{"name":"magic-string-ast","version":"0.6.3","license":"MIT","_id":"magic-string-ast@0.6.3","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":"99684592d00b382fafcc47d290dd79fa4a688925","tarball":"http://registry-npm.ywwl.com/magic-string-ast/download/magic-string-ast-0.6.3.tgz","fileCount":7,"integrity":"sha512-C9sgUzVZtUtzCBoMdYtwrIRQ4IucGRFGgdhkjL7PXsVfPYmTuWtewqzk7dlipaCMWH/gOYehW9rgMoa4Oebtpw==","signatures":[{"sig":"MEUCIB3t3uTrMtEcNCW4mCq/IOAJwSMqHiPD7UIupGIAhe7fAiEAjJ8i+cHWpemaAALvhqBItpv/uUWLrAYbtHd83uW6KnI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13525,"size":3818,"noattachment":false,"key":"/magic-string-ast/-/magic-string-ast-0.6.3.tgz"},"main":"./dist/index.js","type":"module","_from":"file:magic-string-ast-0.6.3.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","format":"prettier --cache --write .","release":"bumpp && pnpm publish","lint:fix":"pnpm run lint --fix","typecheck":"tsc --noEmit"},"_npmUser":{"name":"sxzz","email":"sxzz@sxzz.moe"},"prettier":"@sxzz/prettier-config","_resolved":"/private/var/folders/d9/9drlr87n4j904th57x6955l40000gn/T/0b85dac024becb1d5b3180c78e48fb0d/magic-string-ast-0.6.3.tgz","_integrity":"sha512-C9sgUzVZtUtzCBoMdYtwrIRQ4IucGRFGgdhkjL7PXsVfPYmTuWtewqzk7dlipaCMWH/gOYehW9rgMoa4Oebtpw==","repository":{"url":"git+https://github.com/sxzz/magic-string-ast.git","type":"git"},"_npmVersion":"10.9.0","description":"magic-string with Babel AST shortcut.","directories":{},"_nodeVersion":"22.11.0","dependencies":{"magic-string":"^0.30.13"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","tsup":"^8.3.5","bumpp":"^9.8.1","eslint":"^9.15.0","vitest":"^2.1.5","prettier":"^3.3.3","fast-glob":"^3.3.2","typescript":"^5.6.3","@types/node":"^22.9.1","@babel/types":"^7.26.0","magic-string-stack":"^0.1.1","@sxzz/eslint-config":"^4.4.1","@sxzz/prettier-config":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/magic-string-ast_0.6.3_1732064422728_0.2257447718313379","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":1732064422912,"_cnpm_publish_time":1732064422912,"dist-tags":{"latest":"2.1.1"}}