{"name":"magic-string-ast","version":"0.5.0","license":"MIT","_id":"magic-string-ast@0.5.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":"b87659f1ebda70f5a097b398a82a7c5be1c2033f","tarball":"http://registry-npm.ywwl.com/magic-string-ast/download/magic-string-ast-0.5.0.tgz","fileCount":7,"integrity":"sha512-mxjxZ5zoR4+ybulZ7Z5qdZUTdAfiKJ1Il80kN/I4jWsHTTqNKZ9KsBa3Jepo+3U09I04qiyC2+7MZD8v4rJOoA==","signatures":[{"sig":"MEUCIQCiIS4ub0UDyRvP9c6pwh+e/4OkERACj0yHpJZKF3aDdgIgK4d583yMei7836pKrtzdfHIGPU9q7UmxBdnvB1rhLPM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12675,"size":3640,"noattachment":false,"key":"/magic-string-ast/-/magic-string-ast-0.5.0.tgz"},"main":"./dist/index.js","type":"module","_from":"file:magic-string-ast-0.5.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/adfd5a71cbdcf4e633139d6f895e6e0c/magic-string-ast-0.5.0.tgz","_integrity":"sha512-mxjxZ5zoR4+ybulZ7Z5qdZUTdAfiKJ1Il80kN/I4jWsHTTqNKZ9KsBa3Jepo+3U09I04qiyC2+7MZD8v4rJOoA==","repository":{"url":"git+https://github.com/sxzz/magic-string-ast.git","type":"git"},"_npmVersion":"10.3.0","description":"Extend Babel AST for magic-string.","directories":{},"_nodeVersion":"20.12.0","dependencies":{"magic-string":"^0.30.9"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.2","tsup":"^8.0.2","bumpp":"^9.4.0","eslint":"^9.0.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","@sxzz/eslint-config":"^3.9.1","@sxzz/prettier-config":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/magic-string-ast_0.5.0_1713349887970_0.33642366902044185","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":1713349888182,"_cnpm_publish_time":1713349888182,"dist-tags":{"latest":"2.1.1"}}