package
A compatibility layer for magic-string to work with Rolldown and other bundlers.
npm install rolldown-stringGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 3 packages.
203.4 kB
Includes dependencies.
A compatibility layer for magic-string to work with Rolldown and other bundlers.
magic-string is used to optimize performance.magic-string.Recommended for use with unplugin.
npm i rolldown-stringwithMagicStringHigher-order function to create a transform hook with magic-string support.
import { withMagicString } from 'rolldown-string'
const plugin = {
transform: withMagicString((s, id) => {
// your transformations...
s.replace('42', '43')
}),
}rolldownString / generateTransformMore flexible way to use rolldown-string.
import { generateTransform, rolldownString } from 'rolldown-string'
const yourPlugin = {
transform(code, id, meta) {
const s = rolldownString(code, id, meta)
// your transformations...
s.replace('42', '43')
return generateTransform(s, id)
},
}MIT License © 2025-PRESENT Kevin Deng