{"name":"esast-util-from-estree","version":"1.1.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","dependencies":{"@types/estree-jsx":"^0.0.1","estree-util-visit":"^1.0.0","unist-util-position-from-estree":"^1.0.0"},"devDependencies":{"@types/tape":"^4.0.0","acorn":"^8.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.39.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":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"feed056d1d92c622ee64875c113580ae423cffeb","homepage":"https://github.com/syntax-tree/esast-util-from-estree#readme","_id":"esast-util-from-estree@1.1.0","_nodeVersion":"15.11.0","_npmVersion":"7.11.1","dist":{"integrity":"sha512-dYPtKkQjjZvMp6X2KFTxqBSWxevlqn8u6pfBA3HFvU0/N2xqWc344wOhKtB859Qz0+yGc6SqYAwIOmoXPHBIrA==","shasum":"c6654a934c2e9651f787837a1f83681e7c414442","tarball":"http://registry-npm.ywwl.com/esast-util-from-estree/download/esast-util-from-estree-1.1.0.tgz","fileCount":4,"unpackedSize":9263,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkECvCRA9TVsSAnZWagAAkX8P/R+g6mMXdFwdfMhee8vv\ncfnJzyFONABqZJsjjmuJEz9cqVW6RSCR5wORh3Qi7lXMryUAfUC3r0Tz9qCo\n65WEc/WOQlgOXY5diaoCzWBnKCvNgCEWzI++hy71aUCoAwOJ5kZeWTwEvBW4\nyaq1fxRK53aQuxUAlDsciEUNfTw18XIS9PfOlBrp3Af33fDa5XqDtOFI7I7K\n9JN+mIZrlL4RDQhH3lsIOmaMw+QVmsGyn2XtNAlQ2ZySAVx3w5JSSIXw8FHc\n954PDZdcC86ytm7N8DyJaeUAgyjPd1rY0hLKYJtC9aeu36MdS8LMISbha8Or\nQpT/+Ujv8mmuIZiAQQLXCaWgFcSRFyGqpS8nNcf4rSLOQmW/RA+tHHEBsOhQ\nDZNPSrPu+LCyEvRuJBmg9WZvIEaKInFtonMl9yTZfFdU8nvXgHOSnaBgrNWV\n+4lTXv6DMi+SCNixcEPQA6RacFMhneR80bfjPOfJTLIZOhIpODax36e7hey5\nz0kIRvQD27vb/P5bunp8OvwtXM70Ph3Aycb54ACAHStB4hK63E8zCNqTpvhN\nB/4TwAH8qIB66zOJkoCqjeqaK/wbV+RUfWtV5G22qEOdPhlMVGmWt5Qn0/ZL\nAHhDF0UqJj/ZqJk0cHahXo0QtJhAbBcWjj92arYaeqcnxyjIOvxsmLlRi0u1\n+Fcg\r\n=qoYx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrrMHFDH6ZarjLtgpqcr8MCTb009ko7F6MRPNgCwIP2gIhAK5Iq+E7l6tCEVet6KvEu13aSca+vDCBnPVTe/CHL9hu"}],"size":3842,"noattachment":false,"key":"/esast-util-from-estree/-/esast-util-from-estree-1.1.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.1.0_1620066479245_0.20745336837346806"},"_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":1620066479426,"_cnpm_publish_time":1620066479426,"dist-tags":{"latest":"2.0.0"}}