{"_id":"@parcel/babylon-walk","_rev":"396-a4e095a009c16afb9fb3c4d28577203a","name":"@parcel/babylon-walk","dist-tags":{"nightly":"2.2.2-nightly.2609","latest":"2.2.1","next":"2.0.0-rc.0"},"versions":{"2.0.0-nightly.1765":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1765","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6c1b47dae095e87888308e26f35ec57aa823ec82","_id":"@parcel/babylon-walk@2.0.0-nightly.1765","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-Mbq8m68TdIz+UqiYzXI3mkxu5iM0TaZeblx5aQoyLMyM30O++zJR+AsiV7zeVABeNt+nlfzYSxfZK83ZZq6wkQ==","shasum":"9c89a268e983dcbc58ae83255656895f98217ef0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1765.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZDbQCRA9TVsSAnZWagAAsLAP/3nqdRsQzjEP8Vr/HF6n\nNdjDmJG4wj3qRiFsVNLj+7+Iecn7hPNMmxwmoBQ9tcq8Ri2YXWaEQjGObnA+\nskwI222ZkTiNlNxE94HzwIJh6ZAQnED3kj50Bh7Rl7HsZLw6VxMUvzdfS2mP\nfq6Lt9WgxKCwJu8HiE8i0O5NvCtebOFjleWSrfHcyuX+TtBUiN036FLuME8m\ngM4r/iW9DJtUbycnXVBB1skBqH18Iy/z7EK9TSvkI7ijpENQT4RTPM+Owkjr\n4oLCtM/tBxrN/6f+wo3PTYZBJK3P6Nx+u5TDnIXel7GJIrBNHbFl7ErF6nX6\nFkWVSeoPiIqBnFCQCKuLoXst2r+HSN26nJkCB4gbSyvQLAB7xFfU/dlzB0nM\n9gCl/2M7TAfjnK3p83LzOXULH/EaDVKWfdgEfWOePCBblEtJqqUhnsCIpcZ4\nW0iRvv9YKOjpPOPqybsT/FORb0PdA6s6cgqBmoUFj91wIM4NmHLpI7OLnWho\nLut8nOQiZZE+Str4NIkNbTyHBYetN8n4AkzPKocLnyN3sfZVci4MEB3R5+4M\nn3Hx+W8QQrEECbkP2uQikSO1ufT8aBOzGIUW4U9MxxnM2RWNXi6pnsn4Ofeq\nMa7cAu3Gu09nWvS0VsMOdOTewcFP+ad5B9iPjPBVY/Rn7Ea8e2zvCYSkriFP\nNmoD\r\n=TK7G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHN6yyhMr0bD6Mq2hwkbU/yeG1ywM2RvmDuMU5Cc7FXVAiBhxwmMsDqCBN9CyvIrL/aM1vDgEpy8uELiVduauqXa6Q=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1765_1583625935432_0.3823964561018691"},"_hasShrinkwrap":false},"2.0.0-nightly.1766":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1766","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"dd76c9c84ec223365f1a39b6ec8e68dc16a3a31e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1766","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-lF4UDCj5zFsEyY1QHyb7kHb7tPt5nq/wPlD0C3XprjlIivFhxwu1eGfreIg22qLHCPtPme3IGbfBYp8Lrbn37g==","shasum":"17385b23429f05e9194e9eeafa4bd0000a047842","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1766.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZYhGCRA9TVsSAnZWagAAK3wP/RO1N5Iogt74xtdnaSFp\nYna5NCnwilMOrBuBbnoQ0EhKt3dL4kpZ42Apr2jE71ZDBUuyyVeHQGSiRdGa\nHD3U5AI47UUuajwES8EldKzK5CZJlUqU+XAghM289zulzSYGxjX1zWi9usBw\n/ho1y2jfn7xH402iuN6KqBlAmi3AvXTCUx+arSM4CcvWdnLI0thNKNvF2yqX\nX9sJr4MN2KtVUY3u4CDEx8lTVCjHTW5V2vGZDyyTuYJQe5tAZNBdGtJuTRby\nKhzOIIlCTKlnI1o9fZGpBXUDOfqVaaHBW0EmsGo7B0HLdxROuoGnRO9t8l8c\nO2xUJsQvuMqf+sI+mwdSfLNc3cJRoUQJTli0jsucjFxSIlUyBA8+AjwVbwD/\nYJHxm0WIV0FIgBVu0j9y0IZsnPiCoKAdepd2JODwop2N/gJRzs4fObNL3alL\neN1XFOzUezJgP9Ak9nBf5AMAY0YvpmQB4Co7Wp4UuqYUpLrjNvxxa+t/84NP\nSkqL6wok+VK6OSCFmNZeWF5kb92aIfCr8dzr7wSmuiq7OGPliUO7YdIoGDLa\nk5o8CXZMqQgtJi+i/+1A72TxAPAxhU/DQ6eMlUFqjpd55DnepaSyqJX0L18i\nYlBP/3indDn07GOuBNqvkJ4lZLm4MQUN3PkLBIyytNrbiGufW0XR+aMpu0NW\n6cRm\r\n=5v+6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGOhhRkFe/chT9ygHuf49a5vqjMzacsT6Wwu/j8G21Y2AiEA88Vm+9XIKalIz2bjvGXI9Wfn4+wOwLo0e3KzaiQ2a+o="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1766_1583712325820_0.18465366934847416"},"_hasShrinkwrap":false},"2.0.0-nightly.1768":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1768","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f2a62434adbba86bdd56774833d70d7852988ed1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1768","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-XJvu3MeaAuAbFX5ZPaY4QMAqi9+40YcQh0K79hRfkX9oiE4WJZTWQzwJFBum9vxrZVPU0od8kuu3k+ZzmdQFxQ==","shasum":"ce57ccce8558a71825129137078b82c887006645","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1768.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZtnACRA9TVsSAnZWagAAp48P/38OdSx4kGHP77fUdmBZ\n6PO0FuF77m2XRA6y1BOyWI/zGWWqVffNu9LKqrZQUvbo71k0pwA8p99FzGqT\n34VIibXgvsGbkKZKqVtWttrtvTS9vG6KLOFCOHVVFj7o1mL7SiHomSNuCgiP\nLxQZJFIqEpkluupixGYfEm18MC4zqczx38hIvzaEQHTbMgyrgxSUOGct7EFn\nGlNy0Tt9gMb4V0j0WxLKn1yO+7N+1CRfzmRpnA1detei8q15YTVHUrJnhdI6\n8ZfgIoBzHSgDa9PiI136VgGg8EYsdsbKn7lKCO/ZuvoFkmEFk36kiqrm7IfN\ndWV8JH091Sn7G9ceEMkr5fD1RJFTpvKu66UL4Y6HfoR+RLvONiI257RA+eoV\nD/SPkKRtU+DoTRUfqpG+rDHKSWybSm1QBattCAdOCa2dc634cRP4ANMi5xCq\nHS61g78ejRxbb/C4kCzyeb0KjndfvZKedduV77tylQTLDN2aRHhMWvjTHKuZ\nmYq5MJ3PF7gnmBWAvydvzh3Ud7uCExDyVitpkK6M6nfNjZ/CchBnqqmEe7yI\nDkAOEufrrGo1wb5/crQrDPotoIt8slrZ6eMRtFartjmxZdxSkMzPuIzOdUxg\ns2ZJdYc7WvE5KQcL7zumq7Nbdnv+04WPYWpw7CEuqYEFc/bAXJOKTZSVxrNb\nFB4Y\r\n=0AaP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICDvAfpuuJmG+TgkI+3zs9G2zGjdIy/S8vA0ltCHq5eJAiBwxMD/yYBd/bJIdJqB7MYvZR/f5b6BBqxVNBMsIPp3QA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1768_1583798720332_0.5967421116497091"},"_hasShrinkwrap":false},"2.0.0-nightly.1770":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1770","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"da3cf2a5386d71d25eae5418ebef5d9bfb9e5d62","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1770","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-rhtD6LdWFdxoOiRDqXeQYEJyUOazAK/LKoWF0reuZ8NIyhPlFBTHmK6OdpEC/uJk487QsEceQMmRVwgPKiq3Mg==","shasum":"9f14fa9702079dfa24cd20f46537644fbadc3f51","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1770.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeaXyvCRA9TVsSAnZWagAA+mwP+QEw4bdnvc7tQkX9RHMC\ndRL3fADVaLZ/2hoN8eOLVZk23RhIxmAPOYH9ZlLHvzBGVz6M6uVC3WgUteAb\nDJBHe2ckG3KiSGi+RrQNIhyZqZxn+PALEoEfdrynKsL4dJMwCK6j+/O6gM/X\nigfMiwo+2dBE6qeXWeKqAjdZTYsGxR2MUPa/RIfynljJ3GpSZINs+7iyQnxG\nzSjHDfAJkZUlS7zkEkPf0nux+2+Mf4I8Tg4qcmX3HT7T4ZWJg+L/w05icKTq\nu0zaNl8Uh6cICXGfh0BwqNwzC8MtPfOv0kikG6d1EyjqKtMKfPavIGqnK1h0\nIRAPb38oPuTO9Ovvg3SDfm/9YtEXHSY5Y4tA9JPpAZGn+qyd8SVgib6RcaRY\nR5e/pftXo9HbnSV35jhlbhaK0i6MnkDiHJic16dYr5wa3+Iu2dizZtIjaXQi\n1Zf72W3lxAk/DU7hZud484Wfobv8wQqDrRwzZh0FU8pwPVCaKOloMohSMYYk\nfOCXYXmkG2EjdfsM0orCrbVuaH6mHD8lu6SnQBo5zV28sgDI6Pwp3hDCQXU3\nSNb3mDXBUWKYATrOJ5HhBDBE8/LTc9BRODp1wMlUCyEi+tQoRQLuMH7XEx2h\nBsGrMvYVkq+7mXM0DQ16UscTf3AXfIb9BmK9JBV/I/gC+i4EHaj2/cadvilR\nvHmb\r\n=bYMM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBXTUZzhaHVwKIrw3Yq+7IxMBWjm+2ParYkab8Ma9KnNAiAWUx7IQgI3Si9g6PNlGHG52YIIL58RxsB3hxuUcDSS9g=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1770_1583971503292_0.02373546398527404"},"_hasShrinkwrap":false},"2.0.0-nightly.1771":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1771","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"453f7b0bf295e6a7cbec5d24fab4c48e21e6168f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1771","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-D9gfzAs8sAowaPTsshIiPpBqb6hT1ieBaJQH5jSu8yQ7tlXqkJztyCtdoTQaAZwiQq7yVv8woDcSIgFlUah5Zg==","shasum":"e023dcc4bb2f81cda63f4d881a4d009ac7addf4b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1771.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJebB+6CRA9TVsSAnZWagAATiMP/AlS0D4kMDO2tER7YuD9\nwamzrJtguZ6Hj8Krs1vNF5w2CFFPVR6SJQAwF685AAwBze6MphKXtj3s5gn4\ntkg9BD+1B1emBOYzqhvAsKfbUr+GCNXiGZGKkEOo2qWjQEOeLzxhKAhmGW3E\nsLmfGXR51LyK8yiGXX+tTQKFCsvH311E+ofqt6vZkGHZyMP2vKPqRhWURJ5Z\nNr4XOdNezPHI2uQWxScr1Aep5WpG64za/k6vBRcBfwk/peQgjz/VpphWVaTO\nsCw98RSgf9paPgIrpkHIP87fwCSqP+g/JZVEryfG0oc1PUfwYc2fZtHiMHxO\nLNtFUWLeDTQT8DLFlx+MkCow0yYULzCYYD+326iCZMgqHmcqawopaFJaQEd7\n5a3LmUtWibykUKxhd58yEdRTE0qJzLAzIbtfcXIEc72qFpzBGvIR5oGPXMK0\nGjPewbE3SM8ZiNgFsQdvNw7x+6BNunR9WXjIR6e/CNlLx8wY2J/GG2lAqiW8\ngNdyGJY/mXIx+/uspbbdWJSqCOgEGHA+p+oMGwcEAVoNsoiu1Qn5dEHklqGc\nh5kkjTofoajlQWSQZhaVaiClGc1qXbr5VxoBSS60vCICuzRm3f2Jie5CO7Bz\nHemHFHFcXjXSmcbT2ebex3Tsz6NqYO/CiQL6SistWi+xXWY5jc+ApDI3YeoI\na4F9\r\n=azZw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqk8Q3qFlZgxTvHpHuk/U8zKBaRhlrzIIOOEG/LX0vgQIhAPQrJ00AAyVbBJVPp3nR1p28xyG/L6b4njdAKZdJHc9C"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1771_1584144313765_0.6239802980181326"},"_hasShrinkwrap":false},"2.0.0-nightly.1772":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1772","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"2dc32a8b3f2113e01322f67bc5bc370bcd7be56d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1772","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-IjkWsXGqLN22jOHzJRArJ5/M6HyWZOB7vT7+lb+oEimnauugtCJltG0n4gUxxo7+mzEn8zxN/Q5kfC4FRmB/+Q==","shasum":"7fab9c79f6e78e10a1fa709048b6a3adc6f4e7b2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1772.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJebXFPCRA9TVsSAnZWagAAzgYP/Rz6CACMNnQoGvAUy4Oi\nDvUDXPqiF1nGgn0DyO7NS8ACNodK8pQSAd5ePOccPWaUV/3es12JvRCRFcOU\nCt/ED5jmEo5mINe5qBSxJfx2ncYY9bt/ScQzyfr3feDmJN/SBTzhVd2R2RdX\n6qP2qYoF0RtT62mdfnClqT0uW6P0E4DFT9prlbT19wBgPxVmY8XpgTcWA+ct\ncpi9RTiYe64VqLqdXSoHwmDqaGCkFILviZYwDZK8IBozUWuPDoL5XhCgkv9g\ngnLAQ1j9amvRQ7T37hLqYArX6WRosERhYij1yTsvnFuGRKgJh/UGheaeYsJW\nI8Ev/KtkcbphBTcOT0fwKXltBUrrdRyeuzE7VU0ApAq9OrzwUoRPWJEJJjpA\nN6zj1Si0RwvM9SDoRCuvUWuh7qqAKIGBNeU1k9vxUn364kTKrOHYg/xwZs3D\nOEeVmf9UxZR31n0FMuQLvVhNp7iXg/MUq83XgSdj3snRdOCo/BOc4hcP7xx8\nb6UnUC3wBIUjgfj7IETpAtmBaPr/II9trYn6u/dhF2QFVIlAgD7xv6YnUtni\nGOACfqjMHV0Up8cdxmGWDcWXEJ5FhD+TfSaZEZj97k4Ge04Fj6hv/5VqnVFh\nG05zTAyi5zH1jZ+eMuBmkMXeQXSl77ZWOFFYmy5Gg5/lrKFvm4qbLIw1Scj1\nwy90\r\n=5V62\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDP6NwYDGzACg2SJeTrSbvZxyGsFwSHqS1tIOO5/lFisAIgFR05x9JzAvP8aeJWNtfVblyvauY4xo2GwNDmudeU5CI="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1772_1584230734573_0.9454191373903695"},"_hasShrinkwrap":false},"2.0.0-nightly.1773":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1773","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1af603e1cfab014585ded8aec4d3dcdb7e685987","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1773","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-TeZxD7n4N3j1tbaFETM82p7WJJCn/0WtdB9Wpd8m/om90ckd65uBn7ERHzfogFXIzcdssoiFscLtIVezz6d/cg==","shasum":"73e283e329b65e71b47dd7e7b9f5a9c514c05615","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1773.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJebsLbCRA9TVsSAnZWagAAxeMP/04dc3CjB1r+WCpRhX09\naA0JuPWE+AXxySTsBHvZ5NzMC7TDs5WnJ2G2fOvH/RT5uo5Oc8ltzOP4cl2+\nBz7psNcUGtWHRXT9SFywf9UgT2gEWY/mXGIShE1X8UXyLs8m72Lhvl+Pg/6h\ncwOfpNRWltZGdj9pYtTIWjZMSIC50cssuI64xSg115vpTandZmqO4LgF947T\nKD2Iwr5DWArT9uhQNKMzsq9w+CD2mkFifHHNyHRPU57+NtW+krzzR1trC06R\n5fcolh0R8esPW2vqNEfSOnijCDSSLeshsM0gzFg8Q6dWQcelO0F8xHpSmlQm\nFfTgiihG1YllCMWIU97ag54SZeJO819YJAuMyOVMMiBj8gqytJebI4oNkAww\nNkCOYo0FOOBBWoDrV9/3vDsws3G7rlL5JrSRAnktlxMHRiOgdTLNpEcWSZko\nnem0DgEVe0prhO5OgpHNEhiNNqHWaeB4Pi9Tijjq5aAhwzaO4bMMtlFKX7aA\nfN/HS+mbMdpJDb9D2r0qbmOGnKIyBwBtr0/X3cIDFjbh/f7UuBkUifukHOkm\n7XZR1C0rENNkk2gRt2H+mtc9LHYNEedryYfV46QvnkL1FdbpjyPMV9ClKdUX\nynTnWWIUamypvaXfKrMzIlitgV6OvsPwsmeUITmG8WsqteTQGj/C6fvwzBkM\nPtof\r\n=iR7n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEJuTFjRLqNPMoX3FId0m3u/5KlAooGiiKX8kNjKStTgIgOTsLKUwcojervs1Z9vouZDAJ+1A9OzLrsROiWx/RvEY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1773_1584317147172_0.6566135581955472"},"_hasShrinkwrap":false},"2.0.0-nightly.1777":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1777","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"9007d6ac51a44cca44ff216ee103baca76be5504","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1777","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-j3iAzx22naoekYtMG+U2SYJdlFjKNGlQEAkg9AMIBuLNo6ZNa7EBYubIoZ1zrTqEybiL/QetlW+V9k7KdOi34A==","shasum":"6e3e6c50a3302863d4912bbcd551f74cdbc3313a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1777.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJecWW8CRA9TVsSAnZWagAAtb8P/jEl5q0/StDq52bNf7ba\nxIoy74Z4MR8g0cOLsDW2uRuRJwu2iCdaeNxeRedrLgMQTxsGqPBEhPbvrbQ4\nRZrOsEZ1FOHNNuw6PSRpuG1qu3T7i8iOi+PRrPgq0Q244ecV2zT21tYFr8XE\n/4jih6s12AuxTMIC06VD5/pygTbw9G7ZsfBKZoDdpGIH35fbBzD/osI2QTI0\n0aZThmDvyvMDA/XnYM3yGp7EMhCIg6KAYBxiKYoGH98RTUWQvuFPnXuix6wZ\nQZtuM/E3Z32NRnr69lkHa6E/4Dj55s/xGhMyBQgrrk3I4DWpt62C5kAQmQFP\nyAUfhjkb850in2tMBUFSSMZy3L/9Xj5YyjFtV5W3HRS4KCn9UzNwKJtM3T4K\nbVi5gHHHJH5QB7MQDDbjX1S/rdiSovi7Bl4BHgUFeuwOhfpqVmF0mv9vjwq0\niqPqVafC7w+a+EHWY4ZbP+TZhD+zH4Sbt0wFfU87O3HG1d+x5ok0rVCZxvfz\nb7z3NWDVCtySwFlpVEy9RzKPF8/JpuVz2BZrlBrXAlpHOwnwC/+yfbV52MVY\ncDrVuouibDaVPw6QHrQcgyvQKXrfDVgp7CGBC1Ipo/o6Aqb0sUQy7TyYprOB\nmWCF0qoOaSpIg1bLp+nxh/m1WubC3rWOmY8xCBiBdY8aGOOxheNZe0RH19QD\nPJzS\r\n=XZ/4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7vklaC1N6qQjIqFB499Bhz9EFl1MLzPpLVSGXxgTZDAIhAJe7IWSxpnfr2YExQpkVi0rfdJY2nNodI32Kgtu4usRb"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1777_1584489916499_0.16567585514300265"},"_hasShrinkwrap":false},"2.0.0-nightly.1778":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1778","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"14eaa0f4bcddc79efa3ba383dbd0726f16ca0276","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1778","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-7FsXhCe3SS328IntaHXa0i+fgG7h8NiWgLvSDQhKUNYRm637RYIqa3k41eJTrrgDrmE0wKl50Y/S8UGwfslNTg==","shasum":"6ce4ce9c1bd1eacccd3ca3f32d962a57b3e507c0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1778.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedAiSCRA9TVsSAnZWagAA9ToP/RqHjuvEhXdGA6Rf6uMq\nO6WGX5cMgYMsIOABoy3rxIb6TW1tACh9Db7dVU900fED5XX1oTi3Tit8Kpmt\nghq011TeBNjpZrebEi+jEByYZ73DCQ52RZq9ZhjAvj8ru0a4tchg6qxRY/R3\nvtRW+N/i4oXKEcIGuI721i+3XSdqkyEsAyLC86vAMrMHoIDiZZpP08wabRuM\nx13knoagScGyFG+UuarxPbZQOUXDIugOHPX+P5XHaHRLuNTbN1sKQ4NJv9r0\n/98oh/OGev5g9pY7uk4p2ZVl6mWd+nx/DO61AQXNYrz402HMGiPEkaFVQ87T\n7gKdlzs3fd7aGQcLFLK+6kE1pXC7ZNjMMbzXOKWm/Yj/vrRNs6bKHUVN/lsk\n8jTSC2GjR9lbxlhZJEqSlByUOnsyXdVzI6pX9wf+gSVGUdUQ0DXM/UusD7/D\n/aldGjohmhOWFrxK4XbhHqPbI+kOUlTzK3vjxTPWEiEoi1lEftWSFUZ5Tf9H\nm1dJtxnFdSS3Gklp53S41azouCmO8gzj1/lwq9ZAyoMtTTNg4Yequ7uhf5PB\nQEKz7JWcmZTfViWUE8gFDwoeUSWs3sJ1d3V/hn45GnvEpwu9WCMF09vkyqN7\nbfJ+6IdpuqRDSsAWhbWeUcIPtl9UI+54NwJZ+Fj8/7ELanNTBUc8lbm9WP7y\nlHZB\r\n=9/tN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC37meJFCtJX+ug45wTMM+zQslSWBtUaB/MZmiUTw8aAQIhAODSHXqv2i74KvKrSA8XIHTqyUv+Y4/IHA7XGKUSDOtf"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1778_1584662673558_0.04469184972147611"},"_hasShrinkwrap":false},"2.0.0-nightly.1781":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1781","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"59d4d6ebb6765c5833c31391b6cca4015c88319d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1781","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-WBFOmn7PfxfgDDPMbpg0KPsna91SKCTxqp+W3TlOKXYDI2/kJ+55BfhqlXIVR+fylQRHWFGjtZjV/3BeCf9KjA==","shasum":"c9a2b316780af02a3dbea2092c4f42dff0d4b784","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1781.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedVoHCRA9TVsSAnZWagAA6yAP/3Ozdvrw6hUViBVV8Cvu\nH9UpnDguZDPgraqpG9ZT1wkYzdLtMM26AbL4a+vNdJYQ+1uwMYQNIcPpMHDP\nm2ugspp5Np4XKiZ457riVvflIrAQ+NtOoPeVqtxaGdKGFb/YT2Wbr0yKefeW\naOfYac0oxBO+1s1UyLaYOWBn4LdywMKDd7DX7ya6s2qmUcQq8cfiqJj2UFPw\nkVHsSl70Ubh1JI4Sz1KV6YfqdNIkqpuj8omKGu2WpX4ft06W8kd0gzvEn0Mo\nQiKhDrH+7C5U+Xht61v9pq9RsvWuYVWe4Q8E7Ez7HWfl53nxgMYfFA9YcURm\n9RXjSolXqK+IE1D8ez+6S/W6+TjGtFUQcBHPqhGThBsQd1Br9r5BMlaswSoq\noE0q0r3BvmU+llyYa+TeXFAdOsKQ73TSsaqIYworzQnR7gfOKs93DVfx911M\nTlAl3dFFGoWy0/2/Qhqax+LVsjtaYGk/KnQlIy0CNy8cLtssB0P5t6d4dLPd\nBpSpFc1e1n/uVJKwrf6c1Dm5qJ2elfto9QmztR3ikgq6xE4AESEnhmm+smOo\n4WM68lw5gUayghM2po07gOeFjISshPAVV6eKPrTg0Vbf0UvIain106+l97UZ\nSlrTt1Kpw88XACRU5V895gggRUo3EmhLQagK7tiR88ZJ6Ts/+95dKCP7XX8W\nDzzn\r\n=FK8a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAn4AQe6FD2B0els8oRa0KcfbE4Cw/j8lxUnPFq7Bpc8AiBV2uh0cVexMgmJPxNOK9avyIG4ekGHp8cQuFDz+3tw7w=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1781_1584749063149_0.07531558193583932"},"_hasShrinkwrap":false},"2.0.0-nightly.1787":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1787","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"161837f71682f13d2b16e7396e82eb620fe06e4e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1787","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-NmaHL2RapwtL5FUxIOdSgSYcJr4Gn5iChmitUzadcKnoRFu7Mf1NCxqy05bcP1ACwe25Ccpi0CzA5Wwl0zpynA==","shasum":"3b6eb0526df7f25088d07a98215148379a78f98e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1787.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedquOCRA9TVsSAnZWagAAyygP/iRJni5+tEXoJ4uPjef5\nKx6BDyLRz9/lrR9526Sf84m4suiLwsZVbmjmLLmlpOFR0w798sMIYlsCE5k9\ncvE5eP8/HbxWbah4x7Xgyg5lkZdGggYC4CfRX6J01EjGxqEH4ug8oNOVzycl\nkAwHbhOS0Pxzwpl/gPAnpdUGPu1so99afKL39BQ1sIvfYQ3+gU/walPABmQJ\nXI6GnklgnAen3XiGnwN6ol9bkfgUIHIWeyVWeDLehgCof/jNTd/UVx/4ctv6\nKsyh/qK/5MCnBnXcaOnhN3eIevgvxvxxKCclr6GOUlRzsNvXlnReJc9NkB10\nqb3eAFYz/MLPJbNv/6RQa2CZ93qa0nHIj4oNigBw7G/a4jziRjVbD28blUBq\nbkJ+x3jhbCGVWiIbbfCUw32M1WNpNbz5k7iLTTEVuEugZg2GozvDrfbZZDW3\ncfgCC7ajYuDW7mYm5Pi3ZdaOTKRajL9UT6KXYOoNkeGm0W97c01Udzu368Iw\n9EAH9mTc9tpjPzpVdKOyx87NcboIFagMm24vNHqzPxM9bIU8Y0L1uuQVL8lz\n0U4nEMeO3x76Rp/lVYto00Ch1G/cx1/HP1a5/il8ZcWMugYtbErKV+6X5vdY\nmQa3D2GAmVWmnZYE+0TBpWBEo/c/UJu50AJtsKpHXiWDjYfIj6TeIn0E+Dkw\nwiT6\r\n=t5j9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpQluiLY6hJQv1DasXLdK08VPQ0qjCim2EQmXnSN9ykAIhAO84cNWKZwblPVSbUMHj34w5xDszCPXBWy3a8dLpWm9T"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1787_1584835469538_0.06439868993045872"},"_hasShrinkwrap":false},"2.0.0-nightly.1788":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1788","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"76c5ac6c8dad3158dd0bd6f2a7879a73a80b1979","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1788","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-+doepSpvSMHyH89Rga/c1JUkctOipBPn8OHDN4GhNdnMBvOw8HmhE/ty1iLrF204nFRl54UH5MK4wtvCwdLubA==","shasum":"3c318257b1f2e14293cf77e288bf8df10ba8a561","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1788.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJed/0KCRA9TVsSAnZWagAAoGQP/Rt3aluZherTd5VccAV/\nW/ERzAC0LlY7Jan3zSK06ITQfsK+a6or0mNCgXLbIXoKWfa/NIYGmg9SAv2G\nxR/zbExfRqWhBvgAib67ZaYZxEPOhLAtBSCYfdvxYtigIw9Mvufy6vtOo7xQ\nxB6Ggg7YMCCG0DRw63yEDak3poMh3e7bhaM/WcPf/PzpipCQw2OpfbEJKgTT\nO+xTYV7STqnrUF723VpdSvBcL7wuFrn2AHWz3e05eEWJb2fe5jC8HLzqPx6m\n8kxiLifqfhPESwW12uC4+1iRNP0vKcEpRkOXKFLDNQwH+ey1inwI/0pnynRG\n90IoCccjic/TMkNS8fLTHLnulgK/NaQqSvaWQ6Wwh/p4H8w/wITq824aveoP\npnmvpyFXMR2DYKJd1q+SSu11cIRgflDDaNufqAj3valMIhhQ5Kaz5dImsnhp\nADcaBh8SYokDpp3xRXNCHw3838KVDk0VlSIkCIdwC4c6gs/5VGGA9Q9GPry/\neLxmArNEJMQ+kBno5gGItS9oBiauFi3xsTqlpwtSM3DKwTC+/G/sobeuGsAL\n5SIf8IcC7Kiv8wbfutF3TYsl8DGN1RdwXbZSafsP/AyMi9CK7oQKebrmMWgO\nIfq+9xQaqe4BJJgCAED3aAHOQekiaHZA3IjhUh+VhtLSJPOzhUXsDHUxe1hC\ndzbk\r\n=VVfB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPtDIWzCTytS185GGBmSaXWNMhBpXHUs1PVgcmSuH0cwIhAODwTQBOqpe6TCETxWtxsHt36SGh3UpN4s8aGn8FyeSA"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1788_1584921866297_0.6469283420312906"},"_hasShrinkwrap":false},"2.0.0-nightly.1789":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1789","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b9e4105c50576ed22a99860e08e65491d4659a43","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1789","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-WrnXHTmt/3VgH4/DoU6tyRb6g6r2ffLFa6bkuqndUTyAKiH6vEx5xFxoNxufJ74V5hrUOysdb1Jjr7/6N22eNQ==","shasum":"36eebb2806b6e110c4ab06f2886b4a16390eaf65","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1789.tgz","fileCount":7,"unpackedSize":25951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeeU6UCRA9TVsSAnZWagAAfesP/3QEecXEWZS1XV2eaer2\nDD7xJw2E7FdS6BrLm8H341JpEOzWPzx9dobA5zdVQAhvuKKYQ9K31EcQEhQw\nNNqN7z/M6lUWUSrcGZ+Oy7gA3isqeb0130Sy1RPdkpxM3L61o38ICIMiFbxk\nqKC9LHQNFTY+Vm670S1b9yl17Qr2L5md/U3TBLgnrWxogVosGgeti3pQbTem\nAaO5Fyl2utWPRC+SYNwlQAfqGyHjQ9zQjNkIfxQDx7NJ0V+MzGdYYlcFQC9O\nO/N+sv++nBa0KY7nR7rcHU6nc/1ODUBQL/4+CL5k06dCwUWiWtVaKWAx+K0h\nfY6rzZjjzsWgwnyyUsvKpMjvyB8cckVifHTev3RAUYC6ZY3UdjPnkBx4+0Fb\n0bDLZqLE+sV3R4UnXg5cZ1dh2E8sIQYUGNQSU1Cm5rwjhr6GgjTnXnUiP7PM\nkSZXo72YV0toU3N6oYfYI4dfXDf7qtnTCrrHdLOWV3IqT77+zPV/yNtDirU8\ntuBasTVAtzQcDNkIBnUkuW3Ha5QOFzhZqcq9tszmDbWHkwIZkxuUC5yo+Z1H\nch2YXLcXx4fF16syL0x5Hg15/R3/fsvTSfpIw5hhv60Oqbb6gxxas5Ztett9\nleAC6bt1CnJewOSwKbnxsG0kejBPcQibbZjElqhzYJqSedBAuw9lATzMRsbX\n/FRt\r\n=00yT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgHT+WPGrZebjrrKzwr6wyPmG82NeVjrmqVm4PKdJNBQIhALjldBJ3cWUe2q3OzOje0WrL0Q4sle3G2CIeIOtjbN48"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1789_1585008275553_0.2861291770641472"},"_hasShrinkwrap":false},"2.0.0-nightly.1795":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1795","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"bac3f05fa31574338f14ab9cd2c9bd78fb1c22ee","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1795","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-D4U+/EjWQbJsJYQ/hCpPhD2+IbvrlExwZg31qyk8X95pB/YDWhlGFDaMHLgQxDasRMPod/eE8qy20ppfRYp0eQ==","shasum":"8d08f2bab28dd0976315c4fbaf1217217b9b4478","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1795.tgz","fileCount":7,"unpackedSize":25887,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeeqAgCRA9TVsSAnZWagAAqmMP/Rg1FcsH+jUFvtFmvhy5\nNQwlvsddfpGzTR+XmP/kolsGYvHMhdShy/xi1Z42Mxw1kw+Aq9D5WnT1KzEN\nXRwvnm1TfzRNMZPWMb09zjvDsNveYOx6FbCfGDJZ2yM+rgBV9QhiK4j05Eie\njrgk+CYbWek8tkkQbE+jeDpGkTMeEFVsgBC33kAxvux5iIFbSGA8FV+aqe74\nQ09YvUTWSGOHPUrL9NUB1wzibWllYslOYfowouV3pkKsWuHP9a1lcGHfC25E\n06rgD+RSMTw8omzMxIJR4ldrV615b6sfp05vobFavbbi/BgvuE3uExpkC/q4\nBhcbP7TMFFe/7gw6g5lFAPpYi678UWXD85j9Y/8hsOKWTJ2YbVoJP1uZ6fMV\n2GA4L9LLU3RJwkZV6yLKplV0l2KsABaHEYi9eSsQen4xnzrDDzCR14qCcjrQ\npsVErEgUL5oY5Jlyp1faUfDkb6Eq75iWQTdN8f8KW5NJgotaoAr9UsWakdQC\nndq6v+zr0mfrL1XzcyrQyqjkqtZyUTQ43kNHHCwy4Vd/ssuBLm8I8k4YDMHG\nw+UmHrPcBBNVz0wOwNV5lDusx5dy3LuyuSQqYI+SMCgeDgZKxe45lS8P1nj+\nq9XGzZzZ5HZIZizT/4XwzhO8AQ523Cx+gnoxCxbWJwtdeZGzIPADqw/PKXCZ\nacDT\r\n=aXt+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPCfD7ZEMNuxtAiiA8hP0v4515FURGmgeXJABySFGGxQIgfyyC3iGZffhzWWT5alqWpP9hd8jpfElp07O/AHsEDqA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1795_1585094687730_0.6695189699549384"},"_hasShrinkwrap":false},"2.0.0-nightly.1799":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1799","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"db7e3a12105630abc44058bff7a88eb612f12e75","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1799","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-WwnJ8JhQvVXprCXsNGJ+5OXcrbp2l4luwMnZCqlI4zA7WKyVBxBF2LPRdflh5JZqpIeOHRdnLuNaeV0g/xKBsQ==","shasum":"90733b08d41eeeb1613a562804f5613dda29640a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1799.tgz","fileCount":7,"unpackedSize":25887,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJee/GgCRA9TVsSAnZWagAA6yEP/1W1GlLnMKvM+zndpFEt\nU9V0RXqec8hgrjhNoLpftDO3MgETr1BD9VWN3jtbMkzvmsk5fGVyVTUcEIgF\nmIvjpnEmH+jNv+tAl7o1N2pNetNuw0qBnWj2bTRPJVZW6ySL/roHVvBR226S\ng8hNQY0CHBVi7HOs6b9wb+Mnu/6DElBX4Zyr+F7wzykGCJIAQ7b9m0gLjzc3\nf7s2DUMRJ4inbtXOrfzth5eSfiaQDo33N4UGwAVNjQzig+NISTbsfeubgY9b\nSpmMn49/RqV0c3HWUI0lvqw6KzFPL19q0OefIrQkNxsiSN49V8SSnGeg1aEk\nwWjUv3DLmOqKEgQ2stn8WvzZ7LgU9N8QIQg2yqmiHR1Wr/5FhRt81NT55wyt\nMGnJY6eejVR8UdlU4lkNhjWOTd4j0fVqrz/6d+h6+gntYFgHZX2yixsCPg+5\nDM570DvIsVMaPUTXvQl+q0d/gYM/q9ZYR8BB79MMI7gzI0Q9O5JPAFJHje2z\nekdH0aTOdQTVwWwNRN4lKCamJTL2xwoY9CXCRo/6frgCOV7dEERevO2FSaRl\ni7XIhxatR5lxoXT2wbYuYQY7Bg6urdIL7aJReF3xtO9QqwWo3gzTJ4u2dnlD\npT+nxNcVpQJrBoOCIn4TF9uQt3w159HBpsMW+aWGK0Zb81EJ75LstTiK5cTE\n5KjY\r\n=NKy+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICkOnk8SYu26Tmr2WeweFZsS5+hQA2F1MUcxsp2N7iDOAiEA0JKe5u2ZluAkvAbxohQmZ5bjAXtUQfoGDdaUx1dxBKI="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1799_1585181088551_0.35524145780517924"},"_hasShrinkwrap":false},"2.0.0-nightly.1804":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1804","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a1a2515ff8710c0ebc56fb6dc0aad72b6f6dec48","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1804","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-jgpygrOtw0J9b3ur0nakaUHbEV3ZJvL85OHFd1XPBBfEIVOVXI2D6h47Gpo7DHXAYGn9+C4yzuXmCjXRGPVFAA==","shasum":"bdc9fa663815330f65c97396c2df08181c13c19a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1804.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJefUMiCRA9TVsSAnZWagAAKXkP/jraOBjOGpMdi/DruJAw\n0MllibWQEDVvFGptKMCTSYPvFQD8wKlVa1/OBuXz3lms3Kx06z1+gxTG7lkK\n/QEUhcmR1OlFCttg0ar7PDk2boo1YNoFSqeqDzAl07FmcKafRDTIKlg7fTE8\n/DknZvVEowIuQUIEhEWCRqp7CpjSnet2JHHMV+2gDGSRhirnwlnUXTs3qLBe\n7hFCAJrqetphrzwQSIpZ60SXp6A1X2tD1fLhV/MocYhaCmPY1HlSz6pGzLfs\niKsduGYR/WxYTlTycs2F2FKIU6P7EhgAGT7nKWjMmTcJubxANc2JXpIqYhSU\nBenmjo7gmKa6ttaA5Jy9kPlxM4Y7OGkGk4LygamW/os9v8EoblhxDUyNOQ0I\nsjgbT6fJX3gL18Pdp+cs1jNCeaOZU3+mqDbxJN4tcm8Ng1Etwpn/NVIaYoyN\nrVTHQ+xsCi9EbUESBj0bIFR6v/hPLu+qaZKtG4ajsULvRY3FnXQMHwolzKMC\nhu7I9GNquGkq6BsrmdiGGrzDexQddatJvr7dN2Vys5wkR7JSdyp+YKNSwWWQ\nJtIusHWiVM52gwRSZYR23WxdPdidd/A+HJp7vs6kvLnM+BE1H5JoU06jzmFa\nmd5zrueMWbL2vidLkR22vUa7JwV/YvHMigUgdpt7ro9JU+lBKTaCaPVFOBM9\n/UXZ\r\n=jdDt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBdqwDcntB9Gqbx3QlWLC6KAgTMmsHspTdmNZDam6bRrAiEAvwO5KJWl3kivW8RVyiwV93+CjzzfRJXf1nhf3WAHDiA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1804_1585267489912_0.033767997503189706"},"_hasShrinkwrap":false},"2.0.0-nightly.1807":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1807","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"362922428f38b2ab61d922dc781eeb00eb953d00","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1807","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-X8t1cmhYnQLdFzjIOY79zx42lQJo2+KA1hyXHY0pSWmoG58tSC7ZS+3wJw4LoSrJjR4k35HU2wlc7QbfCeP2dA==","shasum":"2132fc9d3255d26bfaa8748f9bf3dc24adb56633","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1807.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJefpSVCRA9TVsSAnZWagAAG90P/jK72LU2qaMvu7/zEwqH\nYx47+coWfkW1NQiWdwvLVK6vzdw66Bbye8+Yo/14bbDVcU41KyTgY6noHKmc\nlxn+AU+w6ezj/wvhRraqnR9iQ1xXNAlmjTIi+NUG1r4fBIA9ou/noW8GNfGn\nNIiplm8na6ZAptdzoojSntkTMOnryaBGYrgMX1OISfMeqHTzhsK317baurYF\nApCA0pnGyUiVZ4WZofvFmMsurge9DFKywrD6eXS8vPpaGta3tOK88+0FV8CW\nWJT61g55zOP4HmeU239HOmTYMn+nUm8AOa0ST68aIFaBXA+o4cbn97zYnUKY\njMTD9wF4emNIe1zatEXzTYG1C8ptjhviWr9BK92FNvKKqghfsRgCmCJzgx1J\nGWg/wySu1HvQuZLCnqqOs3YVGeoXY5Fc0Cv3fQ83Afj69mrMdIgFAJOkGIsE\nBkqOYwe1d39MpRZY8cx/fMxsbehLc2P3PF/u9r1OpIcqbjqO3AMlyLknq5fP\nbh6NyZTOQdo1wM0C1TouTgC3pxDVxd3i5uWlW+vE3HiKqB8Bq8/OMziGzmKV\nY907BRUW97RKtWZWcEVuMtZDNu6YC+fBHTamARmKvjlLbz4pc3lhO+WpK5ph\nG3y3JB2If4FO++WzqQisJ9Sw6jPpyVpQ8G+wol/9VjulAxDaVdcF/SXeotfT\nfn1i\r\n=Gyc0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAfUGKmUPdN9iarApnN4eOZbY171tP8WTbKkHPjKegZfAiEAmmii8LSDcNTPN8pYEeVf3EMVbDyo+AWQ/1tc8SkcKi0="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1807_1585353876929_0.552831495503542"},"_hasShrinkwrap":false},"2.0.0-nightly.1808":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1808","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"790a2469e5bf9e231949256c1655562c61dda79d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1808","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-2a7sZqB3BXAyzXyzR4o+zOid/ypwPji93cjqsLui0FjEecX5Fajb2Yb0LzpM9x0VH5IePGwJNKAlR6DklcvB/A==","shasum":"b9d3a192f669c86ed630cf372aee4b6d1ebb3d26","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1808.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJef+ZGCRA9TVsSAnZWagAAmDgP/0A6vCT6magPYuifu3Mf\nANW8TcVspzu7tM9/f+v6VMG8LM/mnwIwhN16GT6+KKOpEoMdQzPGXM5XgShY\nedOq9wIEUwI3Hrl+JwuzLRmc1uvn/08+cJgI+nEuneS0hEy3sqlsZJdyaKX0\nrgOpC+4iNbQOWLCf2HbMQ4y70bfb4tnl98jyuuUZSjy2n4dP7JPtq0uq9189\n2kOVH9ZpBfvjIcY1qopD/ehj3YcH1JGdkFVcXq4M+22WUY6VajOwdT+9D/77\n2hKC3gA+BIIGejpoW6YE1aGKOXakENLJo5OIFtZ6Rwp9qExPf14tp7QdpOkN\nB45aegm10XrEZD4CQQhfmjeSrYTxu11DvpndjgHLSaSRZtAomF5DaKiQE07P\nVWBUkDNuoXgRrr7BA13EJN680ZY3plhCsx8bkOQRnzLoisM977jLZsUZ27jH\nHAHnd5ocq0ebkJUswtuzmm1+xhMZcgOiEbk8gaFs0lL7uTuV+vp5q0FSBL+s\n+ywoEXCqnrU62i8MmaSY9rFQLhIpHGghQB0IDF7ZsKDfzLi8gmNTwm4o9vsq\nzy7tc+VU39es2y6OmvO/E0e5eXE3Hu4c16FQrGkSwkQkpnWQHUc0TKdhYUo7\nAfv1DQQ88qZYGMvhdp7SJUbQ5yQ/jWXrn3a+VQEIebBVMrRCeNFdoFAzrXij\naqGj\r\n=yQAJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEGaT5CDnTjOeNa4P6E/PdmuO7GaMcOwVIbQhB53BdryAiAX9FPeJdnTf8yA0z5PUVgiQFpswnIgRzEf3s3oV+ZL+g=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1808_1585440326294_0.5980746344283496"},"_hasShrinkwrap":false},"2.0.0-nightly.1809":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1809","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c34a2a31f84e7293bdbb7fb1109ab285debdb59a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1809","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-ZmnMlTfxvM2vtgxF2oo9jHUVcdVj++CEeXF1UeFzFjyDFnQsAGNYj3LgtgdZFww/0vmoQHwfp2+G10OZIToYXA==","shasum":"58bfb91c666862ee6a7f2c02f824306c5eb94879","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1809.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJegok2CRA9TVsSAnZWagAAq+sP/iBA7VNiA+iHNAt9hQV5\nBc626T6b6JXlJ8L2/vaZuGoytbMsv1tQupGOA9H/7BIqj+t+278R7IShr3xx\nFWkre6H9wo0qozq32LBZRvqV9IzW/ozfhQUvsRtBONoItEintCMArLqTHu5c\nqWiqG00ayQCycy64di8jH/XG7ru214TSbC88xZC+Hk4OBha1E/9su2nM+hnd\ncXAUFMIdJfLX/DoN+CRp0k3N97VHblupsfIAJPJCn1PRFBwVoGHMHVfEtlcH\nHzNceNCKq6pHdr0L7yplDiQEuUKqtg1s7mNkgnAa2RgiNx9xu8Ti0A1KUEUy\nlk8u1IFFflleUJIrrHwa93iVyy0dEEYPQ+nDAw8JU/HG/LO9gxLIUGij/68x\nslvsnsgnjx5/Nmq95YtE58f/e/nqvG60iNGcKBO76RLBoNVSi/KNkgAHm00Q\nqZMFy6wVJm++xGUfMQaqvUxgGq9acw5AZWBdvDK1gYSQnuzBaDB+HUWOqy0s\ngQuxTUcX+Vfg9WXDg0w7U/YrLAPYpYObAWHjavCiGTE/96/7sCirvLD3nnvV\nCjQUMsfNQyRrMCP0Hf5xKfv5yYWsag35ycCsUnV5wA0mVY8R1/wcU0OkZWcx\njrljhJ9R1eVe7daIzlor6kd6E1TYUTxbu8ppSuE+qLCOyDJ+aw8IxA6McA1u\n1bO8\r\n=Wz1P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgPUtzJ1VP04rBR3oqJAEXiKASgZzumwGO+Nvlem09PwIgCqYIUSRjnmjCgwmRTrduU8qtcopxmOdj8jxg25U4mqk="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1809_1585613110154_0.17843052080738975"},"_hasShrinkwrap":false},"2.0.0-nightly.1813":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1813","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3a972d8c9c2333b3dd052e6e795002b665bf625a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1813","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-5jnqkax/ofNKm0M+PvIFa8OboptGX6GezhA1NJL7rX0PgkeO48TMggUdyxhaoe1Dh6DeaFPi909x79k/Q/qAnQ==","shasum":"decd63153adb171814607645b342997c470bef0c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1813.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeg9qsCRA9TVsSAnZWagAA47kP/3bsCUkVc1kZA3GbfUs0\nI+KugzkD09xbh5ZlGt91H+FUXeuSkGuOzDdTjHPpmJ4I9q00iux2HHX5lvMd\nvY25BTdmvrfetHvRTpjh+Ibvb4taZyCocrC/WYO4hGXgqCceBsyEdJCa2UGe\nMfScBSJigfRsG5J5JvoswdXq+Jq6hVZjI+tKPtQ8vitXbf/JwLl1bmJpHC5q\n0iN7HCOjZKLstNoK+jcn5On/cbhMowF+mZ/PvZ0s/X6IhDg4eKtZSniBKb+o\nHQDv2SdrmYlpBwDk0kTvAyjxQX2GALzb5V/dkwEbPbAHtAOM+22clcXzoLfy\nlmmJfrRPhZvqkExkEKJteoLOl7dw+qMiI1Zr6zW3ADGOL/BjhcF5cDy/3hdl\nPN8fe8VVC0FqnfEdF76gSHV34CdBJotkMm8HH6C1qgGSe5DhjKH0HVmoTgch\noxaqgzpRQehGa46dQhbbOtapzIIHlljJhsYuZ6kX87tB8Gd+bs5A7UAHLNhm\nZ9dhm9LA7qHYvBuqDvkMiiWNpQNUFMt+aoFo5xhKCSpL9uypGhHHwyun/dRi\ns3n6dRyo/aLaZSeQwB/hzTwvq/E9l5hKsABFgMFhuIWpspB/T8NV5AbWW6KT\nxDPFvsMQ9/T48v4D2EmEsVc0FSaXOPPZEZdeKumEo4Km3GnokyAc5jx7KF8q\ni7VX\r\n=C0JG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9z4Sy5I05GUtj3tu2uIgIzHEZ0u87O8aftE1BPsOjkQIhAJoLGkg+IGpiK8wMsphHh051BSuNGCKTI8sVEbRralLL"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1813_1585699500247_0.5343925654998576"},"_hasShrinkwrap":false},"2.0.0-nightly.1817":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1817","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b39859b650259ea8977260c73749f3c4ffeef947","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1817","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-50WxpMXnXuKXxqsYoYHUKNHil3lf0/4bQiShxuIaVCPSMkorujz7h6On75TPYD84zKmNbOgUTcBkiPJ0SCGm5Q==","shasum":"6357e378ab486e7502cb12c353a234a54d60b9b9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1817.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehSwxCRA9TVsSAnZWagAAZ6YP/RJwusurwV4F7a2cM8Rl\nBEJ3yIrkFDC5ZcC5xA76d8/ksrGUZzNbRjb6qQ78wNKFJ4Jxco4//XpV7r88\nXvMegaeazUFbQUiqsq50nRR/EH72iUbI7StcGf6pqfboHuF6eph+lvC/0UOo\nr0KvCk/4PCdgvqCrU4wbtvI9xFXrgXThf+/s7fk8eQUA4cwNYVb1nJ2SyeKY\nTgQoBk86w8poWd83PgWqcblvpvjWzHRqtEk/bkzu3MXvzfGMAL0oyHM1W04t\n/e6T+NYKWJHNJOFtSsVNs/pK/fzS9DvGglBJmZY2f0/7RaNWFoQ9ujz36u9o\nYHAIhF6072CvyGfCXYucKDV4HAGo04fs0Lg4D8QkDR+XGi7woztlivktwIom\nw63rHyGQINV/uRC1bGxkqW4h4gEMCUpIVr75ehZEKSDgIQWh8plZED/d4elC\n4h7rl4caRMiRnT68cOpfoGQ89/3VRKZumrcPdr65oANSxzG0QndYk71w0uJo\nfgtWFYhETCxy+vYTfhDPmMQ1NUqEnsjJ3HzStaOo4rj+AZ2fDPB16SqwqnJv\ne1BTnD0dxOnQwtMqCP70PRXtrDmfehUXU/h8vAl1AIYh8Ly+8DVjtZT2ufAl\nuIrtfAUy5fUQb5Ma07KAG96Dw4hOr72QFywktr7SbTIifSJDU/ueIvrotm1G\nruD+\r\n=RaeF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEAWtOG9YrlEL5XvxMN2UR4YOhnWB4Ht5C2wyopraj1sAiEAtoTBcfgIGaT2pRX2HO7fcaMzmuyrH5fHFR2grRdmhJU="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1817_1585785904909_0.698926391636691"},"_hasShrinkwrap":false},"2.0.0-nightly.1818":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1818","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1a1cc60826b23c94998c6a80fb3620a50f1b162c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1818","_nodeVersion":"12.2.0","_npmVersion":"lerna/3.20.2/node@v12.2.0+x64 (darwin)","dist":{"integrity":"sha512-/Wl/ZjoWvnvtW/5+xbnZxsJ5fFWsq6hGICeDV979/MyaWcgs6vG5vSIwLuR1m8r/qYdyjc7aRITaEv6cfmYWYw==","shasum":"166e760cde5a77abe8dd6e9480ab67b7d6e8614a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1818.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehrpBCRA9TVsSAnZWagAAvUsQAIF5VJN4wWm1quhYPurj\n0tWkHVeUD4nDMhJ4KRfGsijXvWg230IHd4UTSD1zhhz8Lih6u2rVYaEPwWsa\nS6vY9Owlet25jFxHixbKEu0SVdndX409YVTYPCL7BITlMjN/iA0rrketfvK7\nGK0DPvqks8to3EW4z17V4JWO+Vh1RZtKRoQfGtdMJ827WlLiGKXSabJTY0fW\nfmhxgNAnjKJux2ekk7XYZgnEM+wtsz9BLZUCEImqy/QaY+4mdg4rTOGVmWSU\nlyuO7A6+GnGe3Dha7GePTnt0DwibQyrC1Ro1kkiqTsE4nLg3iZBfmEUZMqN7\nx4MUK5Rmaxmr21CyV7JD2+qu6i+uD6uHsuJajahH3jh00cRwGycVjHRETwqY\ntKE4xwvkO2nFxsJr9zUkjZAJd3CaZt69yCDWAoqgIWPerOPik8vaZ6nF3C16\nwbK6DQYlDBvOKxsMvt+wUPuEsxhyhixjg9HNzqfPApJ5AeLsjFbTMi8bicAY\nzwSLsnCm2Kaaea0T1Lr0D3ZYinppqVgtcPRDQBzKia0XDvaxexfnplbCFjFF\nkMczCPbZv3vq0P8u5zPXe3iLDMuGl8EySTKP7FsNS0jB3o42hCxmTFuVfw3F\nQ4N3AQ9kGGjRTAy4WuROtbMEau+XaVrkKFQLsG8dZU5WvZiS15yjRKP3mk4i\neT4P\r\n=QDdx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGghQQRVH8ZwWS3a7494Cp2QYTaXxr8/GnlF8Wj6rVaPAiB08m60O6j4E29n+MFfVlgbzg93pgndmmRWyRRCav8aOA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1818_1585887809307_0.7358488155259246"},"_hasShrinkwrap":false},"2.0.0-nightly.1820":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1820","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b326c0dccc2e9948ad4585fa6e4199f36cc2cfd6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1820","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-LQOFuYW++QyE4dlylZiwuBHwSs6gOHuD4Ka/O56KtJ6SQJ1C6tZnQXHA55Ei2Xt01yitmftm3JEG3pds0GQF/Q==","shasum":"a4e557e975c385ba1e42293baf17535b7e24fe90","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1820.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeh881CRA9TVsSAnZWagAAaQ0P/0GyzOGJEqZgIc2UIsix\nFm+s8388fO00qzdHj4TMPk0YYlSrqTvuhl72QH0blmNcdIKAN3LrQlgc+Omw\nrxeDmsG2WnjypvbZxqEqYlvBMXPqvVvQrl9JOkGs2X+pNiMlN8uUegP6j8S4\nQ0RawHXEKuDNJSrfBHsEOEk8CCEKMNs5XpogMWEQegbS5rx8zXEqSoUfQk6T\n3tiGK1d18+VEed2eu6GB1v7V/pRLTCIXgk/uca8/jOD4LbyEFjAAxqRZuoT6\nDAEBrFAjHpUZWWC4obezlpOdISrw9hHW3QdJ43eRpZb7OqPlXjJK97y0AC9F\nV5LZ36++oPr9nKB04piGK9fqJN6mD8siG3lIAY+AAGjE3Nwtv/q6r/E/OUj7\n3grWtVRAZTPhQETGZrmFNkwlCWTN9Ctt2xhQ6v9B8+ctxkan3g9+FUJZHGZe\nBp89v17yy94S6W1wawhxiWWL1B2GHczQxTBmqyzxtGk0ZjzUHAo0psrDndoB\n4maHrzjFbAACKtkzZ3e1aFdrSaO8i9knynfSwz5BxftZtOpHtP3I+DoY3lft\nnLdnIELSo/MUooLAunCuSQXrmf2R/Asz984HWwEtZBLyco3A5yAn1o6HxikP\nrO8htjpcRsP3dpKpySzKGbUMTYzGpSZ3uOMTUxJfC7t9u4ErLKWG1b5oKwi4\nhZWt\r\n=6V8o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZv3eqacWAEaovtKb1tOxpAS7TpN121St1is2YsCuajAIhAJ2YEDSqqGcM/AMjwBbhwegxr8mxOoKbwJA2nKy4QkDz"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1820_1585958709038_0.568753913864086"},"_hasShrinkwrap":false},"2.0.0-nightly.1822":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1822","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f01437e7f646f4aa74a5d3cf48ed7c4f21822352","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1822","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-2IwYM6tJt3GtzX8rkYAvixl40db/PYSZctxl9O5UnYPJABWjXYOvhflMmtAyvpvdR5hYYQmKoib6W0x0c6S9+A==","shasum":"9cac9b09fb667f2d9d57dd1d2d2a0a267ea3c46e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1822.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeiSCeCRA9TVsSAnZWagAA620P/17jlzUZ7IwMrOI+7YtT\nBBXjteFXfwJXoiCPIzMknIF6R9j8Hs9vwQm1FZqRGfSJ2wLUcqcCn5j6AqCI\nVk6F0cpgSq3m6rwYqF0rELHTwb68kb3PnyBmRgWB0orTBY4TOiF1O1eEA5iz\nwAIgyPMCdc5ej05ScbixxXO9h0nkRxecmPp1QIn6aBK+v0nOdG9xPo1dGZnL\nM9SlQtr+JYwHKEC0zmKrdn02XWD2D4E275WHzjRc3Eu+4VKN2jDDPlp3uXtq\nJwE5xbs+XZyNUiSa0k4YV/NBzPSzoJY8UNzZ1CgCRZJqB5SZQY9I9eRCHjek\n55+1TzOjSU1sNglwihm5Yz2pQUy+dC8xLuds3HW8yLv6bw6MafGZA4iD/jCk\nI+VuSMC+fBzMXOLfUUqde+g423drfa8wlgIKSkKQuBfvzfx+5df3wYx3Z6Gu\nAAYHRGqWxPyPxu2P+gyk81iJiRSpfxBHQcziQy9ZcDfsnV1ypUP4eWn17wia\nnApiFBgmVfqfa04EtJ1wo8DDnz4t0I2DPJBDO6ko1FZzWj2vnHvLhz79ZEXD\nekdtMfnPI3b2A3wH5z6SNWurEuMr/0QC/cl/VQjXLjidH7EQP5UXNKmkfTRy\noRCW1oCWU/HG76jiqrd4l+CAbP4jjLS7ZLgXCROxzaXpUbES8DtGUkm/4WGd\nNuPz\r\n=IARc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAvmumPCEgLih/3vpZgpLdX/Y5bg89RYuxS8Z2g8OaPCAiEA9sM1RNI4w02YZr3GNABxyWqgV4RSc3huuGSDMen/fYk="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1822_1586045085864_0.8071410826440564"},"_hasShrinkwrap":false},"2.0.0-nightly.1823":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1823","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"83e272ba8b6fc51651f564da9edbb69576695e2f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1823","_nodeVersion":"12.2.0","_npmVersion":"lerna/3.20.2/node@v12.2.0+x64 (darwin)","dist":{"integrity":"sha512-U/NP848WLbH46bs1pHmTPHT5iWceVyU13fNAu/QElbVicWDOMFyxp8L5XmXW8833vWQEXjkNnbLkcAHXggG6Qw==","shasum":"6eaee860c82209896ce547615c4f2022104c4df9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1823.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeij3fCRA9TVsSAnZWagAAIIUQAJnPkXebkiZpGq1OyLif\nHWV5efKeXgtW3rdLGyvhQDv7QPfXo490rQob+mFzOB+uBx9U+YbgNOmPyF56\n+NdHdxMbUmlYABQNHFxeppCXM9Bdmf6ZBeiqMRnlSvbW01+SlA4/9d9aOAam\niO7BinJUEs19uIoUrZS/y4fRBqaYfdRdpvAOu7wwbymH9VvEDN2nSZ29nnAY\nmoXY+QzglwgK3IINdHggi1topTQP28K2Ons12Y2zrVT6U94Ct5AkZwrT5rcS\naAgU/LcPQt9F5yNbMcDyWXtcLtXb4OHJzmFrZEeqiCzW5tFwOZrvDCA116Xt\nr60z/lbYo+7xLgtPNZxijRiIvkFcMw6XoFZVGpLyqvwN+dn5kdEMWxT9q/9G\nGnKADRLEUC5ciCh4AmjzoeJ60VwxFj91nr7AdYhsS+ebgAqNeId15t2QPNTZ\n23UMdE3eejicLx9s4LchgUihWVl97OshgjbOMZBdzTA0/es3/rvRClA+JoQy\nBCQihSHYwh5EbmMWQvDHQP19ZFQfcOXzY+WNpKT4PySFUuZPjekmLeUUJDdB\nmSoP3Lsh9109dOpSWgCP9LKQgOhqlqj8ahMnZ+lJX/VlnR16ulmLwHCju4bO\nw9o7kf2OjSfJEhFzQ5te6k8YkJnwVEU1KZlJf6e57tUx6Zq8QnWjVeU4fUyH\n0Qf3\r\n=LzW3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwpMu+gyi9nd2gdMpqbOvv/ypc1vFJSh0mr/2LHPpPrAIgTwK4guZcVd48Yo7akoiaz9xTtXa0N0J87ZmaTc3nu4s="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1823_1586118111318_0.2379668511012647"},"_hasShrinkwrap":false},"2.0.0-nightly.1825":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1825","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f6d2a707c932032c39064cf53dd74b2b687e310e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1825","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-1cuBjxY/iggpTHVbtAmD482iVRmczC0ikFkumJyulx8jnV4P9rYL1rqj26LC8W/TZ0JjgHxCMe2vtbAlU/Y48A==","shasum":"07527943c3e8e41ec88fb32abdf18430b79e0fba","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1825.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJei8OlCRA9TVsSAnZWagAA0nsP/R/mQ3sA0qB77kuPw+AR\nGSdGR6t9+FQNrSPJ9F4G1Vqionyl1McajbES36DgXHYVnUswLd3fVISu5Cay\n3MR16FWZiP/e0/EsGv0DbhwK/KmwbsVWocV4FJYzmocYATHPCnxq7jnmDJwS\ndWcoLdZmXU9txa2FDcJiXvGtShvGuafNQ9/KngULvxYmA9VGXjeO6ZdihcAX\nYuHUP2xgutgcJnaZ/2oLuQ4jddEIsGwEnLvPgWANOarH90yKz3cmNLeu6HDo\njlGTNSM80hsdhPNV/BGTuWwyXXg3KnBCrNmVBfAkjH4k/cIhnVdR6euxYpwY\neolhe5Unn9/uKXefXJe4xGXXX5ofDScoag5nJIZyLuo9g0Cm0gnPkv+TyzvO\nlpoJtJvAu/jkM9W6kkCjzHS2h3fBDBaMOemAwkFB9SbTT63zsv1++ObHtkot\nFrwx9toQXeSjZWYvQOShIusnvHgf1bn3+atuPcydmI0KanDNWD1BoNQZqqFX\nsR7anJmx6gC+qKXSA2lAdexNk0J5Dm0tKePNLHdeQm/qKHp6vbRob+cBqMFv\nDRoztKZpgdw4icLjloV+7qutPsr/1CXOTHuK9vLVtE3Y2TpYLLoyqFS1NOtl\n5tiRm4mwY2wfsbTgIhms2OvORCT9z4FvFXRXCkPMpr4ySQbFsTAh1M7l+t7P\nVr4Z\r\n=nr7V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0UB4dF1K0kaqpNM2Tl9e5kvDesZW23JkUSkaiQuhGEQIgbGstM2HoCLl7n1DRyUWlaW9gEb64pZ8nHdCGIgV9IMU="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1825_1586217892764_0.769292979637767"},"_hasShrinkwrap":false},"2.0.0-nightly.1827":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1827","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"68b5050ae0e84c4a65ebdc2e57415c1ed0ceacd2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1827","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-iraoIUsnGmG2IhtQEI66IXKtSUjgV8y9mVvOIYt9DVmiJ/vuZlD0atnvdKUOSRQbmv6tIdJu6nxh4NLKQki80Q==","shasum":"bccf0dcfe8e87f195e1a220751711a24e4d2c6d1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1827.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejRVJCRA9TVsSAnZWagAA700QAJ8WAtQXzqTiqf7J61Bu\nLntTzWKDmYk0xMUJW4pUljwUcew+ReifgBvB2KG/EgJFglzx9o2As1pD53on\n2R8Asp5+SM6pabcCgUt4UcG3NGKOFOzXfdG+4x72ddsx0Z6AfEobnEqv2x7j\nVMAqMNPFN67ZYP2fLLKrIgQM6urDLy9/4XrEaxXZzEMacPC95nFk1Bjojem0\nHVWBMtfskPOYDKD71Ip546i1sa4if5xXSF/kzkHYP1wE5vPjrDLC0zr592t3\n4EGKsu59Ni1/wK6AUBJGJpurLU7IFJ8iNWWLC0kFYkaEcpi+bebx5whWSUxn\nS/QMsDRqc0yOFOBxiIBoyyppkPEjK98+1UPRluuabqavKjR1XtKeXgh8ZDgg\nCoh+PKHP0i04tjkLlrousbZyIGrvdSOphYeZTomuyvJIaCUJf7rmTkK51Hw+\nKMLvxpZIr99E40qlXDrUvHF7vUsDQQ4iv2yb3bLkGyiGTXMG5K51FKoT0bhN\nDE/SGNqBOi6BP4gxQCKOWOKPutQPabl8O+VnFhFLZ/TvJzFRU//PfG8ceQCx\nmLM7etfzgy3rMP9eIO10cXAfiRG5+4VKcPtnJvYJyFdBbRtehVfxQRKzg68Y\n4r8qzYUA+DZJR4B3hE1aMqQ4F4OyCjEATfsXjdfBfhgsbZXLEIJZ+Lw87zpN\n1K1i\r\n=YEws\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyxIeTRx1AaPTv3xIoPnmwYilCY4rIfJOL3F1G8ZTq9wIhALyH0sUdORKOQLilVVtDlM27zEPzycyp5Uzg/ad6Y33G"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1827_1586304328920_0.035810488426965215"},"_hasShrinkwrap":false},"2.0.0-nightly.1829":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1829","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c633aa1b3e33c310b50dada88541838e93e48ec9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1829","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-Rb7s05bj0F+WgnsbVu9W6TfjHpWFfc9xQDyrv6896H774OsIcizlxLslRmR0xMutBlmJ21MPEpWHBPJXUT9aZw==","shasum":"872a3422a68785b9d05a393ceadf19d62e80e1a1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1829.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejmajCRA9TVsSAnZWagAAC8QP/jZzrB9aYGFbEiMqk6qA\norz6VSrVOzw+FGi7A7NZOMNQc+yfodt0xaYJcVhjM2ya/PFx0il+ctfqvRlI\noadkJR0fygmBaxrMsbeRTCvnI4OSrpMhibV406RJoyC2dIUicSQwwpLOvUVh\nf/xNE3PnaZ71T2Vccmm3GoCE6GZhAnrvEiUS8lxcatF58o4TsE2Td6zjopv+\nkFkzkUGXAGEawuLnksiIdPW1l3p3vYe7j2MqR8g3NEjkq5LOZo7f5hYRoLQt\n8hEpMPj6r3/uLsnh7aPqyHhSJx1B1jP6cZcZmwThuf484XahQSXKuIJhyQp0\nz5B5gVkoRBmf7Nn8YdpYZykNDAvjkuk/P4EVNxATZrn1TKMb0gTS3EJluFpb\nZLVxl8Pozg2onrBYolE8FV8vZepulmazxX/jPvK8ZcFYwAV7jEz4lOOwvl3w\nHTrHtRyJmaLYNZUZpBn4cnj6epZbESJQJ3LQPntA39yrtQ0yUcjny7KSvHaT\ndL4d9VR50QIXTtzst/jYPyNtuYyYG9wzqAgeO8xsJv2LiVL5AlBxlM1rFDB2\nVkxtrawtHFB+uAEZCa1UgupjEi6v4xN4q6grcTo2YX3h7X3mX44qmvAz7B4U\n1EwkVddo80l22Gd3jS9uUMp27pjWizHyWUG1hY9vzugMY6BgMNaT2AOnXvTZ\n/N6K\r\n=dtIX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC0P7fGn+cRsvbJ7/GWOtLQ2VzeNSskmJXk4XIuWPkKaAiBvXIsUGbdoe70UoT++sbwDYt39ks2A9CvaLoKHWchJVg=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1829_1586390691560_0.38911158843400573"},"_hasShrinkwrap":false},"2.0.0-nightly.1831":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1831","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3944c6e27dd21d826bbc73f3010f1421a8736e2f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1831","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-2PFD+3ztFTDqAUKBE57/mMk8hXFgwXEvxn9baqeUbkB73hnVMebRFN0FdVl2Zd3EbJWrlYq3O3fsyW8m5VS1og==","shasum":"1c6bda802727ef7a251e6ed2b5398e14bedfe436","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1831.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJej7hbCRA9TVsSAnZWagAAZZYP+gIB2yhlz2nViPz7F258\nxy7bqD5bsZDOJw3Ij6axrKXh3fgMUQSI6kYBQIzpPuju2dzuLyjOvmLc7UhY\nAgZTB6BTYVhsoXBdJ5fLFm/YvghIjAoIhBOQJj6UdEDD8VRIRvk8Z3j4ETDu\nA6EBczqukeoOdapPj/a42KemDMe6NntjA8z73noZiQAy0yRRiVDVot2dNn8I\nWSp9zB/O4lNhRwSua7mXLzwm8rHWbNloyQIL3pmhmJKWDG2b2+5OQ8W+uB/j\no7z/WoKbF5ZZqE6NMTUSlz8900RSnK92xNIi57JFVUONU6R86tUtKsq1BONA\nPkumcSzb3aPsAcgEq5eN1xXbUwZNBKwOyfveH0+U04AVVvg76eAEq5LEsDAx\nT66EzWijSNptMElJwB0ikARGyFTtW9/yA6bPTaeeHdiddEorP5JFWPPgrglg\naXMEC8u3YpqEpohxC2aQHsSCUUW3eCnAo5wKauU3pEV7bs1SKmpBKVxOWeTo\nSTtM6q0ADR+qpXucvw61IFGCP9grTBDM5xzRNFY7M7kkkaLA/9dWjGuYv9WP\n3Ty+zOF2UOQU6ngov8PiEpByBbkYTvRr6Z7Eo4pRlK4zKCay1IbilwYScmxO\n6tlApjjn9o8HcQ8s75Oqs2o9c+6GWyGB690KKuKzQqcR793KMXdu57mE5U6v\n3nW/\r\n=Zajv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICEWJiLUSoceJHmQ2YLutYCyqTJCWzBOHbdjYs9dcWklAiA+l+9YGHz3OXrJ4moqfcDAiQkqMi5x0m9Zym5LencTWA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1831_1586477147493_0.8501375882907882"},"_hasShrinkwrap":false},"2.0.0-nightly.1832":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1832","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"10e18b0a440b1678ef0fdcd7d104a1394a5ed6f6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1832","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-YupxcaUKdadpfiCZ+I00cUR9Y2ImGznlcimTcvbu1fH5vSDv+cfnndYGDbo5Kyx4aLRo9D9HBv/9wyWK/6vpIw==","shasum":"032e805f8aed758d937b7593ed810d44a1890fba","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1832.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekQmeCRA9TVsSAnZWagAAduYP/AlzP1Q8J11s6DORPPLH\nonfCa4S7yi9NIej+CkyCyrVMoMWiQMEDvOmFqy/ZcEahD1fBerHWbaa7PjS7\nElwuik9+FP5sDXl2p85l2lu2PgZrP1jpYZrXOHFSM2rHPi+sL+VCHDC2HkPt\nH46qjA8jKyYTS1Ab7SHy3I1M5iJzLzzWS0gP/hSvQfAmHwBjLVC7SjjjJUk3\nbGf6vkCYP4V/99eHBC6hOOnTr7X3gsnA2AHhpmorLy4+1WtSm/O2a1rool9G\nFvhtHvMhCz4FqSvTMTLGASl/F9opCvim6VLcZnFdSBgvQcFZzGoVcBXA7SGs\noljJj990LGaS2Z6bk40ir3OSYlQmr6fBXqvoDDyOs1HUHbMbZj33LS+Q3kFI\nxYX/Q+W44F3LeFDwjOwAeRPjmaM/d0jPXe3EB2O98GP73qByK+JoBVxgd9VI\njunWEKy7W38rKMvFBnKHWn2PFY2fcONFgy2LK+WsAZ44NxQQMvl756PC8j50\nj2XZD0hYkRF+9pbr7zWn6H84b+Zm2KQGJsLQ9PjPh3oyPG963WA6c6gi93Ye\ncYUtfx2j6MVOimYCtH8A7XFp7iLrAKGZWO1pmO4fRs+mQTY7NwDVX8wDFuU1\nfFeVlSsFXEF8XKym0y5K7JNcKEhOZ13t1jPC8sWMZu4urzq+17GPpVqAMrno\nCLyB\r\n=aHdB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFPwJ821tX4wWtHC92sslqL/CstiRI+r70W0RkYCVCPpAiA/9hxuUvMQICx+UCFYHKmK5/loe03RGUDxsnhYvlfUiw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1832_1586563485669_0.6053531211672065"},"_hasShrinkwrap":false},"2.0.0-nightly.1836":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1836","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"52fd6741a0ea1f2e043c628cf6b7be0715b1c837","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1836","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-y0h3JQ3Ezh6Rro+tWuDi2gKOTeAGgEbZUZC9gsKD1+nFsw876kIi2xIjLoUB3Txg2xWuUiW/49vWJOBPmSfzXA==","shasum":"108c9611d8dbd591f2cbcaaefdc278615d6c967e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1836.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeklsRCRA9TVsSAnZWagAAPyIP/02bBLjfPfBcWFg+2joA\nav20Bkdng5Dm98IlUjsHoaoKjH2BK1UGNXFmARoaIiegZ0ZIsB5Gl7PR99YW\n3pWIOSmSfsCsNAUiRSFq1jzDrSX1zc54KxZt3WBi1lL0TIjljPQM2F2gYdSQ\n9E6qKVj8sP8ZNLoC8Azbhkvs14Zj51fGJS0WtwO6bQoN0mXtHsk0bfNXn28I\nzusFn6jmn++uiyCpFsKl2/4kJ49mCMU3L3gi0Hjlnfd//l1Lng+1Dvkf37fi\nD6QZRzXyYpRRAffXeb6sO47IFeNdkik10gpnHfLXm5Rslo3ggzsFQF8+ucVM\nRXtbSVjNEwZqukMH4X3g7nujEWpOwt2vcmg9S1Gr60aIVBvinkNO3yFUCPPi\n0trw3aOlzke25UiBHFuYnBO1PMSqQl/DYliuKVEPFy0LcQKnRfymmk1Wdcdj\nl7v2anNfHFYZaBfsaNySNaBOZ4GTjWeYsc9pmFBwszf5H82Hci/jj8Dcu6V7\nPGJL14dBDM8VJHxpHFfyEcFaWRIi4w8589Kduei3WYmO5K6GpldulhXlJzrT\njEvNmnZY3gL6RwG1kiyLV8p9ZZ9M+hmFcmrOgTukCX+nPR8vUC7enJy5R+db\nu2rtLaeGjjvJyXVywFyAaEaG9JKr2OiaqYZhxKiZwi9hwmA2zEXb6a6ppFL2\nJz11\r\n=uN7A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH25uowa3ljItdYSxgeft+2daNGdHnOGx9Pmp+swLCUQAiBvD/TJ+aoc3pK4uxm2drasaxruCaqvE/0PEkLZjWr7jw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1836_1586649873198_0.5844291476795445"},"_hasShrinkwrap":false},"2.0.0-nightly.1841":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1841","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f9f7320bed19a9a2a7d75d5c6da657272b4b44ef","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1841","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-FVtSBLkLwosVvIO033FCRHINIFrVUXoeVLBJbgDLFlesilnhCt9uSkufMXI00Qf8rzaX06Nd7ga2WW1WG055gQ==","shasum":"9df323973978992c7c1a9a4fcbd6a1a6a0800de8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1841.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelk+KCRA9TVsSAnZWagAAaI0P/iueNuN9nChc8eYWP4AL\nSI5HPzkzvEL+er8oJQK4nDi3C/Vcbj4aI6PifEQ+/a33igsxflhwZcs8Nv7g\njOF6L6BGS0SNmxesiYGMhpX27TXlP9iJZsSiICDAO/n3UJCybDtwNOuC1NdX\nk4LSmsxTSjJ3krHUQsMpvbHVj4tqZpL3J4tcDQDDGTGz/hGYuCOKDw66GQdU\nWulUWxKxFDgH5zTSJy7rJ4L0apEBCsXlXldPKSmvZRwOQkOK1T4Ds9L27iJY\nuqAiV1xvBEvlL4LNhaIu94WvSQuPbYqtDSBYILjtGO57pxk+eWGzMEVi/XQM\nmADBa/0JFcV8QRh/7h3q9wKR8xdE/s3lLgh1BGA6hyvgUkHZ7lMKG/SKRkoF\nD1PsiUnNAdY2GheTANe7Ytz6O4vZC4mjakA5rSY4whCLRRfmIxDiuZTbshiy\n08EHuEe5MtGxcl2p/bjmspiWSBIrc9ILp8K77zvFvjIDSJtg6jGcHFyNnY/k\n+0/ibASvgCEgqoXdl6KZnUD+chU+3NK47i50iFulWl+CYsy8hf0HsyqAD0Ml\nPyiIrFUuOJ75G2Siru3bpRAPz2gNlKY0NwxjjANfkgUWRNDhpouu9com9JTf\nO+Tm/grR4ez9VVZKUWZpGI+mvBy0JlrT4IFU2rD0bawqt0euxzvLmqbzD5sQ\nvQad\r\n=LxPH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLsTeiRNpnIY4FnKu6BdorUCoL2ZgBRhq4GpShkAo/6wIhALY4GtVfZ7ICpg/pfZ4YT1G7TjDZPtwz5YCQ3+V4JoCZ"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1841_1586909066257_0.42231792346567487"},"_hasShrinkwrap":false},"2.0.0-nightly.1844":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1844","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8dd0e94102e6bd8856b384fe04ce52e104df0e7e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1844","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (darwin)","dist":{"integrity":"sha512-vray/Z47VV3M7bAbyPoX55wzBwhj6bAwxhlsbePKyE4L1TozRU/1ADsM8yK9jJPEO0n+8zyR0m8jldURu3E0OQ==","shasum":"652f920c33f51d76b368c1dfbc48560b74942ccb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1844.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJel2ZeCRA9TVsSAnZWagAAAHYQAJC9fJjnF1ASknMXjuv6\ntetBDNbdnU0jqbyzWgeawGw0ZlLiiYyEQ1SibNFI3UlTbysopiXZa2d8KKDy\nYKeDRx5PQ+DOmKu3yBn7Q7byO1GSm22n1lmtTPwb9/XnRaV7pc4CL9D/sQ5h\n2vupk/C2hfqYHzZ/55IQHgxAVE/QoMTB0BYoviJDFFCCvUNrWuo/kHrVWgDN\nKNbkTht042U8rPhMp92+Df88C+5j8u0KTnQyZqVaLqPt/6KWAsCXD/4GY1c5\nlqDVekrE2HxenVUcrgjZmkKgyKmiuFElj2Y3QRllk4V+wTWFcRVT1ByaTTLl\n9X+mrhEjwHhj5EvaMD34MJH3izgjwG+CswpgQWsvrTRV2L9ucverD5/BAtf+\nq5Fccw11YMdLTr+2MTdqADW6Ni0MdONaQHyxEMbbyIO7+FPXPxDUt1LJSlTO\nGpsTGlyrc0hdRExG3CZnpkU0wG86iciDQ3sU49lTB/6QkEGg8PMfuX1F5kGa\nKKVsVjp0QiybRNIcl/oqM84ZO1DXEpl2KchbkKfs/JzOMeb3LseqsiEHHvpb\nM4Wr3p93TMLg5uMsJM4oWf3MarrxzUhI5JW76WL3VCqEFb/1NOrCJOSFuHmw\nwvtaHkjWjUe4Lbj5I+9cTGiVj4eV5Az+T78hnfFB28uwZl7Bxek8zN9LvYzi\nDEWY\r\n=e0vp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEUgQSl4ZOfhQPAxG9zBrRVFC2IGT2VbGZiW6cMsDP3AIhAJZHznslJs2eNVKrWorgySus+wQeoYQ5Xl/Afc1S8ewA"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1844_1586980445453_0.1663023533011352"},"_hasShrinkwrap":false},"2.0.0-nightly.1845":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1845","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a2ab7d0df389a76a739c25817b878dc35ce782f4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1845","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-qUBIdjBU7FMa+OK2rhqS7pF2Hn/PZYH3Kv+Gp1/b5SAEVsA2IpKM66OFqSgXN1eLGjiHaMSnmm9U7954/zQwTQ==","shasum":"4fa2daa7e449c7e9ba4ce2819119179bfc52b3fd","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1845.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJel6EgCRA9TVsSAnZWagAA1EQP/jwIFCAdPAOWieAL8aRM\n8uDfMf9oHIcPp0wk6d6f4m8iwPkZ57i/30C1j4m4AF01mrlA/54GBIaXYIS2\nJ28UDHgHXf9ByfWAi2Qs8TlmmklB+aohDpoh+HVP+kegz6uoIm3/p4wEJ88A\nqMAUQ/FW9CzgzKtD6e49YC9Dya0YHG1b5EwSVKj8DUL/sbNyaXumfgu/v8+l\n0r1TQA9mZo+05sgW8Kr6J+a8SpZ8y6PIwSk9IrGpZSbCFQkC70cTBiXAvNCs\njgMSR1t2vIYrNoqnat5dhI/1aWGlGapNFG5lbJFpaWZgvQj5qdXt19L4oN/G\nkG2uN1ttehIi3RVsUB7A6mYYEXx7EBrEISGKSSFSNuakntDVOzMVD0NoBKOn\nPg6hFOt2v2rfIUgnjeIlQKGJY65twKtdwUdDxhnNnST89RBXwAssOhKAxWHl\ntFPhf586JeP+o7Z8+l9hNTfCHzuARd0ZfS3CMInPJoPgRe+LWyo3VxE18+TF\nn2rj8B2Jdh2PgDOBu2Rer24h4bT0jDUD6Abt2AKfusauN9fRBV9B1wWEl1iy\n6MpdP/V9bpIhQbRtRQtiM0fLCyli53D07oy+qd8Va3wggJvtklww+eNn5Gim\nDNltj0HnIUE9F9PWIhpCMLO8Ch72N5T97X4TjcIyAiBr8YPr4D8U5mVeUEi4\nS5Ov\r\n=/mne\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDquZDiWj5e+JBDDYxJh76M4Ma8g21p0yGENdwFTgsx+AiADlhJWm3DkZF6vqYMBUsNdYxdIlvuiCy8G7whO02NXPw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1845_1586995487887_0.6349350080801257"},"_hasShrinkwrap":false},"2.0.0-nightly.1847":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1847","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c8d127623e419f23b6216d3fc68e1d45adeecbd0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1847","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-jks8vtkfrBiXwz5oDPU1XkLxx++XliHZ+6Y2P56TYQqT/9wfkfTjzdM+xh7V6C3Y8IUg1ZYWkOfCCYeShvZjtQ==","shasum":"6f812976b2ed9eb759c788ec79b8ea793ca36dc3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1847.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemPKKCRA9TVsSAnZWagAAsy8P/34hfnhyxqmtY9sPu9p6\nWGL8oyXCPD58OXAWueHrHUh6Mvk0TOa5aFpAkVu6v7wPHpDdHuFE7tVF7gi+\nlSGFT+XZXlq2IWLNUvRe0vGJHO2TjOkc2QYAfdAZw1QK+CAjSnysTaIh5uz3\nvU3Txd3iY/mGO3VuoYjutM/cv5q8YV9LZT8WtYkzl3HNjVV6SHpq2ulzHcpu\nAO8NPpkz/Yx8PrO7syASm5X0KRw/6J9zf2ocIT0T/YsiJJzYfW7ww6YVRy+7\nBVmoqesKQD7B1MsQrXHuUzICneYLbKzn5+Fnp+7v4vQdqU5fVSqc0jHqjgVg\nCxMfRx4Oa+DPdp583TcYE+vB39UrvBfVT0DyqAStYJciKueQYfTO/ABN3Jkl\n+/N6awajmUPy6SYvTl6uximLyu5ORB5cAJe7Fj71M8+WjpsUw1dGTOREJtdj\nXhicy5LI5yIWOlh+Pg2K/+TMduGuAxwWDwdfPMBeOcrBfgIljLT6R7hC8Zam\nx05E5rKXrh6yvsgxWB7xhLXPWTOKGCK5h0n/K483EN5V+SwYfjCyGSvc3rqw\napjo2+yMswP7e0dMiTE6MHlCi6Z3zCVqnYf8LfGcweNC+eFuXfMpEoKicX1X\n/vFZ9RLWrtG4orMWAv8TlQQMzjPXfyMLY16i8nSzntl3yuPITueGQ099bYRm\nygoN\r\n=2xX3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCydndXfvsJDX8/YSDXCHFsXpFJSZcf0+a38PL3u3k9kQIhAMyDJnypjSFJ9RUFUmnIDH2siAxDBDIlwiVUNMMqENvr"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1847_1587081866189_0.535212232951854"},"_hasShrinkwrap":false},"2.0.0-nightly.1849":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1849","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a98be59141fd8d4769010c6ea936252cb07f8056","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1849","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (linux)","dist":{"integrity":"sha512-BdhaU70xR64zgNY5Qp6XyyE9T+KVmS3KJHiXg7ciZ0/+l7FgpjjlAMucrQMoZzja7FQq4wgapvJ70YGPkuFN2w==","shasum":"bec5283f091d769fcb7a7fafab3689d5113913e1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1849.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemkQmCRA9TVsSAnZWagAAeGIP/3UoBs/Ir2FFIyQA2Bnf\n0x/aw5clYBNFFtfCse9u7mNwV//yniwf5UXNUk40+peb2aSyMaED6ZPZR6+a\n1BMm05F6NqXXLmjHokqsl2hE+J75zlhKsRpfl0vhBXGbO/UKAMMxSdjZfBDy\nR+CZb3mplqD2kS3E3XVfTYCaWgsNGu98juWYst2T/9OKFEjbZvEhrHbzxcmI\nCK4Ce3F0AmEwYPEXxhZLouiU7D1cO/Z3O/60sl/WefHzpmyG/NHKJ9R9eBQ6\nRZIR6ybE9MngZcm02uazVZZL6eO+WVUNlLL+u7lKIuReOwHGKNQ4ffNRE9I+\nqHI8XA5pxEYG3sF2zfL7aC7h1JCwcF6PNghJpllPv+MUZXJ1TZ8Qm1rtFast\n3hWymgU3wYq7R8oAJwVNn6S1A5IYxMSLVGEcrs9WijmVIyYF96VBxYXPRMLD\n8RWESXSCjS4Xh/Z2vLhxbk8APk4dCHAhWiI7luoiJ36MUxj3gf7srlZr/RfZ\n2ciM2Z9ZIr4VwuB97tjObxBfA+Dpl7dYmg+RD/VzjiwQl9FCokq49oIm+VmN\n7K+CCuJ2khpbRSaYnTEm8KKoaTtQfoG6f8xHOrq9uKRYOGgL+GaCEZ2fG2qq\nlsH1oXgKDe9G7D8/5D4V7xWA9vRWG+aGNURDrD+FyHUHkMwCZYaO5Kj1Vw0g\n4S0d\r\n=k0qh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFPRw23JQCwe8JixqEAy/hjaBI2pQzgnxKCXTeEmXIW8AiEAtfFqj1LbqN6MN0w+HaE0oXA3JlNISwVnYq0edEjFOeE="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1849_1587168294219_0.4464670436263507"},"_hasShrinkwrap":false},"2.0.0-nightly.1850":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1850","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"7c0aa3d2b9cd4a8d3cb6135e6b07d05f33406389","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1850","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (linux)","dist":{"integrity":"sha512-kvDlpusEmXuHPuMWVmYf/QjQVIuAwDifP2HY8tyuoenB4a3kAFXf4+0uzhZRGu/XFthc22kUZtwASgEvzKQQ4A==","shasum":"a4efd7230223d8cded4bc688c873ebab09cd629f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1850.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJem5WUCRA9TVsSAnZWagAADj4QAJjkDJqRgJvLsXo7n+Xk\nJXFOd4t/AOHTUfA6AZQIvnB0tKxVWADYwt35pmPERGiRcFle/TY7LYtXhMWF\nAm/n7hbmwTEnR7wM0FJWjTF/utlBFMZZkgv3PkL9kgyUIoKw0G1u+56y74Oj\nKqRGgDmp5XhWHDnmTWYgS/nOdztH6bIhxVDnGuwOnK+3wA4CE75oROIlPL0D\n+UnRDIQIOcReHfhI9H9zSvxN7ZOjVtjzkDMkb4k87XlzKaVYaWRTik1Yat6u\n78yoaqb+fKLBIeTIKixK6mCTuHnlNE+DcmWzRMZuSvYsMzsfTSoSCtaVh7yp\n8mWovMj5aSZK603myzsyGo33jwn5q3VbBg2hIqEaLX4B7GA1pK0/lS+3gUPR\nJVhL8/WnQc4bvhQXe4qrPJV5XX/OhXRKppy/NFNYcrhbptJDa5HOhthZs7+d\nEMbdecIUJDZScvWX3fG6CyOkkWXqUW49dAxzkep7KkvGygrVaLbJFUuMN/3Z\nsCmZJblQLiWCD2UIMDdTme45RAFnscABr42yr7dvLSKzBbsibRuVouq6VQfV\n4eeij7wr66EQrSHzZdK4E0VERpi2VySmHVQGfS4Z7cyE5/LKsxi/KS5letGb\nc0dBj+SzdsBb70G6lKL1lTO/7bKE3CaaptWDXC35U5K4xgnzgFa6LMkUclDZ\nyoJf\r\n=9Yig\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOQli41O1Wew+0Ay+B4pbe9sfwZJcqYAUdrsoeA39MswIgYOhUhHpOvSQFrkKlo26m7LGqMHRqfSJKm95vg6i+/q4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1850_1587254675902_0.47008925202803065"},"_hasShrinkwrap":false},"2.0.0-nightly.1851":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1851","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"28146ff0210a9b70c5e951957fadccddfec42138","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1851","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (linux)","dist":{"integrity":"sha512-0OteUVydBzrCsHk0+1KkoC8PkuLkyOGMT2QgMy1mXsBZwtgxsMyv9nG/kWybJY/F/y5XBsHxq4cbDCVGZTxXUQ==","shasum":"0a35924d8e73aa9d6a27e3eed2eaeeba1498db2b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1851.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJenjiOCRA9TVsSAnZWagAAhmMQAJ47zyBXrqILLLkQG32z\n1qxB5hunkgIZcPGrHDvWBZ9+Re9YQ1SRTfUxpjPlnSRDHNMX7J1K1f7EJPw+\nk4NpvBwvuN2+cgklgAvsj2s8f8/8rPZvUl8FWtd1UrGFZ51qhvXVSYbKngGW\nloaO6fuqsT7Rsm8oZ/vg9W3xXkguPyV/93BOyeLE3L21GE8K9pXoFzjpLuFs\nXWV90E+kn0pTSteUZG8bPIPegD15w1v9hfxE71vva0TQ26VK/cjYNZfDEOiP\nQVIwcSNm39Wb/BXUgKGDZa9Elo+a/rqsMVkCi2qnQO/8QwlSsW3Iym6ALEce\nB3uEbWsJQLiigu7XMsHKtFZy8iJI7HfzjmwJXJliF1Bx260Zb3usYJGiPJUA\n7iZpNlT3ApL/2TpaDwOpwasBXbb/q6NhhTk+PrG9VPL4Ht9kHe/wk6sPV1L1\n7JQvs9r+Pr0p3LHM60n4bqxzOXQa7kTnACV4uLH64D4XNU66ZbD+FPE+5Dwi\ne8DYFVeDt37zhEKCoyGiPVmminWYgJSZlE4DFs4OVyAyMqjVvJ7DoZX51hvh\nGGw0wdPyCUP72Vf8ysx7k5IrLs46tHrKsQ0FE3oFVMQcqlBaSlKQPs2fEJyW\nk5HBy4Dhgv20f+Gv9DQ5R60A87iNgtglnoQ3eL4ujiIw4MZ1uagT6h0VLv2w\n/Zt2\r\n=FbpI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnnJFKW1UOtvlAR9+ae5ZcQEAGm8DfIrrwxOXgSCZ2swIhANN8Hdu0Gq5FFDRGIDI59iHyYv4yVsSiavIHDr+BawZs"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1851_1587427470501_0.20134477304697262"},"_hasShrinkwrap":false},"2.0.0-nightly.1852":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1852","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b2b56a27bc36d86e5221ec91dbf2fe11787e0c45","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1852","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-6BTYNU92vcK+t49OQvXPseovPMIcr7VkhRju2Q2sPq1caCm14weJyKaBBxvQ6w5duz6nChRik9LVt+nsHckEGQ==","shasum":"969f0ed15841ff482f541d2aabb938a871d50ca6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1852.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeoNueCRA9TVsSAnZWagAA+o8P/iPzIzElJdNcLFwyae/n\nT6PdY4aSfa+HNR8TemnZIXgknPcwdmm9nRWGnIh2wj/0jDAl6aik9Ik6/WiL\ngVBC8MXeGDfwzpG864ZlkjNeAPwTKM4GIqm9Pr5n4OoMUHt79aNjNUgsHCJv\nYtcXRNGdBeRBvejuMCDI7vM1Z3xemzVhvxKScP8dzFPYZrmVPrBhj5WgBJS9\n95O8teWHI8HgeDYkKXp1Jlg2YwlbSi9Z6yX74oqQBj9IWG75rSW+udTO+a+t\nAeI3dvgP+V4W7pB/yxK1ewsBNljKnRJlntC6nj3q4jBN9MngnJSQufwgPetJ\nbLiMc4DCabVLNGq8ywCY2EBmg5SvVd8Y+3Ptr151re9E+dUZukDwU547BxB+\nVsqxJZ+78BylGO7RPGJYCcJNJZPuCWoFzWpJiZ7iU8C32wEigKMwNoyvUtow\naGTaz2eNYSsrNQllZQkJv9lk8nWBzgOzpb0+W9XZWPyUOYUzoKH0QRB6TDtm\nIYmfG9NDJ0k0UXnHV7iB7ESDVyPBARnqj1kYG2ViSw5N0yQfoNVDiBTX8Fvl\nMB2OwOP/hMxGBe87ItLWPgxj092Xe2Uil+rs9n2csBF/cgQBk1sGQklpMWq9\nkpQFo+516KkgQntWhHOcxsrv5qGxmgSqoP5AvMCJaQaZExJBNpKcB7yxjkhV\n6yGw\r\n=aXgG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQOozeXi1YnbGYM6ek5TliNzRJvx1NCipcTbzUEqLF1gIhANwsDfDcjEK6ljEx46YMij8RQcTsOGBujgc9bxeIuiAo"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1852_1587600286408_0.18900269224339228"},"_hasShrinkwrap":false},"2.0.0-nightly.1854":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1854","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6bf8145c61334e29e20f0619d6ce52b9dcd1f236","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1854","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-/pT2JOORN5O6Vpa+zQIX3sF6DTTHf7SaA7E+O4ZTmklL5RzRAGHuRobjtXTCPt4UK/8P6VcvraxsVz9oRjN8yw==","shasum":"0051d1ce2da3b27a3221f21b8dff0505d954484e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1854.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeoi0iCRA9TVsSAnZWagAAffkP/0LFZ8ckMalyxrvdSKOn\nTdyuyfFE1G5RECdGC8/+Wz8hJDsLe6i2ZVL7EU6kkD31isiE+QM2UIsO/RkE\nWIFIjdSA1uM7juD6o2spuv0VPeFCTFwi9XxHAGmB+2YkOPFEdfNSI4kRCib8\n9GaRv9IM5CFnGznIiX9tCbKKbXYyb7TQ7KmmdY4Ll2AwUO6VKw4BkNZ6nZJ7\niOMnhXdHuI5pmz68I7K9aTClvPoNVIMM8KP4Khvfc5MOINPpl6I/xJptWNei\nxgmSQybhUs2XysHRfNnHqGAOhfXFDtpieZOE9V8Goh7bPwg9vtl5qQ4w4O1D\nLWZ7EyaFOgq02pgnirVnQCnIUMkNnvY/+zLh/8w7aiwL7wcGX1q3opIFjMbl\n3eaLBiW4umtnmONd5WMEskLtgyDLZPPrJZs6UPkhFMtyrsN0mYTY26bTaiWq\nT1SjtN5I6v7GYzQ/ANlODfGZmEOS0Ep6TmEIj8WNpfUjMJmFG8tvwKLPaV8q\nAQh+w8fPPwq4ho9+kFacvLU75UaF3RsMTdGMW5+ukUFt6tkT/RGvjpy7M9Od\n7TMAbhlzF9bSRNFxgGu/sI6oR7UgK28Hj2tpqLXAnA5CfRPmZ988E68JReSd\naakbYj9uotybNlC3ZujKbmRo680oerIn/TKLUxirGxtqAJ8AXxPZ00Y83UoH\nGulr\r\n=jXl3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0z0WHbH4B2PpTB/OPk7VPZ6rC7VuOp7P/eErom5ovqQIgXckIRKlysCU7DX5aritI1lqo+ABS5jhSsHim8KxbS9w="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1854_1587686689907_0.6012845073680175"},"_hasShrinkwrap":false},"2.0.0-nightly.1858":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1858","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"297087a806f9ed958fad1e2217d735b284cd3d5c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1858","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-Ntb6ZQ4LKTm3aUEFHrw42hgTqs0XWaxzne0XCQXlDcsKh4a2CBBAp6cAMHuHziI7yAhA7d8LLJnG3ZyIGV77IQ==","shasum":"3958a0190ac22c438a982cf103cb1f61bfa80e9f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1858.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeo36hCRA9TVsSAnZWagAANy8P/isxBy7mgJ3oYzyXg2g8\nc9F+vGhJrnJwGF6nc6nFtP1GRHwhf05jR768Q9LYvOl8TksLg1mAijt+nuWH\neHwfutaL90Tf8WC5NPRg9Vx81lpWXt6PWBJafMLG7Z4hSKpJU27d6fCA16s3\ntfYPwNiV0F03Z/CAsnJuPKKPdX68dAEEEQyHbEVdvZ0ajDFqCAxpfcFi7ZFd\nQrU9p8TJ4b3NeHWj4qUmuVZe0LWztDQx3mQJkd8q9Y/vhwlK1gqbqYgTtwFf\ngve8uTWgJhUmY4GB0wicp33ejjR0Ez8pQ2Dy8Jw0fUdwFFmkJ9c7mRBFLl2o\n81if42KtSWNe9hdf/2jqNk2LPaInqDqxJaZcIJXDnOdJP5c4BrFOQfoHN0R2\n0Irm+JvhALenI3PUYpTNfpbuRxOY6z4S35/q7uTHg5C/hKE+vxJu/8TrRYGe\nnl0GxNhLVeadZb/Dl7U7g7llRd5KMBdEtoAv5Gxl1EhnEvW29dUiq90W6FpP\nscolX2AGRAQFTcwJiJl9mmOZ1UD5iAmZO35eY0xiMfwqgWKAESQWfD2uL7gj\n0mGz1IBUB9JyAcLkt0HplpqGhrHDN67KprR+gbd9q0hz9F1Oj/QL9PEaCtAZ\nU9LuyEsyy2tU7hfkh/fX/E3+WT/Nj/ewvkXjh28w0mpoojRIX5WjthoDHHez\nhnCY\r\n=3G1Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjkJnSqyTNWcYABsfzJrp/Vhz3F2OYDxBm+9s8BZxaEQIgKdmVQ4ydafy9zzEeT9xlCdVeb+lk8IjKRXd4dOvUgOM="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1858_1587773089325_0.6130596239795134"},"_hasShrinkwrap":false},"2.0.0-nightly.1861":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1861","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"df509222e6808e49009e77bff8f4f9bdc94865bc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1861","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-zzrdjtgqyYHrJD9RSjCJeCeBMmV8ixBLIcfTtuOYBgOv5Jq8nzX7YY4QX46YVaKr4SHGu+sf2o7TstdFdLkFUw==","shasum":"edf18f18af39d74321587c6e6f62a05f0d3f5089","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1861.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqMSNCRA9TVsSAnZWagAAeGQQAIsShz/P6DKIyDmkX9vb\n1bhTvbN0wDYfP9EAYNXeUBXswa9mqEzcykt6fzj7UO9p+HQG6CIzMWoqnPU+\np69RHIT88X0XFcLcxndCc+k5tjHBCiaBqsGMC0KFkMzNlLtBZ3QsF0Eyu2nh\nzkYx4KG7ZLIZPy0EVAUx1ngG0Xn8AOClqbiAPxUoiqblPZd1mSSMfTOLGoXS\nGT3e1WPfGI5vB6lywvM1S93w6eaF7gSErBCrgdpSm61lHxUOa4BNAAlnOSts\n7SIoB671tKHbwvn/HTWX938XHd3YcTWuV6kcN03rJ9PXRhfMx0OtwgQIyi/y\nbBRajSgsfeX1XK4wnDWONtwnhDyqmc5iNS3NwKWtvQ+MrfhrBUz+jRFZvxJA\nYCM0k/+30B3dp7pYedFtK7I1izntKsvnDXOQy0RA54pKhbfQhM5zMrNbO/2q\nE5ueqnW6rmvn+dJCY/hbndvNl26PAyrhhlySV9zRE+Cfqh6wdGZeBPOlWLqF\nto4DSxRvyHfKOVSYM86PHzBEPg4U9T8zPAH0vK8jItvS5i3ScRa34U5mmSJN\nWBF2Btz7hISXM8VRBdQYUPnVmQYS6FAUJk0JGGWN184D79bU0URQK7yMHOi3\nUtMT32wfyJV3HDh+eXLnwAVWo8o3f6DQA0wLxIlTqCoGQvWzOUlNwAlFVVvZ\nEaf1\r\n=Zo8e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPTHQslW1wSacseA+yqyUbe9MhJkxFeSqaSYKoVJGYMgIhAKMtWXjIPS58F8Z1N0tT6diiterK2yisX4QzfdKiUvKX"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1861_1588118668672_0.598564235158912"},"_hasShrinkwrap":false},"2.0.0-nightly.1864":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1864","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"ac5e807141df2ab1d83853b631551b28643b5869","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1864","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-xJgMIqzEeiCbHNMYd01+8Lhs6HZPAlhy82l7aOGIXMDPK08V0eEWpQHQl5g+qNIbMjkUDFnO0ApxZAN4+5S+lA==","shasum":"cc3974328c4ead4661753b130e1284ad7d3c406d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1864.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeqhYVCRA9TVsSAnZWagAAL74P/jdjQGKAYjjTm+0qCk9N\nxGe1KpKg0jel5q8g9Kx1HJMqDhULf7/GxxS7rChpJTZooKvKKY/TQxX8KsYN\nmSgK0gWbAvI98BgEXN1r0aL3KjPPvX9k3dzQHaYwruPkd7o/xVD9ul51TuTC\ncWfDk2cb30HHCHbNenRCa2v5H9FhRIHlQJomJd8TP6KXJwxhql6H7vf8EGZ3\nun/Jr9MM3Yhp6JvN2C3z0nZbnr2sjtvhQw2X+UoxLmzMYGWtWP3kwVX1P4nu\nBsgmjZuKQC4zkJa6JpS8ttCM8Gz8s8Q6V9FnSOzVMuGFGj9Z4bmqUif8W2Pd\nRZG5gbc9ujJs79pCnjJvdYfWm208QpGa6VrljO5ZPQEPuw0LRafubTj4bQ5g\nGQo5xiWCwGaa6YVBxTsm9uxXY5OSXb65htjYGiNHZTeWqXsH+XiksAA2AQRT\nxQ8yAA7cSTDoBENQobq4YFLi0mIoqOR8SygYf571QaEefJLk8CnUmMBQDgoQ\njhWSlvNjWMRNKLKoHcsztg4eyAhYBxmvN6Hrpd0/ZxQNVjRmeSVTYlbRN8N5\nVbMQTLUa3O6z1lzGomgGb1N6H37+Isbb4r090DL6u43jOvk+cq0dIR1vrpsV\ndbXV1nRWBx7KaokivjfWsApQlRMouEORXp6el7Sg/8h298FtPyj2pC/Mc2cw\nK8ZD\r\n=1zRe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfhSaVe/eitAEAsRrE2CSUJEna4E18DhPbY8mI7QNoTQIhAM+qLM88jhZDqijptjQdspc+mePo8npvo4Kur3MlMGmO"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1864_1588205076805_0.7353576718490265"},"_hasShrinkwrap":false},"2.0.0-nightly.1871":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1871","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e63c77c800f95d64b835212632d1a9ed2db9f381","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1871","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-m7ypx5d33Rnq8sFJ4rjKevaJF+ukG8n/r12mdr0VhRUhsMsWviDp2inaMVMCA/yGZ3hFz/6uxR16evIGuhqEnQ==","shasum":"7b7e7e1383bf5b4e88ed7bdfe06a950fbc1bec3f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1871.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeq2esCRA9TVsSAnZWagAApBwP/R0jmvOKj7Qbnj1bytMj\nCEJx/2PzKKIuQ1KTC+wTbzsy1QdBDF/sJ4PWQvLS44tigtkpe/ba+6d/FY/H\nkn5Su/XukewEpY8QmgKub2M9dQX9by2y5MXhA86OuiK57Gi4f/uxxHgGjZEH\n2wXQjtasOUqhpht6HUhdTAWuaqmD8mRzk13voqXUhBpYqI7EzZW4sQ3Nie+0\nOnBJCGBSeIBkX2oOKD0unYTvfZZV2XWQL1emFg+WXXITXqk1dZEFe2r0Tt9h\npXZ7NAxLi9GuMzHbBVM3BmD7dXgdkeIpWgnh3AFf1fxgk6cnb4Ku5p7tlTHK\n7R3tL+2IeiUzKsER/TY3Sk6sSJFW5OZtRdHBM9zxHJcRRfGSmn9KmsZU5Gm2\n3PLJsFYLO+EEoJUFMOryAyXwZVYaGpw82yk3DvkWknvBPxDppyDUmt0wS36J\nsLdlUBr7DH9Zzxsn/X9RC92cVdVoOBuNbkJRam2V9cllqFBssKh9BmTcxLwF\nDu2O2NgxI7NrqZaq+YZ0iWJ6UHUhUhXjt2lSigUQ/pLV25zauI1QSO158zBM\np7TwUnU99L2jR1Ll99NruLYXktDcXqcLpXScljzf3f9SQ1u4sUMhE+4xkuek\n5f6zb2tqzfYAUI1HXuHBVIXZ57gavs3LPuugisigj0t1r8pW0tPa+gvwShCq\n12xk\r\n=+RvX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICMiRHqKjhgdy9SWPF8I9lIozbrkJ2oFzeK7TfDUvqv9AiATbTSUKcRyidOzZo0zDbTAWfY+M+zJwHkzvi9k+V5kPQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1871_1588291500438_0.2249669253735782"},"_hasShrinkwrap":false},"2.0.0-nightly.1872":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1872","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"d3e9d8093c0d5848d1a01469ffa9f0ff77b604e4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1872","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-mssYfJurNt9sez8bvKmwJGF3pvbrXchrhI+X7V9ldw/FOTohgTIK8lwpIHtHa1xxYTo+blVBxF7FNSb7EQAHVQ==","shasum":"f9607f612c918703138bde5e9c340e75d8e19476","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1872.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerLksCRA9TVsSAnZWagAA/igP/RhkmzLtYHjxxzVQ8z4I\nugd1vW1SXa+w/IVSpWDZeiG8lqM6KUT8YueOtSiRiqynKBOB+zBL4K+dLd8I\nCbi5m3O+gRd3om4/LsVgzRf2GS+Ep0Qt7uHz8n6Ig9+xsmYESgz8pJyRRVDM\nfpOXPadJfOJccJSBp/VBe82wuQrat2S2kf0EqEg4TPAqCIu8SKLFXo7HhYjC\nriZpXj2FIVeR/pHKLht4WrV2u0W6aPyMgMq7X2DP0UndILGkNiSpGRn+0Lnq\nJPVxu8VcuUMDzRF+zTSBnItLKg6VjR1J7dzvPGPlNsfqc5wj4JX0OoB/7uPS\nAg4GZcOqAOrrUKtDsKecoR6GJGl6gnLFnVNHdvt6TwJEFwWWNZdmp6279NMw\n4LmsvWd7auGHdkfaKBmQaKad/+bkxflL3KCFmNuURL65JyyqV/a0ByVfgycK\nVyayFneInFY1/YbnOJ7tKviRc7yIaNYoWBAhe5SYvgvN0Ns46HD5vpFMC3TT\nYKpZoZoEu1K1ztY7Gdq4SiKPixoX6aJjODMNio+m1bsFvU3ww0XlthkJSKKZ\n6jmncw8RgbE0WEierghnbELg6pU5e8wF/H0NHejWV573Z8Ltb5wifquhPWSt\nEsahohBELejtz8e98n1gSWtOPZyG8AqWjHBTk9naDCMER5oN+Y1I5201AGps\nlwJT\r\n=o/Hc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDMOYG5GZ/IPM2zbpq9ISIFJVLyMSm62lColqcOUHsOwwIgcf2l3XQo3iq1/eSxQ1+qIovKDlFGLqSvNeE4HB92Ruw="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1872_1588377900188_0.6771291137028128"},"_hasShrinkwrap":false},"2.0.0-nightly.1874":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1874","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3c1c7db9559771af7df9f39ead4513b56afd3c9b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1874","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-ilYluUbLDmNdxf6HPMBfzs+Yx0h5WzCGNfn/LpFeHmaB37gkMvn1348FGaNySo4m5CZ9YwJi9ZeIS15vsdDZTQ==","shasum":"5f660e1527689e8ef756675b7e6380a94fadfdb6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1874.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJesf75CRA9TVsSAnZWagAAyn8QAIBVThMPnFCRZNMV32Bi\n/5j3BVsT0bjb2qEUqjM1mpx5FN2+NjUU8mvoKHzNdpFtBSiyDvxZJcAG+NKL\nGYBhZ6qjrHUHMiKPyQQZp4jJ1SO5noW5JJnjwVK6N0nOjgV20W3knvUnWB69\nHhwq74QTh9NnATfXV4GAwhm2tj+pAVE6RO28FIVyobSBhV7NVSkcDGzhvRGT\ntQjfQsc+3d8uwgCa+eut3Fj4LxeRvTAgTi/fn5JjzVtdWXlrcfO0Lv7BRgAn\n1TyJHsFCNDziHAuuxj5tBOzKG4PMAFcaJXzh1hbg58Ka+brXzo3XXypIA163\ngxICFspzZiDgxKvlkMYwam3Hj5HQQFFzHTAYoiYs35NM9LI/KXhmf1HXAw01\nBHLqdTOa6cco+YrwemLEbTv0X2ru/DPJ5nc1ST/yL1yoIVTJTKEOcRmNtoVj\nJHK62pFJ0EBo82DnbxOGVPKYQopq4LnApb6C8tHF3CIfjiKX5QcXFTXkcXvX\n6vcMWkObbYtBXSypA72bQdyaxv2SyHBk0XDutFWm1ZWWvIQ/LEf3mLjZ/9kc\nx3i9TU7woDEd2lM9kT1UBFmaDb7rO9oBKR/ivWJFLI0kyZJS3tQEr/qSf9Zg\niFLlCFjUWcKZsENoDjxAlm7UGKnWGZDHQWVfI/mIZ8cmbNOCBR7uJ8sxwcrS\nNM4J\r\n=1KAd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRX39ss381/tvo52Fi2/1qSfxDCJE3K3DAZ9bqeR313gIhAOGWGrdoRa6lSztavEHtAOe7HNQbGBf2FpT0wzxN58dZ"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1874_1588723449085_0.4337814078124005"},"_hasShrinkwrap":false},"2.0.0-nightly.1875":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1875","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"44a44081bc44503da7233484b318cf5724aa156f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1875","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-AsO80esMzapnyIPsPDwAojnt8Mxm7SiwM7ksmr4XmeRSh1FGImTyctyQ9tnR3w58EK2cDuZOeJghLpf/dVvyng==","shasum":"5f3a4e1cb3a79dc45041de7f56914b91aae9f999","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1875.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJes1CMCRA9TVsSAnZWagAAFaAQAIMm9MYcFXl861UFAKJr\nVDXxIhRnUHeTLFrE0ol49rOXBB/rCDg7ZHCdcjmkVVWiFMKNBl6z7X5WXYST\nRZVLvUVrK/3E0AwmTKM6MVmW5aPCywR/TJOVkdfn6Lslq84d86WNX3TINd7j\nHCsNVtkGi70R+cXtEqOCFcgzlUmVNS0Jjso5L6RfV9lmNrLtk0PVQbg21BKP\n+nbWFUDDF8X2oqwf1W+uJYBYKQIkO8xlntxIERgpQaru+pL9ipb0ovZWh0Zw\nDO4kQ9E1YTWGHc8NeXYqRcWSVzJ7OVT4i2TRwHR1etNEQV9AsCDuVxegvh20\nC8xdWIFCbMlzZMwKMTM37ckEIeRBKo76yeDcUNaME5U80yL1uVZldIdoIwcO\nm/GEbMXCHs9CIIeojbX8OkCIUv2fN7s/3fJxpdUSLugnbXqZ+QHRyU4xCoyx\nJ5xRZMai3VcWAnjtDbEPo9L47BcKtKBzknwnhC0x1wuESuSoIqIXujk4jbC2\nDjEeMWWakZbL4bXrKhf4xZNkVpwJeYoAkw3JnHUNeQT5Ijgm0YFM3BrNPVeo\nAo2I0f2E/YQKSoSpFklTiiNGVhFTIZKFIcep5o39dGArTJf8iQE91rhEO94+\nULEHlaEgD6ZgogLb+5gTCankmvtAHnGnJZeS6tOGD42wm8RPtcJZArshuxXP\n+fMr\r\n=TZb6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgO1+CT6We0Q6dTtkKCWYxC9k/f47xX35io+UZYUJFpwIhAOE0MgAfhA9N+dUKT9EPt9pkV47QUkIE9VW9TtdKYtHz"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1875_1588809868462_0.4536462390587399"},"_hasShrinkwrap":false},"2.0.0-nightly.1879":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1879","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5175a66b28cd2a6090b247204e550cc0264aabbe","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1879","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-LHzVSDkTkLPldDB5RGe19C3Q1vJ91eSN4xbbx+fAax5Y322TuBRvd1DWNomWfxwojEUwIPTx2+MwoxWnA8dx7Q==","shasum":"d00716fde8c66e92ecb4d07fe8b6acdfd765ec7d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1879.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJetKItCRA9TVsSAnZWagAA/n0P+QGybyH4XcHYMF3tUnff\nkAhZAxaRVv9K+2b6auiGF88t+Ce6DilvCbUtTfpDORBxIfy3IMR6Xp5u7yU/\n1Zs5VYJfFklaQKZqj5IZi6DsUmdnuWYApce7EgxWdIMPlC3GSRcpPlzab2SE\nizIVDIZTjhPU9/VrwtEfu7eVKrHxgsMo5QhkvGYzDa/FfJ5kk2UexR2axiB+\nvi/146dod1WvaPGhtaU8xT40oKqqwkbY+VCLgdVOtZPVsqATKSSbjlxpbAGE\nDoWbESox+vvERnV9YG3ydyisG4BDc69TLbIwLXdPJeYKKPbljk7RM8xl+dl2\nnbuaEio8q6H+GIPqbjWx+yUJAo5rhtg8RWSY2sazKCZbhOZuJjYqiWXBwQGj\nJuPk0q5eIebkl9eh/L3DTiK9dSeTw+LfREgQ5liPYSJ8bcCEsWzAVC4++RBD\nu+ook0+UQhn+920boj/S8mroSwHawN11t25CEdkfamUU9vrKqV7SWMa6RMhh\nViQHnfawL+zp4WVWDkd0zMU61Q6lS0B2uL/92NZeY4o0agGzvLJEtuKe3i90\nDMhnJf93T3FATJDzVALCwi9Jx3GWRsCTDzXy9IPM0iTHB/+pSxhCVkh7logs\nQibg7Fqt3L14CbAjQUCAaYhfrkvWx/I7Hv94fYUN/j/aa13B4dfqa2Efr2eA\ngdUE\r\n=MF2V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFDMjTAVoqga3dxV2qt+k3VyWgt87nPBfL2epPfTufh1AiAXvRZS/a4vs7SWtjYTtJ1IvEcueleQ+ZXnI9D7xMiaOw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1879_1588896300845_0.7200809117989431"},"_hasShrinkwrap":false},"2.0.0-nightly.1880":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1880","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e8d7d94484f887c9f61093fca0c63b499305b933","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1880","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-RJm+nl05tDkjqdHwca/QkF0roqbWR0wY1d9Kuh+6Xxw7RAnqUzje0T1sd6rg/sAuqxJVpDw3/W5Rfn1yL35tdg==","shasum":"d3df7c0b826fdd1f33e725790d952395dc55a645","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1880.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJetfN8CRA9TVsSAnZWagAAjTAP/AvbE4UyVq+fmK1CGB2x\nSt2K456nbH5rRqBwdDCJrCk6xwwOmNRd1mC0lp2ueBuRC7CQOkU0ORrh81on\nL453fnula4GxZr0poFGa54+zTrad3kdhbJ39LvR8vz7YnktFk7RjAM/LQhdm\n2OtJUmTTwlQUKwzT9yTJdMByK2XGzmW/Lj9EYmSeTmMe9OCk5Iag+7Nr9YJ0\nVGBtvXbj5sJHgH+08tYTzcCXXAIws5YKsIIsxvf8E5lFhf4RxLf8MUJEr8Az\nKGtMei4DZHjklHABbdTK0rMQpDy4/GPJLpsKkdyGHp0M9mAz5Wc7IvppUzuV\nLmgsfLvs5U1rWgfELBeNLZmYnTRZqNoQ4YO8vQcgRBdbdFjvjMkbkIeTTIcB\nHyp/E8Hadt1AMPRb+E91fCCaZZkWIdJUqD2rx85Z9cusRGKfFqS0oXcgvNSc\nmc5sEhad7Pkoa5cIUDZH9e4zfXIuy6GJIlz0EZr34aZUytVUUuQObz3qsp7m\nD4MEIuRqfE6GGXrMtbaFBNloK2hepLag1BoDe+ZvTf1aBJsKTBAiE1kLxjTn\nb1CQ4feTSC6USO8Ek6twcgy8artCFfkR/nyPX2CkPgenXWFNtS42UOOYmzsS\n38McNrb2onzJqsQST7QcJyOa7l+UEyesuXkj1J0Fw5h8S0OtDhL3IyCGdSuK\nmle2\r\n=B8W/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEnOdfrgYpmWgd9sI7XQtPaPZqmB9gLr+s48jSqvadnxAiA8kTzNPzgk0HDNY+e4RbrW+GdbCmgYkmtm5W1xVIGjAA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1880_1588982651908_0.4391688143894583"},"_hasShrinkwrap":false},"2.0.0-nightly.1883":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1883","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"ab50b2f0fdb04244e6365e5d14099cdd79c36e4d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1883","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-IJjmVMGRweThE6JKGi3MXiexrdqi9L9KCFnIDhtYB1cMm8mPAtAk+4GwH2AA2QraqIbCafIc4UHBWZ8fleE/WQ==","shasum":"2f0029794c07fbd88e934e90bb384b7db1e114a8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1883.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJet0UxCRA9TVsSAnZWagAAivcP+QCPbLm1HPuShokcPhXo\n87CL/4/o7xqMDlXb/8h+gRj8+4bKOQPGPS8ywBWIepJFuRzReXsQg5tdZe9Z\nXwbqcE3ZZrEOpL/fZteYN+KJaHTk1qc3oPS/Yjft7KTmmN7LuwklbV9SzaIl\nJ/mbwmPGOwadG2dc0zfXkRnMhcTVLakO3+u9GgubWBvX0O16i9+R9mFIltT3\nv+ruhph//DH2jgl2JzFoW+CgdBrdtZTXfVqeHaaJCypoy3/7P9D0h6aEushV\nZB6KfHHwRE9xfB4hY8k3fh1cWVcCS6u4JSywF27Evf5fP+CYjv1G7rxwrE21\n0ddiJfduRBbnu7H844Qqtw6RxP70SVgHyiDYaGoBeR16G7txkmRTSrmMnXQL\nxS/rnO9xTFnIY8iRWb/cBySzTTHMbX0qrOL1weZTC8KHeS+fSQAa3BQt9hH9\nel0IDuVt1c0BPOQXgCbLUJZ4Ax/xWyyN4l334wEtKoAw9FljEkkRy7DW1Npq\nOj5NQGprneg93Se9ObqjDHl5XeqamTNuuzy5Zyv3hY58fayAugs/MgIVTeQ+\n9KTBoyfvsDN4ppRVzTQFmwmqmjAl79vhqpNqeignR0aTB/iAiH8nn/sNTtS6\nx3ya1MU+hGmdBeaZzslkhGi5ftPRkerNuk1ASpTYZ+frMyaiZ6z4dDj5iQvT\nW0Us\r\n=KQCi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGYOX8l4Gxry/mj8VPxjuAMjpy4X/AM1AA5uGL8L7BYgIhAMvs0M0d2Vn1ng3YGexTIkeARGz8ipCVhYsIgW+gWUuV"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1883_1589069104449_0.7462948428433869"},"_hasShrinkwrap":false},"2.0.0-nightly.1885":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1885","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"64ae007b915561aa5c5dab10a49d1f10c2df4954","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1885","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-DDDp5MFrzqmbZF5JzrqB6jwFUp28fV+EiHRJ2vtYFQ8lxmpr6QAbigyYIi3g8Sa96kgwFyyi1nqqsC/t9gAfFg==","shasum":"e120c7fd7ab56596581a571c3f4b6dee2f1d4acf","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1885.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuJbVCRA9TVsSAnZWagAASH0P/RaLbG58gyZILGCgqcMi\noWa9ScrTvV4soroqkAK08HK7Jk/kjHdxJ7ozgmQ1ja1/cijCN6IMxOfS+oXJ\nZ/T0laex0SlnlUgJXR5Jh1hZ6Y8UnIMxoz24Wd49ZoMDGu6IS5iKQa+WIUAi\n9lgqT3vU93hDeTttfBD8y11Xe6NcIQOOh0OoaLE3BvzOvsUUPuhqHHbpfC7w\nKHl3vKWP03k23XDPpkoS+4qm5HaWKgS95V8YCCRMSNEVHPxFDTxY5vcHOOlG\n7E5v0P2C7ULWjKrRz9ydHRciEBOeY3p2611mvVMWi0KAZ/+tqG8ffzfNQIWq\ny382vdOfJrZeJri+sHenN8GCN2D/BDQ51JLIVPTyXaZO5X8u7N/GeWXFus66\nuw+c36Qnzi0dBkO+crjviEULCaRhX+BuptgUjLmbdfyJidCsCmVOQ0wXXcB2\nDZtgztpn5UksX+pA56t4erd3Jx/daVYG5V/xvkGnbPejngyZQQBHdECFWHnm\nWulcR1tv1xhcTpQj72ffLB4/ENmEmtc+1qofojqTNBrgleKkOB8t3NpPokZv\nTyRwaA4Z+MGiGTvNclPmRyG4qB2jLyy38AoaVkVpvJtZoa7r//xecFzdernu\nlFhaDKh9lm8/5RfTTsbUhW0y05OCecK11gbxhgoZSxVQFacBMjqiS6ae8WmI\nSnW1\r\n=qX5q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICgHVlC29cO0HNsZawEpN2Vi6kkforq5C9d+W97Q5UlNAiEA01PxKl/Ck/7zWZ46cy8I5OXkHk2C/U3c98gbsAwMqW4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1885_1589155541289_0.5985787109963019"},"_hasShrinkwrap":false},"2.0.0-nightly.1888":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1888","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"4210f2fbf1f5973be24fa268a7bb9b6d52ba326b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1888","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.20.2/node@v12.16.1+x64 (linux)","dist":{"integrity":"sha512-d4c9Ma439Kt2SpEJ2D3g6Qv/n2vBddHASUAw2sV6IdaE4wbmAVZeXQwyEAs2q9TTKV1R8FuGAqXYmwotv0d7VQ==","shasum":"90436ffd918ce88a22d73659ee47ad5d76680fa6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1888.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeueiUCRA9TVsSAnZWagAA+6oP/2J8LhdKtn7R44ySpJ8b\ntwdej9EpOqosATCbit4gOwNNEn5wTl5lWZ+vYSZSsuEGobLgPRhWWW3KHXlj\naGaKgiliZ12Nh5Wk2uq//9My8L1mjrqjQKm4GKB7xATEt42ALMbUErDNZLlJ\njH1K7gBikZPjxSdzFnd+FgReKAmXOf5W9yNQYVrGBGUHBai2cy2nj7T8n1MW\nWkxmVFFc2tg+qM//AKMrpqSHIA2Oz8vunFAS/Ru2LBkULIqisNi8abe5r4YJ\nK9TsN4iDPA0+oFJqum+ikIwBQ3RYWXTwtvliRue2Erlb5UXDPDpP/AvT1G3M\nRS+xLTGTKZMe7V1c9V7//MAqoD4G6QEfJ6oZyggte11Y3LQe/iApdvY78q6l\nHQzJyZ2te7NP5WkOwzRQsy0kbDwhoRm5k93pDjfAxqgkQkbRMAioFs6NMDJG\nMn9X1l35t/n6jnI4DdrY8lFknM+JyFik6gK7Z4HpyJZmc3k9aiNtnLm7hxSy\nU9c2Pll4P/zE+MYd2rLV7ARPcvrQg06/QFKDyS8tf6StOFfxVUW4tgazUB8t\ny/yhwnVs/GgiBYXL/U1SlIHX8iwJ0h4ctT1Fua1N8ifGFke7ay8y2JUiUHcW\nQ0ChFJEsOzZXWDfiWliioiDavMJ60oDfP/Jb0Er7QsXDOCwprrMY1mI3WfQN\nwtHa\r\n=gses\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEyaYJz4ZXw2pg8QbFPK6YN2R0HFakhI1n7GWnFUVt2WAiAicyKA2LuOtOk4LXSp60onN8rZYsfv5x8+Ow6/pwub6g=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1888_1589242004283_0.5133445996446571"},"_hasShrinkwrap":false},"2.0.0-nightly.1890":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1890","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f65aa4c53ab130debfc88f4628eb001f52fb5f63","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1890","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-b5OQ34nIi2CfnT3bMcADNjGFjvTDefZNP18NwmVAsvSR+05WTcHAB1WPKZdWC4lK0JiV4w6zh4HazzD44UnHYg==","shasum":"4abd8334ab6bddeee079d0ea36e30f1f8618a056","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1890.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuzmaCRA9TVsSAnZWagAAfqoQAKDQ2HwaV3g6EXOuH0aR\nogTPblgGDu2/VShAw0jU8AmWdJjh388bK1S/x3vNA8DYbRU6bb4c85wnYiEG\n4ue2BKEKPQZQPcueiy81sh8itRK7NoUMMUHRvfge8n7A5Nb032eFJQfJbfBq\ncgJ509IDKsyBoRBsvApSv0GAetMqVLGvpAaeNUgtZmc+sYSpk60Qx3293uuR\nfHxAwD5GmzrjsNiM0Kn017dcguOg0gMsVGoeZzZFjDZ4riyUYBreeG53Pj2s\n5Xaz5jiY6FemrtBfHCH5TnB11C0V8OOI40gOgBsdOBeAVwNzKkY/yvcTUC9R\nuoF+UYDW9o5P5cg9bBYXzm49pLGUzvryFdPOMTF3aGZcNPTqfgdCAoaOEfjB\ngzbZeAvIfuDIBn8Mpm3N668jxwyXnlxWgG1rwAA/I+X0DJjHvTTTkIfpyfBZ\n02TA8PdmAWl2TotO+0f1O4NQXFAxfgQjxwp0pg2X2o6auN9l0KwB7Mk9FBH6\nP3yCC1AGLOe5Gnqji693Tqic5wyAAx7cX68bVWYB1MnPZPsrDNfh8bv9dD68\nIQBoKZa3QdDDHyKjKORASJFVGOyRGaSRjXcYx9/AO2329qM7xhYMY5ZHNTL8\n4jErbUPJrDzn8LjlIUqcfhJSjSLymD8EI3G/xeMajSQYmCoBsp9rjhJ1krvM\nfez5\r\n=lcVM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8w+2uP9JNEV7xvmQWn6PCTClvMNX3ycHcohug0qLD1wIhAISbcPl/P6LEGjNfMiZtJOKMlAg5JLzBY+7PlYk69Ft1"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1890_1589328282312_0.9384477738025443"},"_hasShrinkwrap":false},"2.0.0-nightly.1894":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1894","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"9f71164b910bb7fef050d57d8ef9036f3aa17af6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1894","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-kP58Fn4AcOWCC2bVFeCQCEI8PVUSkbPVpSdDg3AVm9LmKt7OmvFgC0NOlh+MDN+Qq7osiNM6Rcj0KAlJt1vQ2A==","shasum":"04f02be85bc5d2e4dd6dd9d95c8c3885cc96dedb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1894.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevItNCRA9TVsSAnZWagAAmEgP/2wbchaz6h/PRw5lk6Nw\nkd+lbTlKp9GT8yOrgClMWqNC4twNHC5EMhOrG+qm9zhBlSmLPtENXx29uVq5\nX1lEMLnOgTT5GY98FtYeboX/R22FAyPUSzmlmMUcQPkh0W42e9g5D9VdJC2k\nonkYiFhlzfUjRt7qRTRsDvS7jdSJ6aunsHpMeLbMs2Soniac3ppf2E0/P0U9\nXYIBugl5FwSKPNZqlrXsHDgbbb0KrWKRPZma8tqUKuECNx4KbTKbrSsSsT86\n+FpSVh1Jqc9ga/IW913asvi+urep3DH2goW12yawPmdOdEqiYYdNQHws2S+T\nOjZi0RAmtNuFU3HUReY7cHlHfjZ6RVeAT34aO+RXNpwCgZE/ZXznEq4ILCU9\nbQ9ghnvdRWU1Etu7QhxF+tXAif/b82YgoRDJD/KK1oL4cliTra7gVznwpS2+\nVSHW5Q5hB5IGRzxrG54xCggtng9edgUDZeUdrnvyvobDyws68VUxvTWGthNL\nt88O8b7z/B2tep0vOoiSnop5N6a7ab8bcuiw672GT+pG6fTwvL7dR43XupPH\nQ45bw+/2piCR8SjI/fD3JWpP8Cffv7WVzT2OFEeax/5MBIrvioWkZACJo771\nw3a/xv0Ewxppo0v/Y/EH25KwisG/vN49sAovQKAWjHR9FM4E2F607QTJz6Wv\nJFF0\r\n=yiVP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDe4ccGBnobisfNzA4zGi/Jr1/sDTU6Vd6OCsugdM1KKAiEApiJXXNV63NiiTteFM8PiFlDJZSXjMgLb7J8PVMauSGM="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1894_1589414733410_0.9577736033075828"},"_hasShrinkwrap":false},"2.0.0-nightly.1897":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1897","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b275d0962da1ff200028760f2b1e227dd54ccf95","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1897","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-yMGkFKJqSf4K38m1I+Nc+inPSXNKiNi4LkQxC5y9Qzcs1hgEMKPah0YIGF2uPsfpomA3Eia0TK2xW+V5NFvEZw==","shasum":"03c734ce67e3746fcf63202e479d7e8ed6309191","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1897.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJexHRVCRA9TVsSAnZWagAAfRoQAJtGGvB1cO34kn/oMMew\nwjOKAbv7OG8+E2Vlxrm1ajIDCAuoVUGLT0LFcZ2M32z6FLubeAXskCa8fGN3\nU9zE8tukIcb4t9Zx4/PcR69AtLfGC7H2ShjAKSqWEMS0D8vhol6idsHG0CIZ\nnlgqppnMoeegv1vZJpNq3IBayC00PQwEUe8NAb05LELMX6j5U24RwykCH4Sw\nEOzWpAe3U8rmkHGi/uvKIZzur5k+Mv38mZo70li9ovOW0fraf0X4ifyQEt8m\nZlkgBJqIGR6mG2tR4pM3QA3tuLmB1Y4EXzuX0OkRsbKcevtZet1vrm/Khe7j\ngidBKJ+k2qSxsok4JYqjn41Q0XqlZ7TZolLeFZ987Clg6gwzvw0WoXUz+MSx\nm16JOrH8y9FvxHxGavAuK74A3DsabZ2ga8iIi5wJw+t1JbLJtSXwrGBtVYRI\n3BWTwNOlzCUaTsxRv8W7UcrLdf4uJ0nh9byifbudwHA6GdxQ/bwADtzLIEIr\nBtV4QqFlrXMnLSchD3aokIVYLm4xUAVml9ET7gFiT6ysLjr+1Vmrpg+iHY1Y\ndZHZK+2PKWU8if7v+SwD1tKd7Ns1F9xcM2HTQSocsBsDtGCR67vYAp12erm/\nhiqK0IIXyGB+oeCpOYNH0stVzkygrN//RZdb+K/HW6E0AXNWa36PZErsVytx\nCqaX\r\n=pp/P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICCCfwK3i7Z23S3a/QNsa9esWtRvIyATFCeuYs6FPT8bAiEAyrpUVEyagcJYt0jAgbyDzfwFc+KBBzxxrSvDYJb0XcI="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1897_1589933140606_0.9407816254099186"},"_hasShrinkwrap":false},"2.0.0-nightly.1899":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1899","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"d33fcd9cf826188288e7ffb5dfecbfa221592458","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1899","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-D22QD2GBSSco1kItT4SUOLv1NlQS9wwVBVQvI0r9sknyoZDlN4GeLt+GUPrTnCFxJdBXvXxHrFAUwzzut3x8kQ==","shasum":"2a1bd4bc4c2c5ba8d8d2d087a0a6ba0d36e42f0b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1899.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJexxcuCRA9TVsSAnZWagAAFAEP/jG5A6qw9Vva/tJfyNEy\n+geJGJUXJl7T3D5k0MtydYFCMKhymVl6jPbHoQWzPvAjjKnric4P/LvwK4uj\nxMkDS3RhdXz/3I4LJtJMoLkS/4MpHuEOw0mpi7Y6PxTvlDWI/uT1+pcK9pAx\ngf0XDUopXAsADPo67u88hsrXXQQQpHJEp6GhDLMLxE0zhDGPRJwtoiBN2uPH\nmzEYD8pWOVsKreXRIY4kgxpNZODdrYM0byIwSeRd8+XWGKdx1ymjnD7jcynv\ninJd3CF9qEr8+Uddo7T9pjgyFYv0tmikqHW8MznPvNrs3JTwdxy/y5UM61E7\nBIB/7HQxJyBn/yVsVc7Dj9j4lSX92zPPpE+kLExyghoGsPfPX5e0hJMQnhc3\n2AOcQ1rdnZCo2QKl6rR/WqWWZDC5Ftqku0uUSuQSka27/iH68ra5mizMGwjk\n1FwoXTj2Ny5hGy/w79LiUsaeQHhB8PdmGubIbSafpm+N/BXatxqFlDHt6kLE\nhFmfbkl78/oZZttJVwfJMFt0+GGx6mrRLvOnGBEHPuiopDyNmAuSIUtO39u1\nxg8YTLJj6sm/YdQTnioWAHpzuPhy43rI33Sfm9E9XZ7QiVltNsAkEadtNxRo\nIj1ciMU/mI1VGTglsGiCQCeR7Fj3yJr2VMNtowDzKbjQ0yXIbeqx9+kzsO2A\ni+iV\r\n=KeMF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0tC6jWkzEo4K/bT99hRe8CNnodHJMgAKfwv0BMeCMIgIhAO5KXQBiFH8Vnnbms7dDx/tSP0RWVeFkc13tG2cYHZPa"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1899_1590105902076_0.23453394014591455"},"_hasShrinkwrap":false},"2.0.0-nightly.1900":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1900","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"417a8c6cbb2eb7d7ca1d936c1d93a5cef8e91ba4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1900","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-0RJGxtIov13Apwzaaf02TcPnoHq85KRuIO3DBoOIFKdoEG/7N++JWOXOtLBgIkDOo+P7QObMYqmI9SbAlzOE8Q==","shasum":"0bbfc67d3168bb887d9b238781902d26cbd24f1e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1900.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJezwE4CRA9TVsSAnZWagAAWz0P/35aGkeLe/hyB9xd8IFO\nHu4vrYlVpvzTaxyfw9CknCssy8yyXfO5KQwqDQ9CgdZK2Cs8qs1nEn3LTDTy\nIpVAcRmYjnHlLpsNicyqzU1BM89NeI3/KBtDBIoDbQnQVVgYtbpz/uBEpDWi\nGXx/K+dpBEe0WIrKvUrxEtK8zHPCzVvl1XghLa72BxPP/nOCYS5IVdc50XI3\nByp2pt7DT1KV7CwIzIayVwRGQ8sZKkshoxAc+PI7s8PGi14E2OSJbwH8HgE6\nMBf63cwhlcdBgIJ4ff18YpzE0Xn/1jlXpxqJIPDU2rZ5kS+eTWYhVH3szHuV\nfjY+sjMMmvuY+PNsFbBmkEosyQqjbWc6jZqssxL0q3MXMkY2vxIKbjFfUatq\nE9Ps9K5LiWX6ZdxkBQ1zJHvEwR2cEobVnDdyvZv5t7k0iAHnIShtMWl5tFaa\nz6ZS8V+qbx3VoHbKfibUkNd0w3xz/+qFzxc1VdGu1m85u/joceMBEjzyuq+G\nGXgLPZpyep4DkLtH0G5LotdqnMQDadW6TUpeCMXib0NwI943qUb1xktDrgLP\nTx0ymLq3490/K/tLxa0piZjOJmA2pwaD0nvtRU9t921wtlmDL9LkNl+aREjN\nqeOFf/tNBe0hp3loGqEDZAePi8dDFBVGItnunmoVfphHkXMK+TT2BtMevFg1\nZQCr\r\n=uA03\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG93n9KMKOE1CCdVlN9yDDo/FyD8oStfFnRSM/N4hqmQAiEAzogKa98GYsPH4/AhXzNGWeArVMi1n9l87+XHUeK60pM="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1900_1590624568200_0.698490783818795"},"_hasShrinkwrap":false},"2.0.0-nightly.1901":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1901","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"149c00b79264c7398e05c1a9ec2d9acee59f9384","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1901","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-WH7iIPpcST6K6ArLwS9NyXv8YJfISPn7oirQwnybo9tUXNrQ+1infNDoAYLx7EbEf+OroLffNT5llJQwVswLQw==","shasum":"1ed81970062fe366e3bda0ea64c7f9d9b21707a3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1901.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe1ZhkCRA9TVsSAnZWagAAMukP/3Y+A9LeAyiMch9i4sro\n+d8vu+9rVKkYfbBIc3+VhOWh6G/Jg41ABvpKgrijlxISKBHQb+W227jat7F9\nbNi43yfC+igQHP+p93OEvoc3e7IzJhsTftRWCILMWCwWbtScCszCHfAwkK58\nhSmpdNePbWEIrpywtRUm/KG8z77KkmPoLcLAij77D3xdw+ukk6ZI2kw9+bre\nCeRlRWhcrQ3WUptIRzmGObUS3Pg2QghSQQSJ1ovtXmnfWQJCsfP9b4nLCsW+\n8uQGl3qs1ZZJ1aHHkip+X5sO2SqlNv5IRd88tAWUy6pWjNoNuDkdfVK/gnKh\n8mAkYTT5qg7U+45DXhELevMCsUwhaZgiqZjuGSRDWMxgDqJ4a7sk+Y3hRrfw\ntnXp6k1WW03bobfYZP4xTHSrqV/+rcV6/HxF1jafK5cB2HrWYAPrlsAfhDDn\nAmQU7R1sbxTfCldU+dQB4j9xZK4E/EDT85BgqMxTw2ObaBEOXzbaK1yJ/b4y\n0yr/g/kWqLD/C7gJtK+46bP7LaFKtPVZTvjyuvXs5OdUWhQvAiEqpPCjy1k1\nzXAAzg5lRiEnB1NBmVl5+L59sGegBAEDgL3NnrHd3ELIJUY6xVswPmcU8dgU\n4O5qDsP8rxQ0LHKUYSDF6XrDxHcnYE9Lt71uRFHBLy0dj4rUGVRDSh6U4r/H\n7hlR\r\n=FfXK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHGl4SiebAqnx9yWOsd97DWM+HRZbu/CDrE5o979fTCgAiEA/KHdB1U2n81NgAltrMzURhsLyq3bKKoT60p36toULbE="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1901_1591056484491_0.30719890837016117"},"_hasShrinkwrap":false},"2.0.0-nightly.1902":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1902","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"2668bee153af09e665c30408b1bdafe06e1cc3ac","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1902","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-h54zeRdJpAMXAt3aNGSuUv7lc/7QxWo+lV8txKsJxDrYQ+ZvAXmbL5K4ARNJgbFIqkKRFBO3KvpBPMjuO94MpQ==","shasum":"b409e3ef8edc0426d73a513f3f56a0ec84a46b45","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1902.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2DsbCRA9TVsSAnZWagAAU6AP+wSTuSZ87FZzDD1iBMrw\ngpaeEd7mQrhivCYQnk7f76muCAk17DHSzKTIEEkL0dCXI5bNMuQCaCiVEA3g\nsz5txJDSNyMTXOgZMx2PHuuHTsjOIs0CHPJNn7/w4O2eK+912xaqkJJNTPGZ\njg2IvmUs7pYlIDFM/wGFVxpm4adehV1pw5md8Vj8O5RGuQ0L0oCrtFXa2t4c\nqpX5/BXz39YGMfqnroX9yU843P+i3vqM5X0wFejWifKbuncqbi71f8OCHHzw\nZMa9csBqwg7+KzZ7dQAXrmlruPjcfuWkJyJx4cDx1OqYaoEjpJX1Wvs47ldS\nwixA55AOctSF1K64J7EVi46P+Q7ThslXqL8u61NtNrWsm7lXzSn6d4u2Zq1r\nB+aeKRug0RKBIN+o9yWCr6coQmpOuLhrpwh1CIWEqi1MOS5MQPXwE8jV3JpU\nJqTziMH0ciMk3qODaHxMvtVNBeD77C/UDobYEeaMgxLTQjEIIaiDAU2AgMJc\nwRV/u4elLWAlqHZ8NAj16qIJprlRtbNByztkcP3q8cBp1rzNyTcVXscmsW93\nVYkiiNJVESVe7Rjut0IfMquW3LUcv9e4QGfhFfdefIjmlwX5hIeHiWYPXL4+\nEs/7VIN9ZN5tqZWtSN68AdQw2ONPJoagy9oMamovXDColNs+lZ1B3MrRBngy\nqYhe\r\n=T8XZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAEp6RDQ6aqx9zn63qLx+IA1HrknntrBy0oRoZB+gLrmAiBAwSsjbLCyK6nWKGdIYxR7VMYLsVp/FYz5e6qvSbKPfA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1902_1591229211466_0.7246821423935799"},"_hasShrinkwrap":false},"2.0.0-nightly.1904":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1904","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"948cccd392eecf15ccbd08b91a0de239f6a3abcc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1904","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-01giI0z5OkFaVdv4WCpZxeeOms7gWnX/iupozH9VJotqQk7DtJnJogRRH8Tfs3vUsog77xOYG3VAaIgXZbReVg==","shasum":"46f51ef9c179058174334ef5dbb9d0aca8741677","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1904.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2Yz1CRA9TVsSAnZWagAAUnwP/0Ec9iGDwnGPncBOYDna\nZ/paWLV2FnTus0H8Q8otp4O1h51roCcdoW2H840CsKrzPnTnbvphqvHtLRE1\n1hSU/v5YWqpxxDbiH2q5vEFLIZYUYtk8BrGCoQ6HapslwPCYPDJGSZ1xweLr\nfcLhPa9N2zyiB3LnZxSJocrU/x6eaoD/EQwTWhqaTm8eknznszH7PWzfEHfw\nSt/bIe5m0g1BtYTVg8Rrl8vFAJyPW8Go1sctjsRfKCitmduE2xYJyE2h5gb4\nc6MG/xA4S/lO7XTyAx2zi8uPz3BLJhfE2PC9ipEWgTbwkcS7IOeD8OpqbaqO\n3E4Tizr5ZKDcDu3ebi8L7ueR/dcQhlBaAlIFpO/OdCtEQP1AXmeSS5Ctz4Zj\naGgcIW5//sRjGroll5fKV0f4Ne9SgbMsk8cd6iujoRDDv4vZUzNX0+Mpw3h1\nxl6fvRNnKc7aPEYwAOclbxWDFBJd9E2diE4SRDl4DfoZOmdH3f/rwuB8HmpO\nA1HL3LfJEx0UNRZzYZVnVkx8Igmh47gTkZmoi4ZFIlu77XBbp8A3rFQ2XFYf\ndR5hETEO4FMBARKrRHGn0nHbwYh7D/8aS8EZwBvVEpKnb/XOqCpNcH2aZkVu\n/b+yrJAzURVDBpOyuzGzTir4M1+/x1bs/p/mc8IqrvWjXk8fOpsHT4SxpBc6\nIOYx\r\n=J8IR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDuegyFbv1aMIy5ZKcepd69jg12uERIYQcQfFTLHBUqNQIgVwtCOiCT9vooowVYuxHWFF5qqwIhlPV8QV4oZla6ecA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1904_1591315698625_0.6078480991301449"},"_hasShrinkwrap":false},"2.0.0-nightly.1906":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1906","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5d60c6897cbdfc50b105e83a8bc5392c389002d8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1906","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-AvA2P00qjLGXEuh8WMo25Hi0zsRluNr4wHLWy0Qp3Q5TtBcotiSjvsNQKYQ3VBsw1eTlEpWzymqlDj3D9Jtuzw==","shasum":"88d0a27e5184f4c05efd8da7cb7f20a1b44f3e41","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1906.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3C+mCRA9TVsSAnZWagAASPwP/0PiPg8kqhE/UiKeNS6E\nW7eGAZ7n681SnEHud35w3Wzl0IqcoYOzeYtWUs7c/SDqmx3LVKuGoWzPzmTC\nwu9qbvdikckWZwlSnbPRswU5q3nPkzhCP/jtKJ9CRq4u7Ag5MPjsslcCT0Za\n4g1mIi6HZFwhhBh/amfHUsi9+66kwHZadBNWMZwLNWjprv+pWKQLoEbcRt32\nnsA+BxRUXQKcfHA9mih2DXa+U/93lUYqg8yH0kkkpfzXa01RUnddzZiJ0ewa\nxnEUIdMBeDi4gMUpo/KlXBYTyWgcqCeJOeNCFjR++h5rONbw/seAniBVcsIC\n/hl8CTT23S8cfZUztCElhxiA7K7GRcKdmWDvlqWXmhmQWcwGCv4jFZuXv+U+\nMwZpCtUWYhrShZ5J6Kn8rvFjdnbO9S4lIcyyEYrLun19vTuNUCnRAvj+/JIS\nRvMXEMjeTv9zne7T/LrGKUM6gUJPVfc2T1FJuqiAEPaSE+7GAlKfjK1u72hq\nGS0CkSRQ1kxJficX5zrJrQbYXDEiFAwGIZz6t5/fXD2C1LWRq5jgakQ2r681\nzBy87/hDb8dKaMUNtZuPntHaL8Z5BrgclILG6Ki3Mvfmjanzp1mXHzRrCQMr\nMEDlZGMM24j2MQDPJeT33fu0KuaHHWkjICo2t6LGRQVCqAAK0jeHmphxkmsd\n9bI4\r\n=yk+l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCT4oJMgftaNLgYn8ZAG1mpnfV1MhwP8cFj7XOqUbB4FQIhAN6wRGHODW/CIbMy3rpsLG08AWhRbjJNe/9RIAhSTU7x"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1906_1591488421909_0.44587768071715517"},"_hasShrinkwrap":false},"2.0.0-nightly.1908":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1908","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"cf6a8587c489bdfa5be5a372d0757efb4b81568e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1908","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-K5VzCFMpmHvTFw7vOpHqVkl/OKqEdEvtwS/70NSsjULgkePnkdgO9YsXiM3kxg5tt+K/auRdrtuTdH4pV7cleQ==","shasum":"aece9b147ddcffd17bd7fc3ef967557113a12aea","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1908.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3YE9CRA9TVsSAnZWagAAarEP/iHYfiuscM01sgoXFBYl\nzQTresmATGYfZqpgL5zEHW6fwrkX8gBKtjFTIgNMeeiYM1uPHexagNRCP5JU\nOnnlZ0cFwsq0qjXs/5grr3DB3BNalPKsq/T0ahFe/5JSG9I2QwEkygktpWnD\nn9LCIr6SBa67+EJnjIT/iJmYZQ4BnzSnhQ9QhNaqqIBgrnfmqh6K0S8Rf+2v\nfryNNlNejDueQELSOmFqy5fC9abYSmaeT2WhEw9NtPgToyTNkR8beMWzSIrQ\ncQXusVGlQylVcM0LYzY2ZPuSs3iPYHQa5qtUIMYfz2YOrv/PiRCNGIRe1wtt\nk61xzyZ3sCBKf/b4Y7QrVoLUwVzPjaVD4CNRZHiFO9f5yr8KLJqBraifX8rH\nn5hAcwAZiHc5ITDjY7+6SII17Uf0sdWdPuPFY9TpAY4mFfyNIh7fHsjKT/fG\nuyuL20ddmTfJ75tQDbzFbeOIFTON9RCcJUiedzhilOlFYBkCsQ6T51qL/7IZ\n73aXF2bvCxkBzAfPC/JhRxo4gIEuqjw+qoSkcuxvnOiHCkwziQ/lYdnCmKNQ\nsG/D+GYIJibb7YFiRrSpcvx3ocX37DdrEiGimOnFCkbIsZFbi5Tlc0DFT9Au\nNa56MS46WP1GHR0Q5IOj7sTY+tV5tfAep3YFEMgCLcuGXbxMxx90e5KOGfYT\nnCRq\r\n=+RYv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmXqlaR8Q3ZmFXaU2Nifr4pr8s86iROOx5oUUZe+SvEgIgU2EgdejqqNyR/I9IyvCn6VUJlKVZes0UdZQ2MeOIsEs="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1908_1591574844707_0.6000586181943748"},"_hasShrinkwrap":false},"2.0.0-nightly.1910":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1910","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1d216a9411d029ceca2a13548d78f68d5298c2a8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1910","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-eub9jTyJcOEM2XX46YoptrVI1wNXnCu3Aw26DMBbtmOaz+M1l+hx+yaaWhbX1H6jIjTNJoQ8jYEopoWRd3IAHw==","shasum":"a480bd3e899ab8c30d804d7c1620741d95c75e01","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1910.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3tKTCRA9TVsSAnZWagAAtYcP/2e2mOSn34tgu/tl79eV\nseiOifxsaeF1FrEz2EDNj4SgNOYnPaAteIj3WgSLmY01lec4WQFYPzxqliFp\nDRLWkYcbGlGXjnv0BpGwbl2YtHqwGHriheuBqpNs9B+0SupjvEAvqNo6sgZV\nE5eIwwefP+lOZADJ1thFlagKoyApCUmgOgvihk5WqzrBxw9iNbn7lP5vJjd1\nS8+GrN9UzyumHKhOm3y+3GP596XcVVsGSAh22MBPuFreejpI32o+EYf0t5aq\nLMUTkJ8AJFuXBsGteWfKZ1h+daw1SJo1Qbe3BRlY4LSx5s+PGPlsgWoQWLsP\ng52QQG47X0RLlkkRspQM6FKYhMK5dOyGCzLGr9U76AEuXVJ8JRhljZgVnqli\nQD2m9bxdbUybI5QlA1TZGVKtxYeEdCaN4AzXq1sW606Ocolj3Ou05KOCzbwC\nqiP/PZC5JtkvTZBosBZxY4g7lWhYx7zP1UflSONtbvbugJIGj6uRdJkuFh4o\n9ABKFfQIA3AhvbHh6og1sw/aBMWfzqoUmfmtu82/onhsYumXqm/WrNdewyBG\nPIjWoMpusx0bnSSR4DnzzzVW+PnXR4H5e3L/+2L3RVswArtUdfgb448D3ktW\nUTnB8dpIuqB7uorwex/4xMz2eGsVRCgAzRa79Lw9EN+V5uI16CuliY+BwxKQ\ngHs3\r\n=dG4n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIATHBmUjHVAvL7nDuYmFCJ9GkvoIUugVgQOD3xUcjzJHAiEA+RRtuHFUer9//UR2T4rvkjqn85E4XjrLefNsqr2wK8E="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1910_1591661202810_0.5442834032889223"},"_hasShrinkwrap":false},"2.0.0-nightly.1911":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1911","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"4338719ec3bd2734adb2e7cc0b50bf7b3167abd5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1911","_nodeVersion":"12.16.3","_npmVersion":"lerna/3.20.2/node@v12.16.3+x64 (linux)","dist":{"integrity":"sha512-4Of3j3cuapUoQdFdKv9Bd2M/sSsdQi0SjJan/gKplOWxBPW6Ddh+85ykkkL7UG/LHqwFL2u/OTU77JdsYEBCLg==","shasum":"add885bff73b87d0e25db094d915b4a932443b33","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1911.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4CRGCRA9TVsSAnZWagAA/+0P/jnI5wyDjIB6OO+HuLA/\nGRGY2dDwi0/Q+K2X/hI278l6ByZe2OaydHwUjkVHO4PxOSvnyFLCd79a/g4d\n5rVq931JG/xAirma6RezQ5XxXvL1ds0Y4LJVFAYzaJnxTYmLLWp7y8xDlDu0\nFwnuSSDMm/4VIYF0by3mNc/x2VJXC8UbYb5XEpapcP5ivGNPsD0bfsH0m0mv\n+uI3fBvjcTnSR5jO81VUEJZtKPzi1QAD6/fmgx3FRxTW0T/Y8Z/ZbFwMqqnv\n6tU+342dC/to5C5wg8xRktbSr/1RZyEAtovi5OGcFWRzf2gJtfs4vdL29ljM\n3xNtoVlgk1bvUay7EEHl7ZsuOFTHUSvGAyyAShWiDNr5uiYP9BBQb34hgTRc\n4s2jbwYmi5hueJrWTFiMRPhV1OOM0pI7r4KCFKxt1+PZfoEPI2WKk17iUXI2\nmjlJOth5gclPjD1WxoyItnxocCrEsmPlNqPHQEWbo2apjdFwny4esDgCzws2\n79e+8cbtJA05Q46zbZKGlL+iHrNQnCA5/4KDivgTZZinsS67zUSzkZX6VMlm\ne236yqCS2d6Z/A0XXHo1glyN9XleBcTHSBvoUiq5o2ikAsVkpppT/iF5+Nlh\npjQsTwHnujTEDILd8WiRBBjejmhOhdvyYvJnBiqfLQIgAIcww+O/E1QWjBHo\nu6Vk\r\n=B+9V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDWSF6xI4UnjlfTA0TmqfgoAq8RCJAyZb9dOnJ6qljyAAiAPpBwyVxoMq32XgRDkW3cro7Dnh9+hCx59saav03Yr2g=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1911_1591747654099_0.9566977758709052"},"_hasShrinkwrap":false},"2.0.0-nightly.1912":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1912","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e95fbaeac705c170719f771580e502c1f7f5865a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1912","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-H7ILvzkQuXNoWHU5K3y6IthFG4JejjwEVwHG28N1nOSI8xRpKHLrQ7kNwxe9Gn/Dx/k4xm2MD/G27NE/IPbN6Q==","shasum":"3204d466dc3b882591f0498f967572f45f8c1165","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1912.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4XWvCRA9TVsSAnZWagAARlwP/1rw0MClm8lKGp8AVTIr\nbwxrwsrHvBB7QiCBzQz5pFFMWgm+DhOISHJZ2sPyqrFa9NLElwwVWrvivz7H\nw+cha1rvRG4uDSe95MRe1/9YYdwRVco+4dy5qRZYcie5rE29YCJWNBYoUoOV\nkAdgZ3l1ARGQ5u/Nrz5hJwFFNdzNb9/js78gM5aqIYGbzBH8JkSFZkvefhlH\nB2ytdy80FmbBITVldQj8eGXyCcvdVE90CelMvORzhmsizf2dmyzB3JqQFqVc\nujV3Ht66wpP/Ob7c5lir8EUB1FLp6Vi6QtWkCTRNrrdWVnMyTuWtEvNw/2U2\n5uVcUjBgbi06o4z8N99bINZqMeDSB9QSLWjsn6vl0w1F4lJXDjK+3Np+QH/l\nwvkmXc0+6S3PnhoZ7vWLYITRiBRnALXLivseG/zjblc2As4M27a4nVD9foZ/\nJ2UWQHKH3cGtpaSslJCwr7MXLhY8bNukPm2i1Jqmu3deMmxIwBoY/bXeimVD\nr2oiFv/LDXkluJwmEV+zWRRL6PzDtfvIMieLVc60dxS6gAxl+djwy43AVpF+\nJoRqNQtOw7mcjTSFjXG0d6WhCW+niXR0nNdRM3jNFDGLcICE/i8PDvUE2BOM\nCRDO/GW/O9IruB64Igtl1bV2fVuphwSbjofk4Hlo0hTwK+w0H8aEFhEW21PN\nRkYq\r\n=i3gK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuEVhuntCoqgSMFaYExihITfukl8L85dssNSZL9iBGfAIhAPzlfjZfR1CIOcmtY0cHLC/Gm7FgpBHYrgdUnCQ1+8rQ"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1912_1591834031260_0.4113268547582096"},"_hasShrinkwrap":false},"2.0.0-nightly.1913":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1913","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6d747bc66c40b4f743e472007954d8590daf7eac","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1913","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-+hZLuVsLZtc4qpx9UF3+Btdzwk1OGYipVpdsHvOEbWe3swVQIX1GuQz4bvJAp18ida7PS0u040QSGJE6/AgAqA==","shasum":"0bfd42258a99e3dc8115cd7eef60123e6b024619","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1913.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe5Wp0CRA9TVsSAnZWagAAKmQP/2dEpZ0IpmtPtBym+tIE\nWAKsKXXcxe+RpTYU/IiJhhaZF4HggjOyp2zGAkrtBJ4Ph4gn9Lqgc57dnIcB\nL+RLcB/Zi61YAvqMxfzG/eeYID4ZnBc36p0PSLpu/IC9nO4/9m5pmcP9HBFJ\n1fMbtYgMIXGnlpPun1RRS0WSMUy1jksp/eQAiBCFAbxIJH3cO1v316GCmNdQ\nQjWPj2AOTWCpFlbEfCRtX5CB3LqfhAjenBQ9qKLmAQvWroceCmdgIIX/b/C9\nb5O0BZJnLGKSAD2QsembEAI5JTcxg79b5QSOUCTj9PXAcIE0d0NH7VxxVPH1\nJUp6bXLUuiVbI4TAMt+qs9Sjh9g553LNdXbLVF+H7HY2PcMAeqacmib/p3qn\nPEHpCsnhE7Ts56WxyDSOtW7r7YvENBCCu8IKwjUzNL1X7WQvYP3tf43keXs5\nq+jJ8h1MJcBzxujm7mfhfGR+p9Hu2LjDHwwpM6t6gsZUOUdZwtHN2rDE17m7\n8L9x5dxn8EsYBCsc8wqQDVeHyuL8eic057CG7nM4+7BrTjWwfArnK44KpWvC\nc4Ow5kkLgH/TXnj+/BJZIwxCGt9ff7ysYqAV+BYixQlLNAxmwyYCKQiSza30\nNDB+s0NPYjy5ebptuKZD/6OUixIZyEiL3ov3ml0bXHFODb/a7YkfPhUZq9m/\nBToU\r\n=uiDt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLq9sS7vf/pxZ9xXxZyM8xPcng5NR2C2RSHcaKxoG5aAIgfqjp6cZ2gl4HbHRdFnq9RtKFJVs5VEYFxw6eMVsFS0g="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1913_1592093300371_0.5842570883921738"},"_hasShrinkwrap":false},"2.0.0-nightly.1915":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1915","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b3373c08df19b79d07d1e0fd20467a0cf3132252","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1915","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-fNADtmSX1kN3NDJgKFgLDk57QbAhQNDV8xNhHoJPa0JDgdv8EnLBrrDTOd8BxKg8MZeDDk19BP8IDwHcIjHaEw==","shasum":"3cfd5f2313947bc8ee6b073232aa3296e1a88259","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1915.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe5sCKCRA9TVsSAnZWagAAJN0P/jCjXee6fM9jsqR6seDC\nSvKA+0lH652N58JDIg47pXPk1+cZBbV0qnuXrlxJgdVgbCl7HLKXMclg7tu+\nrxh84pYyPGq2XoYsNq06niKSovwePRmK4GOKKUi8wivSVO0MIkAA3GLUk+f6\nZF7U0ZCKF2wppzY2FIsa57BppcwolM2HchaO4Akp2ZitlxJMms1jxX8sJClO\n3C4IW9xz80izKNQji+PNrSZA7QAgaGyX64heAB50Ufl1KkHug9VjFv10scQB\nlWhu0CnJYYvPqgO4G9ogjGkeoeX4qk1Mr2xcdhXru+Jzibu10ZMv8tOM4aT+\nVQj8QucBX0+74e574dUV0onb2QFq5ippELq5gqAjhzCAdpkIH6S+RhXOEyv6\nR4dfYq55Ek1iXhvcx3huTF5PpcBPzJ2iWUKWljIRydrEi/ZHNcHznwyx9bFU\nheZMXFkF8dvZyea71i9GQGGYgroknlFyqMUlU9l0D68emEb6yhCftFGRPXLZ\nu5INsltP2pGjjjmDSnn4aKPxt1UCP7t0ZZD1055yDy6gcdeSokJr5DZO5oa6\nudwPubTikx6KRSJjqtJherf+kdCOG6XPRQW81SpeYGUW7Y5Edu2i/dZc7L47\neRjJB42XavUVXNpCTb5XaS1CdL3W5Ga+jwt+kXCqp4r8ageGxShOjh90iu71\nQfUp\r\n=2lT8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNKgh4iZo+UQiKvRfvnABVrrh6Kkvg8B9uIhV3/qjmbwIgGTRABJWysrgMgSJ8ww/P1Y8/DrQqjFlEEQT8J+xlr78="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1915_1592180873683_0.5201828895129634"},"_hasShrinkwrap":false},"2.0.0-nightly.1917":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1917","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3f9c496b1ee7c72a4c051e903001462ce6eef449","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1917","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-UKAsQuPYSZe05DjdwLchCfvNhEuuZtIo1Up3qdBVmFzHAYfd6DuHqWsnSEpm3Gfxuzx7tNqRzd5esaAyyu2ubw==","shasum":"7c8142a7b68df94a4fbf9bed0a4c6afee563e2fc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1917.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe6BKMCRA9TVsSAnZWagAArXoP/0qrtRQM53u44hNfkWfQ\nQDCDUlKvGFI8VTjH7Mt6CcNjslKplM9yvaeAsAmuF/dqdQ5IIs4Sl+jS/HTt\nYUuhBBYAU6zoPnBmWqbY9EYr5t1BB1wBj8ic0m0yZ3ArUODxk4XUHndqvJ7B\nHCazpxGTJ0/jDmhYJz41qjUMmj99z2mN3Dd6mgiPXoiyGlHtHWyZg0IuDSs1\nwt0Kz7AMU0zWHsD13UwmCNgwb6d1CFDoUlvmpsQXD8FelciH58rcG6/pTmbX\n1mICZ3tSNIqndRVe/9OtnvpAMIAHree0G3tz3LWUCAjNMJvaRG+t0VSOk6OI\n+lHzNYcNEDF1pQlB0TGhT5lKUoVQhw8s7kOtCN1wywcy/s+obQmMjuKyCxTP\nft0Xbzhap50UlEkTFmXaVXina4Gm1HyAfqbYu4LizWeh53IX6NeWEXErKl0n\nLipfw+ncmqGI/n405Jzd8jr4l8EoZUJSm+aSWeazhAR8xVsTSd73z2IxWD5p\nSfaQ2qf56opYOvvnizmGc5uwB1AQ0gOzD4pPA8GEz1YeZhfPzeCt2a7Knpzb\n99g+CMAoQ7APRLchvoSfcezf5x84YCovxB39coQdfq78H4Npz1YlOOaUcKgZ\nF3+BDV9FGcUDqVSbdwj72Rw9kzrvmvv6ptXC7rxVc/PdemgpS9eqYrAQTuXw\nn8nz\r\n=TbB7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4mKH9Ppxmh7TDw0ktUaWcgfrbXamrfGJEZ1fz6mezBwIhAI/WO7NvbcJklL0akcck+TPcTsSdVUoGCmEPz/qgiXWB"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1917_1592267403809_0.6460001115513252"},"_hasShrinkwrap":false},"2.0.0-nightly.1920":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1920","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8fdd6193a20d0e82e7639115fe31dd0ff145589b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1920","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-nR4mxoLZwNVtkIv+xHXkpBNSYwbJncYRJ7OAotHuCa5GFguMauBNYXSaTp+nZNfKSORh1bfbYg5OS2yiDWM/pA==","shasum":"108a40db867723890d0e223d8d61fe3dc1d1e665","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1920.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe6V6+CRA9TVsSAnZWagAAJ6AP/3tNnm954wGm1NcLcqQh\nOHgbBlO+GMW21gc8Yjtk5xHZ6uT626UHhwp8bhztT4kG89SOvs8F+NRkZCIx\ncPB0y1i3t26S7ioLNvWINnRKGqWCSGOMzrHVLop1YbTvvawQRFyRh0O+zSaF\nxP9tCQiZqFhOQeHPmGWWv05lMv/gDOj96WGgxwdcb9qrvl604IXygZLUfk5V\nBs4Dy3oYVQFDAvPAaLFo6uPnjMwXWUR9jTw4Ry1ovgBF5t8FW9lLPdGHTjD2\nOjXMK3r9HJ+USkZ5j5ACeccgxuZzQka92mAKPNq0Pc/k0j7mqncQquLtxjl8\nsDS9D2IpNrlxL79/9QqBZz7TdVkn+Qm5qjLyUKjUh+4rrVGZxFuRx2qq7VtE\n0+Ufw+cNkJw67Iw9sH2qyQ0D7IAfTiPsHKrTBbtoA//kiOad/gfe9l6RyAai\nbmWpbHckLBaFoHf4RaRs3CWUx83RO00swDt6eDWykpxQQGW2xgaBlNQl16wk\npCVEISqgdYuW8gL41rslca2X+wrqBmqViQITv7mWQp/LJA2q0oJJ0fqhv8KZ\nBMahp3Grkx+d3EAOHYRiBAchpC1zp8mZN7r931D38ANw7ECmO2nJAKC71cAN\n24HrT+EZuDhY9L47lZwceTnr4+jbXpSBRqRd/xXaxPzA/kv0jMh1bawLRpGa\nFVaz\r\n=gq0H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2enwbgDhU34RK3/HiTD5bzKC1t+JErha7QCbHYSj4bAIhAIeaNSrx6B1oKDrRIlUwjkroJ92v0m5H4ty/u4/Ej53t"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1920_1592352445989_0.5378296198418511"},"_hasShrinkwrap":false},"2.0.0-nightly.1921":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1921","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b8a91616850d754b85d64d821b4d765aa43a2de9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1921","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-GlAlDoZ0UX75min19HN2Nj61p7+Om86vLZk6ZolSNPigi94YExTtp9XKVnq/pfnpuQPdy3ujWLo63ISDxDkRLg==","shasum":"d6202ff674938cbcaf54a7f6f635e8900fa98e88","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1921.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe6rAvCRA9TVsSAnZWagAAb3kP/2TLs60sJvEK8r+boMpC\n5fgJQ2zNaKZCG0mApWaOsBDs0rkvbudLT/Qp/FbokgQqZzMTp6J/yBh9EyaZ\nc9pK5HkXkFv0VMoHMtrnf4xZxNH9yxbXdRak0Y+9XB/LFVVMi77OBfKIsHBl\nVAR1i7g870nj5rIvJJxDhK+XU6KydDs8LQZjadxdg7pnURY1V+WXSyUiT7l0\nQSK8k+jfXB6xvMdpFiV2q3cpuAmIj8kvsittg7ysU9vvhh5+ZLasrstiQGsd\nPJ9jeu219eiR0NcdEcDv20mxT4q416FqIJ9DiA4iJHGedVv01IvedSX78ZOD\nwpz31PUJZdZLj6jKv1bSyEOLMwrQi8GyIyKCvOKheU7GPNA01jnOJXUwXrWP\necDAyAyWLdxmVdvaS7Ah7jlws8lUi+vlOGZJr6cvJW1ZadUMvvDnXKfzuW/F\ncXGuJGu0OYjkCX582xxMmZUPEiNHyOusMZeycxEoooVWSIPXYxRkYZMitj30\nRrcVY8GOEkhBwlIQJeknqe+x91sI+lFLj18TwInExWgwliCXmEh80DwZETnH\nvQu5GcQDrGKT7CwsxyZggKYrcpj00yiS3Rm1r5aqxFCtDRTVtfsYdvkzezbN\nxYBpcF7bkQCeAboBzVFn6jkxydnjg44MgkVVkwhXY2MKGrFCRu5YCJOxrmwc\nDWou\r\n=ld7B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjOoxQd5dnchYQS3tYf8OUlN7upDubnESWwCWNini/bQIhAKgh0tBgNv2naOQQmKdLTEBKbF2UGNxpBQCbfQ6U8qZj"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1921_1592438830987_0.8454749115113027"},"_hasShrinkwrap":false},"2.0.0-beta.1":{"name":"@parcel/babylon-walk","version":"2.0.0-beta.1","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"74335525be92e23bac4ed1bf30595443cfb238e3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-beta.1","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-FWZErHc2Q62lrWxfMoRl1mej8HCr3tXvzeVgMfv2cbiOjaZIrN+8khD0AcRyesnm5JipgT8KQoJvl8ZdU9DFAw==","shasum":"feada450c819c67e3552c184c6b30f914a7f54d0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-beta.1.tgz","fileCount":9,"unpackedSize":32913,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe66y2CRA9TVsSAnZWagAAgP8P/R9zTiCmLpwCYe9AIOb2\ngi7APAoLQl2IEr8xElCR6daDtHmdNXdb48GmS7TqTPXngVuaa2YPs7u2PjBJ\n3qyQESZWyV+ajNvszuh7hYlEZeL3IKLVBlRfQyZjae9D6XvWqRUH0VSnI5/D\nweoVVbKgnmE7olMPEmJu0froKOqyVoGaOeYoRF9RZ11BOBQYv53WsCYjST9O\nXn4KK5zPeUdMEyska16JotGSYEUBL3nq/SheycxLB3b5sHSL+WpUMG2qvrFR\nkjM/h/0lKxO2WE66NFDqg6GNkHVQ7DffA36XH8MZ0YejZbAcT9KhIDzO3SxV\nn9FJwBkT3sLIsvHz4EYwypKEaiIdfqdyvfTxRjiVHKIn4qbfnjshJmWz3oTf\n/9kBo4gLTDcgWLkzS/Mm6PoU79jMcKndqzISi8oBEJ/bSce0JkWf2YBwzepT\niWeREtUscyo+nUACFQkUW17OUyYOUn6/ofvBaAu40UEjqsFtJrKX557dj1JY\ncotAgoErEn2yvN2BbSAGXwFYbOg39zTi9Ive1/71tH/3IrFseb+79se+jXOr\nPsWHFlzaZqdAXHKO/8kDvTs+p0RKMC6bBoBzJmSfuxbocHfkkXzEANGHfWsb\nYd4+koz7/TqwZKtrYnYy+t24fx07K1QlLvaNe1DvJEEPE7VePD3mNgmFqpGR\nG4Dz\r\n=YY7q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDz94sKY0G5W7Z9TCu4lP8GLARf6o8QNplvXvsM3AH8RQIgUeDmhZqQo/fNVxNU3w06/a1UwSSWgGdcoIcuTCjtlWA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-beta.1_1592503478529_0.19370272599789917"},"_hasShrinkwrap":false},"2.0.0-nightly.1924":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1924","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"509b0ba8e76b73a2c97d4526d0f190bceade71e2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1924","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-cJcPYSQN1xqY4v3r1aVW9xSwGtu8QjMORuBy2ltKtj3K9dOY/Xz2wOltqLevFlkqA7XOfJ9yS7QUmPLkiGz2ow==","shasum":"297846cdc91b23e3332570fdb2390ebbf922ab59","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1924.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7AGnCRA9TVsSAnZWagAAG9EP/iLhWlV25Hwd7wWrCxjD\n5XVnA/Df5kAXHTfmDykgE0I10ndH15aoU03OfQVLct24t5p/BNJE+JrCDM56\nvHSs5aTN4E89YYKrnH/xkU3C6h5GJIi7Dvv51XgMZASHK8BELuKHUV/GMQyJ\na/1KUHian8pApFP2XyOIA1Mpam712myuRRxgHnxkEeu8IUcw+PYNvUxaT1SL\nAKw/hN7RLGRs2M2x3GXgRSaE3KLk/CXYGpD4NX94k8DrT6rMQW29uyEPLtCO\n1l4EjkCDjwsTiN6psd92lsk3mJVO7jhn64BMCBj57+6hHIjFm0FtFBulJ8Vg\nbJhM2GesWuiyZkfhyfG4eQkyNtaEBb/PKXPxwc4N4/REd1bcj9ah9pYO9qu6\nZKqrvxRcJiwknF7vKb400VwHSQq83+BujnPX1f7s755l6VzcPyeBD0OwO6HP\nkOVGc8g1jXp262H5sXvbzAvOH3rF6FwK69TZ2ONa8NZ6M7pslMRInabV1ZA1\nvUIMTchddfzOneO4T75gqd0u3sUJ/K72Sb0Sldv1QbHUsSUKmPUSVfMJJEYc\nbwTfrseRqxRjVkLzCJNxo+Jmg0LJ2WVUPAMx7k08dwQb5pnyfXEVNk9OhMqV\nL+MFREfsbLZeagimWbHjnRtZqBYrDR6HKDIDRLOs4OBkDPnA6LpObYtzVEcE\nvNGn\r\n=XPNC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGhG0vcqp/4mt2RUesjGyIHd8e6bzWj/nOzRh6iZTblhAiBjFQ3KVNrjIzVoTlxZOX/UrFs5qrO1i8JJ4dkhs6NSTg=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1924_1592525223188_0.23471678965327114"},"_hasShrinkwrap":false},"2.0.0-nightly.1926":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1926","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"cb1bdec606e581265782a644481a36cd6152397a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1926","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-mhV8sFLoXMD09CALtZEz6hw38iyXYpRmkQzF1tePmRIpsQEsUO1H6jFMVygSC5kjAJJoqm8kBREk9A3mtH/LHA==","shasum":"fe1f91066b3f96536edc967ea7c3d4155d69ae57","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1926.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7qTRCRA9TVsSAnZWagAAM0EP/iXgTs9BGKG9vU5pih4g\n2jLqnPX6cZj94aN+DiNw9MUOUDyAE/s+UHkCCK0XJnpqppLSaZQxnP4Cwf4l\n5JSB2NxoHKA1QHPjueXYocpvqU7XyDFjhA/bMxNYyVJC6NbYdRVhHFbTd+Lt\n0ZE01ACTFkdsj7wnnxdoj5RMVRHgatkI1Bx6/zIeTf6xCVLmF61xI0R4uquJ\nrFq9Z1U1i2YmqUdmuNLNtLWuLZnkSuN2338YtQpGP/Uu5DrFvX3sQyO+Lg0E\n3Ka17Mf61eKjGGPY/kFn+nEdw0mQax8d2bTrY5oo53Cjc9VuqH3YwtJNm2Fr\nCFT/YrmzeWYcGc8KgJMbc/TySMPMkHZbFBfvlRy1c6lkkxCOYbAhUHkoeocF\ndlA6bpwuZDnD5x7FftQUT1z8xHxtSPDCOLNzYwmOD/gkdHyPD7VjoLUiNkVU\ntulOpIYp7pHUFbmiYD5SvfSHmMaOweuVz0zq8JCrGUlx4sn2OnkePtbsLkZV\n+KYIUaX5cJkiyLiJp2NZdOFqvvACQnKI8ws1x/BZq9shrb3orCqInPG2Agw+\nbT1boCGYq/2PyErgnUYW6O9125QtOSfdhoAsegkr+x9yEvTTt3s77wtb20Pv\nLMJ31rEix1FkXHzO4KnniUSFNmXyQ4vX+D4ro5opAEQQBKpUGREZNfjQb0G4\nbt5k\r\n=8KLO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKPIp2GEDT4UO6qCvmGjireCgw6cHXsKbdeX6W4iqqZgIhAMsn5TJo8IMRzC2ZBVPXuUZiggfdPl/gQXglG1aj5bi5"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1926_1592698065539_0.24157013493528212"},"_hasShrinkwrap":false},"2.0.0-nightly.1929":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1929","license":"MIT","publishConfig":{"access":"public"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8bedf289800fcfadb9d54be7211ec1f642f89e3d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1929","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-I2oDYKUQkOQndIvdR7KyKDfOv+jmsJB2zPdTsq6e9elPGaPKaTfTFAqJiX3Vpm1D6sM/vs4NWRlfnp1wuwxyhA==","shasum":"a7f17f7418a8e7eb6b2951c2331ba247efa44d64","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1929.tgz","fileCount":9,"unpackedSize":32928,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7/aWCRA9TVsSAnZWagAAui0P/3iaFNP3j7jylC1h5Mh8\noeebWgi4yYyLF/b+LG3REQEW+rEyK4BvVPvlsGLkb7pAR/JFpb3/rvdw/KnD\nDy6jHvr3vj5STOriSIdH0wDM7+ZflDg/GvkywwPem5zjVCHVCq7KP3QKrRzi\nvtbefQH/D+vhRhrZBftndi9r36u2d3qd1MpXqikVZQ0IFKYxhvKaGVjONskA\niFKdZ/CqxVwpfPL/RgP7wZEeAd1o6CaVbcutVcrfrDuPs9JX6z6XjuJwTzfu\n+IXm8ZMvoj+3gI4hHN86nfBpkLbuHXKzBHynOKRnLQLiMKm1WGHpawEDok/z\nKnOpI84L8X4WuZTOGwq3W0x92rYCI27673loKSNZ8rnubA1Daotz/LBwqFmw\nFxv0UcrP+TluU5NE4nu3aqX7w8KO99oVpNlZ+3bLzKqsAYxCcr99SZLaLTYt\nHLFzp9TuVbbdpHrc7cwhCKIvjKIDr3Jid6yg0X3NDf1cTe6Ed0hmDR9oW+8V\nV8yju/54crUCK2/V7c0MeZnKnczIaF1yY4tYct3VR1M8lQUdrzEYsx0zoBI8\nUJLdMvdY2MpY9j4ItDhaSu+4DKPgnMx4pIvGPGql3vz8mSpeZZOGHQWKZyCQ\nmT5s8RvgvWhh0Iszlxva7XcYYAin1Jd27JFCCj2jEfn97U18u41N4Ap9tuFk\nnXt2\r\n=vc4m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBuLYDiHfnBAClVdDSu0k5J4f/uTw3PXTFbPsOliLhHnAiEAnUVfD4kpaCHetyQ7qv8ePAXwJv4Fr88+De4w0UZjAmA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1929_1592784534060_0.6965147883671865"},"_hasShrinkwrap":false},"2.0.0-nightly.1935":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1935","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c12022d9abc39fdb52817d35f5ef7d1c8e5ddd17","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1935","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-0Mbmt6k9llDpB9kOlG1J/K+zfqYLLWTNpWK0ZzDBvcDg7i1WRXbFi8cWnkHRJNiu2sto+mej+QUDruIVuxMduQ==","shasum":"1e637d6a9725680083aa5cf890512a566c11bc61","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1935.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8UgsCRA9TVsSAnZWagAAWR4P/R+GF6uiK9Kn1pZfai45\nv9dhCknyHXc1fITYhMHqKLGj0cSZFoQyYb9RJ1NRTx7trsTDf1LgBTVT28uf\nDfZBnaGXtCNX1FZsVt49HJTORutku1JlZz1OefS3+Yq+jvAF+i3XFQrm1pSK\n7oDikdaZ8QVKB31PsUD6hVrsI8ptTra7t71Y5sZXX81VurHE/9CnO2ZY35C6\nN4hUepYwFpujvcDgVjSxXyrPYISu6XbqjO9CgkynQWFS6j+OBYUxBQsx4v4o\nv+yVTE1n1sJl0LxXEf2XB0Ha2FtjqFytCpD1qr+cmBeQ4FmxNU7VHQW0yKA+\nc9g+c+c6qI5Ast0nXudskWtbomypSx7v2lzLv4AOyt42lEdooYCmK1EZGcMj\nXSaHAGX5IrlU3qTrMZpDJB9XPjb4CDvUunVAbNW5iB0vecjxEAgG4PsMfayy\ncJtSYPTwmbC/CB4WQiQkiXbSVIG+RidbLV89ZyFoptFBGqKcqs/okkeuuAjn\n5JeBmGlj53yGx8iPqWg9NlOE/VT02LAnmJU7YLYsOn61LgS6/+WaWTF/Kwv9\neTSyzkPeQ4ZSCA9Ny/irgV5VAadTw3Pj7bIfvzzhbmbrdB1frpoqpXVfjq1I\n70lx6sZXMm6/zJsMEpmR4Bq61jJali30TXb+xKkpVrp0gmegue42n0yf0izK\naern\r\n=ZeTk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9ryvhQ5Zc8KfQGqYCWrnzROxIYw3+7BkE/CQVvi7LDAIhAKhLvbd6+ZrmhM+vBu2IxOO+PHfv7a3E8LxdagtFwQ9X"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1935_1592870955501_0.26133684329872575"},"_hasShrinkwrap":false},"2.0.0-nightly.1937":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1937","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"d19bee10bef6b611c02ef8af8b40101bb0a238cf","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1937","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (darwin)","dist":{"integrity":"sha512-OYK0KqhtYkSMgPGsykPVALBC6NKRfFhYu5F55iAZjapjGrT+wB7S+JnpUAMgkRI7f/NXA8KFnqvJfGeMFzoLIw==","shasum":"94074218b622e5adfd6f1645b23d909f3ffcdf05","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1937.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8lpHCRA9TVsSAnZWagAAV0oP/i4vs6K9H9Hyx3xUb0TZ\n3jHpsoAyQbQUFTXglIs2W5u48DwTZ6swNGvgbzIxvYgtjzxUtHfQGUSW+TTz\nGDdr3P8jEUUZvvdzVCbFIRh2IvG7DMoPU/3AXqGqUmfZ+Ab1TN6DM4BW+Fx+\nSGqUC+/pCfJ91elZt+aCrTrCuMGwqcyxBkl5y3ouKL/xWfehX/t90D6/YKKZ\nuQRSfryLwpX+kQrywf2yWlVySy3Tl65nXcOK9sw2u9eizWu5+ibd8FCW6JXm\nQHn1WH1Mf+JILCb7xAo2RuLaZd3ZpFUxJKAAGQwkpM8IXzv99tfUcgDTPYwH\nku16BjsdPad66X8LGeMiTO3sC2W4YflrIIMfA8Rs1t5JwbaXK6rjVtC9IPsm\nKX9SpYlUudFwwEN2cl62ZTlwPLnrjd07uJvrQx/B/ki1ffANluAC3BSbXq7O\nYeMGDOc3Gcivm1Dr8l5nC7QSgGJdWqRXeOCKXy+UP/Cc3P+A7ikohqVVCqx1\nMPlaGJ2BiMemlN2xiyqdb3Ho3WKesQ4dz6v1Bxi+O3W+V8DvvRpDqB5cvngP\nvs9tSpstRYrKBd1pJXWj33ZR2NQSzT3ML86MzB5sGh1PF58tRy10z1tC1XDp\nxHQdaEfrkfEIi/QKBy3/3Rya8N8CMx6wD9V5ruXbie3J0+rFBioUr1cTO2Iu\nbMrx\r\n=cTnU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEoa7tvzyuA5UakWUFFEnJGlRku2v1i4Lam/95PXkWs7AiAfS33EV7AowlxjXhLqCCakg1cLJD6Xmoo99SneGiqftQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1937_1592941126995_0.2872633340526689"},"_hasShrinkwrap":false},"2.0.0-nightly.1938":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1938","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"cc5b4862699a9020c0931268e1c6e5b0437a6179","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1938","_nodeVersion":"12.18.0","_npmVersion":"lerna/3.20.2/node@v12.18.0+x64 (linux)","dist":{"integrity":"sha512-r/2FfIgH4r75EITzDMVVZKjZKk9Cm122YqapcmzInaHEJHC1FaBIlkpV4GRjV9SKHzWdJ0hOW/1OuAj1dNru8Q==","shasum":"a22318df8ebf6e71e6a6375b47f1d6c7b9ba486b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1938.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe8pliCRA9TVsSAnZWagAAlYcP/iSpBTN8m+I9tdIZfBej\nfE4jeat1OBG8m/OyMWPzWGST4BBxnuNkNFp/ZLaOlmHfCC5njt3mbgzyQzD0\njePOAxcRW/Qw302+/QYFwFsqoZ7+0jpdsS5xBvqXx0vLNg4zqD32t9n7MhVe\nY86n8sidmZfMMCvasIppKaIO3vuAcu8UK4gqV2pG0M43ngT3VDpnsnOmFzs+\nKlPuSVUYyQTAxzXu2yX0FrR7J3JBszt5scBGwu82lwlaZtyI89+PNz0bvDBc\n4J5eRe3454j4yxXoJnizUABW5D6rIgAQ/LIZf/ez2PpY4AEiii6qCS/hqTLf\nzgvUAGSrUtY+NxUOOAOpUazDznZ8arPt55AgBlHdz4CUBQ9ioHsppCOYKGAY\nXghjgWasQa3uImhggGvM/IQVeTcxIlGO6hcWKcDoX2PyHW/b7XNjVvaURDoB\nYldipTmrZQLbe83Ren6gqpet4hb8lO/0jH5A1e+MB5kiCxHY2mFNwHnCjGOS\nKLL0C1HB9wP3IRLE/F7/tFoazvY+rjOVRLpRaBat82Ixwhdo2HhjwU5ZrTX7\n3khnI6WovXAHK0Lq/ND9VJcXI/mRHIfPsZNLYw8GIFoASZXXm5zUrO+Dvir4\nPHKhlCHT41rEC6+41FR3PKNRI5ZBI390eY/8IbHbL1yfmRD+iuS7qgx/66DA\nZVgt\r\n=Ece5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDSCoox19UGKs5whamJY9oiNMDFreDtqtP1nUmkO8XQbAiAHbom7QntfxSTwT4eQbkKKVqxEW21gzpQDdbO8W9Yg4w=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1938_1592957282412_0.26547875788190156"},"_hasShrinkwrap":false},"2.0.0-nightly.1939":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1939","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5d793be7dc55fd3d80c7b8189e27c51aeedc4478","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1939","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-UnWrlR//t0JQXeavOlAwfPpLou6lP3PoyW63m11/bbGCPpLw4tFhjguXU/fQHSpyvl9fhpfnbn07XlxO6Pl5wA==","shasum":"ebfef0e68034bfe7bb086a6a3ae475cf3b94794b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1939.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9TyRCRA9TVsSAnZWagAAf3YP/ipyN9cT0xfpovAUFhSo\nIQW6clFLm1gNdkpWfxoDdzTqLXwh4GEHhaQGFEDBMk8qzGRUArVFzKZFpa3S\nHGvAkD/fZh8fFICJiXjAKKLIqpxWa2AJhFsqHK/bgBLBd3Crpjzsm1BZ7ZgF\nxJrvOXErD1wJsG/mREGRa8TO9plfoF79UlLR8arwdR9tGqntCf+h6f2aPwb7\n53DwFUyY3y2nqD3fTEUKxCJRZSGP/imqx1iyTQMuZssbsY9YJVho6ggVCz0G\nTuqKFFK8IseDfMhCLdtkbVsfQVrcbPnvg28yuQRWf7o1wiijTVD4+oz+VTHQ\nRwrwx6uRhRarinuItACSSaiLfO4UChIi3B2ZQIF15Pdv8SXVflWCxrJB8Wnt\n/9WByh1Mqb72wdmIL+XNs74DMCT6OZvoLs1/Dvzil7W4WbjMbEfCKqFScvPV\n4nPMNOMO6m0eeN+/P6h0NhY8A8nvTWXnyGwvdjzYS120Tv+D7oStJlOEToaA\nZ6urqiXd05F81hyYYdETIHc25VV6bdVi04D7kotz6cSjMK16XJW4/Bw+nBHh\nZ6fDWEgkiCK+4qYTmqLxOSlGzPTEXKq9LcZWqbBjJuKmyXBcurdj1DJGjF5L\nf9JHnllJbqMZzKd3If+hSd7G33v1zm/+mhDYqE7EQjAeXQ14lLW/dPqg2lKE\nedcU\r\n=z2lr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQ1b6XJGRTOR8jKObHb3+/vfdHMI48q/Po2m3Qc3+v8AIgdLSnQYtvENzdhowHnjrMM73PqkVTDgIFZJNIvxrrtng="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1939_1593130128857_0.8811302308468159"},"_hasShrinkwrap":false},"2.0.0-nightly.1942":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1942","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c9748bcb7778062b626bb30445a2e7c1478a5a5b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1942","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-oxFSj9b3e6YpE6q2V6aZQ/tj5AF/jQqTUVJuXS2DSekyUWidjPMTnvaWCKER1hELkdQoDe1GOQuy86l0CKtM9w==","shasum":"b3b0948c99aa29b36251eaac5e42228cad2a814a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1942.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9o3hCRA9TVsSAnZWagAA38oQAIsWqGAzXucz3ANHva0J\nCAMuTtgxeUQZ13Vzgn347yzKn6AnZhmJgKAzW7YZPpsdV1LMcEjiAx+N8mq9\nIsjFG4ZX7C8BUFfJ6M7h0g+TAycrCUqrAnDAz0FX/FxlUStP4qWHGy4PKHT3\no9COsLf1uVBWdjXmHUDdHoXc7U8CUlkA/kOtFPOCI20BeKg+HbSjpxgSoKqM\nTdTPH78jQ7AJ9tLu71LNAvFco2qOdIGc04UXDUjnISjirXoaVpoBjnql/pwR\njZ9okzxo0Os2JmXRdnX2I9EhZZNvHlvlAM8HXmGThrVEXsb/5oc6+CDR0qXQ\noKwS8CQAyMwoTLB0FhWpY3g70Kot8+HjQ5j/r+1FEAQbtOGhb6Q/+CLYN8nh\naryh+/CGmTdPxiq7/CXuP4YiyFJzB0ATgnWNHE1BvalLHfF3byyEd+xxLfZw\n+7yJIxs5x9DPk1RaqAy5+rjBfo3dN9c9T929PRoOXc8w6wJ2RKSNEyjxRpUk\n8ifjnU2RnLYBfiuOacybKvQiskvfwgY+4rJjcqHgT4v0Kunxg3qsP5EU8x9u\nSdoe/HTb6bqg6RWKcbZewUjj7pmHMg+H2QNmAdtciJe6Pum7AiEflmfvnzga\nKxcF4vro1NOLn2qd4KKYSHqwFxXHISbgg5JNFvT727WtQ+2Wq5gdIWHdVcmq\nemqD\r\n=TcKx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGB0gsbvGFCMgKsVZPUtFaB46kbeLaxmw0HpbnnTwHhZAiA7flF4yA0Qjpe5DVZ4nQhn1DuZh3MMRRluyiZaAaZ7Rw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1942_1593216481378_0.36715119715796507"},"_hasShrinkwrap":false},"2.0.0-nightly.1943":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1943","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"457a9c5f5f2fbd7b1a70388c19f545e011d27c7b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1943","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-cvUnmdMq4+LTNcE4nl/egsmsL4SzkLHQ/GISLfV9hqhL0YxchONW3SztcT64H7mzN9xEjgUYbnAUWBdqC7yO1A==","shasum":"619c51231f5ad99ce03795a2e2ebe6da032f034f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1943.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/SV7CRA9TVsSAnZWagAAhPIP/1MLbCnly2cm1elI+Ohb\n6cORM4kENTpAioTVTRe/3TYelA6IL2FHOE5obegNSl/gGBPGyhd2cCkxQcN4\nZX5L78N325SYXbL2GP/LX9wNViHC0IvxR2jLwq78WNMiLuLPlngv5VVtWIp3\nmeZKiNkG3ye/fQz0XVrYvrL8c6/E6IPyZ28YNecTzkpunsm5MuSDRp8qB9JH\nHOgUjpNMe4Ca35tqCKzz93csz7+iwvqrUWze1pP/6Zutl0vD6OspeVnxoz6K\nkJ8oJ/aBTic4LMluwCKmyPbq1xtUTl748ttgdXMrr9jevh3xb831ib3z1Jkz\nasgAU2fPfeh05sZtRfTvy566L5fehcpkxlm7QMWwp5JBw1mmMjMAtBBUdVD7\niQs6nJDCSwEeizpBmGs1rlrIJz+Xl8cWLrqIgwvzJAUnXT8awJ6YM856Pc+G\nJ2meMIXyr9AwqxrPmVM2YNY708EE/LxVS63BGNzAEHlfJNgNGp5SRzcbmV3I\n0zCO+NpTVrWMb3qfTHToJnF7S65jYTMR0eXFXYPY3FkMb5WIH84KIMeZOJ/W\nK/LYhJIphlZLkuM8Zfej/Qiayms1ij/LtWnDNkDoRGcDVu0IKJPxHOf5DwSS\nZLhiscznSTB4og7o31XPGVEqWPat+tJDKVWlDN5oS63JnOGojU02JBqKc7FC\nVkgY\r\n=K2LT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF09Y0qN6me4OJItHYEXS9EM3L/5ad/kkkZWCBFv+xcSAiAT8I5STms1q0O7kyo3OPRjkhr/dTTzXfvPPXiKUtLeng=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1943_1593648507079_0.6976572835269046"},"_hasShrinkwrap":false},"2.0.0-nightly.1944":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1944","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"78b7910149440f34faa7eb636263e98967a8eb22","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1944","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-bTT1CD5awc7NERIAZBY3yiht2tF6uuw4bImEqzUi1TK9rm/1sMM/6AXTToI+PXtA9J1gHFcN2YlW7xLi68W8OQ==","shasum":"0b756f4403f8e8cbb496574d0fc5278af28b9e57","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1944.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/ndxCRA9TVsSAnZWagAAc1gP/ixiaXnVaWzp5T3sA/sX\n2r18YIYNTZrDx1HEQyF3fsu+D6ZxO6UpbwzNz33/QOIXsOD2BhCy2wSDRWKU\noag73yZxBBuas32kWc5uuReinVFpdEUjq5N4sL1PM6NCwbDaKNBJpEEiMrho\neSUavLmdrgF0v1eif5moQAWkluqvdQgMbgx6hXYEmU0b0eaY2Hy+6veCq9RH\nC/W67VDfoWyZkpEisVtg97J+JCRATfQOXYVV8FPh2m7Qlfgiw9vUjYrBsD/o\nt81nfqTJEwXCfZcdRaNkDvW8mtvxxgYLcdyco1DGMkmExv4YH4esF4NO37xr\naL4Lrtj7Evtl/gF92z5QDeB230/RRQFSi0a3Js4IxaeY1HnMHLqjyNEyEN5M\nwY41Nl3kaY2nps3isym71zuIJuL6HeAkdHobGUsnPT4s4ysOUPh+A5iccW8S\nG+U01cladWnOA3aqZbmlIZRM20dWTUkFs+PoaIyYRmAY2sGOfRfLdXUpe4XU\n18Fuvmq4TfBh6KHMKvKvImAS4WlE3JVBhrfgOi21gHMHLz722TbMIgNa+QBh\nOntynpk8Ir6WWHsaE9C+eD8mtqe6+zL1poV2OOyCZUjQxLj7IjaOFtob69D4\niHHPQ6fZjuY1p7EVxmi87w9q1zu0I2aZFc+tjaKovvIjKqiT7L1WolS402uf\nXe5r\r\n=/zMu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClODKYkA0MtA9HcSylqfGaPn3Mm+nn7rXseKpcE2Pg/gIhAIUX03nnK8SUWQLFfX2GqkXQ6z5Gl8WBiOYIL8MJiEKf"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1944_1593735024823_0.007383349604138889"},"_hasShrinkwrap":false},"2.0.0-nightly.1946":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1946","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"32f7c7e0211bae1434a4b6b8d311aece977905ad","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1946","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-vLXAMeXL5+nh4XwR7IVEKQPxi6t0ZnBhtCmT39+zghWbdotKzgcD6ZG9V1AvSYCe0px172u/GtjsPy7klAlZlA==","shasum":"f67229d64b65a856ff1f2e7508cbadeaf589e1c7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1946.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/8iRCRA9TVsSAnZWagAAkCMP/0nE/oq7n64nQ3nnxROf\naRJYCRj6/5OtSqpIVJleLflSnbWBeWExxAQEIL+KCR10s28VtjR3GmE2JeBV\niVv1+ub25O/WvqDgkQpjNrMK9zSeADgEpNPxkDbVOGMygtGGK8HYwPxGLB3u\nGIr+T3tjR2Eh5HWYgKvpr68sLje8kgtJsm23pkUJhdf73DJBV0L1i56feG8O\ng5ic6tLiR027qP3S59sWX0MjBfLDrjY4CZqR2+nw3aYS/rO0Kt++moxqLz0u\nQN3xy/Q0gH/58wX1tQ065uWiF3d1eLSAaJWtif8uEtT2SemAKjwOHiSf/udp\nJjz3giuAVLB4ejArJ/5nM9GoqQknIokqZqxBy9X3KDu7MzS9eomjyxZzHBav\n8B60SiEuFsAWi3qQZ2PCKpAxU9L5tblaVh4BCjYWEvGl7lnOglhtHuYijoJo\nkYSLZEQc6B6QGo5KUoERXbbVVUncsmcSDQzWzgZrCOMqgizvTJGppgNRob7o\nUJhGdZLiPGfykJdnWSNYAiTY2ZoedGcslAZ7uCj2QARkGaIgvw5yJCVfn5La\nLvs20aWGoAg39hBeAsfwchYq9ggtoI4lv2BboVsoGmSmxOFeHwD1sHlYOB7X\nLZ5PPlu+bBoW1lR+IUMX2a8yAdJXhU2leW2xRHBGQndRYg3gSnu9yX8X1tdc\nuYh6\r\n=z35C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOMWyZ7pVi65OM4aLfjoxc8SsXaBXmqeDGVW66UcyUvgIhAKDWUNVyr53PDFvAt1PfkLvZ4BEiQqSnmjtnoe6qMZnc"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1946_1593821328799_0.9067633621725875"},"_hasShrinkwrap":false},"2.0.0-nightly.1949":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1949","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3eb13e1143a493834b8299da0d6e7dd1bad1f052","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1949","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-rMEE+iDQsJJYBF/zThpC1u8Y8ethNHaBlAbHc2rligkRjUjpAmlNIqP4pz7+8nwhA47B5krqUkkLeOpJcESbQA==","shasum":"ff3ae400bab38c989e72d2ea350c8ae64f0dce38","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1949.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfA70LCRA9TVsSAnZWagAAmiMP/RYGvJ91+32LqvpQI9t5\npZsChXEOpAnCDH3fbKUEug2jRXXknGxmYE6hetsI1qkCm+SVqrD82XGd9sgY\nzfGkfI22ry3xn59yOcQNipfwtX7A8bis3+fGX/s5JktC+F0/4VUpwygCFU5T\n9NoNMzsTzOy9OJu6oQ6V3iG3Jqcur4VV4SxmiaWTBcJrtU0h0iqbDw5Ltah+\n/YNUpLFVi0mOghxkmwx0gD1V+UMnW8XW+q3M/lK7rU1rRbEvBLDJsrgNSNmB\n6nTl3n8o3cYlJUl77l1Qjw3uybGCcgeWBd0wAWFX5EAbGpV3GgpWzguFmW6z\nbPmdSHK4Bjqgs/ygBtSsHJPfKN/SWv2CanuASozefF4PuNsPIn3OGrSu7ZD2\nglIcsvefLQ2ATGcGLZVE55UmFIt+tiVdSB77kS4M+kZQI62O+Iyh5DyKBbsd\nqQ0FyVjfzA7x1jTiovyo20sEuYslGVTa+nej37b/5GhNdSISLFaKNcmxqE4u\nqCgcxeloQpqsZ3Sbp92SNPKJ9thtuDNDyh3spbcJnfUO1YKN90zV1GB/odKt\nS2iDwgAeZbobmNtZaq/19fErAdoTBwSN97QvTPEnelXHQjBTvCGdfiEZxi6R\nvHSvh/52Lznj+XN2dC94x6TlpD7CKb/ZEb3GBBwis7jwwb5mvMfI06/I3/GM\nrYsQ\r\n=rYMk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDgw1AgLweCnMagmkCbM5TGXq1wtPlFl+PlIT8L7lIgLAiB6aYg244T7mVLi+ZFiN7r/AE1Q8kAb1D+86xddoQGEpg=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1949_1594080522632_0.36176173860411676"},"_hasShrinkwrap":false},"2.0.0-nightly.1952":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1952","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"0007639be612389cce0d6406df407b221054143a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1952","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (darwin)","dist":{"integrity":"sha512-/m6vMM6JtUjMSQmg/M6kZ0TjmtsCPhmIRtqoZAGFkQ/AnXNgMYdmq5bkLs6s5QJLJcsh+tVvJQgAKLfiQve36w==","shasum":"c704e1128cdedfd06efd344e42ed1c6c2f44f168","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1952.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfBOrlCRA9TVsSAnZWagAAdY0P/0lZ8HEqrM81F9vfudXD\nvCoMzpnh4knoqG2Vc8eJu1hCNxBQB+aMyyXfca47ie9C8MZ7OGuPmbhw1Zmn\npa2LEnyfigXBk1LH1gaeiiOwR0/VOZHQ0LF2Ul5PNq+n3GKolmK11EmwWMFb\nAOisnAHBcXL0NFiGYnlkuZ95Zdj5fcWPn7AksITeIqdteCZC0GDAz8Y+1mdR\n9J+In00PDOCxB+0R97AXMD5RtYNBLi256j7n2A7XNXm+MltiSqX3bJPIethT\nga2O33qOep74Vy+dw6uB7w9d8wtrkVdy7YiIxJyqb4peeqyoDkaH3lsuEq+P\nqz4xkpxoIXuwYoPLk5JHpQISFBIHcX609mDyhsVqpcgO8OQGgZ8hjx9+qQmf\n5MpqyiRtoMiFlE+MokgP2so2CjKPx+NhpoXP9b6Yms3QxBArlaMTHDUvngyq\nrcNTqqcyUieJSmYuW0WYy2CXFn5uTy0mXetZ/w8BTMBBFU8p4ztDisdgpaXR\nI7/LF28AzML/iHXNJdxW/QfbFwuD3TmtJvflfL3OG81y5NvwX8poWvj+lkPS\nAeuFJ0xk/25QQN/gtpaehWf6+7zOl5+84asJY39t6rprLg6Y5ZrpERafNqwX\n58uNMFGECR+oYoAxXAL3YiHwnPoePwEeqvpQZftjf9vyV+xNF3rIllC4Gt6T\n0hE8\r\n=FJiY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFswTnYZwniaGr+rEUcfAyT5A/SaVf2GAoecqPsNRncKAiEAp2PUHvMbypzzpZFSd5nizZYMjwVpGEH6mb3XjPr6p24="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1952_1594157795327_0.942180915762789"},"_hasShrinkwrap":false},"2.0.0-nightly.1953":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1953","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"44a14ae76290115b3144120fd240939b64f6b93d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1953","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-kf80Ulo8Mf2dFcpyaIHkaxt/Ihc6RDc7p9W49nNQsiJrtJh9ge9uZAQ7lihVv8iv0uCHWrOgZzJh5OllLxPv2Q==","shasum":"6b99624fe5e32fc292e0ff6b5152f98b6128ea4f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1953.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfB7HOCRA9TVsSAnZWagAAYmUP/0TPb70MlaZ5ekp+4GGY\nm//tFMJuwB/LB0FAIAHJdhOTCE/rD+wCj08SvxaAIYkADp9JIbx9DZQvoBXy\nfL+hdF/GGPMdU567/HoQltMqMqvfrzELLmiRv23ILAXEwrGkeGE2EQLk3ugO\nMqd8fSlLOUcK4Fiv2yNROOkvhqCrlqhHcXV3Vv+d5/h7iWNVHvVFpqCuXAIM\nBeVqqvuamRbanOcWJfwAJlZD632oSuUJBz0NDw2y2uoRrv1oFagBf/p4+ApZ\n0KLu0E/Pyg2nUTrpSoKT+WHyqDJAafnFFV0ArmCwY1tUzfDPJ5AQSoAcocH8\nQaNOCT3PXtKMIt+1qzZxetumBbGhGcI2PjPQQRJ7b/UirMC+GQQW6pVZmwOx\nGBYwJR+oNxOAVf24H8HcldJM0hBe7d1bFt51H1p4VpeXMvmmYMVkjvwcw+fC\ncTBiOMtKgrzfgDy4lRGRewJR52cLeOZYL1pDjZcUBLX3vDMGk6clDRKnbKKX\nhJsOrI3tdEgNij8AYFdrnQFuIl+fH8w4E6qJ+ni2W3QNiuVQZereJ6gJgxSz\nkieqxA04H+4I2hg1p2pARHK25pkYPRpvEix2UZOMGYunHATnrxEYsCRfCmuH\nBHovs1W8h31WWs2QsrsZmMi7bUR5BCXZsM09nhBptTvhcXIQB4bsA8ZKW6lr\nT5wu\r\n=y3iN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAg9P743Cl617MkUK0SEb0S8iOCgP0VtwVPkvyb6bOzBAiA0thxz1Z++BgQme2KkN0rqPiDX/5Vm6V6/skLKPvZLig=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1953_1594339790300_0.6029276772309593"},"_hasShrinkwrap":false},"2.0.0-nightly.1954":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1954","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"131e9296aa1fdebdb4cccbf90d3ab0ae82934674","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1954","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-CeedXNZU/lHADPSADivenimtrPR/62Q2ryQ3yRPlpD3w/elrPCe1WZPnMQ4N1//2UOE+4gnFPIdelhs6T9iceA==","shasum":"8336b9f86a28781f5117a6317d7e46a01ebe8d4a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1954.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCQMhCRA9TVsSAnZWagAAfXAP/3QA2psqexQJbSARsYPY\ndaLQ7bvCjXoIBX62o0hp32IiddFlWy8sgh7f2S8RQywY2v2mRkteBlLjI0ck\nZLFjPrJ3XQrM0gXGWD2RIyJvlpmQE7ts74k3lPiwgITBTfLOgTyn7VRZvhpM\nRpMKZXVq2cNxqu5gHMBkv+FTHV8y0MRaTd7N5C/QsSlx2moR6bksriFqxF1G\ndqlIPJKarlB82CLxN8rXaTOmug4NBdeBOaUBirlM+sX8EM3riX1/6jhjbQxF\nv512iuXwrPYnT3qJ+HT+7/wqKR+z/cuGH6hxOw5nkVTcwXzYXGUGwUf1e0vz\nuW3pN9wbhj833MbMI9z2iMQle232AmBahxgGs8OtcnCHy01Svz13ce+3m62+\nLXJz04vHyOEVTUHXG0BIQT/c7l2jXetJydXPMWatDiNLQLIrg0ye6RrGiP+w\nuCbTvhmWbvK9pzA0DJW/SFvjvijDEPRejLQE21Sk3bnXXhQGTg0jslSfjn3q\nKz3ijJz1C0kbkWdzzoMLp9PaJOpNsY1Mdu90bWF6AAseOY4TZlBgIAzw9MnC\nhloXFvHzanBOkbibyArZMfnK0Av5uev9a/0h7cyUcs43zqGktgCwKpnb78n5\n5/hsNWzFE+WFUWZmay0+pXwWDzcoU/5UYandgLzB3VrSS0tEijlPqo0AK9+S\n258d\r\n=US3o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqUhcDiFvIUdKQItw5dLW65i+5IHYvVjnMQJOA8+hrhAiEAzqxRf8T3hvMfmr1Af9OTo9nV1CTVmc4bQcJDGTOoLYE="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1954_1594426144941_0.271216298683874"},"_hasShrinkwrap":false},"2.0.0-nightly.1957":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1957","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"2928e0e7e748eb58806a0cc661558ae1b2dd4ee2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1957","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-8hXxSO6eyEImx/5azQA3m4oO/cy171O2GdMxy4WRCHpPGFcAQO2TaFcpSNEYzkN2ywqR6MjKriS1V67tv//dow==","shasum":"ff4e0d87db8bb6f54bfb1b1f4195f33589f1f079","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1957.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfClTcCRA9TVsSAnZWagAAoKEP/RScG9nbH7XHeusEevR7\n9AZ6dIT7+ILQawTr3ajKRI9x3QxmXp3QEW9evjO12tC+2BvolY1QhJJF7kMc\n4n1F2JtgsPFPlLO41wjquCXCHrQvASlL9jgOrcUSfPWHVPUgOLdh4KhuIO3r\nihURtlfWk1wBK7OkdFYsrYm2mXsKdTcMBDJ104fGdw0+UQaUwmoVyzj3jDv1\niI2z20VPmi6NU0CfFMu+/WzcGGeGN+s00HXx4xEuFee41m8CH8yV022PGTc9\ngnpeN7c+cidaEyzfikMf5wxtMxtRhzqSkWmZAZjgAzapOYMhYE6dd49jVMxj\nJEudl0RriVWh4z7xM9M9UXj/+7f7BdOW+uiixLsl9y1VDznLyH7I0nFkrrGZ\no1VdteZtOcXWVIjr3eoGyRQUSguA0wMgc3YjPpApOKC+FOWYqeLZtkFBC4RE\n2+ppPI8/uU2oHv/butscDzCQht4FAg0waQ/SQEfTHHD7I1cW2dd7btsrS7oo\nW5BO6WLhGf6uSZH3fnlsap38vUNsNbmlNbnEethft4Fus6fXqPdHzDkK5Ri2\nejsXqeXieVxlbFDAEYza1G1MWztBj6oCQI+5LiEO1H/MUwgN4gnjQMFq/ppY\n4WkzhcXNnuMI6cnMXI+lPwZ1/1+VHoRrf4H/uHcg1VMQkFEaN0YjjMpNXNH7\nFQDv\r\n=37LX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjo/YevhBHFpZLFVjrccg6yob0p/D1o/EvRGx4UfzADAIgY/sx0wAsnRTkOTC0a0Zf+JaNciqReorxty7UJUku5l4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1957_1594512604576_0.8263298806435821"},"_hasShrinkwrap":false},"2.0.0-nightly.1961":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1961","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"afc2c9efc2cfcd016bc743291706099eaab004e4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1961","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-qZoXIfrd3nqkMtaGnZMbMGxVfFhdKKf4zzNiAJecZVVgJZP/G1S9fZ6jezB2xnczRuluk0fr5aNPQH4q35bmow==","shasum":"5834dea7180d6a918a84b8745371f47fd8692682","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1961.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfC6YdCRA9TVsSAnZWagAAknYP/3HZDRLeM6sWV740hkos\nPUGkCVQMRtPdQ27P3zdztY+ZopZ1pZq/R2VaVsKzJFMI54d3jUrElOKdtB6y\nhb3pEu+6ggjCxrM4qNUijuWgIYa5ayynQSC32CknbRAqhzTTre4I2f+/LWvf\n496YGV1H0jsLzb73503avDYfviA9gaJpWTti3c15yidMxCywxRX6QPtKr1v+\n7g+C4E53gkuCEuvBhOx9TAGfpbsRBax/RkVFLuckHFoEYMPnmFIjGq6tohfO\n0lwLDNrsCbI+5iEj6QCSRBzwRE32NbJTfgCoNJ1iAnRJEZzAIa+nXnVhFJKo\nD78gH6l9ArNkQun+wxPt5NnMAQ4Hau3A1wfnO+FURKHU/M+ZS9iUH4s0aEZW\n3X1W7wC5VmV+jNHLkwet/q7tnWnQyI7FIdPzTATyywE6pYjzH5O+6cPJucT3\n/n0fN8SEJskNpI9faPZUZq6vosWDootmKPVPNN+ozoZu0iVJhFZgmswQYSTm\nvlqV7lj8scVLmIfnU9Cj+untFf2bXOm68GBIPu9qLdyFW4Z49FFRwAS/J/5w\nwlBP4e4yYrcOsgF9ovdjUfomrTUynD+HrmA/ZXxmqA7stLB7xWsaFy95lSeQ\nPfhD58Xuy5HubuXYg0Xob2ywciR9PYjFLc6ifuuyswsV+R5AykSbTqM8V7tY\na7Qt\r\n=jLel\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAkZrAk2h2Hw8qEoswI+uSzPcdprLd+z+VfXbyufXHgEAiAigpBk90X6aEL1IOw9GVQ0V2RqGAEpxKLjMaULc8rQig=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1961_1594598940513_0.3963002537905116"},"_hasShrinkwrap":false},"2.0.0-nightly.1962":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1962","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8d64328859b787164e596a2140cccfa320e3a799","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1962","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.20.2/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-bFqhwH12aiAp4kgvASKAPNNN0kNiWuf3+xRpBzPxdO48wClvy3+oMjbP5im85KD0qdfhsbUxiZSazJQ8hvYK0g==","shasum":"f500afe1cbe696debae3b4c137eccba89e686553","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1962.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfDPedCRA9TVsSAnZWagAAnL4QAIXsGE8jBlbLLhubKI2+\ngFJqEL0QJm1IGMtUIsvP9JDncjS1D0W7l/hyePqgx3Nx+jG0/aWvb47K7brQ\npcL4aYZNOx+o1ikmw7iRkxq1ZmKWDKTiBjkJzpEn9++uH/MqTUVc+MX7x9N0\noyJtkvigNJqKA/zLWZxiLrLRGzxiBJJ2hDJblbPN05JoAgFQX1eQMInsT6Y3\nT8AAPVSjiF4bPg0yL4+qt1bSgqpcVK+6SS1lsxvIxk+B+X+eNLqZp8tKDjnw\nLdSyHoNNSu6YhTbk47aCB1KJ3IJQWC8HM+sH+TaRK0Jc+b0bjpQKcf5+hKn0\nxdx+cX8KbzxZ1lQMUR+o5X3v3D2iXbqBddcCZpnDxYlRwbChl0NLep2dafvs\neXA/Cdt7on3CFfgPbMIu8r/RNOoshL2mjfWpzBoTPAHddu6DCdj3jDC///bR\nGuP9pN+ZLB4hOsWrUYWYhowWC1ch51d3ppuiSfVPiuwgz83iB0VywQ3un6r3\nxSVRSsOnnun1OgRa3l3ZwdWd4JwRCjRsuvwNCkpdHDPZ7H82dt1YknGrY8jv\nJPSW/oCEvxXN12wKJk25lDRw8XzGb+FJSo3AH3ptJL5hHi+Mosd2LdxgTOxr\nG7VpiWassLLZ/m2mNpPXsoQskokwEHu3viUwsxUIm5u9kjhAeYCzY4DdxGMn\nmDY6\r\n=8UQU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTCkCV2A9DlDlAG4Qj7WWY+9H8CXgqU1CN5Zm3oOn0vwIhANYidI885+0hYZZ2esM5uhVvsaNULlVXZPI7Cm4SJ0sf"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1962_1594685340853_0.7901032769402767"},"_hasShrinkwrap":false},"2.0.0-nightly.1963":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1963","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1f5586657f1ea8660ca1f06abdd75687851ebbb2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1963","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-NpRXrSVIfbCWj2pIgzB4CiK79DQCym6JvWtb/FpFe4rpDPCnruSrcAGemNIyzeGAxUfakZaDyajiEjIN05kC6w==","shasum":"a9bf772384b94b3f045ac464a6d222e49c5c0021","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1963.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfD5rSCRA9TVsSAnZWagAABVsQAIhaaMHwkIURX8ynt8rJ\nPwJ/Stq4R7bVGhSSLfLPMwTHz3EhoQrZY4FQwe1AP3Q4mjnZfTo7qTvr/rqp\n4xK2p2WXbpANLJHkyvBZIBbSdBgv0sKGGm9tsW823sDu3OXmMPsA76Axv+FU\nh++d1OwVxRPeXwnB3xVH8uxM3CDR4wS9U36MdniCRDdF6ooPgv+nO76gCJde\n3n3h58PEvAB7WlEOSTDtv7EouOXBOQig7SyUVQdudfderPyF1cvHMxgehy6J\ns+gSeTIv9+xytgjQG8UmhJ6dZllYiE5GebF5SildCoFn0ee3+78IiWf2m/ck\nTq/LibhFAl2WsoFywBG+KymMqn65nC85TVqFl2vs+cogXEo3K8TNk/edJ2KB\nriHHn2+GiOPBwtU3nVFN3ST5HOT8Q7UkFABvueXE0U2ZjtcEtdM90+ZJL0sb\nComb1HBAICxJ8olbIBCJP0rR3iK7xo/G0g1epGmuyG3CINN+0Us/lj/T+ZC2\nnIC8zD1wfm2TeQiYhSKcS/jzUOm+e1kd0DFb3hyFqzSMF0x+N9J6pP5m6wnh\nPash5ttB6SiUN7QiY7ZV0dPeEqaHQ9AOuSqrwAsMubAEYgc6Ug/wFJUrSkh0\nJef1BwlAwuMGtyPhWWf87Ksd7ErdZiSnLC/vcip+uFF08GAQVYJ9gD+ZBx1c\nuvB/\r\n=80yt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSirXq7xR6RYgMuWiPXR6sb1NUw1/CGyUMwARWl9tuNwIganGVKt+K8zoDTYyF983nGnPTRZfouhVuuuemE8dI9L4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1963_1594858194572_0.6040183357818034"},"_hasShrinkwrap":false},"2.0.0-nightly.1965":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1965","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"fce662ec4e125e26aade08b8dcc032958fb4e42d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1965","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-ewocDrvN/jOhiMLDZRslfVBSHprbPOzCn6shMFZchQzJ0/UdHskbJZsjNvrUY3ZmGMcsGQ254DIaB8QVx20GcQ==","shasum":"ba6d7f320574d7df25c8c6b8b1308fe4512786f8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1965.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfEj2hCRA9TVsSAnZWagAAdRcP+gIicJjnN1LOSx+8ooMl\n689LSPWTU5hMWaOZgavX/74ibeTLM+LCedPA1/sfrLm7+JOF/lZTvVAh27Bg\nU5+UylZUx4vmBa07dkugR5AR4JbHpIxveTJ5OAp7ql1S4RfC7E9QBxngkCs2\n02iprmmNRcWwQPMek88whXLiopdZoxKNJ+XeqGADHDkavR1dZi63UASkH+k7\nZza+V9IbNNbOdV1Ya2eY/kYp5HQ01K4dU6/GPiF2DpSj3FQpbB8+OaexoUkT\ntjoueKZL/lNt9ln2SlKI5+aIhPFGbvB/yErv2ZYhvt+Uk9k4S3GvQB66QW7e\nKgKFfY7/3fkr1r1A5NPkASLzZY8IoeG2p6KyyjTKpTsBlp7nBZ3drvXS2bFv\nwP/p76SWXymA/jPRdpq2DA5Iqo5/POkrooPoq6bfyMKDSPpnQI0NWdHOerH3\nTnGQCSP2IL/EmuvkqiJLwqHRPpOnoGEzXkyAb2n4IrXLRLg62NaUUFid2vst\nGR9luWtTkIej/ddOuemJtDrRafz9OSG1NeBZLeL1q0IcHKlmSIj4mGNCVLT3\nDmXQ9bv5w5+vrjvFSJdGGvw0YPzwqhie00DZfb7BYo6z2gxGu5L0e9xM5vcJ\nGToLQh6rNjegB9aXgxfOJIUYCwDLiAZ/tknKcaXgmV1wUwF1e/mzo1J817h9\nW0kj\r\n=F8mc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEr4BYXq698vuycLVuZxxhsIFMG5EhKia8553WQwuijwAiEAqFB8kyNssWloOrk+QIyEPDmDlb0QGcpGdrFQqJCf8bo="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1965_1595030944703_0.49291521620355705"},"_hasShrinkwrap":false},"2.0.0-nightly.1968":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1968","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"9ad899000fdc044ae7b23e0bd2e1e7d28dae1805","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1968","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-ppJTFfjfM0/5ThJOFHUAMpkN3OO230rIG8Di9j5ctcI3eHaLQppynUxbtFB3FxpNnAOwYuTrvwiQ6N9YwJ+ffg==","shasum":"76131572e3e6141b0be12c1b5021169cf63be7f1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1968.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfE48sCRA9TVsSAnZWagAAX/EP/RVauUv3+9YK1EJtsKJi\nc2YfxqbUhTBuulWr3A54wS8MuBRs2ssgrMXKdnUVlg33PfyCS2p/EF5E5GfH\nd2LHAzDAdTLdEhqQHS3NfYdhEuGFTGT1tXrfU5VPUH/2RCheAai15gqNhi+l\nJCGBYTvSEeDkun0UMG/iiOnf6bzxjAZK/+5AF4/Lb2H1pVW2c/S5E/sa/ECA\nIX/0RHdn6Nbt8BRrpq3avv/ed3vzBi+kE5apHuGTRmySkS9fdZW4COw/na5a\nk3Dbxjv8WWMJX0di2z8eopsqfzotkGyUjiliQTf8FY0I26NLhlxnh4eWCKcr\njavOeM/j4KdoLE0e680s9cxfPZnWemEX+6GLOVPiS1jDHQ0M4IG/IvCJZFu1\nn+WzBEhOvglyuER8wkGfhgUCvqt4YyXfal8IgToqXDW4blDVAREAlT8q4s3b\nYHpi2BvhdzS4MpU2/vn7E4K4YGcHbc5brQYKEPGqbdviEwy1nWSiCZrWkFBX\n1e6IK3pxaXBzl9qJuBIMmh+CqW27Lp65JAyxUw6GQFS+bqFV5BgHhfQwiyj8\nx0O0fTxGscSHJaUMHY5trJTg0CJrHNkuiG6JTMWjXdVBaB67Fvc3+DeJ/W/v\ng/g0Z5/6gDykGpdN5YZR/wRsDBqweJ4m5Rfh5NASpAfoDvK/IUqdiKNjll0t\ndO4Q\r\n=W7ck\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWvKHjB+t+IeYsnSOe078dsjuXyFX2VMrSr68J+cAx+QIhAO+v5LHJ9pQ8e/IfpFU2nY1wt2iPEFQKuwk3c8AyInSN"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1968_1595117355778_0.7714858313775954"},"_hasShrinkwrap":false},"2.0.0-nightly.1971":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1971","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"283fd43b3e5fa3f9b28b1920dd77d21d8b8487fb","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1971","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-03V7N9AP0LoWUkqDE4GM5l5mWT5e32doqE0q4gfMWV3ZwK5IyS5gHRS8GsMrKBcpJdXxrqrJprD4xChPenJgig==","shasum":"1b2fb2c078353d3eebf3ccf9eb4e3ed996c71c0d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1971.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFOCtCRA9TVsSAnZWagAA5BYP/3zMTzlpsv6kub4BI3HG\n7aC+o6ciePwxxvluglS+mHdKMBN32doM6EpEwj/Yzck1foXteIFXjmuH78Uc\nTqKoggrrpE46bAssV55Cn86ie2cciOcBVD4T2v9m6sMUQvklp59FCCOHiQxH\nIRbeBK8L2113v1sHygXgCpMooE93wlsl8gLLBs+qOXdScedEmuRUqC5ubfDV\n2/hRbxYpMH/t/5OUnZdyP9VpX9cM7u9DW7tErLfJsC2D+cutZj0iXlrBl9qM\nqh1XgWds0NEv79anuQvYB/e/lt8Fu9cBEan9jKf7uQqFszbmiPS49L+RuXSd\ndu0BIdVy4IzsUg1iPXqrQ2P0lcuukd6MxhdJE07WUZh6u1al/90g/+Yg1O+X\nm9uJ+fQeDFg3KHQWAzwp9OMO9aZJk2CpgElRbwp+DO3j6L/PYzj7FYyH2To2\nSw6vkOnawVa77L6wQJBPQWmH4GC5UC4NOvPB1m6ewjF+sUYgSEluSIVyMawP\niVARMcodvqFC7w/HNxi9c0AwutvTpcL5Dkery8GO4WM4vAMT6IijxEO603ol\n9v0WAEKr/Qb+quXwRSb3BaTZEFYStdgUJVVV/VLU7PHKWUKPOsFz8OoBUXym\nMpFxQ4tWU9Tewym0Bdgneb6HC+K1miAhnwtCYjvVkVP/ZEkMyaH6EPaBbw5s\nZJeY\r\n=/VYu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGkSBYkGCA+nJsDo9bxV0/b5fGXKFxLKa+z+FWBNS9qPAiAYklNIw8ovLV4mgGg9gIXrsulOk+scw/ffLb/Z5oQREA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1971_1595203757213_0.5954688491994211"},"_hasShrinkwrap":false},"2.0.0-nightly.1973":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1973","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5be013a0b6facd714f6a2ff75e52d945a07df5a5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1973","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-H+DOQuQwpAdL57qDlvIN4mdAR4aRV0dY8StZ5rYzhnNHgOTjgd7K2N7D25yofBGBT8HpcqlIP1kGyLISWunzjQ==","shasum":"7f95eb6808247dc87b1a93b5ae1b4ae8d84f48fd","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1973.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfF4PsCRA9TVsSAnZWagAAZp8P/16wPYPRP6WaIArvuv5/\nt9T0lNKk0HW05niZv6+oHR20RHpgV5LK9HzV1mYF6JeztY0ObGTHhFeEC900\nKH4JZtMRfDMfELZQ2P+1t9SmZxmJ+keLa3SthZhjVypqMg6SShGEl8EkoV+G\nPskwB7hA/dMf1Nh13MOe7uftK+Obt7gDoFA8y/nzriS0ChmHqa1wJVTd6Dyf\n3wMerFMDCQhVTbWxn38La/X27HEUuhCY5QJ3o8Q8IHkFG8OpiLoS3y6y84OA\nHDDl9cKTV3tZIS0/2T0wfLFTODkOvog0U/TYwt9DQ6Do6vVHx4U5P7+jwgad\nuhnKtP2qY5dU8ZgqJD6AwjrwRByzkivNa6NuAIumvj/m7wjxH0gXmhSONg85\np1lBGYBqUNA6fcNKNUyDxNA/jBqgBg8LPVL4Hd7NquHdyvlZKLjv8lUrjjHB\ngT6Bx6tUJVEECPjfcFT+RIf7/wIVXmsRly2qV9ZqFqRlCb0EpWfqiLHGyI0v\nBiPE7gYg/2R/16SwtHMN3aJnolY9DEunqXGaL0Gq4XdzaYoDXLtYDLNt0AVG\nyKcHyerPF0T35NUatfblNxqgo/RsH5kmKE+0PmhzuJdbBp+IG4fgVtZhdrWn\nDGuPugfOBwg8wLOAE4WHumQYtPo5LdGIOlqBsEIOTfv2Xl63RDrDhngqIpi3\nzAYG\r\n=SKF8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHhgUZ6n0Gov132p7dyM29XN4IOxcl2yHdd+27I7iRX4AiB+9yeUuq8z2w68PxlwSZ+/ALY4rvn+qNooT3mm0SEysQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1973_1595376620530_0.5822068750992195"},"_hasShrinkwrap":false},"2.0.0-nightly.1974":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1974","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"11e5a321b7fd48aecca83db8adb5dcf1b1a5aa75","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1974","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-fq43hg+nxm6BPTaoBnh+w92Q2XDyJh2NZ2Rf/ntOvdLkOXkgyclDiBplLtNHwvK/XFJ7NeW/8SlowFtiHBPAGA==","shasum":"efeac8e6b49cc5670cbf0ec1426435d22f22d009","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1974.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGicRCRA9TVsSAnZWagAAgz0P/144oiKNcUZFQ06/gS2q\npTceoZtsGZb8asWbNUFnfstoSJIrxLsaprACab5bXA7Y6giMUnERobie0s7F\nNY9ZOGj+IaJQe4eekJxX2sCwCFaiidZ4nLS9fLSCL+AHI5mn2Cb3hMnxluFp\nmJOGq/e4ML29iytXJyK9sh4DGFiHoRORiQM98dD3AUQmg1Ch3S38HHOIAFLm\n5/0+ALh3Im7Y4hXVKFg7aZU1FLC95qht8TKhHS3PLOHq1VqVECKG1aaSxNud\nNW60JM+PLcBKtKXXJAqRJqdufrYEQx0nnfej6IHgpscEoY3qUbu0ZLAigXmm\n+2LGXdYk+uxZ1E53PFKf70pNo466Yh8jFJN/rpKLos0c3+ztke2PAK7NYk+q\nS1Y4t3R1Rjo27a0aWGLxC6IK05iQXCPLqjao3CbDdRzWzglzh9DxITdhqwDc\n9149cnScLo0kJcQ42RRz7/CbIKDlXXQApgoIsE/xQjrcBrsmGgCvG/IEcKn+\ncBj80it/sjYm1gx89mfTB2a5bYkHOleIEHRJM/i2u6+w0jxX9riYe3np3eyK\nLkMKDgc8N0oYYtqakk7EJ15pqaMGIhsBD9pIROiqNSqzTE34kKs1ghtoRpHB\nqViGUoDe09pZcHu9Qg3rebHlZWNiVWRWsT17uiIk1g2B7s8gqWZT6ye8gtyQ\nvFhS\r\n=CHBc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAgRZYDYrmAinG5aSoM5FUL9dgw/f15pqXW+IDWWuiXWAiEA/mdK8KBbwKy8zTXQ2QSAXY7SWWN05/fPp0YCi5X+PUA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1974_1595549457388_0.5763922467014095"},"_hasShrinkwrap":false},"2.0.0-nightly.1976":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1976","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1bb0498339087cea54b1044d56279813293f00a2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1976","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-M0e0iR0+/dH9wBuUWAGsAp1kCdxLJAkaQDldbh8iHN7oJJuT+V68FeDMS8xQVSN699KKo2HPY+ZwS7XdqRh4Nw==","shasum":"543b827a394592e7abb83a366e5003cc54a94ca5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1976.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfHMnqCRA9TVsSAnZWagAA89YP/2OlvZJ7LexadnrXRlZ+\nCcgubmEOJFa2UcQEsunGOHaBI3zObRL4M9CeT5Mg5k+UeJZd4pEfugwMPHt3\nd9Lex42WevIfwgXaYekNKv/xYIphRRsTa/sZcDj3U8tBsrnrTQPcQLCd2v0X\nk6QDivtfR+dFnMEIC+nPbRE1qG3hN2nxjlECfvD6U8s7D9thEc+haJwkk8Le\ne975BUHMnmhFromq3IFRc2GoJ1I8yNx7Bc9CUv7vemOiuBuRK6YV5Ai03YJg\n1pdMX+XmP5cu/3Em+wCdX/MKziwjXpPNeUMOJi85xiBpwlhYRUhFgkYulzke\neSmvKx49Wm8uoZHe0oCK7J9uckXqpM5rb9sbkgROEPkPKgEJ3ahGU/eRrA8O\nhpDJJg1r4KnVn26WFNb6hRYH3V04dsf/fGlK93AGwE2FrP2Fn8WPguZSw2v7\nAJw0RgB4mR70e2aKhWVpgm9ZEywuj8vQ3fFEiA4PV/o/AoRfSk7uTj2NyY4J\n5lRrHuIYtm+Ga1wB11YLWzDOtmZfdA+6MV/2laWgpYP/DnmhizfPISYQx59U\nwtElgvWivHc7SHCp6ehcxO88PWe1ndDKbfERi1uoC2WN11VrcgtfLZC0dX5s\nEgoZvzWMAPvlQ6f8REvRQlAZCJIG7ixsiGuwp7obunA5flhPM+ZTXFDdkCws\n0MZ9\r\n=nEz0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICbacYhg3cep8WsKq4HofJDzwFw3iOcqwQc4Cgz4DEVWAiEA/kvepgufCMITXZqUaccHTlGDGhPL6qZMxygiGp9YPg8="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1976_1595722218040_0.6841056725760006"},"_hasShrinkwrap":false},"2.0.0-nightly.1977":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1977","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e449b1a46d14a64c8be6b6d17132c706e1983a92","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1977","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.20.2/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-uZi8EY5ZI5SF24a2OKEX9PXrHsBMMZ0Cq6TvmAwOlvIJf3F6K/Hfpgekga+hi/ctrpekLJNS+xeKeZZuWMs5vw==","shasum":"2b492f70ed9f1c96a576888494eaed6aae758a88","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1977.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIg/MCRA9TVsSAnZWagAAxG8P/j4kiE9bxN/hUfvhshel\naNLRGA1u3wSxlE5v/+4v8EvpzVvuNlgNhUWLUAVjAgtL4gy3GzZme3SOWYC9\n8aXEUKAscsMJOpXrPDwSc0qNrFRbfcof72xGc6E+3sjujAIQ9Wz8iVvbGj4S\nRkGXnSF5r4xJOW8FXAd6ikDPKUp1HMx/D27q/16Qxrq+L/zVrFnXyhPmA+sw\nJJ+QlPl8K/lnvhJsIGEf2pk962mEuBI53bnA7eBRVwhEA0bUSdRi2UYxcQJo\n37NqgfD7JA/nhq3P9D+acTPuAfEbACp3vLJ27Rof6K2r4jIb+SI5VHvJSA6t\n0Y4pFuW5/dX6DlidB7IRyv6/ZJQ15eDAgpuLx72f2oPZ4ShuPYXxrL0a3MSH\ncNk7oT4A3E/zfVSMb8YDGUlRzpNlTk8tG3J6BgKGusu2bu8b4QHpaihxkK6n\ni0UAikHiONkCaVYa09wzfZUzxUOnEZLvOrtfAbgtHJdbRhXMHLjAtEOj0qhk\nEAenm5dFVGhW4wE/4p50je0I2atISx3yKCmVR6xKc+tNIXESO+densLuQrCd\nvNlVkDfumX/GbI/8/ReIM97mmO9lNd8nREXb7vBuK/QZIMlxYsF468m9kmGY\net8aci2wD0ieV+pvG+d9idjcqAch2BBdnttJQIlQGXbVCbiCTgyF3FC2X0aI\nmApe\r\n=wN7Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAmN2GK24lavDoPaIN34mZK8TqD67eFtcz1uIFb3rIhiAiEA84tZvXtxChASIEJa5gJsb8/EEpznSoSSCFGlEeasyac="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1977_1596067788312_0.3349510131489408"},"_hasShrinkwrap":false},"2.0.0-nightly.1978":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1978","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"788bf0e8460cb9d60dedb9ec2b469ba5a105120d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1978","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-bvoFvkS4y7rKSl49vbynHwhNB3kvjZ9SrUYNb1XVeaXfTV9RNBn9mNnVQ+IDnyaRXYHuXzsXSU2l/XM3uHiljw==","shasum":"61fe0832f4e6293572e0b20817183998d91313e9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1978.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfI2FSCRA9TVsSAnZWagAAkR0P/0HCQe7xF/5TivhUsdGy\nhL5DRqZtHFjaAr6XuhVAdPF+G9nz3HMZhBI3RAxQIqAeR78U8zOaQw6BJ5Pr\n8TQ3q0t0tf52FkVFtovjNY4rHYOtCdi6M5qmE3zgzZoRWwVaWOOsxj8M/D9Z\nlJ71PU6NxwPw5KpA1WuIcySVMZ2EOL735l2yCadK76JosyXN8hAT1GjJ4X4h\nJtdjRbs38yVsiV7Mo/DwwcOVhjhwSBfp/kadlfmhdIFx0CIdRA1YeAY9zUxl\nIlwEHE3atci9IWaaCHHWCkPZEebtXCLjlwddLsoe/INu3KATst7LTrvoAOdI\nmSlMjFLPY9NUdMJxkh/JjUcpFczsmZVdfhVnk405S2fxDANOI76soikY5/QK\ncxYrKGi+Upqgjn5UBTw4f2e4DR67qMSxJuEG/jF1dDTpmNoIBQ+3HVNt156g\nOmGjDC/7GU6s1UZeki1dMlNG3P5fScyyP2q1NkAirIoPPXYURTaO127LNtst\nlRXl0z5ODvkWTcq+ekWMlLAMJWiauRzvAvbizQ7xZKv9JEVHb6I+1qlqgrp/\n1nvvU+iqcnygdvj0oiDVC3QIaalEXVyo7rcu1pHLSPWQlUkjStq/QO+nltdN\nXjXEgw5m+D9jjLIA8B2A+BICdfCUW/Vb9X+gBOR9AjCTf754XT8rp33//skH\nV8Yv\r\n=Msdv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkPiQvMnNGAqLHatI7XyrgMTHxR7IwVB3a65iPf/r7WgIhAJ8SXFD54MvtQYlIGWoJcMQKmYBAVT5xFI+6KKvlYBrK"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1978_1596154193762_0.6422582936549843"},"_hasShrinkwrap":false},"2.0.0-nightly.1979":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1979","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"ca2af73663c5d77d61c598d374cd118ba00ab2c8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1979","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-7UTjVSjndpINiONO7V+hRgMq4upCoecR1WPJf+rGxw1iI5leoXS2GgMu7FWbmSobF8QV2f71dUEHiNc5+cXueA==","shasum":"9cdf64f84aa826eaa2a760d19b0f48497753366f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1979.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJ1XmCRA9TVsSAnZWagAAulgP/156PyEMPUfv2GgMTuM5\n/JI/zgTYQbjGxKQH0H/a+cVhrSjmqOE08jBZ7h6MLaZ+1hNQk7iXp3kmT0I7\nb7lNhsv0QarleNdJylsspxRfUGH0sbFtPKgNHgp6Jx8VstPIrINKwtoj3Bh6\nDrKT60byFo8Z2qROc+6lrGsC7GkV26mswkrQF2wR+EsecnRVh/ny5wTUffIO\nllnPaGyuPurWkM815nHGnThIl0ztUkFtGomE0P+D8NAimLewE0Gp0GJHiJx5\nPTfEMyBIJ5HDz8VhZkEPHRMsbcZZZmMr90iNdh6Hnv+mTJX8V2ogRO0faxKJ\n33ADzgJt00rEt5pnQ79Z9jZzahwQSV3Rm5SzojXnRkt7iEPzq/6dbCTWlTVH\n1048VaoAYpVANjEd1qI7ZPWSe50bbAlXa0j/fGKzqNahNASsHE9P2+3gCC6T\n+7Lr/tomRJAit/fO1EyBt+ImtOWqbwAy3e84bLupYNWruiJCsS8TM6q03pLI\nAmB9FRJrVK05RQGGyubBXltDa3dL6Ka+0rQyYWvMrQecNd7KeaElfPxQZdBP\neniBMLxZ060PnF02HQJFoC34Y+l/dkLaVj48BMBEp5+Wspdigpds2tcf4nz8\nlWjZwsO59Jz0eakriJdwe21EuhW4czOPgpMoiK9KnVEL0FPEu+RF2v9PGUpI\nkMvo\r\n=1Fxr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEuxwaUlEMBjZ9q0XGJgQ/GiNXDi1mwvq6WtWXxnd52AiEA2fBYlBFI0bDreriXRx+MihDSannzcZERwM/ucyFMVls="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1979_1596413414531_0.35739551878641596"},"_hasShrinkwrap":false},"2.0.0-nightly.1981":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1981","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6231ca1d7a5a43c16ae9ec037de2efea6d3abc8f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1981","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-flLLCdstEtMBgYbAJGODQZbo1Cq+8GyhpXp6ZNAbHxf+J4+nKlAeMVNUMF0DVsLhMk/Be3VaEI7HFIQS5BjJnQ==","shasum":"35cf29ecc23cc716cefb980c0572f153a7ef4d47","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1981.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfKKevCRA9TVsSAnZWagAA6wYQAJC00uNQLYWPJZ/lZ5i4\n58W7ywgvPxGh88IyEpLavH3bsW2jMMuRTKGo8KBxFT+L3ei4idfQI0vJ34MZ\nM5ug7ri2lKuTnuqr3601XJhiVRmguKVZ7FrXwfi0Hsp/K8SVr8j9FCfRiBbF\nMedOosSEP5az6Mp9GPcbjlYZ67s/cigGZKEzEUgvwVLRDSgAkFHD+WzRUPH4\n7SdduR40/LFNcb8IPLBgh+nXevgbBnvOhr1gfPbeOJb6h5mKAkrs5lPtOEWk\ngGA6zQEJ3UyIluZ7haGszSaSOls/wnQ3kf9xixDkqGN1ybYGE2EB2Orj048y\nn7SL+GaZmaWAe6jE2ZamvpSBIhT0xO7LtN479k5cPZP13Nk5OC+wrYZCEJ7c\nDgtcUI/Ux8J8HyVmEVuADQp1nvc8Ky35Bq3Es7jqLxwMzVi7b+A6/b9YEqvn\n0QVEfOtF8AFdSKjdDqLpVSaGGsbTIszXGixkl994AYA2CaIDQ9/wPYOKsCWy\nsShQv4P3Y3dZpaiccICabYJOmk0C51YV+VbSCiFEDOBK3thlNxbqPtKXP+jS\nNOlroNO53RGdrNqDN1yEV0HU7hX48jDckOwgo4LUmvP51yBthsk9Ypk5VCOW\n4w2B2A5ihu6HNZabfq1FbAXW8XQ4zvUpUpduwbhiV/ysZCqrUv9nAGPxAqi1\nl6CT\r\n=NI5m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGW5AM3f7gON0UG5C7beiMYZQYmQ9ahlTp+2DePj8+3uAiA3zhQg/bZsc7bIco/z+JnuRq9HpUgdxdtbDLOIH9QRHQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1981_1596499887196_0.9589360524414567"},"_hasShrinkwrap":false},"2.0.0-nightly.1982":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1982","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"82747eb5778248d8db35186ec424687f91db5942","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1982","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-JqrCpUMhLIEUdtOSZcrc6FD0nYjdQNojTwDglz5SqXfozxxgkbtu8T0/f3O9YFp3mk844pytIDNQ/jFBFkEX0w==","shasum":"60ac892cf8a28d90cacd517cad4165f3b743968e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1982.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfKfjjCRA9TVsSAnZWagAA6KUP/ixZUmc1VH40gWO/ZhgO\nIOTKRFZJxIvDsJRdLLFh28hrmnPTHjewExxA2gL6CBoRwOVJO0L0+9nP/Uw5\n6faxlgKORWhHoWCxC9AuEg3v4LbKyPE+ygP01Vq6p+EFanrLiDWhZpP3u/qr\nuogzl589TrZp5cPx9xOYs/G/kcZwCar1+O7+Nz40d9dnCKi9H2tZap8bVWBc\n+bQQ0vfeeq3dJQ7+VOlFyBSrbS40e4qskWs60B3tU70QBfmhC/BeW/k7SiqL\nXsTIGDLXdKaK3o4qHG9luHaBg3+e1md+BjbtG4bDul1eEDPtI40/nqkzdPeb\nnYPjSY42mfiIQV5vEqDk07eiKTNsec+u8uusJoedG/xWWc5v+KcBxhPip/DI\nxZmvji3B571iLp6ttk5gHXTaXUOUeciRF2GiP3Jt3MTfMRv8vqXBfb+/0rqi\njzs+FcniiadG7N8XM+iJar8S0ixBmRNfJjxvkEvAgGPC2ZstwVE/27bkWbRQ\nvlV4XErNa9h3+sYZ82XDXSwk4PGMwEyS/F4stMqqBeQuwMZ3fv/2ppZZUP9F\nZ2hLbJIpi797MCfLPR8Ly1Gpb/sGCHS8Mug7yaY+2AELA+qVCdNA21S8APGA\n0f6GCB/lbb4paj6TdovAa4TV8c5nepVb1PedX/snC/PuoS2BJJz+nc/vxTm6\nbcYP\r\n=67Ya\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDY1Fr2dAkViHy0/j+3VMa0S+XylBi49+IwTKH2JXpeLgIhAMOpMu2Qb7cDri4kRsfV98oETT+xTpfJ+uZ+qLwNsYTg"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1982_1596586210805_0.9201493916307606"},"_hasShrinkwrap":false},"2.0.0-nightly.1984":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1984","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"46e8ffa3e781fcbee71dfba2fe83b7c0857f4866","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1984","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-R50bFrQg4D8/h3vBT3tUEFzzfTGwtSueFKequYYtNdVhgni/bOf+F4aYUCPvvh4Sbi6s152vZrUzvY9dgwaDiw==","shasum":"0ca3f34d8fd459a2b59535366b66cba5332b5a7f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1984.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLJwECRA9TVsSAnZWagAAlz0QAIK0TLZWghs0ZF8o1uEl\nybuz/xPiNlFjFtJCuhOuMj0hR58lF/h4OLH3nzRp04N+vmzMLxC4xAqcA2+Z\nVjdNzo+TD0FJTd0bRAr7N9rYHq/fRCmk7T4Ht9QtgYp4klbMCq3mdo9K9jTb\ng8BLY9H6KCph8saRw4sEGnb+wBQ5eRC+v0hNJiR4hPksBg6fOmJ0fM42hCp2\nqib2peS91/6LdDNzrwbMLazAYOY0V+gRtKJFliPpAJM92Dd8ItUjnJHS25ni\n0EhqzaiVNuvmH+MR50NbASnWt6H5f+WYttS3JrS8tWkrAtc6RlbaS0jnHmQJ\nb5rWPNFTkstK7pUI4Kg+0X/JawT17FHW2QlWtUnXKJy6QfxtMCE556fuCHV3\nbEVad52Q+3DALGkJDcbhAQ03pk7+zUF3AzuxaaPdfc+snYVoWn2N4jT+SUd8\nUtMH8qTDuRNt6AomPwgBf7QPNoFn7g9e4pGo3baIh/XkG0uoZhwuRNGJ1hR1\n24uouor6zvO/xP+/tQaRYJMVmwGhfu09kp+sSQPMcfHafjB9faITGcsYvb2M\n2WoRGwzZosNqJpNck6AN7R+lsCf2anf862NOqWxZhocWbLBIyNFoTHBIO7Of\naMjx6XF0llGIGz+QrJCONLenl97w5tDPNx7T3sxHSZ7aIlXdsONPR5q+W+9f\nD46V\r\n=MNd4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbQEIVhrxsL5TlVIV3iJrEkXLV5X+7JRefRcg8xRVhPgIgcGGvB5+3fF03bv5G/5/7f8Rib/8J+eh0QlQmVeejBXY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1984_1596759044255_0.17964669254739762"},"_hasShrinkwrap":false},"2.0.0-nightly.1988":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1988","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"0648010297f5e9a08ddb4de2a53dfa09fce64e3d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1988","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-VekUKAKohSfU/TaihSKnaAn9YBOJLUXmbUbsm0cLNyrdQPCc1SC39uQanCbUTLaba5BuMH74brTvnk87o0C/qg==","shasum":"98ac239ce13bb957580c33bc74c86cc5a5fb7e29","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1988.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMeJdCRA9TVsSAnZWagAAiWAQAJ9AETci4UN8c6Mu7bPv\n853mixw7Bb9YjQHaoaVkxMIuXx8X0QkhZbWSxRpRi/hzqbOdwi8oaR7Yy0Xw\npom/IZcdsPSDv75K57LcxZ6V9+GJKZwwkcw0aczj+J8rwO4RGUavefwhRYOi\n0PZinBzRpRquzn75sgruFVFnGhzqAIM+F3us7eBzeoVk9nrJfjVf9Usc/Ipe\nBxfATXb4hsWp2m+Up0RUTzVjHOalAh1J9Lb56yuRaFL4xSPc85osbBBvaZHM\n7sHBfNqOyaUkq+gA64AiSVgqHejYxZJdGRUxsppy9ma/noh7ka4e7Ej17J6S\nnzB2MeROFJ/Ix4UuiKAGC4xUQJcDEtU61tHCy4u8PN4+9H9Z/wG15fdU5MWa\n3f0aK8QEfQPCPu9pGFfRU7T1c/3I3WdYl5W/55yFXPfcO65WXs/g01xE0caC\n7KgnYojpW3DtyBpsMumK8rZN8IPIC31kgzAfDzAJskKiBFjgwVRhHFvdaeBA\n4rkk2nUy8hOEWHhUzEEnhNInLvowVOAK2kqYkKZ8GiRnhejh5syPM36E0H56\ntXvZgg0I+OwQQzRkKK4Si7iBILyb3dMA2hrcOW710OfQIO4W/gK+FvAbWuHW\n/axZjcQfvUqDZ/vwZQMu6IXlht5NC7DijKnggz3Uz92a4uQI6I7LkThUQzPa\nLCrc\r\n=kXaz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCdqFCAZQtKfTre2R2muaU+LJK7DtqwWT5UGXs+aaWx4gIgR31c99sLo9HlHj620MNTSwIVq1aD7FVXK3yI9xuiYOQ="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1988_1597104732730_0.5145162540431254"},"_hasShrinkwrap":false},"2.0.0-nightly.1990":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1990","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"803ec9700bdd384b5b8bfedd41f2398494094776","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1990","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-SKtrtrQUFNxiNfpgrDfbWrMP7dSwmIAlfwiqVebrBOXCwZNv1VlTSbOnhzVWMgxKhOQN4HeRSf6UeKsefwmS0w==","shasum":"6a5b388a22965165c45d5ee3f3990c67b1119bd9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1990.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfNdZ3CRA9TVsSAnZWagAAfQYP/jizyJZcV4Nq/a/clma+\nFpLeQ9yHNOWMXp+vRj8VDjs3lbL103s+7VdS27T9x+m2K8tOqMfZ5hLYM5Th\nf7+bodcRL9Rwvqsr9yFmriXJtp3lNOAPy/mI3YZ5XQAj/DObgR5t0xwis8pu\nj6hfPhKmali5QCKHGJMqZTqq/Z83o8b/p6UEjimGnPKS20MYqAz63TD7Q2Kq\n3heHOeKAUv39O7zaiwtIHpPeIEC2yN2q9fCBWe1sdcUk4+CTOeN5SbgQ2CTG\nMZqAYVhkMgPESacbHm3aCOhBtaqgGycgkTcNGvIhpVr/zoelH8DO5F8Og810\nDjBqp+tcRQ7CDIz9/TRknIsQuTq2JlpeyPEdpNOXwBXOrD3m2LJbOJ2SZdVO\ng+Zz37i1+631G0zFg2R/cAdWtonaXC5SSjwZv0431sRvoNsUTrXsBESgBKhz\nE9wd9SmBNUc4DDs8+S4w4s/muWMfH23RUiHEHA21+mM6AA9Wt0bxghCf8fT+\nBKyD/XOBjd8dhO5HZSMYGmtIQLXSG2k2gEJhVVXxgWkhnoDfKuPilI44Zx9x\n2jLBBozDPZS+oEjop7Tte22h6e9wR4j0frd4OjfxsYXaqdHkiAVq+dWr4vcL\nE0F8kxdWApa9OfQmsSRKPR5KJjN8WjZqvdL8ZK/l9lOge4Ms5JyVrQtxF8HJ\nWF1M\r\n=QjSy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIczfM6Fn5iac+hY+9LQ81bw/bOJNNc3V7ptkACZN50wIgbVtylZVfUdyGjjk2hzSHvM+en+bWqqx6fr4Gm5iQdmw="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1990_1597363831320_0.6491832767646963"},"_hasShrinkwrap":false},"2.0.0-nightly.1992":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1992","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"771715b9e41021a4867715d94e7fc46f93d0303a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1992","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-oaooAkUUCvebouUPvUa6c9dqI1itcWjshFWqYXTK1OW09kqJ9Bs5GKcaPfQ2/YYsIjTMFDWYpsvoCYO6GItiwA==","shasum":"661cd7234c86259a926f8d45aab0c25fa2df829a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1992.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOHmICRA9TVsSAnZWagAALsYP/0caJTTy8u9+LyUF4cBv\n9anIF2lMFfPBGDjqxvBVm0icfEoriCihLAEUeEcQU9wNhFnt0koX8jOJVscv\n4GY2oOIW7ApMJOL8gfZg+SIfnWEinKGJOrV/IYHr6MtUkKr8GYSVgfei66uP\nOo4tAcdwpXOPL9xMFs5UxIooL6VyYKLiPi6oDc8Q3LN4jVyTrTqj4EFAFmtS\nC9GOOY09A5iaSvvWRXFy3h1t+qS54yBfjzqnBf9g1v/348r47/m2NXciboFL\nh6Vi0lF9wT62EwOJ7lijCqPghMLyRludixxyVx8M93dEriceWxt7wKV1xkas\n62piZr7ry51LDb5BVO03UMDo4LWTVx7xgEiClIV1fGO32sojLKJQSlGDJedB\nvh+fcYgchJoJAOcQJYxzQ+dyLGN2zQgz76UbtxQ1PZiBa59tqEk02xfG0BQC\nIfOvxNkBlIvd7wERdrvLmdfCi+iUD5BDHHHqH2Br/CA0eN/tXgo8RY4Y7mfQ\n4PItHA4Tz8geMw0E5F1a77VCVH050IwGKBtOpvlMGfm5hJEkZUkCXaWOQsLD\nWZLKQ3n2Uy3YqBrDcHiOxVFs7iNVfNUC2wG0TBlc9e10+g9wifAbafAxn12j\nVIVlOBPTtAlqldzKFDY51yaUz/87dnLFQdei6trsz7x4z9u8Kk8cBVJ2d1VP\nIxE5\r\n=ghqn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFASWm8XauBAPW4OHeaeYf66yBGKrKTOg4AYAD4jfSnnAiEA5uNsTslHtCL6b68NLeqMDN4OQwM2umaJO0jbjQvBveQ="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1992_1597536648158_0.6067031325769368"},"_hasShrinkwrap":false},"2.0.0-nightly.1994":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1994","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"64ebc3757a7c36432d55ee4d791e96e30dab242f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1994","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-sYVcEYlE7sUIINXRBCcdORrNH6Uqs8G47qNCKnNYw79oRAZg2Bpj85W0nVcUNEy3FQpISO5NOv//tHH8Tqw3Xg==","shasum":"e4ca3bfdc8ba14fb90277aaa24242d8450e3720d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1994.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOxxrCRA9TVsSAnZWagAAtA8QAIcDsFlivbBMl6BavQcP\nV+QkpqmMkqQuH1f5SBqSa6Nf78yVCNegyeeC1HBq9O6+cnfaTb/ffw3jr5PH\nAr30ITTVof94L8lQuHqE8tQ/HzD8Etq0FCxGbbQD4IX2jGu8kZUBBgZn6CAM\nJGFiLl0tb01IvSw3Xy7efSUZ1x+3seOt9XA0JAebnEoqITFhKR+tWAD4sfYc\n5PEHwzeS6phihyFRL0D8wQ1vdreMffJSFRejeGrdyVRFWtDsPK1Q01hOgQoW\nClgvWcJDyGhdR0lOnAkBA9J3qmKUWe3H+L1zlG/eosjwsBXjShamX27z9Qrr\n/9Q3b+LGXHXwL2UVgwkAMA5MlnN6e3/DOekyLV/X2wfjL60aMqyxgMduN8iK\nxigMgOKKg8G32ibqEUZnsc/uK3b+gEPPNK2p0GTnZFF/3oiQKWIJPl+tO+Nt\nwiDhl0W2PaIhCbf7wW/dSV63JTFBIzba7gigfws0ky6/bKABswAB4OOSAWnz\nZoKwbuJU55NhLpxOTQB/Gh8tXWRGLu/I/slPOLZvMP6Abxi7TkQEsF7N+8M9\nVdVQmi+60F3NiX4WwrqiQQM4Rt3yzlQ2yNjGdvmOoK04Cm/79oCn7eFC06Wz\n8OdGpj5Y4AZwu27v9AlcrwFi82k6Td6rUhmicO5sh9/+sFhwJh6xV7Jswio8\n9YUm\r\n=wYsa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDFfzwXABie+JASlj5PiC1zwIl4RSgJSznS3XTW/rqsiAiBS2JLXrRBlHL59PX7JwfVnuMsm4/vs6b+GPCpLhPhVTA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1994_1597709418465_0.9227353600797872"},"_hasShrinkwrap":false},"2.0.0-nightly.1996":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.1996","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"947399643bd37b2dd91b8606d7fd3204cbd8b43e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.1996","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-CfqQH2hV49KWWadTlyHO93MJsHX9rHl1fXYM+Php9NahgAT0HIhT7fVAs9PFjaKTJXFUWMC4g+4UuJz23Hl5wA==","shasum":"ef98a2a43a4212c8080e73e10e1380e23c81ece4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.1996.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPG6lCRA9TVsSAnZWagAA8PMP/1VsSKveE+BN095vUr0Q\n5TjTO39OQs65/6m8Nb4UOoYWQ7F8cHj6m2FqK4bwh+yJonnE5FiOayEI5b8g\niZ26dSPD187Tawg3ACToq5eIxj8z/rEb+z1kNpvsPTP2G/5e9YuM067iFd9c\negR3V0wPa4hZzN0Y903ajXKYjw6+lWZ9izn+/276eL98GGBS0yjocHqGUvxr\nB0knmqlKHzx9jto+9gEkN5Qecrblw1qL1TTZ8FzMkc+6D3nVeeLqjvV5LmkC\nbt1YucrIOCRxP8Dt0KC232vxQ5U/t6uwlmOyTm1hfR6xXCmeF5AhcPHxv3W9\nW8K/dyP9bg118Df31h6UMuvhxkX2hHI0ryi3qd4yYR9o1SLms3EAnOztrhjj\ngOHI3jj0OY7LTLy6lVJXWypJdg2F03w3L7StGkuaSOODle0vWPZlTx7VJvEM\n5Ajh5k/5p3dKtBx4V15j4V9zgfvfNXRBAt4UX+mGz+MjX0SWQNe6vdfnQRLS\n7Q/d/e/YlX+xYUIwsjYzxeRPsdggDKLiB22e6ywz4ECQ2Ittn3NuYk04Sg0G\neIjSGUpkjpLDaizHEphqSV/psHzj3vmg0qkKS2TAVMOi3u7bcVRXRpNPxj0q\nEmYUA1kQeFpzANv4TMU0v5hA9bCSc65syxnjX4n7dhFUKZyNZdXFqlNb3ylI\ntcZh\r\n=Q/cX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIELRSd7HnzPtLDmGb3MiuIa5sdmmk00WOq+IW1nRXcFiAiEAtLRa/u9fdYQIbil2hGct3hB4TTVTnSgADLldF/cbp0E="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.1996_1597796005032_0.9054671434436801"},"_hasShrinkwrap":false},"2.0.0-nightly.2000":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2000","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"28b5631d72cb53eab32afc23e713bc21dbea7b84","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2000","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-CxP+UT6taE6kLpuoEBguOumI76A+iXfVNYNZrfsACxsXACHIcTYav0CICmN3eEUsN1SNtN4xKwvjZVBNEmDcJQ==","shasum":"1cdc624e12770e8f4f601ad5c91c5d07c164b7d0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2000.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPxFXCRA9TVsSAnZWagAAmIcP/jqoH5CN4VnY+6Bsu7xG\nsXE3lRnxziFMqSdUXcYdP/R5Afu3sJfwc2eT5ECpBIZlPXhRxzX3mrICdbro\neQNR+Y3wMw6W05EyUQde20E1PDrbBeFQC2XDDAZkJHPGeT8eYBSfqjHC6D3A\nYJ9X9TS+lYpc2AIBpBIJudRC0gK5aAXe9Y5ziPrdithGxxnWyWoj/yAsbrdK\nb4jGx8azRJSkn5ZBq5vqqricMtnzMCiACcKwx1nkQp7oYElrAnxZZwC9EXol\nK525ChaOzXQOSZW/mv3cxIJLx28a+Vt7gDY4gO+pyamnAjknC3fV+m6B4TJ5\n1sgPpeqk3wB6wEJ0M+DKYusJJ9po9wavZbw3o6a48GHND2YYoydu8TQSSLPJ\nWVS7AXf7zkK+3NJP8C57m8H7/PECFeYQVm+h2hnBQceZLwhFYXcF0HD+1sXF\nmxB9xZMCthW8FPt292S68om/m20dWgbxQqDnc+/epECZOgU4lvtgoKjpYdYX\nBMhfD03zUR7HE1IYRxN4cMA+bpGMRYUXzOA0JH97wIygc1lK+22M7hEdPA/t\neVz3dDWzc8LeDYKeeYXutlUi09ZQ3ObCkr/8ff0kBnSitik1vIy7vTNV5aTe\n27ZO95wu6T85yU41S1fRkXVR5oZ2ZMDXh733rcAeKsoTp80sNZqJ7PHA930r\nM65C\r\n=Hrdl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsgrLIyi8TfAlmvMGtNTNahbgeIywKfsjzKKQJhMJMqAIhALPFiZ655iBW6MAXmB1lUsYVnu2JtAyiPx7HzUPXKrZj"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2000_1597968726960_0.5872310165238255"},"_hasShrinkwrap":false},"2.0.0-nightly.2001":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2001","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e4c350d2f333e9aa25d75aeb6410cf604667fec2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2001","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-2tb/L9J9/i1BLn/FWibJiubMo57D7SpOD1si1nmPl2rasHVeSXyz53JeabvO5/ju8UTH+/HdMkSTUeqtQTLtPA==","shasum":"8689d09e883f13795fe2eb50a5eec6585dc64c43","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2001.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQGMVCRA9TVsSAnZWagAALbAQAIQZ9BnVITQpIwjTB8WM\nj0WDEFpkz+/0qGxve8lkuUyepTAfZ6xLsKAqLEGa9HdVsx8KbdQRd1rK8zzW\nBi3v+Rf5FPo3XaGa9o/8WqqLyOHjydiWf/smRpIgDlyreuTV5CFBKnOFQhyj\nEC+VAn04sQg/kWC4HDHRT72ScR65Sxzm3p73U6HYVUrBpHBj/JKYR6jHbCMX\nVXjE6zvjBkfxBACSbf+RDPatWqoig+GUGXGoKgKZJ9/CZ0tMiPR5EDiMoj/5\n93Gu03vx25m5AdOf8s8qmepDKKj2fOJj2PKDVzzxVKv1Lev2lxws1N/jpx8i\nf71aBpxkzeGlmdiaLi1DA/z6b900eTq/ZG1O6R8cCIZ1+PMraCnrQ8KjwW1j\noAvOjq7rMJi443DGfDIDEOOuh4/ypFqeCaoNV7GIExgtK4sNxUIPJMWhn8Sz\n4FgEyYvzcZ0KfMhghRbaWj8mpn+IaURksfZN1rKvVmBRC3GlYZwp6h03Lswc\nFEShrvnVavpjbEHu/R2IV5Ot7q9JRcYRnuMi8MXXr133gqtQREW4dCATx3Oh\n7IOgGWMAw/FgDsuFHNR+yGfHLxZlJ9p3cDvy0oi8X62Su/GaEzJvCyyB8TUR\nPwJNWGVj8CMI7wS94pu7/MPIiLKrtNsz5knJkTh7HwWH0ozgELaJ1n5kmJaB\nQzZm\r\n=mgij\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC7341niCRyD4SS7G45EX9xOCD8E2dhaeAcWJlbTNBL6AiEA0xChIT/gblPwLBiwcwEHGH/1h28zAOBpZ9mJDbabfnU="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2001_1598055188916_0.02989451781950936"},"_hasShrinkwrap":false},"2.0.0-nightly.2002":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2002","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"dc447be664c4ec77211ab1da8d19c48e81158552","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2002","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-MjETDIV1AiprkChOZWwoNriTkJX7u7X0bcY0uHCt1KoIn+yWPbHmwHtscocvAhwMoPbDHqRdYqkVOR8iivM1IQ==","shasum":"82d4b0f0eaffc3d32b0227d4e1c010e6b8f64185","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2002.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQbSfCRA9TVsSAnZWagAAv4MP/iixrejzaIFXQl7HT9cl\nUQ5gtF8mrieSO92yU7loH8+IULKGWwCcBZ+ecGq/Vl2ldEBCwPa1vW+CDQL1\nchnKdkctqDF6rwNqyL7KUkST/7O0wANgYTEJUEsBNJWjPMlm7dnDTmgJ00Eh\n5tWuulqdNvUHDQs5/ytws1KEYsoJQpJo+8EDeKgwxlgb+9DPk8KDSJn+ppqB\n2EXc8SVOHXWE47566ACvtfJ3zW4f59ywJ138KaB5mabZt2vkRThU5wV/QOkn\n+iFKy42Ej7Djt666fOH0gLsBJGH2cN0MMzupyi9cPVW5VnMMPeIWTwlBUZ+G\nVDOF+OxlE0lowmOQ0tCo7H6/R3GeNtyQeh/GDlGtEwuo9fXZooluuBNyVp0r\noJ/57BYB6D/SYqcixfa/SCUDuoCqZA59z6P0uJ2H/Ai9MG0mqkk6DuhkLizE\nPtvQZDpNx5IWUwhHWWwVtLnCwFo71YMlFwFLClUg6mcWQwPZSpOrREO9SE+t\nfvkpgB0uVs1TUSkC3ZdpnSrv3cLMN1+jsH/UoEtcqxrKATJzxCe5sxQIBjFn\ny6qbenGI9jB50GU2wLmyUebpTpX091WRld/+AGRhgsRuLbcukU9R/S/DFbZb\nLhQfZK0ll3Mfy/hAbsmp6Esq7fqVQC7+jQyO/8JdDjAibZ29MjNiWz5cO25h\nV+lW\r\n=RQBk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGQH4Ye6qLgMQNfC0Q4AyDFbWEerGXsqOQ36IDptb7QeAiEAuVdam/1i9I62Y4m1FssG6XGYZte9vI+SNlQrEtf9HFo="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2002_1598141599369_0.2765389038870496"},"_hasShrinkwrap":false},"2.0.0-nightly.2004":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2004","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"414075d28365b5aa6a032d6d6918d54ee171b195","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2004","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-QGQC/0oMYSQAysMBdAe7dhUY4EeIrIspHxHI1u+67x4flX0zcrR15dUeLzW30I3KjLyUm13I8AKbItbD7SrAxw==","shasum":"258e36250fb1d619382f4f133eddd08efaac75fc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2004.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQwX1CRA9TVsSAnZWagAAkvYP/3yoCkfrUeV5V7F2+Jel\nTvMCpIOSvqBsrcqPsttl3vgoIYMUu1Zk+QIIrkhZM/xQ4avDSYriWcZLHLIK\nDIAbC12oWJJxdhmxWw7OePlL7ZHVTXmpmyUdJw3TyrZysRhEPBCD89ex82mh\nYjo84CznJNk2PX4zRk9aS+dcHT6fpBI3wsxcKUuMaK8aUUx18rc3N946/PA6\nqGJRDjdY4dd7ZCk8mMJg9ckqf68BUOXqVTtIwLFYPPCSrU6gJPBvlO7x0a6E\noEq1T4hlNNs8DXSSpuldW7TAF6go9xxXt/EfdKr0PI+GJuHHM0KdLktehsRY\nQAekQ/fHHe5K3uv/Uug+mQQ5140cgyM80i2HlYAIEhEntJyVidDel4wSKn/s\nDbOfV4pZ4xrBH24CFHblWkRk78wB9p1kK6whEP9EFwjKeZiFeimJPaduk/3k\nvpfJFkNDTxluIO92y+Ul1DHy9/mQ0RPIRNdWAc5T0yDD3Vd7NxxbvybQrM+2\n5KFzyd+m/QvaVPPD6oBg8D+tPMU6OCvpirBvpok5cWQWHWZTxBR4kcjrKKS5\nlG6oAGr5lHJkNpnwOV4occoaQ4K/P8KalvZy1xP9ccKW/NZ9oK0YjrCKmh//\nhdENyUpPArkpO+nv/S75ixgKCnyIc71+9IglHmRxQS5slanMcwqbrkL+DIQH\nUmiT\r\n=ys6F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBdRIQX5GzW4+XbwkzjxmqoGqN75s5rvwC/0wwLNcqOfAiEAkyU0P7H9F1FYLnEGPfaFoRJgi1P/6EgbW7MVLFMQtyQ="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2004_1598227957030_0.7792445595520703"},"_hasShrinkwrap":false},"2.0.0-nightly.2008":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2008","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1e5321fc1a0d01eaad407e335276a2899fe72f62","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2008","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-j4KZL8EXJH6RfHCLlP6za4WnmCQCXGeY1uhbQFNjEs+pPpOd/KiZz/GONJf4RXzzTBd8pV8Yb23nlQvPqvW93Q==","shasum":"95903f02d4ed5ce3273e579d3f9fc9cd5e957054","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2008.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRajyCRA9TVsSAnZWagAAmKAP/2e8xcqE+lUkF9VcJK/7\n24I/FWrDIIbKe1pH0BdE5VXCvu3b0yPxd8pZWkfiUS7s5E5gxPvF2OndRCxf\noJGCPI/wlDF5UACj3IXF0i97Bx5movZWs/c98zjDKf5eOaaccPIPZw+Uc3l2\nCvW6Glt33uqxR5ckZp3yyjBUWIcKVLptRTR0OsBc9rbLqe2Nwchna+5+h/XB\nqyXgCJAENyXLdNRm5Lm+MDCiQed8AlO2QYVzOIcyV9QMiN+SCuUKSZYQAwrp\nipggkM7HQLithVkhB+jSZGyDwB/WO9RtbSO9Eeo4Fs01CDVnXsVYNPPq+VGS\nZRzUeAyeLBMINIhMwyrAN5ovFVMZCSTYJI0sbHF3SqeSWTHx5xN4AjfJS/VY\nobdmvGoPhFvnKjDFTzlFCDFlAbffsAynRmKLixtM51GZCLJWb+6HWJadXNYl\n4r/TtRgR1FHAG8tphsGvfYotAIDlDMvbs95Vigj1/vV5q0rg68DXhNitWd2E\nR6oAk3ykSi5dwnNEmwyObxkfK+sVqdqWaTDVqF5d5+gEHe5NY0JERJxwauRo\nbUUmdN12uLc2hQkxssV+a3axsGxaFTtilrBkOyip4G5B005hEEkQ4AgsYBBy\nN20gFyo/NxaKyvm0tJNWXhGhBXnKioYJz4Zswzd8GWyUXY+7pMhkE/4oUhQ+\n6HwU\r\n=Ezu3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICT8HD7MW7lPFvgOQ7fkvCCW0cFlzAxgjVEAWudbxLEcAiA0O0GzhqOxhjmX5Z+QwpOzVNrPW8tvAQYmeD/+hzOJEw=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2008_1598400754276_0.6485395948113961"},"_hasShrinkwrap":false},"2.0.0-nightly.2009":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2009","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c4e494f3b9fd0eac672edc1a27c6c9216182dd6b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2009","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-udM+AyS9dMXUlGWnfzZJ/YMyaLSqSe/vhwu9l6jsM50YebIslfryZLcwrDy1juE7GxdNertKzmJfoVe78okrMA==","shasum":"041580653e1c77ee8eebcc38306c48d0c6539c28","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2009.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRvpcCRA9TVsSAnZWagAAax0QAJsBdUYSXKNF1QdYsAW6\nIGFsWkHuOSxlW/KYeR5pFzTtkLROBucgOHp9CVpFjrsD8qNnrX3DP1fWTHxJ\niHAFS6WHCVERpFgC8BPhvq4Z6iCNKENonrgmsR5vSf6nUKcXa6nMRdPtaexC\n/B5IQOJSwhqOfUoS0E4XxLxDv3uFoZNE2EDgMbExvkEqvnYeG6vfou6MvWdn\ngtpFkbXGjmY0rE0TVDbZ2jId9IlZ4ama77RPQ6VsQmA+QLza4JaDQqxmnF2q\nOHNNH9PZl09jZpT58eh09ulmHrQBXsGMgpfiF3cRFIKi4IxtAVl9c4PHJQQJ\nw35fBeqUHo86NknoTg9LKJtbrJWeQ1TxTxOb4vWkrHpb3D0kVhCkZW/Cmxjh\nYbarnuAQxFKzkOgE5XUFZgRoMXi+o8qB6wSVSUzMTtfBZ+lBWZHbuI8606nT\nEX+Nk1JDIxc0RODQTKMa5iETNPoN0MLC7B6h13zXB3ZQIsBnePRZvurLgdPA\nLEmiErgvvJKuV+5lUizOnfkBfjC/efA2xcjvZGly8ByQiG+s15G8eSyCyzoH\nnEfGGP/ZmWaYMhdeVy8tU8FW4qhBJCJzjaXEVyEPa/v2f/0u9okRdFWoeUDx\nFbbUKAOggPkGitQ+3N/QPexD8lQdh3T0zqcIsYi9qMLQvqzv//GW9yfpJZ4f\nrUBn\r\n=iks6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICpZ9g8u0KUa4NPNJgdvJeLW1fVtIDFj3b/MSfQPuIDYAiAn4IDBBL+yZdANTCUJ1BZf/W20fmLdG7xJeX9dCc/BIQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2009_1598487132182_0.6077410138652881"},"_hasShrinkwrap":false},"2.0.0-nightly.2010":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2010","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b6ba17daceb4bbd7c2061509c15da3899a497b26","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2010","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-7GzRoGaJRbEaPLMPmhkk5nb/erH+65eJrCzZ77AIwMPY3gWcrH1pAH3Vav1Jf8zdhbr8QO2ICn/PB0oYO42d+g==","shasum":"d5d266ac532453f3d097e3f5d91a964ddaeead46","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2010.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTEF7CRA9TVsSAnZWagAAiM8P/2LLeLSUtDvoqjdrNxc7\nTfuU6oiejXlnXx88RZr+5/7O5t61YO+UD1c21mJXoaNkcoLxPpUKwuVE3sgE\nmQzTQzpXCmRisJCxOLatMcwzdJYvXNNHl2TdOE+rJw990c26msK5jFu11tpQ\nu6JXhrOdbaDqqSaRQaSOHhuZfT15/quO2KJDcXTnHpQz90XfJY0mLTZkFZDS\nCGOUzyg+OnVSddgM9CY4pWWTelVl3jLSy1KgnN1BcHtFcOn1FooFwVgahlce\njsQe1vn+NS3tjyjz/AWt/ucLpW3Uo/7jOCMxf7+evZ2AHoHkImUo2WcWjL8S\nrPFf5Bt5uTtgGsxfc1+aDCLJ1Gettg7I7wR4EuHIC6uuQv8fLYm6oDrLNqDv\nvaMeWKpb5nln63i2AcOLHFSZh7cDA9+3KznYi89Dzl1D/vx5SakjWFYd0Vh/\nAZHjG6KP6GHL2HkwhFqliWSLwGNVbXf+uSBGpJP9ktKGHSN5pQ7iaZ15Qpbn\n+15ylVUowFR2hwCIsFOPjGaR+LlbTLEsJhMLlN3CBN/6aYCY7MsJj+aZN4aX\nvDsJcQ45dlH7IVSqBRzYn1w8xpFQPGPRvTRbVSYBw7uEuGWi30awDOpliPI7\njl3mBg7nHev9xqnwY8I9C5AwC0p6Ndqwic2fz/WgqXnY2tylJorrZn1i8H3O\ncqFi\r\n=0sat\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNXIrxIr6g+XKYruxVhcW7kMC70VAE+Y0s+otxM0EDewIgWqkofjM5BdvDcmjcQlIy1v5b+RwcaXIOz4H08KEHgrw="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2010_1598833019298_0.5357674467792852"},"_hasShrinkwrap":false},"2.0.0-nightly.2011":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2011","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"99d31742177b306579a699a10f4b7cd14bde12ee","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2011","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-GMJdrvbvgko3mQB2rHk3nsEwLSE0P0I4YmsEMlqT+GC5i5O4ulxwYwp2cLH/2qVEipvt43lCEUK9H/w8gYWoyA==","shasum":"44eac8c20b2640a940cc61c26bd5c4a1692df165","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2011.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTuPkCRA9TVsSAnZWagAAI8IP/ioPMeyPcHspKEvjp9Bk\nN84BREkZ/zOItU/AqJdx4UGIg7G1lCeyJM4Vg54qJeqVq5RTrO4+Gw15QuhR\n4SFLl2mt0BIfPF1Nnky9U5n1PqH33CoRTBXjGUCOeqgFNG0cRdUicjWWVYO9\niBgyKLk17NfHehtK3jgJ1NGqIAJFXJSqJudcn+jhwVemVOQL5DJUKgOKTrWV\nJ+U47i+lF0wuWoAWs0UKFwzZAtTNFeA4HRsdHGfCMOEjRSzbIRJQCZ8sgrZa\nYPVrPlZ14D53oy9tG09slUAq5e2clcmMCyEHFE7xQnlmVgblxXc0dxMyU7RT\njIfAIut9ST47tHc4r+Awva8oU4oMaBQuvk/a9Q3cX+nDDEohhb/GyN5Ur41t\n4A2SE4vp0Ue6VSp+KkXzAgUCW0RYFrU/Co5G41YnziUCKkjiR/fdTF4ZQcPk\nB/6cMlxxBTmXBws2jTnKynThlOAWvyzgFmEhcGsKJu/0lFiP999rxjgO97Es\npbs8tcjlLh8Ypr1bVeVVN2K9zHVVv1O62mUiJ/f+2qr1+1m1Sf9apiJoajDh\nTN/BNKttiiWWF8my/L/tuWavWEjuuOJWGC2rhnVlErwoEotwB19ilETjVlaB\nk2PZivG5JbulGN9FJ6lrpcDsj7XDx2DUQYGonZMJpWG9sg+b4nUfDVt5pzEk\nTqsZ\r\n=S+8e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGd6Y6br0++qRLfyDneWo1VfcoxVMY7uY4whJHTeAYk4AiEA+es7Kcqs9njx/46h0Movxzm18p7UWyTeH2wV0+uD/aU="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2011_1599005667845_0.11227245037281874"},"_hasShrinkwrap":false},"2.0.0-nightly.2012":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2012","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"225dded1a001800dc99bc07d879b3b676a56da50","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2012","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-DhIw7jFLoWKTPoYpX4ItBPH8Tt2V+kt/IB2IYxx61HoBBA5iTO8bIlMKHi9BQXe9GepNTInGR87pOrfkci6KtA==","shasum":"328e7f4a0b947cd3671f9bf66e8e8f24ef997161","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2012.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUDUCCRA9TVsSAnZWagAAgEcP/imcxCCHXczHLMbeut39\nKR3PF5wR0mPw4QM3dKMGhf8OU6nR8Bng80/leZJPqcVPdOkvsB7YrXvVKvyp\nzM6spP60oxb+ou8vdLBzbE6hX2VCOcZPpJDy/SOxayoWDsrwJsPqpsrzB4Xp\ngIzTlEIoin0mo/m0HcEItVaH57OFXVZ3RBgS7tCJ9iH2Jr49MNDr3BcxCNbW\nLQ/7wdTUliLPzK8mSoJfUJRrpnoqNWsfjNRJ6nB8xTgky7tEoKvMPB5jdANn\n/ukHdGFaLRtk2liBshPfkYwN9uFZTQZ48sLsznDgFgaxDVt1WKVmQRsdBqiR\nbYnP1E7+IWgQy+8mXB7oEQVN0XYglqld0P7xfKG2zjyZGSr/jVyFdqyzcJEB\nRGaW4/teSPE4aDlZOZkl4mG6jQ2MVVNs3gRPyD3gmeeFJpWxrjveps5Werus\nrAglxkzdi6xXtN5PaAk0X8v9ezeqYIobcftSyjQtGrQSoZtLJYzdWU2VvCbc\nqcW6Khg1RWDetQYPuy9MN0Tq8kjjvrzkGVTmbABysweRYyvM/yghQp1G1ovr\nzkfsel1A/CmwbX3h7v7+rh6nTrhLMj40Md0LlNq48AS67LTDYKeeSqbtN644\n7iyCexan5EczGhzqSku0s2sL6NT5Bf0ced7ldfkb3WPJEdzwc3M2mYDNtg54\n6uYv\r\n=n9yi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICL1E71MPEsiclqRyFXBxIYTRG/YaN57+40lKnRCXEthAiEAtd5+lhPyoybgm2YKoot6iAA/yw6vU2qmxVaxkJ8xXI4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2012_1599091970302_0.7375088075154825"},"_hasShrinkwrap":false},"2.0.0-nightly.2013":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2013","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"288396a5f4dcbe06669ce0d9ad0302aa76ae90b0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2013","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-T8fyvAsC04jB4XLyrod1ev3vJaWtN2VKUC4uq+S7KdvBwKUMcB+YXROVLh7TSWd09i8Gth4zme3jzBDmbpxWDg==","shasum":"97ff3ba43170773d82b20a501ecd40fc7ee1f433","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2013.tgz","fileCount":9,"unpackedSize":33025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfVCmcCRA9TVsSAnZWagAAx0kP/0a2TZxYJCN6NLloS/ln\nEEdJyeZQ7eVfZfMFbBMw5LgqdPqJAZSk349eXke1mtKu7kR6S5Qtr2nGAedj\nMHSP8R9p8gaaInDLpDfKnkPvnu0zSeHvZ5WAhTyxj4ic27vVPj/Sf54fK+Su\n7wTTOm0hogzLrheKRhS9b6C4doQkCM3fF55mmp7dO0UZWnGji0m/YfSF7PTo\nDcxJ3g7+eRDZnZGK0+Nm2OZD5/i9FTF/IQqszTvORvwUqkYJzvmUjS9uT2vJ\njmUqWJGUakYfULsMO/bH9Y+T09wfwceHJPm/8fo9NfhPt5ryEuf7jPKIL0Hb\nuuJAksC3WTGobDy+rO3Jf6Vw0tUhkGEHVFmjujN2C6ghLNqcDEDeFQCcrAKd\ns3fEdzhPOf4Pc7isJ7hmKXOgmq9gmRekFgo2IGVgoeU96eGka2Cz14dL2KXF\nTTW7XZGrQa6I2iPURFXKMyGflcTVo2a6PvF6UNb1jTywpou1A8bODModwD4F\nV3HIo6gtbf4Ifxy+IBDi0zutWfARe+fnK6/dzQ3SaohOQJrV2hT9qInXzKdK\n42ud8LOp3pTf9DwrSvcnDduBdO6yaTc5F3vvA88HN0tnfJvYxQMyDDDGnsfe\nfZOtkZQ+3oIco4aWpj1V+cvc9LCpwIkCMQ1YzqkFZLkTDqDnL84y3SPZ3thR\nPqmc\r\n=QLWq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSCsePLyyx1BgLoZlsDL7msxN+yUTHIxSJmFrFhDSKaQIgIeYfc5G5sSOZGRPi5rxSNo9MBUL5i4UJsAB3OLAkyzY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2013_1599351194829_0.4007681329111552"},"_hasShrinkwrap":false},"2.0.0-nightly.2019":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2019","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"ac21b528c944997148e2c839fb68fdb0f60760b0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2019","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-PTIc/bpnr642obBro2sPd8lTJMs17h5o/vQ6TX/PAs1R1y8Oc25JxEZkAhKwBCaTPWP9dEj2zljZkNpYBJcBvQ==","shasum":"db7df7393848859be53349d9fd5907a687367326","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2019.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfVsymCRA9TVsSAnZWagAASzYP/2cbja7pgW/2NnjFFouQ\nJVfthnhYEK/n15oAeCjgRE+wSPUjy5N6XDlXA0ZKtatpBkP3qSlHfK/ROYL8\niOof3lqK9wUOJETYl42I3TdI9C2Yn3GuhgCpTqDk9DyMSFovolG/PxMqvKZu\n1YQBO6DlyFyq9Wpinhqna48i175pQViAoGmCplPuye8LsMgy//29NixTiLAz\neZ4YBvD3MhJWDk7xKlOWdI1Xty2U4ZDvIdZYcPXqVm9qW2Gid8FeWZwgH12R\nhvUFjrpltAyHvSkyG8sbRRjhvW4i0X0ZDvJV2oHW/Ib2XB5/cg8zRCfqL8yT\nz1fAp/Y/pwFh0C++yt+TCNEFV8k3QAG2o4ioA7dF3Z4gKHI8jmMVPA/4kdxx\nwL1zN3MBAgJv8M1nsF+Jw724K8BnIImMU3aZha0v2xTrGjyyjnFf61YFME25\nLdC2Sod3vsioCJtfDRPIlKSt7aOdwfjIIISncnvzNZTUP6cdh3ZIELWMXSeh\nYBs5NUPXFx/yOKgiyitNMaS9B7SKoyp3KnUQOXsC6e7GvXwc/YQGYGyZ1Ppn\nON9FzFcY6xxmzxdTxw+CXjxgF/kIRkx5yA2FpbSysQXBBD9hAtlbypTYJBsK\nYrZfEoPb9RgfDrrZwotLM6vB9ngA0IxZ64+IgaeTfcTSFNtRi2JmgQNmbh15\nB8sD\r\n=Xuj+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDBiHgSDULbIsBI4RjS09HhhWZ59UbzWalR6NWEN9khcQIhAOnQh96nZRpeXkp5dm1kSi1uRkFcwXjiQUkVO0iB8jXz"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2019_1599524006576_0.1170036810922559"},"_hasShrinkwrap":false},"2.0.0-nightly.2020":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2020","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"71b21f17a13f48d14c788717f27bfba39ecacafa","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2020","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-o7jz0hSEASws+KWgQnAPZDNXFdmUt0LmIXhM+Rj82q4LqvXfGNgiLDh3Wt8Jwt/qVsf0UTEYURBxhkZSKSbB9w==","shasum":"4dd1a189110937eff110c73a4b4f332c39171205","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2020.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWW+jCRA9TVsSAnZWagAASvUP/A6O6BeK9xUXUT76Vm1L\n1I8tVGRLa4i26zheoTECuAHz3epCZxts7k0QQTl2eJVvTKqLLS2u2NC9y+W2\nWiKAvPbTzaqzsuLf7GpZF0mjZ7Kn2Kayg+y1ovPe8uwQxek1lp8SKoLVHdon\nYuWMjkTOwpy+vbpRKyog7lN/mLpHTveG4L23pY/xfLXwesOssjzyF3dWmuCj\nuQtDQOB7wiGcqGKTlGUqx26GMmClO6Sd5j+GHRo718iQlTmBSmwu/H5JOM9j\netJOm1ehs1Mh1llBvhHWTSED0+u/6sX6bj/PIvqEnUcJHkJAtgEvaqOEzx4C\neZS6V9HEgEIkWFjruCEmVMVqlHnQz+lGtPmW459xqxnGEjy99vhI8f+kpz1M\nVw9o74HeYrH8J58UnUgHqEIRknBXxsIncVo5yXP2txGPx+8R/tH/5sDih+m2\nyW0iPGW/uuWYKKPChH3xBIT8NEjBGGLehPrBriB0t3Aiir7Zd7YfQLqCCrln\nsy3rZKPfsGGBqbntVTplNAUBKlFKua1wTT1dwqU1MtjL3XFS5c7Tsi8q+LmU\nM8Jv//BOsmluayB82hiCl2cYVBKCNiX1N+f6muYzni+c9QIrgLRdi4ZjRNEq\n3ZfpuEFhTa9b40uXr0GBNNw9/GVsmHthyunDLrgvUFncbbM8mfHlviGX1oLB\nzU/T\r\n=T3IL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7DgRMF1WCtWSpujVxizMNxiYLOGshiCBvic6woqiIMgIgSzcpsjCkv8dZLdH/Dt1cWBl8NLM9jkLjqJXJNyTxmIw="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2020_1599696803074_0.9355064759901155"},"_hasShrinkwrap":false},"2.0.0-nightly.2021":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2021","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e02314ece68710432aedb9704774921a40aa85ca","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2021","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-3d1EWiiLAUgKPgUqHg09eNtjk49JDKjSHMjo7UfoSRzsubA485/IJm3aiMpow7Dr5KLNBD/kg2m9iSoBmIgxlw==","shasum":"fff2c4107e1dbc74e244ab059a125da4e1779429","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2021.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWsEdCRA9TVsSAnZWagAA4O4QAILIv82C/OsScDBqKaG7\nVqxviSpwHNaAjG8P9s4f/5D/WWMoDaCQK/zw6PPODT3t+ZnYIuzR0YJ3URGH\ncyJ75nmbmb/04stn0fCwLiI/aBQm7ox0ovE/lJkoHF2fjeMT3cESAk4aKHmK\nH3YgvDad+BiSP4qUiySwTRF4h5FnorALAjnkRg+KzxQ8g/QRwPbu+avBu5NL\nZ31GSqdJ8iwDhFh/UMzUWTrXMwJxpv+Duiz1UPOzoXVKdUjUCBsYEdotErXx\n0wvlMrNNV94amOo0eHoKp8hm0vSEL04D74mhNkdNcSJ+xLhQpNYPw4MtQFMw\nExN0/Y7WIkBBJV9tUZP9HSHtcJp4kZvh6pjCOwejLvmpcxpQqz5qMn9lY9VD\ng1xe0UsLMo6WaUhVKiJw43O1HnAcSEJNOYQEAPQK0wpgiDdE7D3B/d/6kJ1s\nhQ88UtenEmgEu17uS5gyvW62mwjXjceXzQmgdPHBcWujd6FgRkGgBUcKsiIo\nlNcMqBdO33vPuelNhQYjjbdXI2HViFowYzRM7RwA5XaWq11JWggenwUr3kuu\ntQgMlPGH/S2anHRcRCWYmsQFbfWanB4Er2NTt8g2XQfkZcD+p8FT9aT1yZh1\nX3XU6IeKtZkbaq9/jEZts8TwONJmLFCzAwZrW8mpThh0hp2ukuJAjf4FIkjK\nKImO\r\n=nVkn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBNXre4epd2ePDHbOQ07LPK9wZCkiJ6gyaA/80grlb0bAiEAxOT15eLgpQPAiek6Viv74E+l46R79U1aIcDU3ZUj148="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2021_1599783197012_0.13935854899176126"},"_hasShrinkwrap":false},"2.0.0-nightly.2022":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2022","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"796e1798a373cf3fcd0666a0d313a7eb5d9f40c0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2022","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-KA6EBm2JQqBylvZbBYu8OMRhRTnFk/eeL8AVLCxsX9a8zCRY2MiqAurw7kgm1VBnb5jMAZpw2/pH3xvv4I48GQ==","shasum":"fc525ecfcec87a73c15637ee2530e859a3d8dfc4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2022.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfXBKOCRA9TVsSAnZWagAA9MAQAIkBaSwbPE5vluG5B904\n8bLXONn/Lnm3iXV/1iTefmV/hV3DfDRDopSnVuTmlCjT/JaB57eIUwHyPzOI\nqUP/CZ1oSa42NdxOVLfV/tOzGm451pvENbvCt3LOP5B5sVFD8U0WxRbBIPh1\nGKQyCi6z4k4SWmWOpP7Manu/cN0hMytmqaGiDpJ1mdoHxK4wHXn5ClqTM//V\nDuETU7HSXIRy1Jq215BWF4C8TM1FZbvpeGOz/NqrvDvRkClRXzK+4R0/zNdF\nglRXKdfKZvalvXdYqBRwT75DFFmyWk4hNgSYhrWXzNuIP87Gwp8ZPtnlscaB\n4OUe17rOyl2+FqleOEQpI8vhw66ql4RtV416n0ga4f3MO6LO0kewBtiSJtUY\ndx/WNzNT1ky7lNLGF98Xp8gqAmP3uvhkm2gPLRWayLfpg2VvjOrDFNgGxCRm\n0ylP3YOIhY7g7E0flqsY0dkfUVX3k8W7NmmPYiWcu6qA6kazf8t+ggnThxDT\nH4mOLVt8Cd1tmUv//vwVoIXFccCKLHJEPhPWiayydJf62GHkN9BD7GlcsNXR\n7o4esEr+GIa+TRkaZJpxk1no5h9F4bUFIchLZZGUM4pES2o+pU2Zcxqp+Jg2\nboR4kylybGI7VJikn/Ali+KGuh3GpCWQWR+eRE8Z0EjBsa8L6WBbodB0LhLa\n1lKs\r\n=57P+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDK8BBQIuBRX5qzYTFt+qhRU4JOfpStdPlwcLIL0fmqBAIgDHb8o8k8EyqPLyDB0dpVf7gUIjIVl+hIHo0bLZ555ZY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2022_1599869582466_0.28466377879049487"},"_hasShrinkwrap":false},"2.0.0-nightly.2023":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2023","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"15fb0fe56135137c82eea6bf9a00f6df7d2e12f0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2023","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-0O97cXKeypQsxqQPm7De4agaeT4RedzMxwCtm5F+1mZYTHnQz8pbhBt2qX5XJmIupMXRCcMMLrh+w3MXeKqx1Q==","shasum":"4f3d65ef5c363aed024516ebf5cfc1f3a452b113","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2023.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfXrWyCRA9TVsSAnZWagAARIAQAJTB9dSwWKN3zHT6QBht\nwFV9IxiM0BHj/sq5959yWfsmSpd24UyYJ0kNt9haXGy+CYhYxa7VG7TjgMJ8\npmzDwv+XvCh5lsJfPi1VGiJfT6zorKBLYN2wcfbkRef1v1KnNP+QoRLwB+Qa\nHIpojx/UospOZWgJF0cMfErp+JBmlOSnsrPjoAFypUuxO71BkawhLfhT5gY9\nMDw4Z79sWz7jFLImuylg2OugGcRUpbDkEBt+Vz6J7B5yLLqVJ6pL2hOo8KE6\njeHFCAsagY+nYFNKIO3HkavXASkdSK1GtkX6+KrVuaNX4Az36O9DI1ICfRJ5\n1oqsNRs4n7RT7Seme+For5cRZ/jqEOCKfN8kanS0bGz39bRICvIwYHLqdPdj\ndnrxb8ofKusgHML2mK70yxyCNFINFSx5IuDeqAr7SHaE/5NOpIw+Q7FkT/mB\n8pdQGTxvA2HppGyCw2nRMXIJPK0YIQHHWEutUnk4ogoUbqE3p8QPy+PXwx+a\nE8pElri5B1meZXW7GrLu6ALMc6eV8L/zdqHHzk9m4eltoqdQps6886Ecn9Om\nntVmo6QgOr4St40S3DMJieIQXuQc91VWK9Y5Ue0PlHISQLesPo2wsUA7akXt\n5N2zHTOK7phbUcDy7kIoHe7qYDzS3ckld1XA6o78B+O5kkrUCFXCe2ftuRaB\nANCr\r\n=rHk8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUo53bTPURuFx6USMn3iMJzsRfa2FxTiVQTizbWdnyawIgVN14rPGsFMQXnZFdTA+ruf280dIV0zNY1uYFy1vkljQ="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2023_1600042417853_0.7402413691356828"},"_hasShrinkwrap":false},"2.0.0-nightly.2024":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2024","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c7a1a930d476f0c60faad6c8596a4e420e7ad3a2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2024","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-rzQ8LjV7zQoX549rpEXGfzYGuc7nXQc9a0iJcQPkXV0ghwr3krNh2mtLnWZ8rAQcbbR3UV1oLkLwp5MGSq0KPQ==","shasum":"83c43428dc3389c00f977a00c2a28d31f9e98b40","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2024.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYVivCRA9TVsSAnZWagAAKA0P/AvZllSZKmmmX0VWKdi5\nEQGq886f/TQLiARqDQx0cjEKmqyV/iGHPYpJx16gZAXYcXUcUkbNneq7UrN9\nCU+nzN6lLpnuX8FJccZDraNQUtfw+OdpGMaIYj3tqC8lr5woCYjqAMGH2YuC\noc6HE0P/KfkMfiFyyJqr0oq92nkUU8kSM3fjWSbmJXYMJ/ni/6mrL62zs25u\nZTuWk7ng9yU1YXB9C2w6A/gGMWhekfu+xV+FL/JynC0F8oBsnv1fyOZC+LKD\nMnL/ZL5/1+3d96AEXB7BhYjS6Gdlum9bfur40HfzPecK0CsM9wNulxhwMDJs\n1gnW5T1hpRtYuodNC/Arq1YeSYB5xy85jlSYa9/muSEU6Ha73T2nMpN2XKXk\nUiq1NMSL8AiWU6/VZYwI7p4gWEynMeiHgYUAHWv0q5ehGwlYybLPLYn0/QbO\nwd50it2eMsLrYx4i8HzAu2WwWQ49T0pD/MrpEhlD9Ca7DlJabiY0WEXXhNSy\nsBRLBpiU49ip72zDedMdnagNIO5SeC/CE+bQ1g/SCHCsdcfQnERk52bWT6tf\nE+0gNT1TmUg72koQFw1SDVOjuuBkSdnz3eMOhtd7+/fs/CYGUmHTI+2RfUgs\nH4Yd5lBGflLSbGD49TU5wWsId4ibXvR1xFenl5SHyQKxEzZEnJrW5OxRL8SV\nPVKL\r\n=mbJi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoC5FbcELyu34zW9T0Kb+QbUx5pxTymi596vgkslS7/AIgMng0Ujob3dV7oVGyRwDOe5P7PAY1XZlYs2dBQ94Km3g="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2024_1600215214598_0.19205239412266284"},"_hasShrinkwrap":false},"2.0.0-nightly.2025":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2025","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"52f365668013a08b8afa03e549934a6137eb9c4d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2025","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-yML0bhsyCMR8gLc5/OAtA+8K4WFPZhUcz8vv2xnNUsq8/kSlmZrcK/5kQ4Z+swUQLDPZNeNUAQBXqvn/8Jr4JA==","shasum":"bb47a830e05d085243ff2a47437b8cc1f2db4e4f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2025.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYqo2CRA9TVsSAnZWagAAZtgP/A1aV7gK4y8HofZOsXPo\newMQvKtjzJ8EACHmXHTZhjbQ7K+AGPdY+2q8nQafXG9nXwNyPpgFS34PUz9u\nkuRhSNE+rZDdmIzxu6Y1AHAAVmv7CXnLkqtLU185tUn2rT4jFcNF2fO1hfQs\nu6wYPphx5cuBoFBZ4DeAi0FrNhKjsJ/DzdibDF7ykRvW5DYG5ozAoi6kUP8A\nYLI7NGYMTy5gBhgHIoc7GrmX34DOk+vn7MIQCdpsu7XP9rDd1BNiICmF9kkO\n+Wom3xc8ipOL96TRsfYBuFr2LrMIuwUP/8ns5gryRfx/imvVKGwX5C5eH3g2\nlpEwpWVk6c4+lXBecL4XNPNMN8IdyLqoqV3FHvBIgVKMKnxX8tWxPwjkcuYj\nQEqyi3KVCrwR2ebEEv+N7YL1QbVv5n6HJPMfzgnrOowAJRNzLWnHFFV5WiHA\nwHdGWUTd8t1gaYmB3UsdfdjcU2wTy8TmoiBdY7bNAD1YbWlrcBmWFibQd4MZ\n/Sw4Rnrgh5ZNtrAb3lvprgUMrxOs+ssVK5Vbs4X4KELxkJBLP185U2yNHOGr\n+JOCsHKzlvzFy3N8Tf66VSrg7YPi05pYJGZS3WzdoOGlghyTyrBi8pb4qEfU\nQcgNhfz9+eN7uA65ix425SRFGJ0MPpE7d3t8NMVt/gO87Fc7NzqFXt04VQUk\ny4vD\r\n=+v0T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHVkwssSnSBvXD8Vsaz5F2XQe6Hbo/FXRqjNNWLYvH9dAiB1B1yIuzsIDHahQdtwLTh03ePnmqIrlsqDGd+kbcv7TA=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2025_1600301621663_0.7088723125760574"},"_hasShrinkwrap":false},"2.0.0-nightly.2027":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2027","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f2429ad4d634e001865f851e2751388889d9d137","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2027","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-IVjaAKuRoi3VnF0J81qR0nQKlzr89M7a6RP+bSBWd90XBnAJLt11/XeR+3aiVb7+4P/zgEwrrXp2oxGQi4R+rA==","shasum":"071c1fe44dc98ab808bebaf470bf2262badfbbd2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2027.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfY/uuCRA9TVsSAnZWagAAAm8P/RfEJ1zvY2wRuVsYeOGG\nJF8b9nD6wn0xB3H5hLBeygX0vj3C+gq6OPtvwKh8BujUbtz0kgU5EcvWDDav\nLqabG+H5aqG1T7EN7T0gQ+4rwGmxSwWw4PaHVblP6ZiquqDqS3QKZFVLnzpP\nsM7AyXHiVdHIG1IjSu4OeS7j0MVkTTY3g8acnwAIR+GDs5jPBghLZlVCBbnb\nmz2Lp9iYl7SQzvfet3JvsPN0xNFsXnS0ABwHHZQnvJWrdrXOWP7CZsQb8MYI\nThve/5DSXK2eOiZV+Eum27V0IS5UAI32LaJ8SOIu6HMA9x+x61oINrYqeWXA\nNaq5DKDlS6DXc9j5iIsPsEi+fAjzfcv2NP8htOJtOVewqlnY6hYlG1jLYFyA\ndIO8toA07kjWHEozYj/9dVoA924lPcbNVYNV3iv7MlyE6LAG2d56LJ3QWEFM\nJi5dR91EWT/VL/ykYeWONEd+8gE0jCSGkE676sGc0gpwXXB8OgcF1UI+XFXO\ndnAk2ro7crlWy5YZAst3nndfAMKFZzzolKqRiM+3ZE/lXWeYglIvb7uhzcT4\n9tUrNou5RkUuJtlXgaT59x2MjjqLRXV3MJtf85tH+o9VlBZqoXPL8gPzEES/\nF3hzJNKBDr/LAXZMpTuKu/W6vQ1INi+h+iIyDvbUn1Mk4tAYpVWIKmVRqnuO\n8WOV\r\n=Ngxv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2qCrb621ZS3bP9wZrKhPi334O+thXmTpojdwle9dnZwIgZmdwpM0U0IYPzpKQnrtcSY3xo+MPXuOsIcuQSM445WY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2027_1600388014262_0.6181230912026938"},"_hasShrinkwrap":false},"2.0.0-nightly.2031":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2031","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"2e0f1afca926b14d03478f8445651edfecf555ee","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2031","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.20.2/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-7ZPjZDQy1WylM/8FFkg7avJVZIgXPRcJjdwK5rJk2KoKvgE7f485WjArPK48HY81WkDyudV1j48dndeASGaMfQ==","shasum":"da0e075f003eba9c3b16e88017bea8f08945eaba","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2031.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZU0dCRA9TVsSAnZWagAAMqYP/RC+H4vxwNy6mcS9kmDT\nUxz4f+GMzDh1AKsFrKVs/lwVtaOw6fM61l/fDE4WkdHFLORYGruYmKBrsYyg\nlyQSQT50zph0tfKiiErELyRhYurdh4TTgFsJPoBttc9yMDxdz9s+hWLcGxKG\n18mDezTIIEKi9zIcLrtsEyejr1+V5vsN815lG839gHhY7Y54t4pUSk/UFpZY\nmx1ZEVLzJCf/ubVh0PI4GocpMgPGrw+qRh9ECa+Xmh1XfpoSMvI3UI7Epdo8\n9mbQT3TO5Pu0KaazsjJSBZ3ZVWfBsBE0ZdC22lTztIwW+xoOk9I5ObdjJunT\ngEVwNH17jiSOaOAr+p0JkJ0zFmVXQSPqe7ZtXFHZRMOhmx78qBFlZviM0SUX\nB//ykZg9C33YgVK8Y12Y84nUhe1Yt7byurjh/ga+UbcNw1GFDK886a5Iv1Vv\nKOqrG6sv/qcaQVpjCw11UcB/U5GFc98YPoesae1umV/bd1zxB0PXzl6qmNcr\n/ML4Bg3RqhSlBs6yPSl56MYUEzhBQTaaoUBbhc7R0DeDc4BuZlCCDPMM/BXG\nKBMiGLthkILqZ6fYfmpArlYRcNwwmKqrqdytWey9aoHT16MRVluCsY/D9D2a\nj5p0fUqScl4ztboR4IFpcExw+RAh4S5OKYNkWmr+aevLBmgNpHZSVg9Zks9Y\n8G/L\r\n=pr6/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgmPvsHDpd5CBC/c5g3qXHdwtE77HSwCX2o+d+yko/yAIhAOyCrddKTMJiAjPcX5JLV93BHOxUQIJ4y/Nq6L0J219o"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2031_1600474396786_0.4278335034609053"},"_hasShrinkwrap":false},"2.0.0-nightly.2032":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2032","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"9120c257b94650ffaf44a3820f27bd1007cd83da","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2032","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-PADRUedMejaS1nfVsOVSq/cDctVc4+h6uEC5VtcA84Xw9UMWk+7lyBhtjX9jvWY9eiiKuuEpIuFbYHLf30fGkw==","shasum":"db29b37463581191afb952c19d5793e2c3905ca5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2032.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbTZPCRA9TVsSAnZWagAAUb4P/0VtXGIT6DiKZdOL/iVX\nRqAQ2o2YAfiFv70cGGMF77I+SgNKPr2sK0Q/QanNoixnp2E06kz+T2gNEMBZ\n/GZE3IaP3hhf6RQM+gYRScFRF2qD0R8Fw/C6tmH27sfqFTNj85YreudNuepy\nx6+/dxOp6bViqI15zP25o3iuUaYxvZWuclwznEwWViufeBJyJUZ/93riBeVi\n7EWV8sUFdz5iJbojg9H1cyz06e0dVrXb1zx4CC8GemXho+yjTjW0Tf4ghLTj\nRZbxnk1unebBiE1mnnNSN6zFcSHZzesceJdDmLEJc42DqpUiBvViMYOxEjsH\nCw6Ocb7YNQwjztDahjtvSdHF+tlRqNgE3zlCUe1F9wv0G/WtzGoTEJ2eL3oJ\nO5TnBoBVXtTjWokEiA7TVZETEASsMq1E3v2yXccaSo5kZyP58wosbQpGHeYQ\nSKPb1XUP9DZMF9zuuKbAF3Z3r+SYPKpH70EODrVlKMvMVXROHqqUmjfF28b8\n8EY6JTc0H9pDbqb0RSJiDsByZXmfJh7+AZ4EpMs0YRnus4+CUnLDvWhgaqYF\n67qU8eh5HS1zILtFzw6z2INVZw02G1CLcwr9Im9L20Wa5sPX3+yPNn9rcox2\n9S3vktDDXC/tE+aYJ8nRnt1cZbCGejxJIpemA5300xVnXjeNWhzn4PvUcsU/\nC0f6\r\n=hEeH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7Tu6m/+c+X4ezgI9sWApmCdWBgu0P9Bwuw0epp1p30gIhAN4HjPRkvTA7bjdDafeIq6AcYVkiV97uex9sdkRp568x"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2032_1600992847335_0.5584591408592781"},"_hasShrinkwrap":false},"2.0.0-nightly.2033":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2033","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"473e579b34ce786b268e18527fe82f3fb94f09e7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2033","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-cJnZ/kAbguziU0HKgwomMqVM8PloJY3m3b2sGFWOv2HjEVvMfIwCy+dmc7NtUG8kbrUYRA+TQc4WhNK7GmiN3Q==","shasum":"d4d9aa52889a18d4ae03fab29d9295b090402cb8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2033.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfboe/CRA9TVsSAnZWagAAl6QQAIRJA4GmHJa/B5aCNfvt\n7zPdLgZoJ7b+Je6CBh57olRvdT0ykdALGXoOBePXvzYbqzvfdDQloJQ20UKz\n6wBFLZgxB6ppvh7ZpNirNTfEtG6HNH2jrhkXtOJFnBD+NKQO2TSnCeflYOCw\nexX/7Is0idOaDirVkxYukL0W3vtjPudg9nh0r2WeO2924HozoG0Z6l9kPIXn\n0CBKYBCqTZ9PZk9agdDlQEU+1j/oOrY+RixEgDmcBTn6BlbjKEeKUyPhUP/Z\n9jemdolmbaU6i3sK7mTnXC+OpppxGTrLm8bVg+/eL4DdgEF3ievPGA3kLs23\n11ggUGUtQDN4xtHjqotBaOOhsuvGeM2hTK00ZIHJSVj/ceW6igCXk9D4YA1s\nNWiosHKXfPIBn+X0xBb4qbJ8aj1Eyp146fPI52/7fyRbKT9zZ9iQmtB+jBEn\nMUX20mgAjsAZCdGEy4NfbIT4jasDnZdrqpq3NdApNx9qDjWBwW9xOCqhiyDh\nSEpS5OZps5D/DABadORdj703ZU6ac+yA3U2DXbPPBNxRMCEPbZlzwvUokyaz\nAvFfSPgn2QAKnl5fyCMBfRJJQYHFWK46Hhj45G42CJ29ZFK/0kY6I8w96LA/\nSuGeeCso0uXyXAnToITsH7Dk9x1eFNb/82Ssq4FJV40LQw+AP/vMa4qvayIo\nnGC2\r\n=FCxL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCG/Of8MIqNIq7urCtx6oPZ7tqTbdDTuN8mNIJ03eqRwQIhAIp/Dqo2EgHCZtJTs9blBRx8o4Z22On2WGn4I/GpOpVr"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2033_1601079230522_0.9836532584418742"},"_hasShrinkwrap":false},"2.0.0-nightly.2034":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2034","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b2da8a221b9289b626cbef2742894101ca620677","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2034","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-s11m5+ISaHt4ZelyKNp0oPXNTpEsLOAA94iGyDA1vIKU2UbwEy5dimvIHSHrrfFwgL7vIhBMBy35ZFxvmsrD7w==","shasum":"c9fa20d6742f7bafa4cbcc6da853b8aa231ed377","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2034.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcSrfCRA9TVsSAnZWagAAyc4P/14TgajvPSZB78C4kVqJ\nyPR354+YSKPehGrqCCHdbkqDWGAa88TSO8DTeuWzCVuW46XPJtcamDAo3IcU\nq0ZW6ymAgwxeLo+VWHxl4tJgufKO7Lzu/cWqajGhKqB/jgUA6sFsaaCAKJd/\nlqOCoI48RZ0RSQVIrMJlHGuGZso6KewKkk2h05WyHwaG8MYoW/R3X57kw1wo\nvX0OKB+nfe1fXFKds1B+Jh0yTzLO+A08Y/EStYO9jPEKl3I4+UwOxfDqxXlh\nhuOWvZTBrrny8VrCXkcBlGx1hJ0VKKm7ShAU/yzMkI+/bVeJ0MFbt0apOQvf\n3MWiFgOdLx7nYzO7/4IYA/srAtU3Yjov7ZlH0vCU97Z737sl8B7KlOxzRdSx\niKA2RsxM1xLsNQ2noGuuIV/X3jFU975yNUfr2nF5+U5Xy14jPZiaZmxoJbux\njLeM2XZZ2UwQHYYGkmQEqbsP3nYY3lybY8veZ4F74xRN8+ipIjoOMVH23Vuf\n+wYAiw6k3UKlLjt3O8UxSlbUFGHoky4vxsvei61DyJAktwJtXh9eSFVR0vD/\n/szseiWl9qQe7mZhozruYR/6edsnrQlObyGiY7y0nS4LYV2Q7q+BG+kQUy6m\n9G1EwqVtfMX4rrPWCQ/o4ruU646h05JEzoS8tlnO4TiQBJluGGcCwKe/63Vu\nWhYf\r\n=2fa+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEfv6HeG4/xUsYN2eOFw9G+FkKOv1ninqV15vGlkVieXAiB/sr6KEwAc1PxXw5bGaElPpJorO4nOA27AJKvkn9Ew+A=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2034_1601252062988_0.11276349151022202"},"_hasShrinkwrap":false},"2.0.0-nightly.2035":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2035","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e1e1d8ab39ecc6eb2b79db7783592ef85002a34c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2035","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-XLJIbrHMrkZT/wFewHNQPHRaC/jD4rhv5iXPTbecqa/TG/kSgp9DhxGm3PGd8+GRhfmNrLZwjQ0FaNXcJizkBA==","shasum":"0661d961a3828b9ed0255304339eb0a36a3ab9fe","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2035.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfc83lCRA9TVsSAnZWagAA0mcP/00JJErf9dR45xmWLaAU\nF8WdxVzxmA8qly6aLfAak/VGs5Sz4SjPSjrbW7//bU3BHbsRXdZFBgLhEYwb\nfzfJi8efRX77xFu16C05XrUOhHjmxd/nf+YL0QiHbrS/B/NwBazbEL7+2HnT\nMSVb2IrFjsewWw+dvg40hAPkB55mF5NC7aOfbKne0oLwk0GlswfHXfhAZ+dM\n3vxFzy4jB5ryxh3g1zts7p9dHbWKlyoXMmBHFeT3qb3jsCAkxpUUA4KTqOAV\nfCSljWjpoFYaF/OzOTihUApJE8Zo+APvHprumkDM1DV1vXMSql9hrJ4oO22i\nlAf06WMAd1q5xxs6SHnzKvkY0AIN8+4vYpDNnQJ4A1qV/rAuXpklBcHeI+DM\n9MKaINkYdK2AMSipNcqCCR5LgU8ja0URPBFmIb/g3fOaTqFjiVlxPDNlc86Y\nRf60bngo1O90lkVbX6O8dc3nPlJzWQX457iQUlt3Eh92gfqvGGSoR3eWvyXA\nBczjTxxCtO7OI5+nK9oMjXLIElSi+tf9QZ6dmESzlfwb9A8BFloPddnNuojo\n8cT8iu/2P32onxGXl3HMLQPWw/0ZdDSPAylPe4Wf9gN4kLpcF08TX5XRyR/i\ng2jTAGWomJO2RDMlCLKTLOsEydRV1ynaNYM/SqlS6Pa8O09gesxXB8NIM2+w\nmsCr\r\n=tKbO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHkq+tGyjNuJVTmky3aNOmCCxcBHxcoribksAFq4iFiNAiAMazk/rAe2DHaZwiztRxENQZVaqKHYMU/AjkymyIXbrg=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2035_1601424869165_0.4941265028655948"},"_hasShrinkwrap":false},"2.0.0-nightly.2037":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2037","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"b5f4d1c9d952e0513545f863a04dcff6640ea2e8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2037","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-geOhC6t3L9FAXAvyIBAeGi1V4Sof4gIkwTilzUozUAHWMeMp3KUkN9h/n1VEj4UZaQrzlytwKj8Qmrpgy3nxGQ==","shasum":"1fb6c8436eb99071a4b96645aae26eb1b76846d8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2037.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfdR9xCRA9TVsSAnZWagAArqsP/1bl5CcjbdjsqCU8koZd\nspMMCciLtViXxaHwvB41NyXpz4/Svc+7ct0uQJKR+EWICGIrgCMLEJlkYtnz\n6nQwxQRAE1dLDRNyxnQxm+gek/FwNHj6TXoxkKRyxmFSIFBe339eppxkNn4/\nKH5JmQG74xLPouvp3vVndKV8NtmArT/FhJXEi1mipJPMP2CmhZ0Unup3rQUM\ngr31pGwldyYa5ehi2ZeFk2KEbqT++fQFLzeACqKZgUEcg+WLNjYiO8tw/x/9\n/Hnt60PYeJai55/IpSvkrKtQ9nCx7FJEEBAfyr9JIIRiltSad9E8gcxYr907\nClDVLDjgXQ9TztLvdSQnv7j2ieScEI8Uq6SUkFl289m5Vp4Qpt9DXxzZwWp4\nZH/T2qunaSYAhW/FzV//gCbx9c7Dk3NLj5DR583lvfXcikWiv116iwlE1NVX\nj9ZHUW0DiaQlSIapcP5wHKthRJfAwDClIqU5eoMuoyGK4p9Z0EPtYX8RNfqR\n+eiNanuS5LdiQo62fmq2PdcIbGV+6j1UB1sd/ogEe2GNrC/1p2Zi/HoF1s1O\n4GtN/RQaD0VtFz/ucMMiGDPInpAeWWzJfCCl021Fh+fvL5ISK4SpcXe0F8Dz\noncZWc4hDp8ZEr4Cis7i2kkaPq+Tt4NiAm+VYYuVioe569NMUfoi4m8DwpaW\nZ+oy\r\n=g58W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsvRUDjEsrA0fcm/LtgPaOJ5r7+DiGoZClAH6moujUSAiBzbuV06HlxEZJ/LcqFFG9gIHQrRMn0ja4WXxjsISr3dQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2037_1601511281231_0.555343602930708"},"_hasShrinkwrap":false},"2.0.0-nightly.2038":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2038","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"411dcea4147a361909598bdcdbbe30e00c643df0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2038","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-P+H0GYEbv3XE2Gw+9kQfP1g0xg6C4UolzRaW2IgVbi2lNxYXoqEbFzNe9pZmhVXQOFxAVWj7zIWyrC5FWprfRQ==","shasum":"91546a4125bf19a0155969650605d6529a8b5217","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2038.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfdnCyCRA9TVsSAnZWagAAWsoP/3c56IMXTdzwKGjGMGVq\nW4YgujAWxggbjgmVBRjAhFqXdf8yhBuAVzizTNQL/jngKAmBBqh1c7UaC8tm\n/3VN/XGeezTLkl0wXkm1wyD+TExQbVnFk0BGcvZSNvIkg+3h66hi6G4xC4JF\n6qssbA6VweqCGUcIHSivCcS8hsJ1rNvW9BAtLqjQglbH/UblsixVeguD8x9u\nnNFpZAhHYxv50D2kQVDIfkjvepq9yDiZtTrZ8da0OmPrrrjnngDEvvDiigW0\nrI/2zHaEI08RnY2cnR8lK/3f+xST5dxYnIm1eQmqHpIllYnEPMR+1o1MK5Ey\nVYBqGBYMf08vOw4WO6f37IlNxvfmS4ri/f3eW8yBjivR8uyT2ZmZSgUQGsNO\n9oGKZh9ZIXnnavPnpAp9oddCWXe6Vp8/n5u2vF9bkVEIOE3PR0iM0BJrv6G8\n81JDKFS7jJfCcksoqNU5GbAoDWnAEjFlWzTCNRNnZFeXJaAXcD9HW/1x4s9K\nQzatNjh5Yi9ucHuty1JuPWUOPa89NNKHwvbE08I7tNaBV8MRTGKNh2Jvup6s\ncNI5eCQBIHL0kCixBVy3HG7hkBRQGdKbpdVKeR2BPog4yJc3vU1ZKVxC/vCP\nCSYzvbAPJbvh2qXN90unhobqw0Ddm4e0JvN+p9sEV6Y33VXF0+5tRbxmqxAs\nF7ZJ\r\n=GVC8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnkA8XLZlQ0x7Ay5yVtyuNibqwDKpwID2NXjSPkToLrQIhAJ5P5/Pulmg7IuYZQOAeykxzrFOlZrhY8l+mEm/ScxZN"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2038_1601597617755_0.915750634163943"},"_hasShrinkwrap":false},"2.0.0-nightly.2039":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2039","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a839a03f93607c1744ce62e6f95f98d0635700f4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2039","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-2QLpSIJEXXct/yv/qhwSq/ryaSowUs6Wx0BXUxREiMCOVxhvBRvpHyPfL8d7MVeGAqDHWCIpJ0PJZ9jP5pOsWg==","shasum":"1e6cbde697900288c486e9d01f91ce6bbca050fc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2039.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfd8Y4CRA9TVsSAnZWagAAK7oP/0rMNkEXXkmW1uvLWI6C\nflw2wgnCDkZhqwH91Sc4erE+fohmkgHHuw1sQdpfX5R3HFszp3MCUpvLPoB9\nj1zVqOZa5wLC2BXFL7yFgWDTdddwkCdK+P2u6Nz8aX9v2xk0VVm8rsg0dmHF\nh93YzDlVj53AIVJy2Yw8FeZORFASXYo6IWbG7GbTSu02TfFF+4R91DRE09BD\n2QEsyVRvDCqBT7e6/R4GBS4s0AfNcTU39J7xYBsbDKloe2pqHJU87MkGAyaF\nZyRKFwcZX3WWaFYB87MBIlS6ibJxQdCtxZXqS78Iv0WPDABj/Fxs4DUslJdO\nUVgjyxpRVw5UY4Q7GxmJAEkqlQ9Je1fiGfqCjCf6JF1i64WQy8rwWao9iQ5T\nxsIG8x53sLYOmWgSzIS9vc9xXfGUd5Smi7Q/znuD2Kn4p+3aEe75UNzrKd/B\nEISMaCkq2rOSJ+053WYAdbLE/67Y0uxMoLee+FzkhIxS8F7lbtNeUw467MCB\nxibhLuR2dypdHW1SYM+HXI8VfakhYralI9nX7Tr5X57k2TWvTJuqKYErusGY\nyMcxIgOeSPFzCSwRwrXxUB4zI+LkAExZEuCXmy8dwjuWj1CAC/xzvxfUkcBB\nyYIlD6t5GGfL19PNjR3ZHpkbAsVAEBxYpN3WxiWtpCg07Gvct+SJ8ZlfrIUL\nid6g\r\n=lc8o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiNs7tAbaSElh1pvXrlBA4ADM7HXaFVJyIC6Bc8pQ/awIgDGqb/LtY+mCbMtqwkif+ytIjreegl4CtwJfqGAISIkA="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2039_1601685048312_0.07887274407566247"},"_hasShrinkwrap":false},"2.0.0-nightly.2040":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2040","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"7717e2547f510c89ea57bbfec62147bfb912ba49","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2040","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-Hz/I/b//xNXknmYHfJfTDwPcBDWQgzV0XvV6wQr5vNMPL9/NE9VDHJ/WUEx0WdCc7NL5VLYZhrBuPbVNnUG17g==","shasum":"2a7af1ae22b01d691e2d57ef9da2372d6fbbb037","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2040.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfemV7CRA9TVsSAnZWagAAAPAP/A65852yIR3GFJFFjNXS\nOc2fBErIC3vLt62MilmcO1R5HfTiJoVyIN0gMeUYQJOTxlmVJca2Laa8cK8X\niMtn3HvN5iL7tmdFuQT1ydExDeJaC6cc/MY4jxgKjXqplLeXkMVS5PMaY0kk\nsNC3vBBHyHljAauWum8FTkRRVsXQfwHwL0TkpII3p5S5tG131hQmnlkPknU2\nICgh5r/DP3/QW2ce2AFghoPL030v+JVGbIsbyHmLcU97BJbndIKl/TrLly4b\nxRUXdY6s00MkqAMJWFQ5mComWLDcIf8bwINQ2z0ooF8cnuL7anZQKglDUs1S\nuQuIDdhcL+06Q5aqQzBcSpw1ZpP/b8FD/4qjICe5R5iqDKwVbEzP8RqZ+9mS\neNl40Un9W3hF8ZbvK9BWbusIeeJvUDnedfeR3ySgvfLGN2O9tPVBMCtRBHjo\nOdpZXFl52lTD6dNHGmlqUNK5fQBgPk/xQ0mHsolcvkGM3Ef6QNW14vm/E0FZ\npTcSTMTz/xdt/Zd+MQceVFgz/5do+6eNIeQhPPmxMgaEV/bKz1OSQft77hO2\ne42WZTzLQ6tM5/4nvw6J+3YrrXd2kttxqqft+6Q0ExMTlRwywdli91qJIia8\n4DOmDtv+0hNEo0d5gP5ZmSb8Qv9FChwB3QBPQNO1qaunwRYfojSPEYMDSzNp\nabJ5\r\n=I8Nt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCd9amY5Su3O5sefCCi1BCEtU/W135N5bSEQE+75GMt9gIhANA0VEU1cVSKFcGxy4D5obgDC6xd8F/EtEmrs8vcSN/w"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2040_1601856891316_0.24305652557245216"},"_hasShrinkwrap":false},"2.0.0-nightly.2043":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2043","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8e72ac50b9c8f69e51b062c824681a4bf131ce1e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2043","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-6gBPlMjazeMRoZ6C/4DaBsgeJHo6XxisxJg1hDe1mx1PbDxHkD34CG/s8t3Dl3HnCEl0Ygm+W4Vf99njLGvBaw==","shasum":"e624d90e09a75e9db9ca98169cc8607e408c345d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2043.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJffQiMCRA9TVsSAnZWagAAJ0gP/1ctYAso1kYctW83CKPp\n+250qtgBQ0qOKyp6NC8Kjg6K6nO/UwyI9avkgGMCvtxl0iOfx4H95J3ef5Ok\n2g3kzwpc8FVsfPthhVXeJ67embIHNMnUku/2tTCR83STt+AG6GvhRnr884K4\npAAGC6ttXnWlT8Y69K3RDYr5Z1rFy/3CNZs81GHhQ0BEy5yj4hDoaK8ENHYH\nLdHcmH21NRaruS9KK1xjjuXU2S9wD5mK6Pa8tVBw9JuTObcITchTWyRq/hy4\nKoXCYx6lE2x69sCBb+7zwG1YVe2CC9j/2exG/y67drV6R1Bp7F3OvkjdYuXP\nJkGz8Lhf0Fqc9BO/UEvLTEZ3OK6xB7qhfdkmM3Gu3PEXGHFhRA/wY5zCGEqR\nWUBAi00twr1mFiBM3iiqrWc1w1teKWr7OGozbV3KEox8XEqLYsVdMubw5nHx\nqsU5ELT6ZhAcRdItJOnZGyN/BYDXUt1RrxKzpBdVx+9x92YGgQP0uQ3yIQNs\n+v60PzoEyPUMNuh49fBBfB8o0/tyaIxfrZAP/gFWJqaR5B2vsR9PwyfvfWg2\nxmqglgYDu9OHF8pXl3z6ZWWCeRpqiGs7OXG7pY7Ru+qUIbmcHyjU3BRdPLt2\nbMb1sVSMOf6Uy/ZpZAgLpE+Ash0Zs6xN2AKwnghSO3TSQNxi85UpUtghU7Qo\nM9EB\r\n=P79e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWg33j6pTnj0q1YS/Rwvg9rhr3GxuVNk4OBZU1bh3MegIhAM0VKUvAOoGhd3bVmvdUcTaADiI9PL958D3+XKUFfCNU"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2043_1602029708273_0.5212631455302401"},"_hasShrinkwrap":false},"2.0.0-nightly.2044":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2044","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"eed8bf1bfafc8e48efb770056053dffb5833bc11","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2044","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-88Da+2KzlNl10QjsT2FN5K7qCQYS7M/wzM0juNG+qNnFn5VBUBjEfRE2tfVbyoZv82TUQbR87Bxzfea6ztG+zg==","shasum":"0071c6109ff160ed3039ec6cdb8bea8d4949f6fb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2044.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJffll0CRA9TVsSAnZWagAAv2sQAISbCsCSfE4oisByr4LE\npqpXsPsbjtZd2GQXDKkNbc2Z3ZjUejPIDHcqlHirNorU9JU4hzqXqlb+ERrV\nHqzE7FiGEUwXNmlMP2u7O+51GYh/MaQgjg4Aa14Wysajs2XRYbPE317zlZiM\nVwEeIHbcPyBaR7O38hbb0QaJ9g0lLU0uo0mLrJ7p3qAgtcodmF98BkqlQz1l\nF97h2RaJeS3jvVh/6wf6QUoPLfBbVX4dbAe+flXqLYyQy/L6QfIX9cJCzNGz\nD7YsSBOmEL2fMD6GP2cPIJWAV5xn5mw2PmiqVs8U9NXFKIBF620CRNydKB9r\nJEozFBKfseC+uAUCZs+xAscRAPTwYcFoRohF/Z4fJquFH4zcq1MZVbJ1xctA\nsy+mF+YaG/gThd76V1nKDRcncVS55QL08gWss2ySTV0TgwYsNnNwKUIFUarR\nFE7KMpIO6PhxRvB5AF/nOa0s8c3IOKAv7a/E+2CWNtydEiCs/v+q9E0yunGx\nd/kJp/MC61Waf2JqrtCvy6AjuAD09D7e2RT/XHhB6aTlU7Hxz/EwM+mTzGFK\nIuR3xhnyyLnBer5sSgpiZPLFJdDZdf7rcDRkCXTZOT9sy87KvYi7T0l982U/\n/gi6/go4XdoWXZdGkNJpOk/vZzxegu9uRlJqRRyjnpiLenCmg6gDE+dJSA7/\nPNgX\r\n=WGTe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE/pLXH0XbvGwN95cZG2q1JZVnnG3IzJqbISukl1QfqXAiEAzO6La5ikx3vV+cll4U3nApDTpl2QhCJAA9M6ULs6bx8="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2044_1602115956206_0.8692616323464288"},"_hasShrinkwrap":false},"2.0.0-nightly.2048":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2048","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"014168aded80ecb49b8f653f41d1ae2738e56a89","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2048","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-IkjO5SgpXhhNsYCCTxqZEv8kvtnAL+zWyF+sUBR7rUCGF0guDJyPefOuNl69Qw6z/yxoEURVrnAd7p9Ehn+uvw==","shasum":"8440f53cc499d66223194112bce5bbc8eea72b51","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2048.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhPHLCRA9TVsSAnZWagAA8IMP/iScdslqBo0ax3jVI7Re\nFbUmbqIrxgYMP7yFhdRAhiPph4cdbDDi71t3628WqolvlqGMVyXThPf2E/kZ\nlrx8mR7/4SViCADG1ANzUfTGzbpkKVbkTkjtsTTAEekVcvZ5qbFe6lLLBRY0\nAW/gfPrbMcvqAhObqaB4chYaoX6cxF2yFwqMv4HTxElhpAQ7XRCX2TvpK1O0\nJ/ZqbCqL5+K8mV0KM3TBUUuiH4TUbu2UYggpBaixxxjo5wSnArPydlUuk/yu\n5sT0gLOQHYQiPDmnIO1icBqkwxMbaph5F6wosqcGucfYBXZh0SWBNPIhnMaq\n774j8QfyJ/3VmtfeQ+eh7P4u7LyN/6f5AQu9IYk9owYqGGgInNBvneP8hO4p\n1aTHWVe/1mKHdebwnBOy5rr76HcHpceYBE8lcTrrzmBlcOF408VgdzMIh/6F\na9uURZAIGHOBjq9p8geDe4JcJWmbbnMbn2qdb6zfHHBZ+8tqxCSIIli374YW\nzqseL+9o/cIk1xQVjxmbF4Quj9mGldtObyfCeIb9f17xC8cbMKmB3RSIB3xw\nZHdc/5/NHFecO1Hd3HcFMSlOCdRGhHIp1K4GM6VU490pABzFumSyOQIzjeid\nyngK3i1rEUHFUiXhOdxUhrCaDr7l+G1gLP3Srvq67bkLi3K2kvXzeR6T3AzQ\ncV+i\r\n=Uage\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHuXiN+3uVLq5a99ar8oIuoGQnjn2Uz5asDagrK35FooAiEAtVrHeTIIL8quSR6x8fdPIqKYl4GrhZTEpah/4j6Srrg="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2048_1602548171185_0.4608105920474801"},"_hasShrinkwrap":false},"2.0.0-nightly.2049":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2049","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"069a2b1d773cb9fe02d621c2a281ecb47b5bf668","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2049","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.20.2/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-DyS5VQ7kHUy3YBh1yPQzh1z8lbb6/H++g69CbXNQ8wZHTymvJLHZcw8IH3fkplPgjViO72hTF+j7bM9M/EeK5w==","shasum":"2bb30222232367d610095e56e6091cecd0a3fe82","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2049.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhkMRCRA9TVsSAnZWagAArpoP/2W+4XiUvmd1N5pHr9/6\nrwxY7t7Sq25dFO5LaeiEKO+/pmHYrVjHnZ4qZQayFcGFyFCnSjtmiN3rKpM0\n/lU/d2bzZrZ8yi9N7Tp9xPm7UE5vnsqhISQvmTRLj4UddymHlcSpf67aBaeQ\n3hhAlROi1m0UUAFlmZQmBUTMlk9NqJepVKImzB6NWGUTeV9f1ot1lyX5uPHE\noOjv+CquRIPy92+rLWvHHHPuttGbfGbLewWhEUJhgOmbfYPJyiIgiwoomP3x\noIoyAOr9iqaah3ssqAwisEA9m1z+5UFG4fw5xjZ9+fBILPKxFvq5rYv2DB+J\nuLpci0IGO7cgMX7rOveHzI8zPJX8WS1c7wpGJ5eLfPKohEJaagg7B/eUeJKM\nrRs7VIl1RPmNAWLEUScUz6qn3Qgip69TCXjoPLNCu8ijoLoPFrGqhvsVz0N5\nAEP3dxsuinlk1du/1CEZQgp3LrWUAceqzjAbOWhwGoDVf05WrB/ceOUDljr6\nrZSAL+3jqd5VXDwjNRKCGznVisj04w3Slw6R5bg20nSFNVoCTLFP8HinEByn\nxCqMOBZfcLncVTgSp8zQAkiZ2CgJelBR0ULxs5n8nmfwJhADh5QfXVu0Pj9z\nCaJrR55h0kf1lmYW6oi3iqvzK8VB2FXzMrucZ1Xkn9Xjz+Cd7kIV4wT/2pfm\n0J+m\r\n=ut14\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEsJgtjpHIauwzMlO+mYRUuDZ9NXOAJx/5srU38iZeGhAiASE6iuuvz/UIv5rQcPDGOwIa7ewjjgsOd41xioUb7uuQ=="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2049_1602634512659_0.09403109969962564"},"_hasShrinkwrap":false},"2.0.0-nightly.2050":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2050","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5f72d6bb93ad45466bfd86cbf1315178990e6705","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2050","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-s+boLOs106tl740NFcL3Jx+YRHII8+X4a4CBo+jeDXURTbTamYvfaEagM9qiAhPgRG7+oxPzPvmU//pPGfOKPg==","shasum":"dc353a5d5d19de40c7c389be9e1670dd32dd5b2e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2050.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfji1XCRA9TVsSAnZWagAAHjEP/2BBXkilAsIN96yN7436\nmQyOtcmjqMTIEWBLrEXxbXI6JfaiIKUTgdsIPbi4Es78El2EYq76EEU3RCzi\nuJ20CSXx2MgQNULKcvt73OG9psGwzWK85UY43ov4hE8jeIZTeA0FkXimWIv/\npXQjok4Yg7wcoErzf15tzhm2eg/Lw/bU2z0xs2mswqfaS5wEv8u+bLwvRJfF\nENU8nOi4Zm31jVMkDTO8Wv7t93s8lSTk31rIvX37Ht4dw8kLH8YuTFpiB+7d\nGbemQEtenJGZDk0aPIkRa3yLmQFHjAyRO9WD4izn0EU34HmY9cJT8vU0NB0P\ntr6WvCqz3du3HBr4GBT89HVpN402xrReYG7Dd1JM/jnBVk1/mi+WXunAdBa+\nKenZUxhLdixmuDM8n+ZqjfxTEvFqRF4upRte9VmUaYHXkuTTUIuCOFrRVlsz\npqgxzFSxH8FFzvjpZuacmToC24VpbVMEhuK52Vu3xmRvyS29Qg8yx4tWnFyO\nVUsre57jPFtbz/z5h2PHK5oe9umq+Um9VOj6vwt6feQzTzY/EpxfDc9CuhaJ\nTf88DmX7sYImmI3qJagy3hKXzXz5EZTtSyDz7K6WshjkqDapqAxXa2hhbHuv\nlq0FU/gVkaqXgIaJ+l0vjaQ6seH1lMvy54f7ljPvkI/qK9tX4qrF1Ii8sxnH\nGfZX\r\n=zZEq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMrPMas/TsE6Fw4zjg7ww4o7CL0K0R18kuQM340JJjyQIhAJF30csAN0DiIB1mh1ITzQY3KLH92I0VTh6Btc70zZk3"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2050_1603153238954_0.1911178325829257"},"_hasShrinkwrap":false},"2.0.0-nightly.2051":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2051","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"c70ca0c643511e072cd413f07e9840761abfd2a9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2051","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-9RpI+1MuSqNKhSfS2TcSVQjbBtoSGPc5GjUq9lz+o1B7H1N0o7vueTocPegzal8Nsy8kNmVdLjuqmD7RwziNzw==","shasum":"0079bc7f3a33a2f86dae408d0caf1677b50c242b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2051.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfj33MCRA9TVsSAnZWagAA3JcP/RDL+pAy0ES2/dOCwxMV\nkEAqK6EtVLsrihLlV5YxBZeX0G0zgyQSoGX4V2W8X0tqYdgU12ZQDhRzku62\nzljaiMIgNkZeRrFA6h0OUI0vP8hySyl0ykbnpq9PPFcOE649QMevI1kzUj6C\n2a5ZKixNSgFZWzpNKq/oeLdYa2d34fh8c5BkUnzPUxmfMKISfBoRLomfyPwB\nftlcqk12RGcSkCW821/cJ0KVScPYRxmUk5HfZJ7g3EgO4hZejQwK7YCy/jPQ\nxeqmhiqG3+X+N+fJSS28ddcwjGx61MAOzjOL4CHPiZJLn1TxSPEQxx5ZquoQ\n4uQiaq2AFAevkquSUFNVkD6eA4QuSNVCagQa4jL9z+J/Df+S4DB3nDaQRe2o\n3nMgyPj+h20XRw02XmYfV+4+HvXIw5gxgvi7IxYiUV7gk5pwE4KtGWhsso95\nPa0yVaeylV9EAuS7yyc3EkbEy0mn/qSI3CyOZ++2DugION6NyoUpnsMxrQoc\noPQMjBdRjCLsZLhNDKqxdTpfkWV6L6KPQUutLe84d8ISZNwLIXolwgtwTYFK\nfaGHQuhzAfWNbcC+qpQo1HaFY3f/MbA4DAxmaOi3+aB9+dwaSXe7tJqb3mCL\nFZYS08/LuQvP/7ILrk/Z07x9eTDxw0VE5Ew5LPiDJyuBe7YHHsojnR4Banft\nTA7p\r\n=XZE3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH4zDTiPq5vsLQ6EJ7qAZA8kkmi3wmMDWlkMggZcCEltAiEA8Xt4HFuodSFB04CJu9Jcv37fmHUesvA/7zRhwqTBSjo="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2051_1603239371703_0.9973744844745627"},"_hasShrinkwrap":false},"2.0.0-nightly.2052":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2052","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"951ad062e285be5b1201ba8065d011c67fb7f4a4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2052","_nodeVersion":"12.16.2","_npmVersion":"lerna/3.20.2/node@v12.16.2+x64 (darwin)","dist":{"integrity":"sha512-EwUrI/kf9lJcVogr2zQio5Q967HZ6hwxUexgfPk20Y4P7CGWpItx0lMxto4TtA3YZ5AkIJ7yfYRbojzDevx31g==","shasum":"9da161778083f7d3cf1a57aff127f6e5b9fe17e7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2052.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkJhUCRA9TVsSAnZWagAA8S0P/3LO+4FO827t2lRBIrzO\nICrU2AOCLQHUg3yfZ5TxxA7VtY6W0QG89RC2uPSas4Ox2Jz+elJ/7ppOYTlA\nlfVysOCg909KG+B8381BJTTA+z59jbkKYtx9dVx7mPdn6quYISOhlB1WIQTb\n/KIX3ljkldBhWeCTSvq4uX7xHwZ3EXmKyQyc1tVM+c2EFMaxshWV6XwMB/pz\nfXXdeXCTD+pxYxD8DbBxMEtgoNxFRK8fMo5dokIP/9ruBtSCSOlUEmVI34kY\nWaMp0gp0rNZu/jUlgH3+V4UGyiWKIgFSKmx/KSmxKD61bUG8ow6Mvwtoinn4\nCv6q1eLPGj8jVEqAhCkTjFHPVD7mSDlixeqVFcqvYsOoSX4iusFRiyJGC5DV\neXjLLHtkRSVyDqxMj9EnGw5cFDBFu7oUT1EkK8M2zmcxgZRIrAVdI999vosq\n0A88y14G2S3jt2RGUUAoe0NOsSJ5c9QozmER/gMsklmjrTrmPQa//mSjL+cS\ncRi4r7kU7B+XhjpkJch599x3dxEdaGH0KUwe/ZTc4YYlEjau04hZc6KGjn63\nM3jfmWR6+FHvtsdToMiideFOWA/ykQmgVLRjzHBx0WYUrR6coyONEJKkIs83\nbr9GhkfBYrEdOccum9LAIjb3SdSXGdlJdNYUl0rkQcAOLcWlwJWv8tVRtx+g\nLdva\r\n=u/Gf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAWNGRsKb4+Qev4HZ+lhsBXGMsQw4Qg6FELdhlYszSouAiEAsv3AUHs2iEkMjvFaeY6jB+gDB4/KZ/Ak1PZuQ+ybS4A="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2052_1603311699610_0.5824160424676246"},"_hasShrinkwrap":false},"2.0.0-nightly.2053":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2053","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"296bc57f63c581d38bbda27ed9ebb895a67127e2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2053","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-YFTNMGwbQl2DEwqrPCPejPPdhq6HOBj38Eui9N3HeSg1Az5nYsXp6h+w2s7jPXv6Zj4yY97qGtGWRVe60hflLg==","shasum":"6f26b502af1ee45a64029037100538c9cf96b5e9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2053.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkM+LCRA9TVsSAnZWagAAcj0P/0Bjz108SW1ZxKFiXdpE\nSajWdseKgg7IQFqj1Xxv2rso0u9B8XgP0Ip2sF1fY3uzycf+FMtrSIFeSXHA\niAyGk7A0LNKJxir88dDhMv7aBdC2PvPC8Jp+SvhafaqaBGBjMiiONAgwEPi9\nXp2REH4u2DNJsZXEUdIQbnQyM8RUhsXPyapjY46MdOnRGLIYVXnjXhoSjztT\ndyCfyXiv8A9HP5KMQo6aMTQhR+vGT/R8f5s/hbVqzeBfuKWAiQsqQeLFRl/H\nuWI9uiPWcPg2bL7j8mbBfxB4j85MMrNUamh8zRIr6HRThQNh0pzorCRSKMq+\nNht6wBsxdRgexk5GUfvZpcVLX3zeu4zo+lX/oFZFRNomvW6/bkilyzcPJg2S\nI4yaLDW9cf2O5b128zEPK4s0QF4ELJwtzoeWj9IDHWn9euboT2LlhactW7bj\nphrtaUH6+13xxjSkpYfvPNin4n4tEDGge0iYVc55hrza6nk2qE5eFOLqUBXO\nDM7x/f7Su+I1x4dY8YPw7EOOm87Am0Sx20yKohUzCtvy5ca+rSJKIBdOGeNK\nFlkT30kVprRjdZ+7xUGD0W1o3qaK5Z4nXlDt1uwkVfr3Wr9aYBDphOf20L4U\nTy4tiqCg8jWbqn488Cl8vR9G+h3Z/LdIibiL7aXB/gCjVkLIEjfSTSkWA5HO\n3Iq0\r\n=myeO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB1xo4+BJOH0pprcBt5Bzt8/AHKU52vMYMJigeeG6Ya3AiEAgg4KSdwthoeEbwNSvtlz3nXS3o/BcOb7KZsgi2IeOS4="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2053_1603325835432_0.3132672453518168"},"_hasShrinkwrap":false},"2.0.0-nightly.2054":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2054","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"dc70ba156392a5eb8f51eea80adeb23d47b11f87","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2054","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-6AFM0qdOutlPObDwpjDeBNs4WRmsDSNu1+oqwtVKY5RCsFoyOjYkIL9C7+rETmW6Hz0hlZWjHWStjqsfw7Y5oQ==","shasum":"099abb5499ef54cd9c0e94426d29d1d090d160f7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2054.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflMPuCRA9TVsSAnZWagAAdD8QAIAuUKYcGwcu2NmSK86W\nulLANOXuDLaZIjMjxSjB9bwcdcYqjGeBeRGNTRBaAEpGkHg/hxfazCqZdtS6\nh3mONoC1Ds9PZF9CKi5c/geaJkBPZcoU5JSqJeZhOs61iX1nDfI4IBFYJaLY\nycRcHWAw9DgEvgcr/Az2CRXQ4IvmPVt7NV+XORxrzTBUezh77DNvHNxBf1RQ\nAcGF6JOSAWDV80hdwbXfSCugVpwGwv/gdL85cB5OZJ4KKhRg2x55YH+UnXGb\na04cAgI2oqvRZoUomIT/WqbDnyGn0tI7hXAEVyTav1YugNYYDtEoSpW2RwjV\nEV79QgOzUbE6yyCoYRYsyZB4/K0SHVai7Hpj0a1F1JNJMlspzyL8J9OM4Fjh\nK7y7FthEHeucWYbbm/q4MkYDtgcVdcntj9Ch6U1sRQRPjWVlYGsxGthFS4uU\njuL8cwQFCXa3yt61KpkXubD0v1VYP3Ub3sLpX31mEty2zT8jdWRkrmVjWSXS\nqugfA7lL9knyWQ41lwUUqmSod+CTLaQhvRGIVCL6a3i5ud5JvGcmaDd0gsOB\nu7Q3N6Sb/pitAdSuI1RV2O+vDHd6GRGJ9EKU92kePhrpL7oyC/W/M7apah8Y\n3CWMt+2fG6L1gL1O02poMHUEKPCqDFAEi196f0fExU1YrKdSjjaSri3p168D\ncaxY\r\n=b77U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTCRPgBBxPRK0rvMxFP5vqpNP2WhXrztfHyAH/9RU1aQIhAKkJwc9Sh2Y0IHcbsBeIrGOk94QgJFLfd1JwXKZhPM7T"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2054_1603585005614_0.31215997014823893"},"_hasShrinkwrap":false},"2.0.0-nightly.2056":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2056","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"146cffb6896d1f2bcc3f7f4426440b09b61142b7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2056","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-zoEnlXO6xNgsg96ItuSVqqwtaqrcDBmMNP9NTHdwX0iHWO2fWE3v16CJAXoI8E8py9nnbtvbCczfKpEW9c2YQg==","shasum":"e7ed28ca5eac5f49c6ddc5813305b75a22b2497d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2056.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflhW4CRA9TVsSAnZWagAA/AcP/iR/F5KUAEivcalHoCuK\nf1MRsccN/ZvqSWyk+YN+IsIOeDgqY/3o4Z9OVnbkR/u2LfMv/13gtVaV1ybO\ntxv3lS/NXv15hAho2Uk7x+7OtZJAvec7fzIaX70gVb+vb1EFOFMTXgXGud+1\nNK5WC2X5K4TcEfi7oFtsS+etBWomH1C9l4AIiSfLluiuQcgYNPbeGnRQm2Bx\nOHJEtEMv7x+X77fseh71e0Z8UtPKMYCR5stzSmdLErplxNLMzewRyJHDrmQi\nUCQvnNEOBz+tO7io9WsIE+joQnZbFH5aboU2IwSOAeFdTNyz0j22q3mzDF7R\ncMg09BdYZXlGSdS1R93ai0WcdS3PFJfVbA6MObtgmap2FLNW8FnK9I4IIGvM\n2zWv1RDvaueHP+NGIhi4L5IeMTI1Kro+qOHRbL5ehfRbA8ccbu4RBkN0TBZF\nNuq7s0eaDYByMsmBBtwpFTSiX+R2qIrb3junt3t32ZtkUzi4h1Cq6DA6vhh2\nf4iUmmN4rTb4kXsvHOxJY5NZnF4ofO0MVUTEt4P2CRRSSoyD6BNh+8xzWr0G\nzsP5/5SvoFZ7hQINwXnrWemVDBJ/MWXw+7AHLgmFd+8hKj1n2jVNK+WQGfjT\nUgDCALwl0dCVVmSd0SV8As5rrPCp7P8Aj/a1Tg1O6gUQmxka5azW98BaHwhQ\nToIA\r\n=7333\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEEYt/ojmM/Kcw8T77wXe6KeYL1Vj3o+j5JJwjXcgLoQAiEA25hKjQeq1Quz4qINO4DZBhEubwGNntM+CO5HOJGZloY="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2056_1603671479879_0.7257709110929669"},"_hasShrinkwrap":false},"2.0.0-nightly.2057":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2057","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"26a67e4aa9693a029a5c6edd6eb91b461ef8f6f6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2057","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-0ytqehOIAD/BRtRLQ7IIhGyGyrlXdgRv9Wjs0w7QB9sXUldnH97bEL/Dp21JmyYQW8AkRUMG16MRPDzX1SLb/g==","shasum":"eb8af46d52f2e17cb5e66dd6b75cabb79ad88f16","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2057.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfl2dECRA9TVsSAnZWagAAliEP/0xdj/E2u6NOPg3HJlPJ\ngLe/sQwhh6uThQe86fZSB4YhSIBlMI+287PSSTNienr7VXhrTNfxmlgxotfm\n4jltT00Tlqv0+cnZ/knYM8FhdGTf4xydNTdRo0urNrJSZoLx7/HIbfveSvQU\nw09uL4QZnsB/1gos3+6y4SJRl6g3sk/gsBlHr/TTuxqLvdV44WscoBCZujcX\nstGnHGCYCP48/rtbmQj805AV6qBl6b8s9/3Zjw1grXlhLKp2uExt4Wm4zXRK\ne7VgfnghtzvId6kjF1TXXFFj6b9AY2sHUv6246NsibFn7Nta4J84xYj3RRDe\nh6KJzpqhENsX2JBXIaoOAwInHn1zFoNVQtdWGNbhGmAw/a3KwpHs7/QKRDtL\nZ0aiSXjRD9VQfysRHLZl0qXY3wSbA70zNh94vzgm5QooC3cfWk7FcD90Vlp/\n6kN3RPLL4kS1YgCMlPaBJJOR011Qm5xYqRaoDZqAG+S1PKM3Bldr+M5Xe81j\nBOlTQzrdLoRVDiIpTNhMDaWz254VcQPQ50OCeBYvdQQ/8AGavamd2BhEqQJi\nJ34BePBj2lu2T5wavdJLoDfyVZp4FudcPJggjMyAn3+cv7M/qQzmVBp7/b8I\nxtoPZGUgYrs5/NesQuDz0AP3QABxzNY6Gv8CLcKfUd8XlyUMI1Xx6CFNEcta\ndbDp\r\n=a8cY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8qKtan0mG34b6C+eOhtUNA6OhwRbM5rOfAiD5Kv+tigIhANxqGigSO/fDefTCXC60ita2sDiGW0KhCD9Iyc6sZssw"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2057_1603757892142_0.9438400619617549"},"_hasShrinkwrap":false},"2.0.0-nightly.2059":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2059","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a2dc60f2d204bbba1237a8524821338e0cde9e83","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2059","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-WVynv571iFBV7SoBAd+rodYVgf5k8Io2un3isyBLf3+RLz4NZ6dWof5pyNvvdW4Fag3UHDVY4CbIvL6GXPNrOg==","shasum":"ee63be4c6bb7970dce9ef0362a6ea9009fece958","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2059.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmgoXCRA9TVsSAnZWagAAwbsQAJLK4NcYz4IbuxZsqlKw\ncnuKm5HcdS6zU7D1Vb5f0SFKs2Tw2Pl41GxiaaMxD33GbNEYzrS8BCRSytsV\nZ7UL3T1oCrqqlaHlUamXmIYJF2W26WRCjHRHKpqbD9wtA7o48Km9ML8iTpER\nV7hoA08+v+AfKiIYi8Yxi3jWq8mr6IEsg14LHsbwRbuFDO91KIlPdy6n74VE\nrftG6gkJe13pnT/l5HBe+IvImISgTCTwGPxkgdYsX1e59jyOgQggDzknDA/s\n7//A2bqpYffCTM+KNQGZ0qXnxHukZSVoCaPJLS4YR+McrskLP48N2yFs0GQ3\ndntYjDD4FI0JuQEC4TbqVkehInjMQQG6XEBlkTfnf1aGvP58pBVaKlxqHBqm\ncwMdhwlTLvkkrIQa6rPUX0XXuUMn0fFij6Y+sCs04dYRyRDZbrzVjm1Oi1PJ\nn/t7/jv5rcvqzcmuZcIL59Buo52jYNAkU5PMPWw4LYzjrGB1/HPNwBRoqw+i\nSQSnwA8BiSvki2T+zNV/A2GeimDwA48p2uVWBg+TaT++sjEkouv1UdOLb3GE\nSl4T19Ct+f7VZAA3LQFwP3Ed182fHQ5+BH5xObDhlRlGuvRdY4Nam1oHRuiC\nzqUunSqWOqtV90dRJ0h3eMFpjs+qy9wvEHv3uqTR7LZWVN+uuSN5IZxuAG2+\no1ER\r\n=h+bc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcKnQrf4e6ggVeR5Sb+GBfXcDjG3WCJIX288IXMb8YywIhAJb/GAAr/CGLkvsxrmwY7Ldk8JGfpQuZJ1cex4Gz2XjC"}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2059_1603930640477_0.9831299587039712"},"_hasShrinkwrap":false},"2.0.0-nightly.2062":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2062","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a5e234877e42ce98eb2bd38665edf6937af5733a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2062","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.20.2/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-7BEK1BPSGnHcudrghUZBK9tM//Zu9Bs7n5OijYX2gTQ9re/qy7NLu4NIV03eJx6cvxg7k/nE/ZpV2lrzFgkcDg==","shasum":"a55418911851c7c4015622b579c4ca01ef921630","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2062.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfnKtuCRA9TVsSAnZWagAATrgP/RE1PGenK/QIfLRzZxxb\n3FnfkNIpo3MIpkq4Qqa+u35GL7dUVrl8v8ZB82WTI7G7YqTIO5XD8uz8aihT\nuxw4AMfgffoMdQwl/RaFVbG9EfOFIT+Y0fjRpsQUf6RW2FK/Ptaf4/DqxW5N\nYPjn8fCAXSCa675Pkj+8FkndX0lzGmZP6VUc68/u91grrqeaAMJTdSckjrtY\nqo3Grd/V4BLIuLSqmFaDYYFkGP+vLhDVCmB5zZdv8Z/nCgdho2L4TObSQpq2\nezKrqf0yr5qFHncv1ZKfdPabEhkwR/juQZHhfRRS2bEgpbXUhnN0pVa5oWbM\n4fwpf2+YPy1QBh9zQy4I09MpXr5Pr2Ogohl493q++RozPu2Sqy6CgFy3Kwth\ngB8XzxJE8v0Ekja/eKvMkkRxQdrzg4QlwdZb5AMRrLj15d0pfe12Fn1U+o1i\nlZYgE6nXGxHKIa+vm/wnRFUlbFLv/s3WO1xYQQ+EeLYDEOHJu2ZlZE6uca4p\nqs2qwSz0atxbR9JVqsI4vTMPsnXohz1hPn6g8WYxZnOtCZ+tPTDX+/OQV/FT\njDjYW/QHkhiiWm+QV77eckoCf9y4sE2alXXaAnpAqgyx1gmYKMnsLE5dPZaL\nFkOp+tixOGXR5tGKo5v1+QK8CDGUoqW6nHRwDT4cQ4IljWHkAFcbSJlrb6ZE\nC49u\r\n=ANsk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICdf+jLLhdhEYa/Le1a8NkBItnliT4et5v3qOWFj2Ed6AiEAuuztDsc73kPVgIrIzs3w6IVFp9+PhggXQzWVcZbBuMk="}]},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2062_1604103021583_0.2624584524104101"},"_hasShrinkwrap":false},"2.0.0-nightly.2063":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2063","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"eaa0137195e101438b3784400496899c275f18e8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2063","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-SA4vtYGE3ppRfBcu36aPrl3kP7RQanceg2LBE1l4f4e6AS39lP2/0Jkh7W3aE6rWAgJ356QaIvxehz7083bP/g==","shasum":"cc8b559599ec0635f8623b5fb7c84afaf201d89c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2063.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfpJTFCRA9TVsSAnZWagAA9GYP/R9WpTrmrG4LU85+P2e4\nAgK5BYS9bkCtqZBpD/JAC5bjyKKD27kDUyU2riY5Fx17L2zb0ED8HA9E3M1U\nueCifWCXUgOugQak9h+LTPzIRXP1FsHt9sqNX2sjWGDK9m6Vnd7bNbaaXZEV\nHt1JtD9D0lcObdDkyYpeQ+r4GxjDrQZ8miwDzLaaTiH27G/OWG61JqnVAbbX\nt//DZZfeDIDa3XRqhhYVZ8RX1+ddVRsX6QveEdNeRVWM2zcAkgx+4z8uKIVq\npPaFxb9AYFq1CMNZTAJ9Nc3Mc97f/HSsMbGExu3i2O/V2kTfKJV5URozwLvV\nkus5zYpGinndCgTJay9YZ1UqMuGgUKWh1vlLELyyJ3sZVAaJeWOlkJLsPKqi\nbbD5v7amCyZYrc5PwUURj1gWXD2hGNNpubIHXXnl2jtzvdSVY8WvAmSw5cUq\n+3ukrlfv+yPTwe9O5Z7wu/ntZAgiSvahe97PQbt69VIDQxzxDXzY1ez2aw7v\nSBU4+f9TKSh39P1Jv5/HeI3Y3aool8ow9YAAb0mWowGzAc5GHjYaOh64Jocj\nJQHI0wm0zMKbAz+iEckZxH6twpmmSKDaB0I5EOMqHDghwtfd5JTrJbH5pYNt\nlEMw5PVjId4mnQakGshK2q46lCWuI1MHU5uOXqoO59qAYnv0wek1q+Rjc7ma\nMs7y\r\n=hh6Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIQDCfiXr84+232URcI9bGlnPsehdc6L5bkrE2Rutqz+RigIfVQCcErqxqKxImnQmUteIdO1psW4MnlIVCY2SUeaxuw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2063_1604621508677_0.49817415024859013"},"_hasShrinkwrap":false},"2.0.0-nightly.2064":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2064","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"1572e394a5a8f83ede7b838ec3834cb2e58dd6a3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2064","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-l/M1oCUQJaOjJXejWE1gzfUj04Ygx9KSRhGeSUhMdFXtvsYj062PKG8ftYX4IYdy4HB1olv2g8ptvo50z3nsSA==","shasum":"db99b1c8b74eb1dab01d2d6b859dc937dc099e04","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2064.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfpeZUCRA9TVsSAnZWagAAWesP/1Xnc/LBktU+EtXrwPbW\nCv8l03UI9EhMFPvr6MQJ++guC6m1IR4/uaX39LbUVzK5HS2aWq7uwaEBBdUk\nqOcavP94HfBcrvOC4AFiHHeihL1m1YQnnJdOWDQIxnou49wYqtMZsQ6fcYXc\nXTnJ/B/gLh6KA46vun6CmYDlQUiLzudZZDfZEQuW4A6YPlj9YwJQvnyvT+2I\n7E8+DcIAIQOVFrTbsWqeojCV+QkmS6VouWq77MJ3njCKuq3RHRKbHA3Z2AwV\nRNKu0Hbsy4Q2NKVCSR5BQwnOY6dq4JogychS0gycZAeB/g3tKOXulYhxx2Nl\nxiwxWWllo4jpRd2jm7nvv0UAuSjdIe/eHFtBas5IugjInBSsMEYvD7Ny75Al\nTtdbFKh04rfN10+Xtm84QzqjJE7RpH827mJCi14TFqK1dH3O0mySvn2fvyqf\nqwl+CMQ39R3Vlp31oPVK4xGl6vTh35nSLL3x2yuLfF04JQf5Dyr3I82Ed5DY\nNIxyt0i1H5KmS/oEQRKLygf8gTjTdx4I+YXAkbIi5N5RVPY778D1Y9Tul7bz\nEiwbwN4zfhL2efdNqc2YUhzjhoR0eLMYKV2iwmPnHe8Auug+5d4V+409gLRr\nrIGz1NgB/UNclHwrpOcZmXiCqt7nQO1qLVhLLCm8DW2u/vBXBfpugMti7gMM\n/tQ6\r\n=S0nX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCAYVVBsiHPMd/HgWQnG9tOGE2aEhZD184aV7zlrj6tqgIhAIfWBk5fYQ44KxB5xkLlV3Plf+cEg/Smzs0C+UCciBGr"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2064_1604707923514_0.1328998433692703"},"_hasShrinkwrap":false},"2.0.0-nightly.2066":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2066","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e21369651332aca0f044e136bf7fd83202e3adff","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2066","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-lDHJ5wUPe4vCGh1wiW8CH7j0Tqo7o6yz2UG9UQhzhDviS7jHfpkCg4f3ss1YpJS8jlYQ/TY+PypoWGZcOQa+8g==","shasum":"375072084e5da071fa9493ce77e16443dd0dfa04","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2066.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqImyCRA9TVsSAnZWagAAMegP/jc0itZ976oyeF5TSKkF\nuXlvn2oG2Hp3LCrUfzHA2i861GJjw11QUW5PjbuCPEisXDkYcUcYYCg8oA8g\n0i1mDtf+OmqsVi3QvKIgjYX1N516bPzDpvLF/vbylywIOGsqBysm95Okxvf0\ncMQd9QUYu1WHxaEujT5RheOAqRktV7OWh+J5mIK2xZQREHcDGd3NsHcG1awe\nuqwz1riKyQsq6XeRnf+uI7EZkEANIHLG1YPblVzl1R57WWQHPD/tvzlwA9sd\nxekLCO8K0jRxg2yxvUhNR+b3HUlg5JlY6WQDowDQKcEvImOWm1kcb6AbwQGU\nseoMADwaXX1a7vmyN4P585XzgkbZdzGnHoLEDOdNBS4jdt3bUMJGCKfWpi8p\nZU2YJUEMJKunyra+MhIY4rCSQ1GgbpGtqxltRFDE3j6yj/Z80O+lpFATAR9w\nOtdEqL+8WvbEPdHxexdsRmVyFlZHrrUDzz7ARvDx499m9bMfjlyt/xHBdzjv\nffmE4qEbTOgVK7WGFvUt1u12OEAkzVtGVmbDK+xsuob4d7294c6kks8enBVF\nkACvILFgYYhGF0kV3bDkiDYhY0G56JK2wFTX6KXPuaLPrLEyxRKuyfhRsM6J\ntdahu4+QE6cBKbbaqyDDlkyQiA9wIWBFFw29UfqLCiTZxX0LDQxLu1d22KW1\nOUg9\r\n=l7Jg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChiT7B+udgS1UjJPTkHuwmDR+6WjDLnylRoqy1//703QIgE4H1M9TM/n2tVfNS2ZFlYvr9iRrPYSlEPwBFzqbug78="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2066_1604880817860_0.517374585309762"},"_hasShrinkwrap":false},"2.0.0-nightly.2067":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2067","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"adb92ee067bee7e10eb4ac9c864e5d28626ee285","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2067","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-PlFGav6fC8HIsA1pS7moWTWgXuwL4OI+xH50Wee5Dc0Q3KNmfyqCJpnhRhCJTGmVe8KGYEgXF6MNwrvjVWUCbg==","shasum":"102349d4f52d8046868429cb70f5fd4fe544957e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2067.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqdrYCRA9TVsSAnZWagAAfE4QAJCUQCVPmwGZiDsdfJIJ\ns95moKCfaWcrMagXv/hufpCkRGJOQia3tI5dEDYhINU18DuVykHZ17HkN2So\n4F/4mTdFgpf6183oqzF/3jQDhs4ygr7FAI4qSolDH+pLpRT954o1W+TPqUj0\nngfN8PMc4eufv41C0FGNsAgd9ZTLVvzp5tW6O/kHKQ26+A9x7BS3ImlfcSaK\nVxipXDsxQwyoCKo99icy0UxFixidNwxughAGkp5yVcutNSpUGzpm3Xbc1bgg\nfvfnDQiOaTCy/66swzACckTK9MS2yYozGnApFxWIAeb1IHhU/AqyzduTed9/\npYOqjzDP9UKRcw4kOp/sDAjd7tZzmTEJyVEgVNvYlD65zvKK61m/DnmCwrsq\nkroN2yBuNFYIc4GJ21OmXddHrTOWjpKNv7KYAJh7zCwe1MrHSS0WAXPzrHTh\nphXeeFTGBfWupoNiRMds9fsqRqdvIpxqnu/HGqF9KeHxIZp+rKvSG7t2MHfJ\nJU7u151DOtajhHrl6EiRpifDd7RuFGaDKGcGKHq5aDj9hQOo2b4JKwicKa6u\nFErpzrFDPZ6bHv/CvL4Xgz1T5JY5FS9nkraVejgJr0pSX2L90S8GiXlDvRBL\nXsJba9T6SwT/2NfthCESQY9Uv7FKoHkH7e3P2GShaOqfGsk/FlQxGBTsJpGq\ngnU2\r\n=G6Fi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICoHN1a+lZR1lP0feaeYEjg6Rh/0DHACQGlMu4z5J44TAiBEafTN7bb0F2JwplY/1EPOSuQk/YSNbQ32OiVcoWfxwg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2067_1604967127840_0.5019194187202709"},"_hasShrinkwrap":false},"2.0.0-nightly.2068":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2068","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3bfef2821b6fa8031e8ec7778132581296266faa","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2068","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-f5jj0MRGMR78whdcDKIRQ5mmhv0mJCRcrTAUibYz7qzaAdZaVR5uOQ0N+AzSN4v5S2F4uw7AtwWph5YnWCJKcA==","shasum":"4e825d931124c340c4031964236942b50093287c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2068.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrH3+CRA9TVsSAnZWagAAXUwP/RNizjLafTNkloKgUc8L\nX3MeZ5skPzs5nn3InEGJsHGrQ1h2Ob1o3jpoe3Lt2qbdw0lXtN07Zt7eQ+H7\nSjyD8zEshV4yfeERltPM1gkChhBB2VzHC480FPAb+BXtdKF4KgVUbb4rTF6H\nQOqOIIHsytbHc6BU97GLgtOGwNlJh7xBSqR0VAzQU9NXdkSk2MiUWj+b6qbe\nWcpjkQUOTOytRHVqsf1+u1xExtrlexrhCYdwIXbTOoxYgc056GYRQWKHSWxc\n+N4V86fcdtBA0nwhSspnk+XJuxuC9nAChj38E+wAfhOQSltqGaSS3myKFFzL\nLqkZ30UF4r+6F70ZPCkVcVkNzGV50jnhpnIMu1d1f9PiC9Sw9zlv+rQFx0iV\nrAr3faKkaKqkxRyyXfRkXL35IUbW6VAxiTPskoFkiWOdf9DGPAWHjTa2feFr\nL0GVgAKknCXFVabsZFPuD99K1C6PLhDcnDZHt0ZLuitmvhUkjVyccWan/wK7\nGwwSv8SayndOtlGmPuKroyyrcduLHwMJbilXbyCUeY0k9LxoRAOcxkxaJgDM\nn+7HVCf6S+fEO7zhoEkA6/d9Z/PDA+7U/n5KxtXPz9ww7bR2182WZFzdX+5h\njScrYnIJ0gq1Tc/2NvYBz3o15QofDHrUJ95yKTpdithGXereOPKretfl0Fqz\nXNGZ\r\n=wYj5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFc0pIfmRvt6JP/PpKzEyeTS/QOdO4snx+tHb4yZzDypAiEAlIpNHhViNpcwMK+GskbyZb62CQm5mZz3IXAt1hyhq8I="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2068_1605139965908_0.8032615239998664"},"_hasShrinkwrap":false},"2.0.0-nightly.2069":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2069","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"3df3153bbd226de7184fec966b0fc50841de3510","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2069","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-B1ZO4c3pQWfB5D0TsVYzHMQ6R949yOvqxuS++WTxbGYEgDgwp2cyQt2Hurqn/fmnadxkCY/kwWaMPpasg+xSiQ==","shasum":"68c4ce70174031b1c8a3ddd0c079ab0704489968","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2069.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrc9pCRA9TVsSAnZWagAAffUQAJlQIVGxwRuRM4YGb55V\nXZHX8lsRz9JKCd13Gm5LWJUIegvTJsJm7kGEKOWTjeImzZ727Xf0+Uw9V2Qb\nqLqhas8mU9uMtHkIS8q1CcbTy0+8AuB+r53cS2KwOw95CCabDTsn7POCb8jg\nXdePfhAO3ocsPpNSmIoGc4aCfogaKYgagWi76tZ/77kFoJxgBnERsgOAKts/\nWhvPlPaNGCWAG/8KYTwP8r5WY+gTPjaHRhjFBnLmMlEWdpAbssKhyC+ZA1Zd\nHiDboPDJWDI6E6eYw0xGBVwHwbEqvQeHY8j/B5QLMhqf2tH2BHxtS7T2uV9Z\nygsBBNIjV5j1Z6+toh6JZMo8yIym5MHYxnVEzfpLy14X03Z3bO704SV2+Mr0\nuELO/Rdn0r06I7MHzjx09O+0elFxlFskwQBQzSaOTWQFHPYa77xlocltkX6I\n+x/WdBmsbAYKnTPniF8uTzh28NWjF/moZeQ+uCroWpG94OAEMmAQUO7cvSfm\ntAuQoUrBaXMN1svjp8rQRuUEYm3358p7xeKokyNSehYbvpvS159srndApPg+\nOKuIyo3ur/vEVy4N29exZNR1HXNLDX7/7Il1F9kppV42QxB6hsWOoCBl84bF\neVjCTwv7mn7e/1X/UtVhhqvreS9Nk5A+y2Yf18tBZGailJAfBxyBbZgx3ea/\n8TBM\r\n=kNz5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSGXcUYeZb/kDoW46MzBSCiQlRiyi4dnHvorh8dTbvEAIgMW/ubu3yo+mIZHI0pCwag9U5+k79IAAz1j1R3wKKUuY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2069_1605226344517_0.5665155343845187"},"_hasShrinkwrap":false},"2.0.0-nightly.2070":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2070","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6100114072dbef712da6ee81e8314ef81f14fe2f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2070","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-XPiOe/lWsWkvfeEbXPHgYldGOnpuR1FhMEXgH6RKa9ZBrGUWBDdC3KuY9AFwxDx5TVZGZxHmuV4LgOE7wpwqSw==","shasum":"3064eb2f8da6a8c88cd85a795898258f1f3292b8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2070.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfryDCCRA9TVsSAnZWagAAX+wP/i1ZRiOiZdDhI4O2g++h\nOzN87Nc5RUtZC/IhKt1Opi2VKaEMTvbbX2ERXwXEW92EKSUo0Di4ldEq6tIR\nPef+nEhzVeEj11/cVeB5IlTb7SESYbb5pS3W5Tf0QJPgb7cSfRseZ6hgSLiy\njCMOIa6ghYWEDHYuhjAQ0Mcoo8yQirbPGZwvUgtk5nUB8EwKJ0qomSAAosVC\nXYBbnUvRTC4y/Q9J70SJlfu1aB5s7hJHPajV/gnHZAuog2JvejjrqHYM6BDy\nm4r+0Cb7EW7fPB+rEV8Z88QsU3jfhoY//LYdqEsY0WXgHsid6um6E8qvSFbu\nN79niMvOv0Z/PuPg4fG2usFaRlmifvt1+pEydSG+B2u/XHUGgBv/no54/klw\nzw07kuaFS0kZYVtpQ9cpxRNWPyBSCEzyZsFy5la+cgLGw9+fM9IVC/dcl4oG\nXW3mIzH+WmrQiS4VnWQY3JTV5p2p53/vR49DIMrSGCLU8dKrxlLb9vCk4Omb\ncdiOPvKBmWP+4cf1KWJwW1ip3VNGlvsohwYvpMmDacc2l44Sy8p75nkaxF2M\nzIn2hAb3/jmDXbOrH3LrHtn21OZMoi4wX00dbfhhUC9T1Y6PM9gir5So/VT0\nmKPlNwKe0jU3/a/TMpuVyOXHcl+pYqOhOb6aMclbwU00a5iQeDHGy0ORkuGh\nqFWb\r\n=htzf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHKB8YvopENG80jVbTBJWjs+IUdSeV3oeBmLrIVkD93aAiEA69qDQ/v33SH01am7/szNnkbKRUwkzD/wyzIOf5APbOg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2070_1605312706325_0.39212890502696607"},"_hasShrinkwrap":false},"2.0.0-nightly.2071":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2071","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"837d1fbda5eda89fe21bce83af3d24dfa9fb5887","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2071","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-MXStP3yWHGCY2nRGi6kh9ezeS3x9ITUCZn0zX80TJc183I/Cz1PHcJKqeS0lwXl8VtPFqDvjXVqoSBY8UCFQ9g==","shasum":"f4d49163214074d2cd2bbc43cd2602eaf993cb53","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2071.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsHP1CRA9TVsSAnZWagAAWBgP/1SxtiBLbOI0o4+aSOUl\no7X6D4BrNBo3Q9xA+Unx4jtDRW/+hLhvQfDyawsZ2N5JIG05xfKHPt1EOYLx\nawxenD7ixcLA9H9/bWZfGphqnq/C7WcsnDnyWtU3L8OP4wI6hNSIB0a+x0bV\nZwAbYvXeK/k+qaqRvlIPgftj81wuHlpuYiKOaihhd2NEFJZ8ZLOMI6aHNlTU\nTQ1ciClcCq+CDr+6wAslT+mehCNxYPXYa/wQd+kvbty+eDvc1DmTa7wmekEZ\njGRgbQMSHiyB2p76iqEQTu+3fEIlZltarjLrGh7ZlvBYeSRFhMQOHdIWvUsr\nBKs2B2aO+J/E/IhbgBjSumQy7T9kavWDrY1DaKkzLkA+pvAGuV+6LiOjKqMi\nynMeyR0nJHkrRH6z18Og4OGKuOpQC1IcwwHPi/Y39sxn1emWjXKN3vSBwhR2\nYXdTd7a8CNJdm0zb8vTEP8G1s0b9OqAgAXIGDwc5TVEKt0OAtMNViDlU4b7m\nn93ENjQlyFpwiaZcJNBimEU1SI/YwnS5GQnQqxbzvmPos7YwN8S+/Q4pBuaG\nciSThD5axZAj4NPQ52UE92K/taRV4jStFVo4GuVRfcos6xWF5bqy4mxgEnPy\nvyw+5v063j50NZzl9CvIjRafhPuvBE6Q00dR1HLFPSJlW0RC36ed55q+EWLS\nWSvR\r\n=hMGX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICWsJJA2elyicgmjq4HIEljC0d9oJV49qTepXuouGdmxAiAZz2W1VhMwZSjuThkffTMQUQ/na7GYxF42p5/xjPKjyw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2071_1605399540791_0.8083810023654792"},"_hasShrinkwrap":false},"2.0.0-nightly.2076":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2076","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"04b47e19d2c66b48f88735612f759bb5fc18205f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2076","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-4/NVkDc2pSfcOEWfAnZlC9GneFAD+LKGGvBiNvkpcrTOAok9QnD6l/OsCkrhZiV8dubqLM7QJIEV5B1BIeT5Lg==","shasum":"985d8a572e23c34472c4d63b7eb6dc2a9a09ec31","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2076.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftbhICRA9TVsSAnZWagAA1NsP/2pF8fuOWWnEqZ668Hct\nIe3hoo+lYfbPBGVPwSHWi0v+e/Zua1n3FWfroTBi4msR3D+ewMXtoI7Glzky\nO6birEz5s+yKJ/HRLWE9uExdknCndFyxquQutwZ3ux08a/FfflU9gnQLAzfD\n0wbqPYVJx+KpPUHfO/fE2qK1y4iMdcq3FLMfoH4NBkfONxFfuVK968fmy70k\nJDp68/au/gJ4CNLmY3y3ULbV+4n4bsG0rYOaGGAxWaQWbQ/HwNks4qOwLSfp\nEskBE+4cKwKAsJYiAXULS0r1dFUUnPfJoZy3aRBY8lELBcC2jSCvz2O6113R\np7XuRSArSpSlZRpdKIWx6kwtU3aDgIlbFGASnGx0Ayurw89Ppz7pQm2RomRg\n6MBFPzDs/NM8Chy29isiMskzfLHSYubg5hyINiQ2dDr+mAYvYAoj2DiSFpZK\nj4LFFavRPx8SVmQ/zPBSMVqPrR23njQLXs50smce908Oqd+4izZ10R4fZBex\neCeuzM7DCmvvDLJc3pYpWwkNfMfirg7bSLdNaXC5mwHp4haQgLmU8vfPsdHh\n9qa7dHnRX4vu/ngnAsvcc3nyAhOZeZeTcva0OEg5Ikn2+2agVAp5ZUrkFZ1l\nsQ6qhSJVKMntrZurQzwyeHI/Pry0PMJQjD7CHgx1eAKS3JlVFMW2zwl8Mhvz\ngRW1\r\n=ljNL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJ1KkpeysNZSwGdwBt7aEkNBzK7pvoyAGyImmYpaoEWAIhAK6wTIyI/iI9FgMBuIUTpP/XzWcQRx5IfCk+PPWBO4Ie"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2076_1605744710844_0.6170503559145795"},"_hasShrinkwrap":false},"2.0.0-nightly.2077":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2077","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"aa979466854f8d2f488613a2bc8f17b85d9ce2fd","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2077","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-BrQT+9Pj0d2sP+UWkdvWVNycUAVF/L1TTiDoAcxdAQwJ2NNrQnnbW/kiozqpuejPRkmh9yHFgrfy2tqKoRMRzA==","shasum":"daf3807598e6e076995a53104ddb7882822b68a7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2077.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftwnRCRA9TVsSAnZWagAAWd4P/2LEX6x/meBP+sdK9BpK\n4OmjeqrDb1C1L4BT0x2gQEplAltMgbxU+dX+Okj0Iq/d6k+GFo74IDZS+INe\nj/Novu25WYAzGZCJ5M4KXwpztwT1aKHqu9APJ3bC1u6eifYyFrm3nbyGaF+r\n0bYFVpudc/RcRw8dpA4t9ywFvJs5Q4tPdnOWAEhG40hqmG5QWbWkJL5Pa0MU\nJIWs8LHAUbx/NhFnR9rVlm4+9UKolQqwGc4SlzpWrAI8+MH8Y992tI6a0gpe\nvz4TBRCV7pBYm4IH0lOE++4pF7FhP9VgPcEqHpWwKG5m9wZRf4pLITYyJNM+\nFBPY7LCFvoTMu9qZx9ihF108D3N4D1ngaqc/H0gbuhOdfbqw1MkgkAGsG397\nJB2BnbT/uaOp/t8tYSquD6K4QHGbciXN7SuePQQkoJzue+7iStc+j4wbi18i\n+3ujrhjPHXsDbdVE7Ym/HyA1U/9mnnQ2wmr9XUhbUkYGpwe1QO53FhJ1vnCT\nw4CdE1FiOcPOHwLMtV/y131SwHJKIS9ASxZpBeImjJSe8/DGlELQNHIPPa+A\nsmuxJ0ujiUydz1MMqIK2w/lQysfZDMngyjgd8Fk6cSdHMJaZNFb3n76nHFuO\nFMkcsxoslb7qLQAag/NrZ3Fatc58g4OQA53Sxg6bxFi+hpoaiM0nxaAY4rQF\nt2Qk\r\n=fWnb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDeIAAbCuunaSYxDqlPtjokCN2yoU9OpfS+ayc0cjy7QAiEA7jk4N+uhWP3JJEMys3sZ8jkj97pNG2iPFPWDjBzkQRk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2077_1605831120615_0.8959399943010151"},"_hasShrinkwrap":false},"2.0.0-nightly.2078":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2078","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"944ac09bd10daab6894ade7ad8935d6964ceddb5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2078","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-pZBPHMvfCfx96tX2DEe0WBuH/m+0bnhrm9Icv+Mw+CESMqpAKibqbw6HMHtR/urdTPQL3ArFQa2O1z0CmHRvuw==","shasum":"f44ca0c1ba6dd222503b6130a3c5cb182d75911b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2078.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuFtWCRA9TVsSAnZWagAAdUwP/iv8nJCgHWt71ExdBy8p\nnh0oYaInbhbOg7IVWdIvJXOcY0pym4w8Do5kJ4+l2UuMDX1rFsLn+5D0jSPw\ndk3LxlbwmhnfhEmqN7X8fOKjc92eFON8ypXQtpBco4xrHjE1Mlxww2FxGQx2\n4pvpgE+gRMzFqZoqfj7VW43r9sYtLo3AwLtAATGOaPGlRp3ebU2NWpED0ewV\nPFuRFfjzeWSdVJufYSrfXKFuaEYtdM/hXvIer9IH4zSYCXGN+hTDeqUXQY3d\neiR0BlvySgxXsNlBO8uWbAkTatXHOxvvVyew708zss2UsEnQ338GfeziX8Jq\n0agvaZjTyHapEhRN2KsNnpeQ/hr7isIw3+6vuw2GztGAOgg6eTqVzh8DhPxn\neb11XrRsqMHBh/onTPzyJrR8JGiubG1AEt+WfkYEpNUPEINFzHq2hJSXEiHh\nrIljv9O+5CbkQlyKun9lZRcGaBs+53olsxzPHagqCqBkHClLfhCFE8FzrGm/\nHCCsNe9YQhNOofLHi4c4M/mVhsN5sRd43CFf3g4H37jEEaIsHMcu76iGAOaR\nqhI/9Gzeg37OgUdc1QetPJuTWbCgvoXiVs5SHZXfyQKXcoIARZIxlB8dK0Qx\nkIio4Y61sNm5frnIEHXpyNtdtdB0rKZT6x33MhPbDgCijcJDcAc6dRp7/Qw3\n1eAE\r\n=ZOYD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHb+zntPmVE2xSxgLQQ3irbdHtcNAgDfwOj5wFcEJp3MAiAwemk62MjAHsQPopdDCDAT901NBFoBHDrHkiCu51QOPg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2078_1605917525573_0.3546671622459099"},"_hasShrinkwrap":false},"2.0.0-nightly.2081":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2081","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"0247770e83394ad44fb755cbe8b20e56a65fc580","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2081","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-65hFEOhditRBkPgZH36Y5+PBQoYmYpcEOwCelT07fMKiBfh4HQ0XOjmDT8kG8pnhAkdo3nzUNl0jxmiTMzeAow==","shasum":"bc374c8a9a99235a527a09c13b55987c1cbc8aff","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2081.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfua0PCRA9TVsSAnZWagAAHpMQAJ2hz3AQIX7YnpXM02XX\nWyKNN3QOT70629lcB9MZ7lj/xYt5tjhTWm0RG6tc857KrpOyAPn8Ca0kvts3\n2oCIfVQ7lEp+lkf6ZRe0Dqreq2NvfQhOpFF+pTtQBJsFVTv20w6bjYiK+Jjh\nFNmQArYJRN2A/f3hSimmWDdG/5O7MlkVD9aP5LXej0vfTt8XS9LgfgABiQBw\nrYR0D5Z5Lh915/HIvU1pDBFU5S/7O2w1+D3ispduHRNVFY8ATNfuaTe741Ff\n+rL1G4lH7qojfKLbZ77oeq7hIRUdOKylJcuXAjma2eLCtBL0MuEk/twLer0t\n3J+i8fD8xQ9jp2olHH9SjejM8M1P7BjEvX4aNc/e9u0cNWnHdp05k4PjKEyl\nFepdIL+1+mXtJjEKh3Z3T54qqt+pLKO7tTtdIusl+io/mQfb8MBv+q7JDgej\np3Ee995ARbfREMwc5YRJrub0p+27Q0qWXBJOneJovI4gVRGcgK4ospxl/7W2\n0Qhy6WHaVgmcuK33xMGFCtKrIe67ymQGswC09PFHCRtvqMxEFKyrv37gqaT6\n8/hz9TH0TYtPYsjzFjxhpTW8iQe4UQHzaMM0UdRd81aNDh5rZDqNV4uuE6KO\nKy/feyeXV5tGhpnpNQMvwWckp9fshXJK/9n0kGd61d56dVoN4Aubg6Y//6S6\nfVcO\r\n=bRBd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIECc27Y890sdTFeUzRECbgo82dvU8KJPvR4ebYVczft6AiAo/caCHpi1K0sew+kkv6B4f35ciPdUjP9HhDuFYqv2Fg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2081_1606003983284_0.8942295186704956"},"_hasShrinkwrap":false},"2.0.0-nightly.2084":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2084","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"6b1aec6a4e56d72166d99f8fb7e0a41b8d310a29","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2084","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-ff04YBrDtj144sD51dtTJsmZKJ7m/sa4ygnobJUL2bJ5zPfH6HLuIrg8yXaPgm5dOwLvrocpzzWyTd86sRS0sw==","shasum":"89847ded273c8b954ce808d4c6cb10458c549dc6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2084.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuv5+CRA9TVsSAnZWagAAAuIP/0YR5agqzAmYckUD8lBP\njjIkJcrIHMpDfjsKXHT7wP7R/zMvmKaSCoN0Ud4B4RYGLE16s0l98Ztlft1l\nr49xn9vlR5Kp4Kagd4PtsI1qkDYC3pceSLWn34sdH1QPD4T8j7qaRZ86etTB\neUnTSwUcE1KBBgyDHK5MlGfbpDsRAu285SZHSBcnnNYDz4dq+iosLBR78Ddg\nwJU0xOfFxjYwiNq/KYH3cyGJKRzDBN3KqXxJsi+0elhw2n8atG8qyC+P6oD+\n1nhVYuOkbFmsXpgKO8+NWlKwHtSJuej1MzLzYTjZevOLUGNWYiH5tSjIUKo5\nZe4oqC1DEbl7R2oO/UbS3yKlnWzuJWlauaH98cfy9IfIctdIOYt1dfOaDsiG\nzg04RtL0N15k8FHzYM64bMkxEwSIsxETK1MVbUBmp5wKG5qg75OxmL7LNqZ4\niaXwFXEae7ZDjogtrUrU30dB4QhFByZ313o7oE3gl6uKrm0hNpIX2IDNielj\nDa8sSyCt8VFjsdxjm9UeEgHCwHZ0CtEHFTV7pDSi6X9TjMep0zrQMcD0uD5Y\nDymQze3jGkpVpBJCOmqESJAx8NJlSrZRoHkQCAdJv2s9OBh1wT790PwmDuqv\nwOyXbNNCt4zt1sjxscmvR9FHDqW/SEfwltLwf3v6100klNG98h2gz+BWYtNE\n08vf\r\n=yDdt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICM6UdiHvnQoiFctOO+1JHUV2ZQkXSErwq0XjwFRfpxtAiBUazXz0MPkhqedWxaB6i/pT9y36qtr7fPilygslcZTNQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2084_1606090366520_0.09774541432808381"},"_hasShrinkwrap":false},"2.0.0-nightly.2086":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2086","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"064ba0a166ea63ccd2b623dc11324d4cd7ffb526","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2086","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-EO7M5Q9S6V6fyDEdsFvUvuwkDs9vhlq9fM0gOgVE68szmq8NuJkv4vxMRPJ3ClKS7EA11JhcaObEJnX/N4qjPQ==","shasum":"6f4e00139020f631c6652b93f39d78c7125264a3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2086.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvE/5CRA9TVsSAnZWagAA7qYP/3zfxHGje86rTyThjMwg\nhEr2KZ4t+sbQ5cmTg5RuZau5Xh5IXJMIJ0OqFE/2tiRk057Dg6q0sRsWe2ea\nscU4GA1BfnGhzuF9uJLlxU2bBGiuVjJwHTFS5lu9Sh0rFvUrxaGexn97jLR9\n7JHOf+LVypd937NZl3B144lEDpeyKP4Ocubm68sJt9jr5vS3vWWe3X3/dRpo\nhv0cyqZN6nvCDshFMc0GV2DWN+oMaugwMLiU6+1qwuGG/ClQb+RmqsNk0EIX\n4EOeVZWhx0JYQ9kxczTR5LfK5unKbSb1wYE47EJFgIkEb9oP+4v6GWZjERLW\nQ+iP5kduAn84KLnt1GyBjPWWjaOf8RP/0dIQbHo0PqLTIAqQgCBzXRPydTD5\nSi93AADSpbP797R21/P61cmQJkwp7ShhJKzeqy/fV13V2M9fD1SD7qZdO/OE\ni5DnlrzrGay5G+onQ0pkZzW3MuJe7GN12u0cp7G1UJRU/Z0rRaxZgxDS9zVS\nrgYWOBrs488KjNhRp9crkn2VbwNimQz3gwjjT9BGq9uunTyAOj8BE966vaRK\nOdxk/bDmmUAIEDCEBGlzqsnVu2K+akCktpHZhvDtwIb7eFzaEn0Q4iF2IMvq\n3qQPRecq+qVosPYk4tz1dBYAlFw1NyszeVsn1q5BInA0Y2HdSdJaCA3lG1V3\nES2k\r\n=YuKZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPmOthXumE7fYQjGRHnkwNlXFrJSTVRhJHvaRW/SC9EQIhAJ3x/7fZ3xqjntXeDqUtSbggDDgln+kXwtBByaWrY/1f"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2086_1606176761528_0.4435576265996497"},"_hasShrinkwrap":false},"2.0.0-nightly.2087":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2087","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"635c973e3e584f7feb99f39c9e1963775e1f2ab1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2087","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-XxObfEdM+mVVS1ZCQJn2ehjJtFvlxwCPb9hOu2s1REaMwQwMnF46+RMmC6giWckJ9k0Fm/k8cDbZ0bP8Zl8wEw==","shasum":"efd0b9de726c7ce8e06e0eb36acf1d802e155faf","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2087.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfxYq6CRA9TVsSAnZWagAAx/MP/0Gz5rXSpYg6bzsW9s/N\nA8E3DkvUJQQ7JdBChATl2lHo9bpDyHQkSyRAgfD/WwW2ZmODS7I5bDORzeZo\n3IpA3Iv1O4xW6BlU4TEMHw8Ccl0k4Uf4ngu/VSfaiyB1WCb/+2nz7TZ24pzT\nonJAesEkfvw6WDCIEklwhDViPj6rbVCl6S4Aqdz3Nh/HZx1+CqAZQmpHyp86\nMjqf18RIjDkvE5tX5S1kMrpWsapxhKKCNe9Q8apQQuoIy+whZXM3actE0L7K\nVGXhWMUHixNGet6BubH/yQSVtTaWhyq16dzoX6lr+XzrfU/KujrgBQG7eIM9\ncRgA+gci+UBsLcCrw7NQzTnijM8YXlaiTpFzp3AmoPbzAblFHIHHh3eNeaBX\n3zlrXsnZQEiFM7UrhvagfwAeyMSsFYPV5iyq5TjkMcVcsUiuqot2H1ue4yn4\n3i0DAPUbBqcehOkNkJ/SeGI8DVsuRlzK4p7nkiWMbM2AcujdXD5el5H6gYEz\n6R5KYvBw6qM89FLFHmcdjP04NmmFauH24kwqwOg+s/Uz/vbuIf1snk6vtOWU\nMP2D2H3VlwXJ/8SWWwFP2MrgPru5hgKs+dkdPaO9OGwowAZHd13CJO/zmFDT\npOXSDYdzeXNFHbHPO9ygsHQ44c4kiEwxTOjY7hD2/6OZwbwxXiUQavovN9Tj\nraXK\r\n=8MQY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHwtl9SMoNkAT0XEAimJ0pHdBUe2TvvCzsJLVFIv4357AiEAsESw8N6CrirISj6zx5XNkw1Ga8y+PRONg3kvWDHxkmk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2087_1606781625763_0.031169304800426012"},"_hasShrinkwrap":false},"2.0.0-nightly.2088":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2088","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"583a6cefb7df9a184352e9a77f2bdeed24776378","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2088","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-b7TsfTQriBOLCDIXEHyyYdsqCn4/v7wootHc1oKSpMEhkWWkqhDatk9xgKCG6+PqVnNU2GvuCwT65y24Rr5p7Q==","shasum":"f3794911e2d50c0849df6ccce7dcc74976b5532b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2088.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfxtwvCRA9TVsSAnZWagAADFYP/0AfCjqze81P7xL5ZND0\n7j5ZUHuF92/iOvGDxq+r1/MCA1LxTocrPIp1zD0wzns/yd3dSrJtDMf40hqy\nikKYyk+t0yPqnMWJRkR1N6lbwZ5ynJHYts3cG4EYrRCDc37sZTfeimZ710gR\nkAhsMJ49TtewI+Sv5NO4zmEih2wTz+iIDCXkgHgjETBYQROW4FFqHidZGQEE\noCv4lwcpKh9UAxvvhvnnO2qv2gsHkoAd9P8P7By4X8PZzmbj2B6T19YUK4iz\nejpeqgGA/ys/IA9APq8I8PUOVv1C/QpB2ujiWuyO7ShrUx40gZ7vqbG/7Sdg\nFQTxvQ7ecgqH4NQz3j48bNeKRDRHXfWKuzMQsk2oxyWyuPMc0kX0oyL24auU\nNxlsuZEbjVwKYm5qC99C8p20gEhDPh5BJpBalpM4fa+xuUsU3G5HssYI0Zr6\nYyDjFmXpiqPMRH3fxKrUEE+D2/cFx4D7asWW7lDJwiq+9ZR33YjMVwwLh7p8\n4uegHlqiZBUkj4VDa4nWauFvLZL0SUV0TwzHPJULHlGIhzdg/+UBYZ/tT0lO\njWAMXcvc79wC8gWe57jw/WNygUn0YxYxwNj0VjpTtTqNnrCOT8Z5271Hm06M\n0N3FqNFB1mXEOj/Wy4M//Vml8iuVRF8kr0W8Xyl05yp8++zC7MpDGMjbsZVo\nI+z5\r\n=PUFZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcw86LI+7SFkdpDF8ZkDs9n5UaOiaOhDTBxon1PA6ecgIgV2EyLQL0m2yi0HSHe3C2/BQaRfOr05XeavDbxTRw32k="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2088_1606868015241_0.17813171690045415"},"_hasShrinkwrap":false},"2.0.0-nightly.2089":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2089","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"5d5b996e04629db8eac0504cb1063089dd97cb56","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2089","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.20.2/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-3CBFgdz0h9cA1ZAnS5/CpF8y2CXijJz8wshWJSquyFwwEsPxFAs3vdNkfkSPWvyf+yExgIzqFEO+dcTKW29RdQ==","shasum":"99980a8817aaf69631dbbe9e1310c86aae4439f7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2089.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfyC3LCRA9TVsSAnZWagAAW9IP/iFw1dlMggdELRj87dCD\nw1PT+qeap/HFYsS700SdSu47P8sxdmd5GtvsdOrpXkO/GCxG17ll1gnd3vdl\nXkfYsmQ8ucYvfTIhzy3Jv5DEylarEZby4++3DFWji1cBWvvJ2SQwrZ1sBIwt\nvO4kMTpbxcmsgs7Jb4gOu0lZY0sG2XRMfSGwojALi4NlK0JzH/QKqkMyiMPM\nsV1zvSsU7Lqqb3/beF+RDZI0SphJ0N/ZXdDcg+Xuq1dMDd6xly+XvCKrm7vQ\n+d4DP8lRB1b4zFFRLli9UOLvIkJ1/Oe2Vgc79DetF4Jj+h7l7uV7WCu0B/69\nJtAVtUyF3qFxMsa4dDBdTcCJI9ZqP6TMUyJczdr8y4C75Y7B/o8666vNArM8\n2plH2ar60hf93RiqhtqxBsVI6nDfji7z2EMStAXPZPcGmB1b+S0XBiFOXyTf\nlfaRYzIRDRvwSXFUB4d0FdSpqs2mflYUfZLboCTICOU3LL9nN8wZIL1lT+Wc\nkAgEdBjfLfFxCzfvzDI4iZI2t/gcQYOoC6zBVvaJ7ztMRaPyeA5wzi6rp7Xi\nVGqnBG7ANtMI0SKbIBrfZVSs6ZWkkL4StP2X3uqoKJSUidHIld5+6YI3Iety\nUTuHuzhWInzjXuKXbFfQpUP22OU1yQYwCGWb9LeB4xTa6SMcUNZll5qk/0fb\nYqkX\r\n=f9xC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEJ2nZkmQN+pln6GWSKmqYgLMhaNj5qcRO5xEiQyEVIJAiAKHcO0Om41vfclEBh+LzKXRXCETPWsBuyYnS+1m1XGbQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2089_1606954443113_0.8361451515219758"},"_hasShrinkwrap":false},"2.0.0-nightly.2090":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2090","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"dffb28f3d6799f3d2452f778ddef14b75d6311ee","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2090","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-5g99JRQeJ34+9j6G08LN5T4QdaZAfmeyHJmJ0+rg24DJ1rBTTPqlz/LhMgWU6GcHXxURfFHWpHqBOSm7dfOOzQ==","shasum":"7cfab22d4bb5ab98d3a702bc4278baf9b6849c38","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2090.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfyX9LCRA9TVsSAnZWagAANikP/1ebM7JWivO9jJWctNf3\niDnnBrClL29hulB2FNu/H32hWZYnegt/4MkClyGHdHTSh3M7bD00LtOguOEF\nudnR//EO2oaHP8H4wceP2s8NexxvrPyh4rOuAd0HvwI0jVMdCvKnfkmvW0ni\nyUeAiYKYXB5UDIcDT+EInX5BsZqDogt9lCWxliSQvRz6SkamCfThxEnXGi8n\nAcdaT7qzupqB0iciyMpgWuo8r6zkIdfoU7eFWgPBsZDrAedq1rg6ixNB7ehC\n9vxH6relNSfDKRgwCnZk89k9ecDaS3uJHEudJp0PWCvcVjG1lo+QAM4ljJp9\n/56DBgxWz5+52u6fjxf/2JG5jEppip1cx3nwSqEB9eP1ajDZ4A63XODLPRKr\n4ThaC0tNAiy5EqdlcDsDtFPCg3nvl/kls04GQBeJLyhXTHYRc9PHPRcdCd72\nlOp20pVKaKIgFE2SCQvpnV6SOIxZqLEDvMRHOQY9J6tqOammMqc7eiynwtib\nvqLJMSIIE249k1U625LaH+3DBNELJ+XbAZCKo/4yO9jKB2WYIvM7yFkzwCYe\nqINqpBgOUonkfmzjrKWewLkvjzt89nzEpqhjTtygjUK+QgjByyuS2o6tcxeB\n1c1PKPd5bF/sBxvL+Sh8sRHFZMvQzxqqqV78T0xZjmNgEHWSxYTz95Ii+Utw\nuQ6O\r\n=SEA6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUokQonGIBVSO79I2OHgNwixzdNd+dpjvd3uoC8vZgwQIgRWOPxyPdD9QPKZLyX8rsL8GFkP3SYBRqJBN1w26Haas="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2090_1607040842949_0.5112696438023543"},"_hasShrinkwrap":false},"2.0.0-nightly.2091":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2091","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"4aa4acc4e5da7ae086136a455f7506eeb7972cdb","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2091","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-S9mubrbOM0EzHiOtRuf1o/VdfIxl+bORvODWqO9hXjEJIKozwlnzlXcpIGkW4rnJctXoQeg2GInS3TisXjqMFg==","shasum":"71069b98499a36dfd384c986272ab74d44d948dc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2091.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfzCJ+CRA9TVsSAnZWagAAUiQP/j4bsohlEzJNj1nVFizi\n0HPNGTUiMWSOzH+jQZnj7+EcICnnz55mwGRLNaXiMzB++9l/oFk+v5bvqW++\ntvMoVzq9yj2SXDqR15OdZE3JhMPb4LxLtVc2nlb4omthRnVMx55Anwt4rgs+\nx2RZPib1yhu8xsf7AMVwf8tCsvHt+FwjxhUjBtwPMX5vrDOKWKnAnkBkhQLr\nvADHxo59KK4SwVsZPGF5dxnOZcu34tWpQZgXU+UnYi2FE4h37sw6A58FFs3w\nIqfcF9RaupeJOZ0Ms8BGmFjF9RI3Md9TBmV1kCoN1DQwYlmACSSIpG3J9BoP\ng01aHDb+axDDDZTyVQpke2gvoK1Sbhn/54GQoeqAH5roiBMH+STm8hIvHGot\nNCI8QZnGkEteim1+OknyGtdhpqbWWCGr2xmXebfyT+Pp8ToFVFIwgvxQue+A\nVhNWkUGoIfH4hDCRlki3w+DtsGDjqGnM/FOQcRtcvygscxRPNtHTxFotSk70\nFR6KKF47hueYJ7m6i4Um2uw9n1nOCjCShO/o3pvjW1I7V2i0a2emNw8ncM1M\n9DGWFMz2H9lO35zBw14sBQvTkFegP7YzZYS5eZHN4VpU4kTVDjm5BlfyOFTQ\noWpXqLaWVfrXAgkhTQIdjNMzuIPjN5K/IH9mOa6uTHu5UfF4LDZqyDW5QjyN\nB0t0\r\n=zqje\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIACKxXHXHi2kQ0v7L55ngrZMpKUAshrUmlIYMFWoi4D9AiEA7s+dCg1Ew9KWNlMzvwRJblNojDKUNKHobjrezZdv29Y="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2091_1607213694235_0.8388351711276314"},"_hasShrinkwrap":false},"2.0.0-nightly.2093":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2093","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"22dd5b928d1dcc4d54cd7f5338a9af8735b30b09","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2093","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-VD7mbZSspnBLzDIAMoyyqRejWV+IcRnyLn9oyYhZoTXGJOt1QvN9Nmk8F1dFtyJ+dWoQ3YT7TnD7kkxOrSaFeQ==","shasum":"ab32b044d8fc8f5baf2eb03e9ed5126417b81f5c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2093.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfzXQCCRA9TVsSAnZWagAAHwsP/2sDj756DhhX0WWrlaWQ\nDLwp3gaqMwP7InLbLVoIg/Y7XilXJKxedBXIn7d8AMvhbJubg2Vux1U0vqT3\nE/M6aod4uurpNPBCW/QxrC2BI4PIPzE9YsxvQPDN5x3/9yHtJeEaBgd4FJVc\npeh8xX+/NBKIsPX1A1tOi3eGStINo8hf7UdLGHF0gAMFd51df5yFyN0QR5kR\n/zO3Vh57dSsQsynfELghwGva3qOI5E10iBdX14EMYYShmpzmDwZyvs5GjE8a\ne+mm6PAG0NEVlph8PqkKhB24FXOL6IKrwfetGBlD3VdPFLfHdSinL7ju8KDH\nkWJl5N4hwSA8wLweP8XMr6OZgVTDNPygqv7dPY0fS4mR8B0dHgq/hcw/7lHo\n7heh+qJGwwhopxoulOWiP0dxllvTCfdnSfEFdYw/agmS8Pvzb/yGUp84RmgC\n0rsL1mWuaCuN1DS2wNeXyGGq+PI07jc57EdxOqJvUlnw+gmvzkOOfF4ypg8K\nsv8nb0VwJLhQl6yM36ND8Xss1fGVL832AN9xxSbecPXptTdBxMm9NALTqePC\nfkB3SHW+6CTNDH1HllPPBaWC1DS+Q80XOcKetz5r32aY7mDIPmEky7sRKJG9\nGeJbVQJswym6b3lemUcY9rETCwSaS9SIkpp2Vvvz3g4H+G7A4a9bW+v1Obuf\nRanH\r\n=6pUO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9MylDy052iznR1CRkMG13HPVxe+G3dBITuDE41Rx3IwIgbBmc/OLoBRVTDiS4zduFBLfNJ3QjJjWFLIdp7rOc68U="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2093_1607300098456_0.9165732836954332"},"_hasShrinkwrap":false},"2.0.0-nightly.2096":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2096","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a23db0bb2a545a2e717939dc7cc752170fe12e22","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2096","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-wlkelFrxm0GQWqfgPF8THc8Ol/kqq2FUDXNTXB1AXheFw1jdLjSamLZSF4MH00y4idKdlpWIcUAKH9PWz/nlfw==","shasum":"f34bff9f0cb02a10fb7cc7206c6c090949c10efb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2096.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfzsVWCRA9TVsSAnZWagAAccMP/i3AnvbUol5wLU2jHImQ\nDOe5JAXPCI78VWucq9DXRoOjPseaZhILC5kXVGeHjO+GUcRRyl+6MlxLZbWl\naWj5aiSq21BLbubAgn650uvB2sp/Ikh3VATAttNgrc5pcMXRUfqBrQFhlcrb\nh20T5RCxCGFFpfNAUtWLBsxtvs/dhwDm2BxLc5lfEm6+g6guYCdD4dQ4Egz1\n0mYnp2GSDmwF7Wm5aBbANcTLNPOEuqvxkyVbe4ZmBvPgqNbWVoRibBtQT4sB\n1PImLc8nCPMsrNlRUQNxpHjuqtUI/OTu49YS1uxYDVz586FM8LuKcT78Te6X\nVxkcOpoZYN0s0NcRMdBUFiQXxkuFvrq4uznsn6c4mliAybPRT5cYNVOHiJU8\nX7sdTUkVl+o9eULML1nzt3WZP23D36fPkygY+eZRa/FoBmuMItj3brUvRMDa\n0ZqTJO7tcu+WgYaPG74QtLPWw3tWlkmk5eAxfqgxIRFFrPhkcgO+hSCIPdv6\nQdvULKFPgR4yET07C+qP1UBg+XbDzi/xOfW994H9MPTSjVscan+pze1BIPf/\nze3CezWTUu4wr6kWkKRvByjbND/fsAflB8pUn9qhU9NFbma9oG2lcyImBp3t\n7mYfmGmH9F5JqvaM6QzkMikpo5tGPRDju9bcZOhsCL7qasyDZVoHuCvI/0RE\nXkQT\r\n=3jxk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCepNZ64Hg9xEZ9EmaXmR/ErrCYbxBBymeywCwCv4RHrgIgEzm7GGQBjQoPqNktOr/pi4x02vQeDRG15CyiG33wbRQ="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2096_1607386454052_0.3385196748869823"},"_hasShrinkwrap":false},"2.0.0-nightly.2098":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2098","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"87542ce3d4c55628afbc659903ba190844d224f7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2098","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-dGRQG8L4oGOP/us5U+Sy7CLfNaFXuaaRIMkeAvzqJHqFXnKvaSO+aD36VJLLTUpYgw9W2mNR8iJow7nY3zFZew==","shasum":"dd753f9381e22503797d525e5a1b56207cdf7907","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2098.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0BbQCRA9TVsSAnZWagAA4XsP/0GbfTQyxSMGviDg9Nfy\nYYCoXJK5Wc/Jmzdnyvf1n8AbgaSLycEWdp+oIaG0LKVDxp4couCRYc+vY7if\nxH8OXcsbOUdpMQOauDjy6rel62NcLsFWYG2jQFAtKRtp7gNHlrFaenetPwo1\nZiQ2OBnzBJ0YCzu8k9Eryrufb5vODNTcb4NytPpVyKk+y6EQdZ+eYnrhZLUK\n8Uj0+gxwF8RBFhpZllCgR7qlCw449oDDa7H1z5RYq+0uYbAlsoukNABBVqck\nNlFbz4Z2W2IjbrNM6duhOGqd6NcYMRWRpvxBpnxMq4EGyM7zEPYk3TS8Pd1+\nj86QGj0U+7QSHxi92wZiJz/PVrU5Oo6SRx7kKRewQc1pkXtzorWtwURR5O4O\nRCHRKh1p7Bc0n7MHFItb4HYQFD8M/Y6ymKYUL/VV0mLuOT0WYuKOvszdxP1E\nvrtd3Lg8cWZCJxMIEeObgVzKIBCIZn0/wUeWc4KmvHcwi8uF3MruA0lp9p/S\nhjlO1kVMD2F4RB6Kxp5fv6uQBNvIpLUy/k1vy8E94UkVmhcdfhkNOWnBHOJx\n/G8xy43bI0nA27Vn8kRCzhrptWw03TbUR5KBXZUTA2jsmnHGWU5R8ayNzBXC\nQ7x5Vp96uBA2Vh6pd+aqftTqERcugRi0zjQapNhGWnAxeo+edFtitfg9H7Yh\nyN0Q\r\n=gwHl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHKbNn+l4jwOl9RVSGKATQoVit5yprJRyVEKRoyryf+PAiEAqOYTg7kwsI18VYX9/xbvzYW8+p+G/azgKTv90g+wGiM="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2098_1607472848199_0.06985064023000187"},"_hasShrinkwrap":false},"2.0.0-nightly.2099":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2099","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"f33c5cd400cdbc7500a53b8f7fd679efe25a3a16","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2099","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-tiTTL9DfcOpu64EzVvx4y/Ja7sHzWRhpvOibYm72i0uiSorM/KcHenwULU2E84tdiZ5HnoOaLN8KQRQZ+Sthpg==","shasum":"46c5540054521523f1bcecfd9adfcd851805453e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2099.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0Wh4CRA9TVsSAnZWagAAMPMP/01YnH2yXkQmDkOJINE1\nVqRxoVzgRmIBCiLkOHbemj9879YM+HojkK87UxUnnufeNnAPa7nDe1xDRGMM\n2uQp22b3tRlAjD2ucVTTPSemj6C/r7pIUXoHD8BaeJsOz9ie7UbYr3lAQ0ED\nKtSdUXKtQu0ol9jaEs5rJ/nXlNHW4ud4vfkUjCrlHxRx0JfaDYodDMhcEllN\netOxiNYfymX6qfRyFWzHy01UeQYjfOBQXJ9cW6ho0R8/uUotyAIjpBOA24EB\nwAjIRMGZS2vSKHh/Fzfe7fbKgdgpfcxvHVp0iSpRTk52G1vAhDorXDIppy1D\nHHJr/bPZEAdvovw5y2txXNiKZXiUluthoLFHeCFq5C/wUtyTGmQLP5UtRz0k\nRyXXLQFIBxYe2qsANOwdIMhnfjFcOJNGPbtc20PdKHjMmyqVO0Hl1G06Qrxx\neUeOCgpyq4EtACME2d/3AE5yBorrKj8sKQF4u43wI9FqMHRfqarnsFyQLhoI\nzL6lUYHufL2AQLjhLIseIEVE2zHfDr3Q34tsUPlZ5yKo7Mh40U8Ab5zNgSkb\nlrWDa3SK7V8DgiTiXphp3O4n/tzdm7bA56mK2LSeyY6bEhVvgXMXHuKUlGau\nl5sZMia5P4sn8xtdEWM07lWikAgc4phdFsLrTZecicytj83WByYeeno74x4A\nEVLV\r\n=mTKl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHbVv50fFs6iMDi9ScH+LfYwrNhYXAs2W/fmvi4WWK/IAiBdKo9RmQ3HOHSK1R7wZCq2UfGXj6nwxZBxGWD7EZAFyQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2099_1607559287970_0.34690573499502464"},"_hasShrinkwrap":false},"2.0.0-nightly.2100":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2100","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"90a3f012ccada0e5f80d9aac0dda3e08f21053d1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2100","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-kyn5+QJxIje55ULPa/F6J9qDmb0X0HH2DtoAzoO5flSi7x5cKKxlXbNm08nrVLRhsdF2srAP7Tdm22qDKkcScQ==","shasum":"cc0869e14f1ca8a0a4f3d156b51a487ed915c6ac","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2100.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0rn0CRA9TVsSAnZWagAAEhkP/0OiYHL8/tg2qfPZN8iK\nXw7sKWXcR1ffWMzuzVgeHXO9eFKTcn3sG2nlUsQet/8gylPMzyIGqH/HsnDd\nQHl7WWtH93BdVuYunq5rjnFoORJTpRZFNlzCKfAtDiB7UG33x3QODwZ0NCXI\ndnKi/lCtmVw73HXPYUJbiyUsqTPIMA/K4/XWwk8fwvgKjiOBNMiUglDNoGaD\nV80WsXx7w+DCFJZgfdUgzrTZj8N0AlfaVnFXp3A7SjeteGZtrEKi9V91Bcnn\nWlzyRHd9zTYpBKECMdV53V1opAI+CMzoN62eByYnvt3lKF95vw1ZkwONiFDM\n807XMI9e0tSp0a1WkkzXR1NYzLkU/h1rlOjS8cyxIsps/OapdGwauhIZjOx3\nqoYProsTbRMzvlcE9jrYy9GKzdIOmaw4Vhk7XeBiDscVIoevpnQvyRHq4ZN2\n3Po4wOjFwekdjGdFhB2L7IG1c1GXeNOQ8qSizKHVMM+sfVLO4R5AzhtQm67e\nFlfl/CFDWDSP/C/0Tn9/9Lose+tbdP/SItQ3SMZvamqcT6Cf37xipoLipMBb\nZeQqxGrGnHrGYXRShUp/luZsQIVaCfiNLBqU64/08gf1VZNnYEg1cVyM8Ymn\ntpo1LW8pt5lFjhHGbKg7zYFf8JhUA70q46U3bXwoBAd/taOo+Df0y34XxRf/\nMWEz\r\n=hDGz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH1jZLexdbApbwE927wH6JZLXvjnXlSP5tZGCaDyDG45AiBkM5W5TvTeg5UbrpnsIJ6sdXTrLi8r4/xqgYHjS541+g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2100_1607645684018_0.4238554325318098"},"_hasShrinkwrap":false},"2.0.0-nightly.2101":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2101","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"ed6b43b673071038fccc637dac50fb9f0a15c7e3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2101","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-zuVcXB9g8Yc/p0LFaP0NlT8VfFmxnSEhwgcoiNbE6h0EhsmCmbzf4qt15f9ZpSXuSzum8bxvRwsITrpd+Ftp0w==","shasum":"1ce952d76b7d93c7519647f071d09fdb289b18a1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2101.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1q6ICRA9TVsSAnZWagAAhycP/iwKT041WfCpnVYgJ+Do\nfEO6Ad4wRWYJ7HzOAUkOdc+HWgP5i+1Qq7vjfmNxWN6SrEro2cJhrfO75n2A\nKfKKHeFlGLTc4bLpjZlIi8VqaNcW92gDFtENpzstiNd9ZGKMt89WUbXPj+Yb\nggWkSXxZ3aIMG/rD/OKFyOTZxhVW7YbfMiwY55OW8GCoWv2jH6L95dq2WStP\njOfe025nFMXsCasteP3LwJ9WVIPT2If+KMw7F8OQrwxk3tv3TKkV9cvjUdQC\nMe/VGp8AK23K+32iI3/t5/Dl0T8fgKRQ//20m7JSt6NzP7P24hKznR49Y2Xe\nMaAVzHamg+3371wiOck9UnS7pHlbkU5W373TSXy5S1nsLrJOlb1ynvtSKM2t\nHv9vnDhNBa8YkKbQl3w4HXXJ91LRLT79tQ2F/cqpHXhADgMDC9JMwNHWcHzx\nb5c0mEUaqdR7F6pjGdXCE9/3HBjBDSRG48tHg7wcX9pgckErR76AXcTW/ruu\nnUuiBHHG8oRHw5Vwzm9xZfTzgnRIDg4taGOwEOBiwiNdcncyscZ8wSb5YzUY\n0sPwyMlbmK67zgsehKjEP3ZxzTnA4yrwHEd7qJyTHdsqHnEM2lHxi/8x97pl\n+xuvQmGGZKSy8MQKr0BGy1N9NStzm9hBcVz+vJ5rTg4UUTq+LNvlZxPuMdBC\nFeOO\r\n=WGOG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDf0aXo1QfAdNP+qL8jjl1EGFFHkFyhaup/axwRuoiMAIgJuuaQGuVE4lvg8RNdj7XuIqZFt3achD2XstREj4eEyA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2101_1607904904242_0.7273429327262271"},"_hasShrinkwrap":false},"2.0.0-nightly.2103":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2103","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"e6df5842da3500fedec890faacabe10353eac295","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2103","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-cH5t+TdMh5XlQIaiNdobKeNUIYUvEPdWLyy1i0lwVt9Q//SnlOUu17o2i8K/jMeWPMH03X0V2smqNuk4vdEIxA==","shasum":"d712d84ba136bb5dd7187bbdc80b0dc75f86fdf5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2103.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf1//qCRA9TVsSAnZWagAASxIQAI30tLl78MNJFL0hkTQB\n7bkn3Cmy+7R5oi6Ex5aRYm6T0FSRLLTywskj3ijWrNXY/PEldNYpdr5z55pw\nXPDwAxYhvPpPcrdVqY12t6rA8TpkbGJ9MxO84T3ytJ+N4xqdCyW3AVmoi7p5\nzqManfLq7vGCTYHIbeNlPGKEXXHC/f/wszijunshL6HCQd6Wu89izfMaQpey\ngeg9gp3rbBfd3BRXQcRS+6w2k1/bW0/Mj/ou7SUvW8y8x9oScv3hhByOQA4R\nNw2IHeomnXkicoV9sb5G6o+v26KPT2PdI6rtd2Oizl67YngPr5kCyl7cuf8F\n66IN6JM+07B9IHsCk2XRtFj8mVdvfZHOXA3in1irAn1uH2yKpqSPJlNm6fBa\nfBS25dcW5HlmiaGMEKz8aODsl3LNmQFOCOXDB5eIwG52xJPY7JDq6/IQ8Fa3\n8fyXxhUhD1119e6Hvb9GUWrSLBpMsG6y0ZI9kAWHJQkug/Tx96aiaRNiqBey\ndkUxq0wfYWKwKy+YWQ7142uSO8UXaw6OMLQeR5dfrbJn33kKldOObTg/5ku1\nYwqG9N4F6gCKTeILYUJMz0sbjQShAE2cllKE6kKVyzcDmuP7XO3ubFyspjA0\n3z+dfu6u9L+5ysjK9xGxF8dNgLvzIHPhbzS0mMnbFpliUhcZOH9N/DX06mTB\n4cNa\r\n=qnJg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID1KmMJ6lDZ6Fxa2vb4nS7ghbC9MBhCaGwBCIlaBNfZEAiEAmR2tirYV+yomE3Is5wr03wDaY5ojALCxujhbwD3Ub6E="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2103_1607991274444_0.546934170248853"},"_hasShrinkwrap":false},"2.0.0-nightly.2105":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2105","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"a4cf3e958ea1136b4829eb93615fba5328213471","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2105","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-c/Fmle3HLuzs+5aAWmlghHkEMWsi0VYhfe0/cQ2BkSCEL7g48dEwaVKr7zjF0TSlKkvJt+Q5Ci2Ps9SFu9V0YA==","shasum":"49a825ed8c58f06ce9b58261a383080847d565b0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2105.tgz","fileCount":9,"unpackedSize":33751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2VF8CRA9TVsSAnZWagAAr40P/jUEwvTaAXLq1c9bVnMt\nm+ep7pnsowXd4KHkbpr+3qbkU52UkJMD/UihprIBNMDyxfINo8G2LhiihVLH\nPWLBuhOfGY8uK+qP1fCRRfBEB+VNWAeFulO0FpzbvJ0tgec9axVDw/r/LB6Z\nW64c5UwC+bR1mUgO6oeNFiqB5LeZYKLAGIcezvmmOqEMyAhP82RnvfTuC/R3\nTMHvn3dmxqfz/NK9+Qf2ygbJKrSlSEsr6X8mzre2gqMcmxVFdJvErY5+50fy\ny33GtIjd9FvXFh/gjBC9+M96e/dRD7fhwv0bowve4RNsCqK9oLdyxTojANbk\nhb6O8aXWEzLY0vP4/pGtpt7XzKOFizChfspULX8C4AX6hiN98no78N50ky9r\nyHyLUHnX1w34yZpPRj9HcpDXujlSVrqwTxFrG/8XLqmlAWLAOwCMjNo4WaEU\nWH+gh1cbPkEIOO5KGM0dEFTia1yLbD3keb2uJVHSnPGoDJsBdopos2w2dpwc\no6JFcKd4j9QueIqVmI5A833gd5zvsqTkMeB5G57w+nZ+TCm804nGNUEUFlg7\njgt0wpH+kW1De7VAzyibB3Q0xI5qFxsVAABC51Rua809fsnmRYwNAMDILZ/o\nbO1eEfGMN+OIBJkYMLSIKLRkFTo8o7XvsDveSSurHEKPuCzWE/2AvJuaCttD\nTNmT\r\n=EzD4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIERlhaub+VDObwBgmpkVqk0s6nK1QF3tv2guwcv3Aqj0AiEAikHSZjJYIxO93o7ncgxGy5a6vpJYkG4o0gAFya820wU="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2105_1608077692460_0.6881555202489826"},"_hasShrinkwrap":false},"2.0.0-nightly.2109":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2109","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.0.0","lodash.clone":"^4.5.0"},"gitHead":"8fdb9581c35d121b7c6d5bd2fce4b2719dd26477","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2109","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-7vUo8akR7S3abOFnxxOo0zMikAx0f8ceHj7tUng6L9PMLUV3+efZYlC+KAN5FByTZpp8ofXfP6CgIZuA56/c6A==","shasum":"e149fe56fec82d8b91f1c6ac57dfdeeb5315d2d8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2109.tgz","fileCount":15,"unpackedSize":73181,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3UZlCRA9TVsSAnZWagAAZsYP/38ZOThTT2iBfEAPdpQR\nNUKh6rF0r61os7Pdc3dEOhdLz+EQ1DYC7WG2pwWzFvdXI34uNV0QeIm4G5dh\nNPrsepSU8f7J2EwtPI4rn3QY/p4Hsg3sI0uvAn805IJiKWzPAgTqsKGerIZ0\n+a4I8V23ptHTp4SLcGbUXj8j+lvD4soDIvYkCSZHKra2gwOSqBW19mhSuysI\nbrbawUDyRm9XhJFRhIbiketYza411TOZcjHqgbG73dsHYjrgS/PxYbS9En+N\ntqOORlKoqKRJEelLGfsmd54hNZ9hzvPXWw5/ic6sQQExeuUtUyq9RuyTYRH0\nUYamDdoZ4KG28abDf+NfdsShVvNiaXqWBHnmOELob+vcHtzYqPjvHqR4uZV5\nvWG80wWgLn2OpcOL+6obM5nqk7Q5BGrPCgvMFjZYG5V2g37dPpUqv8tPEnIJ\nZZPQ+pzkqCGt+d1sdCdQnnDsN6HbDR7tBpKQDnIQ2ToGWzFRSkBu1j6re/vB\nEnQ/SwMWnlO8Cf23nmKy3NcdnFKJZZfM9A3wWngvVJbbA3awRH6rR4Tk7qib\nxxGv4N+hGwc3pIaokRjv8Il9qjzJHhN4el991ryRbOHWTJrelnmzk3WnwcmM\n4rnKcRBq0mK0bFco+SAHcAvhZSIcrcA/4jhAMShBTeKNoNYcRjooru5Dkqy0\nXoDy\r\n=fFxc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRmj4rEU3JGDWpVXfTVEinZgxQ8ZKXVkbApsoO2oz77AIgeNp52SYM1SeodRt/u5bSik44fpYcFnl67s2/Eoe8IL8="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2109_1608336997062_0.924908393205903"},"_hasShrinkwrap":false},"2.0.0-nightly.2110":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2110","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"f89e5ef87fcb58e6131475b5218f188cc231a1d9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2110","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-/pvwRFAHmZbcKtlylevuUZJu6mCngoC4/2SY59CWJnLECstXWxaXrC7iIuDa+ziSpoyJdrt3IMf1lE5CLAS4ow==","shasum":"e924d50d9f97b6c9224a5fab531524de3d8fda58","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2110.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3pfBCRA9TVsSAnZWagAArJgQAJ8p8Hk2PpiihkJTNL8F\nAS1Hn2aHaCM0bSqIUg1NUd4lJgao5LyvkI2xZgLFlW09nShXI2l7C0SUA2eA\npzSWc+njujFVc2KHuaImwYvYNGfJF1ivjEL2rL+qvZ+f2r8dioPMQrEdH02l\nRHibQLCf8TD4vYs9EaL06T9hFyrd4DfX1uO15ss0ffTf979z8GJW8Tm0xQj7\nmFIOSvy/hAOL84wBhyADPLff4DTKT1e1GNaE+UvtFgUcYWzNk6fkEB2VAeoV\nI2Xm5aquPjjD7vrb3mqpnAbLbwEa3rm7l0RxpAAE0gbRwCHw96jAp+vWA9DE\nQ1yUitI9IFFvHYpLQKhUY9T+y8C4WvsdpEzXdbdVfG1QhvgeBjEU/R8HcCw6\nuzvjQc4/22e1Qbh4Vh/xxZE/ImBhZ/JEXwux04Oc/Ue2fUmHixvnZp50dtCk\npKMnQP4Xg5z2KNOzOdemTq4bSLcTwtOzhJrjh7f2JxcqQVvWu30MGI4ts9A5\nr4GMy7GMxpi+svykEHI7lgPhasx2wfT8h/klLOUeNQeaZx5ozm+x+CoOq1M1\nw4IX0aibd/7g/bM+9xn4H7eLPfh1rk5XHyDC34B0VAJbQxs7DgWVNVRHQkd/\nljkPybV/3nGZV09KFJv6OJN6/iUbXGnZ0h+rNT8DMv0Bmm3uRqOyRKAmyef1\noHzt\r\n=QJbT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+7Zx66GYWkcq/yHcH1C8860pg0a/XsOYOPtM1MkVX7AiBoWT08fW5T+HtYGro3jlMI7GCpauGM4zoT9++DiH5Kkg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2110_1608423360702_0.6959861929855731"},"_hasShrinkwrap":false},"2.0.0-nightly.2113":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2113","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"96cdc44690688a6dd7f0943d14022f3c4ab57503","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2113","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-Ri21MMXXDokek1dAWIZYB74wGozCNDM3gdbkKAlJQktL3jzSwriEEVqX0GYHDyJjyUi1HbStcF3IwufV/9TxMg==","shasum":"fa160aaf69af04f6146eb66622feec16f498bfcb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2113.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf49/YCRA9TVsSAnZWagAA6BMP/RWMStpJU5JvbIvIjYUD\n4i9xTHgS6Kgyyp8FGJs25lFYW6YyOHWlzAaBJGHoluSzQ7/Zvrc2aR8JlX5i\nfT3NDw1OgO8M/6lMXGleJA4tNbpkIuSGwV3nnY8jddFW5xgF2zYqmAubmLgH\nM0yb5U6bqRRHOle92qouCdy7ZQhw49JcgZLxOoTyaC1ODyOnHYynSXazIJTM\ndWVfmYwRVCZoK1G0XG3/hxPrOVdW9bNrWubZ661qpvt54RK5Fki5gGXC2qM6\n129Xyu8KdbSW1EI962Qu48oMT3gZITZPonyiSxheqxEgIh6L1Xw0Vr4pkmli\nnHSJKNSDwPECMCFVT26RFqytBfN+iB0HvHCJAoiFnr/psObBE+nL3nFjfDyl\nOUkmmmofFnD7YqSCy5J4eXq1UP7CULiQ5+sBOsNZIs0LtwJNBZ/2SHB8ir4u\nrB6Uolykvb9qdkCBE8iIMXJwOSF1vCH/5uecB15sC8SzbWLh9+fc3Oq9Rl6h\nsw7VfK1USFJIV1L9+sbHt2JWVDcnMitr7i9hwH9MJLs0UOUD2s7MsKhQYpZi\nFwGpUxAzb7/VyxwTK60VyDrRWivfDIRJlLxP6Y0XZ3wfzTzYDQ+RVToUtOi/\nvN+wmyXLAWUOwUoK4/wCshpD1gOR/vhDLhhnFpHsv67mCmgAW7QudGao4rmW\nVV1K\r\n=aYOR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBDGUTFF1/66DBelkygnifeVygRLgZsiBe4IGbd8sUvhAiAC7w2yrT7I4JOMTVnP0GRCiOSlfpMMmyL8ghA/09G93Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2113_1608769495721_0.6871233253681606"},"_hasShrinkwrap":false},"2.0.0-nightly.2114":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2114","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"72e0894f13a3a18811fb90f8044dd49ddf7bd58f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2114","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-oUCiLsl0NmBPRMrpn/xEFmzE4KevT3Yj5drAfmQpRB5YhsIx1xNDuGaYvmk6ksSJtZf6G9wRAQLkP5Ip2O9nhw==","shasum":"511cac0fb9f63f34975a89d000c0bff6f716eaf4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2114.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5TCMCRA9TVsSAnZWagAAXL4P/jz/7cD0+DPhiciVjKxo\nNgpVGof3+HwWOicQmbsQiBdmfc+RhitYx1INipzdMS2z7qqeXzR2ngAf74qi\nPdmp2S/5MyuyfC9zh0JIZcZQ+FEAoPmFWSrJgxGM9L2fAOFJ3dgcpqSOswtS\nuysVQKYpCSc1Gbr2ofyFIfd/GP9qx+oE0aZmnJHbQzcsh4INKO2KD/7otyUd\nd8xncu/VVXZ8aAVgDUsirK6xr68cCGjTsydV1r4i3/wCMarDzDo8aCjzaHQM\n2of3+l1MaEmIogvYBqdvU/UZTxvFdGspyD0xKn6nPT//hMTGQ3oTbm35BfBF\nWnJZJ6F/QEPQtauU+6gOFNEJvWaszrFBlVQozlklzMCp27Ql+cuOco2i8HW7\nAue0X2UkDu/8DMWZkeiF0nQiWHXIoKzcG8ELNxEIA+xWMMhnyLfGC6RXGoUb\nevf4FTpWqwJSXSlfczJtsMQo4aVZiml4NG4f9ZwNTWYk7cT0NCtb1k2zyJx4\nGHOEmzQF+kJKiv0fIidSO0+eBwGcdVWLOJ9vUASW4hgVGkIUNGgiS6+8r0An\ncA5+5itRMdDOiAIIV56q277KohvCP1bxT4ouFmC08zJdHCqM0Od0K3H3+qsv\n++1H6/hqef9k/WXllrrJh1cXmaf1Gagudy9adF6qvmfWDvhQIN/j4oLyeZaI\nHGL5\r\n=JXUe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIByhtdm8G9/iXA4zIttmlcPp3UkwDQC8j+0guZKVqkKqAiABJoo+6o3ce2XNfQ+7aEPWOhO49FbfzgcO3OsSdZqPOg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2114_1608855691762_0.9092427482462977"},"_hasShrinkwrap":false},"2.0.0-nightly.2115":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2115","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"e6a2a6312a472e70c353b3de9978b4f2a2b3406f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2115","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-Ou0ScTDCPDaeMMBmknvFTLmfPX3Ok3rGfR1QBZc0CumwngnBhxirD7scUD4/JbNcHq0DRp2azoXU+xCJublJig==","shasum":"96c85780d91dd1c1d2d8b51bb5d896d46d617bd0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2115.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5oGcCRA9TVsSAnZWagAAIFYQAJ/agSIFr4zUyQfaXrVc\nKkU0JZoe3rVSSGViIoFvCHsMNMuNg3g/UiW1HQvqvt8OU2rIQzJ+VkhE7Lt+\n7OmMYe454cyi/wx0oTe/L3BY0pcNu5KaFIHfQdWmnS5XegHqrLZKOZzkLGDJ\n/acWpW7pG6IGVJQpXqeejIpX36z74+hhesSZQrKf1T+5CxqiojEHK7XOeCdw\nLww5oYR92FKmu1VEDbw27UZKhMmoLZNUTiuSP0dergY427sQzd17j4gW2WB4\nAVvHSCrCQi2xX0zz3ZCeTpjopgd9nj9fq/yDiwUqZUX7ZOySA+CcOx2hDYwW\nQPYibUxMm6g4EzVnkcU551qFXm9gnmUZi2ZRw2BRTmH5wZpVBkax62A5gwof\njDbr96/ySl1RXwx8kFY+Bfus8/1vOOQjxkK6RIwlZEd1K7r+n7bLLmSIb6VF\nsSlj32EWppFtFJE+k8dx3LeVkvWI4rUZQQT8TkdORV/P2svR+htHNlJyr4Df\nsMY22zkaCGZV1GWTsnBzlmpLgH/BGF80HGkGKiQgsbDioPFZ2SuObRjyJCGb\nI8kvld+KL1nlWh9mNI+hbLlQ9+a5kiYTfjrO7VSPvuFHHBmmbjIUSDuq2BBB\njSfqZcEjnbEFuDu019M7LPJ6+uFzCGpHdqF/04stxlzqaJh8StSGE5EKiXY/\nKwSF\r\n=7zlD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5F07paWHwacl8Qpt6ayXLRo/SgHF5zsm9OCl5N00FpAIgK7f38CxCRjyVToggQ7C8quR3B5JwDktlq8IxgpzPrV8="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2115_1608941980475_0.041563730525190135"},"_hasShrinkwrap":false},"2.0.0-nightly.2116":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2116","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"50d599dbcba25b1a5a1117aad09b77e498066a17","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2116","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-86LQ6AWHhYfoD3YRUedcVGPsmyp6pVMW5CGQeLuCVVImnub5pvlEW/pgnHUxgKeSPv/IW8TVygJpxL7IJWYD/w==","shasum":"8316d716fc37bf68aa63340e84cde95340acd4d0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2116.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6nbRCRA9TVsSAnZWagAAb8kP/0K5QQlfUGVfu0cpLv1S\nfvNeM/PIytYNX2ja23GmrZcVxM+qwYdViUzPR3fLMV2ewCMT7B88ZEqm4gML\n5ubEmGXaHD7st1fPFK4erciKGKb8oOy3XK7lZmANGRYgvyov/bk/8sjoa1Wd\nntMVX7JLQ3EaumhTVpQ+0oJr2kIKlIWcHVR4G3Jeko6rfpZysZ2xNyG4ZwMb\nDaARVlMJ8LLS5zXGLLKoHFYmlu1Vwm0xY2e1nOobKfCls4EutpcBj4HcsSIR\nqofZTX14N1yH7rWlD9YAVajBBfaKQ1Y5fLwFU3C05fqDLbBTNEMAEnmeTgDh\n5WS4NvSdWzaDVbRSw6JKAtRIgptambVCyEeexljxvlEbf0nl0OmdnNzuNj/K\nCNLixhjmsalMdzb2qCvn0xgp2P3hRcC8SZPE8wz3dNiQ2KxUrIkGYfuRMLYf\nGm803SmTJxCuy5rEqRvhVy8RbVo5ldC9DzqdufmzoqdMqWfwBvKgtj42dZnc\niyuQ/6yPUEGB/sExbs0+CXuWVfwsWTDStQxmWUanAUZ2xEXkxPOTSkziAPx1\n+XU8abY37C6ReU8ros4mNSz9kyszIPYkoBAsnCscHsfN1kfPYuZ60ocLVVoh\nx4UZwnFEfI1WWqnu8LQK6eLSwAmVyAXuepd1j2nPatLy7lNiW3ofeZ8I3W29\n5qdZ\r\n=WlcB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQanbs4x/AYy7HjS7TnFQeJJR4l1aflOmqNnOMeYSXHAIhAMQ1p5yHc7myfcjCX5KfYlVtLmNqt1SlaDCWvduByNrh"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2116_1609201361184_0.7752619101433709"},"_hasShrinkwrap":false},"2.0.0-nightly.2119":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2119","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 10.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"f62c5442ba7624f682d21409162e00b1e8369a12","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2119","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-m2tlZLQfYt76rP2dxmJioAUqzjPkqeielaZwDHMQ1WupUgFt36fecwp17+R17zXa1urX71Sti8iaFYM2SXrWOA==","shasum":"c898e76b1615879f51839c02b978aef02d419a12","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2119.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf68izCRA9TVsSAnZWagAAAW4QAKSTZWaJM9F0CPevdJN6\n+zgkaIslKEospqCgeeBl0RqGjZjbmXzGWv+RgEpN1tQW8u97j4VAH2sL25Ym\nQuzZebSmyONBteTBSY94xuBv0NoEK2xlPaDg2ph8hSoO+ObOU+L1QFaHKqaX\nHdqpwZV8XBFG0kW+3LXvcq8tAqZwSwb4lUAscK7s/CI2iM75pRQ0q6+wWCyU\njBhE7WWBANQ2o4EQ6fU3erh6a2jPf6HyW/9uW1lj7pZypjHDwkXLYfJEpMUs\n837JRS3FEX1aYsT7lcRcW5jTmx3638zFh3uCo7Z4AmrxxNyoFJq+M5PyZuuc\nJ2GE7qv6CGI4a2zeE48QywfqVxndqA8Y+zuH0H3PDbXXBTEYB6WRf5/QM66o\nyqyeA45cwK/tA2Bvb9mt5DASkBcSRghhBtf7RWKRkshElSiIo0g7Nw03G9lM\n5f9F7UE5sFdDBoziKLnbSevztGkPRnXMlDOka2nEZk44SZ9TUFym2e/fqb2+\n/plLjc3DLGuLnQ/fZz0G42ZePvh4zErBnxOET4aFER+Vu+L3W0D4g1sRUebJ\nq5HLpj4DxRVTj4r9s4cJWvqF18nGyg7iws9u66exGDD6h9wcTHG4ftRHDZmB\nEU6MRa8WSfcAw+578cCvYztAWfjwxBLbJXv0TNnRrmRVJUv3UHIL2K2aVEAI\ncxFF\r\n=U2fV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDaPJHAm/lSFXx2vtCULa+ovOYwI872huDY8Z96Ce8KnAIgWSE2CwjelemN3aHviN55hfyNZYRpMn4oULGDHSmc+eI="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2119_1609287858694_0.5979269640037463"},"_hasShrinkwrap":false},"2.0.0-nightly.2120":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2120","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"67aefd83f8a32813aa86c904952d6ceb63eb235c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2120","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-rLrY/yqXo+Bc5LrzH7Tk6M+ATJPVQZPK8S0UIUeZKPt5HyPt7w0e3dit1OrSAOmxuGcjcdhXFUdQRSC8CW18Qw==","shasum":"9db7093735756f1ee4275ba1bfcf01185240e70d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2120.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7RqaCRA9TVsSAnZWagAAUS4P/0vUsHAUyLUqwaqqSzEA\nyoj9d/ixeupUyZJcKPdJJxaroT5isgds/wFenhJVoXK8GCVo+iYcXIigera5\n0TcwBgIb+MAopjiem6DeoYrl9/XqsvY6xkO8jFK2owCnprY+F722JQ0NR3BN\nLm+grdWr8l2eCP+dx5GWRIEeEsmZa2EHQkstGf74xBdzcpZU8Rnazz/HhpUY\nIViEvXgR0W3UtviCAjRWN9QN0E31e9WsaJnjJETlcKT5meOzcGaqto+vFGs0\nmjziYifd4wLSIGiP5zOLF2VDUwFE5ijCzRmlTnlS8Tctx6RKkZZiFdbvlmPU\ndEQCPp8MCayZD81/1VX3Akjl9pJnfYLbawLl6KYtw9ZlBIVm+oGv8j0cS6cM\nmK/+UTkIGY8QSUGgVXmXtTedX27PdNOJzf44Vl+ld/H7vho175I8MyxYaF1g\nKHd50TfgN9f+VAHbbiq0S25Z63z75o2AL5XCIf/FbQf8RrWBCIBiWNdgZlj+\na7JyNWmZctyap1h1jMKvqniZSKAMtJzFOXzZhwXrEkV9at5Ylh4V6HEOf6zJ\nVcMwR0ahLX3kHJQaIgVQVyRfEDOIOr/3Tg2N453x135+js/OQ1blPdyRlD9O\nNW+STyCOdD0sFY42XSKbEXLhNdX4BTDxNlBCrOFPDKwml6ZOOjtzho5yBHhL\n2KY8\r\n=MRfc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFf58H7XZc94PLsHsj5vj3JV7eLc3tDrvhVssY5tfTmJAiBVyXrlFP8KIOYpXnD0J5/e1u5La7tYz9Ug82NA1CgNuw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2120_1609374361939_0.3039675690363879"},"_hasShrinkwrap":false},"2.0.0-nightly.2124":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2124","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"303a312ea5aa50e59755e30b8ee49fe354f041dc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2124","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-/cw/fgufulkoiGVmvmfDpV6L/9bc2CKSTu+XcpfGbRpIeuvZ8FT5z80l3qmGy53eG154SblfQzR485XysJ2Q+w==","shasum":"249da3982f17e975df5d7fdce40a2589a82e658a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2124.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7mvjCRA9TVsSAnZWagAAxqEP/3osCgvQfvnUujhrA5nK\naitPlWHLtFXUNOHTbJfC7VSe4uRjWT8qEtyf3qBThYHPUFVdrAf8eQmJytfS\nzV28SwRCyNol8egMx61MxsrTAuerQOA/bC399SUA3j0lHs7Y6xoqBt/G9ISg\nTZE4sBPy2Be9XE/iXlhdOpKbZcYBIHjOHNOKZrWxgCaHaqXbjiBqqFPwZZ5I\nBtf6+sJrbPSA9XtiaZyXPZ8D4uGD7z/QO6Tv8NmP+8dMZbKPPHuTPx/rqSQU\nMYVf6PUB14Bq88qfRK2mLGzl5RrylwWW4T/Q7FTWyGPi490z54AyaZdjRjrx\nbCg1i9f//F3XR647i7ggjDY/68ORo2WwCkeUoq33pFxe1vpAiJIUj/Dx5l0Y\nKQz4xK87ljmJMxVQZnSj3I7n8pyyUQWILfy3cHz2meB5cs9TF7hVGp/Yn0fy\n/NdoUxd9LUfjajsac+BUTVQkBzb5W5a23JKxotpRjQi1Q0Nv/+aqGu0HHyty\nLfJfi2d7kelY5fa30Xw4d7R8oqGVkqPVlXlg9GU0ZO5QCsn9YFaGuQT+uewf\nOAwjrMWBHU375aAUEbFGFHSW5a1B3UIbHodHsF0c3goRF/oiMrMD9wRZrMcL\nwTMwCqJatzPzRc7Qcym/+MdQnU6B4TJ/Ka1sb0znuIaNJX/GqQOwEj4dJ82p\nEHEv\r\n=cgx2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCK65UJrffwtfIgPBesstlheSR7uKA1Sh/c7L/6SK0gUgIgX1+ZQ7B9kS0AP2ZKfemjYQZ3IOTASEuO9sg0VQc96Ns="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2124_1609460707112_0.11838410351026729"},"_hasShrinkwrap":false},"2.0.0-nightly.2128":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2128","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"f96b0e18ece3e9288703d892377845a5ecf4b53c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2128","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-CguMP2iZEi0mgL6VIYjfDBWo3Qu/SPVmLmxD85j8ls9LsRXdIM+P6PRmH5YEAbYq2XhZBWPExZw1E0l5K8ed+Q==","shasum":"9307e81508ff92999e99cecead09113e75cfa131","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2128.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8RAsCRA9TVsSAnZWagAA9scP/3KLCpUJpXUDR6QTXFw+\n3aWBg+KEg0kLJ3PN2Y6RaSIy2LVJrFBQ4/c+kmvp7pcg686PoPmjlAwuOiBu\nf1/G8ZL+D0FyO02ett+DXasTm3+iU9f85Gd/VQGwNaK7dKl2yuJFE+UyJFwM\nwDQ1pP4TOwHGjSF+3OshhfRhDe2HA9nMPEGpKo2wtg3iJfVeTyqL/1Gg0XnG\njUwpn9/0TbyJdDAKiEouUaYlvAlwM2N0j6XYdskgXNpJccp/w6IFEGBcSIrC\n6JSid7ZD8/9thgqfHZPxZKUUwMN64qQCUDva15xfV79whK/jcIzCV2tzINw9\nitNt1RAPfRWT3eRhqzwYpDXRBmRSs6v+148FCfM4Hzf+r/pC24LQXotKEyDA\nzkX6O0JECFTD1zOY7KaVHs1LYjychrb7IwN84z85x59jTyvZWSrCZxKrB883\nHZ3Tik/aWmiWKO9v6T6KrNPHoqSuzntMqPj87S6oT4HTUjDkkiF8ulCqNP/o\noG+286oKvfzhdeEgK05ZuSPAuvfczXDqJtgMkYCB22nfQT0aaAcxV84+rgC+\nDGeAp6FrgI6QpWgUkuuh+uCAZPdX5paJPpdE/4/H4ngHmNuy5xJEefZKWHPW\nnZ/sRwJA/x5H/oo2nmOMYUeFGIWcfxX+jI3aazgvdCDnqgnlIMafW+DCFHWY\nF8YY\r\n=uLfJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4SifTjPt1pMMrhlzXSCBvSgIY8/EBoT58rBAwKhaHKAiAVynkR6QHHy3BaL1440t44W8rag2iJUFFDkjMGZw1Whw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2128_1609633836481_0.31635146978806716"},"_hasShrinkwrap":false},"2.0.0-nightly.2130":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2130","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"c09cb4d79388c06072137b420dd28339aa22d2b4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2130","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-VCTNq1lTztxnY9G/tx/SVtNG1MMOsJR1p60/sdeje61dm8bCFUeh08omNx+ovMg+snn7p0J74Y544aHKwld8AA==","shasum":"155d865745684c23a37faad7bf8b46d4b48379f5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2130.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf8gjdCRA9TVsSAnZWagAAUKwP/jPv7jB6zR3W7NoUMJdG\n/vmDSebMGKKLi+4MGHzk9MMMSOQMNyEt95txau8XVije6edpWYj9iFUiaU3l\nQl4NnyyoyZXWfEUEx2SzJZz/wJV5LuFGv7iWwgBHiyB2tG8d4z1FzycY1a+i\nVF6CtbpDyBxSaZPblyepi9l8Ks1PiqIpHMe8TXEMgbJfSBWZzSuhXkXsOM5H\nSphtFBuLF9+ivqSqx87dnJfzobmDn8sFoktTtwh6yw/BMSBGam5HZC/X0jbi\nAJU5/rA7z33Yj8K1ZofRxZQtS17xHppF5mML7odF5jchj7RxrEpWnfVUr6H0\nd/pZgURAjXnc6YwpxFqVd1g0Q179OPecqD/31+SmZhPlwXVL1tKNr0I2RPS7\nI97TLhWso27Vi109hIg+WYHGuUihPdAnfgcY5IsSQQZdRqR917EvJnrwazok\nYvdI5spUSJSXymBqYn5XnjYzAtYNUazZCDyR8Oub+DQjwDtU3zW3iqo+SyVP\nfNk4BPzQDVjEh4c6Wc5sxipupqjvdL74Vb4OCZ3Hde/aIS9RBqqDtjaJTP0b\nPhgi/hCB20UMJjg2ADq7kcDDrwCqKZNrtyjd0xOhH4Mji+bcnmWXwDBy6h9m\nzFusfjhhfUtmTDidvxljtk7OeKkXa4d9OlwxPUwZFLPoZe03rynvdSUiqvT6\njEHo\r\n=7yGA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAoVREIL/kHHm0tIgaonPkPCcLZgn3y0As7wgr9zpHU1AiEArmsircZnu83MgMb58yJhk8vM+Prurqax88JhS7tXJ3s="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2130_1609697500739_0.5589865867019908"},"_hasShrinkwrap":false},"2.0.0-nightly.2135":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2135","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"e9e63bdf132c0c3477617434910e2c5dbe41a292","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2135","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-bxmZx+nup6hNbb0Te+pHZSc5IvKSXNN+henS3D9CX4eY3K/2LThAQLuOUh3+JryNUySI6r8glXApBSxyU93HXA==","shasum":"2fead569aab2e293413a071338d032b3429f705a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2135.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf87OJCRA9TVsSAnZWagAAGmsP/1czzZ3KHPoTbDU85slh\n2lDIokZqXB2I+kb/rNznrL6+OmyipVDH/wL2fzHl/IOWU+1wusBcjTeiUwUr\nLb2pxNmD2QgCvKIc/CbkynJFsCRMXL4+18fHkoTBvGpf6h/Slrb5akTIZaeM\nlNWJolMMmXigNamDvm7d4TAziIRK6RI0AJ0z2kgtwjsZoPhYWt9535ls0ann\n6O43H4Y9i71WltHSgHNMr1YHoR05FLByzwwF2gdFO9pMfYu3VubzulCXp3Oy\nPhkFr5LucI20pTXFhkC0zpFvGFymc4Ok+cxoVBrTQw8Jm1YMRSIrRmyJ32oU\nltzcGbUouz3SOMAQOFdGtpobNzlsuTzPpQ1yBwAZe6mLNZRxPrw3rkOf2bKs\nJancOUdAc/kBZ6UTT6ROuxjMS+ia63p0ZSzX1Y+o71XsYExkWdyR/yrTANE4\nbZPp4ri8riaq3ED3oC5oV+TJ+jzoagh/tvQLxMNzt7ts20soj7WZNgJwkbF/\n6OG9Gx80YcsaRLcJAPNAD1U99S6so4ZgR/Ttj4kIoXB9H2LAJzPX9zUAJ/sV\nkvF1YV3fZXj2dMOoMcV6/hlPW9Vr5BwYpCo5b1uPsQoVjfl2bWpvFIvDEPVl\ncYsGzak/piQPuUIzJmmtHOOngM/hK32wXH/LrErEDlp0qQq9WIpYUwY7GhDL\nqPvm\r\n=0Caw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICYmXrxltmhjkPt8lAUxv1sq5kpXZdKRKfoVxqaeXb3PAiEA83iQYmZTy6CvXP/iXoPGsBh/tFKNvbh98AeDewik9J4="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2135_1609806729141_0.586005558176073"},"_hasShrinkwrap":false},"2.0.0-nightly.2137":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2137","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"6551001c2ed3a42125fefda5881399f85c501f12","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2137","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-zRGAjsFgkfidUp9ANCGkhVsc8KfEPmkvaR/awkP9KBgRzthTXAxTDLGOnM2NGi5HBdCXxlmgYxbgtSMfCX1OTA==","shasum":"827e8f0b0e372af463a1dead5bd3468ef6d57e7e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2137.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9QU+CRA9TVsSAnZWagAAQb4P/0vepOoYZIXD3wG19fOR\nL+6LDzo9MtnpTuJqAcw8AAoqHSwqrVGjYD04xOtHTfHvlsajUGYCz2npvTrO\n6jAyBovcxRO45WdcX6MWOG441nIO8u1G2+FUglcZHkHLVhbMX02i3GbFcnlR\nabCvxBHipWXIL1FTmHGVddLSvao2tXkamdzPJ9sglihg7wTAixX2Pz93k0Rm\nFvTBHhPrUJmQoCNH+SMW9oE6gfXLJkCI7npxjDE3Gjgk3dzED+fNoInYMJng\nFIFzXv091NsMt7f7GC/jcXIVs1pUEVrJhNmdNgg/tR/kggv2ChMz6oAkaadV\nHNjwMwC3odmqh9SH/7uXY2F6fe/kNmHxtVtDxR8bXcpttarQyio761NnJuiw\nfyLvV2hAu1T1SGatclRwfLvNjLQNm/2Y0gxe7qT5AU36Hr4OystdzLb+Bzu2\nR2IF+pQZjU73qSuARSD2aUS/cnCHq0c+IBKHC+2NDQsRqbnfZKPYLlZ9O1sx\nC5SX1rzBqvHbtHnmrVQ8zh9y0Ab86JGEJbUmma7fNKyXHq44lMTvxVwyWxPR\nt3GpwAAQTkES6Vz7T6Jh0nEhjZOggI0xYjcc9IQ5ONeko2Bg/7iUdzkVezBU\nSSBXYCavse1+YJDF6WloTkpJ3ECBasJU2eeGnwfvlrQOCjLK3tDu76rAjPYJ\nL7AA\r\n=w+Oi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFZwYhFFUb5kz0ODWf+n907FcTJIKPaEF3Uk9Z0tNaEmAiEAq80UlL4XAU5PzQDZu9yWApbqOfuhWqoxeWDaIAD5nLk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2137_1609893182287_0.4172627146160761"},"_hasShrinkwrap":false},"2.0.0-nightly.2138":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2138","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"9d5f2d8e4fd60187dede960fa2ac6f2624aacb31","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2138","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-mTA79zUSxICLifS0E//9Ihc83RRzqKWYp0jfI2j4q165tn4IROVebsbBxzSiJ0PL9GDWtE/2SNxO2bEIF5aG1g==","shasum":"f86325750c055dc508a06bdfbac9f99eff73f6f1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2138.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9leNCRA9TVsSAnZWagAAlCQP+wW3JVLHiGefmCoiYSWe\nOAewlUk4h7r9GbPVoFbbMh5yP5mEc/O9ZVBoNLLsOfbJNjGLMzGIoGiUc9iW\n3DfT9/zT0KhzZqlLfu4bpSz/UGYw48nhqG6xMOoZ8yrmherb/7/lA+gc1WU6\nNjBm2+JfX/NGwl+hQxUCGtVDhs/HmXH7tr/5a16oB8ZhS9WCYuZKkjtA/QN4\nhtMpYQbSxtzmCkemHddXCvCdgo1uW8icOkSsZkjmvDssbH79YaEgSAXMag4I\nJR7NAIXW8evVzStMTKts/noIszvMwP83tb4us/INxGaQgO6v6a4Ot1XlAX+L\nlXzh4/g4slgUtsSEr7fQW9nkUrpzVKbpgQC6gj60nRijSBmEkiBZz/WngZKx\nYziYbF5+IJUyC3+DyYPGJ/XiA4vOfelu9cLGsQFYJJ4Q3AgLBRHcBLTnuL3G\nv5hC36YxOalROm1hU/eXHAflODhCABhnN/lFyoR2gT6BPLk63KkridpFvlR9\n4Cj4hcsJpsaiC+WolvOBRGkxuoyvBLQtrk3K+LQWAHNXBp93SbBZHuRKRDKS\ny+llqmKG+BgL+zKbWD30gLcclT6owTy3XDniwOQYXEdxgYmAqxlie8gzqUq1\nrzJCCl1q/xgJ42feMposoUl4xtMDqT1yX65ow4Lgc0B4VROFTmpETZYiuzxp\nEZEh\r\n=8W32\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKPZ2YQbdi4MAuIXel5atQYvszXmBylMptPAZx+3XspAIgC6OP0Pqbjot06PPmkC/fnShSWHOMhqYiF0peMg4OH5g="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2138_1609979789141_0.566203505099022"},"_hasShrinkwrap":false},"2.0.0-nightly.2144":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2144","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"71264fe1af27c6eec127fe8fa3241dd1a2e6c029","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2144","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-HpckToxIBwvAH7Jl9bHV5kdQzdixOJVevXA+vsbdzGeB6Gqp3fxnQo42RPJnngNXFWCsSkSD5BuhWD5pB03sJQ==","shasum":"416fff250339663caa0e757f7778773ec7fda48d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2144.tgz","fileCount":15,"unpackedSize":73183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+Pq3CRA9TVsSAnZWagAAfmwQAITs2RjaI7ydkuUDVcZ/\ndz7AMsZdzsxUPIRbdabWA9GWaBJqN66Io1ERFGCVrREsUalVnPfYrGtb2Mue\nrEpOT9PoW2Xs5hW0pKtKIUbbf2t7ZbUS7nSGcAYkVK047G0bv4Sh8jnZh7/F\n5A1Qw2AKRbWS+0Ou4JJswvGPEh655Sx7OinvE5tow0kHwORYs4bJ/DXkATlR\n7gb0GJ6TN4E/Cs5wZQM0nBJehiX3kxXPo4tsE6ZrTvruQqEtPQKdoW3G45Il\ni8fuvD0wLF+UzS4EbQ/kwKGNga2pzCNFzG+eL69bbiPcINtg5rwjZve3MJhN\niJpymdYaDaFRtwOc7nUZbRE5tQG+GTKwFqQuLtdDLnctRF6SLjfR+LZGlVWV\nVrd0IGiLiWGY/W6MpP12qsk9vRsixEF+Cr8UrcxXuMysaWsiHJHQ1ux0YtoT\nP2K5P/CNkSlUpIoAcS6PeFqvVu6U5hcmxyPuXdLOt46etUF2/+DzqsbWn6JV\nzuy5DKSjU2ORAfLcKDoM1HnCo9RjD/Du/+do3wFglZ7O3loRcnQmZAMu2NTR\nnaHk3txQPU65mSQL7eh0aQevSpkydoHE1BJAzlYtGDUSlw3m9EEvrE56V8dc\nDHaBgVEBYdK82wRcrVAu4L6ilzcgvoPJ0KcPyHFbp2VSQXKgHnTwIyYrWVrG\n52t4\r\n=/YMl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4WYjAywFIQXDQhKZuY2p6ggrnUACYM9XfV6LvbS1sAAIhAIiYBiYFeE0u2rVvmHGBUtOcCKQqhfUzN0xY10t88lL5"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2144_1610152630757_0.47429290067532603"},"_hasShrinkwrap":false},"2.0.0-nightly.2146":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2146","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"e183e32c811f066310fff0610aa856ca73a2fcb6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2146","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-AeSmJ6iL/ihusHLOq+JM/bAXZLzx66ygGEsHVfLZeT3It/oiS8ZW0FcnZU0vnuUO6gfcbh8K2HJeDVnS3ztj0Q==","shasum":"3a2e96b587c8d97a652947df73cdf14572a44757","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2146.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+kxvCRA9TVsSAnZWagAA2m8QAJ+TL0ILNihe8njKX3RN\ncXFFrYnkHyTeOCGzslfeXaoZuL6gsdo6Hq0wn3CXfps48yUtc6gOFy3Iaoh9\nm8Ct37r+sNrmp1TFxxeDJKiOoCAl1dh6IY7WhYd9W8sJl8SQI37HS3FLSJjt\ngVHY8Mn6x9mU5ZwH498FgaVktv4D4kBNY7B7FAUFjrM2PS+A+hXtvN48vUvD\nV2+WY2NR/tKLheh3yrSa7HiD3kzeuYJkocBJtHlvZjHHPqEYGUnzxi9oy14v\nvaYQVslm3wk2wkneohMUFKIZhzKuEVNT6ypoFeUpIfjMRGbS2aDdBZXxo7h/\nAyI/b+ySo+8gxXBePFaLlx6vIvlOzNxwVLMlqn1wfTABcMrEKJ9lh+uH0ZAv\njWeVnsLvTegHS2wKNF2eoNRj163KllaRJB6dPxTNLWpDtyX8CQqaEDIraoYW\n3FuvHE4sBT8EN2JOnQC9XbfL0R7hEF/QKGZ23GNm83qZbAuFVumy0nf9sRQA\nHen0GaUjF1xBnvcfGlFvIKfzowErLDG7SHmWEBouTc4yug0QTQj0JKjCNKTy\nsYiNWWH1CMAet+MA6Hzcr8ltu/YVh2kkjV/kM5kc1LL6yifDeEvBbHYSINFu\nWvcnKUpuLq6JX0U+MprZTAczQyG3UejwNcY3B9ph2BNwH2myq2TreWu4/H6E\nalUe\r\n=tdWD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCveXWX9+3/4yq6+IFWry1scDJoggF1XWg75KleKPfm2QIgIjK/m3NLSsJIgoFftuE5qqSWY9EVSJ/7EOmoZnpDP5c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2146_1610239087351_0.8455767793644213"},"_hasShrinkwrap":false},"2.0.0-nightly.2148":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2148","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"97a7bfeead8007df257d13d94c5b2f724a2ba0bd","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2148","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-FdQJdNpO1erNlV6C1YJ7VE0PqT6f6FqWqVZJAN6FJiBR3CD83FzIkgFgG1vAYt5OlXAa6nqDaNycTkF04AOBXw==","shasum":"8964a4e3c024f571112a7c02097e9d4bab35d1f5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2148.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+516CRA9TVsSAnZWagAANc4P/io162WfI2UqiZMaXScf\nPLZSY5dLgm798npUq6OWlpKasgzShMY2VMmB23ifb9W5SZrpleUMzf8Q0Ocz\noCWcambd3Pk+zJj3aSv/RNJmrySFaml8DcljIlti7xvTi68gFOEGkOlgRZES\nVuGPYasYcA1h5xzxcRhsW76bQdLEFKqK3BQH7n6lBrbfLboUCLqqmggQveyb\nE99GN3KTjWzc8daC2vkwdtnmzVZFfsouj0rfDyb15BUHyEUb6c1/TJgoNCbb\ntfV8gHs3wF+OL9rFovdcBV4uxx17kzjpx1iB7Qxq17VXJ/0yVERlvE0+9+Ot\nEdevXfWabo9C55uvlp5Jgdj0EhNF3t4QZPHQZiqA9MA4fF2At3nZsBmrCwsc\nHnTHOQz7EZujV+Z6D0V47KIPkGznywy1eJpy2mGyXmoe09dXR9RsSm2at++J\nKLuHbN8EkMgB7WdX2yLnbOET+tk7+HLtugd6uVybmf+eb02fu1gsb3tcUs4/\nNqBcTw8iWQOypbuMfJ4O76T4DxskceenMeS2ctGhb6z3WrnrXFBhBl+WD3yH\nzU4U23Q8ru8DGqEboruL/rJ0y2OFRvhjHQJVMg3Z1+6jx4Ew0Fmi3Wi5Y4rX\nc36KPp0rCeg+ZXGLB6VrW341tzZA4xV3XyMGR8zlO2Rx87m8YrN13f4bAg5M\nVfOI\r\n=Mosj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwZAAEo5dczVk6NRLpJRuQJsT6SJi86wJL6WxjAiqFagIgCbQVxKbi5bSL5NeiIHzD/XlWFACHznwfhaXYiyIPvYs="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2148_1610325370508_0.2156758019794458"},"_hasShrinkwrap":false},"2.0.0-nightly.2151":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2151","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"f343ebaa001fb9e88191beea1b383311856402b2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2151","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-KJxIDKL3IZ6or9yhp2z2xSuXzMhoXdTP6cYCsb0ZalskCCFy8LjhfiSXis7NDJy4wA/Nzlk5ewWjCwW+J2qB4w==","shasum":"664b274619ed030f48a8650ad6efb090621de4ba","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2151.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/kMTCRA9TVsSAnZWagAAYMgQAIZa3CH8hATTr2h0A3R3\nCwz4hPIi1iQF4SsRbo50PKoFPiC9GMaaNR0aS0jAHy0qsZWZbHAiAH40hjbF\n6EYBvg/5sgNrhZZ5LwJAzInxGH/h+BI1au3sYOgCyrIbrrQ/ZfW7LvOWsv1Y\niU6ee+Q8j3CNSMoZEIurayGpMzVZ89WCMy1IKXghsmdmwfGKc7AcPIYspm7s\n5EPkUyREV0lwXU54V24eDctV+/OgMosDPu2h44rb52b/ggOAOYmms8eTD9Vr\ndqrMuUXyDNkJogJsFlEkXlnjHL2wnaOcWbWuZtK4p0r1an+01nJScz6//dIt\njoQuLdaUflN3AkBT/BCOunpMx1umF6qrkOAUrajzx2mqh6yMSySKTCDNYAV9\n4syvjPmSrR/E10gzeW7DSxUAqXLURAk+NfQCh/CCS5lpuRa6BEB2zpLrxPs4\nlvFY8RNpRMZXZCk/GVz7B+HIPoyACCaa0Iiqu9q2Nk8WSL/XOibidexg4Vv+\nXebSj4ciq80aP3dYr+bjq2FrDWyfDl/2QWQgDjB8dlKPO9CGK1kMHJRmm99j\naDEnNNJ2NIuFBh+V9R2YnyTWf6/Y0wEvrfXZmoNyBcefVo4ZMXk9sonit/xw\nj4VOeR9YrH+ZuYb2zPILflVxQ0ShMFe8ojGrj7HrqYqejY0zFhTEFlQAX7TH\nC+Y7\r\n=Vf9Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDbXdCAr2oHYzTvyqEPOqdO+6mr7QxQZbodwzbuo8pSOAiBeesCOXL8JoXAo9KbKC1NHaFUek5xJ2xFvdFjhpF5m8g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2151_1610498835386_0.09507115079465445"},"_hasShrinkwrap":false},"2.0.0-nightly.2156":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2156","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"4a083b40c5596cb4639d4e108d162a6cd086711e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2156","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-gNj9ZH4zVFiMS3Ao8DUmaxJZZL67c/Gg+3X9zKoIVpJR5HWSAcUVXwlMM9VAFj/pynPRDrusryDcz3GKWfwK8w==","shasum":"631e72a218c403de84b51acc13f1ef89424ac92e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2156.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/5Z3CRA9TVsSAnZWagAAyeIP/R5waZ10YkTMEU237rR+\nR8sUy10rV1JZSB2o2oxtHigV1ueqIoIa91xe9VcJw4YvyqiVQ+mMHqHfhH+N\nVZz4Khmbx6RERp9vfUmttMjlvD+9X3h1sz7MhZc3RjzRpQEGQnJd/pCR3hyQ\n5nEupeXciRsC8PzAmBDLUU4Xpg9qZkpad3CoeWmsAue4pl7QigeVYqI7IjXk\ncU56XJZD2Hmptjbdc9O8OHT+rzkHUS/zP+HA+roTqGviIHt7KDXbB+Fde4yK\nOON0VOfTP01kZsemenXPzliU2bGdHJWnrfkO9zAOmWgJfGSUtMnQn9280Jk/\nS6/Tu7Zj3ujkidUGDUg07Tg9EPN2dW9IE0IKu/kbBtcyeF4JNp5lE4t6im2y\n12zXZBf/a0VufnxYukuwDk045pUiQgU6L7r3v5kivhDT3CW10X9EoGNlp9Tw\nF2012NC+InwPgoGa+W7SQuaUuDm4AYhMP45/q6WRFg7XKYrkV/0aLIvKzov/\nYYyANPfOflqs0txjpzAfA+T/jTEuZBDA8+7mi3oOsS6364DKhy4P1Si0sYCk\nA30gXCVJGzkNeAyWF2gKgYSvYwkJFhvce353jTS2vJ/t1A9LFZqE0qlh7Vs5\n+BxECvBHUKqu5EiWQqd1TDOexUnkD7x6qRyMF7LVTl5M/zol2RbOcNBYV/zW\nCjMR\r\n=j7DK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsb4b6I15xb+YodwZxpumqhy5cmD53gOszR2IEbB+bTQIhAPWVyg7Nqg/dGySJf/bRLBPA8mkuMJhvsyIvwAPzQbJR"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2156_1610585718734_0.9734420514623654"},"_hasShrinkwrap":false},"2.0.0-nightly.2159":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2159","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"49ac217507d5914a2e38ca402593d26527cdb673","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2159","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-XTc/nKahw1+0d4Y73smJD1qIdhFgj4Yx0VFxHY2WK0arThxm84uy71AgR6AC5aCy8k8lAstd+MOk7mKZFfo71Q==","shasum":"9bb8d935abe6fcbac8165215596ed7fa7dc93145","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2159.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgAOZ5CRA9TVsSAnZWagAAu1sP/3dIt0QA+/f167mOoIWG\n8lRrTw+Z5gfSoDD2CFZeFZMUFgEyojAIvtocPk2+ZqvD5IDIUpFYlSF+xGQl\n4xNiJP82SzRPyd9LY+/PiSvzyVHGqJ38cKFtN9TnrO/MQ8XkQq+1ypAIU/Vm\nncX1279raLMgwRtWKYbSjx007TmD6yM+7/yrL2TX0rNgPazjo/Fxy3xeQtB2\nFZjylTHyW5C26sGI40+8y2yPehr+n16sh17FZgzkMPrPtF78W4K6yuKZrSJF\nL1RW4U3+3pmWSe0AiRG4ahhkFnkj23LmWDvlGbTeeXsbUdtlnV8Kbc8YDB9w\ne3olrqqqbQ8pDUUHvo46T7zuPm0/fv/+8Jr3f1RAxRcwTMrFPukmedgBPsQl\nSObSzucP8D6G44NKVJJ23etx7do4BxJq/9OkTODbWdX6EFZFOCnG8HomeiwO\n8CYfy1gYGdnmxAdS057Yhjwn7plzT8eCNYxYA8GvK9W4hjaVRhptS5muqFVg\nFFjmSbhn68t0wnC0kihOWYtADyeStAavtIfUHf9gp3XZRJ37CelHO++o9vC0\nMQ1Es0AFKkMUXVbe6p/BoID/BvkyEazlCQnsJXDY45Elt0xaw6XFfMPaoXWJ\n3OND+Qtjz3vwNA3Rz4+Ial5RWzB8Z8B1ePZaqljkR6/zIISN2S/zre2ppKq5\nyAbl\r\n=HqgS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjEgq/1Zslrs0fflwBbAy44cZBAZsK1iuOWoaT01U7+AIhAN07URsoJ70a5FdewUYTGeDbf9ci+tP7cDuOOc/TdEG3"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2159_1610671736581_0.09302395808191566"},"_hasShrinkwrap":false},"2.0.0-nightly.2161":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2161","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"47555e2d54cc03780b6c1097c114917cd12c8b10","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2161","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-QCsPqEB8A2vr4pA2mharZXY2/TIbTZqP1w84XRl6Wmllbh7zj5zQehD8JXAnxttCcvWaHAQ4thoTvPIu2EATXA==","shasum":"6161fe19f788edffc685b7e2ca0fd62b657ec843","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2161.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgA4ltCRA9TVsSAnZWagAAdQQP/3HolxTnlxNNCoikpbmw\nATEb9aySZPtlszCB+qYYYu9NEZ7YSBNU6o9NpRvkv3/s2qsaG13Pbq15+DR7\ncDmU9gJ7UAGYV1Ai9qGQ8r4IiQtFXXGYXwewxUwz7KiqQm0d28cRVRFnUsIt\nvPpfL23+DgTxUHOB19PYuuv3joGWSeVD1iZ/5gIlYdTPeFdW4Ew9pL2MPe40\ncecTABcqJED/IX21sv7kLYwWfePxJgCrp+kMR/kJSTgZaVXxhunObuPPIN6J\ndbyr6uhZEoNo6g+/j19ZZ65YcBxzTW33PDzpeVp9XvET4XVS2JaPGXaIy0Ri\n0AM2ZH/0unQtnhK5EFcT9DXPQ9+Ll0mX2ritRcrouXHbVmSaIkHCpN0UngXI\nzTRg3E8LS41jXMTI6zzncgNttvmHsZvMmIfTHtDIY7m/NVK5/nWmtyuB4xTG\njlwpCCJaxZRIm3Dh5Rnz17DuTXxsi3Da2D/VpDqVTKK8oIVxKjVk23rIh+jR\n0jNROfoZG6KzLl5mVMY3qEaS72UsuktItsO3DHYKDg/agEuMQjHyEavUfVsS\nsT1nSOxEsEouYEZg87X/0nIUfHJbnrTwVPyOtIXMBuwiogdB9DPBBdjjvdvu\nqEzalCkFlxA9ZZXWwvAWNZIyLkkBJcFswnZylnaiVjrhx6lFcuWEiNI2ER1z\n8Pf3\r\n=Yt4t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF3pyC5BSpfumyh7qPNbmzsmrJK0O1HDolBCMLa0kV2iAiEAuJLP0RxIBQGSTBAvdEZRSKY514TVTrqCw8wR7rQCqWY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2161_1610844524828_0.30151194229578704"},"_hasShrinkwrap":false},"2.0.0-nightly.2163":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2163","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"53e5918a5be35f2887ffaa2b1f2fa011b84cefb1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2163","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-9zH/evKxEHtLWAHaGjqTGxE4zuo6bGHHFzirSEY3LwJT+ApxHzONCzvjIIgrQF3Tupm31+N7EEFinAYe3nGGqw==","shasum":"ba69996714a9100f2f0e686c678332458fe9c51f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2163.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgBNq5CRA9TVsSAnZWagAAOaQP/303vfNS2SbD0cSWrBZ6\nm71pon2icAwfaGJV4zaUZTOKSUaZ+nn1rOseQs1DLOCMT1Akt8qq2TicnHcz\ndRkh2QuKTKFd93E/vLlf4LyZ884WCZx7JtmFpXBaaCDa5vvtmZ6xG1sEy7ST\nRuOIR143Rx5+eoO0qJg8UaXjJKtLG7vCk111q+FirefUny1XfxQzG1Rmo4zt\nVzPXSHC0PGnmjqMvbcsVUhxWuD9Qo/ovgKtYU/5QMZMDZDgn1R7X6NofaZc5\nBd70XA3Cv0BykQOXZfl0XrqdcTLiqenENTpXcB3Pfql/pb5Y2H20paBU8ty6\noyQi9a9u4oAKXVrqRS27ME1ZI4NsFsnw/zEjblVz3JI49oz9sXU+6h1F7mhV\nt6hUF4hUtOFjwj9ASJVRe58pCF271vI93vL3RI6J69zEzkk3V9excQ5jyPcP\nInR3UD5fQiXK6Jn2/h9rbULaj2BKwRXlp3unNBvYpCsPqC4pvxqmkdvGfl8o\nSLdwxzbdK4QGQN474s9z2vK9kuAUrCuivPnf19OFPZPaHdQZ4RNnvzEP84hL\n/alen0adNDUZhgth6TI+z1uGjxHTMNzf3WnZs9kEfzFMZmb4xnUfduIzAuki\nTlhrXKF0TpEftGH1kLu0biuEECggM7V/tH7TSSPgKR97IeUJJ7+GVZHERg9B\ntqXS\r\n=Z2HC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBeXPvd4zCaXfHreA09vmwoMJlR43QP6ro3lZM4LVjO+AiBkorr7Fq2I9ZhnX1WyiTssOKwAH7WC7G+uRgdLERpt5g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2163_1610930872858_0.44805000152549423"},"_hasShrinkwrap":false},"2.0.0-nightly.2164":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2164","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"bdc45e49437b986934d3b1b0d8f6a4ecc292a2aa","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2164","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-iq+VcvYz8hHlWnf7FfWO0tDUPJLMJNMP9webMVgrhFrxV9ivK4fKRCRN9lOYVVvx3ZsBjfkgHN6PeGC9qgMLZA==","shasum":"d022d8981c0500739054208abecc97f34eb4f9dc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2164.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgBi03CRA9TVsSAnZWagAAA34P/jow2Qf5TZ3uVo6RwqHb\nx3Km+Jky0TWg/dnrS6SEnsALKAGZcKRpigElkB4MHFAMnAF5k15KtQ3xJvIm\nDD61Q+o7rzbq8zRnbwociENUhHFEmjeIVUo8oEMW488awJ5Re1qskdzqr5m8\nW7GDvvhvmnBbZqfyc2mJ2GpCyvr/kFsYUR0iEIY7kTqoOqZ19oqfznCaezAW\ndHNlzyYMnA/UfBxY/bJUxiDvOgSzMP/pzaSnb1sQUrh+pg3ctSKTW4tLQASi\n55NLmh3PXfzshKweVo1KsE/Ru5bUfxefXfW1x8ueA1kZ2Um630zEyz5d9OOM\nAU8zQgIaBil6K3XXxP0gIIhrPF+E61n23Y9rer+ZC14CE7euN3zHuf5bi6+w\netSKDvobbJuhAUlRBdE1mG9GIIedkIrknHvMRAfKScnLqnK316jUlWmWzAoo\nOhzJeAzAQSOhK7gXtCK7r6Uwwifyf2HZfc63Nw3zeT74CppkTXBlrG2N988w\n6G3/S8Dr4ZKvFwRKoWajT4rmFoeOgCkAnp4FdzPpGrs3XpU0DGh5XVo51Yzh\nIPCugLB3uT9VtCp5ZoiAbvZbIufEmCteAZNroUn9Xfml16e1AFoaej9586Kd\n2YPcu8BxJOFuDTxxTcyvhVHQPMJU+U8Rt2YdGPAnlen20QVIZgXBc6gQwUgb\nIPXM\r\n=t7mc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDvFKV5MaZoCxeME1N4OSKP4zoER6bVH31Sy5Jow9I27wIhAK3wPUeutPl8MuQ7DkssUHtFILm+gkufgggLwrviwXpv"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2164_1611017526417_0.4373982992330512"},"_hasShrinkwrap":false},"2.0.0-nightly.2172":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2172","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"0ed50b57e22ddda8a5b92c8106200e07b9c9b9a4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2172","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-NW1mJdR1qbOTOlHqQPwMVvK6SBzoQ1JGnkE8gqAgYOxUJhgjVfmYbDHq7+MRMGJYPll19mCiv6ZvNDYD4AwNlw==","shasum":"5000b6cf25cc6257a3f45f9bb5f8de418ef8b6c8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2172.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCiGqCRA9TVsSAnZWagAAj/8QAKKIZg+mca4lexq2q8xm\nVk5q1uMQXvT4/m6S7fCvbQW+ukhCiG21ao4itto/y/YSZmQWnJYnvI2nnEVZ\n8l1aBhiit9mmqLU6GrLwWJmCyjDwkrL0ZtRKmScN5YbHud0KjW7cYex1Tugj\ndWBgNDXRVcG7IHcg0g0V45mDyVz4GpLJbpkCYMzSdxmdXK4WdO6AdbTXrSlx\nmIMdfaUBatI/dbZr6ZShf3yBiM90C+DLbrnCt1Sxc/OfR69OC/betlCuS+5a\nFhL/SlH4MEx/lDiKXS5LVARpelikaasvMQKc7pqPY567BeEUIblQgHvTWcOd\ni0binYIPfrd+K+XLfCpsFwXJhPFHXL8XXBj3QPz3T3LFJ6EwVsy+EeCCWIvi\nD+rijHFUBQpPLByl1mRuvO+4cfyYaAoWU+J5k8oC/uPJKGuAkfUCmG6wG+Sl\nwBIhmNp4Hj5M71cCUbzkiMr0z7kdPdy+yhgYY1aLsRXRvJpqEgO9NUFENPMk\n4l+6MqLHu7AtmaO5MdKiTFvTZBlbksWq1QZQcJJ3jtgoHfNjxiwSzmFzyqOt\nUNmuEMc8PpAOsqM2PbrfHYKbpqcxCNc7zv5Lc6Ua5cUfcXeHEO9v6WRJ6m2o\n1RN57auM5OIimNt1fbPjnJWnCD3hRowKBmuidYR7WHakoAaQTx0uPL6sFhMd\nIwSe\r\n=27RE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYi2pbSCRj5R15Q5sF2EXtpVipyQoyWNajMO8SyF5oUgIhAK4zsDt/gBHk56KHbgh6+DVRqkHyJ1UgE7Vru8s5Bboh"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2172_1611276713542_0.4346891980101242"},"_hasShrinkwrap":false},"2.0.0-nightly.2175":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2175","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"6d9e3901e213ebd1932d69eb0587d219033f1da7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2175","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-ZDxUFYUQ6kquUhR3GYWrPtxC+WF1Sb2zZ2vM/irMOcfly1w1IhA3gpT5rMjU1ghOerrqsmQEWBPbKQ6fcbPAaw==","shasum":"75ef9e6d47511affb20f20433d0b556a39d44f2b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2175.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgC3LXCRA9TVsSAnZWagAAXeQP/23BVb0aYt46PrC9hVVx\n+inhtoIdOyV1Xvy8Ndoejl7TV1xQA4Q4Gs9gEr+m2odalY4oqDT8ICU1QdXs\nszRcnAN/leKMzHlXIxalHMXUkYUf5pmrMMGNldRVd5mQOAum7SzasDVw4oRc\n1TzBK/KSL4Nl1d5Cw+b9S3UfogTnmg9+wYJkoa9Rlr6kqmvXuFx9Mdr7cBnO\nFdooSce9tQcNax7JwRDf62zqW8yvcITymkgMPXix/lYwNycVfVHbmF7NYiqD\nupEdymNN8sPj69XLiE4SDndBhNhxj/Mi43xFlwek37OsGRH3Nx9x8yeGuu/W\n1S1MVMyURMwlF3rvbh2SQK9ZYLcpysDlu9XlYVAbxB92ovsG2dmFyWc3KPTG\ny1sm+2phTVIp8xRwLKKRgm/pppydahnrUL+Ru7xGiHwbmgTgaoOHGx80g+i5\ndPw0bxIuxuLgBruDTT5UlIsmaM+yLo93yAl6V8A0nZLFEcovVhZKb+4t9JTH\n/DEsgJxio/l4dzOzodjwbYN/u+NXZno4M5d25lc9p2AOlFKKOvXD2WiQhv8o\ndXTln3aTgEvHOG+B08Oe+kSu/PtGBoG7/kmiGlLpjxbc6SOQnENDqqyVO9db\ntHWSnkObXwh5WML1/jDI6coaE+QFDVamCIJ+f6MiH5loJUFcpoLaOatUHHgr\nSYKw\r\n=9W4C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClkSCFj/ElkFlUHKVc5qWHuSy+bEk6xitFgEdm0rm4cgIhAKXnmmhTVrMOpP8lg6loKLffm1u+QfxCB/evSStU2+PB"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2175_1611363031485_0.6565239059963812"},"_hasShrinkwrap":false},"2.0.0-nightly.2177":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2177","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"6a650017dbe04ea0d66ac927d335a2ce4c48cf8c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2177","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-GETJrsNQUk/ymU7GPu3FgEk13DAily2WjRuAI5tq5+80RFF49CqYH7CbVwKSTr/vOHpXcNuuAXk+iC3wtG15ng==","shasum":"4f7a844e0fab1386385efa9954e6ccbe76e154c6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2177.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgD2G9CRA9TVsSAnZWagAA7hkP/ibvko5Wvhh39udNzRxZ\nF76NpuVHiXAOG9CDGbTk7exE7bM5IKZxzoHZtM3C+acGEpvUWAFZgscSkq6W\n5aWvnC3xWaBsi9A6ctE2ar3XM3esaNXzzJ1Z2KIF98J7DxlWgk6ZgPCCY5QF\nolCVkD5MalHld5oxXM2GLRarT4L+dISe8l5K64BTdPicRsEtv/8mQ0ubMjzO\nL2c29Qz6eZcjjTE+6f3lhNH9YBDacTifG1IpD97gu3f9qAeAkhHVc/3t2QBK\nj1q1U0j+LRuIhWhD2Kk+E851Z3Sj/JgTX5RgXyA0LYbG9T/YScCyQzRTeqvZ\noysD1sDE/vuDVvVUNkjf9dABNtbgQXZGELy1M4ziyqPXDXQpg/AJDbXItpyQ\ngrOKoQvq00bErUl7IMHX1cIUpaX64cFLSZovr1zAbnhzMdRNhMQglFEVQxEO\nFfdAQ+9GmcPDRAuvsJ3kkQvwRVKd+GMcfqdG+/Iav/PRkQKwf3sZBUPiqxKX\nd+2u4KPFayTJ2eVOoF0iHVkuCO1CUuQgJUDRFjIC+5DdkZMSFhSvb0RGzSCd\nv73H43MgxqO+UaKwTANW0R8EHVaoxeOTsbHN9ZLa2HvstxnGuhBQuXcB+SE1\nh7dIOAt9DEI3Tdk2iS4BiqO+GnnMlCnmYkOn9A9513VxZWeADmm5OstBeWgy\nPm4F\r\n=Xo+O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjKOUJwyoWfEtVxI50Vyu0UJFK1ZglClmiAiIFSVzuuAIgCgMvdt3NGE/SfbPpXK0g2kcdXz2Hc5TKhjiUZV1O2+w="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2177_1611620797307_0.7192592017856247"},"_hasShrinkwrap":false},"2.0.0-nightly.2178":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2178","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"c50e65556963d4e406d658b64a22cd233a6012df","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2178","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.20.2/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-jFH4LiPYkVo7hj8NsGc214px1wMzJt+wneJ7OKsry40zDWfCp0DrIkCcYKK4YW2R6uEMIRptgUWoZPPYzu6w1w==","shasum":"393cf979b470d38a3b785d62cbdbac90f6d4e13e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2178.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgELN6CRA9TVsSAnZWagAAmS8P/2bjKOz1Jx4P9K590w7B\njS6l59lX3lr7Zx1efQSxHXyYCK5hYkzSP3ByVr24u0y/OObZ6wGYkKbDegFE\n4cQ995/Ah4J/tww3VnO1dOjL0uUabUUeJ55fXDWVX3qJm4jQtuZ6GzMN79uZ\n386N0zn/tVRk0X5BWRKGquU7PqEJEI/roOWHl9oXWcM3DNwR7hguU5dQ6OaR\n8bc9THIrWqDBOSGrxV5HUs6vqVMgNKdoRyHEnTVs4RJdn+5cgo/Fj0LsRxit\nScD88nY+kS7xvXnhE1B/wpx7SAEPl8LKdspaRxprg7CrzywhhXVwMvwG3biO\ncKY45KKKQ4pkxiXBqQqeogUloPMewvGsDTsIjvzPbVS7x+ufkdMf13dLnscF\ncRnDDMjWNDIsULqgCDdn4An+jSr6FZMMDm5ZTeIpgG3sTl2yXBp+GxCkUj80\n2epLqU0YlcOJYoc+EhytPUbjq5pl75Ea3TO3pIFBslr43GcvYPnQhwXdIaxx\nrWQotaEieBuoItrxqrc1qOVtRZAYNw5vs7B0+kzGo3apxYxLyXtkFElWbfaZ\nC6ncCrLytNstWS7z4TtY0AUit9SOM8s7Xk9nwiHgO4yoSWfYSGVbg1/XwFRb\nSBVuSUTtzR7//qRL/xD1gecFiehVZ6NZrQKZ1mkZXzTHzN639o90I5Of/AT1\nK2jU\r\n=LcZB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFlegJSAMsj6eiMdoMPkihgjHUNPgmhnf6o90KKPO/6yAiArIVMO6yH9pS4qw3v5Oqve+O0GTQQFN8xYhbT2mKENqA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2178_1611707258113_0.16889567742290046"},"_hasShrinkwrap":false},"2.0.0-nightly.2182":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2182","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"40f24178138445abe8746c0dec996b0cda1bfe4b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2182","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-BrtJSM6WQMNzFGzNqqeNb6Old+VSI64wmHYN3O+LcZ2hF+8K2ZEA9JjzLPWq0hf/e2KbhAYRQPHoZiw1+RzNWg==","shasum":"e49d7b6bc897faf181d7b2657cd56300c543ee89","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2182.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgFKdGCRA9TVsSAnZWagAAF1oP/RjfroHgz9UXQIPEaoPx\n8+Ho0lauzYBa7l4YFC+dKXKRu25iXgtk2s+8FHXVidV9pdflOSU2hQ+++Ubb\nTck/+BiQCSYmjWLIjkRznTtXqyhu83eerTWWLCAzQ7cZo9jHgvXhJYM7nbrb\nTiDw6dKv+YOR0UUG2wUDZ2CXYghAJxgKKdAVtpGX2nzfexziU8Wl+uTDxv4Q\nsf3TqLoLaPuBDNRf5Y/sI6KYZslLFv+MIWDFnCgOR54i4SSI1/MaIJazrSam\naru6QzjEx8FFrmqkjnChcBeJeggzpFmGiQsIMl/9sJkLZbR12qYbAnR5xFtu\nSpcEtfk0AqoEYVhk4tSgr2gXO7DwGav1ldAHT+ebcZyhjBxi2W+OcBRadakS\n4TDJ+AXwVfltGXQc8giMKuhcwCJDtThO9C6Akse32Ean2zRHyEhFX3/Nw0aA\ntzw3LPZJeDTddp7HcgsAoZSn1oRahyX3OAzViNEmEBHD+J5o8q+GARMRbRDx\nvRmxrBFqAhDnPoxbR21ioBONcUnNNPqNXXg6lH3xPeK4wDCwr+lqQkya3Uxv\nr15N7JIgRoXYNUEcUkKbz3ro8lgj9aJ6oX5OKe+C2iqb1AOEb3OboM/erWUs\nHp4Go0Wf/cpRsk2x5hvplZTk8tyym2OuDyGyjNOCwIZ5iMAwX6llTiuDVHQu\nluFp\r\n=bbE4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnjmK8bFtTVuHOevYOu7ErAYRRuDH6DDqOkIeVEr4syQIgAPHKS5BvhnyHJH++spAjyY0Tjl0MDPUi/Skb8SlaMhA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2182_1611966278531_0.7715593176709694"},"_hasShrinkwrap":false},"2.0.0-nightly.2184":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2184","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"36de59e1f07a99630ca3e2e37deff1ae3258c881","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2184","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-brE5Rh3hMXLLXBIw4RPURY3xX2xJhnOi/vuExXSUnzyMQwSjlQq/gOz+248JSRqtBr9wcabbhX4ocb2AX0qmnw==","shasum":"d15ec4509f6b761b48b9e7cd8d5f0c17e8d6416a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2184.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgF0p3CRA9TVsSAnZWagAAdaoP/1+WMeSWcS7fdQWv3WLi\n6oeBT4BdAbIMgsuRWcum1FHtjuWFMPv69cjO9+2bYYaiLe8CzN20yZz5MPNQ\nzuL5fbcfp2YuMXWBPqMgrL04Hknt6t4yw5CtdG68BF5Ykf0QYnHAVxvOyArB\nFFBivL7beZd4PSkn9Gq/u3rg6XbUEGQWQ0z9tB6Lf+ZtPo0vk4w60l+Bdzns\nY8v8aiv+Sfkv6DNz1oXWlmRxMJ8XZF6QJX6YAIyBDkE6f8cj9nlg6ve056Nu\ntOnDNNFiG03bG2BXmJMZpSKNB7pMvI56etQxQ0gCUnw488MAIrj+7UFX7VQq\nmSyWgt7h3Lc2oBstTr2Ob+YJHUVYMzYEeZyGPJYUukjBsvayqGKYWxi45XBa\nx0tnh91/jvdggRfIF9DyVDG4jI5r3dRg3KcqkYJfur3znEbgQhkdiwrygfMP\nXGqqYQZeTyH4csWu62cqCM/NQvjn2gfVzLyk8lC1azPVFIO6lHjp3Iq/p9Nu\nGtSIQtm9CQThbTBVnnPrn7K2pbPCrNzHIxdljysRRzJ7oy1C1Pda+tLMLkAr\n+e1hwGy77cC8WnhIJxN/JfJZixuQrCtatUMkSCo+2fUS/YyQ1uRqQzQ6og/X\nI+MEfoLE1K2mSgMDPCwxmMAhit3gS0D9BrQK9WLOpP+9KK059inLvX/7oPmk\n0/kw\r\n=M2Xm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjr6rr6+pDMscJRS3XRLjnaAeoMgpQRWvhoEqng+QOHgIhAK7cG9eobhBlVbCH1M47dnJ8y3Fe+8n4X+A38Z5lNSBD"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2184_1612139126985_0.30996118972183173"},"_hasShrinkwrap":false},"2.0.0-nightly.2186":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2186","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"fbca3a93f8ff1178d35ecf55cd31f243c5359dd1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2186","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-WfQCkEQa1UYilmWH82nSl8bgOfw8vaAzylY7gAuSRo+Z4R1TxYRxU9d8H1JLUaqJIksgKh+IkFQoQcbrkfKXOg==","shasum":"84520ce0eafcf6f6852e6caa932b80764e110585","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2186.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGJvcCRA9TVsSAnZWagAANu0P/AiQuSF+37dNJWpOtFqD\nXxUnH6AlJlioZ//9hni3cRrEh8HHV5bdW7rRZjiR70EEegtHQX7Xl4ACAt1D\n9hsleyJLL4YcrACBkir6t6194Gr6koR/0G/0CaP29BcLfTtzz74DWEQcD4g2\n58ZjsIeweEnPDys+EE9oJoyAyx6iNkOwYoGDjjweGAyIxq538+mS/L+8GnYU\nQUv4a+1CVDdenpqPhyDfcHdTevRVz/tYthdAAYFxILd6drOoBubOfAKVyqQe\n8/An4JFpcL4mqvVGxcWIeKR5KZ+r4UxAfwKxSsZhgzTuKrYqcI+le+tuq3UV\nIkgvpSiQGJV2bFUg704zrwyHz/p4k0YEyqalRspofdPNuQHR+wuhAcfDV7AA\nXYwdPCaW002o8yOIHsewqLniw2NKA+xKPh9ILhZPW/aRk4BgkuQ0t7zMPQDI\nGLp28fnxKD0SfN9MAOKa/j1KodZf67WPAAhY9FvfppEor180owzUPOFi7xsV\nVe+jmWlpqkclNs2AoXDRynCd7vglhzAU0DTB60ehOw9R++OSA7ktIkqiW0J/\nnoqgduDlwnOZGPLRQVhsUl6yYUM0eX4k29PWbSRFG0+7CO2/gl5n+fZvdY1j\nZMohTJP2FnoAPEE85B624xVBxyUErLr7JsGvf445U1kxql46bHNytmAgLlHH\njj+n\r\n=uZU3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH4277Jtj4bn/kz97iTEGeYt5WqI3s23tt+5eycOF4gWAiB4E43RidOUG97ovTvw4jRAfwP/vcRHeAEOLy5pp5GJ/Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2186_1612225499463_0.07670965194919788"},"_hasShrinkwrap":false},"2.0.0-nightly.2190":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2190","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.11","lodash.clone":"^4.5.0"},"gitHead":"dba96de07f7aef36fc11a15619e87c5acec00bac","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2190","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-63KCgIp5/LSGXpGOpmXufTeOCP6pQi8+OCz5PaYl/4/YMXTrbpB3bh1KozOb4l4+JefIqSrmW+ErjzSZXqazGA==","shasum":"e7f76c2fd781a30601369a86ce18cab79ff55b49","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2190.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGevnCRA9TVsSAnZWagAAGC4P/RX9Sq1HDKNM4GQbGFGV\naIRvWc8vg+Px3R+/fytzAFX/1I/A0qe0PaU7hmKVD5FoklwZQmJGC2azTmvV\ntaEkYsEcEpRMykxx4xJ4nOZ+GYphDg4NfjFX/Qk2K0vhc9inc65H0iiMd0im\n5SjwKjzQQu3JEB4EzpaCzl237NXdlFGJgyJaFvOcNpT47myd8a+0JedRGn1W\nU7baBFh/vidB4QV6uOhEZw3WD17cYn+9nbI6WPkFLytcOPgNMLdzuhabQPKs\nIxOAeSK1ChuL2qsQIk1TDC/UIdmhuu9RvgLXqdu3R4pW3PPMzTmwe9q4d1QT\nZ5KOJStnpfHGh4YFO4n52W7xhfbszCSFgalpVn0rNvhx9MAFkbkIKzM9dR1f\n3KjbwTwSu/G4jUa/QStKdlyAc4uMrVDwggTHrhVgcuxm9QC9zysFk39PfjAr\nj9exFFDhth4ldHLTJ7SOMY2r8VjmJKM7kGiPB+Olr9mCBUBJZNgVyCHyjsdl\n/o/+Et48h/vOUS1UQ6ilPMQlr0tVx6k4IPp2C60Q4FDblmypSxwDYxIO8FZX\nnGLWmxaeEgJtHXrSHVZ5FSj9Xs0+8+lbPGjJ3M8vnUXP7EGjjBk/5XglXXGX\nC1E1a8JHQK3rQZbNpkCdAvaK6rbHeeBzc3CW7B8tVM4VC9deAQrHzjQCtYOw\nRyDE\r\n=yl1E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHvw4q0GnMbH21m/mAPHWtDJtWIIlUra0nbzDQomVE1xAiA7J2mwjvKqHrZSBhfJx7lLotpI5FHmdHKosreaFHJu0g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2190_1612311527363_0.20981679088206096"},"_hasShrinkwrap":false},"2.0.0-nightly.2194":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2194","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"017e8d795b3237c61c1cdf82c5e68052dda5bf28","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2194","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-4p5Fd80sEw6lkRxOrNSxXrc4q8hUD25yIqX4q9csuMsOhC8Q9bDz+hgmh5nu4Gsok2UORS+EvhDOkUWGM+zuPQ==","shasum":"a199d43fa9dc662af9e9694fdad519120d6cbdb0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2194.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGz21CRA9TVsSAnZWagAAqJ4P/16vMdvrhm8DGXHLGOLG\nryqZ2LQhiJgrBAT7LmiuNw0rTVw8gxhzxXtSzOqbVoJlDKKqFCkUGw95BSU5\nBpVEr0e8RABQQcsKxxbH9WrjWF0lJxC3iI7ON32XWy1sv3J7FU6aKbhAv3Kx\nCCpwXBdlOBknFV3lVU41eFpC8oIYHRFsyG4uAoOzREQ7/pFo+SZ0erWM2vJ0\n2+ngm/HM9egXFSVkz3hRjDsuE4Opph3IdefB0ztyY3OToa2v5GNM5Smvanat\nXJpcgrrIO92immA1vWyviYb4PVfBKs+f4TFhlWhekiFP0PMZc9aJ2p/V3H3E\nQfmAzM1/OhjOekYkjXMP/kaU90+H4bWMU5nIit9ev0JNvTRcpHFEr8Q36Oz5\n1X8nd6QXRzqxV1agXyGtb8Rc4dAf/JAHdksYL+dBTfgcmFu2cSO67AyZsfc4\nM1MgNbT+ODBraMfLS6Wujc8fep+iVql+0bl2wGc20aDNwsHVgizcheSDBHSI\nDnvGwlInOe3WdASAmDtlkvVDzFCJax1t/0SIueVBIWDj8o4ycYqT9TQUtJRa\n/sRID1gfSZHKul3G4EoqR9a2+DyHiLOg2flFIRi0uuwV0xAGSbwG4//tuaOL\n+AxNx12OxH7XVcrulYXTDqIk0VBvFr4tBeaR+y2k7GUkrR8UTUKH4h5g2jFd\nP6lc\r\n=Rd85\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCi8970XDX77Yy5GTEgNpOOJ3s91c5vfnbCjCpbNIEf5wIhAP2drooq/PIkULGLqwvwM2QMl9EFQpuXH9skvWe8R0JL"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2194_1612398004511_0.41262175065394735"},"_hasShrinkwrap":false},"2.0.0-nightly.2197":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2197","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"31f431d93da97d3edc3f489847053ef601412666","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2197","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-HyJoqoJH4nFx1bZyO1+rUjTlULCVHn/qfrKbF7U+mS8Y5dFlLsxI/lU9y6W5kJGAKSk1rqX6Rpfj9womk9HQeg==","shasum":"a143bdd8089daeaa910e9657c9fa69cb889670fe","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2197.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgHI9HCRA9TVsSAnZWagAAKZEP/RDSQGUcsSjf6iIvsdOI\nq+NfQMj9/QvFuQ/s5ESP4ohcv43xZUHvp/KosQAesufGM44UV/H8n1ta6sKV\nWtgY7VSuE9XlnrZKahgtAKkY4VFj7Hf86uTBadtWsbSyscKhUv/rRkW3geHJ\nHE/ObU2IXSehKjEwMtUoCcHBnShUeGmHQpT/mnDUlmMsK1NAlZB9ru/AGb6t\nzvzk5MyT5AbwtwPrNRN0E+8IJM81WpR+OVFkt7GShfcIe0EVJaFfsb08VoyP\nXqaBl+RtsvijDGF0nd7C8Br1nxdK6jLzvj1RF2BzsBkAe/emnNGSAar9VkNs\nXZXCFPc7YYSDLYaSSmw4qs4R7QUmkxIeNC6Co/RvVtVZ34FO4JpM6fl6PKPS\nDV/QI5k+00N2coPnIbie7ANNeSOYYYEzx3/cJOqP18eYlqhSoFLn2ZHfdL6y\nb3FqTy9L0KNB7P9M2+nlCu+YmhLCYSgjXbNP5gSQT6UKnZXjYoNMs0nB2FZs\nUsCUPxFTwJs+Z8jTro3asqXZF3DpaZmK5TyvW7YWDKAaIyfMo6n+rw+ZGx8x\nH2Ao+J3JcXpYd6SH5v8hmoBzApkfu76okVgCQDWDWRnFQAlASSr7NHfFKm7k\nvW/pvfP6uM56Nu1PXixRxrNmFoyge7pmGecOdnHIJZty3mYxXTa2hRwRqbij\nSbRZ\r\n=BhHq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGqdQwj3FAvsMi44nNjvYaUfB8zU4sbME+reCTabI6luAiEAgNuMU0vhDZn9CsXok0QJ0PwgM9651m6X3JD7mhxsVsI="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2197_1612484423294_0.07997065460521369"},"_hasShrinkwrap":false},"2.0.0-nightly.2198":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2198","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"9b0f3ac77e70cfe31a304b6d4235b52f663cb9f8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2198","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-HqUBmtmFwmnskGUb6VID6KsxeBeHVOZs1JkRZsbWrTfG8Fs0roC8ooQQadN14G+xWwYEeuGKioEBNfrxgOLXTA==","shasum":"36dcf0d0e41f1fed57cc6c5f204d6e23d247fa1c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2198.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgHeDcCRA9TVsSAnZWagAAlngQAJNrSzaV3qMbptiRYfkC\n6Lp4aAC4cNQrlURIz/25muMEgncONeBaSw2EmdBPF+o3NpB7YpMbx0tGm7zM\n7FiBz6NUb3ppiVMHWTiej2CN1aBjwl77ME6U+sGzLdeMAoljp042FdeGBRm1\nPj7J3JVVYkYM124ro0STxkGBUFS8uLC7Wva97+/Hv4CR+3nnRyEmG45RKuM/\nBULLRfC8Jfi06nB5fWHLhu15gKcjDtUQGcctE1gQmC7Ea9TUV2oCM2ICNBOS\nJsBOQIs9lE/8k+OFkGzigoUJXtzT871cuO0iMmRJ4sHRzLkL7KZsHvnHqjl4\nE2KHU8DGoYvTlG2Zf1hptqrNi5/H6lvZdICkg2LNcG7qvrP3l7JjWoOGxT8W\nKiBWjHVULbJ3G7F0S2E96oxqGPaJl/pYgzU2gVjADj3RFboAFglfCbEztGg4\n55j8Hy7pLlXLSnwaKIeDSmgM3oV3wZL0qkSc3+ywH4g+Q/6mv2RJF+sCuhwt\n9U+utzaIKwTA7Jekq/zdHptISMh+NeTxeuBQO7E6XRIGVqFOxi+ODJk/rsaB\nSkA6LNCO3K8AAhbwLRgHy+NBPjSfbtK3+0gBym4b6XW/fcrUc+7XnudB8KSr\nLqs16q/A78P+PRL5QV7K+dzSCivX7jGvzWcvLThaNaOP3DVWc9qPb/xm/IiC\nWFwh\r\n=N8/7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxlw0eKXq0HRwCFSILy/smurQ8i5tVU7ZjckK30ni+ZAiEA++V5wSIugA2u1jv6ygM0XLvlf/DS9uq/8GxK6GhvVVE="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2198_1612570844219_0.49491812030502613"},"_hasShrinkwrap":false},"2.0.0-nightly.2201":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2201","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"be12a3cd11a4498dfe28dc1e194ed58776b5d19e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2201","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-9rZ03ssm9u2YfHpH9W91AW4vwPZtMkkWU2EfRpO+HWfXy/HnP1fT4sNm7LC8YtB7Zj2ETTAHod4rIBmKfU0atA==","shasum":"6cb1c01c4d9b35349c9087277bddb7a9a1da3167","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2201.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIdT5CRA9TVsSAnZWagAAZfcP/RzuRz0MQcXOr9/HSgZN\nBM56XrzXQIdhFkAu+K2AacK741aXRen77KXN5G7hmFiWxXAjilc26tGq9ahx\n4hN+1jDLxutOvuIFY5dLBuKzeTv0qsK085fjIcJCsdEhy46E4pgPnIm9h/uu\nMYt/elfTT0NG9jTtgU4fpP47tiFdJm1DhG5CAynIKoVm09Cd3Nfeve2lqG+V\nxANFpotiFWeKJ+RW9gvOvmxRDapXikA8j5qI9IrtuxylMiNCqR7Ww4wql1vz\n8NY0rhVOVHhMbNiYNGEmLI4mgrYGxUV+6I5oVFOBWQahbzLRu5fGgRR3N+of\nE43nKHWhWgRGP6jb5nt6FqCS78t58AQs1n0+S35Nmu70kb7eHlBcmJkAWgWa\n3rgaHFuq3JY7mSIPkRWtCFndY7GDueyULoEq/PH/pIPMWws1tWxxVpIwp6SQ\ng4AaFPwUbDco7gdoLXkdfH2ylUXGH91ZRvgQJzpyayJ5OdpcaCpK1md6nb90\nJTtwFZZZlMKpBBObWGz5v55nkpTw3Jg1fuyXfT5sLBpj7kP9fuJt7a4Kkw+A\ndWmQLJe2ved/jj0mF/66CYRgkO5GrgYxHtfa2MiVScHqhbhw75b3Z6FnsK4X\nNLEEuCI4SOLncUdTvu+LwQo+8yE2ZR8EmaB9fxtq7YQRxyp/03Ruvt2dkU+G\nP+WY\r\n=lsFs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCw6u18zsG9EdW6/ycNQ9LkKKAcPN+tWTa6+nnEnRXubgIgE3C4Hmx8N5EOnYGf0ui4hNtkd7r7t51krYzaUTkLmy0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2201_1612829944704_0.4319398465065867"},"_hasShrinkwrap":false},"2.0.0-nightly.2203":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2203","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"0d3abd6ffa8fc21bbefe6f48bd6edb9713512edc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2203","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-qwWVDFCZ48FnG/4w3EIZajo1SxwIRBSHEe2UMeXTUwg42jog7ZqkZzOIiAa4iXdx96ZWgkmR7yCzEHn+WZFPsQ==","shasum":"e9f735382669adcee08d5f95ec2e4cf8858484e3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2203.tgz","fileCount":15,"unpackedSize":73180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIyZNCRA9TVsSAnZWagAAheIP/Rmh+pFl4Ws6bEFA1uJD\nQxNl4d4BJ4sxXBrOT/dEeARMuBv2+9ipfQaZUQorCR+DMUpmY+oCCjmNTchW\ngFRMriFF+3hhoV3Vt4DoDdx/c2MMUUiYHYVDwEnbJycMp9trpa7MKna97VgC\n8S0FHVYMmTqlBATH2Lw3XzbGsgsZH5kQ0oeepvbik7syDVMrrSmFVLKxZrMX\nIAdC4jT1ade2ROhyh5mAkYjbVXhtJkD5IR1Jp/Zj5lD4F7g7YVHqwxCGhVnd\n4aThnAyCtfvT51wIlqAan2w93g1t25tf2OQzoXnI5K0D/yPn7othvgfhlVWi\nX3CO634pKwD1WggcH0yz5pmvcXBnQKHackitMz+22hvmc9Vo9ia1Hi9fuII6\nXqqveya3b/a/jMIPPczj+uBrN0hD5ct+hzthI4Z+RYt4chrN1fZ9PnhcHX37\nFU7ERWX4Z9vqGcfmgeNZQ3MHu+bLKbACjlalRcf/sA7+zIBfDugpocEglyHB\nepeWCbsADosouHcPsrODVCw6MHfNvWjerAZ+BKtsffDxOLu3w+LpBL09Dn7b\nzC58duKcatnQUb7R6HmtAnIZnW2Qla7hvECX4LLfyU3AN8nih4CGCFPHWGWl\njjyqDLvHvZNF6mBW2NQ9ZEOcpdzLnbHzT5gnIT7UNbeLvnJbTwK1fy6nBLpQ\nilxX\r\n=87Qj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCIE28SZXDrWl7aBUJKPQjfpkt4bdghJVyBzE3MuZdrnvdAh90k2NzlsA+ZJ71OmOL4BPZ7S/TRICbfjPKtE285RE1"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2203_1612916301004_0.9632871411121613"},"_hasShrinkwrap":false},"2.0.0-nightly.2209":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2209","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a26f6397c42370799391511361e4074a0df2d62a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2209","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-1vZqYpU031d7lj8B7oGGtzwShbComkQwDsBOzFpLbupHh2nBrHTlftgEGTp6udpAyM+w5HVuF2/Cu85YSXMPHg==","shasum":"ea08526ed21bf698b3f812c361a7f4fc93ae2e85","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2209.tgz","fileCount":15,"unpackedSize":74370,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJcyICRA9TVsSAnZWagAApeoP/Rrvvp5i4I2AvMVZbJ80\nQ8TyCstFNballyhDQH5cNrOYiCJwDXGNx0l651Z9bCVSBVx+Rst9sSONNpGC\nwubN6aXT232FQsgQy7UArXMpM+nrw2loROLrNDP1ygrky4g2KwO5mna1/vu3\nnLtYwofzUI7PHZOJPUUs9hy7XLR73aVBcb5PxST55XOjWthUwBDXNCpG+wNi\n5A9w1x6MDbgXy8/dZs5lPNM5Z+WR9gnOvcxRGjtyuaCjcjaFgRdnjpZRTEYZ\nzaL2jgDkI2lApScijPn7L3DNVO063za6nAe24RAMiuPyx7U1qmXM13AtFT+E\nJMgfbCoMd5tMQkl/LtDXEySRZUwElNUM0FL1mHNJti8/JzVfLNeD4hBSsn09\nGDaFUNyHHCMXbPySBGxIbn8jXE9nh+nF7fXg3PLIocn5V51QUgMhhthKG+fd\nQkBKmL4moH8SsTQItVNUL2bwabwCVTjq2MUioDeuXRLSloUIOyNK1IaB3CFb\n5queTDWM5DXVhntk+P9fjagjkJjR0STgiAbxSdpalG1GarOXaLIhjpg9iVcV\nP4GxJ2YXbYlS1VzbpdxlOMOs9O9iDTUoDrvcOb2sGrWvOKg5baMMfDMu3goT\n3KNxTseh/PLH0sMhHjVzs0W7HSu+DaCldbszqM3kUNwpNPii4s131C64Tltl\nu+zH\r\n=HXnA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH0hRUKszrYbV03VmJ2OmAAehc8XnU4j/IiKJ1XOS1GjAiA7mNDOxmapyD/t5FI7zSemC3svXkTgTkydvU+5P2+sUQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2209_1613089928050_0.9905707979302587"},"_hasShrinkwrap":false},"2.0.0-nightly.2214":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2214","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"560d06051b36b3f5703848bba801996f351c4ab4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2214","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-vOova/JfyYxPGd7sgJbZ9XJZ8s6huznND+1XfNOMaN60WEhzP91nAvFa3H+P9CG9T6ZnEFZNj6/0vzYLt9V/Ow==","shasum":"48139d19d2b17b6d68cb60bec6eaeb20b97dd814","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2214.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJxs5CRA9TVsSAnZWagAAqWMP+waQ605CGr09Ek85EHQH\nmjFtd3jsdAPGdVHRdhYAdaMdjqJfYZWJYkGrIR2A1+ckDEEpFkHfLf8B/C7x\nBPSoro7QQwHjHfqs5yYTQwsViwjz9LByUNQiBUvexsrtbyoQtaYEQXnDbtNv\nVPoblajc4Z1FlM3ftfsS539Dn3yRIb/i0sCxAiMyIYPQ8NZYt/brXEQTtjQR\nCCyKvlzxgkQYGv61qDC4+AGAk1KnEcmrc6qP9N9q5LDphHJx+PUxd/Dh34q3\nP+H2l3p1ienoHC8tv1Y/ao2tPZkx1LETMR12yoGtO4QeyBNIh1/A7bR9SvwA\n8okbNnlGpAx6avKQBZHnrM2lQe9/CSc3r9ZFAJYa0f8kECUDLqUq0b7EeZ50\nzQbpKQgjXBeeKFonL6zPugVlnOuR1G0ZRPaUoPoHXniVCnIwIh8cXrhY7Vl4\nU30v2M0nCCKvE6524A9EUCtTYML/gZUIyz3SR9dUCgHEQNCpSl2GmUhUdTyx\nfoQ59YLkEeEogPB6c5oOvUeLU0bmAsJYDIYCk+EkbN6v0G2Zm2lsd8jt1oEW\n9neKZjeYgGSkwVpv7ZQWYwKjfn5vDgwqEu9zHLHRQKKWUCS9fVKWZ8OOkGJV\n6Z4oPtZCiR+nf1VUQrSbjmQT1LZZ4w1aFSF9kGG2uwregoOjL6vKBuB9tMM/\nYOPG\r\n=SmTO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFhVj7cm8Q26+p1B4lBgDhyw3uF3hGjSjtcujROqYJDnAiEAmMYnR9Q9fzQ3O/LMRLu1HWkNRHpkAeE9OdC1trY4hPs="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2214_1613175609490_0.02301938655907465"},"_hasShrinkwrap":false},"2.0.0-nightly.2216":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2216","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f6472452e31f658d9b74f6e943486818c4d781e5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2216","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-moX0ZtMDSHr9AlGVwKmz4qFHzTENGNjM2LNaUym2rBy4Nq5F1nX8B0U65rXcXNvsO5OIspoTeqB8LN9PtZ2zQQ==","shasum":"d594aa517e219562f977fa2e8be0273368000e39","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2216.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKGzJCRA9TVsSAnZWagAA4yUP/incjMvXApH5oKrX6lHB\nDd+9zfQ5CxIOSc0wjtHW9I1UbgsRDzIQDIsMGVSQXFgPRnECcdd23W0BVEYy\n4T545qNJNyCC0SkmEIAdnAyDQDJSIB5PgAarfumg2blvJDGkgwjzxB1ZaJbq\nNgRYxJZFXMeHs6/fF7BQ95NxkR/BOtIGZM8YtTeUWoNmE7Rl7ngMWmsl/2HN\nGrxvm7GZ6aWcIFzS7bFAiYnrGzQn+k1w21rCK6Rq9x7qYxgKkKfG8pOO0dM4\n2D1uu7PSnR2I3BDmBAboNM1/4xaDafcQaJfDiEkDzlfwx2oDm8GUyS2VQAXJ\nSllwQXHZaoEh2dFvWgXsCthjJ6u7y5wYPZDdxgefQFGnyz+uLMLyRaPngmR4\nqnHRcvu37r2b54RGjSWHK0s1n0+ZbUIUdQxRcSnvoa0tq9m8tgq1CTh2s/Ei\n9RZ9C1pLhZjb3+opcmGkcN7+NUpZl8qv5wTTieTMnxUZpejvZawJ6qtUcutt\nZo2Y6nxlYTDvLBVlECxtEyAWbhVmZQxbC6ZuIlap5cV0clbHYnYAD+kZ02w1\nsQRGY53FHb0go/D3mdKKAKWGDGJcU2iQWVgu9Q6DMvY5uj3uaKXmNdH9jGrS\nhZ/dLbU+GRV9HhNcu/xFbR39LAq55YGjjNPzZRp1t+SThh4p4XbPwAsFLpkI\nQV5R\r\n=4AR3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCEH/oE5PQwhTvBCFGwUGRz+hPqUJoYPDzv2JNijmLbYAIgEqMVg6BQCdbE1SRZ1I1FUCdr1g6dPfUEbLtq2EQctKw="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2216_1613262025279_0.48314813509194865"},"_hasShrinkwrap":false},"2.0.0-nightly.2220":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2220","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f9750100e11b968b942ce8ec10cbb2a2690cdd8a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2220","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-sR8QV1bMEtBFooI9XZVrjKUfhl61u7BnvlK67ZTg6kstmm+/mQ3K4e3tfa9TKG6i1+oYBs2jcerizC/El4515A==","shasum":"217523f15def5b2846828394f03838d7c7ce709c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2220.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKb4DCRA9TVsSAnZWagAAYFgP/0cZeu8S51Uj7/eYQUYk\nI1D5b+rXpdx1d+UXNDHl2UE9OQJ5QCbZsMTxNiERBRbiqyMhWL3UDClgwhj+\nncSt2YPNb0t0v4C3keswMRex9jy+yKUxuHlX3RC2W6rWVP12h9R6hTbOvG8F\nShYrsvil2ZYi3TW6OY1XhGFmSZPR9ASr90X9J4g+wSnKXS3wOyuflTki8Nhu\nTsyD+aYZ3zmwGo1Qu0Pz0N+e0wEVso9ueZNrpUcXNqnvKxXdNxFonFn/2S87\nUrcmKvH5goyzRQr3IEjWlclzf7I2NrdwmAO9FDEzEkJNyzgRWnl4lxFaLP3V\nnA2hj4C+dBeFtPuPQaXyCrSVLVtg43C7EZR1DO2fg0yeRyw242+8+LAYx3RL\nA4N+1ye6xQ3eeG3KLivxw7Cx1KTDczV3TkprNCiNCbGYaj1rF9y12PjgUZi/\nTu0XblpIW0Cz6JkQhpvbBJf0FC7hdw5lixdEPZk/ktEdvYGbAaiUxdu90rK5\nw3qwPJJ5NsuPvhUz+iC4H7Y1eHSREgLERgvSQugoPQoxbZvWqYnOjwDkoNVw\nZogdzTqIca+JD6d40FeZpjoTA/bZTK5Hjktz54iGcg07qu/db1vsZ8Z67wiN\negde/ENygJm8vNs6OmZ2n1qhLFpxSn8j+3yiab2oAUefFV/ZSgFRmxuELPDY\naUlW\r\n=u087\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHhfsQ06IUtDw5DwzboKjuK3QnBt1i89hZenYhL7ULcEAiAOZzPGq8WTETGRUGTJ2UleDqDyLCrcfmeQXtvmGgHT8w=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2220_1613348354838_0.7686737313593166"},"_hasShrinkwrap":false},"2.0.0-nightly.2221":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2221","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"36035d8d0d7f785771dd24207fe17d67ed85f269","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2221","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-SeHOCd+cdK0nvp1QSHWixOUDB8S+xpPYrnB5PSOvvN0+AhbzH/onJ19PtmcKJrQ1afFDI/hDERJhg/XCdaD5Qw==","shasum":"9a79cadd7dfe0af81610224e7170835512085b4c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2221.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLGE7CRA9TVsSAnZWagAAKqwQAKFCEM+/nCE+QYw6UP72\nvFEbJ+56U4n+zsMJ7a49WThvbpEh7LrBCM5+DviG3ICGIwiVJ7vE1L2Hef1H\nPb523KS7Aw4pj1GD8cHCptbdCks399TkeyXH/aUX44MRz8gChRt7OOo4ZAKC\njP06J6n2+N35Z6OjJmdnR836zDBOZSr8TDWTtZsEBonYzUjQFiHiZaVMsn0R\niMTCDlUkKESS375KbgZtllgYosY1k1Vl5HMFrRQLeT7nOR4hGxaDx+9o9Su4\nXGXvOikldq1p/mAC40Y8OWYfZlNqdO+EqUsBPfHKjrnD4E0hucSD/6bN8w0t\no65UTTG03q9gCKsxyq7TDQsxtcKFDjIPyY+r0Ge0gQYmWR0wec0+bxI9vIOc\nqa2Yj6t4/rKCDViMEOzNgXCUFkJuXeWzyBeQi2lVmAWqWs8rvHEG8LrAc5iQ\nKNRITyFHYDbvXlx6jIyhvDpcpSJb+V7qF+s6oMAnbWoEyo5ujmdPmbNwVvnq\nLd50+aHcZVwcmTWuigH9ovLpMReDjYxEFiAl2Ohm1IvKd9zB+BAEFTiRg7Q0\nz4SMlP88S7U1esYNdcL+pnk3Cpq11eVH9l7SOZJ/T0aje6sVfA6QnNjrifO6\n1HEA/AbOngqVQtZstjTXfS/iKmp+2uNsxJMCHxv85W1y339qHCfkM+1dWJT7\naO71\r\n=IJ6T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAVJi6Ba30vjKaXVijL+C/YXhiepCEr52YeWnU6D5bAFAiEAy0CQ6RgTYltAQ39zWcyT5IXXV0I5DhSmHa8xHyrhD3I="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2221_1613521210692_0.6574974330851959"},"_hasShrinkwrap":false},"2.0.0-nightly.2222":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2222","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f28eaf60ac018d49d2176c563c86d09f84feaa8e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2222","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.20.2/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-0b3Kqc2ObV8YlJMhPZVg2YRL+d5+EamzIrl8k8PZyrG8YBgV+BVyh3R/aAfnk2XPK/wDY/2knLikdyivx/iLkA==","shasum":"58ea632a11c9185da067c4a9f53cf2e15c655b64","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2222.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLbK0CRA9TVsSAnZWagAA8coP+QC7wWwZFoND1xOZKVuH\n3E9UK+JyzPEACjB9IcTpiVQ1hfu8LUpKwyXb0gHM+5ueZDJviumXNMghcj0f\nUM98Cf3Secaey3GioYWxyJ0++o75OEIbsbuA+XY7Xa/R42prqKjWRJBRbl+4\nUBF4CpO0RKQ/r+zYr5U4WLbz5EFF9WC8BNdeaAEy3PubBII7D2pF0vZpKjov\nBim31kGMlhmDyzPi/Wx6skIyB9i1yaaQ5GNdwb3D89AZ3jUaY8X+VZxx4vmK\nq5lA51T859fo+vL9mvXy163bYiGTpWbNkhQP2hJfO2mgIoQqbxo2a+4ISbhB\n189ztLSnQmwzAg2XDRVmtxANkKTMpRMQJw3HZGM14n5u80nVQogvbizu5GOc\nAfA6ApfGqAqEcc1uu9zIiCe5G8s0yot2ZbTAXbp6+79LacPK7HPa8hjbIc9J\nkiQ56kPx6eEmEolTuc0aH0sQWp1EJA5U9gAu2dHQERFPnIU/kPRFLKyjcUzi\nUZD5hFULrzpQolBsmjIHbCxrOP9Lm2jd6Avsy1IAMI+6LHXAwfV9pjs4Eybt\nw5NztYhHQ+IFcHEDkdWa/NW4Wq5jKFksMjOqr/WGqwgSiE/gJVmtrpck1qb5\nr0iQh/Y6ckpJb3LOnYh/K1T5MVapvNrQ/V2wZ/YURmPHzj1JTT8stSzhbD6I\nLU2E\r\n=BDwi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCw22hK2ma/NdByckfnYUWIepvEivJJCb4NBtZfIywwAiBoQMoenKzw6MUrGm4o5dQpesKiuZEHHOcmVkyzr9gfVA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2222_1613607603961_0.30920679929918315"},"_hasShrinkwrap":false},"2.0.0-nightly.2224":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2224","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"2470d3c3bbf50af01d870aa29ff27241228abde3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2224","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-AJ6pK8g40NJlzBL875lhWUMnbFLRFduPUB+4GxyIRB6G6D7LWsjrDXgs1smZrWt7/10qGQpdtSJO96LMojGxyw==","shasum":"6f18ae780865cd40b448bebf7d478b5f7c95206a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2224.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLwRkCRA9TVsSAnZWagAAL3kP/2VU1K6QVpHX234oc5p1\nUCjuB+W7BPdDH1/fN9uRNjlm6NRtCm+dTDQG8jdt0CVFat/RGG7MOILvew9T\nn6dS34P6UMnPdEjKVs/hH22xdo/gPtV9gsmM7ZdI1G49Omhos5X0CFA5raom\nDsOaR2lnlOrXa1zU/UY/3M0kbEWr4aJDN1Af0UVGSVuUkzZvkhfEQnE2m1Ok\nxI42aWmtX85umTIlEGEF7+8svxOY5YoIE8ze1QOAtvpd353me0+joVo1DPJf\nqHGrPuiiYAHOYe1fpjecZzHcfOji62JMivd29rdfqamq5tLrJozwOC+den0J\nFDZuQiyEvtBBHcfzWht9K6d37c6OS5v5CDfIgvnwv2uq2eYPDGfYscTiDbgI\nP7w48k3ovZ5vzEbm9eFnvPomwhg1o9mq5LC/N9oCwtmOAFJQDFKsgtc9Q08z\nDjl0x1eEfLJjZW0s9mY03WM2PVkgdPfvJ5nsg7lVx0C/XRo9P3PHaKu7VhPy\nGlmyjV/rodDcCsIVdD1LH/qTEG10aoO+HjzWKk2WzR9di/OTA1S41mz8L6/Q\naJHlQtH7gF5/GHuCo5LP2478IP1fDU5vi8ooSsbDTJhqvdxbm3kyj5bnVde7\nHrxLhJ4oBcm9gPCyTQppf9mFspnOGMy209k+yLmH41KS9tFXWB33zjir0SKA\nj0Io\r\n=L2+m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHfRzEMH/qmDXo6pQ+ED3/msZo6YMRWWzLA/Ew/wulCwAiBHp9+4CQ2ixyWC01y3C0i4JZ+wzp7x2NccT2MGzkmUKw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2224_1613694052272_0.8118011850999998"},"_hasShrinkwrap":false},"2.0.0-nightly.2227":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2227","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b6c37c73f8672c9054a8409c6b4f1e7551923225","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2227","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-26TgsokHUF8GkwzkHqXvAUTMsYreKk/QQOLatLfANBkEnwEVV+nwymZWUeO/Kut/r/UsEYah2TMoAJc0V+YzaQ==","shasum":"3d864ded7774badacbf10fd647b01bcb147a6230","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2227.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgMFWwCRA9TVsSAnZWagAA7pcP/jYH6zaDQR1fzTJeKAsb\nWEvSQgbD8gMWzo8G3vmm7DryopOhnesLoEq4ay2UOzM1DBUUMJ3qL+I1X+m2\nMXhIKvK3dR1FoagG1EUNuTpZ5kYkPtSSgHNDgwcsTMXKvOzi+XLCFetByUKF\nW/4g6wwxRuVyvIR8utCXhA2ttbygMQbOeLAaVlFn0s//XDfyJTI5h35Hfmis\nq7UHrdC+ub9RiadIbMHeWMFZMGCt5ynWxUd6bQ5aUhyNGRxNVQMe4XFvhSfM\nhV1aXr7fJH3FZFKRgjNm8RHXOqJiPwfa4duoHURrIEwEob3/diEqx163gMSM\n7wj4SLD3+K+FkMn6NxmaOBttmo4i/J7VHhfs0iayqz6UB4c0i9yIzko7wlpg\nwlI2kKKzOoanXVqCdTniRmxTG/JFtQr+3P9w6y65gL/Yd6QhLF8KCF6dkQhZ\neAUP11NDUo/XNBZPCAzi4NHcrf+7ILQ3h3qxL9Tbd+fdgSeBmVX+aIA43Z1K\ni2l1zm/dejx7gwIq8Cyg/q24vB7ewytYQ/chtEHxlEdOcoxnlaNTuMTjgYPY\nt1ueqcYVdb4HZ6T9Rj9g2B1J+qQmAZQ9MvQgMwyNMThw2yaXEoYYEFn+iMCO\nzbyJ0hHGmu1m8EQcJDnnoQC43+BlbKDM2Uj0MpaBjTDnxoR4ezyP3wLjE0Hj\n58Xn\r\n=Wrzy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5/KcQL2udgW/dYcsVBqqeePCAizrgaVge1k5Q3LSUIQIgHOAhJAeMUFiFNDuyYzSB1Hs4HwUuViUZMdN+udyzUpA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2227_1613780400201_0.4215764806118538"},"_hasShrinkwrap":false},"2.0.0-nightly.2229":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2229","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"61859206c7f1ba6b3e1d26a4aeedca81e40899a1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2229","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-DRjjwSurURmq39LQjoKAFraVgdALPxKsTWQKj9l+5tDCx3dICeFx6j+5nuSRftmseKFkhsgAEEnBbQ7abn5GuQ==","shasum":"402e3257e1a3c94b56f3c019f8cc1dd61695f066","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2229.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgMvjcCRA9TVsSAnZWagAA0QoQAJi8qnGguvFrFZYkcrot\n/Bt73IiqdIrNGAcvHrEEbZrhnfjwbMw9MRywZxlVIATBPYVKG5UkxJElZvdL\ny1QCT5MAofbtY0lLCCqmwcg01gRMdh6jC23yEQpoAqZOyVDpoPecY6dRbKLC\nyORB+cVWcDJiOiz2gUXpdQD3ip0rF5uImq0hn4qGLDhtbvsSlNUmdYI0hxZy\nCqOTb3QN+z5AdbrQrNa89pGue4RQGG7AschIAtxTa6pwAUjE1xhVEZwJ3n3O\n8mkmiJs/34BXptQzZhIk+oUqBdVs0FO49lotpvZfDg161TRYigu9I9AW8mot\nCCu/cWb8zdaGCD7n8yGX98DeIb0k/QPkDQghIKBYPG8KeQISN27jMgcEl2C8\nL9eH1SaDc2//WrXWX6p4rXpj+Rhz1WZaFNm/5D2goYBT6QPtZ6v4jgFZZvLA\nF5q9qATP2+w6jJNoDD6tH7FpSDwBvWQBeot+Ho6G5l5niXT5+Br1qvNLnJiy\npOCr06GSpJ9GLZAhW3NyyaAyYdLkduTgbtgR3xPz5tcW7JxkIgFLBWtVvX5Q\ni6vTq2rrs8mR55H1B8tJinydmB0s7JwJH6vPMgpwpEM43jcxaVkkSyYlCGuK\nG5xJayVaRHWdJ2WpNBy766xglDwccih/7UlYxxr3Ip52VEc4w+Q24qPD6+L9\nNSGS\r\n=qstw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDyIQ+kOlC3pRuAgB/Yea3Z3OBhmi0V1RIrsBmka8MvAgIhANcwDGpw4WIKMOC0HhoiOKBR4YXTeCdLTzLiX3emRc08"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2229_1613953243794_0.3568764535657436"},"_hasShrinkwrap":false},"2.0.0-nightly.2230":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2230","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"46af2476ecb78921af21432f978d863fbffafd9d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2230","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-Fur4CFnO71i6IVtL2+PjmbxihQ03ksZdORthzpfKOBZceOul16WsFIXzHG2WHWAFowHsazyldG11WyBKetdeVg==","shasum":"b8b95d76abb0417f5282a2054311899e38fd800c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2230.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNEnlCRA9TVsSAnZWagAAi9wP/2ARf4YEUjl8hwyS8eOi\nEq9lZUnrN1/XNfbmrdgzm2TL5Y5ITz0YXRPoIhHA1K132MGzsVUl+iZn04Ul\nzmm4wDNBtdlyx6ZhDpUFIVmFm63B1XJu9QHCyVCZCv5Y/cyk8Vcr5vaI9P6K\nJepEi1YY/z3W1vsNfGxM/j0XYn7z0cssCuLo7e7ZQEmyC+4ou8ozC6d8Vs+6\nNd4ttqvAmn0coRI2iWjl/TPmKI7vHDslSdJAMX8R+uH/ZhCWbTVZ+r6sq47Y\nCouYIQMpAt3dCLxIpCbqpxuq1zc0sCPux1UY2X2C7I6ZOLh963HjOagxP+p7\nYBBXVWGlvFBBiB19wGD/9fQ4+ulRDAVjnYKFnxX5POP9Yw1z8oDUCLyvtZay\n5BHKo1akpgMD5Y/isg8IB62bPoXfXxLt06TNXAEQEmxQiL6Pp8KQ4muwJIll\nXieFk6Ckaho7oHEZsaYRCcn4vD9c6wiwfx7hRlvdLOlxKRZ0J9Gh+g+WC+MC\n5rCjTONZdWjsoPc0ojMQdQNo5b52YlOy5fmePoaD5OcUTp4ZD+i8A2rUbqhZ\nA9Bkw7ZmmJH6JzIU+baYBnXYQblaZuEjuRO7AZLTIU8YX7bwNoxUnn7nujr8\naFwDBHddIA2wFxsYh5GD5yL8BM+PnyRvj/P/CAT8x2bXCsRZbrdYyvqo0Emt\niCdB\r\n=j8PS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD29DWoJo34wEfpci2AfXBCdqBy3WFHXQMtKWcoqwnq8QIgA3RMxzFdWOC84QDsZkKEKzu9o72+ji0k0hLz+V8BUWk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2230_1614039525459_0.28780631821371405"},"_hasShrinkwrap":false},"2.0.0-nightly.2231":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2231","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d77a564742998e59d65024356b57395a54b93753","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2231","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-I66fKS8jBnmiR9kzvD/nTNGYlhcW4Dp04jRX9HA48h/lZPUtY0gP1W/N5+cuNbZnyVxLFYVwnFZM8/9ULK3KpA==","shasum":"08368cbc1ac34bcb403e1e24e71cd705a556df9f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2231.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNZxSCRA9TVsSAnZWagAA2YQP/1zth7BPmt0qrzicvLjV\nNQBcv0tXVpd2g7VWOP0PY6JMqqBMNEVVsxTJMaCfNUSCF8TWDPgrG3YXVmZi\n9JYaINHekwve/95R2BZLk8D6+UkHY1LXQbWJ21uvOP4Uj8H1wXpNwTuIdZkq\numte9AdAZ7SkPKGGhN4o5H+a/zKSKOkKE6T/PxmwxeCLSeVB91oVXWml4/VT\nGqq0O26iMMdhb5YBwrr8w0WR2rbB+BBs44lxIx7ptta6qyuVl0nA9osYeFoQ\nJHALk5NePbfqEtf2IgaNbNvv2SrHB7Vge3urMGKzdDvSaqmLKIlovslc9jLE\nN5a9xLiMcCcg70LCxcDKX2JmXhU+muWZ7VXVt3UKhroWguF0VSmj6tEZntXg\ny7v++Ti/8DMlFrIiyW/U8X/XXPO+seT6+cZNIgN3kLTUyCjArekGWj+DdOvv\nBrLtBh4LtAQvAM2WitNUOkJsI5TOhJabybl8V7dLwdhT+RbGys8hPBf0b77c\nSU81XdtBj4w2BlqzuASODK8avzWtZp7XyekHn6PTTVn3dK4xUgk/hpF9nOfy\nYOag9TTEOqcCIUIsxD1J06oDBVgS/9VAfrzy15+ruYTBJUgvJK94Fx6iYokB\nQjVnPl5K3PcHtizlx0/WrLSUJgNHy6+4hiFlVob0wQsC3bqSat/CV2N7qowm\n7YmL\r\n=oPTU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9nVmMb2HY+ifzCJLyt6y/5T2kqlIOFcjnvXaBfeIJNAIgMsHZZS4ABjkSmKnRb0Abu4rq40B2p1fcOgjFG7sW+xA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2231_1614126162143_0.9917136352966367"},"_hasShrinkwrap":false},"2.0.0-nightly.2232":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2232","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e336705964a6d92a6607912620860e3a19376bed","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2232","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-Ahoql/8A+I6MdXq2dp4JG1+kPmNsTAiPYaCzJdR3ckZAzIcxJSPaLS4eGc2crHN6091yUfrdY0GWEmFGzSSZhg==","shasum":"b642d30b7f85fe146a26f8c2fd65b6802b9269a8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2232.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgNu0SCRA9TVsSAnZWagAAsCcP/262MVU7TTe5BsetrYok\nR0lEFus0NjUfVQJge3/gGWmQp7+4HSYPRBspaBykGdyyIGmiO0Z3Y0T3YujG\n2StwrDgtqq6ut7N5PpbScoXlPNZ7ixeXEknA3kENIZLWr3FUYrv9gBBANbB6\nCX23ouc9NSTW3NDsODbxxgLTSbYeXsQiT+ap0D8ellx307HzMTplWV8Wu6EF\n+xnxhNES3H6Lobvs+CvKT55MGlhTfgc72Cnll4uMhj0Dbn3HO9OQxl68v4zf\nYf21Eu4jb5J5f0fwM8eN6BCZhvKPFzN344PN/n9uNASU47FeLnb9sq84LMEL\nbOQhzBCatPGzk4TbuXP7/xRcq7EeJ/gB3vEedboOqlMBKV/e1hDYoPSEBTh9\nmn5DNqJfdpT54mvyCTNqBTFQZXovpVypt7NVE4597U04pEi2Sol30NgYot+j\nMK7tNB5QNzrD6teGYBiBufk7IlgENhuaCF6vb1XJ0jDX5iux0dLK7gYcHoWQ\njMsbCPG+QxnHjvYYm79ARNSP38v/+OtOnMvflWqkTlBIXo0O58oqVbf4nlYb\nbGJ7h32YAMx8dBQJbW4lHswTSiZZPsXGWpzCdCY/HgIOoobduhRdaiYUMqJk\nToh83JhVorBau5OMS66LtADZEGl5oT/Zw84czK8WAWL3e4jBM1bITxohj5Mj\n6zYq\r\n=wk87\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCL3O3qqJDI4u2xWaN2kvZ4D9I3Az4J4xK4+2pgljgYSwIgdZoMPbl5qAOm0QLII8y4DJP1/EJBWwCogbjMB8l53ZY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2232_1614212370187_0.5017595429624477"},"_hasShrinkwrap":false},"2.0.0-nightly.2233":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2233","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"00ff8ba2c24769cac0754f95b0e31710769ab15a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2233","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-9E8wNzGYMWZqVWWYFKl0jhXP2KfIQyALRn9Mq+bXllophSS35ngnJ1w4d8/S6KIq7G+/KeoVeEGLesNdJ5+Ohw==","shasum":"75791981723cc9fa16d3c5940952bffb7fda6246","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2233.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgOD6vCRA9TVsSAnZWagAAS/4P/RVuTI50CTuIddoVzNa4\n0mUSTWLEkihCd5ZvWHfd7ZT6RmPpt24RJpyBrUuDtVInQf+MlXwh5wVMfgHQ\nottqa0C+8Nc2aIH2n9CO7neLX0dioxSM47tblnjAwE8kE7qd8xCStAGEh0gn\ngzH0A6ttCO6EysRiOhNN3lE0Hcyhzr3DguilLaRHleD3BY4t6QD38GRH1CT6\n4Ccp1Mz1XnB/wF7hNUP0DDLy5YNUXeZP6RRPDeKqMuug+1NGD9GSuxe3ulqC\nTNYcOCpxbpj7G9AUtYw6gbJjzLIRTM80BNeSqoizUWqCJEl22gDSg/NYB0ql\nDzKUhmMQgMCntW83cW4BQUMRsuRoLPC2dTJtz+pHo9tHFHNjwBy90ZVnS/Ay\nkwx0EmGXRINOmMtnJ8c2Oqg7gmHYv21e6I42ekupZy5ohkKk4f2nVgPUwjXo\nDanK+JqzRwpCjIcYDUbjFLgq+QndWpvVpl17ApNhJ7pGvsv325aXhh04ctOg\nYexgeiFdKGr5IHn1NIZ7vE/Lak82HYXgf0aw8ivSIa8EebMIVObU9Y8Up2Gd\nXhFtl6q6wxI+4Ms8TmU2+OA/8Xt6U0bB1ZAbb8FJEv/2z1j0n4HFIH3WyxmK\nBeLiUUNx6JuKLGUPq7CPOsBGGyxRlYhxuBDawOrUNPXSSJWNqTqUb68ARuln\nSrTC\r\n=2rIV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA/4mEyy1GRAj5yu1F+rwqYxcHpF0JCr0BazQr9strQbAiEAjdjfD/YpwgqXzHu58Z51MK4pK79m7iZrWw7LAAgB4d4="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2233_1614298798921_0.4417224144024152"},"_hasShrinkwrap":false},"2.0.0-nightly.2234":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2234","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8a4fa3ee3716087a38fc60d482da18a3a7bc3370","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2234","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-DYsdwjofHvlw2CicjzsYEGzMP283cXJ9nhaAfk1hOlfmwvb/aS/pZ3s00NbujsO7BRawcNT5uMeby11qMdndsQ==","shasum":"f9cffd0d33260c257902e9935343d3b06ba12b2d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2234.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgOZA+CRA9TVsSAnZWagAAULoP/037O2rRoBxszUemhHNA\nXrnXVAj0DRYdKFhRNfYBlLOXxZkUeWKxtV6NnZDZNHQQwBXiCDawc6zFoxkW\nagxP0MUDu1NoaUqsYwlE4ZZjLJ48sj8A74D9mXa+JR3lkRPkLHw+Tm0MhlsA\nqm/munxrMRhzkyITptbEexV3GO0jdbGocFwLuPLBBrBKUvVRFHFOXQjSFCEJ\n//ZQT6z8TZSOB13LSYyykm7EO2uAnDLLXDAS5Pp+nMBG/6Yyq8uw3vwLw/3G\naoIf3SZEzjN6ityH4g79BkQFla1fi+f4kUmhFA71Er4YEkEScBaHUrYWVNnI\nd5PiWB6eBb73V8IscVVuXzbczcZ0lQSfmQYXhSMbIXABzZ0zWUYkLBNqLhFJ\nMu1av8wgOIqu8ATverVJGm6XkwsAveyGifmzdo9DMkQa+2zlU9FmU1AB9teF\nPDaaOs385NPaHfkgoJOFyYTHOscji62kWSJPoH5yFZsgJ8G4PVl+EunS9fwE\nB4ZRMgjRtPeuxgD9DV0dBwyrRBNlyPNEfEbrCJsFN8FOYf+HkVo8OIB890Ga\nMEXImWD9QX7/cQw/Pm69nQaEPHPQt6+H67ntV2vVrXTlUWy4stQI4ydy+ALB\n1R+rkcCBsU6PFOP5TqW+D9soYP/iopd2Sr5exsxY+QZg0kNADvaXERP/m/ry\ngI+o\r\n=sa1a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGZ7ZYFOKfqGnPjRSXQFCtHdQ4QK7V5EOACYMqUqH/GQIhAOQdZOh8ltG/SfEfXOP7/Vj9aFHIWBroqekIDDLBDI2m"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2234_1614385213712_0.4589106508182246"},"_hasShrinkwrap":false},"2.0.0-nightly.2238":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2238","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"6ce9e707443e609e1961d24a6563bc68a83a1486","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2238","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.20.2/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-DnvKrDyzlRhZXb2FGwyh/iiL6KUwvRZ1GHlqlzcWSJdV8SxmmLnWNMsOia6HDtKm+KkuEs1Z6f6gpW7TKplX+g==","shasum":"59d68e8796e88db067ce96a01ade3d6fc23f8124","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2238.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQCftCRA9TVsSAnZWagAAEHUQAJkUUdMr/ySDfyDQM0mq\nEXP+7+Oc+HTEk+LgO+7DSV32Lt/PdL/Z17BhDZ8LxHp80XDaQd63oVvdrTyD\nImpv+QJFJ45/5wdXt9jNOq9AsntB5lefwsebIVX1x+ai/xIpQeR8nhyhWuzw\ngjqGIyE2gPKzP32iaj09qEM040bBLXzjIwmWEc40bPawFnqHlTeyanw1bSzd\nLCi7VkAfjNZmPW5nMulsAaKOtNSbeV28T01CqqrKkLxj46rHt0OUpsv50Ohp\nM7VmaP1bPoOFWQ9yCUtmlqT6/1D1m13tlMSWY0juD63WQZf/VMz965lYRX76\nrA/jNyoByqudzp5i6C1DpZo4i71TTCc7fIRq2JUmXznPMfdIacwlT9rZ1bhh\nQc620vS5OxrYR4+OF41pGLIibOjI2sYV1GRfrex94ex+l7Wh9wYV4l8K14Bu\nAzDYuZUCkFw7XyO5LRGm/KYL1kz2b7b9K8H8BcXPFZ/UIzR0idwMLfXbj6OC\nHLkrqLQNaK10bqxZVFKRUtTpk7x1ZHp6aQuT7+/lVLym7R4jIo4Ad4lXiZ3J\n9Bj/0oFcZrFTiW9u3H00rCd7fwqP9VsitdQ/ER9D8Zx+L1a4sDBMzXTSC2Hg\nal6QI0OuJ++23XYTqtvPmw58u4u5neqq729Dg0NTGBMJNICOYR7Pqk1EhNFz\nsXgP\r\n=vc2T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC792z3UoZBrtoeWue2i9+2tGdGYw6gqC3iYKLyGhjZyQIhAJryg69yTP3pC5BVFJlu7ZNycSKbRRb5znWlxLP6nAnX"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2238_1614817260541_0.6029623578863335"},"_hasShrinkwrap":false},"2.0.0-nightly.2239":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2239","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"eabbbecf5a45981d2faa10be55d55115fc1c9bb4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2239","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-somWOv8QimMnD8bzrRMaPqII5qQrosgXYQeqb3MgLZ0qUpdp+KIbf7G1MEzmoaAJQJfL5caYAuIpIrbkxopt3g==","shasum":"b027820554e359884a8139f8b000c975985dd4f0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2239.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQXkNCRA9TVsSAnZWagAAISgP/2tf8dFyk5iZGwbNp7Hm\nrRuaILUdeiwKBJlsSG6oZFQyOIk+ddBM8UMhe+xzILiVmSMR74H4g+mqV7/A\nS9m7FgCyu4bbAvX/9+Dx8OqYvJta1sUTq2dl6g2lkbI0qwCH/NuCLqIfTJxG\nu51RtknPmsToiDAosI7MDd9gbm8lU5x8FtFNORE7w95d7T+WDTt7qZnOXfrm\nApSNs0rbCK3rLUKort41sKK8KPdj1PifgSXlRkt/rb3BUTQclMZBFKlmTraI\nS8BK7xw+8mG7xFJF9myeXb5E1qgnqYC2PIG4Y631ufPlqquNO0tOIWr1prge\nkJ5k/GG7OC215lnlukMEOLzrNersS0wkxSwbL5nLEh0a+hO+e4xS6hZ6kOMe\nmg1BG3vldEOs85zYrYV4dphBHRTm0qwPv+DvYVQWZJvxxLLLrb962wPbugpt\nmz4Xh9Gix6rVN4oatiBzyodaXPRWpVm6JIOOZ6z5wgAqICU+fyY/30yPBO8N\nX+SveLEw6UXA4l4Kp/3QiGjc6iORomrwibls31QoLea0b1Gyl4hi3mkAUJXy\nBxYlgFY7OQqqbq2W5ixr+uU01u4xyB97e8tlYkzUBmR9sZ8DPxBgNjUmtNWA\nDxaZ//OoSSPaiZWWKY6hBJ6pGWvWlGKQUtIkysnVqdeig01Gs6nbOLPHfUbl\nVEwK\r\n=D1eU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBaXI8BjlWZbm4zD+vCivfWeohjUqRz4aNch2OaxDuZeAiBbKDdFhCVFnT1hWGZ6YcFMe6AMP2hJIYc+VlJIWgp88w=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2239_1614903565353_0.8500005515616909"},"_hasShrinkwrap":false},"2.0.0-nightly.2242":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2242","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"98c5902cefe1bba6c890da56f111e4b31b487c64","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2242","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-6eL0k01zblvxTQvmZbcb3JimR+kXLWYFU9YoG75ZQ5ZNEhvLI/c1yim/TJkvAY3Xd8PtXEQJMoA0102F8mG9nw==","shasum":"f247669e939c2d852ea969acfa1b65f28fa46bf8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2242.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQsshCRA9TVsSAnZWagAALJYP/1YR2LK9nb9szpclve6v\nq7mDiyGhq4373SojeFvmNtXoyexD2nmf3ptacQmAMXmooGEmqHm2RpmOTYFR\nXl9tOykuPTBm3ZAV3HKweygMJxJm1Sll1bXX71qwEVSWxo6kMBix6W1skfZa\nZOcDbJjt1ww2pjBpsNjtVJXPH8+12Qri2Oemn/Fif74piaA3JOXmmt74W+AB\nwHYck799cmKP837o9FJorTcCPzqTt31YR+0qlEWXeZYv+EirncVZQDKRtff+\n8Iuddh1lCxseQKDAhDM+O/78ezt+1PklqpXIj+NjGilK1CGh5JExDv0nJLo3\nbzvecP/Ll0UbGYv4jvcn1oN2CmL4voDNf283QFnw+Nywl1qOFYSmmniIkO/N\nPaPwStlnWJ/XrYGiKNF/nRteU8TGkEBhVBU81/yxuZq504R4Ioc9Nnj+ZGKr\n6OCUNh6/PM3nLhVAU35iMm0aFjGNJRVsNT1QycKEUTyKoWx9Gl5/DDoU4Ci3\nN+VD6F1T+bvVkzZXheXGGCj9QEKRpGyKKxaFYM04N5SoX78JWQQGlF39gsIE\nKLl8UfJpdABi3bFN5TRli2OwYmXa4QBPCmD31jBJgBzp4auy2WSCLv3jF0Aw\nHJNgyQaWYLfirOJsVrCJiEx2oOX88hpm2Q+zOKs91s9IoiwTvQ1VRu0Y15vn\nMEoe\r\n=Yl6V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3dcGaMU/YMT0hxt/3NOo/8au4btnXAWuDA4hjk2x3VgIhAN0sgLyOu04kDfJ6NDXp6yhsbb2qBPVVGPiDU85C+n8j"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2242_1614990113519_0.7162693108067917"},"_hasShrinkwrap":false},"2.0.0-nightly.2243":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2243","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"28eec7be0a7dc709f1142e49543d7a3770d60980","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2243","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-z5ERsQr1f5OuJ4YkZUcKljTzdL/YDTgQiqTKS7eNp6vrHEYNqhrqgP7vRK6Or1x6UJKw2hC4l2DbZ2qxzW2ksA==","shasum":"eda83478ffac7a95ca33dd15d5ab1d6b2abf23d5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2243.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgRW4QCRA9TVsSAnZWagAAxXIQAJipJ4AaeIP/8Lx3ghYN\n9wz2fo3vls60FviCZYIttR6ZyiJEFUJwYvATrkEuZoWiGOm9EuVn1WpOOpj5\n23i5VW/p0Q32oU4QCabZG5RME7F9ZA0h4rIENBWAh0BjfkzQBwe5LaSPl3ET\njkehrxg1tCzdCkv4Tz4sppa+iAsG8k4qOiYoCeSLXdu8xB1CwJUEZ9hgBMJb\nBJ86CxsnkIT+zA9UFjPeDF+lF9L0ytXeRwbQUnW2wkKDvSPsYSLxWmEeshlE\n5ASzvh6FrBWhGI1PX0mN5qL6867u5E1o4M6NLoDZADwRpCnMIJNPkEDI1aUw\nZe+I2+ufD6om+ARwAw6BMtcR0fpEfCLeZXGfMqEyjdtX5aQ7pzBeSP5K6qDE\n2L5enDl7ohXHbOMH/7l7T07y2KcUIfU00wgg1PMakn1DZictKz+WnO9j6UTh\nZzAKmBkCdP48mRXbTPoBFTsWBQbcha7NmUWFbVd/PAIpf6Bp4CLQ4yJgeDt9\nb4eoLaCTDZV9cKB7M7towOZfF4WI+aAMoNzx3/Vv7VWZ4TIAC0t3pcXBHjWL\naj/RY4aXp2wSEyGHDZRXGsSsu4T4Jr+EO0a6mNpclzylu/K3h0lzfkYhkqvu\nRI3nUpxJkg2omxiR5YIQhH/pucFyrq16KRZPsm6F08cmeaY3dc4nesB1qMrJ\nmQbR\r\n=fojn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClVurXdMqMHehhD8NgIZioELU3+BKps1SEu+Y8U+6AUAIhAIHhbKirXA/gBmOfmu8yp8BpVOaYJ9RE5VFq6qvkAw65"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2243_1615162896303_0.8041678894847819"},"_hasShrinkwrap":false},"2.0.0-nightly.2244":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2244","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dc8586e359a289d65bfa4945c405f7a72a0fa596","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2244","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-8kaqBiTBthISBofOGl/x6hWaWOU4oZuVYYcJBG6rwKlzOJqnDGsHnTwcfcxXyPcUvdCc2LKPugbh5ucqiKtgEA==","shasum":"2271758c636e8d68bc05e33bdc0478fb7384f956","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2244.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSBDaCRA9TVsSAnZWagAAEkoP/0wL2mB5T3lmLhyZEqav\nWk9Cg2hhdXNDq+cXJwm3SL++9DP7XYgVs5W2opOVss+Yhdugke48IGIXPFjl\nTHWhiGBl57Bx7lMFs3hGq4BJB9rJrudZ1gGx5/kvOYNO13SdDl5ls7wjr3L3\nQsRfcjWdFd0f43wk4Dd3r4qsQAFPjvSfoa7wLyTcOHKKdMmfD8+sqgauUIny\nsvC1HTRKJ1q0FD3nnbOTBkZZ9UyvceZe1iv8MZpDJlS+m2DlFeItrIDRu+/O\nOtlX63rtNarghxSCpeHckW+Pi6gwHXGURUWZw6miIWr8yQ7Fe40wfDZljgDD\ntta8u6w7WO8kKGUH9DdKPzEp82gn0N4///pB8ihDnQyQpP+nPSBWTFmcSZHT\nZBeU8ORUjQcHiITLmdE+EnXmSzzn5RNSGTfpp2hyPshq0b6LZ0FsJNVJDjAZ\nSc0bQqquGVukyeFlwhSzwSJroWeedw70Wduqvt3Ac1kwfjsip0JRyx9HoP8Y\nwjWM6aW5jAvXJgC2nYSSOIcuQlObvthjI1BRGl0CCNThzgNZmGhPtAr4dD/C\ngrD9iY7cZSg2r8jzqUTLDaQPQLDMG3xyrqYmQo712nOHT4gwccWIDRJeIKE4\nwoIQ/UamvGWDPQADK6BpT124QZ0ABMsd3avNcDo0ajnGUYhyRCOcVbqxDJmU\nNLw9\r\n=Jqpz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCdMnJUMIcCa80BS952L43lDOPns3uWmCzR9I9cpgYfqAIhAJNjC1pEo5i3icDmCjs0xIpb50Us0Viunrk6pg/RkskW"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2244_1615335641595_0.3469464687981283"},"_hasShrinkwrap":false},"2.0.0-nightly.2247":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2247","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"7eb2b1630a7de109e26af5f2f2b5091164058d0e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2247","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-SOgogbken4gSTS4eu67ARlyxN/J8sQm64M3mRi9L6c+sYR6yJqjwh8RH6S5i4eeZ8byS7wXPXPc0sxc6VAvqBQ==","shasum":"49c8423574e18b457452f0d2c510262f3e310336","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2247.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSWKbCRA9TVsSAnZWagAA2Q8P/1xNUo7kVk+aLoVesCgc\nH4yenyGN8RFKBU3u7yssXFS38xEDS7+rahjlCfhhkUyphJZua5QnEy2luOoS\nV5ySt7fHNvt/pYGNKDCZoAT+do7ba6VTEZVUaMSWfbIKq7dg5U/ZTGEgT3+N\n0kp/gVP+Xj9RcxL32YUqe+eEw1HWXYRYvZFQ32UVcI/uQq01aDCym15MBMFs\nywythP31xbpSLsJ4qpXQRP6Rqt+sj1nVp8IX3SmRC5UTHmy77LatUk/m3jq2\nD98E+Wb9h6e4dV77ELk/CkvU02c8gTLRIJRSYNa03kVukoBdnc/Lw4v9UJuO\nwxHRHt0e10q6sHL6kLJxF5KWOtGzZ5HMl3e1Hrm24p5ICuvfedfd6Y7PKFsB\nL6MGew2dBFwS+zz2wWdIor0cNWlUOtNHOWQbHhZynq7HIep/NP+ZpTAc1BVE\noHTvS+jS0WsUSdYTffyXH7Q8GtHl2h1ZbRbMootpvvn6UaoId3CTDudGRs7S\nncgKB1Cund6N0VV79TL+OwAJ4D4RhZWvrYc7BBsH+r332wGv9T/NPHJ0WqwL\n8dvWn9rjcs754GQhp2PeWe4lccifWO5Ehi9tiF3RFzaWehyKeBg+WcpjJNHF\nThRgE1gWlh5vRAkZuYKqYYOWwhh/be5ISKeFIzbaPmmbfR8xfcgYctIYzHmk\n4DHr\r\n=4NZJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICYyM5E5IqZNgLbpZguTQHDw9fBalU3vBPFx8ZAtJwPOAiApYLwBYDEFnnv/rhgsT8JtDZw23GnnPncDbFkfXkC7ng=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2247_1615422107093_0.7650261666640779"},"_hasShrinkwrap":false},"2.0.0-nightly.2249":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2249","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"11ca1c9e92b2ac6dee4ddef5996195ab7d8659e1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2249","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-rNpbo4uAnp5iLywNOK5xJDSDmuvu5fzn11yVBNtSbrDWyTRMXtbKLs6a7XPzyzTx3PH6ghny8umvjcA1ngHQaQ==","shasum":"cf3318440895df47be694ab9c59df81b25b69a93","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2249.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgTAXUCRA9TVsSAnZWagAAHaIQAI68QJmdXjGKwHWZOxaq\nAzmMiJkUiZOjt4t2/VXqpL4hO4aAm32FoWzlpFrYoh73pkWq6ffOi6va00Nw\nGR00xaSeU+xzU/j5/2c8LqgKHhLlGLCuPqEZjCARdBwH7ruUsqy7JtaIs0/z\nV99c5jEkcpoN8yU0Nf/BOfdU9ryFIBIIKIkZ9VyShiE9/Ryv3RM8f2YBnMNw\nUYD9hlsJp7uObt0Z5Qg0RaOH9s5vlKZpzpbQIYp29C25qZUCY5ySBKlOh++F\nJrP3JMaQ0won6u6ytHEiBmBa3u2SpmrB+nM6WmiulsqajOXi6yqOTtuxjhGK\nOKgkoE04xJCF2QUT0wZywXP9+zlC2MHUILDZ9OIv5xXzG+1DTDda11mvulqF\na8dl/GpOIIXgy97ZYnsko2nSRWdpXeI8wIMvzqT5xFzd15J1bmXjkbY3v+uc\nfcBZzyfPPemVGf+UXjUh1J4UvICR0GprCwUEK9GFYKXBSjhRQtTJZuwfbIPh\nKqj+UKeANvolIWvFLH1I6GC30MX48+rhd3eQqQUgb2WupwpVGK17RukKChqB\npHn3r7gFl85b9vwrwhzrC504K0u6JY8iaEB5EqqDfV/Q95TRbvmxxkc428z0\ncHhkzxfhhQ5uaamDgwXF7zf1H0XdvaUeCXvWgzssPgB3P1xUvYxxjV4StYr5\nST3c\r\n=VrTV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbSaTK2BxSRazOmOjl8D+E+3kW4/4ZRypfsFNmh1nKjwIhAI53uTeqqL1uTdzLUw7m1EnNvLNxtsb8Yvd9d9LUKTAV"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2249_1615594963596_0.5730425634571277"},"_hasShrinkwrap":false},"2.0.0-nightly.2250":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2250","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8366801abf9681159b81fd48e4db0d787e59db4a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2250","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-Hg51iMFkwSGBTED7kkrSx6BAQ2gM30rZXB0shLl8WN6MOlgg8nHINMkK8zGe+k13Eg+DD9i2MtPfpaERDg7vZQ==","shasum":"50697549bdbee1b7c1c48cec76ec5194da315a20","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2250.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgTVc/CRA9TVsSAnZWagAAXZsP/1L7nAc/u8pmh5hEkr2R\nmlqOpuiM6YRKiOY/d9iZLRZWZpfoMSduT9VdmMKbESC9jAXKIy8Q5h1Xkov4\nlzvtugmxCKPfHywZACJ1cWAPyweZ9JJ6BUYuyP6TM2a9SCsS2hm66D9oL33x\n/HNNCaPXhd9u0z19yaCsV07JV/knogkxI3DZiC3j4+LfMo4vP7XmUhzK+W54\nR9qAvznMtq9ZtqoUofdsN43+DlxRlBNtrjac39xfmFYPh6AjPveWz5xexR2o\nyvL0QOUMgi0c+hecHi67rlTGqtS0t7dwgbouzb2VjvIONoRGYSs9K6AN3js6\n/6bQZaBpkBsNdylkfSyJiC6nyW15MARke7Z5eX8swuxY5NYvLybq6gbQxS8q\nMy4QVvYatf3WEEFWxPErnobHb41ilc68qsfthisWuweVb/d0JxoS9GgmppMp\nCNLbysbYJPTV3zACgVRxSWnWqwB2kwE1P6US5duAacQnHbSjXkL2bRWnBKlZ\nbdyi6UYkwunq14sjQheMEkb4+vfmPreXWbU1GphePC6/iihPHWp9fb6HoKw0\nA2gcWJXsNCddncwnLyhUqfl62z83mtE99F/015VqcP/cMNWKoGpxV9UqHDQL\nSLV9poMu8+GqmCylKtMTu1JRTkQIM4LKq1NXcucX60iBjr2NVrV/WEyyBOb7\n55a+\r\n=qMaW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0Ujw7/ZPCj55ClYMjsuTIqoLdLmKdr73wR1HPGEaa5AiBsjfkNr8zX7njbxig/b7MIC3tRPyD3oDKVUwQOfJnHXA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2250_1615681343388_0.5344910493172967"},"_hasShrinkwrap":false},"2.0.0-beta.2":{"name":"@parcel/babylon-walk","version":"2.0.0-beta.2","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a3aa86815e098c90fda72a08d29646ff059ab74d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-beta.2","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-bfMq8kDpzqkMT/yRYAnjVsrkuPhEDLRxiCNR4yoSje4Mcj2sMwiGyjFkSQAgGzav7O8iBa0NsL+txiF1QnmcUg==","shasum":"c22da82161d1f548d6736b07d9aa754451ec00b1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-beta.2.tgz","fileCount":15,"unpackedSize":74572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgT/f+CRA9TVsSAnZWagAAeCkP/0BKPhHT4qSSevADowy2\nmc5E0Wo3dIfVWYAb0iInvMt4jk81tpP5cv3zKvuXW2zXzbgl4+x4OWoT99Zz\nY9oewWgmWSk2rT5mkeJ9o0a/W5zjetqTNakk4vDmCrQUn+hY5CW2Wmhm+ICn\n3BufFLryqVp6wrp1/J9X60gnLqJiCxn21ieqF+Z8BaFoIuv6YQqdIVn3fWxG\nBJQ4YvhV1Ko/V3jHnOgOd8VQUBIGSS+7tRCDuIE7oXLgGV+zFOGpfisyBszP\n07dkEdiE/IBkGdvrdU5OXlCrGe3ZFBnOnbH80NDnXsVtqGQjY/otFcfueiON\nVLXe8vebBPgE3Hxq4GPzS8a5A0CVA4xXzFJjNvxFxQxU58g523mRuLnoKY7e\nXwBUnywLsydjIMTdkpzbViQbDYm9svu0H9jPwnSvVtKcMkH+fW/I/DCWcTpJ\ntpSu3pGV3tShcXyNVGhJ4xmP/w4rdkTW88/qK6qc50R4fZbSClJYBW+gpy9b\n1gkTpCGs8vE1MPgjPD1FK4MVLeVrig7JYQiYz7jaqZKiscgmv47r3ZLYhC6H\njq8mhVMn1bKDUfbCzY5ctnHEh87aQvYb1bbrFPi/CP/SVFfaNHgUV2C3qn56\nMKEiu9TkyqUI0yHgtHqa3qCZCkLcJUjivBsjbUwE81qFZLO6yjCzgIdt1L/q\ndcH/\r\n=PgQh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKauGugoHvn1IrKF62kbXDBOcyMXvzIoNTwox6CQrWnAIhAIKG3ok0CF14cMvosQhn+k+DSAayVf2PUl9CfoE8/B0w"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-beta.2_1615853566024_0.9449720613701624"},"_hasShrinkwrap":false},"2.0.0-nightly.2251":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2251","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a3aa86815e098c90fda72a08d29646ff059ab74d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2251","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-Rqg3rzKxNwAMds3i4Im7vGJnqIONREhwvYzK99FRlSINDeW5luWAGNEDKza3MCh3R5NJOfjUHW8P+bbmmcMTDg==","shasum":"9ea4344e1cd112433c736998db5bdc99ebf3ec91","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2251.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgT/ndCRA9TVsSAnZWagAAI9gP+QD6sl29WDuastYGm5ZT\net1nFiRu0pjQNVqDIsxWNzy9SRtia0ZOK4OPlRllZLZBuhM1RvuKDBqTRORP\n7155YTg79VRHhX9DR7fB/vWdkoP6NRYHL/MsGKtV8hoBLw5RNP1DZ9ZC59BX\nmHAfRinilzmqCMLY+G0barHMFQCl1zWjoqdwdkv0mjJwDS0DkI0GNTs4zqVl\n1Oew7mwE2b7mwS861KRE/3lfuLtEdEclnaZy37t5sMaF1KZxBmoz2Cd+sxMS\nY8QXOUhl/s1FMpTtyA+jr0qQ0Y1T15YndsJlAEcg2k+bo+2clIK6b4TR9Y92\ndw+K42ne9d1woW86vGiaQFi8PxsLchXLAbrbGr0f5Di5QdjEsVU+nS/0/ql3\nWt7aUaSZnsJ1zyvkzwRwIBTX2MjwyKVcLv+3TrLkJjP/bxLh2/4qCyKKXAAz\nqE5lpcLyI1ueodCXFoNlD1V8TcyliroDO4sQGIOYKKTLTBKy98oPXbJXUyW3\n+VAmzezJxU4H73o6xAw0XE/NPgDiCmFpnIyVTJ/EbVRkQN46G4A7DJL6952A\nvyBzlqCeqPpIJxXnfVXamFAWncCvP/3jUoxW07MTqcCKezNrNBkZpk/am1Ib\nlzQa+FJsIXuyWeAzv2csveuI6oO91Sx58MgOb1qxbdY2yLEECjOhrnoU9X/1\nTaVY\r\n=ORog\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICT94/oJeQRehR3cWpPk+07+FxTmuOlnJmxZtdFEotGiAiAU3PkTru8kBHfHrW+gdyhtv+5Ljm4PqTSFSoGNI1Id/Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2251_1615854045268_0.4043289709368405"},"_hasShrinkwrap":false},"2.0.0-nightly.2252":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2252","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dc09f12563ad4fcc452760b2477fa6beb8af30fd","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2252","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-TEZnpCfD1UW5hDnJpBJBRwKtvzJHKtCR3HsuhEpN4OO/A/x2nyUf5ht02axURMjW8R2ODyXknBR/FfeXtljjag==","shasum":"ac592efad5c43a421243ae824a517d7630bd0136","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2252.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgUp1nCRA9TVsSAnZWagAAi1sP/iiI1nZmRPssHmpHBnvg\nRYRbIsGGhpMNeyPWrJIY80EuQjCX+DFJANe+KuNiWedWrL9vbS0zUsxD4MBE\nuwnJ3HaX3YZn+TCUB6qZPaHawS2hJYkarcHFzgtkLGqAlsCXaDkoewREgPTK\nM3zDs1LZ8taHmuSGbp3guHkWWrvFd1bZCy96lKQLm5OsN1oT7rhpZ+OncN7c\nfKNRqcjdt60Eo1StWHZkTBFZLQ2f0vG0/cFg6I+MILgi2DKUtGLa+4a8/B9C\nWoEKjrqoZGOTuxumvdFgWhDAn8jzb9CdF6sgsfKHaiZpn5AJ/8z4uHPkOzin\n9yjK8KjpmlwLckpwrhoZ9uaLOJAq66hjnKMNRiAdJKlNryISBETAj2I8qAJF\n12kYxW31TTuj5XFzdVJs9O+XFxpkd7mEFKlBQbkMwXMpoIQyLFL+DrR/J8f4\nhDegsaO3RKazahMW/Q8kgYj/D5EjUamSCNekvjLBlD6VPjeaFvsn+ViJGKZj\nePP0bCusjgSAnrzQGtZQ3ewLiYq2ai/wBWgpvhLrNC/NQK/cm7ymbgt3NgXM\nNJQNpxkPK6U0oE+3KVK9lgbw7JRE04NJugGYkYmTCjMmvFrSNxWBBjVUZ+ov\n6pSctsmw0g4KoxYbaAyq7ShmSXZTZX8Am+r0bZeLvQ00cG+BedsTuGYIobUm\nroTe\r\n=K91g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgVza8fe1k4bWM7GexBqsjMZCZfIgFs6Z2h1GxO86rsgIhAKJ36lG/3hgGYP1YYiKnhEBHWNLLHszpzxPfR+mrPtPv"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2252_1616026982802_0.6491405752843682"},"_hasShrinkwrap":false},"2.0.0-nightly.2253":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2253","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"39ff8330d68c6c0e01d9e8471dd94ce1eb2e62ec","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2253","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-Yl0v5cgvqPp5u1MGCVOqiAJdPUpuivMB8LlcXbVa9ZIOcEVPCXrpHsib6cf/ucwnqcLFeB6SUsk/NGkc72uvqw==","shasum":"4e47a6b80df7bbd04b52abbf40eb7ccbbf590a0c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2253.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgVpF6CRA9TVsSAnZWagAAS8oP/22NRDnStpVPtJW1sOjY\n35I0rmNWklbnsFm5+BKwgjYQ7+myu6KatdHLakZU8ZJoGOvcR9+3yyZGI/mj\nw+ILwAnbbLgk9nS+m0iGZB5xqtCOPbbPAKFUjtaqPOrviu6xsQNZoOCAXTng\ntwSQLQUtrmJwDFXoePIQXXH9KaA6PWxxEFuZ3Brv6kaEFQoqq+UgFVUbQABf\nJ5oOsq8Lw4n2WdH0xJdlW3Va3s3KveGM3TolIabXvDR817b8SEPTGPUg6Ghv\nsKB6GJ4IhXPCWWsHNA/SYPrfmCJyX53AGYb7TTu+bdRae45UyrDFbzRBJu/9\nhcx6qlhfNP2PBPyI/Lkuo+3WjmNU1nnxy2gx8nCiBzDPO988KO0jr+2fwDii\nH0NZeZffzl144rf62ZrvyXuw6Q/V6jxnnU09xXlp4xas6nZPuAi6T7vMkodn\n+mvY6V61LkWayouqQ1sCMiBJi/wJjCgX2wuoLbluZxJoPMoBpNHopTZGTwjm\nn5AMge7UDJzF1Tn4R0Jx0acBWkpbm/VLDEXWXjR1pUAR1/KJF6CdxxEsuXS2\nqaLw09t6y2+oYmv1fCdstlX1gL29kmlEvGN9czqczNFSGzQq95XNcDCbFr0V\nqnZPwIX5eHxjohyusdJmbbbFZFDSSH1IdNV9Vyq97uxyTm3xMEyv3wjRYuK1\n+qmR\r\n=aJHF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICExmEs03D5LlHsdRIml1f/mqb6OBVahByjDz3Nutgv7AiEAmLV8IwSUV9C2awJcaZ2wkCGfRKdOMmlPzS8b97uhz7o="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2253_1616286074378_0.020999857707935776"},"_hasShrinkwrap":false},"2.0.0-nightly.2254":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2254","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ed72667047b7a1497b405801e49635ba5366729c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2254","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-wcMUOgIWhNJzLx5B9UbH5iPIfudvXaWavhsCXwfdi15imvrFSy/eVzLd/Gm7opCD++nKEgZo++mIq1IR8y1dUg==","shasum":"1b3297b26049867bbc5d51439540c633328ea594","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2254.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgV+K1CRA9TVsSAnZWagAADH4QAJQhb0YwkROBoZuRNJ0L\nxytB4asPGy5YfGsGeWwfQIF4syIZqRrV1sB7ivfiTZHkzBkbUUl53Ois0z3W\nLi9iwBI4hJbgq/QhPsjk67jJEN/bp9O+JQuEzJovtV0/4vpvni6+/88Mqvz6\nE/Iogux5d6YKVsp/av0J/8hGq6K21GWFR9mO6iNsaz4pnYGMLkNEFj2bGePj\na2aQ6989yP++ZF8YrC7pjMg5ntEszTSx85qoj8JI056QtMVjayZDHOovBEco\nNiW4+SAfGXgergWCtbKqbDOhLykemj1+zsLAyQXGEBUS1AjVQlagoUH/7kpN\nwfbL9F52mGtiYZbx7ombdneWi1krycfw/hXMmW3AA3Hm8lYYwAj9dMmk9ZPu\nfoVBUKC5cz1S+5gQyBhfwSel/wi1jWGbaO4ljsU3bDkRNGlD5RH+EeWuEQme\nyKYbkec3jVg7QHPVTmTzlCGfOU7a4OhSfbjWtGFMMPLOLbESSyofpjSMQxhz\nifb9hRN1UuKyIhvpMyhg/BC3ZZEoHP08qMuVHoZvIN8aTJYLHBBEETlQjnau\nuoZtybUzPRH1zvGGVY9s4GEEOxg9GG7XIsZEaZHLHUAvMSgMirUeW4xB9Abd\nhxBEZYztBh8Aotn7rEf5iWwce9d89ZNGSb4B0R94WvIgZKUgb/j1L8u4eTpR\nDmWF\r\n=gWjz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5wEYQXJY+oayYSXejwuXm7tivgsLpb+2aeO1uFPaRXAIgPLJitV2dSS71D/TfHXjoYgFGRYBTByhU88TtrPpC81c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2254_1616372404802_0.6711348413740865"},"_hasShrinkwrap":false},"2.0.0-nightly.2255":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2255","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dea272f0708fdabfe11f844f189df6421e7a3b65","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2255","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-QohpdYF1XkKwrIFh7HZ9loSvzskCKKdZz+qfF0wouqljnoC1DvrhhBsaSUjMAa/th2PucdyvGxqddD1rIIVv/Q==","shasum":"032b4007ea290cf30d06c634178de90ed6a9595c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2255.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWoY5CRA9TVsSAnZWagAA5FwP/3vBZkcZFCjoLrIdmGHr\nC22xSSMaV0thZvgYL6u1GgIqwtYqu3pceNLrZ9OsOqIG7tEQixBGN8Xw8aMj\n+l/aWlS+fvJQ0vfi7p3h/WDY6CfqfENQ5COdWYD2MFj3SkfiYuzyuhwVj1/K\nP83/IT5F5m5IYFRiQV9GJgGTvsT4HP8tfzLBvZQ6dKF2oJIudjU46AWSME8E\n3XZxNn54p+SGjCVwBdgb0bL1BCE8jg/LDowsviBMPNpAc6bAI3dIcDjHO5Hw\ntXq8+dbafqamqoAHZDYsgBlgDCTWBLt5Z85lTv29fyQg6n6P7l8/w/wRq4KF\nR7J8H4GPqy/2/y0pUd/jZEg8Gg0sQbBm7Ws+acNjX3eL5yBNt0rtEMqQDfbv\nVv3Yl7tQDICHgOlqVaHMILeTH1T8kDqVcXV8fBYnKG7QkCFQxrlt/7LCrwlE\neBBv3JLRm7yfTonUxuobKhsS7a8cws6oG6iQf+1igZFb8sM68/zyHEia0wcU\niw6MEorou7Nv1KL+/2EYTEBLlH5jgJy0u86azhrvR2ctgT3g58lC6XOhzQj7\nLzoFN/e96Bt7DATuIgUx9BNiqV2JgYI6PvGN8iANLr4z2Cj1NvavgZ0YVcre\nmuxPE5s+yzLVwoHyjETofHm+fW03PJPD/JjZSamoTrVERAOPR7N11afwzsGW\nevKQ\r\n=jciy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmc4CgZ8ewCAGBC5tn9JXCf7AC+Zqr2r56soSWurVX2AIhANshSzkVHth5ccEmvkKskjb5PwTtwywQ3f/ydNHFBDpN"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2255_1616545336897_0.4548580806302438"},"_hasShrinkwrap":false},"2.0.0-nightly.2256":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2256","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"59e6f1c8d364045e75d7291419d3a16395f6f171","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2256","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-cmGcxA2zhQ+0j6Uo7cPxEbEuB6e5AO8/51TZaBZDssqwzpZ5wxSJOngqtZalVrXqzvD+9W5QGmQbv4hzrw4DRw==","shasum":"36ba425f164e63d00b61dc2c4a6358fb6ed68ff4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2256.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgYm19CRA9TVsSAnZWagAA+GUP/RKNeCYD1OTtlomYsB8i\nckbZDzhhwQ5bVk4shGZVnGbRO29/wKOV9efLLo6RvC6rgcVrXaQZvaAXR5zs\nDEf5o5QrWGJ0lJA466fSNefqe5OUKw0bQkYe26MTu7RhkzCHzZ7ILZmHX1T6\nmjmPEsW86EdCZOGoLlU/wbQ9YnQ3La576gB763yKfMu19RIcR4FD+gf00uoj\n3lXQFxi/WB7ZbbR7nhdsHJSGRv6i53wK5pf4y59o/0zVTMe1/49v9hfRglpW\na83aDdBPA2gEyqVlHJwuhSAA116fV8wPTv7Hmkq+QpMsKrkxnZvF4F8aSnYV\n+ld/90bbUQJwiRaDhKqacUMc7XDCVjsitaD+OyGivd0oYgHy1W2qANPvxRfJ\nM0dDNkxaHaK8Sgi6os7cKuVHUtvdVbkfM9yJtXzF3rpl76OEp6/Z4TKQDTvG\nHh/T6g7QV+BUehUm/U8ssPmduO7FzOuqsrfjL8hr1Iv3r0IXi1iclH9Hef3r\nTip4JpzOludPq7zbCz8Y8bFUryTU/kkVZVSBnCt9HSGdzqFDR08H8qlA40TG\nx1CR1cgJE6ixsYa62kZV3tSBXbDywQR2srq20FYoZ69B8AbGyy6ZD32guJ8L\nefja7tsfaKVZDwR6dJZo1fYOdigP4vu19+goIxm66iIvkjib9PELDwerpJZJ\nSAka\r\n=cZ0b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFmPkayvecOVEG3B9BSnlQOS/seI01FBhYBHn1jqFVh4AiEAm83ON63zPD0Cja8okYEGjuhzfQFgu+OeLE+56RpBa78="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2256_1617063292869_0.5548646482350612"},"_hasShrinkwrap":false},"2.0.0-nightly.2257":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2257","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f8981bfb142631f286c98fe4aaa0adfe674ce057","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2257","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-m8DnONEWekrUZDpFBFMM2DgUtjppj+Phku0tNFHqQ0ha8igAQjNIC7nFMcjSjqEM+B7Qj7trOglQjRqCZVyfEA==","shasum":"b99d0cf0f31e0df362f5bbba01eb94f6fcf065f2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2257.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZ7M1CRA9TVsSAnZWagAAsaEP/2ucsB4wDJQqrPyFHQ11\nGF239kXtKgQpmssdJ6LLy/OidlneezBtSYu4vWs+0HzoePxsgXirPuNVxG8v\nEmf7z0ykda0JZ96NoJtRm2zKn4k4+BTcCSv9u7y+rWUsVzg7RuAT+DgPNnDB\nA04Z/0GSoM0knOUFozUubrjBtmM+x5c7HVULgAjLiLhEnnh1iyvupYMorT6w\nxpCE6vx9aspBgNecLWrc11i8kBo6371bFGXGV7wUx2pb7awNKZxCCHddnuNg\nB6W4DAh6EoixRALZocK885whOHf2c/PZ136sEIUQBIOfkCPEX1hwbsCVYJy1\n7yC/QZO1EjgrLa3Spb0EHCx1gpeAkACf1woi4rPS3UH8c6MAyqvVb/p54GLt\n8GTQt8lkSvyci2XTbFkuoI8ETR2Bzv6JbzbzIyZL4pI0oVpmYcQ4vgQqJ/SM\n8cSv3TG2Is//FiunBcRaaySnSERwIIZxwawTRz69XB3pZ3N6dk7sFtCMb+M/\nPFFYE2oXrd2tqQrfgcVmGwNstStVMFEA/RivxMSCnPYXhYJ6Qd+nXpthm4QF\naABgnif0kzaPgT9lk9ziKPlLYc0dRy7SprqwF/HwrsP+b2BIj/m3zntwMQn2\n4qzoqwkyDvkBvyi8EgIRB9pLi1LlCiojMjJn+4hTSv+naeBWvFhY+Viit8mi\nNxA9\r\n=utVO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDnvpTDZU6EJ9q8qyhRGI8/fuyE+DIYH2uGAhsVUR6pvwIhAJjuhWUDRYOD3aKN1Q9kAo3TbKUcEulq0qnyrLMwPxFR"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2257_1617408821439_0.8967981080532186"},"_hasShrinkwrap":false},"2.0.0-nightly.2258":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2258","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"82276043b460253c9550c1bd69cd59f95e4d01a1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2258","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-7qUlNBFacSk5Lzefr5fgU+2tNmGpGJlSwxdzNl2RcQbuTwQXOp97iRx79IwNXifFVHyFF9XvbY0nD6+pQxCVRA==","shasum":"73562fd4cea2a5e033af9f76fa24399e1b30ac3a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2258.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgaQS6CRA9TVsSAnZWagAAD0IQAJ3zFt5HkQNVT7sZpJMV\nlcmzSjoSkKu0cbspVoYFGo2e4KPgPrjoAtMBt8VdODbNS8vcMxIMp8gImRJo\neLcxCeFHy5AdpO3AsY4QkVU/nl1e3CS3hlQ3Gm0P+zI1ne7kwJXTAjaHmyVR\nDBXt9x2V/QmSr2doORgE/Yy4NpiAokzdHcjhkaSv4H2VrQZ+iCexiAhzRDsm\nFOtFaZ8p60ri9VsEEf6KufkGZKvtkr6xBZQrjARoj8Ew79UCOPMJbqlUoccS\n3z+jKBiWXs/iMngz/E6+Vb8W9RVUy3x/14BS+v8dMua24LLGJFNJbYh19fca\nmrNOLlqNkf5RB1ymDD6Gjuphip5rfUJGspgnXQ7W74MyQoIMPreeZBE0pRz4\nlNUiWES7/SrNlnoR7vkhzTqS9h6rj9R4rfVjOYDhSLb0GKYAGqjh+EPqOOmj\nKOfFijRW+9rwkS1f5XUnSjFBh8PaollH023lxevOz3+YTyg86kf3HGDYjIeT\nebG2Sd8ganx2QvbN546JKJOBR5B3j6ueoZhgXhKJ7M/8x/LTC85r1hDqK/t4\ncjMduYdQziZ69Mj7/6XKcVa/xyLlHcg9PVFa/KymRC2o9zFZeqhJqFI+MwwL\nlVIJGNCNZCyLQiBlOFXojGDHVuUtGujA4tRoOxLAtxKP+Qos/+796HgqOExD\nv3tn\r\n=797i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBMnFx0cJWn2AU/ijHmpnZhpzkQEl3Tyjo+hCQNBClj7AiAQDYskyZfcTJkUh1fwRqtRy3ho4jfONSBMd+50jNcj5Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2258_1617495225590_0.993629538332881"},"_hasShrinkwrap":false},"2.0.0-nightly.2259":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2259","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f59627374664acb7af95a7a6505170af972e84e3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2259","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-qEu7oQR6vGdjpYGSoOgr0MxcZNvyDUZb9SeeL0qjIaJhMuPqvK4n1RGR3sD8o3B1pN2DyWdPTgM9WdIjs9oXYQ==","shasum":"0af2dac26077b84513b06ccdc5ed9e3606882259","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2259.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgbPlNCRA9TVsSAnZWagAAS9UP/ip3p5AL5Cf0l+BkuTYr\nBB+vZX3CPtftrmB9rRqTwu08JCEu/BMveQ8qPhSvrwXt28a7iXAgHFtAuslq\nx1DZxxvkbZWLfEclZ8EGiLoH+zZAh6+RdVBn5w/eb15L7OBKSUsmkh8uy+dA\naaD6BGKzFImBhpNNGwH2m/0oSK9Q3/QZGvg4fJmWChZF9vK14+46rba5OfDR\nC0XAzd5P4O3nnRYF/BCSafyIwQWY/nCIzXfTpf3kB21YWe/nQEDfHDdtVXJz\n+vMyuNXs2BQP7hTbjWvEgsNDBcVbS4EROmEVKLiWZe4bDAPThLOsYUARPyR4\nc38Sv39QCS7mJHgBUrPIlvC3QmEShIFjy8sFBrSZXPVk/Py+EddAoGQkMS2U\n4wJsMMatC7H4ho4Yn/i2m0Mc6z06VcSk2BjpYP/tCgckDR5MnctAVxireG90\n+qf8yVsx/FMDLoJjxuO7jQH24jCgQ79V9oIoeLH13ZcvkS2ZydqsbWBvW7wb\ni+1Gk72h6H6/a7Lh7dcrH2dZu8S7bMWksP/9oF9ebaMVgYA9X/738KLNUBqE\nIixe6mF77hLarGG5eClv1+9XTA2eB6GwJwABw2EfuaK5B7KvVXfN/HG669iK\nTfipMPlhKY+2of1HczcMHa1QG11u5XZmqY+IGM1x7ijnwfWcFk+nlQfhN0tb\nJShg\r\n=JP5f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7YxhVhcBf0FKZn69VZlMVfMfeXkWm/DKc61wdLW3SfAIhAOaSnQcXV6mZr5NZxhuW3GUtlNZMdPs65uAWQnZvYZ41"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2259_1617754445494_0.9314294180564062"},"_hasShrinkwrap":false},"2.0.0-nightly.2260":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2260","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ff1a55e8a8d0ec989adfede698771b7fdb567d95","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2260","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-0xnsgNV1OEZTRi5W/4t20TTOmu0UkIaNgXpqaaNoiZ0thSVo0jxoi5E9JCiGdMP2tfiRo6RxDsKAbw5RWJDMLA==","shasum":"7bec34d3fec9b9ecb67dacb2294cd74163d64f63","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2260.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgb5xACRA9TVsSAnZWagAAHNMP/iGlmB7AvxR4hL8uH0/8\nQDIdM+850dXhLT+ZFo9rLURs6DNc1NCNbKwlrQoDIHjDllDkeyTMkgKBzSJW\nFLi4RAexkP3VXecIrH70dSoCKEy+rnHsUI8drKhnrIdxmb1iVEd+6AuHinzJ\ntNiavtorRh85xFszkumhwnTnEYYVviUTg1mVy4dWl9dv+3tijZfZw7H4unG9\nBpq7xf8SPxgJAlUvNCRPtboJW1cPFvXswb6n+useDIgf1P5+WzNfVFRTB5D0\n5qGsjAf4qb2qK07CsjFCq0n4uRJA/WJ6lxxj+XB94kv+8U2NTU/sEpeK2PHa\nfj6R8oyMAu+6r0wEo2ReirnpuwV/xTOZcPmcCbsvPMv73l7fHA/KN4TuGWqg\nw8lcLpBN4L8spVtWdeQypd81laXKwi6voYNgMqhy9z6aEWK9lzXg8ZQb2Sbp\nxHNxtIfpoZwz5VYnQcsTrCYDRQefxCEYwmsL8Hhwftojbv0BSLYWSLdpPKMk\nLDLy52H10dSHCP3J/4SmRASG9EsFrFKbAw46apEtYZxTZILnKm485lDhXm76\nhM850BhdLoqSmAXNUYzbeQ5wEbnOvYnNCCmN/v8mqD/3sDuSU+jIwANwuIju\n4JUbEboiSn/zUBWN6fbGuHP+nHauDPi+osoMe+B2FNvcvguRDvH04hBxVxh4\nguBe\r\n=DtZI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5Eh/OsR6TRGAyMNn21o6LC8/PfN2b/1RLTRnCVZOAbwIhAKXbmb0zwIQShbGSmS69FCVt3Czq+wZBAj8fb5jLy08U"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2260_1617927231908_0.19079374359252"},"_hasShrinkwrap":false},"2.0.0-nightly.2261":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2261","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e088bfadd9bd7da7fad033e10102118ce73247d7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2261","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-lptCNvUjVAKt6i00YKidM4kDg5XqFdQ1JiyIkLQEMlwC9hlSTr1ClwX9D4pUqpc1ZhIFqeQGthnnE5g9qZUTzw==","shasum":"023719c8c97f1f9cd5f4f08a6a6e4b628364d2d0","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2261.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgc5DeCRA9TVsSAnZWagAA/EEP/RIbnJzYimUoMNtKhGB5\ngbc9XEYTxHb/cPzw3wa9QJ6IrLukl/rnALhY2zAuAN79KH5winu461RSLjWh\nAuQ7pEKZ+plMIpHaQWlAWpgRpIAm8TmkzP2OQYJJoj1APZajd3OC+0kk4mAd\n5zjdHJ8z/AhhWfAEQEykygWHvnFyy0RdGSIw/j6xAseHcR5KPvV3wPz3qLvn\nAlL9QAoOfDAjd1hiGQeKa749ycUvVtP2YirQxNDeg//Fz1bcovXdCjnM9jIr\nNmGDC2lRJGAUWYZdX6rh0IqPDHxKiQCujSaHnXAiQqzFBoJ+TRyrHbMMoSyG\niUidtFOatWZh/ggUrqSiu6MSYJlhGz/zmEfRmARINZ8r1peSYixy2hUoGBgV\njRtmF6L1JV116xmrtkeYja9sABzE+dCrLQKxF20vCzshVtC4biyR/7guxbIt\nT99uxbX6NYjAr5Wz0oHTt2qExK99pzBCfdpS/SN7gle/oLQ7dRkG5AXcy5CH\nAFu454fhN/lYLk4HkVj9pwyOQi9CtIF52v4PYi3gr2jJEIaMJ5RXyYR+BSPg\nOG0HVWNA0og4eaZDm+JCKuZCRoGQjBwLCLdeub07An9VxWw9FyQxXE8PLrSU\nxEuB1q7cTdSVtHJ5TQCN+/RSAWvpKYQMnBngxlfLBAOg6ERcPCsG1IY3y+DY\nT9IP\r\n=3RmV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDxxtlm/4Nk3/Zul0Ad3D5Kd1gdsd3PlHmrsJuXjPNIQIhAPScBsndMAJDcawMHNd7eM8kfYbKqjh5StQWnrvxWlTP"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2261_1618186461600_0.5331717430312306"},"_hasShrinkwrap":false},"2.0.0-nightly.2263":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2263","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"059d502fbe1eeba44409d5dc902ea0bef66a3565","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2263","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-4qIl4GNcvPndBZYGjZBjqZQhgX6ewWYlxLZng83OM0zwUhyafAzIQCA5neYkWjVHGaujpztBrrt1Wob22qtYzA==","shasum":"395eaf0570d45a8499d616b722f902aefc8d3a79","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2263.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdOLRCRA9TVsSAnZWagAAjCAP/jEtcJ34GuU8aj53Gw6E\nvhEHWLVXob3zZM/cyp12uD7zZ+iYNGQ8t9VhprNSFNc5Kzm25DyYp7KFUtU3\nyKNK1+tYNaDO0sO4y5Fwo+giZhu/JAER7XsSdGlbOG3kC9/7hR9U42E9FUFS\nFiD42G2Udo1HB7hhiu+Mc/iUAKqOLElSjtOv7ZlWnsbERdgHuzEbci/M2BGN\nuQMPdAuC19l3Smaf45w9ozb+eev9riNk8KdgYG8eGNbicqUey8cKQYLO1vti\nvi2TR5wNsuj2avgVwBOHYm0JQfrg/whJjyYS08XdCRdjM6veoIipJi8EySmN\nSyp2Gi4aahu5byUHYIcJ0YzkgtPxqEP/VUnIl9gyWHetYm5QdG+kUP3GtL0f\nRJ0XLAf55b7B7AFoiQ7O7kUSNwK2NXxlZWywnHNlKqWgM2rFjbHZfsemYdTI\nib85/vu/L4gmSlwprjODpZ09NeEGfvNCQzWnqXlwwGOqPRh2St97ZsJQg/89\nUc2/RrfPRdlipYoMQ5dEbdEus4eW/ccEH73zSxZz69vF1R0TKvxLaHNixKxk\nR1swesYCQUoeQFWBC30RERztlaEIkiHUTzvURXSg8EtBD7ABdl/7GckXSoqk\ndvAmwXk6QZEzBlxRV0KMM2Llfes7W6ISzvxq5Q36pUJdrUX3Y1JymXCotAwX\nrUIJ\r\n=L5OR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH1B7tPzu64DlRvH7MN9zWbQTK1yxLnvEPNGA2kyS0slAiBZiBc1SBvu8difSHE7TtDScPfMWBCUeG/f/KeaLWQ1/g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2263_1618272977002_0.9092854320445816"},"_hasShrinkwrap":false},"2.0.0-nightly.2264":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2264","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"bbc79c1abc47b0793780640717b71cd4e1ad0d94","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2264","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-F8KPj7WUtKFCNGUPiHw6qci2TPvlzQYpVQL4xa4vdMlLnCFFPPcIOtqdCj0gu586pgp0GNn+uVbCR0IRraE7XQ==","shasum":"64c099149e3d617b393c4360182e93fee5d1a1ec","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2264.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdjO7CRA9TVsSAnZWagAA4l0P/RnfODn7N8HkHnSvuS02\nclErpVo8rWfOwSkp7rsnqJE3RMzWX3S1gEgKgB9wY72+jEAN1klDlwEY1pWw\n04EN+ffQI9wGYYvm3P6sSah74555ajsbTPgGtNBXCd3RjLcT9OXL3/PdJxYL\nMMq6iJYxcVRyQ3MZ4e7TM7uH7+hyPWg0z/cU6g957f9OQtH9hA4LPdMPNm5L\nY7gDR/0dygHBCdrwgPQH4NGU2PlPZxoiDrtwmWIu6q0P8VE9PRZx1Ko5fxTe\n5ku5hEuhhm4fyZORCDOSEoPG5MVaK4WsGnNfZVErtKgv1SlhS82sU8IwsZ9h\nY237XFu+kd7Z8EsAdlbkihPnPIc9CT6tU4z62XFwNgULfg+swuZEAFePC1ih\nmYELLd1oyDX8UoA+Gx0VnB42jY3JRsPCrRbzgr/J74V8auOiL0KadkFZVpxF\nb3gxs2OGCazNX4j9J/aTWrY4PflP2YEeGQJb3plkp+uTtcTZr1rYY7+d1Vod\nBqTR6+kgYDkLc6kSOUN3aNOPd13kHLMnYwtQ7xS+S8MlfKN5BeosY2ivlEAu\nNttUQnDtefL7JEs3zQWIABFqLTAecVlRkDIDZMJQ4nC8Ay7bizhLZZlHdT69\n0bxsXRuASQ1qCd8eQpSKTwdBbwtVuGQOCGLiKp+PUM15pnPuuRFmAAYdd0W6\notN0\r\n=JgEi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4Ldh69zjMlgZw+9scI0Gs2o/Q6+JCPSjL4ohhk5zYkAiBd/YddkiLIuEqF4WeblOai5PZ2agwfY1s2CMKSEW7Bwg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2264_1618359227501_0.5359364980220869"},"_hasShrinkwrap":false},"2.0.0-nightly.2265":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2265","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"1ec530f64c227b6a0cc9f814382bae21bc6944b8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2265","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.20.2/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-1aF31t4bzb25ArE6an4srgZDaZJay/qjIRTnxstodbU74B2zyyxb9VO7R/vYKH0rroOq1ixHO2PXRjsBzxfvsw==","shasum":"7db58ff2060d0462b020c02c95668cf0ca77f926","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2265.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgd4UgCRA9TVsSAnZWagAAjTsQAJph8OStidGwDEHiiiGf\nJr/kZ7WzJ+2rDpcwv3F0PDTz4Uq6uzUVvEF89hI5PDBJsZDa8ukWgFbydq7h\n9pFSOz0QQTQfR4286z9q77o4ZD9JQ9ck91RHcbJUn1Tkb8y7naBzSUhLm6nM\nORnvPbz4a9jibaUquGx/yydG9cx1By/dh1Cpar9LlzxS/RM8Ynq79mdeZ4ML\ncw8/gsNyJDeGSFCW7OcwbIYRAZuC5YQ0ZWrSvMJ62w6+LEi2HsvmJCyJrNfZ\n0kLLl16PpBNlZFHkF+O8qrO+H9QcrV6/GuMdJRSRi52m17UQMh91U9j2RP8O\njrpRD6C/We0ZqnhlyCIpo3NwBRb9jtWCOfJmAR1SQrhi0QiRBhn+kfDnLP37\nEGPHyi4JKNRvp8XjlcfkIrdfk9jShjfb7/476tmGgAH3csCT3mUh2Dl1YMXQ\nbUf7KaqiV9KrIZRgNVyxMxfKskUz84YVL54WFXBJHNw01qd1Hmw/TBaxtoBy\nXXOPPK3/1/f5PcxduS5WpoSt5FdqyeD5vjbdfikRFEA2bdSkx5a511W3DxKK\n16Ql5cg8QmF38MNgqr91ohLKDEG2tA+PbmpRPmJhwfgULXEuu937hGZgv5+b\nAoOPaY/fuSaxa/IEYOHExHCFMxeL9wYTm57/vkW6cYFsanvnDrjO24yM1LVk\noi/y\r\n=zjXu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAu/JlEibwi5euXfdZ7O7NSbBEF//HqW9PIkshX+MYbCAiAN2TBqeJEiravh7SQJZO8n/Ii/RkdT0EvYfRk4xUF1bw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2265_1618445599693_0.9208344211588133"},"_hasShrinkwrap":false},"2.0.0-nightly.2266":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2266","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"737b7ec5e6e4629566f2861c67b974e31a7b69ad","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2266","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-vuPqJ742ifzoD43e0Eub/mjRJAWrvMQJ5xZ1Z/NXPpppNTjYhXVYx0qgMAECkRk72s3MhqdC3xow9I8HMw0CvQ==","shasum":"ff448eea3aeee01fb9f0dff92b673e68a4922a1b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2266.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgeifvCRA9TVsSAnZWagAAKcEP/i+6gmJvT8AbQFrUOdf4\nkuQ8VTGIIanPs1RsNOZBQb6yLJP66YzjyYW91DWyyRfAGs6UA1z9VLzRo/w1\ncQMHiDh5yNXAv4keToW70yHqBvZiCSKz87jmnoEuWNj4fWTVPOpWfJcBDvC0\nByBDde8pC1ih5PaUw+E6I/nepMeYxkg7RlZvpsVNRhKTV9A6yMhbJTeZFWwA\ndbcLEVto112tsZTVDEo4/+PkeuTWwUgliFrv+mQW6LdqtUuo+cX5sudtbD7A\nu1Yew2sAe58PyOUta6OX6W0Cd+spCx93DvcKD31GVYoWFgjbh/LQJ/AVlxhM\nK5ab0CaLJTZ2jMRqPQrr8Anbk7BYYcN9/EAiqNvlio0szErI1ZaoCLDC54Mx\nLg2bixE2+UVuVimWzaOsCkHKoPk2ODb6wPglZ4po9dPGRaeExNBJExdhjWfK\nOTQa1umEMRliZqm6wpzW/zsPIWghuT+AeRoowCVJgsf0uwu2dvq1LuJTb6kV\njzqI97tY/muP2xOMkW2zkOck062shKP+mz5e1IlgZ8RPZbm5Ji016w7Pl0l+\nXtQj5hthE5vXzQwEHIVJiQRBQxUNaFizRFgF1/Mhyknu50CZJRAmMX9wPKpF\npnx0Tbuqxgi+tBHrVpup79Ca3j5vsvUHMbN+ytJLn6Mo8xmCQ/Zvn1QVnOQJ\n59zF\r\n=ztmz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAnx++gySip+sxKDwaSWMdrYjA0cl4KuJ0QLq6C46rDJAiEA3zQMFBy7XRBk6tfSZ3rn0SI0lOpMN58agzj4ZWg2+28="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2266_1618618350492_0.8297846807773261"},"_hasShrinkwrap":false},"2.0.0-nightly.2267":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2267","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"3baf990a686d1c1dd0c5f4360296de890cc00c47","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2267","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-SjqT+DQY6E7Ez/d4W2aCjm4vc4MPPYg35HljmQuFoa/W1xd0+L0zVMonXO3vYggew2ZIDNDrzc0OJSZGoGulBw==","shasum":"a5cbdd8a3846c194cecbb4d3d00530d677984a66","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2267.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgfh0dCRA9TVsSAnZWagAANPcP/2SyqOZXn/Ac9Ea9QWi8\nfOq7bWivgaCK9jRxzO1dMKmB/yyFFSRdBQAWbRXOJBKfaRNFIinpoVUFwz8g\nctsXErHdMwheOMintIuaZ+PD5znnBtBBpZki1nvPef6wSgOmQQK8f+PHGQYX\nAt+t3d4rDYoVYYkRDRY94aapS6UCVlPI3Iu7kCeKWAVKZPxf9t6sClZnsHSd\n7wjsYNTiDpsTQUPDOamrCUPMJm2Go6Dzw4+NvSJxHCUj/0RJhXzWzzifaqU8\n0GB7C0abMSe5hegzH2tgeHkifQCp/pJg+144c7u4whQBlhpMjXbE2nlZSUQf\nabezCeItazxR9ru4GWPFJHFo23CyKh+AFeHU+iMI/zjjA/5xcMFSNE6IzpeK\n346oKVAyInbBtZgW8qn7PYhT1Sc5m3mWnJMNg5wv9egit9+/awmwatgjNKGX\nstKm6wUnsfZJbbOxluzB/DkMJXtOeSxXChmOKLyEVzXzLu7cYc9zdKcRqdT5\nmfWQl8tGvmZVXan5WNI2iGZcyK7hIlRLRhIabMVqor6r350+hUYygQUHUApF\nxrpPAHX8Q0wqfWnCXWRjDLVcDJ8U5vE0B81wTKqMcgddk7XkgBUqsCLsO1ge\naZFcJDOXf4w4a7HeBZE4v0vTY1P4X37sZGPFYH0ImaLTvGv5iSN6EzxU1+3W\nYJS4\r\n=xm23\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDbofGuz8LbA41KKlnRLf2J2rh/xNlyz7Swgh0b877hIAiB/m15G4/2eOmC8J53Zb1YOd2tSZ4k1SWY0G5nYFhZpfg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2267_1618877724838_0.5213876446814885"},"_hasShrinkwrap":false},"2.0.0-nightly.2268":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2268","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a3679960728140a609ff29d98bf069e15d773305","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2268","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-cx0S7Z7oxA2Rv+Qv820LWcefKIFn5sOcy8hb/PGBFbdl2zOyBnz81hkABI0mpyi3TwW4CRcXxkmSYWg13O2tuA==","shasum":"955a48fa6fa2d7dab519f0d449dce1188a7560e1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2268.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgh1buCRA9TVsSAnZWagAARwoQAIyuBLBNuzj2ofUQSkKk\nNGq8M9c4Bti0XFs9NMRyX356yhAj7VRFxgwSWXmzy005NiAYXtscvogHik0T\nKF/W3LHeGo+1X3hPtbO2s7N6cRmneyu+CCP0o3IeGEz7+ELy5Ayku03+xwPD\n9q9ZWt+ARYQ3RfSvjRVTYvrOf/umG/Pl8TGgG/l+a36GNkAQ4XFOkNFETZdo\nc+WfvVbtQcI7M3P3DbNZRDnDwmlLREmgljCPXymN5vBaq1O4269ONY3eWNY3\nqBmy6YpeWfHDqYRGr7/Owe88RLRc56bQkncFvk3g0FCO9XxObA6CYttNhmnA\ng8X7aEyH/2AID8tGVYSX2StnExqbgIpGj2IuMD1AOZcgcWVN8hzx9f6igJrv\n6MHC+Rwg5nQqHjcuDYuHKCQhs25t+0+guZPrDpPB7/3KzyzNSYXKFKqXDjbf\nb1ANxkQsBsR3d9w9Hm8ywwlRYqiD1I7HAp8zQeCrjJGshuUWNdRbmX/Ndbu7\nDTnP7kMXRUPv1k40tZIC8uOLyChmwxZBC246NSZbBgHB29rYQwvutUHA9XML\nzPa1UYA1Qd8Bc9O2nm8+1YklmUmpuHP+u8A15JZECpam5tZECM62gQP0mPJ5\nYFRmY/aPzpzZcmxotwkHOKNMuPq0eAuLU0gJpbGLDTl9SlOwofayhvvqS3OJ\nyV0P\r\n=lh9s\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF31wafRfHuGmG+k6ID/Db1mgXyfcnsj578n/gy+EIkMAiEAg6leodf1jk//j0Y/jUdIXG5c4D9sNomF5o5LkBQtdP0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2268_1619482349978_0.287598670817204"},"_hasShrinkwrap":false},"2.0.0-nightly.2270":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2270","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4949f153f1d64dac1970e0881e17324dc1c0dd1b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2270","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-V1BE0K8lynAtWrzXN8Z26K9MISTIL2OSTn7f375m7YVqKS3KomBZHV8VGDciTagtlzh95OhMIB6+Ga0RJT2EUQ==","shasum":"60181c67bc9c074b3f949b5f3a02fb118569ce98","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2270.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiKi9CRA9TVsSAnZWagAAf34P+gPbdUnWWU2h8vuW8g4R\nzL5DupyDbJSolovle7tdfmC+Jek4QgG6h4QYXHMd1BJs/38sgrb3Vano8R0Y\nWI7mkzDQ8a1DzRzTCSYROWVXYIq/Agsn07aDZGz6OH3/lEmHxQ50fbuYWeAU\ntNA/ZM9dRFaoWvv/dqt/pZVvyOftPJRSbonm7f8mrza6GrXd0J8cVrsFcq5s\n6elleIcPm7WLeXXJSf9XOsC+DtxnAK08XHniX5d5IQG66RxJNEm5I4ld3bTN\nCFrmtgSBU4m7ABD5/9Bm2WZOemHiNPRCKfXLLNape1w/3+a5rLBQ+mn/Uwxm\nK5dJ5QzIbULchhHZ4lHysEzQamQhCoFMd4kjctLArmvVSYavi58GXM4lbulO\n/CUl/MCpkRSo+QbkXuyLTcomKb7ruPNXaIC9OI+nC/+6hFqQNmBtUFfjwNC3\neNf6/GkXA2AXQMIfb9k38eeola373VYAZSgRzp2FvbU0PHTXFPESiPSfXoRr\nfYyrygvLub5mEb5DyfB0aUPpXvfATZCm+B9v0F1q7K9WyvMOS8p/yT3slqRF\nCHr4dZOhwMk2Cw3jl1SzWIHDSAvGclfKqyEAN+w+ipwSzER229GkNc9yFwwc\nafSuHswoZhjn6gK3NeDoYHj0uD9rBQhEspIlIXGDy2fIBAVKExcgVuCZtWk3\nzmxj\r\n=uZSU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHd6oJGA1ReNi2+BCzuHRGEMSlx4VIo4VazzrKTOqXHZAiB0ewEbpY3FGWE6/oF6uWy2FhyNQ1gm/TXubGicPvM0dQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2270_1619568829419_0.162972496731435"},"_hasShrinkwrap":false},"2.0.0-nightly.2271":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2271","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b54c2b6fa91a638eef2b199b9a5631e19828a150","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2271","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-qhiJG5UmFlMEkz8ppo469VU2DkbrHAL+uNkKyVd8TMRB+afrgWaVgbXGFikOY/jCNI9jNq83848uA5ULIOWDEg==","shasum":"053135a51eca6cc12d726635616c6cb59d0df92d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2271.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgifpTCRA9TVsSAnZWagAAfV0QAI2RhSdBIaXsnLoZc3VW\nWW9UxqPotyfsLpMj02MztUQg+7WAlc7LguR//dDUQ+bAhKrhBkX/Cp00IRsd\n7tBjORwkE88W+alNjVZXN50lJe2rnQ7MzCgbfb5ctIPKdfx/Xh8oheLIcQCL\nuU1fBb4hgpFCmXcfYeVRXFYiSt4YQIpyJaQS2F4gDCNryyrMI//Gk9uApN/L\nqlSnEJIo7hLIjCEuctRJBhofyeRktwQILtSkWDQ15H45B+AM1ICIl7N1Qgnf\nTLIOzlpmGXCTkgOcZOifV5/1b6Ta3kKgeps9fgviHneDaN8O5/Z+16Eus7ja\nNLq0IpNInmEm2XHJQnPL9XVh/JKAEgnzg/tJOYs9NmmM67bidoHcjtdjbVaY\nbFTsQxj6xhB8qVVt9/Z4HBsqdA7VoPqB4lNqK2qZqcDCBBHdkAYrAm41zs1m\ngWVaOX+i688uHbJDEgnCDrZ2c7NuSvHSBB8uGG+XkT+YcZXzyNGTFnv71iQp\nepDvtpCamBi2w7fz/NvjZk9kUyD5NGaOLvXXT7PGe9zm4WzAmcIlo9Xuht98\nilPoSbTAaS84f4q8g6U9rHxIwhu2ldHLrAV6+o5+NPFYlJ400V97dx8aQTDJ\n1H3CzuBcEPnQI+3IY7EPuvuqW0WBOa1swvQ6h3ka8oS0Imkc/3Gcfbt3Re0G\nZ16H\r\n=J5KX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRbYuJce0QVYbt5wd9HrtDaP0CsNyJJ5+HNt6E/0/fxgIgcittGIsrEHH9ynABPhgxGl9OTWNALO1YnOXV6PY7g9c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2271_1619655250485_0.7646127440361588"},"_hasShrinkwrap":false},"2.0.0-nightly.2273":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2273","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a67a5f02a7a4f6fdf9e849847c1a7d86994bcd64","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2273","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-Pa+aZDXsCYNcWm1eGjJ01tqgtez0sepNgCmGYWFMN4MUvLNiYREIlN1kkZ7pTGw4sWH4LepgjoYQf7RTyCdaoQ==","shasum":"0dadec2788fcad9dbfb228e0c1abf5fdb627fb88","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2273.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgi0t1CRA9TVsSAnZWagAAYq4QAILHIv2gDwsaSbJQjkw9\nqILsRDMcRuq3N3qejc13moQdZqi/W8IJpeoJlhfXBwpk8EHieSItH2C0wXgM\nc+c+QAXbUCYSvOF39L0AsmY9L0WOP3EtzmLCLBsQF3vbESauYUKueiA9xVMv\nIDTHWDQeMfFj7TNmwIuJiQnhUgCtcofpmMwWd9JZlYnZ3UVM3lWgjw7lQVE8\nXgppKsBdUm1t6f8+jdLs3IBR3CAKelspRoxWEDbEe6qVpUzY/QCZ8CocZUHc\nicVOG1xgC41bdmwwqXv0zeut22QCwYCJZWHHB5Q6Kkk0m39gf4thcVDslc5S\n/SCt0rF79Z19ySRZHbJkTdHbVWAqzM1Czh2WFoKfXK8pOHEs4FMhx06MNdVV\nGPs8u2XaRD7ilnZggPafkvHcjH3hcz3GUohRWivdQorrSh53e3ZZ+beyjpMH\nMGkMbt/W7M4rOxdHXHXto5JN+6OcHFEa4T5vmSnIK3tkt1TZaDeaBozIbi73\nLFWrZzGCBS38EHZKUhCqU2Tgisxgcga3fXKtQPb9lBtp1eO4bNBwREs2Uvtw\nr2qAW+2tQKIzj1Fg7pHntJUWPReOBu9HtHpNlBGeVuM0V14wdQN9eOFpX+HC\nFEQ+xgmRgk+XyshYcjvAFSDm1h53m+nP5zV4f20INWSl/sadxIPhDRz9cOL3\ne7X+\r\n=lv1O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEpuQt915qzTFbqF57jFgzdvpNpdnMvAjfQuZ8mMC0lAiEAgdp68szqVd04YPcGB5sqL1PXTRP7NpELQuX6OTixIKM="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2273_1619741557011_0.9255249748422678"},"_hasShrinkwrap":false},"2.0.0-nightly.2274":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2274","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dc79abcdc6312c67af5e5779b585fe96d4393452","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2274","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-8LD7rO7ncFK5y8mwuUgekFaT65s4OvopKEmLeL/7JocPZRBr02n5vPjCvhCtPD4iyid5gP/XPJpOLZoVcLQ41Q==","shasum":"5abce046b3b8f52dc45206a2d45ea564e1325bcb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2274.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkeKECRA9TVsSAnZWagAAxV0QAIuTcZ9jK+MbmyMabNyu\nr2P7KbgX6R+AILCKbABosg3U5WtLerE9QB8SSfqUjU/JTO9oxOXASnOhuKDd\nPyZyvNxD8nEuQCY5squjFlMRgflBbtW5DVNgbu9ZS5wh8vz3mz5a6Tc0HOMF\nE5V0nk2q26CwVlti0bm4QK07Ko21DmNCuTALHsKsgiUvfIRsTM7e/KtAA/hc\nq9CamPRWHkOqLhM9WuADmWaEjDjyRq35agvtK9kC4fdUGjb/FxMZthKoT3Ow\nelwiyFQ54iIvpjX/WrA45yfkvYYJZWcI0k7c9JmkyvNhhZ91xQhzROqMsY06\nNI31XDvy2wYYeeLXQHLjDHlwwZ7juv6fFVG/zTkcM52fKdgIOxXghlloZ4fG\ndBt4UX8j3HxRt+hbWgk68CmgdfxVjNcHC7yPWOXynkLBHGc1IgTMDw0liUfU\nRKFP/4BBzij7hvLiAHGi5UtONbcbMkFjzaQmWq91DvH1bzaBIE9EdhMym0Zx\nQo86xxLMugAZ5Xbzkt4zY6t16DfofhBYo2qzQtG+3lvXkZhYlvD6D5LdxWto\nnIDNEAH+69bnoixNiu/sXLvaw8jht9k/qpv8koQSKWAv0tPfrCuaDi+zOjMp\nU6aGXQz+pL3bLxnaLxRZPP9fdXef9F6YX2kDqYxcSEYEjK/ENFHZi1Jfd9pw\n5GbW\r\n=jSjU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICvhNhP/o1cM5LBenH9qUqnoPh766fpHxWnq5TUiVE2tAiBsoVA8CcGJVhlyBDK9jVdSyukaTyyFcdtSosLzgdOYpQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2274_1620173443619_0.6330550884790231"},"_hasShrinkwrap":false},"2.0.0-nightly.2275":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2275","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"2079b78a066eac2f7fc61def1cca048adacb7d1a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2275","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-ZKzTTz5yl7v6NostL4nLsOgtwLExaRfhhPxVbKK2IUve+59piO7zF91KG/MTV29LNI6XmpxBIIyNjbnAF113Sw==","shasum":"00306a534c9d99a93134c2966009947d7e2c07b4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2275.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkzONCRA9TVsSAnZWagAABzsP/Akl9N6LtGlbXC1ftl1Q\nck0Clno2xsUgyV2MSKH8fNLE3ksV7BndyFANJ1fNUFY8XFQRxn95Q4F+Zcy8\nExeRRW0jGk3IBvuEUyoPFYLTZY6Uygz+1yuRzsfVca8FTxdG2u695+YWLNh1\nLDZg1AtIoh6OE8tb3R7CbU8WqUWRkqHEMfdlJbzZnaDv9F5ZnaDoBFyiR6K/\nxR5aoXy06xv+Dn83AmaeFUHe3PzftuciwAjNM7OJPOlSbkkMVGy6//zYxLNi\nmIMWAylr3lPazq6U68wiQ9wsHfMd9oTjVepYyR65jdmyOJSJnGk2WcVYeQ7T\nsn0NsIiXEACU0hBE5/rD+NDsYEy7soL7GmqEvongsvABymDduC68LPbLazTt\n9LGQGpqD8+CQA8Jo6l+xKUPMXoW6yn9q/v7x+nDftNPoT5odQTWzn/+I0rMo\niZvYHsAXUxEUQJFTNaBOR6+sfWKEOo+CsL34WOkSC89NyfXjb12Ode7mp2nE\n58f+t7tjF5dD8m3sr7YaU6sTp17yloyhSSGtzzWvH55M6Xj8t13MQc8IAlYi\nEe9LS1NqtzmiPU5VCW9elVA9X3QE+D4MxQnpTmN2T/OuZPfxaYM3VRruqCNg\n6Ou7P7ovD13gSTmyrifubEM8cJDAk2OXr+WBaDtxgETJjrngMQ42FP9NRr4x\nX7Q/\r\n=46QH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBC/uFbJ6GvFA7tILiMXfFf0Iu/mxRC674HCz+towJdnAiBkSNIepER0XMSVyO9bhHo0hecSv03Mxmo0jzHGpP0Y7A=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2275_1620259725535_0.46793482575820144"},"_hasShrinkwrap":false},"2.0.0-nightly.2277":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2277","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8b240d03dec1bec95bb232070de7cb60890171b1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2277","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-ATUQxsVt4OlGCveRNPvyPP8zcN0PjmoBLjJRhapWC9l20uhoBu3yz4HXjKkFervUZvxmiFAxMTu3A5NJeMBIXA==","shasum":"f44d7800a1eb786b331e3710730f79cbddc89454","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2277.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglIVDCRA9TVsSAnZWagAAAm0P/26gQ6Jpji4/UuWdpcjO\nHcYtsTicfaOK11Yc4NOemPSiJYPC7dpBqKTCRdT9z+I9kiEKIn/8fRI9fdaN\n82eepXv6fPVJplOE4ldDbSqtWpATKnsmuE/QhYdVpBB82F7NkDmh/5oCint4\nfYJU5aBjxN1xMPXYfXrgngLd+xn4rENO8Z2zA3Y0Ep6D5GOHGR+eLIn4ETQg\n8y31zVGJedrAb3aaveuaEgGx6Xn/pYkYGLo+F+p+KeL4g8UFX4vnUsr7pfV/\nJrtIg/ngUjOVEKxVITCYbly9rdCdmO7ZZOH1GlHCn4BLvDi61hjSlpaWxA/j\nVyJrRZFL0qRC4xclog4jOgr/ho/IZjQgMz7xsDyJI2X28LxbVuXARmjVefsq\n4/Svp/fkTPBqanP5vIjO2UKqb44IEoDYeQNZhYebdNtRNQ34UNBMQjq+p2oU\nfoEFaslUv72Z9F2D55BvJ15L/m4BtKqNutrAgFvAmT3iwUu8nWbCFgDcZDDL\nPVcSH/YuZYWfMCeUwGUTZv9CapFitLz/5L5Wy759jpLZ2TkFwSdroz3R2Uvm\nVOvtizpRU287JkHk+gU26xJdOOsGO45PPWZPQTV2VoMbZBRRyD8smv8M65YC\nzMlh0iPt4KB/MryvpDA5n4I7Rz90PyQVJYf0A589gZw41hEGn9z3424Srbxp\ndBaO\r\n=q3JI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeqfmfEsk5fTSPgQcr/faMXxSTAwSoowQGNB/iOyJSEwIhAPh4X9cKflxa3qbk0B+d79YfyZJTveQJuyXAenbo+fyf"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2277_1620346178966_0.5291969668634078"},"_hasShrinkwrap":false},"2.0.0-nightly.2278":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2278","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"fdbcbd6996fe3e91014af0e5c18e8ae6ae282a04","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2278","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-QyIBjswsmYuJt6xpreY5HC9js31952a6MLbmWE/XDhn+MkL94M0VXIE/kGUXHV/RKbxrWYJUbWCM/pR+xhSgBg==","shasum":"56d86f821db73b9a4b5d6a480b9f2e0e59d9b600","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2278.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmHmoCRA9TVsSAnZWagAACWkQAIgRDzaUcInQOj9RQ28r\ngDlcifwcTNLUshVhTn9OMP7R8CvBgcZnnjPlDWcVZJ4EX+HA2EMB5HV2tiP4\nWeAxLqFtRIKp27Yls24HM46/aElVozCHVAyFWpfiMsQndilYv300tkT/2HKC\n35V/70sO+u8KCD7C96jteqndwHjhnuNKo2cXJnmm8diYc0IR7sPVsNnC1WmG\n7HsvyHHX5jim9pkVdKgGlLQTjyQYnNWIjyiFPwSrz9VP1+hzohOHOePMQHjM\nLVd4DZEEU5IhLVid9aRQbaY1eo/cWQPs5w1hzLQN7AhGmRvI/MydK6+C+Y85\nb9S32ZDd+f6kOEHASZLYC/Z4mWI0nHWagpS3LVYj7TBgjLZ1FFOY3WWaY+NF\n/2Bq4iuTjMqSZN4Cskh+YWeg1mrBXT1e8Yv+ONX2eTpbrsLBGhxCMlgAkoPh\nb3vVKkH7FmJJSA3WUNe6CAAsykeDOCEzpd0TK9j7KuoUTMEW+dXKcI4kIvjK\nqis7zoXw/Rn3OLWvmZta0n7eCX/Cp1icjRbkNQAywixyXrHiLlTcXl8GmZUr\nHolSgVeKKJE4EIvOh4o/lR3rSA9kVFv8VZAOyH2Zx+l+62U8Qisoox6q/d4K\naK7RtqmGHfto/4XPMpXXthTbTK4oVxVi/jxCnrYU++4dc3eOe039ACN35i72\n3TWU\r\n=Cny7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEWHce3TVLvTFBwjgbj/Tb4TwG3AUiIjr1gcKCcAX5ldAiEA1GtQMoF3yADHSQDrxtHREeNbWqVogmL1PzUsTDTSeTg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2278_1620605352183_0.5721105625195186"},"_hasShrinkwrap":false},"2.0.0-nightly.2279":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2279","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ba57b6501632703d68923b214b0c0f6d47a34b1f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2279","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-OFRID4b6B4ee6pHUR7xiFqIsxiGPcMR5fq9X9U+7W9/nMkXGndzzBBo/cGCGG8bi92b5RD4PbFRutssir408GQ==","shasum":"ba5e4914a381514d0ffb18450861b47f324b8980","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2279.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmLd/CRA9TVsSAnZWagAAgbcQAJqeONTnMLNY6cp6kHnB\ndbJXCNLTXe5Os8Xvsz6oMAs6FPnWCPOCMJmEVFXnr3ML8WngS2Er9WLdtbgj\ngafdq3Axw/9sRX1tKQoKUemcT1bCwHCt185ad+N3rkvsh0Bhg7Xgv5hQBV4m\nTOT+T73ntgUs0fOG45Bx0B8FTe093pHs/oqtgKhLQoX/7rjbTkJf+GCryKoi\nT468rfTL9R2fFPnHSh+2aAtLCSGPF4dr4UDtgT9yTC9LkYQJXj3/vH+8y/OQ\natZ0F5ZqeKwQXgGtuU5grR7Bpr3aGyQyTv4hXzg9YJq11EibPhXnX2DD8hUG\nUuyTwGM6HbH0ZPGSuJAjfkIAM7YS4IU8RWNmO32Bp1Elqg6NCOxZg7Lt5Qav\nYhOot4UdWw8NIzOu2tLEXPxoaq/AZGRoASs1TDEqG3LrxGYyGFFlg3erCiyQ\n40kQqYh8eyCpbRPdka/pBUPLtZzchClgB7kXkE0bwpCyNK9EUwtqGInb4dHu\nrruhCholvFqQUtd7U28TBGKJHcHmJMg6kLeQWuHGbMOwuIEIEjh4YRSzaZUP\nVi4d4Av3ocJWn0i5ulSAFd1MlpFgjVP76EROWShRaO4rboLzUOw1FSeiByKs\n9XC/ezktkxEXUYUR1vWXyKvYo1jdY85UR3uziQZcx3LCOQUKA3sbfFMAf4qE\nK2kj\r\n=cr6v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDta82Aq+GahIMWy+nqXujviGy4NdlyOCAuRG/tV/LcKAIhAJn4o/MqCwtXM3EJEiSWFQMpTHf9GaLrN0N7HCWJd6gh"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2279_1620621182568_0.2582521030521765"},"_hasShrinkwrap":false},"2.0.0-nightly.2284":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2284","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"177f8eec63e5b91d607c03dac76d8c87c5176d1f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2284","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-tqavgTfsfummA7+fMve889QDhiuBWU7IzwL4VqQAdRv1nPea0kfDQbMW+/p0Aoqls0YLV24LlrinDJlHVkuQaw==","shasum":"41b1b68de6f52b61ce57d57f0cbfeb0df6707dce","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2284.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgm9LDCRA9TVsSAnZWagAAcuQQAIw4knksUefPYJP5d5j2\nz9fx4oJDVNYQQS7PYf8Naej3LKhirEaan/qkwpZ0KnQ9g6Z5VtyCWM1lzjnq\nQPs6V4/oAaZ+S8YrxGFcBiBGvSKxPkko1gjc4bOAWQLB9YL02CoSGmLJX5Xu\nIU6L7zE4flWYy6I84vj26XP7b43SixN5CcSkLL6dJmmz18oUSqVk2xgRxjt1\naE23r/KTOIuVD91TLAFh5h8I9A2rPFnIAtNmVpbx7JT737W4FV9iKFgB6yqS\nHcjctLc4ScSiPnF+6xxlAkaOR3QtzeMWIuVwvPmiQa2pXQUt2hUlWImWS80N\n/6ULf2lHEgyuPPs4v7vPP//8+7I5/3h2nsdd3vqPh3it+p6Y2gNcBg/gyW5v\nSeQK4VEMKCqv5Mum6J9mztz/HcAp4nWX9WFWoyU9RJucHT6ClfILyyJCmiev\nzg0tKfLCyMD82kROMwyXTeD5bdpX+pX66f+jUIlVT1lP3bxYK8/UUguRsgoT\nadlt7hD8O2gqxVkDs2AylPX3g8ahvOoqpw+biTu+skcg6gwghkg+PrvrOUzd\n0CIpykJ2FWUibtOFhMtRoVAyeYJrkGQktrtOiniYiU1FM9BMHaOOfAfoxQAL\nFAusKGLDIBQJJexwTKZfI29u4JTWioCgRLDcKCds8Vo6lZOpj4XeovWFrcOY\no1go\r\n=+zWB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGqdU4L69qSYFKiknjsi3KqybKDGmEmEK0HkBdqKUo+xAiBUgy3WRthkTJU2CXC2F7o7vpzvXGlRBmhk50YFK4cWmA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2284_1620824771317_0.3313352038727484"},"_hasShrinkwrap":false},"2.0.0-nightly.2289":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2289","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"019d762098198e9860f830afd7d9da1b250c0cb4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2289","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-gI4qrN6XhdHP1fVqwHjixxySub8lAG6sdubn46LGhw1yDF/0hlnN0bpfAGVLAFJeXw5tCYzr5LCFMTj33dr3mA==","shasum":"d16e6da9e9666efd7698f14e62d282b6eb62e347","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2289.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnccECRA9TVsSAnZWagAABGYP/0Kg1PiwbBcyz9tQM3fP\nXnM6qpevix9m8OluXmdHdtyut3PHum6Elv7eEeSpMu1CZtjTI7ZY8zBRlhJg\nEmat7hZ98no57u/IW0+J+vOBq/9/SvRmj7D7Licmo6C8xkGsUtsUwOFxhDAf\nm45tcqsbmaeZRB8mv4vgiNOeATBoK2RvQdEEjjzaz5AbJad+5En7qYTiPdFA\nNVqeHFh/CInIOzDGActS4wXfRTrrseCJNCsG2eGZ3QmbDZf40/v0vDUuCUBg\nHzPX69MKLIjjxk/hSiE9miXiPmblO0LLmWnuNSiQ51RvfhEl29DbY6krEp6T\nwjY0Vv4iKp/diGp0Bmn0+Cg32yG9+rr4HDjoQrtSDWL4zjTP+zAuwa+s4cSD\nTY5Z5zdqBAoc/6NQEh39SzSJtzcGI3BcaOGF+9g/gHDISN9oqSYQ4qIFgZCs\nv+I428mATtwArctKikGnhB33BBFNWykkFy6lwskACRyY/TGObL+VyKjUFsgz\nUYOKt/r9Jickc8Zmr9dKBaFzBcb+UscRh5fn86WO5HRvfOne6c2JBPEtFPHr\nDrCxxJc0SMlxiyNNU/bi7Ml0Nq0q2ZQlnPFN2OJQrOjAT2BJN5rb2yjHcRON\npf6rR4WIwIg8/JmF1Gxg/z6OXpdGVJl1d2XGGnC39xYRpY8nFigi5LIfkn1+\nYDMe\r\n=OX0x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBPi4KBj2od5m4+bT5soK6EM9TZ0DPacIFuWURE32FrEAiBElzeMKFfk5PZawtVlYNWaUSo8qS/J169kzPb4S1B7wg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2289_1620952836215_0.39012807163517826"},"_hasShrinkwrap":false},"2.0.0-nightly.2292":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2292","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f6695be56a7adae160819a90ea037bac699ba81d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2292","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-7bMhyQ6gaAqxqJU6UwywWCdotTRA7k6eeW/7nFH+Y2vM5bQSV+56fJYpgELj+OBAJwtiI6GREEQKux27eTRMeg==","shasum":"bdd7108392e3f6009e631b1a37d5923158808289","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2292.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnxcVCRA9TVsSAnZWagAAAwsQAJ1f94ghvpY5fvLX2MlB\nFaUn8/nlzobJDnf968ULGDx83PkjDDwOLzgX+OkfJg8BQ/+8dhQ+GC/TWJCp\nFMvsAUqM2B+OVVhcTopH2qcpw9CD7M4wVMrPneYSYPZXHmOBUD1dgqYeBm0O\n/J8oiU79ackFIhYgZDCjG/mvFPV0wM5vRW2l3OBPumduhlSeIrjxRK5cQwVo\npV0g3gukQG0QXqhLHKy/HzNxGHcxDCL37audNtaqcT2MnmQijMlod2DpN3/H\nOQdqMtZ8WYufAo2bihHsURYhXO/38MY/vvaxTn+g1oAMcW2eNLi02dcVOgX4\n/a/0AkQTIkayKgJKIZb/+03sGcz92bJtYxVL5X5siV8Xk83zAW38FGdCu1BQ\n2JB7PPBbtYKymItCf3khWhBuVg/ZR1cyhr7/ev073qJsmqZTty2YGeeUFEpb\nee2iEG3O265aFsPoKKpxZ59PFzYn1Xvm91RbJnt2Rz3FhfvDERl2KYlNsADO\niWPEGywkA4EcBP2CMhYQIeF7h2HIG1kLdTu+RqUz7I8mUXUHu+qyWBO7NqaP\nBPlPbawOEDt1HLweQ7mjCLzNX4wm5qJLpezhHQaKYIoKjpxvIaQQHawHDGoS\nG9IJ168MgJxOPDCQ/qjkiuEUHatNzlsOP54WEjD8UAvhnmcif9e2rwJovebH\nhmBd\r\n=Kr+Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEBfVR5yAw27ZFu1QusP2L/nBBuv10XRv1Og4VO4SLPjAiA88zeBhqUvQEbm2CSVGvTnhqGjvv6ujjR09qMnxvx0IA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2292_1621038868372_0.9869109137653183"},"_hasShrinkwrap":false},"2.0.0-nightly.2293":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2293","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"afaab71ab78035a88f8a92471f7d6e514e45b4cc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2293","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-OGLTj/aYEBW2h2+8iDILx/jld/u0Xn6Fawh2OBerrDmwW9+2u2QeWz+z8lLIytnkYrxRZCddSwFvnmenr2x7Yg==","shasum":"3a335d99b8c253acad8499560f4ee2fb8c352c12","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2293.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgoGjPCRA9TVsSAnZWagAAO1kP+wZq3Znfl/pM7YJC9lxr\nBDYKjK81Ywk5rvzcMMf6MpbTRcAXO8rCuR4feuKMFIYbQRQVaql4/7LsbUMr\nBBDi1dlwm3Fu7TbIpX02AKgAN4qNehf0q6xKVUfk/Lxoou2KjcU0uW90pFUC\nPjhdMVKg1/aLCAfdK4Qr7hyjQyLLJqwQbdwehulcUZwMBc/tEjNjsdQxm61+\nNr7AQ6scQ+DNiBX6zRpuzYcSVhWMt0WaMe80qvmpJHULmXE+Wb2BF+3H3Lj0\nXOlFp+Bil8WS2kWsGBkxl7FU2hUONZs9ybyjf0rnaKmWYEo7riaDYH7rt/YO\nLvons+RBPkyjnP4X16A8Ag8eNIe4POet2HDOJDCk9fiF2gPQABV3vGq6F00L\n6K6I/+6VEX5x7oavtA0qtTIrqQznULfQvPbh/2DMFB1FBf9TQeObPfqFGYxm\nmWzdKuThXuFL53whiKof6g5Y51e/3xCrDq8pYLWAtWHaHxLfWioj4w3CdgtU\nWVXNinipVMvSTlPmPKkmSFPR2BbwqtFsRw6gM+HDFL2kq946k/H4qnJAB/GM\nMPSeb5X69cLSNEVIFZJYHTZcHDou/XWV0s1z3enESdre++bNf3vuljSINwaU\nUHY32G+z17gDdJGyXjiYI6n5SvH4g08G7GjNreMLZiHwrASOj/FxaVqvuqJ4\njKac\r\n=R0Tn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChm9adbMYnBLEzacVzpGHCafChwybcasJja7GOZp1eTAIgYssT2vsYzR1ofqM88820QyJTUtMpoKp+X+ww/Jo53UI="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2293_1621125327282_0.2426544741323966"},"_hasShrinkwrap":false},"2.0.0-nightly.2294":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2294","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c8392be1a607a4689cd7d79b46635bb03ae80e26","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2294","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-hmya1jyniGRVynGpmzzVR9GVkw2i51W3kBBiu2tDg0b8XkuhPrQa8xxjauuL7v7bQuhaV95Adap+wtaiY1HYBQ==","shasum":"57260fccaaa0d29e3944aa68f1c62eff29b839c1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2294.tgz","fileCount":15,"unpackedSize":74587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgobo4CRA9TVsSAnZWagAAM3sP/23QOecC1SVo+xLYt8+R\nUUZnnWjrKrhM/UOCSWusK5/34POSP7LKjf02msuZogcB9YZBn5uLb9wFxRf4\nZdt3a5iHg4Eq2sSSF+ubrgK0leEQ49HT8puxj9GRXTcadghB/F4YmqXUrb05\n40aCNsDks+bxsDUltMo2o59ddw1FjqH594h0voPLQVfk89pRx2l+Jbup5cmw\n/LKjSavKcqvYExPJHOtVX+luOkkmRhG7y0I7p6LLuWVCH+4aGph/Mpj6bBh/\nLLWl+QJkaKCW/7gy3GtBYCe5jrCwgGW2QzhI2nqgsdoPcdDxi1rH8oHcv4RF\nCtph16NeLNUUb69TEmQezXMi36U7T+91MjoQURX5e4qIRgI1pzoMb/0ML9ME\n2xqZ/GJz94eudOFznk4CZdSJQosgA/MUV0FN+GZ6VX8k3Iv+jNqn39S/Jj4J\ni5/YbMwp41/MtBNMqyXeIiF8OfXjc9yLBBlYYzrAk5Z0FNYE9c5JaFHFFWNz\n3TYxftfnRgHltphFoB+vmhFLc4DQ6LBU9/f1c2hVKB1rFg4ofcsTih2fGlhD\n1scVB27SI0W3/cTQlKbiQlgcNiCY0VXK7krXPqdCb7PeHyGKRePo/ThOHSkz\nCC+Y3mWz49R/wHpLlz9ch+F7u/JBFMskgQZmHimLbLl2ud3M2g7Pv57aa6FQ\ntJrd\r\n=RV1H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHWA71X1WU+gBj4AShdloumKg/sT1nYR/CUTBfU1kT8jAiAs4HGdkJfsoFYwV8vlIRKki0YrA6OOBDpeEkEPacgueg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2294_1621211704171_0.6394980696113621"},"_hasShrinkwrap":false},"2.0.0-nightly.2295":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2295","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"06bdb1fb17537fd661bc7c694586e6fbfa4bf3fc","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2295","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-ddpwM2UOfbTQhRwuEl4EvqAmqD199UzOTI0cNhsmYng/LEjZDv59oMUco2juj3tyYzQm464U74XOM9QRMQweJw==","shasum":"1ed61571a0c9986f3dfeb40078d72cf034d5f5b7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2295.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgodK4CRA9TVsSAnZWagAAaTUP/3U5O9/7ZB+tWUUJPyJ4\nWWn3W8BJJDBNgW3QIXluN+IYcm5zMGv/49MlsSkNBAIFaeLgXs0RzEX8tlx3\nF8/MojvCHAUUoJhGLuOO4tYKUmjj9W+gvBqbr9cyTAXUgP4qBP4YYA4L9mSn\n+4jawXKTSZqIID226hn+qY9SJN66fzt6WWjqg81kyQydJSrhaEGq9T6YCb3j\n2iXU4h8H3f0Fe0YlLVaV/JDryWLi0/y9/vfflIqtpm00Hm3KBUO7Z9xxgAkp\nvPZY7dFHAxB0I3DSzKPSiYgIgt3lTfXZ3UkUp+z3ITLPcfp5sSTmLH4SNvX7\nZcZ3fLF7DvAAF1Zxp2f1rdtxtxHz4V9I+0QMsJQcQwA6jU965jHW7kfzCXML\nxAjgwHgEiHI3RCtuv0pO7RdlEZCDrmxtA00oGzE3RikElR8tSoi7ysUaKDS8\nCJe9umNjRkLw28lb4znEi9V6304QHnCYm+SSQowMPYZFtL4NZ5M5DWBFZsDK\nrxq5Iyklj9UHOqZHsdsspV1YTdrsOgzQZi1yywItOYRByiRjIxh7hST+AfaY\nBVzz109c0T/hlHGNCwO7HMltUxB5R5vaDKBbnZwHZkRyqpJKqktGEFxe2PBB\nl1TJppFsu6gq0dfrB85kt2vcUNEfd9C0EswO7W7oTpJ6ecM+9IPevfY2x49b\nASSR\r\n=UM/N\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDHBjQNVq4c6N/qlEVueB2R8o05DdQt4NbhpdfGL3apaAiAaq3MEOw7rzhcsb1o7XAXGrsqAwoBvuQ+i/5htxA/YlA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2295_1621217976156_0.6568677306093391"},"_hasShrinkwrap":false},"2.0.0-nightly.2296":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2296","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"71b3b9356bb56deb8c0a63a1277b84db89c02cc4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2296","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-qKfV6rIMlPk9x+HAqXGoE0nnbzA91OiHzcTeoAmkH2Y1uxXuVJpsxVGFb+Ft9scCDxdS0ks7y/6XTze/erOC4A==","shasum":"d9e3021807351940674619ad4f32ae7f440f2268","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2296.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgowyeCRA9TVsSAnZWagAAFgsP/joVttJVOTfxCpJZFzdn\nY3snMtJVB0FGHExCe/cT0PW0bFMqCsaGMzOzk7hq5i0xV1b9v4KTRE/HBknO\nWZaz0S1TKf8c821eNgZPFOHpQWxCZS0UxgK2Lg4cEa52IMwy3OV/NtOAf12T\n2DPHStzkg/lJTptFDSHWyfRwjk4ChCuFeygvPXtoYdSOJoIwcYPS3dyOH67F\nyIzFV0vdprE2UsP8MVn1Q3CDc78EQu7XV8wtmqwqmjo8F7FOmQj3gEmO6NIK\nBQUrDpPP9QjjHTRfcAz7VgMy0OLc7j29G3naydtYaml9AIfFH3NGWwGhCNfO\n3UsQ237NaaC94gEtyhmEgqQADx4q6hUzSYgNd/BJBi5c1HM6+o2c7gBtdrWB\n2OTqPdHWGTPGKJRE5duMUjDMJtAEBQ/ee85vOpvhTTtsMwAtuNNTrR+9ggi9\njO/A7HGPSM4p5XPAAJCThd1zuXMRZzHumQ2ZvfnrxakmJ/ZPklIFRQcwZ0EE\neUJNjTpMpw0ByigmQi5c88epJkE43lo/xZdRP14YsGToY07YGJcBy1qCPWn3\ny1Q2C3rI1W7cbMcP0yHzV/0HXqQPkXQXlYqZP0RBspZhRgPEnbRcWYQc8KpJ\nwx4W7NwyxY87VEYA5d6eg67Q+iYqP/otWGrzt75fNJdhyFPCFSBM2E44CqFE\njNXU\r\n=WzQF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAgjEPjOEemW+NX3oES4dwx8eLSY0R7b0AdIXJOm4UlQIgF7FrlJiwIDUEeoQ5WYDL4SnsBLjW2quNwqsUAx1o6ac="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2296_1621298333954_0.13311495776564408"},"_hasShrinkwrap":false},"2.0.0-nightly.2298":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2298","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"bf03f018093f8c7ca4c3a544524e15065a637b3b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2298","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-DpOf+wMvVLT7PR/yOPKQBwzRLZz1+6R0PIwNIeJSREtFDwwIDMAKrQLWI+Gvy30lHzU0nXtmd2QHQZxy9GWBVA==","shasum":"d1c8bc3c18f2ffb10e41615d093af145e9338501","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2298.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpF55CRA9TVsSAnZWagAAaDkP/14Q0RbzSHYCyibyCj2U\nHn9in9w7LVeGt7mix7DkiyWJ16I8Y5VnoTQul86dV0WyHU3NJ8TZyjZCX3Gc\nBNknOHfcJDi1RFWSPBd3pBp8Sh5vXFh/VwjNnTP5HkY7Y+2paF3RCUm1nqnp\n/5FvO4KtHp/UkvL8z1xt69KgvjMmGQck/nH4/tK07rGzQynKuGYBwUZu2mPi\nuvCJbpQvMrwctTrJ5+0Q0FZ1deA39tj3i5WwQpH6N6aUfZfmClHAO2EH0gQ2\nw2dfKiWH0j+ybPsIMh4ymlOgdjTh2iauyEdI3OYIaUR2AmxOdtp+JW3xxl9U\nwntMG6X0ZAj9xghGpD6PSvTVbvhWaIQq8yynoYM9oIWIpu1Z4TOtTPO9cfOf\nAtNj2qAbUfDeuJH2oAJeISKyhfjxezfiu/f0luSYAVFSyS9D5u+9Fe/avZIm\nknROBh9eHCyB9TfqeMKzLkjh3MFq3SMizbve4MyveFosEzcIj7vzct9kgGGN\n23oLFi7/VWpunvBTLTbqv1Hz+U0lTJlWWTitu7vUj6PdebQzL35L0Jylyps1\nFxuTC1iEnxwQZIi+5uKYRENOYkCSpoDcYyUmS0fpjUP/181DdBz2nZqf8lWH\nwIwvnURwg7+R/ziB/PT5trPtzrp7+jWbV9c9Gm4AU7zpg9QajT8vww6FTW/V\no5bL\r\n=LIND\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRkVU5B/ttqJ7t1TFDBjx7Kixb/FnIKbRCRrY3cpSI0gIhAJ5cT/CyIaKO9CBH79baxuFXIyNRKw9Ke+hx6Xyi5dLz"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2298_1621384825237_0.8436990720936104"},"_hasShrinkwrap":false},"2.0.0-beta.3":{"name":"@parcel/babylon-walk","version":"2.0.0-beta.3","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"bf03f018093f8c7ca4c3a544524e15065a637b3b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-beta.3","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-7RKfrrGXhgG6uz3uUOv2XmDEhCkewn3/olmcz8AAIZzbPqJjg/KF6onj+ZgX+5Zz5JD0pGTDFuQxT9rP75jwtg==","shasum":"386468ff6ec02e9aaabd63ff750620891d727923","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-beta.3.tgz","fileCount":17,"unpackedSize":77155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpS/yCRA9TVsSAnZWagAAh4MP/jwkujpuJbOUgQSPEi8u\nmBxsLYA9TkJ9JJB4mB1SFnGYl61iq6zcvIBTH6pzZd6Oemnu6ayGLte5zC2N\nFeGOZVKGW1WXjKg73Iab2BlzU+nfyu/HXprHO+KSLrAp5tDcbDp1BWTrcxtN\nE+kV/I16nGeXc2IL2JaK+m8A5a1lFxkkWp6Rz72mbiCrLsyo0utdMRftKkOR\ndK2xXrA4nsYp+6pt6rVaRsBvqLq7MUYiCLhNSV+dxTsS0d2WWwf/bftBY7qh\n1UT7ZMjAFNr3UboCcFjj2k8bA9ioD8bcQnDuQ3Ba1ap4ebdDl7ZCO+FuehKD\n7TU0gKhjsG/TkgAhIfQgeo3vqBe+VcTp2KMlZbjyWx1+4LybxBXPQT78NwpF\n4+LE3k8rY/B3anCeq0BN3Lj+kGkaN0ks4MVOKhJt6PyFyd1mfRMSq6EKvQHm\nyiYcSAatfM6dcbDC3ZGnVfOA7hrRRwCCRVt/kVjnviO9L/MxcGJk0rt/lksf\nLIQ0ETj1PmpyCTE/bCwKOSz51+eKrJsMmfCMFztBAjKZg6xlS8ucYkYjo8Ev\n3hJsiUK3Wiifn2zUEKkBzKgPgAh+4AHJ8+PjsVgKdnsGaSq7SwFgMZuNhHs2\nKuncTw5FZgqoiSXvg2EZoKi3I3LztkXVMWMbhx5AQRRQwlSXrKcKK0gY3OK3\nBTYs\r\n=qc+b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH08Jh99V9ZZ0iBZL9409zVeBV+SutfyAVW20NCRZwF1AiEA9kZwrtDgjRo/sj9/+dwm/j98Bf32FMIkLZMxMuHNTUk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-beta.3_1621438450577_0.8871457773177363"},"_hasShrinkwrap":false},"2.0.0-nightly.2300":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2300","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c39d3ce185b8ffdefe4343cd534d70c19959a3c8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2300","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-CzDvxCRt4wEEw5AMuf7OdxUNx3ptwxJWyHSALDkNzjjInuRu9wj87P/tlXSpVPIolGkKBLnH86PSjJkt+NJ8jw==","shasum":"4f2d1e2e16dc1d8d4951d8ae64c7621a0e4a53c1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2300.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpdmtCRA9TVsSAnZWagAA4mkP+QHkKmA84ounxZGHScg7\nO1a08GaoHLl/TyKEnf3ZHx/IRGyA8Nqf+RbJyR9LQ/IYPbpzvFgH7bP+4YNL\nopgGZsXU7l+FodyVtijVY1A4VL/2xUDDhtqjBbQd3LyURX1N6N73nmtRhx7j\n4cjDOBc1QEBk1DdLpEZnLnUvlfeTnVxEv2RRg246iRZHKCtiX5x5q7kFxLZU\n6dmjELTt9t+750Z7kgXg16dhubUdPWrNkjQbB4BHjhpD5h29w+DC19ojt5Ic\nlTgmjfCFg2/1rldBW8FW8vZ4SEnmUDBAEf0nPIk4CfvTaV6v9aIzk9ph06fG\n8g0VbPvMv1zlsO7NY/NpVLPt8S7nUt1L7hblFlzeDaEEkR6iYZQQ2FRja1GY\nj/BlPeu/MjJulV7KGyZeWVo/Q1QD0+D1Onrw16G9WIlsuPYq3SPP95KL6dzq\nB1CGPyVeP7J+jAwnjbQODdMFwhajalHy9YfMQcmTe3xBB51HSXZfDWusBAX/\nuOq83ykoE8DHG9gQO0u5jAwK8riuVjEkKdiSUbx/zpUZCyPBZQCrD/HaO9B5\nvXWiqQt5Z4dS35G7CfMX1B/RiJGJzeQNKV1RPBggpg0nLqipHaanlGQ3wpCo\nYXbMIlPGO5UBCiMFADwNkI1YgMj8AUbqXHAR/BFqinvjuyjYJLs3XdAdFJFh\n9vDQ\r\n=bzqG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCm+TdbwwWeQ+Ymex70aWhODm0b5CbkErqTtkTa78/ITgIgHS623LUsVrmOUWqMA+F4dm/IG2SuSzfxKAHKjbypaw0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2300_1621481900532_0.6916371900021807"},"_hasShrinkwrap":false},"2.0.0-nightly.2301":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2301","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d43a9eeeab54eed1ba2156ad5948d52d855112e2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2301","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-Xog2kERxggv6/DPyNVVPu4h3nNvI+JxIfhW63qH5I783+pCFX7YcJHCNVGOGuKh9wPxLbp29VYiUH3uSS8CiVg==","shasum":"6e00833528afd808661ca906c45e11a4afb5e328","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2301.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpfFgCRA9TVsSAnZWagAAgzIP/3x2PlYPLG8fh7WTioiI\n8bf06Xu2eNADSUlDOV4HaUJOjxoYCGoxogLQAQrYtsuTvRPvYK7Zv6pmaG3T\nMhfd4VPtKvG+DaqbUI6EW//7R106s7aVq6dtStFFvY8SlG9fjU2BMnlqHv2i\nicSJVZ10qNzadYHqZ3aJyZXMB5Cc415KG3o7eIglGAztxGvocuEdHCnx/13j\naVESdl5o3W+cBwp2kLdD3lQ+tCATDIX+inyGgw5DkZknOx0/LKrM9SZavS+S\n6odBWZRICrc1rHc7N69mA3gNlTLsA6V/csB0kzsU9I67EWGEQw/diy1ZPZJR\ncB35n9fg7a5OiFViQ7pBi82ZvSzAc5A6QWRQUX1LY15wIkUhfWNy8QoVGlwk\nUCbF+Jv5HVOQ5KiJwqO4mEaDzWpxSJDknD9wXDfZuPt+3nHHfwbtp2EJ5RIb\ngKt907tBsDDBrEYIsTlsap+0jpsFZiKegyLXmg27JuAcMgqNABoWZ3ICNJTJ\nKoqDipL3friJi6nHM4NQd/9WeewHPMpXffHo8MClMGXwaiMSKd3vBZF+sh0t\nKiq73m8+rIKrPxjTkFttnU2eQ54QUuVIvU3+EMUb4DoIIbq8UC/POXm7YGPW\n2zlzOsOwBjc975OocHuy7vmKxt5X+hYhYwmsPSZzLTFFQ2uyT96ZCkbJzphV\nAwpU\r\n=ZtXI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG6lC/e4ROOvuUCE05QYpkZl6oP80MWG2EHaTlrE3mhjAiAc+fRSbNkU5MPpBJE+Dmuc/0FK5OXmyVEjQhrTWqS5GA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2301_1621487968441_0.42037318319359707"},"_hasShrinkwrap":false},"2.0.0-beta.3.1":{"name":"@parcel/babylon-walk","version":"2.0.0-beta.3.1","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"daece49d003ba804bbdaa3a7ed3d6aaf446f166d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-beta.3.1","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-Ght8OWI9vxTwOhrblcKhfRjfPJXbq+nnCulfXE1OjB+j4GzZN2iERfk3YC/4KJJ3sI0qkqUIq4UHOexbMZnIZA==","shasum":"83a1fb3b68b2a714aa707e56ad319741d3f6a3aa","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-beta.3.1.tgz","fileCount":17,"unpackedSize":77157,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpgmlCRA9TVsSAnZWagAA1Q8P/10YfFVGyrOh4xyJSPuh\nc6/G0yzfRGO/XnIvUBbUs8Qx/oK46F35nXNZLa5HieJcwOj/ZjkdFcFNhI/8\nTJpGZHlP0Kg3lj7zcPfwV1X9szwJ40Ic/IUFeR3BL9rOqYf/nBfzPwZYRQbO\nXbUJaC7tLbkj1JfqHuVnj2Ma4oxOpJ6MeDQDwRtemyI44BNWtJiaa7XKdwOU\nRd/XlzmbgEDre81nwlPAT9QLmaMni5XJxbCtmKFJne0T9u1kc5MGutc+PiLd\nhvtvCNAIWOglplo2mnULijnasSu28K/bzjXWx2CzX6UzSi/aGxMMyirY9U6D\nNy5fRUw78Fy3fM5nx1XQoflpSX+R7MCDs1ITio+urPmty0JQz0sIxvR7Po0B\noWADRaQqqWjtCDP0InsqKBm4u55fw1DjF/bmF8IEk6YJ3LBq5lgbM2PHAG7Q\nPYYVAUYkLx3pCWsOF1C0dwQydgTGwcn51zRgQRWAagw1dXkcd8JjXDamk+0c\nApv/X0B+xyvKbrOu81aWHvRztlgZwjM0blSjIQzunm7BH0shEquWRS/nrhu3\nhYs46i7h9Zu+UPMGtmp/7LAQcP8q835JagakVDjweYsroRuM7Q8FLiVaMdPy\nlCeTvK2yHZiIVlYtmVn9Fg+360863JFrLQhmLA02bflWEYWAwnWSnr2e2tsW\npC6X\r\n=qgqM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsMzwtcESl04eDIXoSHZ8/0jCj3lq1xnPMB8wk1OKFMAIhANPbcqy3BgxqyjWpL9WjXXM224+e9ZvVidO141pYK1LD"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-beta.3.1_1621494180788_0.8811651415524744"},"_hasShrinkwrap":false},"2.0.0-nightly.2302":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2302","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"daece49d003ba804bbdaa3a7ed3d6aaf446f166d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2302","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.20.2/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-kWqjr9sOIzyq0KQ3RG27BK4jf9r30MfAiN2SCoj5spauSnfsypG5MA8xRwr73eMX7mUgXtUskzGEuPVJjoEGDQ==","shasum":"b262791f91b2f35cbe718ecb2c27e0a9cd9c1edc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2302.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpwEBCRA9TVsSAnZWagAAZmgP/0k+VB+DPYM6Y52WVjRi\nlFJzhz57JLyW6+VBhc5Tm5SyP+gpf6k1/Bfep08DBHqNBUwQNlKUy5IEmnGh\ndpoQQn5mb3LKX10YP6NAlwefQS1cE+8qtNnlFobbfHXEwTdgzJobueac8aS1\nVXaVb7Du5PTvP4HxK8XOcNqx2+hczci1L8RYYSBmMQsd45oBJFwvMh3+O1Cx\n4hlWcwg3Ge2WHu5VVTcRf6s5nA7VibrWjUSAaqTFSNO8n2kaHeI26ipw8FPa\nD9ucFK73QyWuYFxl2Cds4E9xI9XurjF19KJqnfr0XxFIEV31nZNXg7YB+cr2\nleN0kRbx6IsLH43Mqc4PMQQBI6o2fQrexVn0912nya3laH58WD/xKlw70aoQ\nQGX6vnMFYhDamnhyntcM0olkrrdzUph1n/Y3IAuFbZEbXsqqkOvOnAbilRuG\nhxMpadJQBTwVsjuO+/KE1cyu3U8CSmRWWv2kUHX6GbNVDfQMAmzKdComnBuA\nr2GmdzgdxW5RJAs9yUW3C0iOExZkQSNKzW6dKk5S0gmkq3V2E4GVD0WJ851S\nIdtA8VIV7E4PwxdAetwRJgs9iNlhEmAkoKw62J5a6wc6n9wRY2wKFzeVk9dN\nQ9aHOlsAiokbA9dHdxuSnzi8m9SnFkUz7NKCOQGzVFkxwDMgKOU1RlG0uJol\n9fOc\r\n=2JzT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnHMo7Y05/DMaU836MKGiWdgILFoz5Pq5PwDpyVnKnoQIgbKrj4p4S+LObP8RIZWImVjN7CQV+Uk5IMsBCGA4HuzY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2302_1621557505201_0.007716430714445277"},"_hasShrinkwrap":false},"2.0.0-nightly.2303":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2303","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"edf7813bdda629eea977439f556692cb3152ab5c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2303","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-gNwlXYUVtfTKbuBIQbJlJtcng6ZownZfnH/N2VeScks6AdtQaAw+tBEKaivP2BL0JB5p/sEnL/8gEC33wY7JVQ==","shasum":"10bb2de12b186c630acc7fc9cdb53453a3d6edaa","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2303.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgqFKGCRA9TVsSAnZWagAA6DoP/jEQe4QqZoMLspoioDqi\n6AxMSKMSdNtRPO12lSEauT6yyKvPBlv0QWRThj81ypgWr7mFYBW2Cn4Biuq1\nWWKsFeBRosaIsQtQRj27Y39ZNhiIuiSuFOsV+NWhh4r1vvEZHlDlvlaXqjIu\nJbsbjtxwo9IxUOGH8y4jT315XbF3Lyx979UdJw+iTvZFt8QolTWmrVuOmm/S\ncH8ooyxS5TgtgcmRSHyvclo9lWYVxivtYvhpSi3YBHt+kMjRo4hsbtn2eQc0\n3V4w/M0Y0T6tSZX4fm1Ihv5oSZoRtlvykuIed5SCM3kYl24OohhpU+FP0s99\nOKWQizxpYuNcVFofolsL1NzNviO+cIuVLlP/mGfFJ4I03UZM+udAu+bSAAtQ\njKvkcA03L1VIEETY2uufJbf5flmtv0X14RJLUijMZuDHoCycYo251MEBKW6V\nVHxY5CtujZCt4mQ/G7dnkTHofw2j4GHdGTyZaNkeOg8L8vOT2So4tNBgE2/m\nbdxApjZqiXs7ui2nZd+gRSHwbeVLNm4hCku5ZWYTglLsgosfd/LXrkZJNBhO\nXiAzQfrV2Iym7c/tmjQ5fMEfa4nSTWlB+XLu1lsFfZEWiObJ4L1FSuFdoY+M\n2x/x3turRZRZlbtghBb/OFhqp8a5PF7RoUFcJqw8JQxyAvBvCNkgIp52fgVU\noMi/\r\n=28b2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFTcu2aQI6G5DS5lrLrYfTCcAdEy+7bbQTiWP+IfVoNQIgaz4rFWRwagkQyr/+zLcZcfTC0pDvOJGYSTrle+zgqVA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2303_1621643909985_0.8153750221894862"},"_hasShrinkwrap":false},"2.0.0-nightly.2310":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2310","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"14a039f071c35ad154067715f49d2494c249890f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2310","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-UQABC7qfU3iwT81cS1UGctkgqG5XSB8POD/NSTC4+mXmYyk2wd0MmPUOCheaVfRTkvcvFYdU87j0OsyNdoXf4A==","shasum":"6bc4633c32d6d610028d0fac4636e675aa49f39b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2310.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrEd4CRA9TVsSAnZWagAA4I8QAIUWRgOo4t4tIFVOkSQ3\npv02x5v40lA7zi2wtTyNTAzkDvwx2U8Cko/HX2MlSnPzjt8fmo3pCldhDNGr\n+8s0ai7KWNSwdRkWSJu3CPrAzNDIlpFRH78Warx4UNsSnBNpiRXMBRXZEjn0\nrrYvnZGnfhGHfMjW/TJE2kEfovpVQndjte2kNB8TdR2qLyxjxOdr/Mr3Mta3\n+E7YuCJ9dqOFRQemf6Dgh+kYbhqIEHvkeFpiz9+0e53T5D20YsqBJVumP9bj\n0EDzwLNMD8fwvkHoi3csj8LnRXxa4gVU6XxFXAbzBCJDF1de1BgMLIBTH9rC\n4sNtAHv1y14ovTlVPrN58N2PYZsoJ5HPTMiqsszUQJRcgH4eIUcqLCXJk924\nF55VJSLkAqEPUTf/meQFrP9DIDx/MzlnQIUXcGiAB5kOQv9y20hwYsuXWJ/D\n708kMzCvkvn7jwUtTJEfJZfr6otip7B97dSb7ITBMwzY78Rj/a1B0bYTQE+4\nO12rBM8Wk6F+8btmVruMuv8iC5maOaAD3Y6vW+7wFCUp/lnsA9n/AQfdOOCJ\nypDAuxMDUXFwyDVz6STt0bqbWDP8vwTONBlhGAFLrRt3z9rVPZdW71fhf8pB\nSRDAN9dEPZgtbmP2161+D/wIdQ4vEe83Ga4sRNxMVGQQCahLB9suY9IcLzWA\nuIrz\r\n=Trer\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDei0CGOZ5lXxAZCEuiOtt56OEnF9AvGIx3ickGDYT94gIgQ9eN3Gn9jBE6/5lXZzwI504j4eEPSJnECQFOkQ8g56E="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2310_1621903224055_0.08127023719064308"},"_hasShrinkwrap":false},"2.0.0-nightly.2312":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2312","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8c0721e5a835ff89c6ae88df75bb5957a5ee89f0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2312","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-2mKRL2akaXb6ECihKVsGjxuB/vpSb+tfTAAW7bxUtBZMJNXlERCcvGp2ROVmA+9q83IPKTM2kMZuezzZzAFeyg==","shasum":"97f2117d8b4a06bcba00d8762b0f7af6e588d426","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2312.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrZlHCRA9TVsSAnZWagAAtm4P/Ai837d7uRr8OTxGUVOI\nxuYbHo2KPWkCRcLEWh3m2AxeBAxBY0qUbkrrNKeRKYUouhcqnh/Vmmc+pqSO\nyj/ey7Bory5ukGFN7SMHFmT4TPQkk6RKtHiZqjC1H8Xh/cTblRAfJA1Wpo6K\nv8dfsTNsY/MddUAUGXTTG1rsSbB1Ow86f2dn46O14wpEwn+LpnrZbmf+a/JZ\nYhrfsYo7S01I78mqZ7L3qoDn4EaU2kZNv0NJqlsDeDCFNFAxf0rofcyVaOht\nTeAoUYZPyccX54efHhyi8oV5QziNUwOLb6p8GXiULS9DznvN393XeRJ4mmJ3\ng1p+xAYVQ3Hpvahj6ma2p/7iCs8OQDz26eco6ct4bDq1ky1VisCJmAI3VlRZ\nBuURRfZ8gddQ94HHV63yXjNADVMIg8K8qXwWXQ1pcUqi780xFM6K+wAw1qtQ\nAGwXXZy4W92HW8+VHHJnj2O8E5aAunticd/1rfyxLWAOVrtU/K6nI4Ib+E79\ntseRJtu3WB411RQxuOVIs1I3006v4rd/FxvK7IxDnRI5LNQl+cj1QWC7baoV\neJQ6fZeo4tt2RN3VMapesXfP5L+tHJdOJjZjgb4HExG20uXu+WysakexKn+m\nesCmTqWK3xIZhG0RbVWy+Nw0XgGfBfVrMaWF0D22CJpGUYC5MEtHSg+dLTSo\nXsHy\r\n=QVGg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnbXGqv8hLq+LvKtQgiHIv6z3NC1sPHFNOyFE3ahfZdgIgHy+sZ5q2M71PBZqCJrFFVHcBo+jqvQYCqUsnt+kNsi8="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2312_1621989702594_0.79367727077599"},"_hasShrinkwrap":false},"2.0.0-nightly.2325":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2325","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"7cb8d8dcd92aa3087e8da9c12fc05258a2ed314a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2325","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-4ZYpq+r65bldDiUPx7Ob1mS5TM7WFU7++tWEsyjfd7SPs3T4JL0jh/Dv1ZR3b7sJaSQ3tahFUQE5Dl2UhbuDMA==","shasum":"d3492eae0fb915648e78bf36dff63df204383d87","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2325.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgt/YhCRA9TVsSAnZWagAA/OkP/2BPT79gx9ywxZ1Gud8l\nBdSgcqd7/QZCGxrB/3oXe4+7emH5L+J/HGjBQ2Ek/KRAUTqYJJmNKNJK1J9d\nUj2kGVTTQwuMu8l0PJq3/bb+kuVzVV1YE/+ZShiPlAfFwqWXf8jKHa62eg1m\nY2CIufaqidb7DeVGNwgWqxu1801ETk/LCMEcMFsGGLNBxXf/w0QDBMyTkcy3\ng7atxmWtCK7IAvghGC8+NImzbd13uanPW2WSopzYsk6mneSPJe1VKvEXB4vL\nFadJvWENbF69Ij3nA5Z+MyVdvhwjvEuzrBjMFLN5eshT2MH98VUXdYqvhYz9\npFYdg+ubvsbNFYUDFu6/byDzJQbIw7f/e9YQ2QEKYAfynaDo35L3wRU9MAe+\n4qk3wUPXH3lPV5wX6vgN5J7dDA3ewnGvBH86sY8fbGbbX2+JLyPw1Q2XxKSz\nKXh2nI5ZPmb372SfJh4r7pbw4+AsO/Oy6Ql7YEMTtqJyJZEL+v1yVNT+prRL\nx1Frmtybw+gd2NRy3Kk0WrEhvLmOuilw+4Z4qseOQKZtaG4HeDL3oMN1O+An\nVxuDQMEr6bYDWhODhO3pvOv01nqVRTYI3oJTIPimuVwaUJWWQSs+K5UcX+2P\n5cjc4kM9LGBJr42xED7EhhKQRGWsviwKAuv9i377C+wNfhiCxTQWJ8QGVTRX\nGPU1\r\n=WpKg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICTOuRDL4F24OCExU+Bo353lsEaTYF+x86TXwsBAJXKuAiA4YTAH0JtzLdFbn+A9aWYfLamSVOCDeeKDUfWbEGbRqg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2325_1622668832874_0.7437179047378606"},"_hasShrinkwrap":false},"2.0.0-nightly.2328":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2328","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"760fc61c601641270e7ac7d4320682a074afebf8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2328","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-/foWENX7pde/T5ezhBiH//6LkYQxDcHo5zKpqHoPcRRSs8dcA+asQKhPRB1EdySY0Sa3FuPEJUisolZdh3Jl5Q==","shasum":"e792492e0eaf85cdb71b2a443606dbbb31e92e8c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2328.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguXl5CRA9TVsSAnZWagAAltcQAIn8psm+rplArL0adhFA\neRY+rc+QDgDV97W0AyB/r8vj7yRVTdawhpMu4mqSHWC84Hw82QnnmKKyuGQ+\ns4q6MCvITSn1uK/UpV3EIH6C5KnySHZ4GMaFfn06h7ov5tz+GHc9cX+2vCd8\nEC2VVRpOXvXMKPt5Si0csTYVOhzKoHw3HYzjwt46t5mypTuESqc/oZkMtl00\nV6kixJNO6nfK4X81EmqJAJ6YBVse3L3Kh0/p+CW4hPPhORHk5i5/QmAFHLhT\nVugyTQoRSDIpOUFWK8sLYkUcVQBXnz4m53mHc8POhEhxRMrFBCyMXte6RLOq\nJLHXXdlIN2BJZwoJM4N/H3KyQBZ9pK1UEscEYyonmoTczS6PDJZmGvT7KVrB\nlfLfFIIuKiuhQFEJG4CBuChUsC6kKFHgFXFa/Agmq7OOjpggRaWSBchjJMxA\nHPLyBQGRRokAARPVvVmqHP8hkkQmNt7NT4jy0QDpAQ/cm3KJ4KnYJqq7JxPz\n5SRk5mpyPL43T6zZgimRWgHqOodqsvfJzc53gASdUsPS5IGi9c0bnMrGAokq\n9WMuroAemBzjs3QvNOshrPtnVRP8SBeqxxT6Lvd1fdqIAjgAF9DPwwdb1rS8\nytz0nr5ybc4ui94iXUZBayQeAULOz/uaimihyfkkIQK6eyXXn8joqWRDMpJx\nrRkv\r\n=yjaL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDN6/3VkfIAjTz+yKsA8UUiObWNkPBVoBDkTrk5QHCEKAIhAO7FwZWtasGEmshL4XrZ/TxTE1L9ijK2icwzFGT9Yqx5"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2328_1622767993472_0.9092471997000426"},"_hasShrinkwrap":false},"2.0.0-nightly.2332":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2332","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"10620104693ee2523d626b0d46834b0cc273b895","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2332","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-W6GJJre2KkhmW40Q/iLHpQ1o3bav0/Cw6SX0FNIfnp1x5dZ6kZ5N1qHdXvfXBKcF0zoLOFhcvu3rZDcr8MAUUw==","shasum":"5ca152d958f6f01be9286556726d53105c48ef33","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2332.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvBk3CRA9TVsSAnZWagAAwgwP/0wR9NO85P6FthG6ISoT\nu/9NXQLYQoFAirqsrKn0zfrC0TFNksQ6GI0M++IBg6mMq27Mf4ChvFkZdcIG\nyMdZvM/9B0sFfhkgbqr5zE16hYEYUNIU6h4y3QcEqC6DeQVqgjKof1CuoJxx\n9LgJ//X4322u8Kg16OkIL8u1yFVeBCRW+nNDpFTacSM5VtGKTYlOXCZzuYO5\nCg9vXTRQeBqeFbfymPdfvsyNEPXojnTQh3A8Yf11yQynwD0kjA3gdcsHc3gU\nipSIwVsX9RbzYaV4tdsj7Xyj5rxBpW3mYBUci5YOfaN3mF+T8dwcES6bUNDo\nDV4mgWdhicaQgOuCAD+SpHgjgvrz6rTtRrV6zV6mLLsdjJ4DcSYzD6AyU41L\n+3PquQoLPRslmCX/CuE+vjdTYcvN4LZrYfGwT5Tosu5jHG0I66SjOuepB+E8\nuD5dR9kgYPwLCoGprG3RjCL2kvMMw8NC+ZsjJhHTtUWtOrRm4iqevylOy8cN\nSv0ud3LL0Pk/ZtM8Qkljzqy0c+HHUyaeuxGZlJoZO3bHnvmwnMI3NkqfV7tr\ndjy9ONB1vTIWZSavjKBUu2CsJCWAk7k4AczAwXgtnl2pif1bSd9sLcxQerWP\n0n3h/8uBhe6DBqziMIOvyQxgTUBWiY8LipmzcR9zW5U0dX7dZ0dJCF0zkwwU\nEOsj\r\n=OoIl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCM6Fl2E0xuRxpQBE2i/oeCcmbgIBxwN19QjeMC3lDZ0gIhAJXmOB2WDvcJw1CrMDkcXUxG+e9V5/WTyx+Yd7SAvQOh"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2332_1622939959183_0.27094843744640396"},"_hasShrinkwrap":false},"2.0.0-nightly.2335":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2335","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"003cce7b71359393cc0299c5e90ee07ac68de51b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2335","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-XM2ZEOfaJgT9l41tvPva/58rvads7ATVWobFqH5WQ838cI8WRw9y9sWug9mo9Z4K9lTvpHmrRNZNGXRPX/oYsA==","shasum":"75b4ae50826dcc97ed65af24f7f1ca5fbbc84d5c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2335.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvWq9CRA9TVsSAnZWagAAC4EQAJ/52HlmeMeoc93wtYx4\nwnUtnqdufMHYPrcarMTpAQI5lj/ZjvVv/OaSSW+QMSiBtNoe/T6t+gm9u8Bz\nDedFM7YFksHuQoIDFSYP/uVmbLe8NzcNweCXab8URJVU0RyxX7by239LP9NW\nHyryfjEakt3vVaWzCC+egTQFn9xH2km+w7gQrC9yPPmlx+YTA8zQVZVrtnPg\ne9WORUcN7af/klN2+F/dEB8RI+AZ4Cnix34XYDh+UNpH8Z+beCkVq0FQzMCV\nNO+KJxjBmbp8r8GCzr8UxkX5otjJIVTPpzGnlZVXP3K18ped8v0T9qJylLh5\n+O7zS6rXzJKHyzhLGjXuty0SmDpBl20hhLH8hb8Ev3lL3liWYBZ2CqyJ7NGj\nIoW6MygApcr+quU7zhXFGIdYzaIFFjS7VMBibicdnwRiQghsSm/4mNx0M3Gc\n2KfNt+sIuN3v0xwUdTlccXwe3DKzUFuDL30IAFhYyIBOPHWDwR0UEf39kr6w\npb2eNCGsc54DuVmHT3eHkDMIrN2t3CEsyeGB/IuosD1vA5JKtCTmyoTZlksO\n0AfQbE0KbOQ5m2tCI41/CMP7rqiNzXA54tdx0TGGnz3ZSTt3lIx/F11ScGEI\ntO38Epqo7q9GBLg6i8AE72CY37ztEJo1N6Ye3ZtTF3AkwpAO5ji0dAogxXhU\nKbA3\r\n=pttQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDWD7aGDXMlrf4e9kdfWYdaKY+kqEayDyXy/uzLpXRPAIgDCL26W/jPYG9YirSSISq5PjXWGcEOUGfqLLLFTVMQn8="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2335_1623026365151_0.6540323206870251"},"_hasShrinkwrap":false},"2.0.0-nightly.2338":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2338","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f582ffdc0428290f69fa6bdb492aeb5310a9a317","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2338","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-31J/EWs6AAzzsBBk0rkweeUHuq2hDSvPVQunE87AagJZ6qi1/kUoBwUn95pcL12vCErByqgBQuH0GCmgkgCxTQ==","shasum":"5236cde744a98dc512d5be3b1f909ea0442f5d07","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2338.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwAvACRA9TVsSAnZWagAAgMcP/A+BYU7W50dRYFjFp9HN\nDKmqnJe3xNcLiWxvQZhvIYg7X6uwHonN+EhBt/DggsJyrxIo4HXVV7kM7F2m\nJmTM7HNwQexD1pu/jDtBhHcnNojr3csA6zwTxL2fcHxyRMKmv3BGCvJVGWcW\ndQYp9i4+vfeGfG0UpvxFdrCAL3asZIS6OeifdHndkWHUpfzLrB0vCN4994LO\n2WTw1P4WxcmmTLurScaa6qpsfMD/YoW5+hhXg3OIKXZXXSxBIH5Cmo5PSkZr\nVEddkA2A79/rYq0b56xfo9zkie7x7ihkOYVtXSnA4Idb0eO8Y+6qg92QvBrc\n8V909EylbTxlvZfzlhXV8CCRUYLvrEPoUKhmmvbQx2kznJAtIeKUcJHiCloB\nAALEpKDwLJ4meY4qn+sC/H5r4h4SqEETi5f+s3HQcCe8phZ2zmVT58FIv89q\nriwyLLCDxZJEgTJ/+Mq00uE3r0JwbucSYjiutnUkb/HhLy7UlIKW6n1/TKkf\nI8GCK9NEF7DUqa8rQ/TKjQx79eqe2XC0YhaunMOI7kak1qn52QQTfN4iKSOm\ndLNV5u1tZnjIQgrBbH4u3igc4zkd0hEuS4qopreb7kifHpT/1vD5zt7KdCBD\n5wPQ4XJ7xYlno+1B9PwA8/DqAGco37Yt4BroSx1DT8AKGPMVe/sVKxm7bIjo\nqRro\r\n=cFOB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2cOI23mFioJ9hNrkt24Vohh/RS49KcAcXGXJveP2MUgIgU2M25cJHjqfNsN1/jYZYo6fcfOinoVeytpq4kGq9eUk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2338_1623198656170_0.5020597043597916"},"_hasShrinkwrap":false},"2.0.0-nightly.2340":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2340","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"1ba0bd1833d785c1acf6af36e0a1d429f1ce1fb6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2340","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-VtICVurPi47CC3bX/jejhrkPGNUz45qbEYLjbqXR/wXVgg8ABFk2jeS4eV0nKTx3qnkLjSgGe03i2d9MaudXCQ==","shasum":"b92edd138ea33fd2b4dae50e59675a1960a3f545","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2340.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwq9KCRA9TVsSAnZWagAA0XoP/Rayh8xRqxFTCCNMiBIG\n6R/pP7xPihM1pjXSHzfWGR7HfZx46pV2wi0Ar9lexc5/jZ1DDUe1aE4S5cE7\nmGc5Q55ifINmCslwTT2ni/ZLoIAwWjsXJjVZ+aCQMFw21PbGIdStzYutsVJ4\n6WJH5cecrZ1UHdw9VMQLhDiONVWPRjCpHzOJWcaL5EbTIB2t88korlkXY5hI\n0IpNXwxOAz6ne069j1nzOzjKLHCNnWuitaMVxoXiHH8521C7Mz9ltvEIfYMB\nQJrRIS0lovER1o10gvVoxBLNxpAvDMUI083W6+X05pit/egCljY0yCStqVgZ\nf0IfOH4oVo+DzMy8CjAE5qUwoBdle595ajXpmoHuIt+XCNakMbf+RrBIeoUp\nEu3Fr96wPBPAHpPPPU2UeZjo3gI8dje2RR8/zz88yqOMYMD6on+DXADlG7XF\n1hX1JsARL/2l4C+LawC43lfCw89cSbn6YRKAInp+OhyWV+z9hjdtJwb55OGE\n+jdDvsfDEyVrmITV2Vbdj3hiDwTI2i7CF7lFYJtsSGYdCQF0FXTsDNqt4yKD\nanFL7yaGZV6Q70o29hlk7PVbwWatetFyib4NF93zh/iptNyMYgbrtg1B8t7s\n0/iQPs7nzRsO1QwN4EHF7RSM5Y7ekfAKxOuqcntrY5Ers9VKQI57LRVtjTZf\nE0ta\r\n=fm9h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEiUIxGdxLxF/oazyv6V9KOzMRLLCWeMKAUCdRgeIy87AiEAq7oI054a+1W2vbZ1+xjdKOdt9RpuMBwzlP4besRO6eQ="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2340_1623371594585_0.07526942533041225"},"_hasShrinkwrap":false},"2.0.0-nightly.2342":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2342","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"9c2a96fcbb2075fafeb65dd5b61cd3acbf72f361","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2342","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-6uNxPvdEKVDMwIK6IM7hyt1AoqoxNoWkAcQB05qFQvg+ADp7e+ocWz4VtxfTfA0Y7GRmo9u0+j8L+94zifFilA==","shasum":"efc14fbd2c778d0a675d673410587eac038acf4e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2342.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxAByCRA9TVsSAnZWagAA4psP/jxjJvdoNXNSqOi2rALR\nCbYmmQD30HMwL+XdFFGdT9uUgq3TkTvCbe7Ezykh/drdSXeW4ocYYEG5zzic\nvpQmzBwqka+kqOwBeUwULOWiimxR9w+w4kbxHB5o7MdFZNMrIhr6H49ddsST\ndGHa8VdScJWv/pP7mMZqNwehxL0d9xsSZ3szaY6JRBSguT0++ne/CVLbc2Ae\n3l5Fj38r3buvjDgB7HBGWNMDo9VWmdwP+9RCL+tiu+Z0hxQ+WPA/KILjtsoR\naDyZaerlCNGYulUj6/1xs9fryFaRizOltgySvorqttbtsOOx6f7lSkzHwV7h\n3nqXo5KEmQ5fU5BqfkswQFXzMx6k8shX6HbA3JJXPW1ez6DhWllK+n0jBc3j\nY2EIi4AjxzQgr5WNzLNKmKhvQITxA2N5hMzWqOzGl/U/nvrjNeCFt6Rx6RcS\nX8Lf+effBJl8JN5YyRkxLkD7pYHFgzH2I0ur1vnW1l6JPKliXVnTkytrl3wf\n0yIBtQluQSTznMrNZUiQKetW5xRoiJgiRppWtrAu6yvdzBFG90LRgqkYeM1h\nZ29nA6YZ1X2APx5u/wWCAafaJzG7sTv13rS2KW9+U3+GLZkrYUP12vtiqqoE\ndSpHb9ij7ShdAstJ5EuvA3TfPa3FdQvi05fGc31wkNxV0OK40h9/FTI3VQym\nSKJd\r\n=qFW2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFRiWcwz4Vpt0KgpoQxXjr9M9+0+avZmgwcRFbEv98/TAiBQbFKDQ0I7saWSFd8yNxuMOoZo9cFqILaPYGyW6Kg7vQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2342_1623457906666_0.7419483524690338"},"_hasShrinkwrap":false},"2.0.0-nightly.2343":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2343","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"23ec831fdce646b8eaaeb93fec72e3b8e3c4926a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2343","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-avBNAKnXAEKyrgUyxqOOUUfgk7mPKokm9jAZjZX20X7w7FNNM8uPEbyQZvcucc0OqZGFfJyg8ShKajZecb63hA==","shasum":"1ba284bdd126659fb0f0ba78adac0625370cbe24","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2343.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxVM+CRA9TVsSAnZWagAALAsP/3ZM9qOrPUVr1uyi6Ck2\nbhKeH0YJjJs78dL8Z5Zq8okT195mlsGsPx/BxCkPuqWgtykIauPfVNxkzCm8\nBZ6paDO1w6YSsUfw6jedK3qeBW6iYJS2uJy3XWyv+E4J7nhQKeGaGe6T3TPl\nmcc/Ge74/dIzzEF63CfzvfMH9l1dMSJ4NFKpWsnpb6uDM/urjIwFWqUroZ0B\nyFKLPi560YS9Q6DBsPOtLWsGt/Azne4WVXxQ/2KzybMjCxiJpi/xsL+8EqPM\n/gWRTe9LTi8gfSzWnGa3F2n79vb1Cb8nlQxw6K27r8axd1DneaT/qMmeZXKe\nSBlPdw8nxLC3Da8YfKVTS4ShnkhT2J6SaZ7nyaNCkyWzZ6beeHKQVkRFMa97\nZ0djQkC1A7Ta0MyMyMbXMHPzg1cQNRcoA2QMp7no7unHYyRM9L4tBqwJuA6G\niXZCspo9v9xCKNi2zkFy6Jx+q8KYAIitx0w06HlvCDoWTVZogsWllj2KHUaO\nLDJBgFgQVjgW0fIUhvAhPrOZBom4qVT+qgH7c395l/BjHz1x6vJtPV7t4jRN\nreb3UISxchiQsPD3JxGXrocmThbeyV3vKMuZJAZ8Oyj9QPZtYKabQJ+euI+F\nclSZULVHiqjfgYTW/q0VRs44cKrB1NNVSCQVhN8fpEVcW59g4nIJNmnOqP01\n4uUX\r\n=68vM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCB/FdR0Cv8Ov6U1x81MrKor5MFA1T46SxY2qk7hcobZwIhAMzT+fA9pbQo2bci/2RzFR5vTVvcZX3DFAZnICWy/MSm"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2343_1623544638522_0.05139112364020715"},"_hasShrinkwrap":false},"2.0.0-nightly.2344":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2344","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ff6b7b4e97f95d8aabe3a93c22ec30f96b0fbf15","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2344","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-yxpWW6Gf8WrSSj40SOIGsBU0BcxUxEBjAzqNdQockJhAFDnr6btDfySkOTod3TyAMqpmPRRe3mkFZeTsS/hTWQ==","shasum":"337163d56832e867dfdd3795555ce8fef53d5a3d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2344.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxqReCRA9TVsSAnZWagAAUjAP/j1Q+SkfWp+GQSBhu6tV\nwqrdwzCXSomP+wNbkQ7vS3AhpJ6p34vG59qyANdiyHdid2bQ8FdC8gEh1UMJ\nFeYf0w2gl1jkdnIo/0Npb/Eku3sjXp0fi1RX5b280oc0bC/XicKjvoOl1z8Z\nNl2UmY64fG/aSVR29O3VKpamdVuqPtpx2tDZwgns9mPqxczKSU5Gs3oic/kF\nnqoUoenPHZY6fDPABfKs8ynskPTyGjVpviWre+fiGzPkKzmDgF/UKawACC8V\n987TetTMWKFUeOHibmO1yALIN2ilvHWJdaFadUMud/aIAWGFGzx4D7j4Cv/z\nge4RnWLd+Ck+5ClACSepvSJk/CfQVDV8ebwf1GtvAlh0Vvene37jwkS94Hwj\n9PfQNEqdjmsUbbUs9ZEFuKKlqeHm19PxrrlbgnK1gUuEQdcklrnxOWkdytOI\nYjG38KCZLaeNTFa5ymnkgHdmnI2GqCY982GDpM49mBhRqsCqjrNChpwSspUp\ndMYrVO8pu6a0VBu+97Y7aBK7YuNx2N+KeUwv21OB6mv8zR6dF+UYC7etR/Nc\nk0DLyvaKjVCrF5caKbB4S3Q1nKCDwpGg/cobweEBWOCrfM5UJBIKkYXiDkRH\nV1TwWN8qYFPVP5QcTy81SDFW2YqCWtKTPalWuXoAmhl5rm7wvoS6gbWRQLDI\nKSyG\r\n=BG8l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBtq1lIBBwHg7XSG93OaIs5mrt0Ay1wm6unJ68lBt37GAiEAp9iStREDjbXkUIVmoS3KJqf+M/iUMSYJirSK9sDuotY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2344_1623630942498_0.3622913223783548"},"_hasShrinkwrap":false},"2.0.0-nightly.2346":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2346","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e9c4ebb141698b1e7a06a1bd6f71e39d09cffaf5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2346","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-XXeuF88q1MSi9uduNab+wImrVjsX10FjiDtDdk6S/HrL4LtwHDdTpzjVCGGX5lrvOMg+Sv82vhOKkFoSRpeF6A==","shasum":"1d06a231d8bbe609e076ed58d76dc0bbc0def5c5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2346.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgyUdACRA9TVsSAnZWagAAyKwP/3fNY+7LBFAuo0YHNeqj\nH/CgvGD62OVZuU6Mn3Bo4JWOdmI4yl/9pzGE5hcBWPyGHet0+xtnBwP5Z4uK\ns07oRdr2iHG3DG90X+j374/HELLGle8giu4nnRlyP00t8x0MSHHYbglsC8Ib\nZTMqwfsmP23gRAsQUG+xLra3jL29BChv0J/tFTTx5oNft3QWyHdn1EjEQjO2\nkbNuvOVfHxyM38z6wPqjuhJjbXGUA8xOrpVuK95Vpo1++be6r8lS1gaIHUdX\nmA0ryoTDqGa5hg830IoUW9QlddLaL2mW7wgJEITHOG7Z+pepXHSo+r/y8jy+\nGGsoH/5B1PT0rBgFdMUdkcdux3cVTVZd7fbSQtJvNwaXE4Jtw/YVpj6Q7phT\nqWelwe263v5O38v7fVCXIJkKprzGyzjy+NdEC3YBQ4QYoJvkAZiC5lorTyzl\niveWFI28IcVUqlBYY/Amg2TI1kTZQGS+/2Zgdf8GtqKNiGh6qYucV/GsOrHh\nfRdBgd66B8mqpOcmFiQdh77u1jhGR3V/UCkO8X3aj3m8CpYBxBQnG42l/Z2W\nWazE81NuojSpC1RwcFSRjRPMLBk6JQlA2/RsFtszGF363ggjtdjzNXd6A+nE\nPwkoN0QCPJqtjYTLTZQoGGkBuJH+EzZhd5fnrolhR+SaOJTI2Sb9ZI0vQiJp\nfUu4\r\n=cBX9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCx5q1ACd7e9BbDrfpwN2EsDXbWxEbJv1EevdyUXH00lQIhAM5dmvrewKO5V5pR8b0mPsYmcPYmiY8PlO8Fl64jFP5m"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2346_1623803712055_0.6482464917254975"},"_hasShrinkwrap":false},"2.0.0-nightly.2349":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2349","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"eae381509767dc32c76db7445c9c25b1c0dbeec7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2349","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-0xucItaoN/6NeNt+19WWmBxpitdBL0Hr0laVoR1Sel5ACPP63NmWcUnKbNQZSEUVIV/uFn/KHbdgh3/g2JmGpg==","shasum":"c104a4d7876fc0f02515c56e3f8ea4ea78d91b7e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2349.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgy+meCRA9TVsSAnZWagAA4TwP/1HrnM3EpfybgxpCqll+\ncT6+C5iXpXk+rBPHyeHJPF59KPXIR+mX/3vME4sLLo1jQSVLa9GBWAxUCvXc\nqWAYm4A6UOCGp3ZbZL5x7i4r7xhov0GeVG6wrSmEdlPImk4HL2W3+uBJY5Fn\nNNZ7fK49wf999+oqYInkA9V+IM5/3l6nm7GUjJsGN+Ns/sZbSKjckmI9IkOu\nES35MwlDgst00d0A/ZB/YGLBhpWA+uV1Zo6FxyJIUf5lgG6UXVDuvB4qsabn\nIrSU3z3t4sldnQZ3pjXjxbNyOH88oSUFNmVGUJ0LgcV6hrkeLsQMxgTPxeE/\nsnyIIpJD0MAf3342z/grHiFDh2bux/rSZ6GjktnLNF8NN9jKzjx2XoD7KIhD\nPq/QQ3XmpXMZ9OvQ/j58zcFJZhZYkdjAPEv2hqWkGxgQQXenC8/w8qwVbMp9\naUReC/dtX4R230bflNP57rP7UB6oPT6FaJIs8ZUoEMCo/MyEw5k6WA4Pbw7y\nbz+QiFd1HTWPBlr9R1ATZVUyXZo4xdpNiSzYsOCKgFc72jypcMuUIY0zFq8y\n5kczoAHpeMqYS8jTxzTSjmGEqKXO631cOiR2vRfBIWJ2IqwC+G6byUdpOek4\n8a+cl8F0F4pu+FxZaotQsmptGXq4Z+JszYuxgGMw1NuLfx75azGwd49i+nU/\nErwb\r\n=SgFE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKBUE+ImMpMNR9kFBIT+igzExlxwYMNnHETB5aE8BctQIhAMoHhsJPQgxKrSk4MGVYqlhCu422ha4O9pPOX1XAlLvt"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2349_1623976349946_0.9343369636911185"},"_hasShrinkwrap":false},"2.0.0-nightly.2350":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2350","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dfb179bd070341249391e8f224e72863f1ad27af","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2350","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-gkfMkOLsN3G8blV7BYwNz/GcLTgAgTAumKJRcG+kCek78L6vH7/zWPUYQn805n3wzB8wOrfNCDwZoat/bwQI+w==","shasum":"d1c8533d378cdc5ccacccb2f830b78894166c01b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2350.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzo0SCRA9TVsSAnZWagAAbNMP/3qWcV+cYzEKd0nWEtLT\nRbaXR1IWhMqQKqibdLjoMjlMv0wvtrLnI3Dql2di6Ski9BypzM0CEuEZBq/s\nGGIO2aKZK69VavB/fVpf+HagB8VDLh3pUlNtqU7K9qoJ/RlZ9C9NYXEXFuPi\nj1kWyiybaFiOJ60Hcuh+hrG3bovfojeii42fvdSDyzsmJboWRImZhjodGuZY\nOHlcVclkm5Y81iD+Y8wr4iKgJqGgSkBR2s7tP1MWo5a7UBDXdQc7R8xG+N9x\nD29xntH0cIH5uICogs6uOZY9R4wIo26Y1Pu/6xQp2R5Ud+/33hUtKERxCgra\ns58EWPldGmR59tHOfl9+ry7vClOFuOHaWkBhdHbQl+Z+4C6KcYK9bzB3OJVS\nQ8hcHcXGoM4pi/H/gmoxHMCTgwTzKw2jd69sCAnPpBmK5a1ZB1Qg6UZdZv1i\nkG0Vbl6acL60sKlTOYI8Csfc6tz0T5/JrczCd61i+bo7ju1pP1W/iS5oSrNf\n+H8dPIPw3o9LCMOxtBK/M9t28Zt2ls4pLGASoadPbZwEPKRhvxZpS70EXyW8\nkfKsky5pGLDGoTvFnIdFV3QsRouAKTMXNgiceERVe6rfHjGS7HXzm/3bKTyr\noQPtIsM1jWybQ+EJ14EiLAFe1XADZb/K4fRJGfbbJMR8nlCWPTfoA2OcVjMg\nOE8v\r\n=aRUk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICVQ+ZOO0vURToz3wzLUZlO2K4PLHZwS/z6VRXf1SyVIAiEA1B5gB248+X2W68drTCnTDZE7YKpsEkk4t56KXTTFr1A="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2350_1624149265930_0.15111606985255"},"_hasShrinkwrap":false},"2.0.0-nightly.2353":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2353","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e63235f33fadbc3009f94281b9c7420d0c4b383f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2353","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-oiRRgKWcur3QW9gRmG6F1hI3T1OJGZhIK0rUgxryWmWmNgxa6ezO0vq9iHmduETumBfObNrix78Q3K98fhJlBg==","shasum":"baf679b00bd2c40eb7a85234046b92b8fd8126b9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2353.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgz96MCRA9TVsSAnZWagAAnFQP/igj0h5I1AyjOG3Ao5F9\nsCfyb9AnNn5A5udM5wOuNimAbNv08Fmr4RxuDAHhlibiBkaOUEjZZniX9rNv\nO/Q0l9rN3oz9OZquSJRpEwKpfs7nGRx5jSRno1SKb4T5N74unKNZzJ5dF82m\n98Na7QZsUDRyq5bUwCRMsbHHFqMqRb5/VMWTopiT0B32oSKmUUFsGzbTgx4j\nG7q0XP4C4uYaMdvOLZuqo+AHoBAk2dQL8c4OPUKDGN+AAbq5rXpDUVSPW79v\nvsSztUmkLn7GXaAblP5GLnhQoRXdI1wOm2s3oyRXZtJsLa331kXypjByhOM5\n8yfXjGzWShsBHK0ufPdNADV2KhAjoEgfCjEpY/N6oQZ7810yKnffGEHTmlyX\n5Xjc2VdJvMFZCZPnmJWtzru4YN8gZZT+n6zq7nlNrJl49d0Ch1Z7xdWLoMto\nIU995r787NLOSOShIiJu0wEitcg1OKQ0rdNNOVabLoCkGSDqtfwgnswKYGUH\n/B0bl9sRl0BfhDlQWSdFA8zcSQFAN89Jy50tFU9aJOZwsQzyC+TKckRw6g4y\nbG1flyDcBfh8APTFUmM88uHApoBEbJQOJ5zTje6Z/BrFdZE2fwNpjrmyv/4v\n5y6Uo9Eq9Vw1Bzv8nMS2iGqjRu8HIEBtPoLva7/k7Q3dVNptZGNWY7L/Rts6\n6LQW\r\n=BnzZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDYynCcCogM0vhApZa1hILD7o+upz0M71i9e3Rpdm5isAIgZ8ZBx7zM5omSy0Df9GxnQReD1jnS/INotzwEd0Fxn9c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2353_1624235660044_0.15618351145452913"},"_hasShrinkwrap":false},"2.0.0-nightly.2355":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2355","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e66dc12f0257faa4395f903b67d03b627dc62016","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2355","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-Q7KuIRTZUBKeJ9dbxebzy4HJzzTa9XvPBxR+jtaMHANtgKzwar9YOEnh7WAm3QuhVGMOKRhpwYplPZ60Swjl1A==","shasum":"3e718c6da180c878ff426e5c1ad1591b94623d90","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2355.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg0oHiCRA9TVsSAnZWagAAccMP/Rtz/SdFuYqjpqsAkGVa\nPCumvNFMXFK4hNG+U163J702sFBR+Zf9+yjRvL3kJNXIds8qWwReV0Ke4IUY\nLg5ib+jdyV5AK8cG69nKj7QeZ3/s6HJIftn/VTu547ISNKirNe8mZBHi25nj\nK9ACX2DHkMMuqyACGHPZejeXTVN2tqOsWaSN6aLcD/lo9xHBo0mnINUsZZFb\nSMNFP5cJN8roUwTBDs4ey16eq35T/q8fqlZSt7SiXyTLm830qZ78snbGvqba\n3nVHCzZF/xSap+kxWlNBP6JOOG6nGceyr1RYhB5dtmbowlwY218Dn7mUfTIV\nq9obKbqbAe25Sbwp5PrJWt83SLUqsxCNCTWuzLbYMQzDDrpH2zAGpA89+i9H\nKBxh7W9bRylhgiGoc9WoaBK1YAPpYyZnWMZeNfNHa9YlrQWpHVvS8DBsBqr/\nZ4ryTU9D1IrA7sizQrNkQrX2mE2wVRdm44PI4Bc/IfiI3j0HQRk+wW8fqazw\naGCwWlwolXykUnEtXpT4y4Y7UH48F69Rx3CiD6Fz8WVayTZcj4omY7sOpraU\nArFjM9WYzpG4hxNDwRIH53ndhQaQk2bCb1WGAAQ4gfsz603RLg2hpbYs5DGe\n8B7hA/M91B5x8RstkMuzm6D+x5oEku6NBcenrtOWMa/Ji5NDi1rw5sLETJjy\nX5Pj\r\n=xUeJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH0btDnravsSfTLCKeogPPGz7qUnXmauJXbc7yI3gFp/AiArd/M1dLDibtVWYYZUiRLzjxB3mf97J8qAFsdlryGD/w=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2355_1624408546135_0.40315348761262104"},"_hasShrinkwrap":false},"2.0.0-nightly.2356":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2356","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"41a9a11ad4ab5ded8168684df9c9f84065bdaf50","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2356","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-HfK48E7cAwYhFiGDpjQ8X3Z6E8OJUNYJ8Ol/V0/U3XGKTEQCZHQjSC0GJJhLBVSCTOg3S9H3b2yX4kTzwEw5dQ==","shasum":"e9838c4d90b14ef83a63e56b0678fbf938517fec","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2356.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg09IQCRA9TVsSAnZWagAAjiEP/0hqP7SG7e92AOWNwIIf\nR8xl5P+Ge+MvC59iS2zIXSkntYxk0PuxO5BENty7O3uctpdic4ObKWIXCRWW\n+BjB4WSpCJCeoPe+gFKxirwSxbRFJf8nBYjp54RZZL2Cm0r4aFZ6pQGqiRF5\npc9CwkDHZCVBcT+mjDIqdOvR99J+zdd0t/oeI9IDMV6+2rn8g5a1zi6f4CW6\n564M5cRODW+s/ryZVyc3CsP17JvwdmdK1nEoWFwVKULNIxrI57+h33+JU/LX\nxDijaf3K6+C9hV3XnWdaQE/BsPabU45Tzf5t+eDIgoBT6SiGNTRt76Mo/vVk\nRqLtUfEGvbNX70HH1HsPEgRG5omauqCHkTPm/Zlt0UfyGLDGtGcnnh/nnIN3\n1Xm5BnFBUATVf/0Ga9LTGFGRJVceCuh4uBlo1fxcVUjmh8eR+xm/ttt/gyd9\nMZfKRIxe74X3yQZXEy0wahbksLlY40eej1MTEYxnuvUiZf9Q7HUPeh1DYCUX\n7fPE1bMTJ0D3ObhupdJSfYNnDpLeqcYeERAO9omT1rBmSmQkAXcWf72cfnog\nEK5qff4A+413JZDenXNvkh57BAFPkYkrfKiuzok+owwVCqY1SpDfg2LehB4Z\ntsx1Cjy0DmKLVq817OiYVcR8nA+JVRjGyRxuZxE802FhX5ki3tPvFsKatpa3\nqche\r\n=TgGC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCCHKUNdNTzx/x/QmalmrzJ27XRfuih36P2Z415z3QEwIgcSXZDUXBs6KJYEksng9luyGMQ5ljQ7ITvG8dmUUP6m0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2356_1624494607564_0.6996192147283213"},"_hasShrinkwrap":false},"2.0.0-nightly.2357":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2357","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dee58e9721c535a2431d734388cd6b9e319e5c7c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2357","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-Y7AVn8aXlALqRNvvCe/+peORcd+qfST7JS/DrU0w5vqkuWK//w+mE6CZj9LuZ8+3KIEVEBGlzP6uRLXG2JBjqQ==","shasum":"1f574f3ebeda62f72ba630d341f0513c8b336334","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2357.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1SRpCRA9TVsSAnZWagAA8G4P/REVjJzlv24neLHPaTLl\nuVJIwBR2A2nCXxPt12vTg1hHL80IlbFaixqq9wdB1crjoCVM1vbKcxZ47s0t\nBaMIILE17ZE3N9A93YO+HSHXINgE7lJdMeGiNu/kj9m+vFjtNBEgBZ8DMjmZ\nDDWuhSEvEe5lblrZFFEQqi3I86/4K3Ff9JLQ78oeW9cSpELbkrIfqbXVG5JX\n5XPzTW9UEAuD1SDxsXoUOHZeqB1E0W/xMbCupcioxMcJ2OgC7NNbT9Kf1P/r\n5BWNDXH7+3yW3ZJOW7emYZiSNck+OFZzVBWLKQ+URfwfO7oaTZewfsWJheds\nAl+E5o/vlqSCq6VSn9iAF4ug7/p0jVJPHPVU/osWbhvIpFBpLpbozS5LZeNI\n81TccTHpeXvv60fYjOHugNsMA3bmYUULpIzXP9iRWfxBY2TCgbWxhbPEYEDe\nxh3eRrB3o1qM+DL56DBC/bNypREDiRY1BYKAntDQTWm/hrlh0pt81dCZjgac\nvjxBEeYdD9hBomOnmo9W/tel0HpMkVtI3MIoQEEONK4OXHLoEPO9u5bYJddK\ni2wwp4txZ+N6HyCiZ0Ap7HRq9RDLVkj6vxoNe51IVH8CZ9dwgJS9Gscz/5Kh\nWx268WjzZL6sHqgvuLYWNguaRvyn/6YV5r6vw47EiPvVX6OY+IzwFhiuSwXg\nbAgC\r\n=rFep\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNCdwZAoUJydWBcv5d1oR6WgwQ07xDt+w7mlw5porO6QIhALIaGt37y53kVjGzWdJXaDk03Pqu6ag0Wsk18crA4qBB"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2357_1624581224622_0.6143900641096176"},"_hasShrinkwrap":false},"2.0.0-nightly.2358":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2358","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"88f2c7c2242e8530d62502e28ea0c08296227e58","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2358","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-oL1Bd1sdLZ0HiRb5nETAbXJL37f0psQccx1xp13LETCsUO+TxIojsSJimbmyBu4jjju/1bNXnBE87jbkb/1KPw==","shasum":"74940f915232e307f8d5be54c20b2b59b115da58","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2358.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1nWyCRA9TVsSAnZWagAAcoYP/1qfe2lESFQnyZC+W+CG\nSa/4rARkkpPzzef7M9XeO/9ABGHbo06aDVUN6M0GCoAl07E+vz5i1BAt/Nh5\n9bVBD+HJWYqMRuxv8e/wsyO1pOEPQYjiE7jCgb/GZX6ZT69T+/wk/zFePap6\nsjKLIN0CcKm+PI02e0Xe+n4MlD4OwvxgK6EoiRfdJEdNndtYJlLJVMlJblBK\nO9AMFOMwqwtCssLauO9ZSRCKz1zLx26LFsQXArnJ8L5mcjgsm9LuXDz129eN\n+ZPdroeyDl6w9ZGXEZxFgsrXEB+p2BT9QxVMa4S1S3FoHp99KWP/8+AUvVVI\nmufk0OJqaSgTYqo6OGWV5003yMJ5l4ynt/le2emFbhmX1gqw0apzvWF+wY+g\nC+R20frz3WzDGSHpRKIwx4/hMWf7SS2w+HJ+j4x58t1tS7iyRUUZdvRURlwD\nkjKZxqdJh5psPKiG1hXWzsWxB6kH/vJhbE/jXGOjMj9VOM7h1jFixsdFB2s4\nSYN+yDozmgaHX6No/c954kRknf1OOW3mh2D6jfxmIGj+WadVkYSMOyIn08Xe\nAZUGTQcBgG3aFKi72yqsXwhmvilxmotD/p+D8cDyanB2hpK6RpsasG4oUvL+\nzs7wUOOPSyYaXbPJ28tNu077uDEBr69mb2HN6jasY1UKVvabOMx6ji9xDNBL\naMDM\r\n=m1hz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID6hmNu/S2SOU5Zo3oQ9dw8zfDMg2BfqRrW76BPbBVGwAiEAv8g9ckmpKHE7WSaE9wqo1u21s+kNrXFaj58jracI5Hg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2358_1624667570248_0.5195136847413315"},"_hasShrinkwrap":false},"2.0.0-nightly.2370":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2370","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d1e0a1a0781d65fdfb84354e52ed85313717bc4b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2370","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.20.2/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-83DE1gMVqdiEfY4al/whM1eXPpSXenKevx7LasnoymvjbFPasxJ0/UH5tQQqU9Vj7ICZMnJLbw8SIlSs0flRBQ==","shasum":"11236ed64a3f79ca27c9f8cc0b3a8924eb6dfa9c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2370.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg2o7aCRA9TVsSAnZWagAAiFwP/i3i12s1plh9kvCjLLsO\nbAim3nkbKGwpQVk5tGRg4T4IfYjtI+99ARFMzaYVNGcNppazM9mKGHat+rx8\nVuOZVn3QKej01MQx07M3PzAdlW4Pl5Twz+ol0yt5GkuPdmaf/97AWrCRHOlR\nsdLhS11Q3h5jep/scMXmBUNdEj3YXJ92wuLuih7RTw+T92wRtT1eIwfh45uV\nOrTIXWkFmm5ZwUGqg+yoIM7bQaG4LzH+fES1/bHe1/dSajJ187M9rUdESYY9\neZ6YGIm7MFLe5e5EOCMjxHYrUknZQ6vfsCYId+TtkgFbqUQwC1AZ4LX6Acb6\nz6mTUOhJsmG10xtp8Us5CNJ4IzPLZBj+tMgL8FfZodPf6h+jkhSN7QGVKTzW\nhb+AJ+yOf1YouCJS6NLw1t4AnZ9o9CL/Fe+UhbT/sJAn510lldGgzs6qGZgW\ni7czta/52Xc04bnc2iNm6fEO+0EOegCogDSV199cvGJnV8FkDacJTvdsU5Kn\ndESWP9lGNibAMpf9FFI+ay/gRXHt9xmxXVoz2TTyV7o3Ql3uT29aqvMC23ji\nd727NbhJwztCa29e1eUWMhQ1FsLF98+W3NRJiV+4xN9r9vt0puYeDrw87Izb\nzOHF3/ui7dhbJDQNVaj0kNCeXG3w119ET7lLTcv928lLZ1iHm/bd4LtLW80x\n/LBb\r\n=iY8W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEbVqS4lFrml6STRm4lYks1P85RPFki4kpaAYjlx9r5gIhAJ5lJAOh+BpfPvwfQzCSH2s9fVmM6q/g0HKDj4pGsRwy"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2370_1624936154451_0.34810522156452195"},"_hasShrinkwrap":false},"2.0.0-nightly.2373":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2373","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c999ae1df89793cd262428d4527258661b41de1c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2373","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-GDXJ4kVXNxBBeor2LvOS2n1AKYnOSaN2WRbGTaieBDG/meGLx1fV8+5Y32obf0imtpIwsq/BAnVUU7IxVS3W+w==","shasum":"30fc02d590e88714bfaed3119cc91a1da7eb43ab","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2373.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3l9RCRA9TVsSAnZWagAAurwQAJIh54sNxDjP64EdoGfF\nQuuR8YgXAxY/Gpm4PdekyeX2B1cuEZF6+8Mdq8wJmI6es4HVzh/sJVyxNqNF\nBxhq2koQtGjn/eQQkC0xJf1Wd7VfNgrByDSBH0tJBgEGdmkR0nCYzUAsXri1\nLdqwOoI5styk8M8I+3dogoEcF5/rUX2HaKyrrGDyECmz8h4m7LLP2Z6qEe41\n+UuLXkuYoVGN+Q/JdSrcVPumKU6nB7n8spt7BqyFJHqX4VX/vXSEvLgxkiVr\nWqJ80B8y04/hvI+JueQIsx0qunzqkJvvq5oSP8kpdycKocg05yzl0Gj709eL\n2hKOILca1IvhsuDyqQm/qs4UE6HjRZseObqVYM5uCThmG0RjBLp4ab9C3TCt\nti+Nrn1Brw3bCJz2z0DvQXjtJpA/ZVfefBkwcQP4ixq4BE+crqZrQMNKU7gN\nt7VX68+M0fh8La5s7LZwJF3h8mxfAzNSzJyM0a7xzjsN1balZma3CVFXCx7U\n3OwH1agsDoyksCaEB+wEjUc/sQSj2WGHNmxk9jqa/2++VVp4XAETtlot0BHu\n6EjJiOQJ0/7l5iH9BG4LpS+4U6+2JfIwTfNDhLnkxucHCUgV+t7CxsgPMlgl\nzWUzXnNsOqiUiuDu3wV4vNiE5CJcU37qllnV7vuozl8p9f1F/ajfvDvfP9ep\nOrPx\r\n=4f8X\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNtq/GBSirq4uyxI7+E9GqGjR98N4M1Lag/RnYVLg5wwIgddZ+vSPuTE5jq/ySnCaxYHRUpNa43LM0aBXhjqSHius="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2373_1625186129431_0.5237789380878315"},"_hasShrinkwrap":false},"2.0.0-nightly.2374":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2374","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8d50ec65914803bdc1ba8e719d27fcd833422839","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2374","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-NYaByjLJmADfpQxappzJIVgL0g+B3Mjg7RDXV2WkEFCoaIIQReBMCJYZjVRtEHVJhisq0cmidm79+njFc0mkvQ==","shasum":"492414f78ea701e05dc753eb2a474d7b1a21252d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2374.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg36/tCRA9TVsSAnZWagAAS18P/3Zji2PvO1X+lFq91XLE\nU60DP2VTv008r6NWITvefOVWW9hcKqE1nGtDRHm1sAzNK0F/PQgGdLq4wNMS\nqTnnvogq853WIg4v5N/T+ICYC9SuX5sAu9L47Va3UmokkrWkqUQFc22xsLls\ng7VyqKNaj9HGDOEQbV8u9b+s3+dlD/nkZkajI8/xIpi4/CpCM+Fx6YGqtlKc\n/TuBz0XtfRppBzRnrqWuDo2FGTpk6KBGBdq4Uql4xl/o79/DOMXSlluHlhdJ\n0Z8uXfRN0b7KDAPE8VGvcpegTGawSJQNcaD0mGvuDw0iR7Y6RgWFn6ebuFer\n2bPUqiX+/meMxLal2NJMYpzYBcUTIE79BlGfGon62Ap3TUBpHN6t+SbPYmyz\ngzCL+tUiS7Mb4Dxu9uH0lVrXlND1K9e3qRkaJ6woKbit+t8KnXu4s+9dyT3U\nh/TEaEv6CzbVYblvAhnyjY4Vke1QXk3GwSsvzOtTGcJRAc7X9/b17Xxh1wvn\np7XmbfRqTyXCrm0QIxXJIvp9c/ONNuvrDFc6IiyDFGHGuTnEqS2niQbyV2Wp\nDAQRmbK60emv4aayVrBZU+qXDpa3eHy4O8TkhvDibwSxzFN/0utXgEHTLbEd\nju8jggb/SGbmpHVXfCft6BqNLatw2EtApz5MTg/vjG1QTpucn+wzGF01VlGo\nadzJ\r\n=qRwp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID2eFEeD3FY/iWODpVG5LmRusvxfUcuo0FnnaXE24OU7AiAb7zpFSVRIZfahg3lC90sdomBMzvxy7vSsbxO2kF/Nrg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2374_1625272300957_0.49327954743842906"},"_hasShrinkwrap":false},"2.0.0-nightly.2376":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2376","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"aaf0e237343eb1da40864f9cf843c0b86e35329f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2376","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-bySXE6C6CCQm3YSuGihApX5wdczDltQLeHtU5SlHHE4jd/PwhzZLjtbOL/7Uokdr/UQZl3EHIPf5Gylk8Bzw8w==","shasum":"f25e98fc16a6a05755c9764fb462e16ee4690f03","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2376.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg46U0CRA9TVsSAnZWagAAAXUP/2hqt1pn5pwHEFRu2h4F\nZLpOY4ob33iNtNyUa2JcfIWHne0pewdpfqTNhTFflCRafAb18P17GEHp1u8d\nu/dLq589HIX/6LyVvlBj1b8JJcBZx9Sp5rSZq2lyquBbwWNZ2pQqgJZCMPN1\nPeC7tP1j05hegpnJ9+x7Kb15jm2h0XB0Rh7yg+hvMe+p76u1qP/+fsqxAPPC\n0Ohqm4AAQsbF1kRrpDLqRpyOAf6Fh+sfLOlOqxWJiXtQBW29nbg6DqPo8lGn\nddgGmLyI561EP29QZEk4svUlSl9RvUOVkSj98t0cpuRZWH+HPG6xxP70W7ua\nRlEl2Sfm4B+nOblEOSPC86tXBVZ2DKyZpcQDqcSTa+JLgu3oG981rqjFuDpJ\nM2YQfainWeiVZXryDn9IY0ELPdO7D1o2aX611+DCvTQOHUnKwKcvcK2eVlZc\noaoIlIh+9mBFhp9al2uWMLLzY809lMyIlqC3dRoFmHNYXsKJU7l8Xz7hV9yb\nCHS+q3UlRCKzZicoqYJKUMAMW5ipuHzoFDR5qgdosKO8O4GK5esATdXin4kR\nY9T4uyNuF5UBUMKdpW1SjHaZE9aKXcNJQDQaj3FTGZ8qsPh5qiQwtBvxk+hj\n3sdtCpCk57KM1NeDXC/y1QAFqaPwKtX2M+aBNRNrJIV8deaWfFDzgsGemZQ8\nkkib\r\n=AmYS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHgjx+LMRwEJoxIah0mXFzOlDaemwv+rzsn8WY330AleAiEAhXQRETmEoaSyYaJvMRNVbiIPoollwc5HPQ3sYrfbhgI="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2376_1625531699702_0.7753723914972344"},"_hasShrinkwrap":false},"2.0.0-nightly.2377":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2377","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"79923ce52238f293c1dfec60f152996c73461c4c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2377","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-l89ILAv6PPseT58rjUUsHNR30VmxP0SYuUvX4mcLWmGHzJS1TlLhFnQllXq5+3uve/IsrzV/wbhgks1IpmsTyQ==","shasum":"fe59bfac6d25912f35d9972939e09e24166340c1","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2377.tgz","fileCount":17,"unpackedSize":77170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg5PbGCRA9TVsSAnZWagAAqlsP/3gzIT+WxlGcH9Ebwi4B\nIIicB4l+E6mOy0CIDI63QDfOOTE5K1uzBixfLT0aLcQ+1kcWmC20J713rUN+\nF64168GhfFFspeSHK9XZ3qsmInMV9oCXh/MVJxx7MJAbNEPw+ossZxY36OrC\nJT6qbXRdm/1f+R1Jq6CVgoYp4vDKHCqGIl4H0EqZqHZDH4XgK+sLGJs2GUen\nqGZMZMTukWG7HSuIwXf7h1E8UFFXO1ZzSFN0XyWWXLQiOE8zoF9wIdRhXK3S\nwuMCg2fDbq5T8PZeS3gDxQ60kxs5/O/TXWn4kKgPi+gX21L7LG8SIyznvTx6\nr+xwqIBaFW+hZWB4MYYOCIay9fDN+yUHXkR4oXVBGTkYDVv9ayevYD7GDYwg\nEzE1BoRUCTHLdJI+Qy8op7uWmt43GmnlyiMKMiwtAsTuuW1XVagGEpHpN8/+\nf+fNBeYi/Vj1Ifxz93rtLNPm7vq3Bbl/vnkUSDSuZSiMH4ZGhmxYOuZvV2B4\n57gWa44IQJyAgsQ1zCkLrh6I+JgQ576JcLZEafN4w2rALglVRS5HqUgfV2wz\noyZ/pUWw8R6o8vj1MyWvToR4hK9a1HB7QaZZ9sDJ89a4Yht3l2lg2qLnBjNA\n6GMyWUF5byW+1r4sbUa35lFH2bFylo5ZBuDJzzjepL9swKNAbxJdBGxDDI2P\nIl7m\r\n=3Uht\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcPclqiOAHVJRqFlPmbzT6nHkAqTYV/PZf/JdHKaLr0AiEAkcVqlp5u0fNe5ZFhJ+M6uOsviLGSVzh82eImZhro5DQ="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2377_1625618117524_0.3044479715203803"},"_hasShrinkwrap":false},"2.0.0-nightly.2380":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2380","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ba548ef0165e105565d31a87647edda999fbfb75","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2380","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-nkGl3muPt0tM8Sl55X33wfvYzsx5RaWMuR2tAUINgqMyicwPdShgqB3ckrkRy1BKKWB4iA4BXdidjt2LXClowQ==","shasum":"259ec19da077461712e5af17733f3382b8ac58ba","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2380.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg5kefCRA9TVsSAnZWagAAMnQQAIhNkC/VCCVybIhDyQT/\np1Z6M+TJC9r31Gm8czS00Uliy+Wbm40ZELG+EoYEoesIA1aXO4RM7wv1ZB1V\nQANVW1TPZ4W7N2C53am2qlWamsLs26EH7kH1Q/Q0Q2a1u/TsMupqJisfYXnm\nCBbfACfRUVOtdz3Uqqjfu2Nb29rGSsOlaGPxIPNGhOFe50FzpbD2YncPy5Cx\nDECeaSK4t492ctQ8ViUh/1mk0CJCZaXv1rS0vpifaDJ7lUUF2vU555n+b9FH\nGPoCJLE3nUFWIpE6o8S9+O5nPS1o4WVrLWe2i7khUGWtvAQB3JeCjivEt8nc\nbgh5NVaZ+StrjumnaYq7F2ER2ZH/GLBZEVHLxlyPNbVuSmVNEAQOlmshZKve\nzE8rIG+8O+sjQZCC1xJ6YwpKwjbVKJ+tgXeNjmjBkUG8sFKQvJ6gfF6kZOTU\nnF5hpJpXFcV4yUAmphj+/X5dFLDgQsPVbPDzFmPDEWAxZ21JVGoyf5DFjjbU\nmbuCPRp3E42TlaLUoz6phgxs7O4qB3nY9VBEuB8JcOoQ6iG7VMrfwkXC2Pot\n4VqcwqPfj3Vsev9n1I6LvU41ZGl/vAX3OE7FvUDbdsDaiCbRoqFAlaF9RZgu\nI+B02saLSBPMd1cp5XRSFLiQ/Dpy7Wqu8DdHUjaNPRbFLBLHzsoZ+6n84jDu\nlEdH\r\n=kTtg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHmHYSDR59axUXZjcKd4h/A4H24zA28X8thGxnkDsjHEAiACmhiZ5zjo96K6napledJnz8/RT7llIzHTvmEt3Kzn+w=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2380_1625704351264_0.2660897193231364"},"_hasShrinkwrap":false},"2.0.0-nightly.2384":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2384","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"db75d9cf9f05521cf168c68d0e8d9f1950462a8f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2384","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-JrMZMCL0uFnZKnfdir3OIS1v2UIN+0ky61OWkLhY1UDIwPLMe2wDG0D4GBWBR6qxsOUb6xk2GS/3EeExzZ8Gcg==","shasum":"6af2c37750fb36a10e79215acb01a6b689b58dda","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2384.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg55nCCRA9TVsSAnZWagAA0ycP/i/6MFLwddl/5tAuaE3o\n86KVXqIxoWRmXWdPPxYHJLj+kQIBTic22G6M/FR9cSc8MTzKu27US8UTC2JZ\n0gugIIFaQFFO4rHIWUBT+yCuHHBFqdtJbaxhfKKEfi7yiz0tRT6ISYtUn115\n6nnTq4BPbeuKhMYSvdzd3hHjLMA44wie2CpulW+RpWjakZfffK8auNRDGN8V\npRTUSympw+JJ+pEa5LtQwS1AXYglaQ5/JAgdhaqXDsnHPVqSmeL/p0EEHC2c\nqBdZSkAn8cJ2TNNrgcZQIKQI19MNsUb+lXR6pfTBTKEcBQK/GxMu/bGSaEMo\n7PW9nfsnSNZgYuvYSLnbN+KH8XBKXmtt80ztXKQBwCVAiSgPVClsvlX5xYaV\n0jzRFtIHDviTJ8zSVVqcOOF6Kh6ere0wX/wvg3Ny2gfpMzj5Ubx6kB377K2c\nJyeIneORQxrKoXZgLljsRY6yD6ftV7wY4oMdwJo/5Jnww09uZ/eLfCrkrnpX\nfUH1ogXUwkTTr83UkQHJyWuTMIDXq/oJV5fjsFK7AvJCPGyLqYB3T7eGPWgx\nrggPpsou245Kg+Q1GHETIXGyJ/iR8ipDNVXgQYRLpWtXfmKz9kSr/emv0KZG\ndDXNtm1AlKi962XBPfpbFWn19Ei4U50RFu3p1wPZPNX0m6vREhJsBQcirxd1\ns3Ee\r\n=BLyI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDmO85oel51R+UQte2u1ZpR595pDXgBWalI8Ta5NT4AwIhAICwQDbm+KLEmqlWU8Y83w5ufzOmVKxMOtcNrHFEeS/X"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2384_1625790913908_0.1723450142622378"},"_hasShrinkwrap":false},"2.0.0-nightly.2387":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2387","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e8c0c95729d87dd03b5763202a87cc0b5f3edadf","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2387","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-bRFHSIrDvxanrOPgPXqqpubKrdC7y27bDfi8Z2MRVxVXrsdLmhSdidBmUZ28a/sRo5ALIkPO8KFHLk7M2zBM4w==","shasum":"2e47ec22fcd303350c7d91fb002033f2c7067acb","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2387.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6OrRCRA9TVsSAnZWagAAxPQQAKKyB6co0Ntx5AN1gxsd\nysHlb3J7v4W//AaG96NNGOpv4VZFZlT2jp684XxdeWtcsDQIecYbICID7R9W\n1mTYsMHKirX0xIhRpCkir2l4s8Nfex2n3OIvLniNU0dUce82ws3bw8pXN/qy\ntjnOsbaQwGLf8IoaFLuZa5+Pz2jv1ayZcGApHIHRevknqDcGQ6cZjphZitlR\nC+X3zIxB/tVSHJeGBHHwuCU7aqkEzBlWzNLj8nefnv5RhrY+b4BQ9eNuh1Vv\n6GcUORg74HqB36OQjNTF1KBSyc73wVxVvXRMxf5F+E5wkLl8UUZ1x/cAQN7Z\n7Q52laxtHqH+nynYksUwLFFg3PTzXUre1zRDYGHtX4jCvzmFRcGyC72lbwp3\nZdVV/KOS7394sDTUOkemIgLhI7WlS4uP1e3WT5hBf0tq26SLJB0WRx08GSXg\ni1NU45qhEo+LAqy3En5jSJtF+INVNEt1AJCF5guUBbnjDzfySGbGUIOJ5rgD\nnJRwSKnpNbtHfMXja4sq28qF/3vVE1MndoxAbBJyR2GlhoRKT8vrgLzJ2vB+\nH6CRXu4F0tyAdaD7eqvIMsMeMwKERxJaEN4kChvJmTw/7J1O/ResxqthHnO/\nFvZfYoxGih1UHu/SiE1kH9gBvF7nRb6fuVkTeCehq6HJ2Nf1UVCrN1/IJZc7\nPB9V\r\n=60UZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXBT7ioG2WJhThtmmxJcuEI+NxziKG3hpwdpCNuGduywIhAOEpwlxSCY+rRQPh0BxosY0nLgKma514Xad47HvBCadI"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2387_1625877201135_0.1963510844408778"},"_hasShrinkwrap":false},"2.0.0-nightly.2388":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2388","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"81293fc84517f756b593a73d94da4e2630339140","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2388","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-HIma34qiKKElN75VQ8OejnjtLlLB8TrHXM/FzfA5G80VGNd1kszwcmbFFIpYY3ZAZ+/YC3Ebub53aYMrhchQeA==","shasum":"7047b5af49463d68fca448e7a5db864f6b5479f3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2388.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg6jxdCRA9TVsSAnZWagAADGsP/2qi0DBvk9kyy3TTCUhq\ngDGqSmsjXIEXDZO2OjT1bB+vK7/PK4Zne4SJjyY748hwyxDuH4Tmgr+rfee2\nL6bIU0sKtbIUiLNKA11tx3LQx2sFhgEEcTViFKu2WLHEkjaRwwevhbylMfK+\nvnFY8NOccuU7k8mW0yCQUP4S4vZp4F+Ck8SzQ8GXz0Mi5GaNhJk6ed762GBd\nqpA1y8g7Qj4m067hms2x8W682PieeeI6zeK3TuXeTaxEHZ2NXcE9aK6PjRqD\nmbY2yhQgRGc+pfXTUSqi1z1q08JI1fS/8lN1qUX4/U4Nu4yDZmbXl/L35JIZ\nBNvQM+jX3PMz/F1Niz69nT3jfYhtRnNaxaHYzEx1BLbAxEQKZwempJ+wM5lM\nDmNWNcSLdIZETfYriFNnNU8NF+4ZNTSbVjbYZtN8tBymkOl9dvRtFpMSEaAz\nAp5HhTC/Zogcl4aaWpf8zrzzFYzqhmy3KKCdHMqrAmUwNPEzwW/WPu/vlPwO\n6+J+kvSOjhRi2t4dSaPtelpqcmyr2mzyc1q2jitBjRaxixJpSrdou4RZGEHG\neizw6wozKZV/mEa/m8XKaiI+hB9LXIxO2jzVuDVFAheqSaW6X5eJg/00tKkh\nfvH3Sy+7BDCamgz7w0EV13B4cE7aOBAvOxJEeubJNtjhvv9JPm57Bi2vKii7\nRdfc\r\n=YpRz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFiqf7Tw6STnnSD+ZIt86Jx98GHNSjXnrLir6kX9V4piAiBoNUL++/FMklM3U/VexxE2CP8sZ+OymfB/zigAWVLY3w=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2388_1625963612617_0.7401679062111144"},"_hasShrinkwrap":false},"2.0.0-nightly.2391":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2391","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"20f2f14a806cc2fcba4d33979add2ac11dce78eb","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2391","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-Psli34tf4IMJtqRdfBsJ5HoEe7pkoR6p1t7DFbdjtsBcTMrDwRueSdVx1wzW1D5D+Tiopw4qkrQGLQqzaYyDeg==","shasum":"8eb6f3dc800a03bee9f0ff06b5c5d1c8d9a68123","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2391.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg644iCRA9TVsSAnZWagAAYcAP/iXJD+L39QRA7frZoxiE\nzOAcySZUKcydBFi6xRM83hPqf2ZTIOt3dTHfm8zUyMVdjrzc8YqPVAziGO86\nWcOpHgW/INvG0aK6ee+lxZGMB/uvF08cEmX2pJBhWYxbO0hfMCMF4Ih5MQZ2\nNH96YOLJVco+Xbl7q5VGSJU2o05n7BoHbQVJxmlXBsWAIwvzUO+426QGsAHs\nfiAWJuJe7PKBvxEh+6eILWpu9bkOoOR+M/1PyoHWn//C98BXhbBA006nCNNr\nY90sf9YFbkWOFQVRPocaVQ8btiY+uqIWafplnWZmWWInfVz5GCZe8rVhA+H6\nJo8mZqumA4xd8okLsjj2sQFFSKvjqY9/vMwYsbyf9igQl1SaRUw6Inx1VhL9\nZ8J7jIf88fEcNd9s5enLok9gcSTkhgaO17orudPrFNBVcM842/cO+s91DI/n\nr/xGcFgA+erL1wNX793Z0fX+mzCMdCG4dGP2gqdoTxDcx1UNl0EZ/qeQUnnc\n2w6P0T+KIZN9CQ3myr0imEerTzKcfEmvNOdc+VHn7H22m/OKdngFVP8WKFXo\nrUjBzpDCFyL9DVMdpxge/o+rAmxyAr0xXD8/Q7G9I4fdemNGhAMn+/LQlWbN\ny+ZY5AesEBl/MLX2egCWjHzshkKf0OwwjRgjOHnrXU4+zg5SkkaRQDTYE1f4\nxgL2\r\n=rVqa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGdjPGezvmZ0w2e9ZZ4waU40fD3v+ms5F7Ur7lJkvui0AiBdrujbDPA1+4fpKeIlnUjmKkviFvDgW9urRbnNgjj7Hg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2391_1626050082431_0.7607645020602045"},"_hasShrinkwrap":false},"2.0.0-nightly.2393":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2393","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b549b1d27142ca124f85597f3e666a9937f543b2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2393","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.20.2/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-/GBE04BLV/zk8eoewzZobyGeh935qoNbDKKogw1v1GJsI67sYbQ93psYdmW+wajn9Jp7GcAAoQQ+KCjjwj+jyg==","shasum":"83f8fefe158302552d7f07af7de180e943d08221","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2393.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg7N/NCRA9TVsSAnZWagAAWcUQAIblTYZCtc8GL9d4vRN2\nsN9r1rmAF53gujE9MfY3yeq9O8wbaft9i4kE+sZ8c1L95wabomCCeuzLuqcX\nowGeALQ0QJaQGGiq5TYRyNh22aLbSXuHAUyRAGMgVQvZKp2kpsOBxjhWadm6\n6AgtY00GBK3nBgluB+viRAmN1SC66Ibfso+pJTzK1SAxe7YspCB4ahswicPL\ndpoO/BwYXDVxsPFoHTIoNSt781Us+3UqRK+6tmWWNueyobpPGZz3x4atLrgs\nG+DtA4s8mpPoq6iqc5P9jp5CtZMMkcmeRhKk3PrafbN4bpBmOflIVqL1lxdc\nd2AFxFLrQ/88jprvm2LLetH0mKPa/9dDdzFAeWMZt76VYG9VnvzfEQG0KJCr\nfMs1INFDfz2KyAM0iERLlOGS27pId6R3Hed0qiauIyS4bJbsfN0q+NrCV35C\nFPAZWC4UFf4kNHQTfuENZcH7F1FnQ/IjVN3ImD8A7tEzLfBMO27jv+DJOj+T\nWJVJHgMYUra/zxFTfejlO1F1RMQUYvwJL119VngSZtINPeGClUTBouwGTno1\nLaiqV885hGLpmJpw50w7V+Ccx6B/zNnTOADzCwwy+w6hsTUER2G3bmdzBftY\nnB6BMB+P65VOyzv0OltLre57usG0JJYVjUsTkTo3DXeKj18I7Vru6t0mU16S\nYGTN\r\n=0fh+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCEJfEPABONo/2JTbcFW+0czmPuySJ8FH+7E79vEQqjwAIgZUY04O8MpNTL2Egn1ZyIS5d5NIMPuVP5AXForfAdF/o="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2393_1626136524617_0.13631070967512637"},"_hasShrinkwrap":false},"2.0.0-nightly.2398":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2398","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e362618a413b44a27295c47402b5386a4ef39a9e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2398","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-wb7NNQ8GdtVDFETzwGI7AMZF0HzvsHCUORHIDS9uMZYfyog2RwEzNwlvKpJqr7x/EV4YnJ1cjEEKk32mDag9tw==","shasum":"a83b9cedaed576a6e9a737bab750f3e47b910342","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2398.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg83cICRA9TVsSAnZWagAAvjIP/1RJqtERrWvUlUGU6Yc3\ngI2KLnlTVtS5X6LXisDaWu7eWQr6JLuL2TutCE7RHc9E8PfnubmBKPrJWG/0\nhK99ekI3u5ee19u35IaHnW+VoYZA4qbzdYqPwI2xcUR/WNDMEoxZLmKVc1/U\nwSzRpqCttZPr0uQ7tnjwyTH+Ybc39899/r6pvDpo7cY7EU1NDN0yf9BIeuqr\nneyAxloS1qqQsXeYFlAuBrWRBldNL2lSq/BRelPSm73BL8bGB4lsllsfsWG7\nsVw7Us8hK9huq1jtylgG6UcNA9jqzS24ZDLaLIllQ14qguIdYt8yvMpTOWiY\nT/+X4gRHyrMRspOfW2Z7+uZUDyhWleB1QPbF+y0jlIcK03M91Bzu97uIy68I\ncdbX0H7OMklBulRJO9WrRq45g/Lqpx3GD3Kn2NgO8zZZTtcJ/72KtsLPJgDW\n2G3BCtUsjGpxVnucAlffysYl7SBijxsZjyq1AXCHxD+GQcJNTgAceTElufax\nxjLbm3X5ummNi9I4Z9Xw9EZ2lGX/yrPM7HihkFDolQ1xexsgzutwTF2x99X5\nzP79me7vgO1z8HTHqDWJBs0U0tvA+8D14xvfXal0/p4twf1ukYzdAYEEH991\nq0vzz3KFB2H/56QsMMegc2pvYccX5yuuI+Hu+rtogXYp3UM/1kAHCWP/Cezn\nG1ZB\r\n=afnY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAhO9FnGx4B0iveEtQqLbuI5NclRZjcjev2VClSZmZNnAiEAssNvJkuIkBXQs4ZoWtoUOdiODfu0arfEmguJVPZKtqw="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2398_1626568456288_0.7155898913695686"},"_hasShrinkwrap":false},"2.0.0-nightly.2400":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2400","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ba7d2263fd15a282aece0a079da6b6e6e7ba1a9e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2400","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-8mky+u3sa8r1wbhWtE7NbE6pEQN7/s5y7Rl7UGV6xElqWUPQN2dGAmRYHiuM69yC6pXi77MRWVrBSQqKaevTOQ==","shasum":"e6dd7edac36f661f40e8145d275ac63c161a238b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2400.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9MjlCRA9TVsSAnZWagAAWwUQAImdsuWU6fiVU8IN0I5f\ng80TkOKBRnLk4BpgG7otmU+z2mk/2VZ8JPRYHHlLufAKndBxrYvu5zNrqTNy\nWJEyNt5h1gspm7R5jqHp7gnULyladyfOPdyc44UYTBLQt9RRr74/MIc9x7HJ\nj7N55SSU1E8Yg4wUCVYz8X8FrmlPPOCYnm6cZkhn9L9Cfo3sP52s88Ccx1Qz\nZeiJEhOKtB9SUXyZ19hRZ4GeuDCIHcyZbE1wW4ByxOJeUBFpvwswZzEgYupR\nP/LeVJ4CaDWb7L4wKlUSieW275suTp8rLyN1E1RZSjJJVSuhX8v0HQ3kggOQ\n9jdR9B3Oqf59HjITTx5UAww9lAk7kJK8165XA3130YiMU0QjI9qMS4V1ihw7\nZZSGHE6iASDTcoWhmPs85BgfDujZrVC4H2auCsBlUc5Lh8+yjCaUZ4naxPmI\nfTnGmjlqMq/xIYlxUxrBa6F892U9KvroTKdWlDtha4pL9VEuPccZrZy0waEs\n39Wes7LZ7k3RgITyfyo4UeGVqQTkQQUFNFDNfzf50Vdvwk6eET+tF3WnjM+J\ngHLKp0Dzxz3Dv5jdLUG9JvbE2VKqbMIJlU6ieGE/lLj9RxWlWiOSQTUgGuMR\n7RPJ85nWV7b3/6/VgE0UJ4oZiuH1Ea2Y2oxgur15/+nQ6SS6mSBXAx6pyWM/\nKKTL\r\n=Zz+b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRxBn2dWy60qIdnoWEbGxKi2ou34FWcBPmglPV4bxDPQIgRl86DA79k21FdS9E/TU0qHK0YJsvTEWky9NpJsRWZww="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2400_1626654949084_0.7927643136504086"},"_hasShrinkwrap":false},"2.0.0-nightly.2414":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2414","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"2cf41dc1eb53c5192a9e6b60a75f5af9de6adce4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2414","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-BVdALUV5R0VJ1vxzYq2gfcWoCkntZMDQhteLOVFrB79GWs6kOeshzRGpm+wTPwvdPTwTaZrsEkv0L/GwVHyInQ==","shasum":"d51fc92528fbee9b9462bfc3ca768f8891eb737c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2414.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhAoXlCRA9TVsSAnZWagAANqsP/1xUJu3zVOIi2W2Vt6+E\n/8llx7xYnXRGu1YDqbRZMjTT3woSt3BIjLoL1uGlzntkRvRtfHRbvkvKigCi\nWzIv+sb//qMKsdHsnySbtzXskay4Qg4GpAIrSTrArUgCRVud2na+aFd9sXOt\nSU/r10xc8zIGZurlNGsSnBck23UjEBGEibW07uIuNqTD41hDE578NEUdXS+x\niZoy4iTK6QTXvql9Wd5rNGuFopYKSC+053WDiybIl4MY4h0H5p4skaOjsh15\no2w/xUlatljtf20uxZQumwFDsh2VKDR077SlqJLTg99ihV95C/f1vjYWtBBL\nbcsYXpa0kS9RYbfwBtLa6pE2olkB6JcWagN8xbPFhAQmLoBHkQPRp8Ntbyhd\nSyTzSWwGBLwYquRwq9fCX2KvN4dGZWa5QtpujG6UXXB2zv/iN7kHn105HOm1\ncrwy6yLX7E+M1+kO3zHcnZrieUmwHF/95Dwm2kHuSiYhmMZ21HED6LdXR4Sz\nBSZK+YqfBVMqgbD3sxg1Mwx94Wnxr5yrnpr1ecWSzzxyp/ZdvI0MN+Pm+fNt\nuwmmjSxUpP1bY75t7MOigRq81+z0taDAORfI999pD+jQMdF3hgdE5Qv1l0S0\nM1qlclvPitcwSukfFSzcbblm2+kKbPFg9AgUQRNJRmBK4ZGrd7OUkq3l1iRX\nCE9U\r\n=HCwM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDO3SMvrwUpnNShkb4nGlyNaXa22D6bs6asDw3t/0l4KQIgPe6HY4sEdR2scSZTGBX34k0R1pYMp5KaUageUju/2oA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2414_1627555301244_0.8746559744324867"},"_hasShrinkwrap":false},"2.0.0-nightly.2416":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2416","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"0ddf73e202e481c8a6d21935fb02b8c121fdd0fd","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2416","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-skAGOnIRZbWlI05O5bGjcfSYDiMuVLAmi57bwIPN98oyWoXDG/hg+IZbwQsuXIQ4Is4WdOA+eWpgxMjTdBGR9A==","shasum":"f6d9ab54f7018de5e86420d88bc4a67d5b5637fa","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2416.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBXVjCRA9TVsSAnZWagAAM50P/j6jx889Mh9lUQsspBhy\nnZUPcNWrun+6UQtrfqw1F9BMeLyky5Podfj2SSC8XU44sb/Re21t9RomkKcM\ncWMfjiBCS0lj3dBeRut3/bPrCplE/tRviq5CeQiA+43BPVITegZka3KF8mTI\nswrM5DI++Xdkc9twJ5s1mgWmYkLAVGG2arSyNzpuwVOQ/owDE7rIl7ASha1z\npqecoCI1AfDsnR7yTz3eOqMq3/Wn+6yGGYU57zCdtxaAxGHKi7teOoUB3bbd\n4JodDBnK8vzwMJrNxy+RbAdyX6RIROv9QLTZ/bcmd7r3cqqmEArYD3p9CxEu\nOPNbdK3hi312G8IMpQBhccx4hr4Bz9+EvD1ByNqRntuaAwR+yQN0OCBZQafB\nmyNlJgwQiPHlBpbgITbf5OmHRkt+1xlxzofM540+oR7rBf8Un6iujeIFp8ir\nP9nGfUpCARfsxo12d9l0m2/Qo3vdU9duzSuVgfETC5jGzanjiqfpHNSmg5vi\nSmGFthJh3cZ/iVCWlNPWkgHSkhU1+meF/vRnUDJP2NKjfa7vzpFXPyXIWq0E\nOsGp1h4Z4WoL/USTNfT/Im3nbWDKgzxmOkib9BR5aPtgttljaw+/K8GjtyXa\nHz6fWvKuU2s49owOsl7JphTMylOBf9u2sS+cDejXDyEoM3X5hBIiZ9OOhGW8\nZkdC\r\n=CXl8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWqXaqldZf0eoJoNmyzEMP/Nfll4pdZjHxXzrpFq+MXwIgH169eNBG1inoqM76dfyISt733ZUEfhGRA5DX3ePwv9c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2416_1627747683032_0.1955744707179612"},"_hasShrinkwrap":false},"2.0.0-nightly.2417":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2417","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"9128703036805eb6f45b46572163f0a29d3b72b1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2417","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-qYpq2tJgXy/QiH41kleRjLVOZEBaml7ui7zKHMiK12nIhX2S2+lA2g895qSt0KYw2Ozwt0SVofOdv+NLUywHjw==","shasum":"a9e6351feafde86fa4dcc58b60a7f0519bbd7f80","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2417.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCI8XCRA9TVsSAnZWagAAvKAP/1W8sNtYQ+A6pekpXSbs\ntAktxHiZecPkVyfK7SGQNXZC61rR8Uxn7jyyClvpZa0GVOnGSAJ5tabrI0YU\n3Qr/ME+bRJM7ESSXj6QU0cQc03KJfFSF9a1MzXKf8oZ+pzFlzShqBQ+X02hg\nUY94euX1ZTMd2JFo1CiLt6bVpQU6wILUm0FxkkImxGYDQk+dnTp7NeyfQo/y\nGN8Zyv0AuI5vOTPBaiQl3/388idxPK/vHO7uJbSruhTEuUpazA7CT0sOK0Is\n+F5kgcblnsBbSuV4qzctyC6sWOkHubkSpnGr9lGvB9APCIFOoFcjQ+vspqtt\n9OVuVbcGUO4txMORy4eVcjmnOEclqUWljYxKGfLCudInY0eeD2cGuOYEK/OJ\ntcNPiNuEp04BMJ9BISDXtG6VDxzm3npnBpvxQ4mG7yBzq7m61TnoZDwviymk\n32LqzO0SSnGsFbzG+Z02WV9Np5LqDnBZ3DJs7KEcnxhTu+femP9YEw73lHCy\nX79s80UUNF8kNTV48o5e4ak5I6rEj0vwy5sZQkokzQsm4kJAlTl2QDnPNX55\nZe8jW6b3zuPHTwd99hJDss6ZILFQtuECV9oDGiO6rTXM+qF9uCYlp/da5ZML\nY05Euk30SJNsgCkGqmT3Jp2Auu1HUbNn6VDokL4narb1fqh+tA+l1cwqjsck\nIxWq\r\n=P5Od\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf1hRh8eWsA/CnMXaN7DXA3ohJqUu6/VH5RU3Dadez0wIgBHfE4uQyGEHg0ycnJXKbD5py6e1MADAz3AfgJJR6Vqg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2417_1627950870856_0.203331526532752"},"_hasShrinkwrap":false},"2.0.0-rc.0":{"name":"@parcel/babylon-walk","version":"2.0.0-rc.0","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8fc248f1f8eeb4428f7abd768bd23111451b1903","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-rc.0","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-h/Gz+RQNbPUxHHd0TO1lm1QmLhKI+kgByXq8U9cIMhkoef8gN2BqwA8v1Dr3Cm2tbT1G9TUPPx1GUrN8uA44pQ==","shasum":"fda5b73fa4803cd4c835ec85230a6f8f9baec2d7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-rc.0.tgz","fileCount":17,"unpackedSize":75761,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCNPeCRA9TVsSAnZWagAAWqAP/3fwLVEZCqdm/wqozFMb\nlR71OSWqgM35WlD2/5diq4QWNSL4ifSIfjAJC6Z6T1TA2thaWgJf1u1XGOxN\n5GU5ayt6UM8t0OYEWYSaa/Dg0R40w9xYYt+6DQ2ujzkIXc9lYxIG9Cng4WRq\njwT0ITbDvLsAj7ryH3GZ7lfr83LMExmmIZMz9h8p3YGkx/ehpD0SOeiQBRFT\nRiHCgFRT365snTLuTEeLUwGJzCVVVvTj/g7ftDmm1iVbqvox8SNv00rpOVp2\nWu18LC7acflKXZi4IaWlKlBlYH1Hr5p9h9xxPXmT7mEb7NP2huJOCdmNVDCZ\nbIz8pbjAGlY0MGFu+mvXNBW/IgtITKc2/jXmP68hKFJcDwzY6B0I9x1pLx4s\ntCxTUPwco6ebes1FaHX6GpCr6pSbJnm3UyW2uMzOrVxRt1QoYV6FRiOP8LL0\nxBoeYlFOAO6pBy3s/alWIkVV1jEs6ww3W2A9R+yVZlgwj6laKfviLEu0fQid\n2/e4yn3Y3g8qlcNfXYVzDFFe+c34qEm7iICDB6GN/zZYF347C1EZeedPka+q\nNWC18IAneTFfA8lHvn8KEhPrKq7dyPHhVCBN/VvMhjMdmJH/r2AHNXSWx5bV\nMQ1efzKGwdWOnK5G6dObekKMMCe68UlymDk0I2b8jOaYU4rdFZ8ls222fwEq\n+Wl/\r\n=dcAu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH9/apxA149mVZw6jYY9jEjmvcbeOAoNyD27bCPvNezqAiB6KhGvuJjxCQxe0SnYotnM5bn9SzTlQwMAnrbBWYAFYw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-rc.0_1627968478317_0.0762751010311471"},"_hasShrinkwrap":false},"2.0.0-nightly.2418":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2418","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8fc248f1f8eeb4428f7abd768bd23111451b1903","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2418","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.20.2/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-PVmtx8Yzntd2ZzDrVDBb13FxOVKKWGFx/sC4hwGY1GzSralLARC77nhG/KcSGPQDIUDQBBw5U1HVBa6rl83dCw==","shasum":"cf159f473fa61b4ddc25ffbb2045c0c91e3cc70d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2418.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCeBpCRA9TVsSAnZWagAAOj0P/ibcv2Y73EyqdGRMm5J3\nr+IdfQAYbjYffTNu71GeGYMj/z5/FdXbAGSbiknLkr4PWpA3RK5s59E9qRXT\nA//WysSyNQNATiGUpDscoGOloV/2NT0pjclXGR1/9HK5iQ77y68ORrkM11Is\n9PgL7jhUGVJv3LfjsVEyGbuTTdufOwLnaP2GxaLg1ZlG6RmLGFqa5h9auNff\nSeCSBk2EKrntRa2yCYd9vo/TlkFpNE9Te66byvrHrrUD/2pmbCEMvB3ypceo\nh+U4xEPwwtvcsENSquMqOrBnKx9TTGLPxXfDVlYj16WCZUsbpm5XuhIyE+un\nXNwg6PcOFRkiBXKFxWYNshsu3cjeFqB/tcRL7mqIvRITn7BnqA8fsiSsa4I/\nJOr4Us2avOBSPIgtfXzXW1GK5ZzoLNc0gXJMYk3uIq2N5UNWZctJebFpxMyR\ns4dmXLw72yZb2yr0+xiwSKOqup3N537TmCkoFNBr5cBaJyE7T/4Y4XQRrccd\nnOh2ZoTBMDg1hCep8bd3TIhMJptkyFb2sceKsC1c1ANdhKjR/2mP+9IZA0ro\n0LniTJljguPpyV6E3bbUxEdz/6VIUU1+8NpkO4tgSN4jZc1xyNfvLz2ng2+N\nwwF2SsX1CoOS+ghb+gShVBY6sZ1aVaVaTW1YTWrqb0jSdDkp56cdpvCGiJdp\nE6YZ\r\n=YPfk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUXMFSzSO2VGhAGds8XUhqR/+7+P11I2p22jPnwHBGJgIhAMuNR/4Ckympru3xAwrNDDSOlECULdjgauX8JLRgE1VE"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2418_1628037225527_0.6975955371921616"},"_hasShrinkwrap":false},"2.0.0-nightly.2420":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2420","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4df85e34d919f75cfa0d8ad79e9cc7d4fd19f716","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2420","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.20.2/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-e+8CzTSU3rK6JbeChS36/QnkyXnfXes1kqo7FDafiES6fFELzvZseQ4/B4TLFkaBu0z8IoiRFn5/HxcaCZi/7g==","shasum":"52e2dea83b549d24565ea852289d25493e1c9963","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2420.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhDdRLCRA9TVsSAnZWagAAxTAP/RVvn3U7exyBXlGQpHff\nxhVe91KM+UqR+rzfBrChKZMO0Bn0r/Vskc2bnWwq0UmZRxch1xtxBDclx0Af\nro5Bi7wg2IrQn04I55+4VouNAibTKFXNIgk2x56AtQ4M6hre4bb0fIO4JU8X\ndHabql0qixxlGQZsNHxpOkDMkzTUUeeCMlcl7pHpLFheKnVCEwSOGPOUDT/m\nViiHyRi+5wgze6a4OIouy8gWPDL5ZgmDrfWHwD3pvq0xFT5FP+R71Yw6k9Iy\nYG6aO4cWRFCAACBEYx8r3WXudSpd65kezgHQ2S4L1KZBfVpX6HnyWXw33fzs\nBlUYno1svnKCafLh8tz3kbPKILRR0sLAUwpuRZ+Mtx54wtW9xpcI3wO+SLVL\nbpxys4KX5BAyiBOFKMuun4OkoKvmQTVlqOGuQdONG33pGgDRDp3O/c3IYnYj\nnUamGwjhEv9P8zj6A2aiQPqrTAiHBK8x+Giz5gfAfSsUNFMMVJROQ95OMOgM\nAKaFL9SdJ2yG2MRUZhGKicTxZx6qAnF/WinnVIMjB8sO2x/7bxkOtssfNtaA\nXtv6ETU1cJj0Ad7DnyRtQHTstzZgBopj2IZYSWtW1YJoY3dY0wxihNQgiozU\nmF1rhMZnrGnrBGrpJVgjdbkF9U2v3W9xDYC71cAMFfpvVXtKKMDKycOFOgx6\n8YFi\r\n=QJ1F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHiW6/VHmHKIjmc8lWs10J1GmTRwFu+lHZOxFAf07oAaAiEAgiAv0ylVCVOAvM5ta6n47d4FNbiZVKcN4o79w8BiY5A="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2420_1628296267300_0.911018018954902"},"_hasShrinkwrap":false},"2.0.0-nightly.2422":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2422","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"7c4d267ee0b61c12f57c95db9e5d24860e386680","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2422","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.20.2/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-UO2UxlGU9F/9q1vrCrY11bsJTfvn74OFY4JQTpMd3axvvfmmUNjHT2lnt2yAfLHWgZQtRCzgKzHhokaJOAvXwA==","shasum":"fbf05935f195cf0590cff7f94bf021fbcb2cb670","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2422.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFG4ICRA9TVsSAnZWagAA4I0P/1sQ7zoAL9Q9mX+kqwyF\nuDl7gVU/PFNqAenw/vALlZzwJLvkZCGXut/e5A/TVHHb5snLrWbGH1566onG\npTLXp67wf49Nzq6Vq9ZejLAdRWqN/EFMsQtqOxhvI1l4Kfw7Az4p9hHwyo+G\niKFnBMrz34B2ThJbTUtUOReF4bvqDIoShYvYPPNFNStSXL0uyosKT5YdfSMQ\n64StG3UuhzfzNX8Y60Irn83hNcxOZkN/lnC9uR5EgwPaMxSxfjZR/XX8PocB\nliuutkkhfMkh2MTq0qML6/Lkt1I0fumybm7AfCUOyNbOqiI6s/Lyq8SGNuvw\nuTqbgYQlD5C5Ls2x7BeFfKlYFQVYGK5wT8JO+AnFBMoMSNH+p0OmQ0Ow9DHy\nty5ZmDa2nL+dScrPpLYkLwG6hJsfd/poCVP4Q+LdbZeUafqSSxUEe2vnH93t\n/k2i+zQJgVCirwlv4Rt4UHp0GSA45qyHRUucED4yXkZEoTkpAFYcN1z1RnAZ\n+ovLWrq6/ty8PJZEZrt6IaKBIKQZpAfyqmvnXf2pRgIM8/yEmVTmGoQtFyFr\n28Mfsohoy0ou38ieafJ6P9+T4nhXPKBpBqeUUw8Jp0Qqx67IYdw3dqWlBEIX\nneTWuJczgBAV5Z1nvkRoMc48m0xH1muDOLieV5tNwh2X1SUmUWoLd2JpZl9H\npK3k\r\n=FJzD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHACynIG/9IEUVIEhGHJilt5vt7WbkLYONEw+m3tjfHEAiB37RR+HjnthiyVRt074d15FSIvqDHvn5lSBIu1mNVdCQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2422_1628728839780_0.8701370120306384"},"_hasShrinkwrap":false},"2.0.0-nightly.2423":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2423","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f9887fef5f1adc85cf3569a2081987c0db4036c8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2423","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.20.2/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-Mt4e/YZbXC0RefmAXQ4FjwsCqcu678o3lBgzrok7NGb2WSvRcnHTP4yG664z+RXU1fOG2Gz21celrhgAAnsLPw==","shasum":"840d89bdbede2e7fa786854af36049a42fa65432","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2423.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFw/WCRA9TVsSAnZWagAAlIMP/0HK+N6J8CJhnooW2Mgw\nGZW3V1b6KZgkwRTUnK4Q+lbupnBx6KNAtzaxx7YwnVJZjWRHTzknLIswlFCY\nc8r0SXydxHTOMY+eUNZ8fLJIuM0UhMQaGPLCSTKGOOcnRR75ijFtTeqghdfx\nrgs0Db/HLHbjCvClKUlcBGVm6KaRwjfE9D934s9XPrzgOndImLCNzNe8bpFm\nBNZZ2j22OhhrhMlntlnWyMPnQY69xd+PUqGQr7MWt3Mm3najBpILsQUNgQWD\nNzWdUuKXv+BFmCvRP7FjCglXCz7eR/+QAq3iHxY62fnZIqcbIfuakmE8NwPy\nxRFVDrLlZEyceiZIwhGZSvohfEXX6nCVVb5khjSCZZG82TR2S22LsZFvGdmd\ngSUW0DlAyPiqmn9kbNCZ1HpkaHqZ7pY4WhyZyWoGyOGLHKmIQBJEj6aB8YhF\nbLTygN++8CCyboh/97h4aEqbOnkmirjGom/9yf6Urau8XGLAHFt+/QaJXUnV\ng/OMmJTcvXeDvEkVukhICk/yMvtPev+EOI9lhPhYDPlGI3hsnmBfLpKgU2JB\nCyI2nVdXlpK2LHzNj1WDuGvT8UjoLAX+69Ccxi2k5gl8GvjOJ6G0QJlD0c6f\n5YlRSfMwp4je4FgL/RQifRdxFmGCKVIrp+NyfoG8rK8z+JOSeVjoged9qbgH\nmVHP\r\n=8ReL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFae052JICCvYsIdenoFzXCbe6tbzU1syaazgAKqGAgwIhALNqxdAQFSXOp+ZNqMMvAs/6jDZAKB5PcRkxxe+dKvL8"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2423_1628901334170_0.08595050526310288"},"_hasShrinkwrap":false},"2.0.0-nightly.2424":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2424","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"aa21e8990fb6a95a0df8ce6cdf1ebada2342230a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2424","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.20.2/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-9OlFqka5Dar96j1z7puAwIKgSBJaRwRWTT5mQuMXcIbipnjvIyKX7B+93LNs0H22Q4k5Suy1twh42I1fnbfGNg==","shasum":"17c90f310fe49f9e4045fd603ca14a6f70e41670","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2424.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhGwN4CRA9TVsSAnZWagAAabkP/2ptihIb3h345td6tR/M\nPq+y2sfIYGJzmkL9GEWhYL67LIU5rODZplK99z+ECAJOiF0hIufiYnZYIdXD\n6KRWuDkZvmHbLGKxgqDcVG+t2dNn8D83LQ29Q5brQZr4erNaJFSJLR0cK7CL\n9LS/TgGzX92SzbcQl82gUDCizzu7RkcLbjItCkJh5hAihT7hfbbupQ3aesuc\nxYShc7+woAnkZa4FY1rqm0x3ZKGQ/AlanN466G1pnoeLLFxfOqx162fMl5xO\nEx+RwRAb4ifhCr1i2mfkrmq02U5wJPxRM0cAKk4xy9HJIdLf6imkvOpNg+97\ni4UC3eQV3Okuh19yb460McKPOVtfglGx9joELUSrgsX5sj/beEbhEXfpfAQo\n+97jiMvP5GyahSigNs9lgGIG3v9jCj2M0d0Q8VKtRPzq/MXn8tJfGl6oa6N5\nN3mZofmB+bYTjxwm0lV4DswH2ObU9Uhw6CDIzlsDvj3Oi15gcqbydK+o1DwE\nDLF5TFPYvGSaUOnwNm83mOV3Lkz/uiTz1ut2Qw9DBsP5WivSW2jy3sjWGxd+\nR3Dnpwt9casN3g+CATrJn1RhIePNEw/Z/39hqXMsiue9Gcs08NYbmNIdBAEL\nmrVSJT+kHU3t0kcs51VUJMcgDF8u+yqqB/zZaVjFt9yvWooy56HRb1sweHv1\nQlaD\r\n=0+RB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTew3bXV93A2Tx/aSASqCbK4QN5IN6oowCHtMhrEtYLAIhANcxaDVrvp8IRPWQu/t2RTwBxrVjPxGWyi9TlAynBaQL"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2424_1629160312329_0.060118502521315564"},"_hasShrinkwrap":false},"2.0.0-nightly.2425":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2425","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"cd013739397927ba370a69ca36b05bd0ec641c04","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2425","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.20.2/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-eAu9abAbTETOQ8j5Iq87ASb+tPfrr7h2hxO1l8DPviuT53gaVW7QFw1brd8/L2jhRPuaj5riksdKtHy4AdQ/vQ==","shasum":"10b15dc388e8bdb50375c7b584961fc98ac1aacf","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2425.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHFYvCRA9TVsSAnZWagAAGHcQAJ/BnGL+C0tvW5VgZSYV\nrAKeG4vzJay/DzHrG4t0zyPWUY9cMTDqmIz30d0WpofTAaeu9XpWA3hDXBKD\nc23dIPrg7D+Vf3ZC49fkpPT4pqqi8ZmL6mAkF0xNCJjORGD9tZwN0RLNm7RZ\nXp7y/RxbJn0zeELQKONxQAmFmD6jq2PTWCR8+Tm0gmlLg9/gM7yTaqf9Tvkb\ncnHOtRmTiR8lgncbaWiwlDrcC2edJQLI6yBDLQEg7dgq1g+wosnXaacM4McJ\n+j3B5FEGhCFjPfAK4/ePr0EAWrYQNxrrEC5ttFVKyo6nckdEaoMIUQcTK894\n61ALFrx2ocAr+gm5pQjhVHHh5NBHa1vG9W0TTGyIleWkw6jMGmB7qi9baLQ3\nz5TZ0HSFbuItIIc4oHoY2mkuacnj0i2ix/vSRvTih9v+WIGZZ7LdhMZfusSp\n1aHP58AgXwp+53d4wF53A/+bFdRCSca2RLslXs+gM3OGw6+hKsIBl/j2zmIx\nurCmxcHlkuaYDaKGRHx3evIyKpJP0gsy/AgwL2PPtsRw4vKl752kKqBTu3EH\nvwKmZ89oyAck9RaFOrcJ7CxcolE9OU1XRwxM4RI9aHAQhf+8ZUVuLXF8VvCq\nyOI7aVoxy4nyzIXWf+VSXSSvhN6+wHz8Cr3gxQGIv4uNNjdgmWPQy4x1t0HM\ngO6F\r\n=Fhna\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDu9rpi7KYB06mt2pP4jkFvJNOhOF0GYKydWtsb88wY8wIgBWqZMCReJ4wVffHrrkG0QbrR+67wmlVbCIXpc4xXb3c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2425_1629247022968_0.8013648321635447"},"_hasShrinkwrap":false},"2.0.0-nightly.2426":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2426","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"de415831bdd6f36a1c71aff44c1c9ec4ef3ad266","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2426","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-sMUPTINir1FYOLjivvHm6jaoa8XjbUVI6H9UiBeZ2PsodM6hQX5QyWuJJDLrMYswoCfKxTmNCuUSRcL5NGCB6w==","shasum":"d08ddafd80afe05d540fd33f774bb7b25abff3b3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2426.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHvjaCRA9TVsSAnZWagAADWMP/2qfY+turCVan3eSbFVm\nB4dycRTfkYH1JbpA1IkqT8Ns9+6yR3k06Z+cOpgfRqWsj3MlHXzIHrrY92TP\nBSaq5MqbhENMVgSLTAJ2+qwSqYNpnNbWKpJvxONuR3P58fCVOnBz57wUOvA9\nvAEGHQJqH7BXihwGtYk3fdghPOfexwUOtGXJrSX2OltPFvqYPeowIkAmD4xW\nt6Co/JdUo6hvsQXNbooepHxvkrXzCDa8XfIR9lFBx7toVrAd0VSxCdOc20nb\nw0C7qbq6cIEgMaZH0oXv7N6rKyfZysztnwlDvtU2H3KPPNNHafw6t7nrcIs4\nJr0wkQYzvGVyHlzq4zxli/sG4T7/isKnRvUPb/15aM9yg2oLvZSC0fFel0mA\nSNbRqaXEBqpYB6m6voavm8ItWOnDDvVKPmiEqo3SZxLrUbTtTRyfZ/MiHXH/\nqseQF40rHsJvRDZfenefoKwD65zy5SXXkAJJ4af563OtHpNhWkD6N+7RxGtN\neibZLHH+5mA2koo10YBArYmH4yzX+DFdr5q6r+mdv21H+aZehbOnj8WhvyaF\najQcpi2gU7ri14IH8SovmmI0PGezEkRa6rMOVBLsTGTHGUpGfLEkG1fxXC/q\nZfKx2yEqsiRdq6avg7SQigkiiEYds2VgjL2m6GEvmoJfOwnT4y2ocd6j4HDe\nn8aW\r\n=Kjuy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGWljVmqiokGM6vg4FWNxHhQxY9/RpvRs45JCTCdUuWlAiEA5AKgKJqRGjT1o6NKyNRlbgvEmEBmTdlHFjJLIjJ6/DY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2426_1629419738023_0.3294372891140738"},"_hasShrinkwrap":false},"2.0.0-nightly.2428":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2428","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c5337a8b4af6114a2d3634c2d314a5f0ed1795a2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2428","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-RW+fqr8VuoCOcplV8/OSSml8pGNMHTwBN3+k5TYT3DcQwfQEVCbh33Z6TmeY8AYHdShyPxkd9TO7sV/Yhb9DsQ==","shasum":"8c99de7b9f6b0955482c7cb1326ccd004630dd52","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2428.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhIZu1CRA9TVsSAnZWagAAHTgP/2A09NC8WdMCRP+un90f\nlrNL+yqDzG6yTH8Rcpg+mMH4aArR29MHbYOsyqSp/jAIFm/PgMYK9x+heTCO\nOX3geMcXZoa6d1dGlXggtDDFZQXxDPECnZsyfPEzLh2d//1kXI3HlQCB+r6r\n4VwMZHSxP45ytqlfrOBIVN6PysskrFMOU/2fHxSGesvkwI3ER2k/0eOmfT7t\nMLwf4VWDTj4qM3ogwasbxScMbJnmCdcak4nUJAuuwx3Q1Bp/w2t1b25ie6md\nsTvtSpTCoOZPTFs7VMBrAvBvpZ9iNGrTf/eOImZ+vXhr1BfpLko5edtOWZQ0\nB1yDL4HvhW5VxMBK14iM6h+bSS67HfUKXd4Rm3Dcrsy5YUFsSwgwPUSPu6O/\nZZPpTcjy71zbyQjbVlAnWKp1VsJpAg53anBOSfKfxoyQfhghrcTXfLC+SmC6\n4O2bJ4TjMw1QZ/IZewivfK2E4ycrv0iWaO0Ziy90eXoxOXC239KJC9kNjOrw\nMPS+RLIdBUGUT41dnzXqYSnJHKYA9KGxZX0aTPihq/b0+RQaU2ACxFyputjv\nnuo4U95AXlaEfxjIjtOHFbtFdRej3gOXh2TqdGcjSBg9ohN3omfVwoCfX1sO\nwJMhowfcp6VuA+/xdGRJFMQ/1fG8PTBBa2ntSoT+3iLJZHmZI1UcNPaumfqV\nC104\r\n=FDYe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAIRtealX9otiHxjoQGOpkyPX4LLL5TEP+cD7FvucsokAiAVdj9pGU+hx8yPnIljQNbjhm81HIH8/lLS4ZLGc07O4Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2428_1629592500860_0.49001254174989795"},"_hasShrinkwrap":false},"2.0.0-nightly.2430":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2430","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"a73259cef6777f651e917534ae55cf320e100e9a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2430","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-cEPOrw2dpr3/ek4pwcxq2A8TTMeGgD+l3DkXViC7RgDGmr9/Z251NgLAeU16kHUCc3W67Do9YA1zqYpqP8adAQ==","shasum":"a3ac98415d840771fa753f7c300fdb59a5ec981e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2430.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhIu2zCRA9TVsSAnZWagAAOvUP/Ruy/KFTcdOO1VaSgwD0\niv510i0xuaulcUJvRezOHq+ppNN5XYEpRTvigTOH3jHQXps8aAXo/3YisiC/\n4N7iCURrKjTKzU2qja80pkLc0EOp1JiNYjNswgw+Kb9NE0CDwGJjT0pOFHga\nC3SL81rFAMC8lzAmendyGKdDdaxH7NMvtsUydSdlefiEr1AVbLYtJ1RsvYT4\nNyRfo2Dl7ntfEdPAuuSouMGPhf+Q+wZtnWjOzWlGVzq7EUQMBVyJ/ellkmQa\ndSKzqQkK6VH4Wunqo5HkB5/Wqqvlo/M9eMDYcZi+t5oQlSpXHi6UuNFAm/Jt\nEkxmxezVYhauj15XYaLCf6aAN/ttw+1WjDUxH78oyQklmnRaG0+N9pw447wv\nDojybc8pJzZ2bg+i8HsMEav9c8vQex1Xu9xtComN2ps5xaWfZwWzaNXmg7Vl\nUIZGgo9GPleRmjy3ChlESuDeVp2yjiwrAU9+XZOi8TgbMtlY/Ly8lehIUDa+\n5tIP2NsQ6IAkBuK/cBdbOqs8IWYlgPYJ/iBWPD+Lxs1KyeoXogYV6Nqsalv4\nTJRcKEkTkpp4kCLni/murY7DAr8Sb1Ne61xUd1DB7iXrTeqnrcJy58lc/95w\n3y42ejvjRyqWBZAJ4X61gosTbW5eNUPkc0TW49/K9/yvEv7Y5fJrxF/Xb37Y\njM3B\r\n=vTeh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcjzPyO1eKbgo5HNmxeJWVups0OTZ5Y/5hYnLm+tt6gwIgTEMXh+aJY0J4LBeGN5qln06ytv41ZrSGTCbLmBE501U="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2430_1629679026722_0.8664410862806993"},"_hasShrinkwrap":false},"2.0.0-nightly.2433":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2433","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"95f5648d775fbea72506c3c4f7a67fe48efa8d43","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2433","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-Ks5MhgTX7Ot8E7vbY4+tmO1Jpf06zmwALhdHqiQbZckAJwY2j4kS+xwcrDqt/WoMSWvO2rhtDZB/P/clMP+PZw==","shasum":"6dfe06619b0a43dce46f5afdb42c4a29ba5182c3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2433.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJD9/CRA9TVsSAnZWagAACIUP/22noyTbeNDC8h+589XP\nO+q8X8IhDSA0FjuwfD1puPAVVcg5MJHAtD6NdrAvwjgTb0mybIEY3ZNyzUxB\nbnoM03c2zJQVPi+g91n5v85y17Vsn1kP6/6BIOfpPhTtLb0rc4W50U37pV4p\n29sPbqCq7F+I1iQlIW/GNa5SNa56p5zy22k5GcAy1MlH3aDvuQgErpXDqECa\n81ryCeUNOz/h8dtfytI1nehHrJY1uvkTIWK3bl6+u6oC5gYSwXusjSBxwFDw\nHxtZQ4QIPN+qgxo9oz0TtRjgB3mRmppxdWGrw/FU7+FjbqU3k2PJSXLvJikg\nXw4c/h16gYnq3giex4ueLPrjb3Lift8RRRtzCJlC57K6ePOAU5LdQQJKS5sQ\nIfjo8IZPEd7tiD6NdIwoTfhHYEtjgMjvtG4hxAgLDp4BsZJcq+Uo/HQTFJ/1\ngr+3XPnUxbarsqCMo+gM3HXeP3dqkXyGA2ndx/mI1IrfR+4wsIOg7DIceVVP\nYsZZsrNPZd75JS1wrxeRsuU3ts1+U3d/sKabL7goKxWGG4VChvSpI4uQlI+b\neNFnMN4KCRwxFhy/NQWkpv5cVQuTA1adSRSDNjwSpBcyJOMmWaiw9GafDO8J\neUvxBVB4uUOnY/Y9nBZyFpbZVBytalPco+C0iZ7XfVe6Re4qrOszfXpKqt4p\nKWIF\r\n=1TDq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDslqd215WAjfA9UTEHUqVEpKvM14R8VDJJYSwaGn91zwIgJ+3HcdrRidw/Jj7mlCC5Aija+9IzJVZbbrhJT+GFyjU="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2433_1629765503159_0.6920990814500481"},"_hasShrinkwrap":false},"2.0.0-nightly.2434":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2434","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"0058a02dbf140a5b4b1c7ecc4462bc5e686d29e4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2434","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-lxSngLUvUgDfYZcv/AVgv5qQYtM70Ua17zuKizSlBB8EeOUkZJ9tw7+uHts6bfRi6SgAPt8sRGeBthCVZECp6g==","shasum":"f1bcc8151bddca976c09d9816f2461a05cf46005","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2434.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJuFiCRA9TVsSAnZWagAAKCAQAJBY7xaNmJaGMDEZCTpl\nT4z8R94wkcGhQNzYDmua282VEVjBDy7gPtovXXCVFISMB3FQTAAX3RtXxbsZ\njLkWzhCmm2c1n4Z8YQkgVaPblzX5HjHl+wEQV/iRJJsHQCpe40NgDCQvUVfM\n6PV10Y7kFP4jZEswZVA/oaszE5+p3TDwMKKa44QnwR5UCUCoUrX6u1y1b+Di\nFUMSvkuNdbY2DVTMqo+o5vtl97FGAlrKtaH/rO2OcE3DT+Hdt38on5V6zsV9\nwgBVzgRGZ9Zzmk4x3+nQts6Z2g1Bg15/4GnkuJFlw+3ll3gfRBlWbqe6Hr5E\nlydRT3vE2pHpwXiMWdCLKwRIfsKS1LsooTAAiXyJKgt46KMIcwjFKycT4G0u\nm6hW8OlqYIgEspwjkd19gzcqK90kticH4MAEyUWZi/eRh1NF8Udda0yWQjvL\nftxUvkG8l3c4wdAe9AXCRIQWdDu6a/vWmD7JojowsViMQGa95S4NWgNQcheD\nWboS0NK36gYLURQIzgjxGNaKEi/w60dfPIOJ/9DA3XCzlskgFQMJCnfLvpry\nKkHAjhTufVNnRM4QDhZNZ8sSanhySFITYSoqSC+TZ8cS9qJpTKWzaprtE/fi\nB+E81InfXqqft/Zs019xHnkqOeB6B+NsEpCubZJ0Ii4NGP1XFx14FInL5XsJ\nWeyI\r\n=NKVg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBM8KOSa0/8Bkh/WubdjYgWwvMn6HDSXuQfsxJgIHk+oAiAvFxoLvjpURRzqwGEVowkJM+Oht+hmkpTzgyNmV/0z4g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2434_1629938018353_0.8093843515677515"},"_hasShrinkwrap":false},"2.0.0-nightly.2435":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2435","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"1452a30c38c7dca0e870cc75569ecab63f8f386b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2435","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-St5BRaXFESO09oikzMUdsvFwdnRd9YAPp9VmyrkHLHCP1bRmyEABRVqyMh5in3j1nI/ZldfcU4SKCRuFd86KFQ==","shasum":"49ea5104c852fc07b444de4ec2a287bbd5f9e2a3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2435.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhKDLHCRA9TVsSAnZWagAAy20P/35v+fcwGWOU4fXPbaNw\nQ84d++RgmxrXLh5N4qkT21G/xpfWQQc4UEd3Ry6cKV4Mm6hoha2iUnwp66T5\nRn1qBOuTIGKeXUbnj8iIlcKbJNQWVUGiD8q0dDdjcOayy6+miEThn5gqQwF5\nmL3oue8km/ZqEwMmKnZcJI0UITp2mY4zgbB5fvvYs56p+xCttWPQ7AdbSZpP\nZuL1B+CDVVoksvwJyK1+ULvTmZ/QAhTdtunAOc8oHqMZmc8EiS/oBdc9Rq9e\nI1HDZyX5pMZRKkcpev4JXHiJcXGgvqGIB7bk+u0oOPKNzBvQMlqnAJGffDcm\nEeVYxNfL4bt26iEVWbe1sAP5TRy5P0EO9iIcqSxkjmmhhGeSmp3LfSUsKetV\n/G+7VGDXR3QGcr9aFH2Z0y3BhFDzmImpU3860soB6RyUcSvwHzfIjMAp9ua5\nz6lTB0gyp5Cb6o/uk4hVPKayX2QgqZOPPS6GAfBpD51P8A71AS+Rb1ui5uJe\nigbGXs0Lu9nJ+9ug0TcnUvKdNUUxXsj2txVwyVchxh4j1kFt5Mgw9TDrpB1R\nb6341hBo5ueDTFl7+umXEDDmUCi1sOHRYpzdd606NVVcrTEm901Q0GhHLrnL\n9NrqVI3sxuAWNtgplIgglkZ2TBZfML4kfHxZi7C2FWPVl31zxGHRwZtjBDF2\nxV0t\r\n=7zQx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrfhYSM83NXaQF1oKEe8ydc7zeip1AR0S3zxt/+6saPgIhAKm4v+oYRSiAqaIU3FFBBzI6MjQYRyRwnBaNPrxOyVZp"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2435_1630024391604_0.5773729178616622"},"_hasShrinkwrap":false},"2.0.0-nightly.2436":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2436","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b8588017c9cdbe0bb811587da328af45ac94e18d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2436","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-WfuSr1kURCooCeGUHNT5daaA7j6j8wdwbfqtqREOn8FjZ0GqwZnRFhcTueM+0KHRZfqLMz6ZsoO2ARGbQu7xNg==","shasum":"625c04fa9b62135efec067069979e98591951198","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2436.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhKYTACRA9TVsSAnZWagAALP0P/icnbkpHKfXPpS0CW4wX\ngcU4IU4CQVGAgCOuGsO3QyLWLLHgPrGaXhrIcSSdq8sFeceq0+vcTFur64mI\nQdzAP3+hka9TtWoejhcNfZGC/ZUrX4DEf2kA/+FuaTG0mOfIyZVf2zJmbqSO\nocNdXyj+IVKPNH6mnr0IAQIfbqpuagVjVBrR1n76IDq0ctL5UGOzsLD1Ltqg\nUAWR2j++0MmeyCB11s9nppaM42SZ6wBhq1AHnYyy48CSBmsB5mHR4tnRap0s\nCt0JSF4i2WSYrzlyutNgpXnNTwHNW4hub97D8+Tah+/+wNUoSgb/2z2EsOY6\nKXelqw5WQUf1BhffZEQiZabnKvZmxvjmE5D1eeCrTICged0pqDaM/dM0SrrW\nYHSULfYxn+bVZvp2fWNty6t9qm/US0r172cmvyD0Gu2UK+Sv0i3C8BI82x28\nmDu0m+qX/Jt2YoTbgWqT89KwxbXrrobjY0qZPXZcP/4CAfNub/gxGc7tRjL3\nQglOEO5rfh6ABO5HfN4MddQ60Qy62gp8BJX2TlCS70QEMqYnOUoGBs4jQWiw\ndwta8ihZZYls5J5GHbCYrKuKuAkyg8VaDYJ8PXdpkVYS9am4p0Ms6tIq846i\neDE/L/wGLqYnoOnvCAvlr82yTG5kG6Xf/t2DQ5A8QM2rKlV8t9jnS6dFn3U2\nP20U\r\n=0VUq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAX64SFv4FOrsmC22+Sk65jAkvZ/QEbM78Lnrf43fAAxAiEA45XBVMeITZ35QvjlHQsUz0C7Ir7GgTaIF1EeXpDD0iY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2436_1630110912419_0.28073183526124423"},"_hasShrinkwrap":false},"2.0.0-nightly.2437":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2437","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f30f0561f9c6524a3a949d35aef58319fbdf7917","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2437","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-mCzidPwH5WV9IXQ9hDAZsrYiE3Gq58eDxjwSSROZdXGdxlseOLEatBvd7icRFRpZm7ZpeNjO0S4ZeVv23lrMSA==","shasum":"e745820792c503addcc122cfe818be1f9beb8d71","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2437.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhKtX8CRA9TVsSAnZWagAA/QcQAIKVe/38YKWsatTEgI4+\nV+aZTfFXwryAsds3zdmhTbzV5/lWPoC2FwmcUhsCxxehsf0UPZahq7trFxU+\n4dKnSuU1NULqgfaWxEiko1wKqgxjgPqc3d7u2wYOE4vQWDGQ/MVIQ0IGr04H\nTP/VYjTiDaljR5Y9YXK58FSJTcJwR3uXO5piS1OZEOyTLykHmbWikA3SH/lw\npSGmBqsgO/4k4286CSjBFxfeaxa/itY0tgC4mTdm7d6pYrKGIjjqCSE292nm\n+Nu66XAmqcjaeFMSFfVH9R/LJu9aKR3XVTPUAZ1znncFwnXZKOQVJBY35s5h\nIhbWylgYd9CvyRJWhL7a3JK1h32l8qKMAul5RfDHH70z2vTo6ycLeT6/gLTb\n2htIwzj1V2TwLit8bvyWLSnSB/eWUHq8qskX/R3nXmT91KegnylqEOpn/ivf\nmRsnzfP2vsxSkCJsHr5He622i0NSK2eKY26nzukW8KAdEyjZAUwMKs15NoK0\nt+wAFu+I8ISR3qkPrJzjOGBNK/Hfdc7/XY5ccx4aVzYbouRKL16eKKWbw4cO\nA6i8vdSKeg6sciS7aGhgWceiNM6bqx+razu+JFdirg2JAr8pwl9RaUvVX0Ck\nb5Eh3ejXp7CuWxvTw1V2vWePmJhxhGLL8jarVJ8svyMlP+lKVDAly+8DlCPf\nxBtr\r\n=4jBJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID3ii55rODhMJT9bfqwhJ0AoC1qnVNhCTZlqMJmpixImAiEA3IOFNmRfuos6gpQ22aWDtLczg1cTeJB/sBv51Q9nvoc="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2437_1630197244037_0.29762867251841896"},"_hasShrinkwrap":false},"2.0.0-nightly.2441":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2441","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"461de1149a0312d4c541d8e5fca977a7f3c58f7e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2441","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-pPvkslruOC/WPEEYgl6arysrkt548Vkdie09PFiIAxrfR5PhgSauMdOMAJxf2D7KBsFjoj362H2cxjLxNQCIxQ==","shasum":"b8c3e313fb3bde8c321560884f87ef29ef8c8aac","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2441.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLCf7CRA9TVsSAnZWagAAHf8P/01ki6cPXrazE/w4E02r\nCNrZBg4vBeiyPOdyDzk0LdGWlGhtLwVmUhFpnWKN8/YkaZ3vEpmUOndU4PYO\neaTVoAM1qPNPjL0/T/IvKb0HgufYYVgEnWJOwzoYgT1xacQ3Nefl9atxKq9O\nWSRkSAh+i552iL1rNwGZNb85Ta7A9jtYzXKkKJye46EX/Up6zsot1CteoW4C\n/02qd2AZzuJ7hUIyQe5Ess4ry0dWWqa0lFksZDjZbDfleKNV3VXchnJhwoyM\ng26oDam1CA2f8YFEEaKqR81ANo1AEAtl6VO0yFoiHzT84rPsSuhObzjJsT4k\nay9+zhmN00qkVHPhxj0CB5I50qWT4WgvSBSLP0DRe6nbOdVR4SqEf1DToJ5g\naIwD1rUhtHXEbnyk4SDUNiIF8vNrR2iaBkaiCAkurYD3o6L0io9lFLhiatkY\n46ytsA3q1IHwlhYvyCFSZaqWXHds4qKuYEjNfLr4Jz/VKoyy2fn0jzQsyjHs\nUj3veB8wBsSUihNOSbOg4Ed+Sy/4T79B2uOfye4SmMvl5ssp/lLt5rUmgE62\nefCG+ISF7LYbJb63YQ7tKCsfKBU0+ax6o788Ri0TVtwkGjBp+2PVZIM3+I/H\n3PFtcu/a7AF7dTB7Aqbe8Yu+6A5RL7i5aErwbP9fpJ9b26CwBKPRTI36Q+86\nLyeq\r\n=ibf3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHd+4RXckixoDd8c9LmltHkgIlDcanMSQMFGX9rqSkhqAiAFA8Zd3rmmnOJOCkoWuP7rZgPQgG38cPSQbzdVXbfU5A=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2441_1630283771480_0.3645696343762126"},"_hasShrinkwrap":false},"2.0.0-nightly.2443":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2443","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"6c62ec421c4189793ae95f2e60f083d49ac79880","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2443","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-zzkJsdH5p8ln5rshn05TlSepeOTMSUVl9zhQss2226RdAPFNYHJIdMOvrqKTTeOY1+1Z3o78rhlvSPmwm/TKSw==","shasum":"32fc23f05544bf415d9ad1778f6cde57f1da86dd","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2443.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLXmsCRA9TVsSAnZWagAAdQgP/1g5FE4ahATEjTq72FHR\nNwvI8RM8tLVrmggB8Eu/fUdcddkEYvSRxPJKus3e30QAq7k4rt+xFTpXAiHq\nFyZhHTtKXyHPiagInA2srfyTzzdTE3eZ+h5pVjdxzIUBjEQzTrEacUWs7JjN\nItF1VLpJCLC1FBrUeZjKTAvuqe8K0VV13dZ09R9x0VXz4Pc9E7Tbd81xkkzG\n4PfIOeW7VwYZ9CDw1X5aSV7VNY8iydLhLOjV6EnPT+a/TIna5fldFAXzYP6u\nOy/AFAn3F1HkaWtoy7khThf+flIxhlPicprvUMNNtUnNBoz+XGBxlBZVX/xy\n22KkY6a1D334woF4js6URdEMRGxDehClTAi9veoeEqekVnsQ8pJvov0N3H14\naP8RY7D70G5USwvhmHQ1VSsMcx/6r2UM97K66M+ysx4zh9oxEnFJblJ+CySc\nvwD1AIuoQxvEWbwbC95L1LqNfr4c5pbs1Ezd6zE7Df17f0Emdriw9MSwDrd/\nWOWknk6mtUurNzH/cuV8BhboPlZ9e5zEkwFklIbnGnJm6WggsdmTG/u8n8DU\n3NvfBo5Z2PEhg4paD60ifVBxNpezDq+tVDwAcvu/2AyC2mDNEAjueTkIk/tO\nirSbJT2g+y00mpHPV0lk66DbuhFp5VcQWJWXf+CQLtNoIcFhZQRPBOlCuEM2\nCKmY\r\n=t+pj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAhfAr42lBjj1sT5wdqcGXGRoc5AzmDdDnCjfyTFzk2vAiEAimk+TO8ddkGgpHA6liPGhQIAyyxwSp+3Fkti4z/ClGE="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2443_1630370219889_0.05448274998377034"},"_hasShrinkwrap":false},"2.0.0-nightly.2445":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2445","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f03eddda4ca3de324586a163e3341ae88a8729d8","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2445","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-mHoZ5qOK0Qv2XfcQ/NLP5fcGcRi1FKkf3W9JYdRwfh6gXzGp3ZhHoiPJftHBZ6HDwA9fkbESY8nwwkhOLHgM4g==","shasum":"a8069957cc592e638c0e39008dc92c1221e50a36","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2445.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLsxQCRA9TVsSAnZWagAAz0IP/jgKzhu50Bl4Gw14DsK3\njYYGIj/BVZ64eyY/j+fWhyosDuOextnwRoOfghcwfAaQiKVFT48P0W/e8f90\nDVijGSjNsOojRqHEXGBUGhHxx7SNWPRdzxt3EX51f9HvMFnpNfozq3pVjqxU\ndHsEKsNQbU7f0hxx/nQsTNw1WgIHXp/G3kCpdtpxAWTIFkcQMwqZgVf2+RZY\nPMy1wTa5Rs4LEZl1o68Zt3LJoPRPGVHiMdfFwptbsGGHlWZpOpt6deQpyf5k\nGx95LfrZgwHWMZ3zwM7ZNOVQ+sXO+dTdAKzkH2AnejumVUbuLnWFBMnsTXJX\nPLXJWFNZnMyOYIQtI22MQmGq28hQaRZhrqDqxYP3mi2WWA2WbcW8/EKeIVpB\nYtmhKpOfaYUWvtPgjIaP5PpUNVjW0RGeA2cjmWQuCSknmwUFK3+b1/5jQw2z\ncPe92FmQTInTU8VPr0oM9+P1kQB2yb3B384+fqaoaEr0KnZ9VspLjjZjLJYs\n4bQWEU0jy3SF1IFtmsLf5hF6s4D+L8aWas2DitX2vEZs0LYXXFAxHwDMK9rm\n2IBhIkxNelI4q/h/y7ebWNHEo2ZdZ/C4UP8ShBtTXLxbI12cmKT/DyDaUyfF\nrXQf8hwF3abCqw+rwn7OoCjSocxOyypaluxHkC9SJIMlwzjP2R/Lxh1JPxef\nOuvg\r\n=tXDN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChOle7Vvv7CQ7kOQpqEi1ePghL75vfVMLTploGTBK4NAIhAK5hH0aOA3y/79KveEpAp0w171Ib4bDfiDFytlFLpcD9"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2445_1630456912199_0.7853717957193576"},"_hasShrinkwrap":false},"2.0.0-nightly.2448":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2448","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"80d7ae24f272cc4568a001d44d496c4e13b600ec","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2448","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.20.2/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-F28vmR3ERoUKwAKs7uoiT0YC0aofPWU8IruV7tfSQ8m/hnsWmMq/X7OmihPr1MTn3P7QPHMMo/12WdVsby3MCQ==","shasum":"d83518363efed81f0c9c4821f6d82d66a03de808","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2448.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMBytCRA9TVsSAnZWagAATt4P/2n1ptPsKnZJ54I2SMhG\nz0anLfgjLHdngRyNEtdAi3TbFysilGlIFroUEyhBbltntO/yUUsLFqBHtii7\nKcDqvlKb/P1CrBWFgkHrM7WKWz3Y6Mrp+7efFPh8x74ih9OGvvgncjGuTJ0y\neJ+hNZf+7MLkwJ1ofGxt1l01ibShqMMmnMiBXVJdOR3Q0EqKSZb02dWvw098\nu6IFan+wpFyfS6oZ6e8r2KwJMneoKTqZ5EHr/Cy2bT07mtJR4WfyqaLCGnJM\nYyjdijNBUPRm8vA68jfGF1vLGR+C577ZndDZMza4alyFIOvQ/gnB9uRX7rLM\n+ZKeUOnJ5pQDDBGoXGfu2E1LCopP7B316z8BDpcGYTHPLVAKjqDa1L+80Y+R\n5EWFj/em1yQL4tlxNaGENyyvOP2LR/AVOi5K36kI/HW2ocLTnyycrsWj/iRi\nORptTYrk+2d3ELI39T4tUTspREcedKAENhvPnZIc35yBYpBtLEIq/RwA6fGy\nAFEi6GqowhxuWHpemE3NtoYztWymvJCvQg8WJUrGV3qVdebVZircoaR9eUgB\nqwtVQs//E+EMmVqcYhJaUCvZgjsXlky53tihFj8S8ohsQjLsKJXDkNtbLOOi\nJ+56d6u752ClxT/iANxw8cq9F0ON97jXYojZNUdr7vPmNGv6v80J11QjYRFu\nb5am\r\n=mJLo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHS+78Ut/a4rx7FQkPFk+B+aXKBLFc/OztWNP180FxSvAiAjHzqnUGP8wC2w76oEBunP8Jm3eX0eONJKWVr8bFrPpw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2448_1630543021602_0.21596595265802665"},"_hasShrinkwrap":false},"2.0.0-nightly.2460":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2460","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"fb9818a7dcdfc930e3a2efac910a0e70964df05f","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2460","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-Hf5vXtCH0YWS5oVS2ftY6kR2fLuxE+jgaan+xEVXrQBTL2OwOtdVAyUHmNZPcf5GYIw8e0mUKfgy4tdzKCRv4g==","shasum":"ca768d266dce0c2df80f0c5d2ff0b29882bcb24a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2460.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhPUvXCRA9TVsSAnZWagAAUXUP/izOSVR2LxH92x0DXRjn\nmcAvavASBlqmghvjWDsycEu1Cwt2736wfumt9sf7WrBtduB2edYqPNJw8yuF\nwV+MfeygtuECPI73KnHKEUCTb2PGD3wO+RrmM+GEDpo25A6xm9rxDD6HcZ6f\nCPHc7c2HpSpODAOe1rLFFrD25y41pcjZlIRLVk6qLomoJGIT73s2Co7dfJAM\nMNEy0pL4PnSEvLFsJUyCUqgrNUxFqIFQjNMa8r947DV4f7aAeDXI7GtDpEcM\nZHjtG5Rz2PRE9F5c7V9CehCGcTRXsw3+Q3m+Ay9jtCZ/AYgnM0NAdPIswLdI\ncsuKY2IjR5/Ws5P3llp2TOSWpb3tO6b8yxQLxu4W23+aSBVtJXU2Z+JaALOK\nZ3DIaDZ78Hjx9nj3L2+3old9iw9m11YwS/7hFwXs1K8qYMUm5GvHrQebme+U\nRKs2i2urLP6FkB5w6qVdgBHXnBOAILmm2fPShhPGGa1QzKUUVL6QZUtDi80s\nVOQlzL/OMljW/YYUx3LDJ4P4JQEqeUt4arkov9OBizOfgePftLQr0kpFLzmc\nPjHD5AYPocx0EuczDzIOfkaEMWpTHMDMLby9FoHM0nPpYEt1mlyfkNE/VSw1\nRHddE6zJEHDYUd9Vj51RmvMH1H/WAecU2VR0CpfulwlcCl6LHiOBt1cFYQLJ\ngnft\r\n=vQw7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsZloe8hDHi3yUe78PgExugD3bFdRANug61raC0coVbwIgINakehP2iNf584lamBUSVb/0ANV2nAJ80rq+ulutFSI="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2460_1631407063655_0.5716307277265829"},"_hasShrinkwrap":false},"2.0.0-nightly.2461":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2461","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"6dc8e68c496f61dd31de3f1d753f9bc976845f7a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2461","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-QRD+KzzhJDXmtEdL23mwAFEnzMgfG5bJk5DO4yKmypYU6tEXM89HYrdZZ1zZznvp8h+DkMlpfUakW6Z1sJQ/iw==","shasum":"f8fb1a402b5ad4e56462a4136a426173e337f7b6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2461.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQUF+CRA9TVsSAnZWagAATWIP/jN+CeaVczk24Yr2mae4\n3nUqxzRItDbCIebqk+EkGOxu2iMoIhIToSzXyiYMRwK2VVy1Dz3Osvarm5ls\n2Vhqj+aQ38/47hZlj58jVUkz2uCbPRPTW91zBhcVT920WWdhdU9950Vqfr/u\neO1Juo/KRyuwx1brl1xbtMF7rXYVoLT7jvWeDma0ayWpjvhJHWp9eZhFL2lo\nQYacjmuKZQly8nACVaz6qym5tur4sTWseBXnW4LlMJyLkk/0zUCboOIfYU8/\nyge2DYTv2hi32xl0QnBgwlxb0IspUXjtPvAflqjyvIz03YBUom7bqxVDfXvk\nII0zi1rAsq1b7mqjB6V+UUWL8ptkKfJSnHJuRksTqy3YnpRODlDN4pyFH+7H\nnk22V/tM1ffWVgnJju7fVDlheY8tegRbaaZ/XrP6ZxSYl5gV0hmgJkNhlFgY\nJh9zyjMsQ0Y/JEFMKwb5yfpr5sKJBFiwBLYEePQqbZPTLtjoy9ImG0Nf73Ck\nuiSZakHdEzHtYpDXQB8txhU6l9jU7TedtpOt5HKbSni9vdXHh8lf1kucsd2g\nLUyslLAp7aUWcA9b/AGvxIbWnhrc5XH6iZEHICtTKk3mVkNLuPs9DaEAOlJO\nTCiJ7OCSDgv6CvuuxBN3XQmI0obilvSGu6wkyNbr60vq06NfW8J3kIaVjyAh\nWqeC\r\n=ADL7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHBBhf9Xm8fuY6S3bIVAi3/FdsJK7tGWPg586FxZVrwGAiBiRPy2SQfXZVA18jt+29zeAIBMBbuV/XbYhShjeWhTtw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2461_1631666558318_0.9915967906973453"},"_hasShrinkwrap":false},"2.0.0-nightly.2462":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2462","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"6f6759e5c2140aa8d7c3be70d56432258439ff19","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2462","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-yXJKeU4CWX28sOknOdFKGyd+fB1QNJnZZQYY2N3Rb/boKivfYAp0puMyGLH2FzH/X4UxFq0YTUrgyTt7PAg+vw==","shasum":"14562e909ca92402d0d2992fcbf24d9719638962","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2462.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQpIjCRA9TVsSAnZWagAAYO4P/AhlcMJcUoFSKxHZoaA3\nk7RBf00tgtypyRStNu6w55YferSUQ4hohOEyVFwKo3PlKUsr2bp8HNsEY7MJ\nrPiK4+Ews2JRJOOiLOz62QtcuFfgjP2uIF1NBSZpE6vHR+T+nqYMTklAQUQk\nlQP1Qzv4U5yAHDrp2cVnKGS7Y7DM4fUvY/eO1E/Cqf0pjTOINtGoMfy5veNQ\n+ovhLOorkb5lezlKT44xicOLFEnOxybTtuY5UBKKTqZ1TqzDhbLz5fGt0lsL\nHI+K/H3QZIau9nWb8VFGrxOcXt0D7DkRF+L8TfTY1zyqTMllUfZdWiiyxIEQ\nJymptJQfepqFwJ3QdLGacEOEbXCG8QzazHSRpYFTESnwrYVBzioK6ZynqPOS\nrVlf4VzQxa9U33ij8oLla3UVN0pbrfiE3pkKd5PSNdd73UVIUYy1Ah7snu9x\nillItTOMWA9IX5qoGaqiGPuWQvMrOc5/Z3dz+AmQ96v0KN9FDF3YgX1wMn+f\nedNOp8JIcVNTb2m/CpjNP5GLWepnIUEP/94bLAaRW+8Sg72y//+pZnQiTdWS\n/pL52GJiPTg7TqAwZtvln0vmkuznS0g7OhWBjF3+uZIpvu7fCUQMXEF0W8uh\ndPYjsjxg+dAaEd6Wz4ngLRbccLC+m5BsJ2sU8i412kml1A/CN0JqTYqgFRR7\nzrUb\r\n=GM/h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBfXKTjhiiw6+IG5+uaMQ8Vg+fU8TjdcnrvHPpY2vGKkAiBul/ywvwmg9PpKDcwfVtQ07Dfbu8u5DUl2CEokhjeF9A=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2462_1631752739501_0.35623822372509895"},"_hasShrinkwrap":false},"2.0.0-nightly.2464":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2464","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"2013dfff74468ee8a3a1dbed6742db32dd24032a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2464","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-mQOucpLPQ9BDjkiDrmYSFOvpkgG9Euf5m1wb9vCrCyi2oVCi8FHSuvanPvgVd6RzZH1aLzq1/QEXbxeAB5IDTQ==","shasum":"a3036b8af0a8b97cbbd7af1970823b8148731353","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2464.tgz","fileCount":17,"unpackedSize":75778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQ+PfCRA9TVsSAnZWagAAAq0P/jn2fVMZoVO0adG79gBt\nAt7uCbQb17lEgkvVvFw7mcQyMUxq0DVLdjvEYuvGOXmdztQ+mXn2GL1qKQga\nrFz0GeCi1wVCyqO9MGAFhs28uI/SmghHWACHHQoG55DDR1PjqcGzZ5RSZj7J\nc3CI36oD5K0Q0tdmCMJHCzqwTbQxa8XQ+xb4j8olh3K5/w0SJ0pWdgD6ZH5w\n2mPMJ1n3ljc9WHxjG7VaA2P0ZHbJ1R+tEDML2Zas4HVn4B14IRHzf5vRAWrJ\nX5UnDmh/bD7NU6wLqRPOV1Zx9Pt1gn6/vSK7mo65rkgpFKXO1TyjlYlGE0ie\ndy4V+unNkuQEygZmNmGlhq6Pq2A6Ldzs2h2ZgtR99SGXC7NZTop/i5vgRilA\n3s2BqavKbQdrzsq2eUdqfb9RPoKNnK0te1xgA1gv/SzuYBmsOjqeKfWql6va\n4kY6tkF2StpKdTn6namC/pNNitmvFzuWrXR/mCh11saNCaPe7muc8aPG2s0o\nBO7lys/2YEjFvpsWiGguEuUZ6vu1edC8N6KS0t1HWF6FDFotSowv3ykHr4li\ntjo5ztdsAxjlW3i2p60s7FhK49qB10W+IcdXs4Mh9BkI77PSyHWfJEnA9HhY\ndPt+eA/h2fV2iGVDkYVSniHafub4z/5SE1wwH6Ab4BtzTGUtpJWhhcDioJMO\nOM76\r\n=PCuR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFFdRQUTpvxHjjMD6mbtGA07H/vyX2lqX8eCv2rsBnSUAiAfbm6iUh457cWP8+MCba5ozGyjlB+VbQXgvbz+n8kTIA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2464_1631839199388_0.0451271630234209"},"_hasShrinkwrap":false},"2.0.0-nightly.2465":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2465","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b6faa0c819d562726ac8708f7f91ff0cb65b8311","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2465","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-XNCRy6oKDg9UWipgGMxCalclKjzALjY3d+FK3nrvTqOWhheylD78wdlJqurbqs+4Xh6eOR2W9MQxEYjliJ67rg==","shasum":"8e9164f558efa9beead37350c1ac2288e04970a6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2465.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRdxmDNHnT4fdJfJ6UlhbIBFSQ1AWP2QxOp3BT+qxe6gIgF/Pk8L1NnWTfag9o1CX4bcMg9w7IVtbcmoh4Iasds3w="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2465_1632011998651_0.23938995425438891"},"_hasShrinkwrap":false},"2.0.0-nightly.2466":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2466","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"aaec5bae96bebe3d90046a1a182303b68336dcec","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2466","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-oqSt4oEAS70fingpPSfVsJWij+SFxni78hfduyEJovFNsf4LYCZkig4BzQtuWWeK6DrT/CMt537TGDturt+OyA==","shasum":"bd62ace7bf8f2b2fd0fd206391e67e1df2a2f031","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2466.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQQ/4LlcaG7tZqnzwvnX9sA70WYRzkICTdtlC9Q0GdeAIgFsBZc6DVs6h348mUhEKKuUO5K5aSGDPgY1ayiHW2tho="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2466_1632184716700_0.6932281204418951"},"_hasShrinkwrap":false},"2.0.0-nightly.2467":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2467","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"1b980caf31e324fd2285d4301067191e4ad99243","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2467","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-eBmT1xzr9wY7j6BT6ZHYrASRfiZlwsZHKP41Mv5uEz1kZ2rt2W129sQlh43NiP5xsjWgfcw0eX7TdAym0YUHrw==","shasum":"66dcf8632d95cbcdaa9fefd8f4edac8d90dc18c9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2467.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDJMURRGyZGWgUB6HxuQLmBSM7NnL3BcMhMQPJXa1AB2AiEA3GP3BhfyrLXbuIawjhH15TcdPJ4Xg4aIoGEhgR4zNRE="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2467_1632357330064_0.5579239350516587"},"_hasShrinkwrap":false},"2.0.0-nightly.2468":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2468","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4308a0da19860b3a4ccec286a503af472fd0f4c2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2468","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-2cXyvO4Il9igl6/gJq8Jvsk9EApRQMSDmw6wO66rt01Zxmu7lxZyOQB2tciW9v1Te0Pxfp1uHhSRIJSpCtc3Dg==","shasum":"d6c41c43700b8979913abaf8e9cd7f247187b206","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2468.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCH0Sqpc+UW8P36NOYzsRbjyRuOc+K58FbW7403qm08pMCIHiCKzKjOkkqaMhJI4eLEPPw8PV1D85HMz7AiRewuQro"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2468_1632875790240_0.7774627862923928"},"_hasShrinkwrap":false},"2.0.0-nightly.2469":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2469","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8e1cfc90ff83b2ceeafac925054b46a3a2856bad","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2469","_nodeVersion":"14.17.6","_npmVersion":"lerna/3.20.2/node@v14.17.6+x64 (linux)","dist":{"integrity":"sha512-NgFU4PzRNc3NBJ2T5EX/FXQGhACtYQnvfChLJad3kfLGgf3mt4AsxUQ7AyZh+w9jjayDF7yaKbrxAUYp3pLr3A==","shasum":"c8b04db4e954fc3c26d19dd90a6a7e20f258a19e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2469.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDC0P8SIl2cQgbsITk8T0beGD6I4jpKI6OskwQ/Hv+MCAiBUk5ltGRLrOZaA20QR2u3EY0HGkOndUgefNhRKyv41fw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2469_1632897954154_0.8015598649812692"},"_hasShrinkwrap":false},"2.0.0-nightly.2471":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2471","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"5277d24b4e62a93ab7d42af8a89ee62a98e33d18","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2471","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-o3YyGICaZnWY+LIOa5ythaeD6sqQrsf04Osp8RZMIqNphoqSMzNQdn0uUVfq0NLk30Kbz3MwrCSPWmUSLnvn/w==","shasum":"51d7c95e53aaf796bb19e49aa28414a2d95ba65e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2471.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDyxFfmCbrJkm0UsUYDzdla0eqbLa2qZnHMDQPDIvWsqgIhALHDstLA2Brm1T6joWncPwBGAWiWDk+z7IHV7zfpNK/S"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2471_1633024833876_0.2256167355260652"},"_hasShrinkwrap":false},"2.0.0-nightly.2474":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2474","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"843eb50ef398f61acd07847bc12a9f72aef02c06","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2474","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-Llqh0j7d6Ejm87/RQaNMweQdpmd8JbD7+AQAHrN9aAhi2J4+y4jnjWQr7y8a6Afb9jPrJTanzuzj9EKtb5ugcA==","shasum":"418f4f9a342bdb0bf0d4646152e11f251d26462d","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2474.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEnshx/84NS3/JLFU20KlMwKZprvWp3M6dEYSkgBth4NAiEAlp9m30h5RbGoBHAoQGMpfjSx+QG5rN1Ddj5fp7Y6j1I="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2474_1633135254498_0.9920395439575564"},"_hasShrinkwrap":false},"2.0.0-nightly.2476":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2476","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"fa9ea38f214836890c418c8b002d98aed56e4f09","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2476","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-MgwcCXqCQi2trmERtVmFYHV9ObYlMhBkrbMM5hfOhWbCuToAzSo7K4TN72Nt6k2CV1PNknK3XDb2CMzTS5+fjw==","shasum":"b127235d383c59071d6a43b63afabadf16d3b917","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2476.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHSQXFRb4bPTx5ycVa9Sd5UmdYqih2rFxA+mDceucfooAiEAiUeOR7zYMROhW8pEjKEfjRTm+KHXDihN6AUcVbNm/sk="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2476_1633308130440_0.15177217379612884"},"_hasShrinkwrap":false},"2.0.0-nightly.2479":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2479","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"76205cb0f7c6cd15bd0869f9486c042f7e78cc63","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2479","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-iaJAkBgw3YoHVPhKrn+uq3ITgCuMAm204JsNUs7zGjtdMhySWP38QuZC02UTaT/012StKvYyRTs4unyOdFMJ2g==","shasum":"9f225e06f99135dd3ae9368ecd2cecbae83f18f4","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2479.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHb12z6yfxCzqrWlGYsLQieGsWFT97KT44U/umqGOLfgIhAOoc6T9F9B/UXBIaJ3YiIhdGh7CUIexeTeiAhUeWMjFi"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2479_1633394109974_0.6163972473736072"},"_hasShrinkwrap":false},"2.0.0-nightly.2483":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2483","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"375fd68988823186708e46e48f18750ed318f6a5","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2483","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-pZeEpJDxWO2sXqakt+LHuCWamG+0+AlCNuEGNAZbt4kDhEYn2mvjlGgXO6GIG2Cl4wSI6Usm47U3Er9jIsZ/8g==","shasum":"52bc292745ad8e21eda40b0fa72607558820fbe8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2483.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdVWLOJx+yi82MrDlYp6gdoDZC5EsULIHVeNxsEDLgagIgFs6KQuPjAkAZQQU51TGorrbnhVQtTw4zyaBYfqS1mUA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2483_1633480813980_0.07771204313396418"},"_hasShrinkwrap":false},"2.0.0-nightly.2488":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2488","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"7d4d53a098755d3dd494eb28d593f1bb4d5c1ec7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2488","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-7ly856SfoQkVhlXbuYep/wPzvgTSdLvaHUE4ZiCk7wjZy2enPfU2i2WCbqLHE0pBHGHu+CHrwG4RBrIArkATpg==","shasum":"3a9a40f0b8eb5c6198dd65ed0988557d8690cb1c","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2488.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDRfNkbXar9LMVuJv+mJGVxp9e99Es6aIqIWJjE3BXfBgIhANesyV3xI6riprbY0R1sw6gAo5De0I9+TZsU6Jo/UzAH"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2488_1633567213718_0.6658221079630311"},"_hasShrinkwrap":false},"2.0.0-nightly.2491":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2491","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d2d4f1c8b240b71f6115165bcec11054435aeb0b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2491","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-mIIQkNKNQJ2c363jbLIcEAGtJaA6XSIHu83jXkcN8Z2pNMTRGFWMWsnbcO4lv0lieibvlaqFEDki5PEufHVNDw==","shasum":"b8bfca74d7f0f358de8124207ab8945fc5ab4250","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2491.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCR0FSBp8EJ2HJEt0LZd0xPFlrTVxMQcM2aJ7L8ko7p7wIgBecW//1mxiVNsgVW3wXpuoR1Wumu/f54B+leGiiEJPo="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2491_1633653758600_0.7871808522696775"},"_hasShrinkwrap":false},"2.0.0-nightly.2497":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2497","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d6de61d33450c753d5bb30d06426b35a4674a98b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2497","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-N/PTIHKQNAK/U3yQZX3y+77X7V7aiGmPvOiYfkQPfzRmMzomscQnbLRrjHh0peeuMCxSsBtANL2MwfVzts7JMA==","shasum":"b83c5688cd7f4caad8ebe27d4d080a69df2f9022","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2497.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3TGeHo1zkwpL5R+iKOSEIndQhijwLKYNuJHhieYePpwIgLMZFbKE3to7w0IqTH4J2UIk6EXRjIF168P0/Vdu/S3w="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2497_1633739694015_0.5886479837398382"},"_hasShrinkwrap":false},"2.0.0-nightly.2500":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2500","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"5afe766e637827ede728ec7a9fefcfea691dfa35","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2500","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-mYyRidRHe8ipOVaON6zjKQqgS4TeXiue+Y/RBf2TWXM9JSlCji1oc4lQ9cDSJOu2+ShBCHPvrOxCMJN8/viV3g==","shasum":"2436c33be397460d25cef1802ae88ac8eaa408f7","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2500.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA9sKYJSvjAAx4A75ACiv7HNMaQNQj6gcPUXmcdapVgmAiB+gd+MldaGMaVt+/aW09VgKKP6WUdIwruVZe76JDG1oQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2500_1633826423074_0.7848856340616766"},"_hasShrinkwrap":false},"2.0.0-nightly.2501":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2501","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4312b91df293d15ad8f659ac2434d0d18ff006bb","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2501","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-rpVIw/rA65ghc05doUyJox29ftax7hcWt5ZVlde7DGxv5RuUWdTCTtbrNmqA9RryGrOPLck2O6zp/JIGUDT2rA==","shasum":"e57668af88bae507a08a0f745e6e1491900ecd25","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2501.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGCO5byV4qdIuTOFsIQ/dc05osB+8lFKLV2Gf9sL0iRTAiAEp7bl1FXDNjMBOXpP2SRhTc2Nj71WUj9JMlJFFxyphQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2501_1633912701987_0.07147042588683061"},"_hasShrinkwrap":false},"2.0.0-nightly.2503":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2503","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"bea9442267a7fcf9062fe58d1f8875fbc0493adb","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2503","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-qY5h9drmu9weZaNMDYS8+GYjTK6z+4p1pZ28OrQdU7FibGKtJnHx5NLYZbJXLmjSrhTkZheqa1bTHypt8KeywA==","shasum":"3c0350177b285e8837fa9b786117de17727badfc","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2503.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG5JnEU8Brqjm5TU8AabkOqa5Uqo8W/NcuVNHwa9IvmAAiBjVGEH7uD7w+P9A9pj+0pCSRkSgO1CVl80XEH6vsX4rQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2503_1633999126291_0.7270528961783429"},"_hasShrinkwrap":false},"2.0.0-nightly.2506":{"name":"@parcel/babylon-walk","version":"2.0.0-nightly.2506","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c78601b90ca7aeb87a8a38b6221766cebbb09c71","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.0-nightly.2506","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-CXgbEY1qZZw3B/qac8vdddW4VRL9qgzALZ4Cn0OaC0PF5v7EtHz5AWheIubIfgMuRRPsK/01v8cbxr67vgXcqw==","shasum":"20064d7ffead074299d63bd717feed5d2b4076b8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0-nightly.2506.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCg9Jx0AIIaHM4XQ3b77CBdDbAmENy1Nz2oivKi9oFjVAIgPj+hgHG99aUzC+2z42qicID54iFFBiaDDIfojgFWeUY="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0-nightly.2506_1634080433025_0.06780390711756334"},"_hasShrinkwrap":false},"2.0.0":{"name":"@parcel/babylon-walk","version":"2.0.0","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"84da50ae6943bff9741e2fc76d2f4968074cbbd6","_id":"@parcel/babylon-walk@2.0.0","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-eKABjg+i5pmgd9OtduBUMzhwB+l4rRmv+DOj18KnPIcr653LUUfQSWMwa/LGnn/0QRKPLVIjT0feLt1Yg9AvCQ==","shasum":"2937bb1298004a565c23ad4fc1eac9a34a151fa3","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.0.tgz","fileCount":17,"unpackedSize":75756,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHIuezsD4+o83FTIHecpGsI1K9JsqehrzqVBX7c4L2sOAiEA7r74voY4+G0SD4hhaSqTssURti8vMBTqDlu44qu8jEA="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.0_1634136221761_0.6220498091677304"},"_hasShrinkwrap":false},"2.0.1-nightly.2508":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2508","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"84da50ae6943bff9741e2fc76d2f4968074cbbd6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2508","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-herpxgU7znDDBYMlWS11Gfxdde0okS1nkMGRH/xD5mDNcOL/P7WcMXOrZGXAB/nYETggOlDbsPfdPTgB42F2ag==","shasum":"541385df537d898754b2f77308d93663b32d6ef5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2508.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBTpDue7MjSxCUFUWgoReSGDhcXhpI92VWTUaUQs/+AkAiAoCZRiROcUGTdwnAD1BikHZqxPIOnkS9day24fRh6YuQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2508_1634171975451_0.44835497181998996"},"_hasShrinkwrap":false},"2.0.1-nightly.2509":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2509","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"674539e13167275be17620f638ea2ceb98aa0c54","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2509","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-sKoRPuPcrd+rnQJcvcLUU+qT2l+GbXNO/M6/3e6JS8L4bh3m3K8E1YNBj2Rq0961XCcc4PojmVxooYS0S5pwcw==","shasum":"be96f5732b326b494d68dae656ea326b86787ea5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2509.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDb7qGpUcBa/cB4uQF55ggQt70cCMlu0zc/K4619qo27gIgfPBUfUBxpReJS+rmMlkIChPoMXzLzXt85uqXkL8SHP4="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2509_1634258477416_0.7768191913854796"},"_hasShrinkwrap":false},"2.0.1-nightly.2510":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2510","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"85b76e86ddc431b7140e114db5b16486962bf964","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2510","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-IgVJ/V6s23wFTOrJlA2eXRaQ6JTt5QyXXkD1lP+d7ckZfhd9/yGYVvqIGTZQDh+dr5k41lOrxXf27KsFAwGPjQ==","shasum":"a3cb90ea7822a553a58a4c9431fb1a49becd82e6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2510.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNuJjl7yGLs5RXc05N4KOYpI26DxI81+y+HulIK130wgIgboaGox7HaeDVZTtvgYAUDeNt70Lu3NWZZ0d/qYs7wvM="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2510_1634344815439_0.6313508682457869"},"_hasShrinkwrap":false},"2.0.1-nightly.2511":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2511","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4a62581dd430a6b12aad688f0a0ac3d087a5b5ad","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2511","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-K5lfKKM49VSx9j87YiYKaZZ5cxpuvkrANZVOhp3TARsCQ1un8/DgxhsC8Du62zZfDprFbgkRjidGnb8cPhgNCA==","shasum":"5d511ae225ae13865fae2d4eb14a17ed3d9e521e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2511.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICu6BIhH8YKfPuiFXPL3GLV8IiNOEx7Yyhzl7ApuvrtsAiBio2F6ooJqOoVCUMCqt8eDzIy8R4CAs+JJ958i5+Mf9A=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2511_1634431346545_0.555793902143878"},"_hasShrinkwrap":false},"2.0.1-nightly.2512":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2512","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"efe72271aa84936c4533a7a10f0fd29b84810cf9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2512","_nodeVersion":"14.18.0","_npmVersion":"lerna/3.20.2/node@v14.18.0+x64 (linux)","dist":{"integrity":"sha512-4o9VPLZDfZtWaE5AuOjNhXYxNj6Mu+a8P7oCXItxvYxSiVFfestpsvsx/lR6u+KWQLSdLACjODP2svMt5nQ0DQ==","shasum":"d701754f0c6c2ee4899edad7f225c5deff006035","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2512.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZtyOrRrDd6DKF60WLTdOn3KiraagofsZu/DoIz4OnZgIgZA3FDRggYn9pinkyf22I5apvFP3TLKYn9b5Cvqr8/pU="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2512_1634603852844_0.14984393441821742"},"_hasShrinkwrap":false},"2.0.1-nightly.2513":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2513","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"daed0c3fa3c1c5c52ab3e3a98f5494bfc3be06c4","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2513","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-ni3TuwtK7uCCduSFpj82MFJbOmIE5JJnYKtulXuKSkguUYIF7ODMW+Ccytlk9PIjjMpEb6XShvg0qY8s3P+Pnw==","shasum":"8d3cc95bff61fd4244db1cee0afd0d5aeb32846a","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2513.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFQmP3p/gEI3hlfWIcJ9XfjiaOVDXXJPVHyTDzgFme77AiBYKBjXjy6FDIK2WgfHhGCxFCBynZzSyIRDhEbEAG6OVw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2513_1634863231457_0.5138094282363386"},"_hasShrinkwrap":false},"2.0.1-nightly.2514":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2514","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"530e06a20b7ba5729b54715a2e00f6e4ca2ad896","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2514","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-Wyxt7ABOpI4XwFiXj0GJ0CTlMD5t3KPFXh6rvauiu5GM6CNuZgVJlrFTQafO7bxJZwyxrQ4/lYsjLhdD4Dz2EQ==","shasum":"f4314758e58e0a40d07f9449ac3be894fe984288","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2514.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+WfJzjVyKq+FJngdTzmsnGqnU9ttzRhtU+ZgJI8aTFgIgLcpZ7iMB+C5UzgVRimef5k64maV+Ux1CWek/n9eFmS4="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2514_1635122670043_0.31045049591255514"},"_hasShrinkwrap":false},"2.0.1-nightly.2517":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2517","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"da998f7548f4624bfeb17dd8a3ef17bdd96652a0","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2517","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-NuhyfAwzdXfBPM3kki9KKeEsgzid2HA9u1vjy/Aw+yRIWpO/IKmai9gtc8RewCeIxmjzTWpgvOBo8Om/j9hIpA==","shasum":"95a2ecefe04c6af7117844584cfb842cf42d0446","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2517.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr1fin/vhUJdbyMDR8GFDSDDcoEwGTRu8JvFLyChGh1gIgN7sFSLI6Wex0TlvPRKYRL0M8bPoqrpkX0G69NU2FW7s="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2517_1635295208784_0.6797112426507419"},"_hasShrinkwrap":false},"2.0.1-nightly.2518":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2518","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"84e07f22192f65a9fbe6bd56b2695e1e847cbe44","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_id":"@parcel/babylon-walk@2.0.1-nightly.2518","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-AJf6KFTHN2EsQeJ1Ue8bLLJ1yki3b3yXSop1iY/jR7FtJS+w7mI7vUHZV1JNnyyJ8gGjqMPUxzB7vb0uPc1Yog==","shasum":"9275c4689e1e9a70b18af1dd959ee686458d8aea","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2518.tgz","fileCount":17,"unpackedSize":75778,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMO/SyTOxy+XLP1KBEY5bi0zTItL73gEBVxgd0lrJYcAIhAL8HegUx9tcE2dLHFYIQppNp41ICExUXzDfJhdJROncl"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2518_1635381563204_0.5242357633995427"},"_hasShrinkwrap":false},"2.0.1-nightly.2519":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2519","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d80749f71a59606a235a4a0be667a902a58bb610","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2519","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-+npPPgWvPkXS1RK7505fR+TXdnKYSyVJIZKx/D6r28QdMqxz8Qb5qpQiPL/355s3V586SFxDd4Q/70bwZinv3A==","shasum":"93545e351fca134256e0a116c04d4472e1172a28","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2519.tgz","fileCount":17,"unpackedSize":75926,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE3rWtvWP0/uWC0/3cwViz981FD8P8VHAcb0OezCSw4oAiA5464cQklF6tBWCxVqaQtBbKJLT6j9f8MAlPhY2f6NHw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2519_1635554529461_0.5343868879114835"},"_hasShrinkwrap":false},"2.0.1-nightly.2520":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2520","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"c8a64c9a533072c12681ca0805d1e4d7481ee53d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2520","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-w+w3CQSoZ9Kt5Dk9L4uA2DSuBnFzJgfbL8S6qyualcx+vNoMX/44Puh4fu/geGTrwW4dEJtKJAdFA68voWHyRA==","shasum":"e535362e52a0216654b6c5d451561131a36d9eda","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2520.tgz","fileCount":17,"unpackedSize":75926,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYwDJmsDA0TDjGKDPP3CFoirTMTHay0RBhImySKnoJHwIhAJ4fVLxOnT0ETz/nGrpyeeFFOQScnHairAKBgI675KlO"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2520_1635727227478_0.7206110294930301"},"_hasShrinkwrap":false},"2.0.1-nightly.2521":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2521","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e0440dcbe6d6e419a412c8c568d94715cdb4282a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2521","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-HkGCTykJ+T6QkEPez6HHTGj2B5tLOigMuy44pp4KzhILL9Va88bGZCv2i6b19JQm24gV4PQoIKSOLu1nvld99g==","shasum":"8eda9e47c50d973ca1ed4825150d963a1a804e4f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2521.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFeejynKMMQM4gScFZFnASQyt8xvIeXJYAf3jFXep04jAiEAjL/Pqh8XSrCxkL9xt+cXpkuHLj0ZzU4URGAjLa9vrB0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2521_1635813830934_0.36941981064618346"},"_hasShrinkwrap":false},"2.0.1-nightly.2527":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2527","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d4b42567e0267dac94b3fba68232242ced5ec022","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2527","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-GrR7acWzVJ4wi/qZS9CT2A44qsutxMPAh9G4QgO6oHBfQZ2wpZadMby86F6FtPPDsc5qroF1qNtrmS57PhMqhA==","shasum":"4adc91ead0489147a11b59a7f8bb90593b915822","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2527.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNNWx/4Tb5AZV0fYEi4u+ui6F0ZfnVEc6GGQak5qeVpwIgUr6QIZbsZdAJa/rftjHroEMuOf4CfTrzQNv7wl2OSLs="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2527_1635900212411_0.08259411061442123"},"_hasShrinkwrap":false},"2.0.1-nightly.2528":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2528","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"52101af24ebab2b25f964842015c9599ffc00323","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2528","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-5UVGXlRl9/jg2ZZL8EN3EZQk/9txpXXsQ1PtP3X8y8LJiWkrP6PhTKHEVsbOWiQjFaMy3DW0nXcRtOtOg1KxEw==","shasum":"2f148dc87242907b49a9ec3b3b21b6e49dc0fbe5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2528.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA9fi5lxefisNcelZMIonCHFHiWf9p/vnFHOIblk8SdlAiEApdN2rWUNVt9z045fDu9y0MiBft1cYWvuIvSlxmq73JE="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2528_1636072945294_0.6452196909697621"},"_hasShrinkwrap":false},"2.0.1-nightly.2529":{"name":"@parcel/babylon-walk","version":"2.0.1-nightly.2529","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"d2a9b6bdd93855b468fa9911dad27a49e54e9557","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1-nightly.2529","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-rzVYw27Z84eTNnAjcI1BTHZwjKRtYtzgeZlv2yzkGJBVtCDy8SVTELjMQmY3rSSvybjoYD4Wu81vv/zrvoYMsg==","shasum":"bea2390c8ee810375cbe8e342b92a44cf2f634da","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1-nightly.2529.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvOp5Y2mX5Znyf5f+o0oBfgj7pk02z4FewyIiyAEbTwgIgK+vfCxyBApVJsR/WHRFZgEjI73muKXdghhl5lJfSoIg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1-nightly.2529_1636159277947_0.48433278038167193"},"_hasShrinkwrap":false},"2.0.1":{"name":"@parcel/babylon-walk","version":"2.0.1","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"28b47e6bdca7de2a06b7cc39a4a0b1df89f3fe15","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.1","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-eXlfG7ZGUuRF81mStZGeaYj4uH7Mgd8yfWB+c/Y13sxdacml+0vinCyZ9BjY7rYuxvKTlVSjp9BJW0Q0DS6THg==","shasum":"eaedb97e57db3d40d20f6140bc3303d53e103144","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.1.tgz","fileCount":17,"unpackedSize":75899,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC9+l+eLt6pVMe7NI60yjaSux9smVJtmvnJZEn/HsLDMAiA0LWLen6UIRGSXSnmJTF0OPa3HP+AgHRxXk4DQxBcUYA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.1_1636387253553_0.6181369093616553"},"_hasShrinkwrap":false},"2.0.2-nightly.2533":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2533","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ab0f5e1b25b187878e9fd9c014fb4191043baeb1","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2533","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-cjexZ6kqc1hsp3f5HS4lRVd1hLhKOmyz3yxebXuTFwmcJ27FSR3fyjtxqIYligCmmLJYumzybnBIzrFD/ljB8w==","shasum":"d4d02537848a5f38ab9f65edd0713aa4ffd62549","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2533.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbEtFIN3u6b9WPQ4/EUZhZEEjVTPElMnhVyVJsBPlZ4gIgSRTL8dJfSZlUNvcjs1CIhzGFM1lqv15Pms7vyXFnt+c="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2533_1636418554296_0.010706631970151648"},"_hasShrinkwrap":false},"2.0.2-nightly.2534":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2534","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f65182989334638e5fca7d4ce637bdf471b9b874","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2534","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-C0aYDLh/xalLTua23Vopln+o7SYL0B9iInHoPX5QXA09BipZr8VWX1BTf0JaltDyCoW5obGI4IAGOuaOjQ8RCg==","shasum":"ba6787949d4fb035f5230ebe9e7a766df77182d2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2534.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf5qoI1gH0welRQf2kzsw9opPBfln95Heha25MiohXaAIgKHRdYMnZaBj5v0UqtUzQgRc8nskeQ4AlnCvZL/1MvfE="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2534_1636763924877_0.7855470731883782"},"_hasShrinkwrap":false},"2.0.2-nightly.2536":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2536","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"145bfb8243c516765bcf5c59e381d0bc45fc5f9e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2536","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-dI9m/K6SuBZDA3VLwlwe7b9ObNT1lq+q+muLnZ9qNv5cOTcrJQq8EQbF9CEpZsaWaTYMrcTjQhA4JhXIk82h3w==","shasum":"ecb1c5f8eaff3fd2b56dd900bdb4c23645ef5241","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2536.tgz","fileCount":17,"unpackedSize":75921,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8DWj53LJ3Ivl2Cd1iJasjQrd8SyLg1vppWIQ0EFWu2gIgCBJJl4IqiahfcnndZFIDyPU7U1J0qdBwciEm712jasw="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2536_1636936716933_0.22940514559023972"},"_hasShrinkwrap":false},"2.0.2-nightly.2540":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2540","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"3eb0fc79fe22d5875e1d2cbf71d03773610818ec","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2540","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-oSHnAIYhaaVRPrUa7LYJUh9nFayHhhB9EjEiO/t5KT40xod59o1pc/8U5O19QvrqCK5+q4YAPxP+W8tlllZ8qg==","shasum":"c5fdff47a78b588593bb3545613cc594ec9e2039","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2540.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhlFDOCRA9TVsSAnZWagAAZZkQAIEkrit3H1ru/pJsigpn\nAxf6oJ9b7VSa54rT+E8msv8FWxnmwNojbvGzCsBB0BvlLuEcwM5WRP73HwaN\nOUgJG5I8E+eEJ/L1mPkybSYt3/kzbm30Q4VzXVu6gbCyeYgXkkSfBbZRRtnf\n7AeOZ1VihnJiGaZCIDtOJKNib+Unj+NUXzxmw/zwGY5Z0mbrTMIlcBAmvzaD\n44/gNBFoUsJTp8O5bLNlaewDkknq4iWlmFPhL+0MP8zrTe26zLdadH1rO4J6\n+ZeWnQLLdFq8rhYOvjUi71kChuBLaMcmXWa2vBdA669PU5vH35o29fGgNUPS\npNIO548e2aT0APSfvVTBLUML3raWJKY1vADomWJS4fR6zBLprNogXQHJog/c\ngxsEooJMcDOmJo0/o17Vu4exPqO1CTyWzRYngfO7/vGHVzG9HnZWOMyrpGje\n5ZYC/ron0QZo5f/xC31w0HRjmhKwWKzpfzwRZWoLmqM+sWxwo5qL1RexsKkJ\n8nZC1JmYjNZg2MSPpxjXXIzA5eQTCz7GKkXjJ7wzs4hjgVOI/B2+huVDxmOT\nbotnKuHfvnGiEZVxiFC8wx9r8TjBEG5yGbG/liDec9CjrCB2IsF9FZQ+3Ffp\noKRHc8j68Xjmeezm1phkyLNMPf9UQ0jEqJq6NYlTjPVw8jEc+HRGs3e3+Mgy\n3KW5\r\n=9lKm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcXwXStBUFoUyMcAbzcWYKvHUbZNENOQAlNrH0C3ufuQIgRq1MmzljuiQ9AWBZbReuhJwz/XE6OKrifjl+W3LJdNc="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2540_1637109965772_0.5423131543173854"},"_hasShrinkwrap":false},"2.0.2-nightly.2541":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2541","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"106939872e15014f45671fa971ad96fee27b2d6d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2541","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-3i2FJhAJ1Q3srwEugzHkQIKAwg03pSwJgCYv6vKaKvSDntxBq6kG86Fluo2J50CVrWsmdMtAY3tXBMTbGnEWRA==","shasum":"b0fb2d50f00073d526e1ba1ab93de3ed207e2fe5","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2541.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmueECRA9TVsSAnZWagAADkoP/2bhr14nrkI49ZV4qnHy\n0gnv71fwTDayOI6FMUVjfnygTCIBtOSLLFIIqoCmFQ+Y0gnMOpJeg5E/GhJx\nQrxE8oOr++9j3fRd9gjmUyYTF5LsDTvVlU8uPBKDOJF/VOhrSMdeFk2crksr\nhlRrSnYcoaiGv4xTcA4z+gK5zEiAMActCXckhrZ/omLfxZ1xjyeIco4uwvut\n5XjmlLPNjq9Mr/5GkPjz5WW1uYpac5EGKTJk8DiqopQd9Fuw+eTSYfuqXrGz\nKP61M982WY/1bMBf+GU5Y/zG8b88VCd8f9GZDueU2kCza0Cq+L6htnwBfGEB\nogoUvzNBvldGVoQXjIiNt3nGUjp3N6mlKDmV+wQoBld8/ZTgXTlGO/orP0cY\nS0fHw7q55neW0EDH9DmtJ/fwqsArGJ90ENVRzlvcAkiWP++iibEYIXkZojAU\nmR06vBEKSHjIEiOMnsqV/M81r70UaV9LT2jlUBnhPctJMjzktuhRuDijbIVB\nkH1Eys3pihW3Lphqe9V45Lu9+nRzWd/HbBrJOURAYvObkyaStFSBAApO/P3v\nSAdIzKkLQeaF5wnjkTYGIASrPrzl95iMEtu4JAudBIHSIt3hayR/CllAbX+6\nhtDR80HY6z9GJA91mDr+GendGLi/Rbu26qbcRC6riI7hjXK+enCGCo0lXndN\no+lF\r\n=jybd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDkcMNbLP5n5QA+uL/0vZ346kNCBgF7BNnWl/A3Zsk6iAiEAg1AiITnSgcBzmpeQ9ZElhj7lM4Z1Pt6dPSgC9IUNp3E="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2541_1637541764411_0.2821516164608351"},"_hasShrinkwrap":false},"2.0.2-nightly.2548":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2548","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8cabeae83ca838134a003a52be468328e15d19ed","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2548","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-9MFX/CC4SeSagbIqnshQPpHaJNljtxQ13T0fqS8xG8sNuS6eCK+XNcixMmCMAJDCMPVe3KwTvqsSuz3Vcxl5Ag==","shasum":"3f237f315d67a98d2f625621ea3cd5efa0809800","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2548.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnYmiCRA9TVsSAnZWagAAFCwQAJYLS9dSEN1RapLU3Bjv\n2wpFPY558RAZV9yCdRH+0+aRVvX8T27blFltKLHX/2SAgVc+Lo+an3iiqGJi\nQLF+1JnVAeATghq8HiUS+2gIkWRcQFQcJwOFiCSL1RLtygmXT8O6Rk2lNuOF\n6wGd0VKDikUMTVs0iB/EGi8JiQbKx9naFaYLgl0B/mrQfbPbVahb3+NNgNNN\nVkUBU4NBy4uXRPtZclPDSwWEwCyHvYSYIOg6rUS717g/hcFYatR7MSsNLQcE\nOHlygSXizCDSLbhXmeI8hCeRHKD8792A791lb0a8EecJGZKACXQHnSLSDgSd\ng5DpDC/+xw0gaLRyTVvKTQ+gbVZz6WSZ15UuKHqkN9UuW9dpQhhrq3v8Lpxb\nTCDQI6S2/iUQBUI3zVcUjpI8t8stoiaRJQHXYOukWDQFu+R7UomviRpip9hn\nmIbR6Vd0+lo/fQ6YNLooVD6JpLVIE4mlk07tOULEMWh5FoabTKAu1v0j+Yc3\n4LzVozSROFLX/wB1Y/maIlwfB+Oh72mL64PWg6Sb+XSCtVUZT3BP8MSt+Ai8\n0JVFyGt8SPMHGMsnmuyz6Pqo1GMtyxhTlcBEllX1dKHY4JzHcQomRJu/zz/m\n1ul7V6RjHhHB+iwRwzbYZMag18KE3Dnq4dlIF9hfOEmfh6Z2shA/te+v3Qms\nwh1E\r\n=0idA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbd1m3rTz2zZO4fyASfZr4ZnDhaHlM8MzG+cH3hHXHuwIhAOI9GTWk/WBXx/xIcoPL/74D21hXFoShF8t08fOYQPR/"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2548_1637714338303_0.9657960058524218"},"_hasShrinkwrap":false},"2.0.2-nightly.2549":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2549","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b9426b83f86809143ff122bde3ee217fb64a8d78","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2549","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-Kc+D/YY+XPmF5cjndgN/Ol86AqWHUcPqjLhvwysoAcTNXU5CfF7/MMCGUMZrNokzZS3l2GcZM/oqFlNLqFCyaQ==","shasum":"aa278a0e2bccb7c711812298ba911610b5e16551","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2549.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnttKCRA9TVsSAnZWagAA8yIP/RMPSU7SrBl9G+C/+j1Q\n4CI+/UXMKufnOXbXC1tjWmGGwbZTRvTLE9Yxzb1DCgPotAJQfktCtAzEPJgn\n8NCQBLwYN7V6BhUjxrFW/EfynQ1CcnxRz00UyGN8oUb7ngI9pdM3xsoIkDNF\nYSa+CiRltcxJbbS2gTe8Lk8WNquP80tot7YDK03ynlNPLpi8lERqNvU/2RmO\nUDX6kpOwA0EueJv1LKwymI7Kt9MnVINAE72N4aTtXVCTb6ErfM7UCQNO7peO\n9M824v913cMvFYTF52+64PnI/5Ymds9oARF0Jr5cHFZpvmBefUMzRFuR0fBL\nz/uViRrA2oV9aOPKtaK2slUImqrglT4wxlkwJrky7CdGFUIiGopmHF04ADhL\nz2zjnw3GU1FprqpHnuLP40mRPIjcD9l17Gbw/V1zVKLpM4cC9+JvtRNqPFFC\n5ZLPpmv5lCW5EPRqwdboqrKazA9BVN+QgZhHa+h6ienpOd2Yh9CeNRRH8Ijl\nhh8k2PolB+vJMQSoX6oLD/D+XowQ3hZRcyP0LLZBU8tJ0mWxwU0dj/VkgUez\nrQK3J96c0HH563bu+f2bpY7Go0NEhh39utcec6PW9UclAZLRrVuKXAVfmPaO\nMGMlx2OXbsRP3652Ia8Nq9InDgCjxrvJCDPTdm5u5wyf1f4LyC6eP7SjS3K0\nzGDu\r\n=VAfl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhXQQuFJj554yXtiN+gL9s2qxrH0dmIMSCtNp+K6ypTAIhAPkAWuIJs1MN9f+/O0VB9QiglSmnH0E0ThPQWhUGZ9mi"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2549_1637800778112_0.7908427523406043"},"_hasShrinkwrap":false},"2.0.2-nightly.2554":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2554","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b08ef9cb340a46c17ba388f6f7f97ce8cfeaba5b","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2554","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-BBnsoQUtW3tuuXkc1AFoNxKpwMh28XC/vkYe4luSweo211Pt+eMfYC1lOve2HKq5FkzEjKop4Z5wXctAgyhNMg==","shasum":"8bba84c809927f5f2cdd0a4d292ca7380569f70b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2554.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpCHoCRA9TVsSAnZWagAAwL4P/1+UHE5/I2+L9Ome8i+T\ny+QghCom9OfwwNr+AA5AXCk0mQMuFJkwiBHqv+wNzR0dUeXfodP4g1ena4Ff\nEsXYLi7M/PhCPW1ftQ7HIPM6Oy9Z4enTn1uKTjWdIGgbeZT73brlOJgwNKgs\naOJ3eIpBqcvG/SYiUIWQXyABmsbGCkkDsxjrjfWLG8qttCNE99jBK0VygMFO\nOHAkPyQkQeU3fG7w7g9vGcKt0wI0yTGnMqcPhYX53UIJJjAngARGYh7a55rS\n3eOGxVDH5r0meo4X5CTKF+XWGn4yH8vnFa1P6FTQv94H8bp21xu00O5c3APq\nrzcy8r932CWaeOR6SRSvMygwsq+/opz7W44iN8TtpPoT9cXRf/qo4O0jBjWE\nyLn2Ns77RAyrcVMTdXOmz+1jdq9cU20FjC/mEuU12g4BNTuhpr8tqxaVpZXz\nx+sMcb2XGfZNSvY0+8QvnZ6XTM0a6JBplu28JE3oZNzajBsBiDL7Cq3jPE6Z\nmkhgP8yN31PENjHIdhQOJHgTp7qnXj6GVy3ylVm6FBExJZPDczZefyVUpMvk\nla6j6o6HMgtjcQtanf3r6i2e3U77OSSD4oLL7oqmBvXW3B/DqSwx8HkoEdzd\n2umCV/c+QdDvq61ii+pLnatkHf4mMYRYIUn31fgRBLRjEJrk1DXRohL6pqxa\n9RML\r\n=pme0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIErXPAsyq3vJOnapshV1v16Ddtn5AYPpJXUtaXvfZQhYAiAj77L5K96mlpYtik/Td6BAUCPHJlA8E20+Md67N5q1UA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2554_1638146536742_0.9483833577126819"},"_hasShrinkwrap":false},"2.0.2-nightly.2556":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2556","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"cdc1d0e4e1991c623608f74b573be6896f5cdb4a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2556","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-8Z2xs7Q2CJuhDXQHmBEB6okYoHqxg137JkVx6v4i2xxn/Rc2k12iWeHk4lrqxAjsBt3RswRx+YEYXQm4vJ36OA==","shasum":"3d12b4d546770bd1a82f57c66b10ae5af35e51f9","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2556.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpXQNCRA9TVsSAnZWagAAZpEQAKGZN9SpEPu0v8HcExas\nwzIuireEhwmNAYq7vFlIJFqTB4a34Mi/tjWSY3nEJ1lY81dcqrqCGTylJX+Y\nF2hgc6jvFFz1HuZGgOYf/pY6dNEPYCrPSB0nYhWiz7fDhxIBrImV6JBYO21S\nG8rfvs9ZbOU7zwSXOgNQLnODuomrLaM5hzqc7mwvG7H00i760dV4y+1NrvsD\nHinXY/+NsuU90VR7aQQLInVfq45R+Ym1ak7qVQQaPoVlB65x/6UxSguVW77L\nGQi+Szu0bK9YrpXOAtg8xlvh/HBycAZRrPTQBy3TDTRwKuvEaC/iFmaKUbCE\n1Yf7KYJbWkaR4/W317I0vB6LZdKTlHZHd+zXQcd/zRR5xFArpwK1Mttz3AZo\nW4v4dGXyzEwJkEFqhnm9csqR/sHKDJtHm+21cmJLQ8hpCdNipRCLFXZIC/I8\nriyKEX3UIERbOv979FdLVvix6RFpwzLltQpNnfinpUEzQri0wTtOl3GvRnz2\nmJlk70e2HiLFni7diRutt5ubtWzFO+3n0+wLvk/XRwN0EBtecTVyol3GsPAV\n9DyeaZaMUuaGNQrkrNhIFjnygKlfPxCl4GaE0m0JACjyI+r3ejJRzhNX42zl\nZlxL7xyJqVvI84fl3uJzddbPXl1XCFJBmOqKyQFtUAyf/FSVlUA+RhbREzWR\nmr7p\r\n=js4T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE4bORoyapNuCNpodv8NohaGuxTFS1Sn1r+3CEbs7VIrAiB8Fo623N8SHEQ2sPngBk1qhSbX8YQ6e9txq6578Fmt2g=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2556_1638233100786_0.30134174399486335"},"_hasShrinkwrap":false},"2.0.2-nightly.2558":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2558","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"ebd1d6afc96d613b3cf65e73cf4e7272ddb1449d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2558","_nodeVersion":"14.18.1","_npmVersion":"lerna/3.20.2/node@v14.18.1+x64 (linux)","dist":{"integrity":"sha512-PUhmcoBb6odstWrwMLubPOFM+KBI86lMzpVO1LwWfq9DbzDoTZcg9luoAmMRbNxUEehTyiUHEOCme+rSz2eQPQ==","shasum":"736e12e1ac10eab4f2f35af533ffea938066b673","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2558.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpsQACRA9TVsSAnZWagAACAsP/j0Jt/fIvgv8yQceZ9O7\nF3JNvKvCbmz3Crxmbi4RPAVZaPctSOxeXHbLLwi8NPJmD63DPcrEZ0nlXksI\nl4FHjuA3ANLKCtl2040ovaC5FgFSgc4ZVnrb9Ws10j4eLn+zRi4sx51YGgaI\ne/2FCNc8uj2O0B6TKH7kcJ7WRROZ+fd0nwrXOYXgjuL7y/gJNLTNqpffMGiu\nybhO48OdGJqanwNi/l/H5XGctlcjCtiX4C3355dAq96SHn3HHmJGCc4bpH6Z\nmTl5+QV6ARX0swQUQi61JAcCVDpRFqmWPEf2+8P8piUqMXH5AWxakt2f6I08\n6V2ips3W3euBzHsukgB5zue88jxNQfwEyV26I43NRdaSaiAdRgjiX+QLR246\n3nCEQbTYi0TdwkFtNi91E+dK7fKd/Aa65Xq5znU2iGSlVDInMnU0ez8Rr0UN\nAYGPLFR89Q0rLN42GtevqTSLckyB0M+xoxnj4SXH7zaslVB2ls8r8yxvPZq1\nZu/CBwAR9ev5vV0kVf3O6wyMggL1gBoEO/zSiV7WuPxo/nqyoMrGJVOyiHEF\nDyfKNtex/8+n8A3mGs5XExIrwy0iL5AvFy6eImpG5lI8UhahzPAqAqRhgDSD\nZc0iILD73MgAvFsaIKw6i6ri/sk4biTVw9bZwVrHLiB4Lj+u0rcNObrkTd4x\nugBK\r\n=yoCw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBwzdpOCybzuGfDO2QYQU4EcXnxT7AvB8YJyRToBYwigIgQfzaPEKaR5lnhe8u6IuasP78Pmo/WGH3z5l+aFSqAZw="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2558_1638319104039_0.8434435575829078"},"_hasShrinkwrap":false},"2.0.2-nightly.2563":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2563","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"17404e9a9ee6323b973a681017937a4bc6966277","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2563","_nodeVersion":"16.13.0","_npmVersion":"lerna/3.20.2/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-fy3E1Uc/YH0JOA5sWjROPeRG0FeTjU9TQvj5YAfcclwdVYpNOar+17oO7RFJ6uLZF+wLdCGJap5LlDrXurjbKQ==","shasum":"ae0ce1dc581a37f9b4b0d9e9a659e025a40adb99","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2563.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhsVCICRA9TVsSAnZWagAAQVIP/1VhlOimLQyAaAZUvozY\nRc7AlM9enw4subLje1csTXuxEfyhU3YyqBcGXK2wuFB0eVJ+4Si3WwE5Q6HG\neh7yZ3Gn7XHMChezftPTb+xYeNnMgT3yPkQP9WP0KQt3/gaKd378ofh2bodm\nSLZ5fYEyWNwlH9Cg9eV3zPumyBKkxo6DA+X8giWfzKAIwC/w3YKZOlXMQ1TW\nyTBdoOJ1cHzFgOwSdY8wApukWqNsvtNMgKnrVLcJpcV/sAP1iIi/zwPXSTl7\nQTlFguxjk2c0IGvqiYL6FoJlRgHgmRo9cLDvwO7Bdwku9D1ZGPkIua/TYP8b\nKOQMC596O5eR7Oo4y5Q3cK6A9lEC5PZdvKkGHfnhxU7hUPTaSzeW2KJyo4bj\nZ1PdWHNWuMi14OpX/FoshoMGv7lCuAWt9Dt445orvQA38TLUzGxAwrlRcVzA\ntRxS1UBxN7yNvggzDZIbla4WNyc6/myruT4ZO00Np173vi8toRqnFhFHtoDa\naZBYxi2EwLgQFeTT35I0EpyT07/pk8QiN4mzJpgzAsGTeC73NccPjotkdY4E\nCMwI640Jo1kATCSUOzaCA6aLx+Hq1uPyHNjsNhfZws/6ITbHlS0pwBbq4+G6\nM0e78SIcv3v2nweCPb8EQzXrsGuEI46jFrpgxQGOw6FsRcC7DgHO9DwE0ph4\nNOUQ\r\n=6c3J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHBtCU9qqIoT9mF+atPiMAjPOB62MTTzmy1kdhQh/t9lAiBvX9hltK9qRAa4TvOgXbl/b7AUMgJEOsWRI/h+5bazEQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2563_1639010440057_0.10593388347108368"},"_hasShrinkwrap":false},"2.0.2-nightly.2564":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2564","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"b27515ec0eb557971dfe83ad3692fd208a9ee397","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2564","_nodeVersion":"16.13.0","_npmVersion":"lerna/3.20.2/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-c+08do5ehoe8aWLzLcP5YGPWlKSn8g3NwAF9Ya+5hU1FSODdeKgp4odwrGS+cnKPvX1alR46xolDtiGJ7Xow8Q==","shasum":"76665d5a8e8bd84e9b9f49439e5ef6570527ad9b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2564.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhtUSOCRA9TVsSAnZWagAAw2AP/2yrxrBb4dp5AanRt4SD\nhmENYblmkjqmmI4nTR5Y8kl6rU1KtdUmoDpE9s0c4m/tsHCg7Qo/mF2gNeF0\nWt7/oqRxVwpDygIkgDYslCRgVkYwe8x0hmL/+r/gQiN699zMtTeEQbqw1rvo\nmW0IyyhsJ9aQYKmKDr4e4rVKEbj4drBY+B4yU2gcY5hof+fQ/ScnB1MUQeoU\nFNwPQueR1NNmSU5U5J7B8mvHxMmuZwHFiyv6FxJ/xLPJNZfh2Sz4S3H6dSRN\nHRvITUXBNOWv62BvhQAN5zTHOBYWh5Ld8tPouC8k62gUI18rDvHyrdwD4kbJ\nS/MjFH2tYydj82s5Q4IZb02/2iFHuXdbQLWBjP/5qZud/RiAwv0HvErzvQwh\ngAZavcmUR31e42UrFZZRntuG7Q4TM1s36jcc5D0mIP6JUJ3M9BdwouwzHYuY\n6PcWtifsLh2EeHfMEZcaHalQLr0aXx0MvQrIy5Wf7egEXu2HbSdmErtLeqTy\ns+SJt5+5PD+ahuueXEEpImdWWdIeZDRY94hJCQSWT27xyvB2qp4VFtUFdSKU\nr4g13OT5oNCOZ1k4dAaOaEhmJE77sPV1+Hdp4wYICHTi2xt1vyJhkm3kZ4Pp\nAH1tenP2qL2BBk73Lv2YN9cLgOdyhcrZcLXkPbCJkOBGz6wWJxTQT/8baPXb\nDQr8\r\n=6PXr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeefGIu4AnJGncIodD4IdxRgVnL4LJGXiUxwMbwmWCWgIhAJhiYi8QVrLjb1XjnpWwIxngYokLa0s4Dnm5jGFZIFtZ"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2564_1639269518701_0.17024105911257026"},"_hasShrinkwrap":false},"2.0.2-nightly.2566":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2566","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8ee562aefc03a8ae4f3008109581f4170d7bda66","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2566","_nodeVersion":"16.13.0","_npmVersion":"lerna/3.20.2/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-gEDdP8zkqTogpYV0OlVfNLiskOrKvWHgv56umfT4Ad7YeXqoCHmj9Kx0MhfTIHYgvPMBCqw3/1BtNYtOh7RAng==","shasum":"de2b51b5ebe7a5ce993e32d1e2a01c3f87fa33f6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2566.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhtkA0CRA9TVsSAnZWagAAiuoP/1YeLuDxxYrCC75dGb7U\nFR1qVN3cVmddTXOCTUmcJxh3Ddn6HPioyJR9ZSSmN3k3xUumRKK3eA5zx/SD\nJ3h+EJsLZkew81A4y4yHK+q8sHBfytz84BhFJGFUxM5gcz1Cxlg6HiSBd6P+\n0tkB5Hh3esUEWdbLPJ6qjM1kvdRnr9uhbaFhioGUZmyTp1Yn090BnfaDL7Yv\nh6y90NgPV7Ei7B59FBf83OOSNPjM/EzbarSYzNGUnak9+TLGJOsB7YiWE/q1\n2HwzE+AkdJdnrf47chtIqjBXOX5fdusZi6pv25X1z3pO5MM9vP5pshpVZjcy\nAG/DB0tzKIkSZu116jQYzhp5SgmZgbRxmmQhZ9VzjKwxznPfiPnlH+k9le1X\n9QajCP5n1fGfbKDs5BuWryxt0e0eNU81I1CJGJCZT9qzkOy7hcWFTauUtIo8\nMWj1dsQG/IkS4n7eLsXuTAnAFWdmDs4grYB/YE/KEAG+AT0JXcI6aW5E4ho9\n5XDEwWank7RGuvYKUkfxWSd095Yn0ESzPaLy5AzM4wN3f9M7qJerRQuWTemb\nTyswDZoTdm6fQB/wEJE3PFpJ0owSQOkPG256T5nsAsAEeSGRgc0m/RpSrHQb\n28KFS3gwj4yy+X41wUsoa2M1WS3Mn039/NiVqPAjklj8d/RRiTqajo92GfRW\nPs4X\r\n=ioMA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGD5mXRK4TN+ANfyNUSPtbr0VpSpCn4SkEh8/NN1eFwcAiAQIDCyYmnu8LphixNGZO1lfCEZkYZRfkxOHWEqTeHu4Q=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2566_1639333939663_0.11388414575323691"},"_hasShrinkwrap":false},"2.0.2-nightly.2569":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2569","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"68ceb5581497cb336e82002fafcec53fb6cfc084","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2569","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-FbtXLQf5Zh0jRwvvaRfq6mSZTmqz+RmoUqj2AXPYf7qh4A1gmxLNj62bvbjZVV628nbykiAwTkd/q+1X5XO4Wg==","shasum":"267141cac962f2023de26deb1bdf233d1fc04dfa","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2569.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJht/AhCRA9TVsSAnZWagAAZcoP/i+cOG113YjZz3pFX1OZ\nDqJq5Xvp0qoUrWNf0PedlScqoBzBeUp5X240iSihmjqj9xEVkMSpDxpJZ8uA\nWkeEZj2Ib8QCd+GAE1elS6CGfffhF+QLZPyYx0HyNK2Q/HRnsmYsqkX/NHWu\nJKRZJ7kYQRPj882cwW5DuadOzH3IwEr+9KW2NkvxSt75ZXae2pljNo79kPQc\nS2IROurvS7ucabT0ZBm9rFXIGOST+/38Q9mlUHlDAQ8+hHwMffyEsskQpQ2C\nS3QlMMPKnK+nRXqkdyPt+ERCPzmbucADjpngZDLVTpq2H+u8it1wdhQLF9xW\n5F0NMej5P3A1VK+oL+VWXAymll29JH8zaxSaei2C++yNm7vLFYKmWwGP3mUd\nTi/4DYGzITM8QBmq/bpeXwURc/OR5CAIJirXONUUn7/2kcPIqj3ZyXPosGSi\njns59d70vos7K0oy0QCQvs/G89qvAw0oYM9K8pcgGMvdLs0BGcPLhB1v09tF\nEiANjqXuGSVAJXtiTtksvahFgUWGnOHjkjbWeM2Y9WnxkAaHkk86BOM2imV1\nR5sj7IPSmANssjhiKX5DIcKWyBCn05YjRDdYDkl+pyawa20FYsaUBmYUMp/V\nm/5pHtHPHj7uVjwkxMywD8BF/Px1pGdQpMl2NqzpltjCvGZyNd15zvCeyZ+c\n8+gT\r\n=qYIO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxEgd2JY0DTfJnwKV2f/alhgXw1T+woNH2WY98KSEhxwIgdGTn5ER2+QO7K6HTVT63rYgNfd7DLNbCN03CsKXNK3Y="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2569_1639444513027_0.9416144689931905"},"_hasShrinkwrap":false},"2.0.2-nightly.2571":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2571","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"588bf4c0d6d9dac65a9bf89bf734d7684b523ca2","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2571","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-mDLTw5kWrIP1Zfh02tynQS9eTLnUhcSY3VmIcAM+yPfZ2GdSj1hsRxQ9Ubdu1ZEjw+G5BD9gOrNayt671H9hXQ==","shasum":"da47d38f0a25ff01f63e645df6dd1f88e99eda98","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2571.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhu4+BCRA9TVsSAnZWagAAHZIP/2XP/dwg2fUjvquU29tM\nDk6m+RGIxiBeQGSn4dD9AtTHnMmIKOzGa7dlm7JqO2BH4+wiar4a6FbanN1P\nKjgdaNGIrLNgsQ+Sk0y+CllMmXT7LW+snfcbUyhDoaxEsU2hxTa9zNB1QbWB\n+aHlougedVyZ+yobNh2C1w6MmXE9eoEqBsdUHDWilYFauabyXlzzwG/TVgg5\n0hNgUDlGbs0zrd7limiZquNwoU93qOaqGQVXC3D9iA/yI5dlaVvjzrj2j+bH\nDcSDqkh3IS/YoPz66JzKDK/ozT46mu+v2Nb4d1okWWfHdJhrvD4tu774y6T8\n0rcNVT7UTpS40paqWu97nmv5wjROvmA0JS01fDfTnIqtOWZplwzx5ee6DV9l\n/HmWGW3jQjCQM+RanZHzrZ6D2gF5lhiGXcLBHMaLdFXCuj0ESpoigNhxBjPS\n5nWSGHnR92oGoMyEpBl+13OrM6G6TS7YB8VVMdqU8aw1wXDyz/KJkzt1+WGR\nCyXHl2OhOqAH/UwENiKUtBfA4rV25x8JUJYPukWi5ZpAZrXdvZ7lktC68EcZ\neQ9Gz2w6+1pRq4wbgQsebLiD35W3etZ+4At2Vc0qaGaLp6sZcCVk/+Z9nNay\nGKe1CGFAGG3BSItFRn25e/ecEROgK1Dr51lBmsve/IYD5FH8DzwSlH6nmcYU\nOlIF\r\n=5uX0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeJVAz9mYDbXn/BjItmRM0eJhvSnP7lL0ndsJSvYA3IgIhANcGMh23D98SCp/wh7kQ9FpdWeU+mrH39KYzSuQDXMtr"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2571_1639681921214_0.21164167575426518"},"_hasShrinkwrap":false},"2.0.2-nightly.2572":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2572","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"eb2ccdea1287f6e42566ce0fc1e1e3c7435a9734","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2572","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-o4TGaQMHVESK+5KWDdBn9L79tBeQnyTjCsZOLDFzgLoYogD4lP+bTumjybYPU1tnyxaEHXjwsPqpXybo6zgrlg==","shasum":"7acbe91c580c0c697e34511d4220d38835d6e77e","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2572.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhu/gPCRA9TVsSAnZWagAAQp8QAIvQXRVGCfJqKjZaOP/q\nzro7lZYaUqN+dxxcg8x45zkoDDztQw6sHHDIeiKW7kv3LC5WV/yapsptYn1R\nq7j43JMB9ZG/tYn5UP8lAx/+Bhu5bSaUtTUptYwIxUUfHIlHlekBjsxEB0nN\nX2rB8tr7FOkOwDK/6tojoOsIIwie4zC7TQc+BxQgPG9N7Q+VW35eUVTOVUdi\nodYDWvUTTcveqolX4Ptv1glA7Vzz9tqlJqmgD+BiuPMpVC6A36odMfM3Kb9U\nNXtwgnh+ouz83xCx9qdZPKyyY5pjm7m3zTkXm4E8m7dbVgPaZtOURGjgG1Mc\niVGOhaynS9cU6JV+3bul43XG4AgYNCR8U/viv0suJiTZ236TNBg7/LSepPTQ\nBuTjAXeOVJ6FOBM9ak2uA+1EGp0rYtAka8Y6RKo+1cQHAIDGFMs2P2ed57xs\nCDs0Sogqz2ORaKbfKD6QzhfjYJIrBpfIcMSMLXuXlIvXUcr3V1zUouhEdHtt\nt4MTUkcQZSk0CXZvAI9Jf3c2j8hp79tZhr+owuG/vbeLOHWKBS9SiQR6/cF/\nFie7CIeT983HEmMWKFBXAqe2dBZBuRT+O2pR0vejK2omi0uhBV8WAfnVRgGN\nu4HAuDTtdBy1VWdTY/krv4gzYP+rr2RT4gg3+6skf9epBbJ3zD2F9GCjtHyJ\naaOH\r\n=IK2d\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDE4LfV62GpUj+qzcM7h8+6mYImEyFv+wLEjmPq3nTSBAiBbEU9rjbYdHharW3wrYVvZu0l04tJzCXfq1qWCEgksWw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2572_1639708687374_0.7623989152635973"},"_hasShrinkwrap":false},"2.0.2-nightly.2573":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2573","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f5ab4677f0b01c317756b0bc0e8f759f1da49988","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2573","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-DNVipbvALGkhCazhZ56iRSCFNGiy27A8tQFaD8nsrbezWuShlW4HW+6lKOWloLeQ2lSGlckg+I+/OR3On9+dUw==","shasum":"4522d5407ea2cd0a8e8b711946407411e8978695","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2573.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhvQcCCRA9TVsSAnZWagAACTEQAJEkipVFND7DwahLVVv6\nDOgc2lhUcYF8+oAWuaMy3hh/vdlQfOc+9qvlVj6+GbSlO32Mxi+83Sb2Ka88\nNxY+3Y6bEhrwRacoN4ZVbjc/FDDgNYZ+3ZhiFxdd+JZfLaXLEO5GsgvT07nN\ncywPw35+vLCBabt2xMfUklr7aU+ePLNyrIz0sL+zH03okSOeYpK74fVbZLzt\nrrcYWDSm1NaE1+5sdSyiGpmmbPvKFHAVQRYXnuv/EetTwtffRqYJwUv+nhA+\nVPpGkZP5cWoE7KY/P2ZJcr2Ff6ZdglxGoypyzCq3LIj87pqDItyp+WHNgL1a\ngpV1/TTw0duWacwrOjpGhZA6ohQ21JllMSPHCXWv7aBuLf3NzKssTgsC/38v\nyDJaMgZLUD1B1oO4bq5m1jI9lDUi/7DMAQe6My8Vwffr+wsKyUerb1Avb2aH\nDLHEf9i2rZx0ehmBsclOb+F46ai6b/cEO+qRHYIoQstfE+5UO8VV1gw61epS\nc7vBse0WvJ2LnBFXXnild9CvQCZrNab3bLCWevOEqb3QFxgLkrO5d36yewYA\nfQ7iTpiZJnq0/DWmkcDatJNcQg/6Q+4MTgn0WG3kBHb2K/fxeA1rW/HX31Uq\nObHoVA1Yk1m232mhrvmCaqr0CyliliF5yaWfQYifMoYtIIcsgdC+DPfXaQmZ\nCpSO\r\n=SQG+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBq2E81tx2c7Xe8btOftcyk3zeFknfxMQSLBAMmZxWg8AiAUu8ZLUUbdtMi3OO/6p3OPKNFW+64FtnjMMsRauXnRRQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2573_1639778050659_0.23037996337933508"},"_hasShrinkwrap":false},"2.0.2-nightly.2575":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2575","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"8823770717bf451da2667b4d0d24b8915698856d","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2575","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-ZnIURhsq2C8bD95ic2dlgftfsai3tQCtnI6LlEIli72lqAWR8Uvhuqy26ihEhoTLSFRHx28CdCyEc3z8WIX4Vg==","shasum":"077d832c3794506bf0a66bdc5037bc69b431a6a2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2575.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhv9C0CRA9TVsSAnZWagAAIFQQAI8ztZ5qXmVnuTR9kQSl\n67v6pvZ5+CmkWleZa5Tp9OVJOBmeyxKOCKz/Nc+COgQIrqtOe2jmqQaRKHhI\n7Te0qZJpGkGghj4pdkj3dZSbShTjnwYJ5pXAN9DsbDiZUmfU1qNUo0+6qLwp\n91aMpMzl/poESfhCfTC8PH12+uaWupL70zTEpRU3fTkIWc5R0/wubvdyvaFs\nK5gRPrdMgcEneuOyAIX31O5GQaquw3AUjTRrTMQfDGlAb+G54FJeMVCUfncs\nLwaKz+BzEWEi2rJG2ynsr1e+hD95NWw1joVxlZz2iTLC3f/PGy+rbhuZF2KZ\n2JDxouKSXSvzevzjwlSTa2ttYPjnKPejOnnyeYU0d3sNTYiyIA4oEs1XRMcg\n0Ldam3kTRmQYshSA6mvRarP3SnlcwstW8+1p7CG2DrSnbyCecNRgNBDzhva5\nQ1ayJ4Os8W0DCbh1C69EOigAekksbuAUfd2MgM9OfXtzwePexo6lgU8Dx1KZ\n6P9kMfEIyKdshL4d/6aRxIYb9dvynA0GzULQtpW2KFe3SVP+jxpMXRd5g+Ag\nhA8RzzgHAQNITWFfyidF8o2qNEdaW1I6sgaR7HE4ofkLcB+G77WTeLZ2CKYo\nckXlrZrA7nx+e/VrICYHvDerokorMeJNSxktVKdTEojSQ/AdkVPo4JFF8ylR\nWpPj\r\n=efk9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHTwLyH1VamKBtunZFjipWbrgU63lwgEenfjgJToBOhUAiB1MQ8avAVgkPi39ijIb1/X/lHez4fkM7Nsp4Q7drbBow=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2575_1639960756681_0.6641215806340415"},"_hasShrinkwrap":false},"2.0.2-nightly.2576":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2576","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"af76afc12109040abfbe0eaf13b2465ba99b1678","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2576","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-6W9CfD2WIXmpCS7kqcLzKQE4L3CfEt0Z0PREmmjHykWZ6yMxTgx6qmhwgqPowZnbpxErK5SkAmnxjjHH8eGA3w==","shasum":"d0d9970e1846ca180176e0fecdbba42a98c794c6","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2576.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhx7ziCRA9TVsSAnZWagAAZY8P/11ulrKAe1ZfQIrT0v+2\np3n1NaHb2M5qVJ9SYkLzl6sAKAuAs1PZdafKnyLIl0OCa9dmLqiaGxdxZNPM\n40yxMM2VaYeauqhtayvzy54uKaO+TE8PjE2dfdRGdiuLcgGvhzWj7sfY4p8N\nQMIBmCjFi6IGQ2zEnbpgN9/XuJEpWTExM15iMPMO0BRYxrne1Bvj1Ofz9iFU\nGnQFweduJrXTsGILgaotm2wP9j7dF1iegGD3x0uq7Eijw4GSwH4Vzcz3F6cK\nI8zA8KAVhQunvBUOsZTvVBM/Tg+A+5g971xRxEUw7yCAqubUjJXR172XKPJW\nh4c6WHbtgSY1WOv9voCB5GP0L83OMO8foWMg7ziPSpUhYKnVc2vzQsFcCBWe\nCo+fJ23N2dX9WOqCwsNDIhTp36P76kEioKJ2stYtlaYfgS2v5DAMSKW0hCc7\nsaE8e6Nd7A/pFtMdYk6Q9xIcL3+Ad8MSP7PtK/ABUZPXryJ7MmZVyNCEAlFg\nPwbkLKCz/0Z5nvRn7ThIDgsbJOVrf+TS3ZUy7YfFXBk8xBIqi1ERhP5Uei8u\nF56vKbHsfTytbVEzhbvu0zSdyDOWYJNgJQwV4tsutRuwYPdlAvvhKdd6alEJ\nqbsV/p5LkvgP31ihNrfzTGBAJJ1VI3IsqDx+svyfcx3LqZ/BWfRrsG/uq3Kr\nypOt\r\n=Jk/+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgw5M778QSncSzsSsBFGlZbbY2lqHLM3pj02ObGDFxnQIhALYossKzLDG8nRlQZb1oxfwsbnUFwT8ECMqt0LtT/E8R"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2576_1640479970125_0.012089849056872826"},"_hasShrinkwrap":false},"2.0.2-nightly.2581":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2581","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"13649c365d36b40e548e34e2e278bdb4cd1de48a","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2581","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-KbCao148MVIPo63vXiJ6Z7aMV+J1BKJw/aNlvcLiNtWCayA02LEWKGPQe8LFqx0HBr6oi5kOUI2gXqR6+/246A==","shasum":"7b729058e64b3ca992579fe2c499c44ff12bc983","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2581.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzP9YCRA9TVsSAnZWagAA4WgQAKOPshWv610vVs3bW5dE\nGZLIMujbGqJrP7cPWSNXzet/737T99+P3PwLFoUUwAq1OB8kZyoslIuedNhj\n5VMv7IsxN4efLjy6KSJfHaAJOu7udUhFjDjr1itirxvmjxqf0gSD1YKkIxxT\nQqojJwARRkoFKk7kh5wjizS6rVNh2n2O79cyaqiJicQmDW+SM7rZiFHvRYI1\nn4NI47aaCSb5xpo5LFFvqDhSulasaFT/a3ZAWRbAgsow11i0I4nkUxqJR7XO\nHwktpHQ80Od+KLmLum/SG8VkBnuPsjYYQQky2DLVReK2A7zP1q02Gm754gUs\nAFxLgXyFmUEiuHZf4d/Mbav/1sjeghTm0S8NsnHSJh38qOl1c6ubgsxBab8R\nWWfUOu8qktsxaawh6DwnL3Itp04smRTRbrA6nN1Awxk5sd5nnbyLqqcf0u6K\nc47SnrbtY5hE1Rz8YynZEzf855nUqJrIl/cPOKzlhWm3GCvxAjLN3uWUNt/j\nRrN8zh5iWDXDeRxhvI7zxgrYzudEtxbhlszudSQf7ZtlxpNUw2aQZC1XHblf\n2HZ4yJ89dQK+HkL5AfugCu/GuAs4Bh8en3dH5TinFEw+u1kTk9rQ5Oeq5vNE\n8c6SsVubuFaIkSPGwxoQyq2vr1vCXAL1JFMiqwVcAgmuduIxujQZcuWYziYv\nYpzs\r\n=Yc2p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKzgfHCKgVKL5db8wqkOiOOZ3lSsW6rRJmrYkHBBDMJgIgaUJ061QRoQWg88bsSXRytQ5570aprtEyRmP4cMpOa50="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2581_1640824664713_0.17296580584370558"},"_hasShrinkwrap":false},"2.0.2-nightly.2584":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2584","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"5746ab1b59bc90230435b78679326b3e5ef0a5a7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2584","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-sDLS8Ln9ILJLKfsvdbFOM/62O40J6JF/E6v9UGnoVEL1Tys41i2ckq5PFw4mqnQ0nERkKM/Z1ty422y25PyTkw==","shasum":"7765582f52eb04e1d6bc782a890b209d757ad7ce","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2584.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0POmCRA9TVsSAnZWagAA9PYP/0h/3nBLnujlsXCqZ34a\nq8XYkG3PUMfqbXDpbCC8xC7Rd9lKb3V1rBLQwwPkkgPegHt7cO9iZGBIytrU\n+hQa1Ue1xYz2UUgXnVULv5p3bjr8gStyy1+mN6TpiylpmSlIB96T8c6y3bqU\nZXptppmNHkIYBPwUYUu3z4uDkRJM1WgXC30DpUge212fC0jtwmLndOJmh/90\neMEvP5a5fnwRrNc3bY0T8ShTV/nMyYuwDLeoaGjxgLE7BAua/SuRt7OS23l9\ncCGXuexNNoaLtcPmR2kHpb6lBQWYPC4U4oZe9Q9/LOUv8ALOzwbVBSihf2SN\nxiT0nY7vZHqPNR/VHB00wfEmTb5SCMmHsLPIVcVbKq7YHP809FSLjgQAqye8\nCrjGZ5g5IKgBRcLyu3xvpZTvgsoCogDEJgeSORjcqha08WJuvnOe7mLvjCTh\nbQShPvcVe6mz2SXYe6MA/cg1HXdAisxgvALGCR7HvPA59ALwj4Qmu7OmwGbb\nhpYVjvL5fg0Ld5nAujo9DwX+KQeK57k3/a+A9gbFCW/apCtD+W1tgiYTBVtg\noV9NMViSNn0FlyEJx7f2eBLddfKDgqXQiz/YVlavdQTGrEwawsto6O5Hswdo\ngv7YRIjkvLOk6NEICyMBrF05U3tZ7AM+COfM+3P8uKvNQgVVyEXtdhCPpt7v\n8yug\r\n=0+8T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA+2ujXTnqDeejoPAW21R0HC/Gi+99HFzAKmEnP3P2KDAiEA9INokM6dfUJZturHDEjONhd8dn0Nz4NXulnbT1RceBg="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2584_1641083814071_0.45126003542653925"},"_hasShrinkwrap":false},"2.0.2-nightly.2585":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2585","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"695660000f2f25ed17398176a78b85e5a8c3ccd6","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2585","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-bnmWTOPKpnMJWTCChw9p2opVOhvaFVUwI9FuKVIP+67AktliNuTIgKOXEbZs3MWG3SXIAmP56pkrNWy3NGaTKg==","shasum":"37229dc30af142d474a3f5c2345b0d7189758919","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2585.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0kWyCRA9TVsSAnZWagAAfJcP/RenruQ83fV4WQSc6wQX\nsjnUj8j708Tp98nEaiI2vpYWkftKvRpE4SZZLjmZXReYgKT5EGerZSMSfAp4\nSW4T5g1w6S/nN5FVYWP3XOhx/Drfudyx3KpNs6cDxTbtL+bBn22vXPPuTeAU\n++1K5sZld2bVbbCGZ4K0TQEy83lmzTYUStn4mWgswn4HjemoqlklZ6CYBCG2\nteemrzRWVJDtgdb444vUf6pOFo7Qr9OZ8KnfcI1vzcw1K4wbs1WqnpvXWaPZ\nNtIIMU5GAFdP3/VU3cfyOJ27lc38WOx4387VlvaJceg2XMf7FNPNsns29QgQ\nN82nxs6s9Lc9o53SaNsCDJaiL0jNmXdrrDwzE/39wmEbqkqmB8aqPRhkDUCW\nhE5SRtVWlVxat+lODRX8kH2chU4zjfVLDtQaDI/j2vwNJCeoSIZTjvdQNHqF\nG+llE52T9Ni7HxiSQRbwMHhHzjmIw+wkpFiA8Uq6OJm7lLxC32MkS/OqOcZK\nEgflADsWsM/n0jUUUjH15LrPGs+pravkRt/1+XvYoAC0hllXUNaHYEDDfSDS\n1OCS2+ygTXHOUXr7FbYqk+rCPOHUzMvFKLXkRxaX2OOuvd7LTsNnSXt9MK6n\nnlUPNF0XREYFHn7KNsir2NA3AJ20JgDdYXUkwkAyLWsGDiIOfWsucfFvb0sT\nCqUQ\r\n=3VgL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIADyfy8pjxoW3t++i94uR9h7Bl2r1qjaN2y+pOictVkxAiEA/S3oW0Yhc3bOnnylXYtWhquK/ItQBux8Zjk/bO5jIGc="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2585_1641170354602_0.47698126182746803"},"_hasShrinkwrap":false},"2.0.2-nightly.2589":{"name":"@parcel/babylon-walk","version":"2.0.2-nightly.2589","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"e6c96774a9e1712a5fb2e9fd84f4b708130a387c","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.0.2-nightly.2589","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-exyqyMZGsL90DpQJ5q5LuXqkR0ykIkNzwH5GhOUrYSpTXYhQ47k7VxmrafiQstshZV5v6KG6evcTdHQ9Cu01kA==","shasum":"277d24916de3a7a17035a969d8a5b07cac2eed4b","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.0.2-nightly.2589.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1OkTCRA9TVsSAnZWagAAyKkP/iCaey0KdO11YTiItV1A\nI5Gv2Eu24HG6XtogLSBQxl6Wgnc+x/QXY8SeQ0Nd517LmPaCODEaPpFfwQZM\nR/DIZqCEZdIJAoW67WUV5bQbuUt8sQEyGmcyHZICtcauZxacASQDeXYArEN0\ngjdwf3kv1c/toAfZs+dbq1r0asdzGuhBR334HQ9wYdwElHMbKQOzBfCwTEyl\nsi827LQR18tBzdBOa+Wn1S3hp287zk8LshKbI6BCDE4ZkWX7Cn7i+kWh3FUW\nw5/duBb7OJq6SyXk5Z+LPjPIDDQuAbMwn8K4IsUCOMs/FzkIVvKJaRQgVF57\n+OOjs855irYYdDy2ai04Gk1VS274fWCnydyvZAlvgPS7apNdpGShFQvhEVsq\ngedkfdbNOK456FbnAuy9VgiR3muYHL8QyucVU/skejLEpSKl6VZzqA5OLNm2\nVcw6U21pvtcBdyjufzULHfTS4A28onKy6vQKfkSdqXMCNtzehNeaaKsz4rCQ\n8LxIIFkAjuVpC83+8vs1BQOtM+vZ3fBaH3YbnKqOu/O9rOK0/lsFEwZjbMn0\nVH2Yx2hpO0Z/yCc9HSbS50HXIyyiKNdsz/CUxIbhBYyz3NEEFdGNPlZbPLT4\nB1tfrrdNCeKMRbmuf+aLUZ6uxUvFzqRaYvpSVa/ShpO0US8tSpTskoTW4Drk\nYKAc\r\n=Mbqa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBDxM/xZY0ub7tNjB1+ViMFOBX0OpIC5HNobU9LDmO8TAiA2SPXyiI2W21Mf6f5L6PrZbv9XwJdhQsfs9ttYNvqTfg=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.0.2-nightly.2589_1641343251502_0.7770884249790126"},"_hasShrinkwrap":false},"2.1.0":{"name":"@parcel/babylon-walk","version":"2.1.0","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"5a80fbe4af8797d0aab248a66f5254f42f00e83e","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.1.0","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-rmWli986EaT1CT97PQAoDxfCyqbYd+aSWcAIF9GDZ/MsAWER7VQvWj62y10qQsTUulNFBswMGjbOa3xwRnr0HQ==","shasum":"8cbd4458e0df1186335bc7302bd5ef9f5c3a4ed8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.1.0.tgz","fileCount":17,"unpackedSize":75899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1cWGCRA9TVsSAnZWagAAlhYP/15SUTm1cA8u6So6f4U+\nqBiqtpx30gZXbLc4E2OYrgaADOu0G3bKMeGEEY0733/x2vZbzAV5rPg/Rd8j\nDIFVKw2M83h0BqNerBkJ/+BeZZtzBRam+bpDadkOiFhkj8/y9p0jHYlhkqIT\nZox03/DoBqboq3npOOogj5a+Rb9Ntsu82bdl+CVDGO0bxvsuqB74nHvvZsP2\nRBmob+qjYQhdQz8MzCEfhvohGaIiBJYTkZhr1irTAhf7xTpzVUu5056TDE3f\nK/VH/8gV7GswCFn9NyBeSXivOAM3dJNSgJI37WogKiGQUwy8zYEHk6rQmUyi\nT5qYqaMelJtAvR408JpqwEcYkh/ackZSicVEhXjrwN73EYQRUzsNbjS8uJOh\n5k2JV3Nkh2wGgFoWBlmr0O93nhau4M2xR29oxdrQFKURUiMeel4yGBFDZTS+\nz7a/fN8ZHuSNiwOjGfER/CNkdvgjmDO6RvXnohcVvKMlTI1ARbYqQLC4I71q\nw3a2dRUBFoUFBSA9WkvH51cxg2p9HaQf8AxhX1qK6KGSgL2fai2N3txbogbM\nglWv7FBrg+3VmXivHTvoSWNxSNafv1tsWJOdR4WXY/pIPasP/VFTrU0xcSH4\nQCyfVl8JouEjX5CYWKQw9BEoaFHJ8aYSlEDApkPbiyApfjHYV/PxM+LxmNR8\n8d7s\r\n=SZVE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBLM5ppe7/x6MVAO3AZ3CccxIB+d0ZNEg6g4SHZtffnuAiAU7xxWzfmmscEVMxnsBYu0/b8/Rtb6aZl08qXHSajo4A=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.1.0_1641399686572_0.7709861442619539"},"_hasShrinkwrap":false},"2.1.1-nightly.2593":{"name":"@parcel/babylon-walk","version":"2.1.1-nightly.2593","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"5a80fbe4af8797d0aab248a66f5254f42f00e83e","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.1.1-nightly.2593","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-sqWaxlE+7jJx8k0uWyzLMmklskxPVyV0tbt0fVzxii11rGvItvUnFsG4RnKBRtN0uInL6R2UFTWQt7ckwcd34Q==","shasum":"86c10611b875e81708e5d11ddfa8b9f22280a62f","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.1.1-nightly.2593.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1joJCRA9TVsSAnZWagAAxjgP/2XJ7kzjIMz4umFMkcmG\nfpCdjXL0aIQ9lZXlzb53KW1ZjKYGCE2OWXg5WgnQ2HXh+Svt2imAINrgDSS9\nL8yyk0We8gWTIFERb7UuLuWS3zU+/OSJXrUQw0TzSOhBcvUEK49SS24/IFFG\n033BEUTRhKotx3qit7BBb7zTxZljIcPS8329tyCYOCvx9/WqvWPljGAnPsNE\n7wB9dK4MebGyvJDzFNU8IzUynfXxPcXlgzbUq14au/3wisMwgGW7w733mFtz\nbJrgNl5SDXvjz/INXmbTBgyzmNfJwu71Ep0Vk2pggidGUCaNXmzehMiRA019\nRZltjK4PNylyMcqZnJNPqdFk+l6sQVjVdXnipNmbd+fMM3iwA25i837/0XUA\nwtv+P1VXU9KjUN4jWFrwrbtAaX3hFu1nP3DAf8CSOpWT+jBmI0B3P/5bMoE4\nka9KBm3yN9w/p/G+gv4BK+9z0pRBuVEu4tkSx+wJLmYww4I8gVpJyfmZjbJV\nm9FKtXrVA3YuL1wKfG4bSK4jVKFo5UXcNqKVuUyMMQqWbJf0K0C7qkwsDzHE\neLUqYlKSxVXxbvp3suohClNesHL6krmdz89XYc7LlORWaxcmowZKTX0vbiQG\n8LEX/V4A4nXGSc3CzfxJld6LCBU2wiUj4qtOkNwiIgxMkOD+E9Lcrqk4Os3k\nIB5q\r\n=5r/g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCSpcRGbCwWQ/pzqGpXXCbBawwwL0cz0vj9Ixh73t1TswIhAJphG8ChNI4hC1sYp8qRMk8JQxZ9Ijn79O+hHeE0RSss"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.1.1-nightly.2593_1641429513542_0.172237185652371"},"_hasShrinkwrap":false},"2.1.1":{"name":"@parcel/babylon-walk","version":"2.1.1","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f53ffe772a8259d94ca2937d02fde149454112f3","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.1.1","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-9MHQe0tv4NWGbIJMJ771mxXGpBqyM3iSi9AAmuRoZiUmoeuURNxS6srBo7QrkpUdhy+FiIw1jMBSZzA0nTuo6w==","shasum":"5a30123037424dcc6ac085578189f0970b7a4cce","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.1.1.tgz","fileCount":17,"unpackedSize":75899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1zcXCRA9TVsSAnZWagAAgmYQAJUGsv65qJXeiDMKqEbm\n5BtEERKNrTX7bwiojQkDV74S/q4V8rLfX5RaczRNXZZ/GpK8qrOZUOQZBr1I\nj00UWVQiklO8Joyx8QgyROfFBHVXlTsgSbkhJPHVU6KvUwp6ArN2p3FWRKY3\nESSGk5SfkfFW55oglTnQP9v/gKzX35/vlQdd3GgfbOvHXnNopsAdGoZkrYZ0\nQMnB46XBU0NbcVeObW6c2cTU1A17iu1ik5Osm9bq8e+qlEUWJzOGEB4tKguF\nGmAEAzwby9SxPIWmYH1cD+OVfMhdoUpLJr1m6tZn6EATIvB7n36U0qroqhyT\nQ0cvhvvsE4f7XDFOEgg6G3yvbjLMXOsWVK6WeWgubj0vl/DlR663KQO+pJ4d\nmR7psMdITTBcJMymCR/XlKCWY5NCYIec0WrTxbtUcybBT37BV6Us8yV9UWYZ\nuM658+2Ri3xAfcBgDGoUmt6rF+eSJATOAWpbKIYpA5kkBirqPmRQf6E/0Xb4\nPzA6pQ0+svqwjmW+Hz+/AEpva56DCNSbmlbvf9Esq5QNFGTB2hhj1ORw15iZ\noHRyVdxyrD4zJmTqQcInK6CTFFtOoGLKkB0vrhyQqXfM5W1TAL0Utbgsd/sR\n7YkAQ1dDSbHNu3dsyZQ636Oa28OtM4L70Jxtc0Ox28SRlssExNa7ZrlbeioQ\n3DCg\r\n=XJm8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG3m80dBA27ZNPaPYJz/dsU1XjSkkq3c0T/PNK7b6FEdAiBIe7XWDHjqdWCE5C42244VBan8gmtCWo4tk1oLA2DpCA=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.1.1_1641494295689_0.08966297855797167"},"_hasShrinkwrap":false},"2.1.2-nightly.2600":{"name":"@parcel/babylon-walk","version":"2.1.2-nightly.2600","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"f53ffe772a8259d94ca2937d02fde149454112f3","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.1.2-nightly.2600","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-Efq5KivseLXfwUrKpnS1lGlJkYEffU9etlt9Ge7DE0isDPrIfoO5wZKFrx2Nl+Hfup/g587y2QTh8m+rsbjBWg==","shasum":"a54cef5911446fcb1f6910235c6dfe608f4b3af2","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.1.2-nightly.2600.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2N25CRA9TVsSAnZWagAA25gQAJcQRzU3+ABkI3dNNJXK\n/0DHMHNWvQd7HfNrk0ssj5rCTNzIW7KTb2Xx4t1zd0Ns5oTZhMe2BjrfZ06M\nkeVoiOErfj/SsbwEYbtY63A0aXhAK+T+d3WLFDD3sb58UdacYUAwCMK7VRBx\nGQFZZd16SRW/A3CHNfppqeRk61YOEAcjbgj8/n0X5wODLd/+d+hZRU02QWd3\n4GIaF9gQqbmBPSFZkVOcajys/e12KeOQnAUV6m3qAtRATHNWRsZ5Ppwye/av\n4g8RPphnBnMOFW85+7XORqGJ1u5sIpHeciqCXp9rqy533PtHIahKLxg4rlwF\nq8A7PjQrah4f0XJFHtTfP77U9EHfZanEP/9LF+w44dWTQ0y/IO3aVc9ppl+r\nIrWqUW+q5XNG1/5N5W9Kt1DBM4jW35pBCUq97DvjTnP2UUnt7Tp6exYyIUgz\nFaC69Q0zqWXaKQK52WJVrXMDSBEhmfFLCsvvOHBKgHHzf1ozGT50wCIaQYie\nmTFOV6KY0cSGps6f/L7C/pcY1sJDmO/9ch1sX1G824INnEx7YTWh7/LowONP\nwxLqvd3SG1uAGzRHV0xUqvsQubYYDmHfyZ8oLEh+DHpcO/b3SaV8VowNGmAh\n6YxSUMjmMG0nFLmNT4mCVkkes2H4n9jPRltz+JT58gBKDTUv24h6XgewEW4L\nD5tw\r\n=ZkQQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxB7+TzK+vMVAXewVxv6uNVM/lZR0Yrv7D0Snlgz7uGAIhAPq/DZaG3pu73CW1tT/YoyHtc0dg80ALi5XGStH3rpyd"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.1.2-nightly.2600_1641602489196_0.6297130012873671"},"_hasShrinkwrap":false},"2.1.2-nightly.2601":{"name":"@parcel/babylon-walk","version":"2.1.2-nightly.2601","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"dbe2f10dd6199769e5a7b299f936aac0ae5841b9","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.1.2-nightly.2601","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-mJ5LCf1IdTmjbzbXRF/6CGJ2brq7xEpSx778MfQ6SX5woRDuUQ/lrBeDUAit9hVvcwAAJlH5VAOITK2XCbmfqg==","shasum":"df1a1902eca2d18deb7db7d17a7dc4dc866b4805","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.1.2-nightly.2601.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3gG4CRA9TVsSAnZWagAAdoEP/0+JYmoeuhZQ+azCgH3m\nZ0riRYsGzg7+yuzztiH1wW21tsL045K7pIk6V5kIGV8wBaguuS7e4ucQbLNs\nHGgzvLdqNPuHB06pXWUJis94s1h6OQbh5XzCS7faozBCMj5x0aJifGRuMCKh\nLthxweDCTL1L+HceiLxM3pDqI/Glh1ScVtnitaJxj2vk0JuzVUP/V/Uf2hHw\nYKalbMYnbJZjwL/LPmV+lHWLFehqLVOS/K3P5xH3/NMTnPBgQkEAoJn8sFas\nPMUeI4evfVmXtu1OOTq+qCOcRMW5EKlkKydT9eZoZMa+58MOorZ6u/YF1gdO\nLpUEdwz/hmGV5vIIA0hqwCvE6NJ51Fr1Fw3G4s+k8fMcS/7quAvxBgnW51b9\nJpawM7sy4Ze9reRU28Kg1eQvzjgl95DC/BbOIRPxl3OymsvTElj7foWhpM7s\nm2fJsyH6u3fL3lnXBhTbVcB8J0hJe8BpI351XKNbVmpt/3zPZkzZ7EMrZgz8\n24c547i99qQ0kDF97/6D5RD92hqPyfTaV50y2OemxPfg6lroX5MMj6PXBQKp\nq9gZqTxhZqHpBeWJhrMbkTVPTZR+rTpA50QB3VnZ9N/pBpsjRAK+UD1SY1xd\nTO2UFTi+OjQV0iaOwni9FoOP0ikeJvtkH7FkoeLUUo2ORyNCzygSpaQii5ec\nt4WP\r\n=p4HD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7VxX9ndPDJdRFR52V8BbeszqMluLba7E9yT2Bc2Ci4wIhANVplnF2AADPGWHduHXtS7e5ZC3mTK63bNqA5+MQabD2"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.1.2-nightly.2601_1641939384797_0.19267515702533622"},"_hasShrinkwrap":false},"2.2.0":{"name":"@parcel/babylon-walk","version":"2.2.0","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4745cd3023f8d5a5adcf9e565d5b82d1418dc262","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.2.0","_nodeVersion":"16.13.1","_npmVersion":"lerna/3.20.2/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-7H32Ln6hUAMaW46ba1S44l5EZ8l+boqQrV3iOVZEyPUUToOmFUD/TER+51M2CioXShvxdSZLVITKvbZLWRbTig==","shasum":"822ba7c74272d605a1edef24e7f57492373a2674","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.2.0.tgz","fileCount":17,"unpackedSize":75899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3wNVCRA9TVsSAnZWagAAm3gP/ig8BxINjfX0ahy5waTF\nJvAe+sY3cayY0CyCU+CO892ub50RKtiEK2JFvomxrwitYQKY0I7q+VIWTa/w\nle9nfc0iC1Co++14nDt4dpdij1rPEt6ANOVoX1YaZwaosRFYAWFqqaoGxA6L\nMFh/yOZ+nlAukGqxrWZr55n/t5yyvGxJ9yanuIRn8cJlrH7QsLWTZ3uHfuM8\niKa1XyYSPsh4Fgp5ekY+pBzhofCizvvl/gYROuCAGNQ9wQdsAmfeg9cHiZfO\nAlSDwxsDE7K7HHzCXDSH8XJXZ8IpCzh3bY0Zhhevjqq+tXAHZqMSeWSdxdo+\n7IuAnrXpUhzQU1p64Ac+xUJQMxtlFS1vLuTJYuq9s2rQXA8dse5+8ggzZ9b9\nDUgQATBw362tomchS0WbUBqoEE0yRrwj6rD8C2r+RJ6MDPCJAXHM8slBqYRv\nRqIrPqvvQLMAXL3x2PmQRglrHD9TqSHPb/+Z7iCu3GilTcYvwnYZ7L/a1sS7\neAfVP0xNModya5XFc4rVKJIPOq1kol+t/f48swlOy8b1rnjoGETJtjDQshQ6\nNLaZFsmtPumpuZ571rz9NWJ8OxoZN9WDxb1t9n43gyd4GMPqRtYrniZKDE2L\nzWMTagZnhE/wLBWvcH+ryJhgWkMiuphlf0+uFSfVKDVPiJIUihPYl2NkrusZ\n/7N3\r\n=ZQeR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICSK6Wd5bKWKeTc2+BgxVxWsV8S5rdh3CSgIXTV1sN8cAiBRaDYIquwUMhdnbearXjTbOwIsWofj9TXwDC17DVoboQ=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.2.0_1642005333628_0.5060196261341672"},"_hasShrinkwrap":false},"2.2.1-nightly.2605":{"name":"@parcel/babylon-walk","version":"2.2.1-nightly.2605","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"4745cd3023f8d5a5adcf9e565d5b82d1418dc262","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.2.1-nightly.2605","_nodeVersion":"16.13.2","_npmVersion":"lerna/3.20.2/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-fMmQ9wMhEPx2vuDdiCFWHUm86fRZndX0Chn3n1k/FezDCfHuD3ZqM0C8QkTb+i+Q9AFEYVl+uc/J0/HvlRP5TA==","shasum":"151152b4d2d13131fb365ecae3f7c3d7ab4c1313","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.2.1-nightly.2605.tgz","fileCount":17,"unpackedSize":75921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh4MZACRA9TVsSAnZWagAAjxYP/RckZhOxlsNNK5JZw7wN\n1XZsaGZJoZbKK1aXHF0bv28ubCDxbH53cP9y7MOcQM1CGqlmUBKg3xA+Bz7C\n9rofFsgtnLF8iEaD6K1oiOmw68OcVKjAtZUZXGUPRjqe/Bc+Kj9BknPwYG9X\n0XJ9GJCR158vCX5q2ZGEtghH+glKIQyn9U17FU8ivzk28W9J2gZXR8g36W3m\nWmmy8cntS8dipg6Kp4D5C9jEta7sWaVQagO5029bFfVDdnLt5p7WOhK8TBVe\nSaB1sToRBeWxsh0jUuP2WAQAfxG7oABKWMfT22dBZ1OSxEEXmsapFl2LG3hZ\nCBl/NjDsraHy/RIS/BZYbYgAKSf94Wxv2o/4iSxmgqQ7S6BKZidu0bXwsmMw\nzcTW0avXfe26IGYyyzEYng5nZF34Hdu/+ao18ZE7X/GbE6T7QYyFo20CoODO\nhsYY4n6YsvS8JkjzA8hg4m/4ELwdwainTOqsMG6vCEQ8YsT0yPiGDldy3aiy\nGwt9c1zLNgTEquKYN+tfVTOwNoX4EqwwJmDD5SO7FPAMpeQbt1TocmJ6mosZ\nVYMouWuWDGanzAV04EsqdfKwiHzJ8krxfi3/uO1CbNHf+FQH9Rkq5twpGQM6\nQSrHpjxlwycNOOmUs38fEvkVDVek3HsyaXpPQFjMmHPkD9jHDM6BRT6WD0Dw\nB0jm\r\n=kHrn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICZzmS9k+nj9xg+MyN2eOMdwH7f+FakQOlTyuNrkoLP5AiAXNBJY/NXcCAzsGFV1J7Fz+zD34NRb3bkw999/dR4Crw=="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.2.1-nightly.2605_1642120768686_0.8849079679812601"},"_hasShrinkwrap":false},"2.2.1":{"name":"@parcel/babylon-walk","version":"2.2.1","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"74fcc3fbe80cea993bff10e158df3d0f701973c7","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.2.1","_nodeVersion":"16.13.2","_npmVersion":"lerna/3.22.1/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-tc0WuLdq56akmOtVDmzMe7kiTzn0lcQ7Xt74omICc0okd430ZfA7UdORND5YgDhbR2eK8uU4WTZm+JUV6QzJuA==","shasum":"bfe2297f905097c8e3b152918af098e776206bd8","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.2.1.tgz","fileCount":17,"unpackedSize":77201,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh5bEXCRA9TVsSAnZWagAAInAQAIaqNCzNyUNJbOH4zM3i\nQVL+/TxwBf1vt1E4nyMP+qZJ2sedMKOFeJ6s8M1LgkznWYnlCDuMyQ6j6POO\nNbsCIzu7OAxeDi+pUr9+ReZjEGZWc5SDWRldHIURKnJOy3Wlt/Sanz9RBI9I\nqM9TUmgX/ab/BvZCmUTvUmVe9O9HTfxEInU/hMQT84MlxzLdt4QIRmqB2Rmq\nUiild0MK+m3CTODwZQbOkPbNGLG10HGl5gzAa3gfa79AEuTQ2RhvLCw0KTVC\nEYavF7DzV9d4er6CjZJGXdK1bP5dmRt++/e1Gbp3Eim7rH026RC1mhrGjt1j\njZsX1K8jgsQRKl1matUi8HMVNJNPOtrVlU1j9cY4poxtxT/HugcliaKFykKe\nHezW5ic+AEKB3TSihbKuUlNWAD4Ss3omdOt6oUtkIK3vPgPN7T5Qjikr6KFh\nSXfzCMNCYRqU+haLuD17xng3QBneIZdMwFrUHbAGI5gLfVpyTGXN6Ho6nO/O\nqKAsjkQxKIj2F6tFYWoZb6uPqOoVdy1cpYI0bqs426bH6N+Y2//YkWZRTfoo\n1XFyoTzhNYijmua4sL1+e9tcWvkdxVkuw1V1NhUuo9pbf9wOzIf7U3xm8GqI\ndXyxk/e2bdzWM8vlCyLrW5IFR2JPTtjQFwN6/owUR4TSggE4ZT/gR9OyDKwZ\nY8Mh\r\n=twEM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChi2XAAOgXYu90xJ6ZulKcByW4Di+NSMEE3Q96kM+rUgIgPuAmuTOFnyUZ8TwfEPg9L3ng5XeYV1gR3HMSzDBXBs0="}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.2.1_1642443031473_0.4366367245367948"},"_hasShrinkwrap":false},"2.2.2-nightly.2609":{"name":"@parcel/babylon-walk","version":"2.2.2-nightly.2609","license":"MIT","publishConfig":{"access":"public"},"funding":{"type":"opencollective","url":"https://opencollective.com/parcel"},"description":"Lightweight Babylon AST traversal","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"main":"lib/index.js","source":"src/index.js","engines":{"node":">= 12.0.0"},"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"dependencies":{"@babel/types":"^7.12.13","lodash.clone":"^4.5.0"},"gitHead":"74fcc3fbe80cea993bff10e158df3d0f701973c7","readme":"# babylon-walk\n\nLightweight AST traversal tools for [Babylon] ASTs.\n\nBabylon is the parser used by the [Babel] project, which supplies the wonderful [babel-traverse] module for walking Babylon ASTs. Problem is, babel-traverse is very heavyweight, as it is designed to supply utilities to make all sorts of AST transformations possible. For simple AST walking without transformation, babel-traverse brings a lot of overhead.\n\nThis module loosely implements the API of Acorn parser's [walk module], which is a lightweight AST walker for the ESTree AST format.\n\nIn my tests, babylon-walk's ancestor walker (the most complex walker provided by this module) is about 8 times faster than babel-traverse, if the visitors are cached and the same AST is used for all runs. It is about 16 times faster if a fresh AST is used every run.\n\n[![Dependency Status](https://img.shields.io/david/pugjs/babylon-walk.svg)](https://david-dm.org/pugjs/babylon-walk)\n[![NPM version](https://img.shields.io/npm/v/babylon-walk.svg)](https://www.npmjs.com/package/babylon-walk)\n\n[babylon]: https://github.com/babel/babylon\n[babel]: https://babeljs.io/\n[babel-traverse]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-babel-traverse\n[walk module]: https://github.com/ternjs/acorn#distwalkjs\n\n## Installation\n\n```sh\n$ npm install babylon-walk\n```\n\n## API\n\n```js\nvar walk = require('babylon-walk');\n```\n\n### walk.simple(node, visitors, state)\n\nDo a simple walk over the AST. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state)`, where `node` is the AST node, and `state` is the same `state` passed to `walk.simple`.\n\nWhen `walk.simple` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.ancestor(node, visitors, state)\n\nDo a simple walk over the AST, but memoizing the ancestors of the node and making them available to the visitors. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, ancestors)`, where `node` is the AST node, `state` is the same `state` passed to `walk.ancestor`, and `ancestors` is an array of ancestors to the node (with the outermost node being `[0]` and the current node being `[ancestors.length - 1]`). If `state` is not specified in the call to `walk.ancestor`, the `state` parameter will be set to `ancestors`.\n\nWhen `walk.ancestor` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\n### walk.recursive(node, visitors, state)\n\nDo a recursive walk over the AST, where the visitors are responsible for continuing the walk on the child nodes of their target node. `node` should be the AST node to walk, and `visitors` an object containing Babel [visitors]. Each visitor function will be called as `(node, state, c)`, where `node` is the AST node, `state` is the same `state` passed to `walk.recursive`, and `c` is a function that takes a single node as argument and continues walking _that_ node. If no visitor for a node is provided, the default walker algorithm will still be used.\n\nWhen `walk.recursive` is called with a fresh set of visitors, it will first \"explode\" the visitors (e.g. expanding `Visitor(node, state) {}` to `Visitor() { enter(node, state) {} }`). This exploding process can take some time, so it is recommended to [cache your visitors] and communicate state leveraging the `state` parameter. (One difference between the linked article and babylon-walk is that the state is only accessible through the `state` variable, never as `this`.)\n\nUnlike other babylon-walk walkers, `walk.recursive` does not call the `exit` visitor, only the `enter` (the default) visitor, of a specific node type.\n\nAll [babel-types] aliases (e.g. `Expression`) and the union syntax (e.g. `'Identifier|AssignmentPattern'(node, state) {}`) work.\n\nIn the following example, we are trying to count the number of functions in the outermost scope. This means, that we can simply walk all the statements and increment a counter if it is a function declaration or expression, and then stop walking. Note that we do not specify a visitor for the `Program` node, and the default algorithm for walking `Program` nodes is used (which is what we want). Also of note is how I bring the `visitors` object outside of `countFunctions` so that the object can be cached to improve performance.\n\n```js\nimport * as t from 'babel-types';\nimport {parse} from 'babylon';\nimport * as walk from 'babylon-walk';\n\nconst visitors = {\n  Statement(node, state, c) {\n    if (t.isVariableDeclaration(node)) {\n      for (let declarator of node.declarations) {\n        // Continue walking the declarator\n        c(declarator);\n      }\n    } else if (t.isFunctionDeclaration(node)) {\n      state.counter++;\n    }\n  },\n\n  VariableDeclarator(node, state) {\n    if (t.isFunction(node.init)) {\n      state.counter++;\n    }\n  },\n};\n\nfunction countFunctions(node) {\n  const state = {\n    counter: 0,\n  };\n  walk.recursive(node, visitors, state);\n  return state.counter;\n}\n\nconst ast = parse(`\n  // Counts\n  var a = () => {};\n\n  // Counts\n  function b() {\n    // Doesn't count\n    function c() {\n    }\n  }\n\n  // Counts\n  const c = function d() {};\n`);\n\ncountFunctions(ast);\n// = 3\n```\n\n### walk.traverse(node, visitors, state)\n\nVisitors get called as `(path, state)`. Every `Path` has these methods (similar to `@babel/traverse`):\n\n- `skip()`\n- `replaceWith(node)`\n- `remove()`\n\n[babel-types]: https://github.com/babel/babel/tree/master/packages/babel-types\n[cache your visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-optimizing-nested-visitors\n[visitors]: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#toc-visitors\n\n## Caveat\n\nFor those of you migrating from Acorn to Babylon, there are a few things to be aware of.\n\n1. The visitor caching suggestions do not apply to Acorn's walk module, but do for babylon-walk.\n\n2. babylon-walk does not provide any of the other functions Acorn's walk module provides (e.g. `make`, `findNode*`).\n\n3. babylon-walk does not use a `base` variable. The walker algorithm is the same as what babel-traverse uses.\n   - That means certain nodes that are not walked by Acorn, such as the `property` property of a non-computed `MemberExpression`, are walked by babylon-walk.\n\n## License\n\nMIT\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"},"homepage":"https://github.com/parcel-bundler/parcel#readme","_id":"@parcel/babylon-walk@2.2.2-nightly.2609","_nodeVersion":"16.13.2","_npmVersion":"lerna/3.22.1/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-Qk1ucYcCtD5O9Qz/aAGCw9rFCAQ3y6sta3eEdM7S/RXaWHd8woyN2clDlvaD9c2Xfa7YMkszvV350H3jm1m9Cg==","shasum":"4de6a9c8aabcd8237b5a1ff329136f1f94dec456","tarball":"https://registry.npmjs.org/@parcel/babylon-walk/-/babylon-walk-2.2.2-nightly.2609.tgz","fileCount":17,"unpackedSize":77223,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh5gzaCRA9TVsSAnZWagAAEQwP+wRagyU1RgYK1lDaEiPv\nckfHD8vaMKmq7Vd2ZqE0UFxllL/B1vRE26b9bbBgoLFWPbD6o9O1fvU2KVEW\nvrs8Q2BCUh0lEO+ymfBUwD8MuMyt+s8nW/aO55A1Ej7/IKqgGqr6vw+B+zao\nm2IH9ZD70Wp0wJHJfcWSjkMQ5hc/fUfcHTbtuJ7rJ7qKj+fSU8aBpqLWzkfs\nuUJi0/5zBMQvMdNuhpScv1FK23IkjUYWgtQHfcgu75gsXJ4hPX+xgwq2mKj4\nAvpovTNHL+XrEwXIzq+SSzU4XKZsyXVgCDyoCRKLwbXjd2jN08o70CLqTKAs\nLqy0xFhaEfGcBeH2QKsaHGtG0YuEw1JK2XjiSlkhiowxwSf7EbXkz3+w3hhp\n0+cBFiy2c8VrYmUktEhYb+j9lvLI/B+T9pDhtX8elDGP4uKuosGJIocPoAWm\nkdv05wMi26kakG2aGE3UuuElAlv1Pxv5dcnSG7R8tWr1EV7/yowD+fCpQ5hj\nsBBZsMxTVkddgxxlD1LNV+y/VbwTAAPeBFKDSoYV7goBdfSIEiqHcwp0pYyh\nXjRSkg9WEFiEyqadeKXmUsUBvAplyN25LAhFXI5JB9ReUUzcyWiX1pCyyQ8g\nTgwwNy0uoyQgzi9q6PcqJWR3knRAE8bIH7PFhBkYI+ME6A8R17RdJ+V3M7vq\n/b45\r\n=tgrw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNjD7ujGM6g8OuBQCg2PiFmlkHYICZsCfoYejpUHDHqgIhAKNPwhj44M3PTJCs/3XpxSl6skRyYZCUhP//Y5RLdmEh"}]},"_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"directories":{},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babylon-walk_2.2.2-nightly.2609_1642466522134_0.6349736841882803"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-08T00:05:35.362Z","2.0.0-nightly.1765":"2020-03-08T00:05:35.765Z","modified":"2022-04-06T13:11:17.067Z","2.0.0-nightly.1766":"2020-03-09T00:05:25.962Z","2.0.0-nightly.1768":"2020-03-10T00:05:20.467Z","2.0.0-nightly.1770":"2020-03-12T00:05:03.429Z","2.0.0-nightly.1771":"2020-03-14T00:05:13.921Z","2.0.0-nightly.1772":"2020-03-15T00:05:34.709Z","2.0.0-nightly.1773":"2020-03-16T00:05:47.365Z","2.0.0-nightly.1777":"2020-03-18T00:05:16.602Z","2.0.0-nightly.1778":"2020-03-20T00:04:33.685Z","2.0.0-nightly.1781":"2020-03-21T00:04:23.252Z","2.0.0-nightly.1787":"2020-03-22T00:04:29.712Z","2.0.0-nightly.1788":"2020-03-23T00:04:26.447Z","2.0.0-nightly.1789":"2020-03-24T00:04:35.693Z","2.0.0-nightly.1795":"2020-03-25T00:04:47.872Z","2.0.0-nightly.1799":"2020-03-26T00:04:48.671Z","2.0.0-nightly.1804":"2020-03-27T00:04:50.139Z","2.0.0-nightly.1807":"2020-03-28T00:04:37.059Z","2.0.0-nightly.1808":"2020-03-29T00:05:26.465Z","2.0.0-nightly.1809":"2020-03-31T00:05:10.278Z","2.0.0-nightly.1813":"2020-04-01T00:05:00.357Z","2.0.0-nightly.1817":"2020-04-02T00:05:05.098Z","2.0.0-nightly.1818":"2020-04-03T04:23:29.402Z","2.0.0-nightly.1820":"2020-04-04T00:05:09.242Z","2.0.0-nightly.1822":"2020-04-05T00:04:45.998Z","2.0.0-nightly.1823":"2020-04-05T20:21:51.430Z","2.0.0-nightly.1825":"2020-04-07T00:04:53.000Z","2.0.0-nightly.1827":"2020-04-08T00:05:29.020Z","2.0.0-nightly.1829":"2020-04-09T00:04:51.671Z","2.0.0-nightly.1831":"2020-04-10T00:05:47.633Z","2.0.0-nightly.1832":"2020-04-11T00:04:45.759Z","2.0.0-nightly.1836":"2020-04-12T00:04:33.345Z","2.0.0-nightly.1841":"2020-04-15T00:04:26.406Z","2.0.0-nightly.1844":"2020-04-15T19:54:05.819Z","2.0.0-nightly.1845":"2020-04-16T00:04:48.003Z","2.0.0-nightly.1847":"2020-04-17T00:04:26.309Z","2.0.0-nightly.1849":"2020-04-18T00:04:54.377Z","2.0.0-nightly.1850":"2020-04-19T00:04:36.024Z","2.0.0-nightly.1851":"2020-04-21T00:04:30.641Z","2.0.0-nightly.1852":"2020-04-23T00:04:46.545Z","2.0.0-nightly.1854":"2020-04-24T00:04:50.033Z","2.0.0-nightly.1858":"2020-04-25T00:04:49.461Z","2.0.0-nightly.1861":"2020-04-29T00:04:28.868Z","2.0.0-nightly.1864":"2020-04-30T00:04:36.916Z","2.0.0-nightly.1871":"2020-05-01T00:05:00.542Z","2.0.0-nightly.1872":"2020-05-02T00:05:00.285Z","2.0.0-nightly.1874":"2020-05-06T00:04:09.176Z","2.0.0-nightly.1875":"2020-05-07T00:04:28.607Z","2.0.0-nightly.1879":"2020-05-08T00:05:01.016Z","2.0.0-nightly.1880":"2020-05-09T00:04:12.017Z","2.0.0-nightly.1883":"2020-05-10T00:05:04.796Z","2.0.0-nightly.1885":"2020-05-11T00:05:41.388Z","2.0.0-nightly.1888":"2020-05-12T00:06:44.468Z","2.0.0-nightly.1890":"2020-05-13T00:04:42.460Z","2.0.0-nightly.1894":"2020-05-14T00:05:33.580Z","2.0.0-nightly.1897":"2020-05-20T00:05:40.853Z","2.0.0-nightly.1899":"2020-05-22T00:05:02.607Z","2.0.0-nightly.1900":"2020-05-28T00:09:28.369Z","2.0.0-nightly.1901":"2020-06-02T00:08:04.613Z","2.0.0-nightly.1902":"2020-06-04T00:06:51.579Z","2.0.0-nightly.1904":"2020-06-05T00:08:18.874Z","2.0.0-nightly.1906":"2020-06-07T00:07:02.105Z","2.0.0-nightly.1908":"2020-06-08T00:07:24.824Z","2.0.0-nightly.1910":"2020-06-09T00:06:42.956Z","2.0.0-nightly.1911":"2020-06-10T00:07:34.219Z","2.0.0-nightly.1912":"2020-06-11T00:07:11.436Z","2.0.0-nightly.1913":"2020-06-14T00:08:20.477Z","2.0.0-nightly.1915":"2020-06-15T00:27:53.785Z","2.0.0-nightly.1917":"2020-06-16T00:30:03.954Z","2.0.0-nightly.1920":"2020-06-17T00:07:26.092Z","2.0.0-nightly.1921":"2020-06-18T00:07:11.096Z","2.0.0-beta.1":"2020-06-18T18:04:38.629Z","2.0.0-nightly.1924":"2020-06-19T00:07:03.288Z","2.0.0-nightly.1926":"2020-06-21T00:07:45.688Z","2.0.0-nightly.1929":"2020-06-22T00:08:54.168Z","2.0.0-nightly.1935":"2020-06-23T00:09:15.735Z","2.0.0-nightly.1937":"2020-06-23T19:38:47.132Z","2.0.0-nightly.1938":"2020-06-24T00:08:02.532Z","2.0.0-nightly.1939":"2020-06-26T00:08:49.024Z","2.0.0-nightly.1942":"2020-06-27T00:08:01.519Z","2.0.0-nightly.1943":"2020-07-02T00:08:27.226Z","2.0.0-nightly.1944":"2020-07-03T00:10:24.921Z","2.0.0-nightly.1946":"2020-07-04T00:08:48.945Z","2.0.0-nightly.1949":"2020-07-07T00:08:42.752Z","2.0.0-nightly.1952":"2020-07-07T21:36:35.429Z","2.0.0-nightly.1953":"2020-07-10T00:09:50.445Z","2.0.0-nightly.1954":"2020-07-11T00:09:05.104Z","2.0.0-nightly.1957":"2020-07-12T00:10:04.671Z","2.0.0-nightly.1961":"2020-07-13T00:09:00.643Z","2.0.0-nightly.1962":"2020-07-14T00:09:00.991Z","2.0.0-nightly.1963":"2020-07-16T00:09:54.673Z","2.0.0-nightly.1965":"2020-07-18T00:09:04.850Z","2.0.0-nightly.1968":"2020-07-19T00:09:15.896Z","2.0.0-nightly.1971":"2020-07-20T00:09:17.312Z","2.0.0-nightly.1973":"2020-07-22T00:10:20.639Z","2.0.0-nightly.1974":"2020-07-24T00:10:57.530Z","2.0.0-nightly.1976":"2020-07-26T00:10:18.161Z","2.0.0-nightly.1977":"2020-07-30T00:09:48.487Z","2.0.0-nightly.1978":"2020-07-31T00:09:53.909Z","2.0.0-nightly.1979":"2020-08-03T00:10:14.637Z","2.0.0-nightly.1981":"2020-08-04T00:11:27.300Z","2.0.0-nightly.1982":"2020-08-05T00:10:11.019Z","2.0.0-nightly.1984":"2020-08-07T00:10:44.432Z","2.0.0-nightly.1988":"2020-08-11T00:12:12.846Z","2.0.0-nightly.1990":"2020-08-14T00:10:31.465Z","2.0.0-nightly.1992":"2020-08-16T00:10:48.283Z","2.0.0-nightly.1994":"2020-08-18T00:10:18.776Z","2.0.0-nightly.1996":"2020-08-19T00:13:25.123Z","2.0.0-nightly.2000":"2020-08-21T00:12:07.068Z","2.0.0-nightly.2001":"2020-08-22T00:13:09.096Z","2.0.0-nightly.2002":"2020-08-23T00:13:19.463Z","2.0.0-nightly.2004":"2020-08-24T00:12:37.141Z","2.0.0-nightly.2008":"2020-08-26T00:12:34.430Z","2.0.0-nightly.2009":"2020-08-27T00:12:12.308Z","2.0.0-nightly.2010":"2020-08-31T00:16:59.419Z","2.0.0-nightly.2011":"2020-09-02T00:14:28.013Z","2.0.0-nightly.2012":"2020-09-03T00:12:50.455Z","2.0.0-nightly.2013":"2020-09-06T00:13:15.916Z","2.0.0-nightly.2019":"2020-09-08T00:13:26.693Z","2.0.0-nightly.2020":"2020-09-10T00:13:23.313Z","2.0.0-nightly.2021":"2020-09-11T00:13:17.147Z","2.0.0-nightly.2022":"2020-09-12T00:13:02.599Z","2.0.0-nightly.2023":"2020-09-14T00:13:37.966Z","2.0.0-nightly.2024":"2020-09-16T00:13:34.802Z","2.0.0-nightly.2025":"2020-09-17T00:13:41.810Z","2.0.0-nightly.2027":"2020-09-18T00:13:34.391Z","2.0.0-nightly.2031":"2020-09-19T00:13:16.942Z","2.0.0-nightly.2032":"2020-09-25T00:14:07.580Z","2.0.0-nightly.2033":"2020-09-26T00:13:50.699Z","2.0.0-nightly.2034":"2020-09-28T00:14:23.098Z","2.0.0-nightly.2035":"2020-09-30T00:14:29.293Z","2.0.0-nightly.2037":"2020-10-01T00:14:41.347Z","2.0.0-nightly.2038":"2020-10-02T00:13:37.897Z","2.0.0-nightly.2039":"2020-10-03T00:30:48.441Z","2.0.0-nightly.2040":"2020-10-05T00:14:51.479Z","2.0.0-nightly.2043":"2020-10-07T00:15:08.374Z","2.0.0-nightly.2044":"2020-10-08T00:12:36.373Z","2.0.0-nightly.2048":"2020-10-13T00:16:11.400Z","2.0.0-nightly.2049":"2020-10-14T00:15:12.816Z","2.0.0-nightly.2050":"2020-10-20T00:20:39.103Z","2.0.0-nightly.2051":"2020-10-21T00:16:11.842Z","2.0.0-nightly.2052":"2020-10-21T20:21:39.767Z","2.0.0-nightly.2053":"2020-10-22T00:17:15.583Z","2.0.0-nightly.2054":"2020-10-25T00:16:45.747Z","2.0.0-nightly.2056":"2020-10-26T00:17:59.973Z","2.0.0-nightly.2057":"2020-10-27T00:18:12.304Z","2.0.0-nightly.2059":"2020-10-29T00:17:20.848Z","2.0.0-nightly.2062":"2020-10-31T00:10:21.730Z","2.0.0-nightly.2063":"2020-11-06T00:11:48.833Z","2.0.0-nightly.2064":"2020-11-07T00:12:03.711Z","2.0.0-nightly.2066":"2020-11-09T00:13:37.997Z","2.0.0-nightly.2067":"2020-11-10T00:12:08.013Z","2.0.0-nightly.2068":"2020-11-12T00:12:46.035Z","2.0.0-nightly.2069":"2020-11-13T00:12:24.716Z","2.0.0-nightly.2070":"2020-11-14T00:11:46.471Z","2.0.0-nightly.2071":"2020-11-15T00:19:00.946Z","2.0.0-nightly.2076":"2020-11-19T00:11:50.994Z","2.0.0-nightly.2077":"2020-11-20T00:12:00.754Z","2.0.0-nightly.2078":"2020-11-21T00:12:05.703Z","2.0.0-nightly.2081":"2020-11-22T00:13:03.447Z","2.0.0-nightly.2084":"2020-11-23T00:12:46.639Z","2.0.0-nightly.2086":"2020-11-24T00:12:41.661Z","2.0.0-nightly.2087":"2020-12-01T00:13:45.931Z","2.0.0-nightly.2088":"2020-12-02T00:13:35.482Z","2.0.0-nightly.2089":"2020-12-03T00:14:03.256Z","2.0.0-nightly.2090":"2020-12-04T00:14:03.160Z","2.0.0-nightly.2091":"2020-12-06T00:14:54.350Z","2.0.0-nightly.2093":"2020-12-07T00:14:58.601Z","2.0.0-nightly.2096":"2020-12-08T00:14:14.162Z","2.0.0-nightly.2098":"2020-12-09T00:14:08.365Z","2.0.0-nightly.2099":"2020-12-10T00:14:48.120Z","2.0.0-nightly.2100":"2020-12-11T00:14:44.486Z","2.0.0-nightly.2101":"2020-12-14T00:15:04.435Z","2.0.0-nightly.2103":"2020-12-15T00:14:34.630Z","2.0.0-nightly.2105":"2020-12-16T00:14:52.567Z","2.0.0-nightly.2109":"2020-12-19T00:16:37.209Z","2.0.0-nightly.2110":"2020-12-20T00:16:00.822Z","2.0.0-nightly.2113":"2020-12-24T00:24:55.928Z","2.0.0-nightly.2114":"2020-12-25T00:21:31.885Z","2.0.0-nightly.2115":"2020-12-26T00:19:40.624Z","2.0.0-nightly.2116":"2020-12-29T00:22:41.373Z","2.0.0-nightly.2119":"2020-12-30T00:24:18.847Z","2.0.0-nightly.2120":"2020-12-31T00:26:02.136Z","2.0.0-nightly.2124":"2021-01-01T00:25:07.258Z","2.0.0-nightly.2128":"2021-01-03T00:30:36.613Z","2.0.0-nightly.2130":"2021-01-03T18:11:40.868Z","2.0.0-nightly.2135":"2021-01-05T00:32:09.252Z","2.0.0-nightly.2137":"2021-01-06T00:33:02.441Z","2.0.0-nightly.2138":"2021-01-07T00:36:29.327Z","2.0.0-nightly.2144":"2021-01-09T00:37:10.922Z","2.0.0-nightly.2146":"2021-01-10T00:38:07.472Z","2.0.0-nightly.2148":"2021-01-11T00:36:10.637Z","2.0.0-nightly.2151":"2021-01-13T00:47:15.512Z","2.0.0-nightly.2156":"2021-01-14T00:55:18.884Z","2.0.0-nightly.2159":"2021-01-15T00:48:56.778Z","2.0.0-nightly.2161":"2021-01-17T00:48:44.995Z","2.0.0-nightly.2163":"2021-01-18T00:47:53.003Z","2.0.0-nightly.2164":"2021-01-19T00:52:06.547Z","2.0.0-nightly.2172":"2021-01-22T00:51:53.646Z","2.0.0-nightly.2175":"2021-01-23T00:50:31.640Z","2.0.0-nightly.2177":"2021-01-26T00:26:37.494Z","2.0.0-nightly.2178":"2021-01-27T00:27:38.257Z","2.0.0-nightly.2182":"2021-01-30T00:24:38.632Z","2.0.0-nightly.2184":"2021-02-01T00:25:27.124Z","2.0.0-nightly.2186":"2021-02-02T00:24:59.662Z","2.0.0-nightly.2190":"2021-02-03T00:18:47.485Z","2.0.0-nightly.2194":"2021-02-04T00:20:04.781Z","2.0.0-nightly.2197":"2021-02-05T00:20:23.421Z","2.0.0-nightly.2198":"2021-02-06T00:20:44.396Z","2.0.0-nightly.2201":"2021-02-09T00:19:04.821Z","2.0.0-nightly.2203":"2021-02-10T00:18:21.154Z","2.0.0-nightly.2209":"2021-02-12T00:32:08.313Z","2.0.0-nightly.2214":"2021-02-13T00:20:09.638Z","2.0.0-nightly.2216":"2021-02-14T00:20:25.399Z","2.0.0-nightly.2220":"2021-02-15T00:19:14.986Z","2.0.0-nightly.2221":"2021-02-17T00:20:10.882Z","2.0.0-nightly.2222":"2021-02-18T00:20:04.152Z","2.0.0-nightly.2224":"2021-02-19T00:20:52.486Z","2.0.0-nightly.2227":"2021-02-20T00:20:00.368Z","2.0.0-nightly.2229":"2021-02-22T00:20:43.908Z","2.0.0-nightly.2230":"2021-02-23T00:18:45.656Z","2.0.0-nightly.2231":"2021-02-24T00:22:42.304Z","2.0.0-nightly.2232":"2021-02-25T00:19:30.319Z","2.0.0-nightly.2233":"2021-02-26T00:19:59.062Z","2.0.0-nightly.2234":"2021-02-27T00:20:13.878Z","2.0.0-nightly.2238":"2021-03-04T00:21:00.714Z","2.0.0-nightly.2239":"2021-03-05T00:19:25.466Z","2.0.0-nightly.2242":"2021-03-06T00:21:53.642Z","2.0.0-nightly.2243":"2021-03-08T00:21:36.417Z","2.0.0-nightly.2244":"2021-03-10T00:20:41.834Z","2.0.0-nightly.2247":"2021-03-11T00:21:47.247Z","2.0.0-nightly.2249":"2021-03-13T00:22:43.751Z","2.0.0-nightly.2250":"2021-03-14T00:22:23.525Z","2.0.0-beta.2":"2021-03-16T00:12:46.215Z","2.0.0-nightly.2251":"2021-03-16T00:20:45.489Z","2.0.0-nightly.2252":"2021-03-18T00:23:02.967Z","2.0.0-nightly.2253":"2021-03-21T00:21:14.576Z","2.0.0-nightly.2254":"2021-03-22T00:20:04.963Z","2.0.0-nightly.2255":"2021-03-24T00:22:17.065Z","2.0.0-nightly.2256":"2021-03-30T00:14:53.038Z","2.0.0-nightly.2257":"2021-04-03T00:13:41.606Z","2.0.0-nightly.2258":"2021-04-04T00:13:45.766Z","2.0.0-nightly.2259":"2021-04-07T00:14:05.672Z","2.0.0-nightly.2260":"2021-04-09T00:13:52.079Z","2.0.0-nightly.2261":"2021-04-12T00:14:21.740Z","2.0.0-nightly.2263":"2021-04-13T00:16:17.123Z","2.0.0-nightly.2264":"2021-04-14T00:13:47.634Z","2.0.0-nightly.2265":"2021-04-15T00:13:19.841Z","2.0.0-nightly.2266":"2021-04-17T00:12:30.684Z","2.0.0-nightly.2267":"2021-04-20T00:15:24.981Z","2.0.0-nightly.2268":"2021-04-27T00:12:30.153Z","2.0.0-nightly.2270":"2021-04-28T00:13:49.615Z","2.0.0-nightly.2271":"2021-04-29T00:14:11.566Z","2.0.0-nightly.2273":"2021-04-30T00:12:37.180Z","2.0.0-nightly.2274":"2021-05-05T00:10:43.750Z","2.0.0-nightly.2275":"2021-05-06T00:08:45.653Z","2.0.0-nightly.2277":"2021-05-07T00:09:39.128Z","2.0.0-nightly.2278":"2021-05-10T00:09:12.334Z","2.0.0-nightly.2279":"2021-05-10T04:33:02.766Z","2.0.0-nightly.2284":"2021-05-12T13:06:11.425Z","2.0.0-nightly.2289":"2021-05-14T00:40:36.347Z","2.0.0-nightly.2292":"2021-05-15T00:34:28.572Z","2.0.0-nightly.2293":"2021-05-16T00:35:27.440Z","2.0.0-nightly.2294":"2021-05-17T00:35:04.367Z","2.0.0-nightly.2295":"2021-05-17T02:19:36.294Z","2.0.0-nightly.2296":"2021-05-18T00:38:54.123Z","2.0.0-nightly.2298":"2021-05-19T00:40:25.392Z","2.0.0-beta.3":"2021-05-19T15:34:10.687Z","2.0.0-nightly.2300":"2021-05-20T03:38:20.721Z","2.0.0-nightly.2301":"2021-05-20T05:19:28.578Z","2.0.0-beta.3.1":"2021-05-20T07:03:00.912Z","2.0.0-nightly.2302":"2021-05-21T00:38:25.343Z","2.0.0-nightly.2303":"2021-05-22T00:38:30.147Z","2.0.0-nightly.2310":"2021-05-25T00:40:24.204Z","2.0.0-nightly.2312":"2021-05-26T00:41:42.925Z","2.0.0-nightly.2325":"2021-06-02T21:20:33.008Z","2.0.0-nightly.2328":"2021-06-04T00:53:13.594Z","2.0.0-nightly.2332":"2021-06-06T00:39:19.301Z","2.0.0-nightly.2335":"2021-06-07T00:39:25.282Z","2.0.0-nightly.2338":"2021-06-09T00:30:56.280Z","2.0.0-nightly.2340":"2021-06-11T00:33:14.708Z","2.0.0-nightly.2342":"2021-06-12T00:31:46.816Z","2.0.0-nightly.2343":"2021-06-13T00:37:18.669Z","2.0.0-nightly.2344":"2021-06-14T00:35:42.632Z","2.0.0-nightly.2346":"2021-06-16T00:35:12.206Z","2.0.0-nightly.2349":"2021-06-18T00:32:30.089Z","2.0.0-nightly.2350":"2021-06-20T00:34:26.064Z","2.0.0-nightly.2353":"2021-06-21T00:34:20.178Z","2.0.0-nightly.2355":"2021-06-23T00:35:46.355Z","2.0.0-nightly.2356":"2021-06-24T00:30:07.734Z","2.0.0-nightly.2357":"2021-06-25T00:33:44.787Z","2.0.0-nightly.2358":"2021-06-26T00:32:50.399Z","2.0.0-nightly.2370":"2021-06-29T03:09:14.620Z","2.0.0-nightly.2373":"2021-07-02T00:35:29.580Z","2.0.0-nightly.2374":"2021-07-03T00:31:41.271Z","2.0.0-nightly.2376":"2021-07-06T00:34:59.819Z","2.0.0-nightly.2377":"2021-07-07T00:35:17.652Z","2.0.0-nightly.2380":"2021-07-08T00:32:31.427Z","2.0.0-nightly.2384":"2021-07-09T00:35:14.025Z","2.0.0-nightly.2387":"2021-07-10T00:33:21.274Z","2.0.0-nightly.2388":"2021-07-11T00:33:32.774Z","2.0.0-nightly.2391":"2021-07-12T00:34:42.623Z","2.0.0-nightly.2393":"2021-07-13T00:35:24.865Z","2.0.0-nightly.2398":"2021-07-18T00:34:16.409Z","2.0.0-nightly.2400":"2021-07-19T00:35:49.283Z","2.0.0-nightly.2414":"2021-07-29T10:41:41.434Z","2.0.0-nightly.2416":"2021-07-31T16:08:03.217Z","2.0.0-nightly.2417":"2021-08-03T00:34:31.054Z","2.0.0-rc.0":"2021-08-03T05:27:58.428Z","2.0.0-nightly.2418":"2021-08-04T00:33:45.675Z","2.0.0-nightly.2420":"2021-08-07T00:31:07.448Z","2.0.0-nightly.2422":"2021-08-12T00:40:40.019Z","2.0.0-nightly.2423":"2021-08-14T00:35:34.347Z","2.0.0-nightly.2424":"2021-08-17T00:31:52.497Z","2.0.0-nightly.2425":"2021-08-18T00:37:03.159Z","2.0.0-nightly.2426":"2021-08-20T00:35:38.199Z","2.0.0-nightly.2428":"2021-08-22T00:35:01.017Z","2.0.0-nightly.2430":"2021-08-23T00:37:07.087Z","2.0.0-nightly.2433":"2021-08-24T00:38:23.291Z","2.0.0-nightly.2434":"2021-08-26T00:33:38.508Z","2.0.0-nightly.2435":"2021-08-27T00:33:11.735Z","2.0.0-nightly.2436":"2021-08-28T00:35:12.652Z","2.0.0-nightly.2437":"2021-08-29T00:34:04.188Z","2.0.0-nightly.2441":"2021-08-30T00:36:11.855Z","2.0.0-nightly.2443":"2021-08-31T00:37:00.034Z","2.0.0-nightly.2445":"2021-09-01T00:41:52.335Z","2.0.0-nightly.2448":"2021-09-02T00:37:01.817Z","2.0.0-nightly.2460":"2021-09-12T00:37:43.780Z","2.0.0-nightly.2461":"2021-09-15T00:42:38.427Z","2.0.0-nightly.2462":"2021-09-16T00:38:59.725Z","2.0.0-nightly.2464":"2021-09-17T00:39:59.553Z","2.0.0-nightly.2465":"2021-09-19T00:39:58.868Z","2.0.0-nightly.2466":"2021-09-21T00:38:36.856Z","2.0.0-nightly.2467":"2021-09-23T00:35:30.329Z","2.0.0-nightly.2468":"2021-09-29T00:36:30.404Z","2.0.0-nightly.2469":"2021-09-29T06:45:54.352Z","2.0.0-nightly.2471":"2021-09-30T18:00:34.022Z","2.0.0-nightly.2474":"2021-10-02T00:40:54.621Z","2.0.0-nightly.2476":"2021-10-04T00:42:10.601Z","2.0.0-nightly.2479":"2021-10-05T00:35:10.275Z","2.0.0-nightly.2483":"2021-10-06T00:40:14.360Z","2.0.0-nightly.2488":"2021-10-07T00:40:13.899Z","2.0.0-nightly.2491":"2021-10-08T00:42:38.735Z","2.0.0-nightly.2497":"2021-10-09T00:34:54.192Z","2.0.0-nightly.2500":"2021-10-10T00:40:23.251Z","2.0.0-nightly.2501":"2021-10-11T00:38:22.137Z","2.0.0-nightly.2503":"2021-10-12T00:38:46.475Z","2.0.0-nightly.2506":"2021-10-12T23:13:53.217Z","2.0.0":"2021-10-13T14:43:41.934Z","2.0.1-nightly.2508":"2021-10-14T00:39:35.576Z","2.0.1-nightly.2509":"2021-10-15T00:41:17.552Z","2.0.1-nightly.2510":"2021-10-16T00:40:15.587Z","2.0.1-nightly.2511":"2021-10-17T00:42:26.719Z","2.0.1-nightly.2512":"2021-10-19T00:37:33.021Z","2.0.1-nightly.2513":"2021-10-22T00:40:31.605Z","2.0.1-nightly.2514":"2021-10-25T00:44:30.168Z","2.0.1-nightly.2517":"2021-10-27T00:40:08.910Z","2.0.1-nightly.2518":"2021-10-28T00:39:23.353Z","2.0.1-nightly.2519":"2021-10-30T00:42:09.603Z","2.0.1-nightly.2520":"2021-11-01T00:40:27.627Z","2.0.1-nightly.2521":"2021-11-02T00:43:51.093Z","2.0.1-nightly.2527":"2021-11-03T00:43:32.555Z","2.0.1-nightly.2528":"2021-11-05T00:42:25.484Z","2.0.1-nightly.2529":"2021-11-06T00:41:18.141Z","2.0.1":"2021-11-08T16:00:53.743Z","2.0.2-nightly.2533":"2021-11-09T00:42:34.487Z","2.0.2-nightly.2534":"2021-11-13T00:38:45.114Z","2.0.2-nightly.2536":"2021-11-15T00:38:37.116Z","2.0.2-nightly.2540":"2021-11-17T00:46:06.094Z","2.0.2-nightly.2541":"2021-11-22T00:42:44.584Z","2.0.2-nightly.2548":"2021-11-24T00:38:58.486Z","2.0.2-nightly.2549":"2021-11-25T00:39:38.290Z","2.0.2-nightly.2554":"2021-11-29T00:42:16.913Z","2.0.2-nightly.2556":"2021-11-30T00:45:01.071Z","2.0.2-nightly.2558":"2021-12-01T00:38:24.236Z","2.0.2-nightly.2563":"2021-12-09T00:40:40.309Z","2.0.2-nightly.2564":"2021-12-12T00:38:38.891Z","2.0.2-nightly.2566":"2021-12-12T18:32:20.082Z","2.0.2-nightly.2569":"2021-12-14T01:15:13.219Z","2.0.2-nightly.2571":"2021-12-16T19:12:01.407Z","2.0.2-nightly.2572":"2021-12-17T02:38:07.762Z","2.0.2-nightly.2573":"2021-12-17T21:54:10.795Z","2.0.2-nightly.2575":"2021-12-20T00:39:16.867Z","2.0.2-nightly.2576":"2021-12-26T00:52:50.308Z","2.0.2-nightly.2581":"2021-12-30T00:37:44.920Z","2.0.2-nightly.2584":"2022-01-02T00:36:54.314Z","2.0.2-nightly.2585":"2022-01-03T00:39:14.759Z","2.0.2-nightly.2589":"2022-01-05T00:40:51.699Z","2.1.0":"2022-01-05T16:21:26.731Z","2.1.1-nightly.2593":"2022-01-06T00:38:33.707Z","2.1.1":"2022-01-06T18:38:15.818Z","2.1.2-nightly.2600":"2022-01-08T00:41:29.327Z","2.1.2-nightly.2601":"2022-01-11T22:16:24.950Z","2.2.0":"2022-01-12T16:35:33.785Z","2.2.1-nightly.2605":"2022-01-14T00:39:28.921Z","2.2.1":"2022-01-17T18:10:31.696Z","2.2.2-nightly.2609":"2022-01-18T00:42:02.294Z"},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"description":"Lightweight Babylon AST traversal","author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"license":"MIT","readme":"","readmeFilename":"","homepage":"https://github.com/parcel-bundler/parcel#readme","repository":{"type":"git","url":"git+https://github.com/parcel-bundler/parcel.git","directory":"packages/utils/babylon-walk"},"bugs":{"url":"https://github.com/parcel-bundler/parcel/issues"}}