{"name":"estree-to-babel","version":"10.0.0","keywords":["ast","convert","estree","babel","espree"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"estree-to-babel@10.0.0","homepage":"http://github.com/coderaiser/estree-to-babel","bugs":{"url":"https://github.com/coderaiser/estree-to-babel/issues"},"dist":{"shasum":"f1ba7f9680adcafe0b30429b3f6fb31c1cf178f7","tarball":"http://registry-npm.ywwl.com/estree-to-babel/download/estree-to-babel-10.0.0.tgz","fileCount":18,"integrity":"sha512-V0Rj2ICUBEeoVhMVhxFMpQmpFDZVoNs2VgRgB9Yw2V0RcXto3ZjywfAmSzfDMY9nXlyAJGyYntKptOpSZQ9DBg==","signatures":[{"sig":"MEUCIQDGiiJ5CTaigMwj2KecK3oUZkbrgRXEKv4I6ajTUjdRaAIgLWkaKmq9ST5n79qVzyFzaHzVL88liVekxNUoSGk8m5g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25736,"size":7548,"noattachment":false,"key":"/estree-to-babel/-/estree-to-babel-10.0.0.tgz"},"main":"lib/estree-to-babel.js","type":"commonjs","types":"./lib/estree-to-babel.d.ts","engines":{"node":">=18"},"gitHead":"a8713ae7e4eb208724d718978a1de6afd068c237","scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","fixture":"madrun fixture","coverage":"madrun coverage","fix:lint":"madrun fix:lint","test:dts":"madrun test:dts","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"repository":{"url":"git+https://github.com/coderaiser/estree-to-babel.git","type":"git"},"_npmVersion":"10.9.0","description":"convert estree ast to babel","directories":{},"_nodeVersion":"22.8.0","dependencies":{"@putout/babel":"^2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.1.2","acorn":"^8.0.1","eslint":"^9.8.0","espree":"^10.0.1","madrun":"^10.0.0","putout":"^36.0.3","meriyah":"^6.0.2","nodemon":"^3.0.1","check-dts":"^0.8.0","supertape":"^10.1.0","typescript":"^5.1.3","acorn-stage3":"^4.0.0","eslint-plugin-putout":"^23.1.0","estree-util-attach-comments":"^3.0.0","@typescript-eslint/typescript-estree":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/estree-to-babel_10.0.0_1729947476245_0.8152056393786711","host":"s3://npm-registry-packages"},"readme":"# Estree-to-babel [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/estree-to-babel.svg?style=flat&longCache=true\n[BuildStatusURL]: https://github.com/coderaiser/estree-to-babel/actions?query=workflow%3A%22Node+CI%22 \"Build Status\"\n[BuildStatusIMGURL]: https://github.com/coderaiser/estree-to-babel/workflows/Node%20CI/badge.svg\n[NPMURL]: https://npmjs.org/package/estree-to-babel \"npm\"\n[BuildStatusURL]: https://travis-ci.org/coderaiser/estree-to-babel \"Build Status\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/estree-to-babel?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/estree-to-babel/badge.svg?branch=master&service=github\n\nConvert [`ESTree`](https://github.com/estree/estree)-compatible `JavaScript AST` to [`Babel AST`](https://github.com/babel/babel/blob/main/packages/babel-parser/ast/spec.md).\n\nTo use parsers like:\n\n- [`acorn`](https://github.com/acornjs/acorn)\n- [`cherow`](https://github.com/cherow/cherow)\n- [`espree`](https://github.com/eslint/espree)\n- etc...\n\nWith `babel` tools like:\n\n- [`@babel/traverse`](https://babeljs.io/docs/en/babel-traverse)\n- [`@babel/types`](https://babeljs.io/docs/en/babel-types)\n- etc...\n\nThe thing is [`@babel/parser`](https://babeljs.io/docs/en/babel-parser) has a [little differences](https://babeljs.io/docs/en/babel-parser#output) with `estree` standard:\n\n- `Property` of `ObjectExpression` and `ObjectPattern` called `ObjectProperty`;\n- `FunctionExpression` of a `Property` located in `ObjectMethod` node;\n- `File` node;\n- `StringLiteral`, `NumericLiteral`, `NullLiteral`, `RegExpLiteral`, `BooleanLiteral` instead of `Literal`;\n- `ClassMethod` instead of `MethodDefinition`;\n- `ClassPrivateMethod`;\n- `ClassPrivateName` stores name as `Identifier` in `id` field;\n- `ClassPrivateProperty` instead of `FieldDefinition`;\n- `OptionalMemberExpression` and `OptionalCallExpression` instead of `ChainExpression`;\n- `ImportDeclaration` and `ExportNamedDeclaration` has `attributes`;\n- `JSXText` has `extra` field;\n- etc...\n\nAlso [`@babel/parser`](https://babeljs.io/docs/en/babel-parser) has differences with [`typescript-estree`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree):\n\n- `ClassPrivateProperty` instead of `PropertyDefinition` when `key.type=PrivateName`;\n- `ClasseProperty` instead of `PropertyDefinition` when `key.type=Identifier`;\n- `PrivateName` instead of `PrivateIdentifier`;\n- `TSQualifiedName` instead of `MemberExpression`  in `TSInterfaceHeritage`;\n- `TSDeclaredMethod` with `abstract=true` instead of `TSAbstractMethodDefinition`;\n- etc...\n\n`estree-to-babel` aims to smooth this differences.\n\n## Install\n\n```\nnpm i estree-to-babel\n```\n\n### Example\n\n```js\nconst cherow = require('cherow');\nconst toBabel = require('estree-to-babel');\nconst traverse = require('@babel/traverse').default;\n\nconst ast = toBabel(cherow.parse(`\n    const f = ({a}) => a;\n`));\n\ntraverse({\n    ObjectProperty(path) {\n        console.log(path.value.name);\n        // output\n        'a';\n    },\n});\n```\n\n## License\n\nMIT\n","publish_time":1729947476421,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1729947476421,"dist-tags":{"latest":"12.0.1"}}