{"name":"magic-string-ast","version":"1.0.3","author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","_id":"magic-string-ast@1.0.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":"51ef7832fd5c70a0188fb94627caa3b8c74ff9bf","tarball":"http://registry-npm.ywwl.com/magic-string-ast/download/magic-string-ast-1.0.3.tgz","fileCount":5,"integrity":"sha512-CvkkH1i81zl7mmb94DsRiFeG9V2fR2JeuK8yDgS8oiZSFa++wWLEgZ5ufEOyLHbvSbD1gTRKv9NdX69Rnvr9JA==","signatures":[{"sig":"MEUCIQDS4zphHen1VHiF4iNRbT0KiGptXbpLdSqR18UimnqseQIgcfUetKXtDBdfg0f89Mqx6zA4O8XPM2BcVXcKeep1NpM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/magic-string-ast@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":9948,"size":3749,"noattachment":false,"key":"/magic-string-ast/-/magic-string-ast-1.0.3.tgz"},"main":"./dist/index.js","type":"module","_from":"file:magic-string-ast-1.0.3.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","tsdown":{"exports":true,"inlineOnly":[]},"engines":{"node":">=20.19.0"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"funding":"https://github.com/sponsors/sxzz","scripts":{"lint":"eslint .","test":"vitest","build":"tsdown","format":"prettier --cache --write .","release":"bumpp","lint:fix":"pnpm run lint --fix","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:45cf375a-1e82-4987-9476-971eb8e7703a"}},"prettier":"@sxzz/prettier-config","_resolved":"/tmp/8f2cb3e363ef687eea3a3fdaba50cf40/magic-string-ast-1.0.3.tgz","_integrity":"sha512-CvkkH1i81zl7mmb94DsRiFeG9V2fR2JeuK8yDgS8oiZSFa++wWLEgZ5ufEOyLHbvSbD1gTRKv9NdX69Rnvr9JA==","repository":{"url":"git+https://github.com/sxzz/magic-string-ast.git","type":"git"},"_npmVersion":"11.6.1","description":"magic-string with AST shortcut.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"magic-string":"^0.30.19"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.6","bumpp":"^10.3.1","eslint":"^9.37.0","tsdown":"^0.15.6","vitest":"^3.2.4","prettier":"^3.6.2","fast-glob":"^3.3.3","typescript":"^5.9.3","@types/node":"^24.7.0","magic-string-stack":"^1.1.0","@sxzz/eslint-config":"^7.2.7","@sxzz/prettier-config":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/magic-string-ast_1.0.3_1759765103025_0.34927549424046744","host":"s3://npm-registry-packages-npm-production"},"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":1759765103227,"_cnpm_publish_time":1759765103227,"dist-tags":{"latest":"2.1.1"}}