{"name":"esast-util-from-estree","version":"1.1.1","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":"^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":"^10.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.47.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":"c25a24575a2b94e44f6db98f2183c1e9eed23d4f","homepage":"https://github.com/syntax-tree/esast-util-from-estree#readme","_id":"esast-util-from-estree@1.1.1","_nodeVersion":"17.4.0","_npmVersion":"8.4.1","dist":{"integrity":"sha512-k0cAWz27tCmez/tORtWBiEK7WAD+S3lLAS4N5Vs0khq3VnzZDucjlajULf0HycAUyyiBId7ml/a1jrxGvLAa3w==","shasum":"daffdf303f428829c7a6fe4835ff2fbe5d625650","tarball":"http://registry-npm.ywwl.com/esast-util-from-estree/download/esast-util-from-estree-1.1.1.tgz","fileCount":5,"unpackedSize":9954,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/9iFCRA9TVsSAnZWagAAIG4P/j7B+iMc0rr0Uza0dLcF\nuR1OIoHqPfRSPwst7C5AVTq1UzGm6fkA5LdQUYZmax9WETZnam/GZpBragNK\n4UMp1n+KJ2evqs9JDtaFoPg3+09ZZVYmjw4Ynqua3Yw4bbyqV72fhS9duPh3\nLVSM8AAJryEoVR49kxpuibbg3zvgzjwNLQj1JfhHtvZp48hw9DPpJTpcVNrF\nCsmo2v5WSEDXn9D9ahyZE0Olv2dTEHmkmJgGPegq3ZiEslW3vKB9O/ShHUEM\ncaIyt2iGP5gXmyU/MH81TXFs4fWwfJ/B6TCU6szBJeQh0XFa6ZPTEzNY0P98\nOq9FGzPBkVwLr3IcrzI0XL5ami+6uzFNp349gPG9ouOU5su64MHYUslZ3ZbQ\nKXG8cn6k1OjNShW3H6EA6dVJo0QmkhsD/D+PThaWaFxrmAGdarZF178avP5K\n5nLFH7QFukA7MwzveDBRPxpJqf6cAmpGbN+3ZdplFM7n2mhNtBdTHRW81TS8\nj6lvG1FzwaYSjBMI4OYyGnhQCdBKrMtnOXYVw3xd2DkI9ZRQIOpfI3EkyLzl\nGSHwN+sQHWfDoWhTV8iLnwfbL/YooB5E+H5pNJtFUlqEygH3Z/dNdMzG0LEh\nh5OE70boeWWrcXxh9vvVzLN98NYPoeN+hGBY3wf4i2ThH9TxsCyv6x9obblz\nJzpo\r\n=I3zv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQ0hf9+SzsAEQSd6Gfzi01Wyx3FShfKC9WZXjFdhs91AIgHZMFUHr514mnKE2+kGJ6PFb4Hdyq7KDW8pXJlb0AaFA="}],"size":3998,"noattachment":false,"key":"/esast-util-from-estree/-/esast-util-from-estree-1.1.1.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.1_1644157060914_0.4325342557489218"},"_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":1644157061044,"_cnpm_publish_time":1644157061044,"dist-tags":{"latest":"2.0.0"}}