{"name":"esast-util-from-estree","version":"1.3.0","description":"esast utility to transform from estree","license":"MIT","keywords":["esast","esast-util","util","utility","recma","esast","estree","javascript","ecmascript","tree","ast","transform"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/esast-util-from-estree.git"},"bugs":{"url":"https://github.com/syntax-tree/esast-util-from-estree/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/estree-jsx":"^1.0.0","estree-util-visit":"^1.0.0","unist-util-position-from-estree":"^1.0.0"},"devDependencies":{"@types/tape":"^4.0.0","acorn":"^8.0.0","acorn-jsx":"^5.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.51.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"cbdda152acb2c3e20fe4bfd308921cfa2e0182ce","homepage":"https://github.com/syntax-tree/esast-util-from-estree#readme","_id":"esast-util-from-estree@1.3.0","_nodeVersion":"18.2.0","_npmVersion":"8.13.2","dist":{"integrity":"sha512-/7J22ZcSPEY3DUpOr/agTeIJCTVhTXbCCBajPDjtSXYQOd8stzXFWqOVpfs5em5Hk42XUVC4xfHLp1ZoanKQuA==","shasum":"a3b9a11755f54452817d847c6a59151064b600db","tarball":"http://registry-npm.ywwl.com/esast-util-from-estree/download/esast-util-from-estree-1.3.0.tgz","fileCount":5,"unpackedSize":11692,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFDeBpG39Lnw1G+rSmtkikNFKWlZnRTaA+/psj0fnsW3AiEAkO/3cOSrcHzCBW3kQsupQQLCY4qbydmOQf1o6ADUyuU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi3RimACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmppTQ/+Kx4L4pyRkrlBUgcZ/yat3I5aBveDK5uBXCyAfY7KAGT8GqRk\r\nRYyUtbKb98If57301KYj4voJQPJbhll3jch7pHHKnXdHSWWGmWntihb4twJA\r\nI5xXOD8/+1QYx/0kzQg1hRAAZYKaGN8otSD8gPZqg1L1XTn0CwzsppDjh7oB\r\nAYKzUT/f7tb/Ivt1F0jPcOScoU/mPSyCK6bIOVRAGn4tlnppHEn6bxHoxjIO\r\nWAOcTwKTiY1dLKCYGuEWeR7Zd7jSCm1nPEgsjvA3ugf3gPk8x1IquiQE0+9l\r\nKD31FiJX3m1gsaN9ly8r3+alPjjbvjtn8lr6L8WQhUiEfsdgbLH+7Mvy3pQ4\r\nG76aG2DgtB7CkvPIBU3CV4N5egHSMa4oY8ZKvFirueIkUUMmyhNiIh9WdUwO\r\n1TnIQnlbzQLVZPnch+gu/tw8QRbANWqmv6VeUmtMHr0g9Sevg77cZWov+s4Q\r\nfcaP0PfVyY6LCTbAJ5OJ8kClZr3y3iIuR4dcZfyT42leq0vPOmV9pNANLQei\r\npGQXOlUyv1XIanBdClR4HugcfTgLEH88QwAMP/ooYqceR/9P6NzxRu4l0K9c\r\nBXAv1AV4LsFG46+bwy2Q7nHmFTNa7STeqsvDXRozzNh6GW3qd9rXD2WG82ai\r\nJF+uvpNj6rS9dtsvrJqAh2ZeeFqrtjEskVM=\r\n=AUB4\r\n-----END PGP SIGNATURE-----\r\n","size":4593,"noattachment":false,"key":"/esast-util-from-estree/-/esast-util-from-estree-1.3.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esast-util-from-estree_1.3.0_1658656934616_0.2998449434025279"},"_hasShrinkwrap":false,"readme":"# esast-util-from-estree\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[esast][] utility to transform from [estree][].\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    *   [`fromEstree(estree[, options])`](#fromestreeestree-options)\n    *   [`Options`](#options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package applies some transforms to a cloned, given estree to make it\ncompatible with unist.\nIt:\n\n*   makes sure nodes are plain JSON\n*   adds unist positions\n*   normalizes `.bigint`\n*   remove `attributes`, `selfClosing` from `JSXOpeningFragment`\n*   removes certain discouraged fields\n\n## When should I use this?\n\nThe transform applied by this utility is often optional: estrees can be used in\nmost places where esast can be used, and vice versa.\nBut, if you come from a unist background and want to deal with JavaScript,\nor want to use unist utilities with JavaScript, this helps a lot.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install esast-util-from-estree\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {fromEstree} from 'https://esm.sh/esast-util-from-estree@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {fromEstree} from 'https://esm.sh/esast-util-from-estree@2?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {parse} from 'acorn'\nimport {fromEstree} from './index.js'\n\n// Make acorn support comments and positional info.\n/** @type {Array<import('acorn').Comment>} */\nconst comments = []\n/** @type {import('estree').Program} */\n// @ts-expect-error: acorn looks like estree.\nconst estree = parse(\n  'export function x() { /* Something senseless */ console.log(/(?:)/ + 1n) }',\n  {\n    sourceType: 'module',\n    ecmaVersion: 'latest',\n    locations: true,\n    onComment: comments\n  }\n)\nestree.comments = comments\n\nconst esast = fromEstree(estree)\n\nconsole.log(esast)\n```\n\nYields:\n\n```js\n{\n  type: 'Program',\n  body: [\n    {\n      type: 'ExportNamedDeclaration',\n      declaration: [Object],\n      specifiers: [],\n      source: null,\n      position: [Object]\n    }\n  ],\n  sourceType: 'module',\n  comments: [\n    {\n      type: 'Block',\n      value: ' Something senseless ',\n      position: [Object]\n    }\n  ],\n  position: {\n    start: {line: 1, column: 1, offset: 0},\n    end: {line: 1, column: 75, offset: 74}\n  }\n}\n```\n\n## API\n\nThis package exports the identifier [`fromEstree`][api-from-estree].\nThere is no default export.\n\n### `fromEstree(estree[, options])`\n\nTurn an estree into an esast.\n\n###### Parameters\n\n*   `estree` ([`EstreeNode`][estree])\n    — estree\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nClean clone of `estree` ([`UnistNode`][esast]).\n\n### `Options`\n\nConfiguration (TypeScript Type).\n\n###### Fields\n\n*   `dirty` (`boolean`, default: `false`)\n    — leave discouraged fields in the tree\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`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, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`esast-util-from-estree@^2`, compatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definition -->\n\n[build-badge]: https://github.com/syntax-tree/esast-util-from-estree/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/esast-util-from-estree/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/esast-util-from-estree.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/esast-util-from-estree\n\n[downloads-badge]: https://img.shields.io/npm/dm/esast-util-from-estree.svg\n\n[downloads]: https://www.npmjs.com/package/esast-util-from-estree\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=esast-util-from-estree\n\n[size]: https://bundlejs.com/?q=esast-util-from-estree\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[esast]: https://github.com/syntax-tree/esast\n\n[estree]: https://github.com/estree/estree\n\n[api-from-estree]: #fromestreeestree-options\n\n[api-options]: #options\n","publish_time":1658656934787,"_cnpm_publish_time":1658656934787,"dist-tags":{"latest":"2.0.0"}}