rolldown-string
undefined
Last updated 4 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rolldown-string 
SYNC missed versions from official npm registry.

rolldown-string

npm version npm downloads Unit Test

A compatibility layer for magic-string to work with Rolldown and other bundlers.

  • In Rolldown, native magic-string is used to optimize performance.
  • If native support is unavailable, it gracefully falls back to the JavaScript implementation of magic-string.

Recommended for use with unplugin.

Install

npm i rolldown-string

Usage

withMagicString

Higher-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 / generateTransform

More 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)
  },
}

Sponsors

License

MIT License © 2025-PRESENT Kevin Deng

Current Tags

  • 0.2.1                                ...           latest (4 months ago)

4 Versions

  • 0.2.1                                ...           4 months ago
  • 0.2.0                                ...           4 months ago
  • 0.1.0                                ...           4 months ago
  • 0.0.0                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (11)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |