/ c4f / front / node_modules / magic-string-ast /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/9 months ago -  
[TXT]README.md9 months ago1.1K 
[   ]LICENSE9 months ago1.1K 
[   ]package.json9 months ago1.5K 
README.md

magic-string-ast npm

Unit Test

Extend Babel AST for magic-string.

Install

npm i magic-string-ast

Usage

import { MagicString } from 'magic-string-ast'

const offset = 0
const node = {
  // ...
  // AST node from @babel/parser
}

const s = new MagicString('const a = 1')
s.removeNode(node)
s.moveNode(node, 0)
console.log(s.sliceNode(node, { offset }))
s.overwriteNode(node, 'const b = 2')

For more APIs, see magic-string.

Sponsors

License

MIT License © 2023 三咲智子

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80