{"_id":"rolldown-string","_rev":"4194786","name":"rolldown-string","description":"A compatibility layer for magic-string to work with Rolldown and other bundlers.","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"time":{"modified":"2026-03-02T02:52:41.000Z","created":"2025-12-15T13:02:50.331Z","0.2.1":"2025-12-15T18:06:16.598Z","0.2.0":"2025-12-15T14:05:17.682Z","0.1.0":"2025-12-15T13:16:58.687Z","0.0.0":"2025-12-15T13:02:50.331Z"},"users":{},"author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"repository":{"type":"git","url":"git+https://github.com/sxzz/rolldown-string.git"},"versions":{"0.2.1":{"name":"rolldown-string","type":"module","version":"0.2.1","description":"A compatibility layer for magic-string to work with Rolldown and other bundlers.","author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","funding":"https://github.com/sponsors/sxzz","homepage":"https://github.com/sxzz/rolldown-string#readme","repository":{"type":"git","url":"git+https://github.com/sxzz/rolldown-string.git"},"bugs":{"url":"https://github.com/sxzz/rolldown-string/issues"},"keywords":["rolldown","unplugin","magic-string","rollup"],"exports":{".":"./dist/index.js","./package.json":"./package.json"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"engines":{"node":">=20.19.0"},"dependencies":{"magic-string":"^0.30.21"},"devDependencies":{"@sxzz/eslint-config":"^7.4.3","@sxzz/prettier-config":"^2.2.6","@sxzz/test-utils":"^0.5.14","@types/node":"^25.0.2","@typescript/native-preview":"7.0.0-dev.20251215.1","bumpp":"^10.3.2","eslint":"^9.39.2","magic-string-ast":"^1.0.3","prettier":"^3.7.4","rolldown":"1.0.0-beta.54","tsdown":"^0.18.0","typescript":"^5.9.3","vitest":"^4.0.15"},"prettier":"@sxzz/prettier-config","scripts":{"lint":"eslint --cache .","lint:fix":"pnpm run lint --fix","build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsgo --noEmit","format":"prettier --cache --write .","release":"bumpp"},"_id":"rolldown-string@0.2.1","_integrity":"sha512-7H8oH5A8+L96pbBTPCt/rZrwayEhZY5/ejhdk9nRODH32H1v7+bfkaCr+kS15DcGQ7VC1HcWdQVNABFYgrMOzg==","_resolved":"/tmp/8b51267ab8bc62ef36900b43e9cbfffd/rolldown-string-0.2.1.tgz","_from":"file:rolldown-string-0.2.1.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"shasum":"331034f391e9a0e509251b22bbccf7816885a5ea","size":3107,"noattachment":false,"key":"/rolldown-string/-/rolldown-string-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/rolldown-string/download/rolldown-string-0.2.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e1233415-e961-4de2-9581-39f2107abcd3"}},"directories":{},"maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rolldown-string_0.2.1_1765821976451_0.3794364885230397"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-12-15T18:06:16.598Z","publish_time":1765821976598,"_source_registry_name":"default","_cnpm_publish_time":1765821976598},"0.2.0":{"name":"rolldown-string","type":"module","version":"0.2.0","description":"A compatibility layer for magic-string to work with Rolldown and other bundlers.","author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","funding":"https://github.com/sponsors/sxzz","homepage":"https://github.com/sxzz/rolldown-string#readme","repository":{"type":"git","url":"git+https://github.com/sxzz/rolldown-string.git"},"bugs":{"url":"https://github.com/sxzz/rolldown-string/issues"},"keywords":["rolldown","unplugin","magic-string","rollup"],"exports":{".":"./dist/index.js","./package.json":"./package.json"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"engines":{"node":">=20.19.0"},"dependencies":{"magic-string":"^0.30.21"},"devDependencies":{"@sxzz/eslint-config":"^7.4.3","@sxzz/prettier-config":"^2.2.6","@sxzz/test-utils":"^0.5.14","@types/node":"^24.10.4","@typescript/native-preview":"7.0.0-dev.20251214.1","bumpp":"^10.3.2","eslint":"^9.39.2","prettier":"^3.7.4","rolldown":"1.0.0-beta.54","tsdown":"^0.17.4","typescript":"^5.9.3","vitest":"^4.0.15"},"prettier":"@sxzz/prettier-config","scripts":{"lint":"eslint --cache .","lint:fix":"pnpm run lint --fix","build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsgo --noEmit","format":"prettier --cache --write .","release":"bumpp"},"_id":"rolldown-string@0.2.0","_integrity":"sha512-HxdK/ZwelcAtUVbAaPIYMGjjdfRxsggDBgHMdIpf0YkRPdmhROHpctG3DQnKmVuMhk03p1QSFxirmpibQ7aAAg==","_resolved":"/tmp/b698ba72352601ef48bddeae6d2f0b8a/rolldown-string-0.2.0.tgz","_from":"file:rolldown-string-0.2.0.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"shasum":"fbbcf0672412ac3455ac5b1b62169c222fb35ebf","size":3041,"noattachment":false,"key":"/rolldown-string/-/rolldown-string-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rolldown-string/download/rolldown-string-0.2.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e1233415-e961-4de2-9581-39f2107abcd3"}},"directories":{},"maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rolldown-string_0.2.0_1765807517542_0.8778847857146492"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-12-15T14:05:17.682Z","publish_time":1765807517682,"_source_registry_name":"default","_cnpm_publish_time":1765807517682},"0.1.0":{"name":"rolldown-string","type":"module","version":"0.1.0","description":"undefined","author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","funding":"https://github.com/sponsors/sxzz","homepage":"https://github.com/sxzz/rolldown-string#readme","repository":{"type":"git","url":"git+https://github.com/sxzz/rolldown-string.git"},"bugs":{"url":"https://github.com/sxzz/rolldown-string/issues"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"engines":{"node":">=20.19.0"},"dependencies":{"magic-string":"^0.30.21"},"devDependencies":{"@sxzz/eslint-config":"^7.4.3","@sxzz/prettier-config":"^2.2.6","@types/node":"^24.10.4","@typescript/native-preview":"7.0.0-dev.20251214.1","bumpp":"^10.3.2","eslint":"^9.39.2","prettier":"^3.7.4","rolldown":"1.0.0-beta.54","tsdown":"^0.17.4","typescript":"^5.9.3","vitest":"^4.0.15"},"prettier":"@sxzz/prettier-config","scripts":{"lint":"eslint --cache .","lint:fix":"pnpm run lint --fix","build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsgo --noEmit","format":"prettier --cache --write .","release":"bumpp"},"_id":"rolldown-string@0.1.0","_integrity":"sha512-Rh4DwHYKWwQbtP91a6eKD5ZC/EPWNIhhpa/3tv67Ct0qp/YoQfs1YCVVAvjMxrVTaPP8yFzY02fmw1K1ToP6Ig==","_resolved":"/tmp/7d89680cce45d1fbb087d50acbbcac0c/rolldown-string-0.1.0.tgz","_from":"file:rolldown-string-0.1.0.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"shasum":"0c50867411ae049260e41a5193dd0e1fa112f3e4","size":2621,"noattachment":false,"key":"/rolldown-string/-/rolldown-string-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rolldown-string/download/rolldown-string-0.1.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e1233415-e961-4de2-9581-39f2107abcd3"}},"directories":{},"maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rolldown-string_0.1.0_1765804618533_0.8728289192156906"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-12-15T13:16:58.687Z","publish_time":1765804618687,"_source_registry_name":"default","_cnpm_publish_time":1765804618687},"0.0.0":{"name":"rolldown-string","type":"module","version":"0.0.0","description":"undefined","author":{"name":"Kevin Deng","email":"sxzz@sxzz.moe"},"license":"MIT","funding":"https://github.com/sponsors/sxzz","homepage":"https://github.com/sxzz/rolldown-string#readme","repository":{"type":"git","url":"git+https://github.com/sxzz/rolldown-string.git"},"bugs":{"url":"https://github.com/sxzz/rolldown-string/issues"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","publishConfig":{"access":"public"},"engines":{"node":">=20.19.0"},"dependencies":{"magic-string":"^0.30.21"},"devDependencies":{"@sxzz/eslint-config":"^7.4.3","@sxzz/prettier-config":"^2.2.6","@types/node":"^24.10.4","@typescript/native-preview":"7.0.0-dev.20251214.1","bumpp":"^10.3.2","eslint":"^9.39.2","prettier":"^3.7.4","rolldown":"1.0.0-beta.54","tsdown":"^0.17.4","typescript":"^5.9.3","vitest":"^4.0.15"},"prettier":"@sxzz/prettier-config","scripts":{"lint":"eslint --cache .","lint:fix":"pnpm run lint --fix","build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsgo --noEmit","format":"prettier --cache --write .","release":"bumpp"},"_id":"rolldown-string@0.0.0","_integrity":"sha512-5uEq7nmwfXCexI2CtrEG/PKCEa0Ds5nNJ8Z7kSmIdIYWxguI58f7oGDWrrlJx2+L1PZVreOXReA1gz9AV2fwcA==","_resolved":"/private/var/folders/d9/9drlr87n4j904th57x6955l40000gn/T/5b00682ed0e9fa2e0ed410d3b01b6313/rolldown-string-0.0.0.tgz","_from":"file:rolldown-string-0.0.0.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.4","dist":{"shasum":"f0ad9311b6a34f10a03e82f23dc621b9cacf6677","size":2345,"noattachment":false,"key":"/rolldown-string/-/rolldown-string-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rolldown-string/download/rolldown-string-0.0.0.tgz"},"_npmUser":{"name":"sxzz","email":"sxzz@sxzz.moe"},"directories":{},"maintainers":[{"name":"sxzz","email":"sxzz@sxzz.moe"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rolldown-string_0.0.0_1765803770189_0.5722284879857937"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-12-15T13:02:50.331Z","publish_time":1765803770331,"_source_registry_name":"default","_cnpm_publish_time":1765803770331}},"readme":"# rolldown-string\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Unit Test][unit-test-src]][unit-test-href]\n\nA compatibility layer for [magic-string](https://github.com/Rich-Harris/magic-string) to work with Rolldown and other bundlers.\n\n- In Rolldown, [native `magic-string`](https://rolldown.rs/in-depth/native-magic-string) is used to optimize performance.\n- If native support is unavailable, it gracefully falls back to the JavaScript implementation of `magic-string`.\n\nRecommended for use with [unplugin](https://github.com/unjs/unplugin).\n\n## Install\n\n```bash\nnpm i rolldown-string\n```\n\n## Usage\n\n### `withMagicString`\n\nHigher-order function to create a `transform` hook with `magic-string` support.\n\n```ts\nimport { withMagicString } from 'rolldown-string'\n\nconst plugin = {\n  transform: withMagicString((s, id) => {\n    // your transformations...\n    s.replace('42', '43')\n  }),\n}\n```\n\n### `rolldownString` / `generateTransform`\n\nMore flexible way to use `rolldown-string`.\n\n```ts\nimport { generateTransform, rolldownString } from 'rolldown-string'\n\nconst yourPlugin = {\n  transform(code, id, meta) {\n    const s = rolldownString(code, id, meta)\n\n    // your transformations...\n    s.replace('42', '43')\n\n    return generateTransform(s, id)\n  },\n}\n```\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 © 2025-PRESENT [Kevin Deng](https://github.com/sxzz)\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/rolldown-string.svg\n[npm-version-href]: https://npmjs.com/package/rolldown-string\n[npm-downloads-src]: https://img.shields.io/npm/dm/rolldown-string\n[npm-downloads-href]: https://www.npmcharts.com/compare/rolldown-string?interval=30\n[unit-test-src]: https://github.com/sxzz/rolldown-string/actions/workflows/unit-test.yml/badge.svg\n[unit-test-href]: https://github.com/sxzz/rolldown-string/actions/workflows/unit-test.yml\n","_attachments":{},"homepage":"https://github.com/sxzz/rolldown-string#readme","bugs":{"url":"https://github.com/sxzz/rolldown-string/issues"},"license":"MIT"}