{"name":"magic-string-ast","version":"0.6.0","license":"MIT","_id":"magic-string-ast@0.6.0","maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"homepage":"https://github.com/sxzz/magic-string-ast#readme","bugs":{"url":"https://github.com/sxzz/magic-string-ast/issues"},"dist":{"shasum":"484be48aae0860bdac1b3e97edc7827f561c797f","tarball":"http://registry-npm.ywwl.com/magic-string-ast/download/magic-string-ast-0.6.0.tgz","fileCount":7,"integrity":"sha512-TFODfAlfOZmuhFQ+h9qKDhL13un2FCoJ1bqWuhT5kUXr35W4tkcOWqvoCvKpuXymLcVAaNpFIvDZbope1pXGww==","signatures":[{"sig":"MEQCICAzXI8BRkvUVz3T8WbY/onBv7IjwCOyxz2ZvySRS3SJAiB8lATqe3rnJd0fc9j9N7/LbfFC9EOpVKUmovfg1xuyog==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13131,"size":3698,"noattachment":false,"key":"/magic-string-ast/-/magic-string-ast-0.6.0.tgz"},"main":"./dist/index.js","type":"module","_from":"file:magic-string-ast-0.6.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.14.0"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"},"./*":"./*"},"scripts":{"lint":"eslint .","test":"vitest","build":"tsup","release":"bumpp && pnpm publish","lint:fix":"pnpm run lint --fix"},"_npmUser":{"name":"sxzz","email":"sxzz@sxzz.moe"},"prettier":"@sxzz/prettier-config","_resolved":"/private/var/folders/d9/9drlr87n4j904th57x6955l40000gn/T/24226382f4adfd0dc9a033e6b05a0ed5/magic-string-ast-0.6.0.tgz","_integrity":"sha512-TFODfAlfOZmuhFQ+h9qKDhL13un2FCoJ1bqWuhT5kUXr35W4tkcOWqvoCvKpuXymLcVAaNpFIvDZbope1pXGww==","repository":{"url":"git+https://github.com/sxzz/magic-string-ast.git","type":"git"},"_npmVersion":"10.5.0","description":"magic-string with Babel AST shortcut.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"magic-string":"^0.30.10"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.2","tsup":"^8.0.2","bumpp":"^9.4.0","eslint":"^9.1.0","vitest":"^1.5.0","prettier":"^3.2.5","fast-glob":"^3.3.2","typescript":"^5.4.5","@types/node":"^20.12.7","@babel/types":"^7.24.0","magic-string-stack":"^0.1.1","@sxzz/eslint-config":"^3.9.1","@sxzz/prettier-config":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/magic-string-ast_0.6.0_1714743960925_0.014966005572127017","host":"s3://npm-registry-packages"},"readme":"# magic-string-ast\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![JSR][jsr-badge-src]][jsr-badge-href]\n[![Unit Test][unit-test-src]][unit-test-href]\n\n[magic-string](https://github.com/rich-harris/magic-string) with AST shortcut.\n\n## Install\n\n```bash\n# npm\nnpm i magic-string-ast\n\n# jsr\nnpx jsr add -D @sxzz/magic-string-ast\n```\n\n## Usage\n\n```ts\nimport { MagicStringAST } from 'magic-string-ast'\n\nconst offset = 0\nconst node = {\n  // AST node with `start` and `end` properties\n  start: 6,\n  end: 7,\n  // ...\n}\n\nconst s = new MagicStringAST('const a = 1')\ns.sliceNode(node, { offset }) // 'a'\ns.removeNode(node)\ns.moveNode(node, 0)\ns.overwriteNode(node, 'foo')\n\n// support source-map, inspired by muggle-string.\ns.replaceRange(5, 5, '(', expression, ')') // appendLeft\ns.replaceRange(5, 8, '(', expression, ')') // overwrite\ns.replaceRange(5, 8) // remove\n```\n\nFor more APIs, see [docs](https://jsr.io/@sxzz/magic-string-ast/doc) and [magic-string](https://github.com/rich-harris/magic-string#usage).\n\n## Sponsors\n\n<p align=\"center\">\n  <a href=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\">\n    <img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>\n  </a>\n</p>\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [Kevin Deng](https://github.com/sxzz)\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/magic-string-ast.svg\n[npm-version-href]: https://npmjs.com/package/magic-string-ast\n[npm-downloads-src]: https://img.shields.io/npm/dm/magic-string-ast\n[npm-downloads-href]: https://www.npmcharts.com/compare/magic-string-ast?interval=30\n[jsr-badge-src]: https://jsr.io/badges/@sxzz/magic-string-ast\n[jsr-badge-href]: https://jsr.io/@sxzz/magic-string-ast\n[unit-test-src]: https://github.com/sxzz/magic-string-ast/actions/workflows/unit-test.yml/badge.svg\n[unit-test-href]: https://github.com/sxzz/magic-string-ast/actions/workflows/unit-test.yml\n","publish_time":1714743961060,"_cnpm_publish_time":1714743961060,"dist-tags":{"latest":"2.1.1"}}