{"_id":"recma-parse","_rev":"3918642","name":"recma-parse","description":"recma plugin to parse JavaScript","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"remcohaszing","email":""},{"name":"timneutkens","email":"tim@timneutkens.nl"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"time":{"modified":"2025-09-01T01:21:00.000Z","created":"2024-10-18T11:35:24.337Z","1.0.0":"2024-10-18T11:35:24.337Z"},"users":{},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"repository":{"type":"git","url":"git+https://github.com/mdx-js/recma.git#main"},"versions":{"1.0.0":{"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"bugs":{"url":"https://github.com/mdx-js/recma/issues"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"@types/estree":"^1.0.0","esast-util-from-js":"^2.0.0","unified":"^11.0.0","vfile":"^6.0.0"},"description":"recma plugin to parse JavaScript","exports":"./index.js","funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"homepage":"https://github.com/mdx-js/recma","keywords":["abstract","ast","javascript","parse","plugin","recma-plugin","recma","syntax","tree","unified"],"license":"MIT","name":"recma-parse","repository":{"type":"git","url":"git+https://github.com/mdx-js/recma.git#main"},"scripts":{},"sideEffects":false,"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"type":"module","version":"1.0.0","_id":"recma-parse@1.0.0","gitHead":"dda808fc7f68aed7ce89f4c945666ae17c133a7b","types":"./index.d.ts","_nodeVersion":"22.7.0","_npmVersion":"10.9.0","dist":{"shasum":"c351e161bb0ab47d86b92a98a9d891f9b6814b52","size":4674,"noattachment":false,"key":"/recma-parse/-/recma-parse-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/recma-parse/download/recma-parse-1.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"remcohaszing","email":""},{"name":"timneutkens","email":"tim@timneutkens.nl"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/recma-parse_1.0.0_1729251324128_0.9760036489644606"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-10-18T11:35:24.337Z","publish_time":1729251324337,"_source_registry_name":"default","_cnpm_publish_time":1729251324337}},"readme":"# recma-parse\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n[![Size][badge-size-image]][badge-size-url]\n[![Sponsors][badge-sponsors-image]][badge-collective-url]\n[![Backers][badge-backers-image]][badge-collective-url]\n[![Chat][badge-chat-image]][badge-chat-url]\n\n**[recma][github-recma]** plugin to add support for parsing JavaScript.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`unified().use(recmaParse[, options])`](#unifieduserecmaparse-options)\n  * [`Options`](#options)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][github-unified] ([recma][github-recma]) plugin that\ndefines how to take JavaScript as input and turn it into a syntax tree.\nWhen it’s used,\nJavaScript can be parsed and other recma plugins can be used.\n\nSee [the monorepo readme][github-recma] for info on what the recma ecosystem is.\n\n## When should I use this?\n\nThis plugin adds support to unified for parsing JavaScript.\nIf you also need to serialize JavaScript,\nyou can alternatively use [`recma`][github-recma-core],\nwhich combines unified,\nthis plugin,\nand [`recma-stringify`][github-recma-stringify].\n\nIf you don’t use plugins and want to access the syntax tree,\nyou can directly use [`esast-util-from-js`][github-esast-util-from-js],\nwhich is used inside this plugin.\nrecma focusses on making it easier to transform code by abstracting such\ninternals away.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 16+),\ninstall with [npm][npm-install]:\n\n```sh\nnpm install recma-parse\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport recmaParse from 'https://esm.sh/recma-parse@1'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import recmaParse from 'https://esm.sh/recma-parse@1?bundle'\n</script>\n```\n\n## Use\n\nSay we have the following module `example.js`:\n\n```js\nimport recmaBuildJsx from 'recma-build-jsx'\nimport recmaJsx from 'recma-jsx'\nimport recmaParse from 'recma-parse'\nimport recmaStringify from 'recma-stringify'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(recmaParse)\n  .use(recmaJsx)\n  .use(recmaBuildJsx)\n  .use(recmaStringify)\n  .process('console.log(<em>Hi!</em>)')\n\nconsole.log(String(file))\n```\n\n…running that with `node example.js` yields:\n\n```js\nconsole.log(React.createElement(\"em\", null, \"Hi!\"));\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`recmaParse`][api-recma-parse].\n\n### `unified().use(recmaParse[, options])`\n\nPlugin to add support for parsing from JavaScript.\n\n###### Parameters\n\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\nSame as [`Options`][github-esast-util-from-js-options]\nfrom [`esast-util-from-js`][github-esast-util-from-js].\n\n## Syntax\n\nJS is parsed according to [ECMA-262][tc39-ecma-262],\nwhich is also followed by all browsers and engines such as Node.js.\n\n## Syntax tree\n\nThe syntax tree format used in recma is [esast][github-esast] and\n[estree][github-estree].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type\n[`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release,\nwe drop support for unmaintained versions of Node.\nThis means we try to keep the current release line,\n`recma-parse@1`,\ncompatible with Node.js 16.\n\n## Security\n\nAs **recma** works on JS and evaluating JS is unsafe,\nuse of recma can also be unsafe.\nDo not evaluate unsafe code.\n\nUse of recma plugins could also open you up to other attacks.\nCarefully assess each plugin and the risks involved in using them.\n\nFor info on how to submit a report, see our [security policy][health-security].\n\n## Contribute\n\nSee [§ Contribute][mdxjs-contribute] on our site for ways to get started.\nSee [§ Support][mdxjs-support] for ways to get help.\n\nThis project has a [code of conduct][health-coc].\nBy interacting with this repository,\norganization,\nor community you agree to abide by its terms.\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n<!-- Definitions -->\n\n[api-options]: #options\n\n[api-recma-parse]: #unifieduserecmaparse-options\n\n[badge-backers-image]: https://opencollective.com/unified/backers/badge.svg\n\n[badge-build-image]: https://github.com/mdx-js/recma/actions/workflows/main.yml/badge.svg\n\n[badge-build-url]: https://github.com/mdx-js/recma/actions\n\n[badge-collective-url]: https://opencollective.com/unified\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/mdx-js/recma.svg\n\n[badge-coverage-url]: https://codecov.io/github/mdx-js/recma\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/recma-parse.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/recma-parse\n\n[badge-size-image]: https://img.shields.io/bundlejs/size/recma-parse\n\n[badge-size-url]: https://bundlejs.com/?q=recma-parse\n\n[badge-sponsors-image]: https://opencollective.com/unified/sponsors/badge.svg\n\n[badge-chat-image]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[badge-chat-url]: https://github.com/mdx-js/mdx/discussions\n\n[esmsh]: https://esm.sh\n\n[file-license]: license\n\n[github-esast]: https://github.com/syntax-tree/esast\n\n[github-esast-util-from-js]: https://github.com/syntax-tree/esast-util-from-js\n\n[github-esast-util-from-js-options]: https://github.com/syntax-tree/esast-util-from-js#options\n\n[github-estree]: https://github.com/estree/estree\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-recma-core]: https://github.com/mdx-js/recma/tree/main/packages/recma\n\n[github-recma-stringify]: https://github.com/mdx-js/recma/tree/main/packages/recma-stringify\n\n[github-recma]: https://github.com/mdx-js/recma\n\n[github-unified]: https://github.com/unifiedjs/unified\n\n[health-coc]: https://github.com/mdx-js/.github/blob/main/code-of-conduct.md\n\n[health-security]: https://github.com/mdx-js/.github/blob/main/security.md\n\n[mdxjs-contribute]: https://mdxjs.com/community/contribute/\n\n[mdxjs-support]: https://mdxjs.com/community/support/\n\n[npm-install]: https://docs.npmjs.com/cli/install\n\n[tc39-ecma-262]: https://tc39.es/ecma262/multipage/\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","_attachments":{},"homepage":"https://github.com/mdx-js/recma","bugs":{"url":"https://github.com/mdx-js/recma/issues"},"license":"MIT"}