{"name":"esrap","version":"1.2.3","description":"Parse in reverse","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/esrap.git"},"type":"module","exports":{".":{"types":"./types/index.d.ts","default":"./src/index.js"}},"types":"./types/index.d.ts","devDependencies":{"@vitest/ui":"^2.0.5","acorn":"^8.10.0","dts-buddy":"^0.2.4","prettier":"^3.0.3","typescript":"^5.2.2","vitest":"^2.0.5","zimmerframe":"^1.0.0"},"scripts":{"check":"tsc","prepublishOnly":"pnpm test && dts-buddy","sandbox":"node test/sandbox/index.js","test":"vitest --run"},"license":"MIT","dependencies":{"@jridgewell/sourcemap-codec":"^1.4.15","@types/estree":"^1.0.1"},"packageManager":"pnpm@9.8.0","_id":"esrap@1.2.3","gitHead":"307df9170067ae921fe068ef39153618bd5f9c56","bugs":{"url":"https://github.com/Rich-Harris/esrap/issues"},"homepage":"https://github.com/Rich-Harris/esrap#readme","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-ZlQmCCK+n7SGoqo7DnfKaP1sJZa49P01/dXzmjCASSo04p72w8EksT2NMK8CEX8DhKsfJXANioIw8VyHNsBfvQ==","shasum":"abe6c0cffeee013aaa8396ad8eaa7c0553768323","tarball":"http://registry-npm.ywwl.com/esrap/download/esrap-1.2.3.tgz","fileCount":8,"unpackedSize":38825,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICJu7Svm8b6zpvM1yiDxbl15rurl7lM7Y6+PLvUBzab8AiEAwqRbI7aICExmgMVhh9oGR4e23FHxWkDKHFVDk2WXFuE="}],"size":9581,"noattachment":false,"key":"/esrap/-/esrap-1.2.3.tgz"},"_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esrap_1.2.3_1732974131134_0.27668913295387565"},"_hasShrinkwrap":false,"readme":"# esrap\n\nParse in reverse. AST goes in, code comes out.\n\n## Usage\n\n```js\nimport { print } from 'esrap';\n\nconst { code, map } = print({\n  type: 'Program',\n  body: [\n    {\n      type: 'ExpressionStatement',\n      expression: {\n        callee: {\n          type: 'Identifier',\n          name: 'alert'\n        },\n        arguments: [\n          {\n            type: 'Literal',\n            value: 'hello world!'\n          }\n        ]\n      }\n    }\n  ]\n});\n\nconsole.log(code); // alert('hello world!');\n```\n\nIf the nodes of the input AST have `loc` properties (e.g. the AST was generated with [`acorn`](https://github.com/acornjs/acorn/tree/master/acorn/#interface) with the `locations` option set), sourcemap mappings will be created.\n\n## Options\n\nYou can pass information that will be added to the resulting sourcemap (note that the AST is assumed to come from a single file):\n\n```js\nconst { code, map } = print(ast, {\n  sourceMapSource: 'input.js',\n  sourceMapContent: fs.readFileSync('input.js', 'utf-8')\n});\n```\n\n## Why not just use Prettier?\n\nBecause it's ginormous.\n\n## Developing\n\nThis repo uses [pnpm](https://pnpm.io). Once it's installed, do `pnpm install` to install dependencies, and `pnpm test` to run the tests.\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1732974131319,"maintainers":[{"name":"rich_harris","email":"richard.a.harris@gmail.com"}],"_cnpm_publish_time":1732974131319,"dist-tags":{"latest":"2.4.0"}}