{"name":"acorn-typescript","version":"1.0.2","description":"[![npm version](https://img.shields.io/npm/v/acorn-typescript.svg?style=flat)](https://www.npmjs.com/package/acorn-typescript)[![Coverage Status](https://codecov.io/gh/TyrealHu/acorn-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/TyrealH","source":"src/index.ts","main":"lib/index.js","module":"lib/index.esm.js","types":"lib/index.d.ts","unpkg":"lib/index.umd.js","scripts":{"build":"microbundle --define process.env.NODE_ENV=production --sourcemap --tsconfig ./tsconfig.json","test":"jest --collect-coverage --silent","release-major":"standard-version --release-as major","release-minor":"standard-version --release-as minor","release-patch":"standard-version --release-as patch"},"repository":{"type":"git","url":"git+https://github.com/TyrealHu/acorn-typescript.git"},"author":{"name":"tyrealhu"},"license":"MIT","bugs":{"url":"https://github.com/TyrealHu/acorn-typescript/issues"},"homepage":"https://github.com/TyrealHu/acorn-typescript#readme","devDependencies":{"@types/estree":"^1.0.0","@types/jest":"^24.1.0","acorn":"^8.8.0","jest":"^24.1.0","microbundle":"^0.15.1","standard-version":"^9.5.0","ts-jest":"^26.0.0","ts-node":"^10.9.1","typescript":"^4.8.4"},"dependencies":{"charcodes":"^0.2.0"},"peerDependencies":{"acorn":">=8.0.0"},"gitHead":"35977ab5b041e35191a5903b25666c6bc87cc3e3","_id":"acorn-typescript@1.0.2","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"integrity":"sha512-IROZg/qycD7MpcyKPdDQN2gnt/+e0Ajf9aYoQuDuO/FTz+aZEu40UbB/gjm6YriTHItXPVEUuGTWLXifGGm2Tw==","shasum":"8ab5bf268b2eef0a444063008d413e37c295f3d8","tarball":"http://registry-npm.ywwl.com/acorn-typescript/download/acorn-typescript-1.0.2.tgz","fileCount":20,"unpackedSize":1610989,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDu9LkjrHbx2fp4qO3B9IGkiKACxyUZ3rzBy89uksmOogIgMtp9163fm6CI2F51ycjHWteVaQbjN3tmE+xeCoyrXH4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsS/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMNw/9FLlUBqQmQ3QtxIjvkBorEhHkMKJv7tL3nlHEgzcGoXOiKgdQ\r\nWiCeLPD//p//ivDbyi8q2CDIJEWhpbJtp4ZCozJPA8VeDV+nFscOtxmHYKer\r\nNUcc306pNrPVLvEFKbJzgd1As8g5TnNMzFtGvvB6Q2JbkMZBrMTLb0JzsX9b\r\nMBnnYlrDrTvMr4Xzz5EyMUkmXBNKP7fe7WOJvc+eAJebN5jZPvOQ/Vk2xMAO\r\nsIO9RKGnW6KjGffcST6IwSZ9yI2jQP9BMDN84Q+qeMq4EG2aGBsbretq0EAO\r\nB+1QBv6eTk/SaO3GpzO1tKqMuNkmONYa6F0jfxxGLgnmFs98ZqMsWSe+pBI3\r\n1FDJrsUCXEC3MIKTgU4kgUbHQfDs08JE2gP/R7bLmGo3/xQZX0HsW54u6t0O\r\n6ZiiVnpF+DxMHCHysOgjIFFsvIQA5Dnc1LS1rZfxoOB2uWRfHAUnvDnz80AL\r\nkyYn9mL/33tH6fnlglBllMRALL6CqGvPk1rMzJWVq2NjNDXxe4fcOKy2Oaxm\r\n81vOFY4eJbK9kKhagUe75fKxyu4hgXL2Tuxe6QzzYptFTeVFk0SkkGe3Joia\r\ndnxmloVccEduP8xX8rJHqcWx7XE/VxtkZeODwNnc/AomoztCVrD11mCuGEHj\r\n+xZNotngcUsXvT9KpBQgHnHL3f35t931v+E=\r\n=CHM9\r\n-----END PGP SIGNATURE-----\r\n","size":388131,"noattachment":false,"key":"/acorn-typescript/-/acorn-typescript-1.0.2.tgz"},"_npmUser":{"name":"tyrealhu","email":"995927270@qq.com"},"directories":{},"maintainers":[{"name":"tyrealhu","email":"995927270@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/acorn-typescript_1.0.2_1673446590919_0.008535097390336421"},"_hasShrinkwrap":false,"readme":"# acorn-typescript\n[![npm version](https://img.shields.io/npm/v/acorn-typescript.svg?style=flat)](https://www.npmjs.com/package/acorn-typescript)[![Coverage Status](https://codecov.io/gh/TyrealHu/acorn-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/TyrealHu/acorn-typescript)\n---\n\nThis is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.\n\nIt was created as an experimental alternative, faster [TypeScript](https://www.typescriptlang.org/) parser. It will help you to parse\ntypescript script into typeScript AST.\n\n## Usage\n\nRequiring this module provides you with an Acorn plugin that you can use like this:\n\n```typescript\nimport * as acorn from 'acorn'\nimport tsPlugin from 'acorn-typescript'\n\n/*\n*\n* */\nconst node = acorn.Parser.extend(tsPlugin()).parse(`\nconst a = 1\ntype A = number\nexport {\n  a,\n  type A as B\n}\n`, {\n  sourceType: 'module',\n  ecmaVersion: 'latest',\n  locations: true\n})\n```\n\nIf you want to enable parsing within a TypeScript ambient context, where certain syntax have different rules (like .d.ts files and inside [declare module blocks](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)).\n```typescript\nimport * as acorn from 'acorn'\nimport tsPlugin from 'acorn-typescript'\n\n/*\n*\n* */\nconst node = acorn.Parser.extend(tsPlugin({ dts: true })).parse(`\nconst a = 1\ntype A = number\nexport {\n  a,\n  type A as B\n}\n`, {\n  sourceType: 'module',\n  ecmaVersion: 'latest',\n  locations: true\n})\n```\n\n## Notice\n- You have to enable options.locations while using acorn-typescript\n```ts\nacorn.parse(input, {\n    sourceType: 'module',\n    ecmaVersion: 'latest',\n    // here\n    locations: true\n  })\n```\n\n## SUPPORTED\n- Typescript normal syntax\n- Support to parse TypeScript [Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html)\n- Support to parse JSX & TSX\n\n## CHANGELOG\n\n[click](./CHANGELOG.md)\n\n## RoadMap\n- support import-assertions\n\n## License\n[MIT](https://couto.mit-license.org/)\n","publish_time":1673446591302,"_cnpm_publish_time":1673446591302,"dist-tags":{"latest":"1.4.13"}}