/ student-intifada / node_modules / magic-string-ast /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/a year ago -  
[   ]LICENSEa year ago1.1K 
[TXT]README.mda year ago1.3K595aea1 more query options + view options [كارل مبارك]
[   ]package.jsona year ago1.3Kafd0ccc remove unused [كارل مبارك]
README.md

magic-string-ast npm JSR

Unit Test

Extend Babel AST for magic-string.

Install

# npm
npm i magic-string-ast

# jsr
npx jsr add -D @sxzz/magic-string-ast

Usage

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

const offset = 0
const node = {
  // AST node from @babel/parser
  start: 6,
  end: 7,
  // ...
}

const s = new MagicStringAST('const a = 1')
s.sliceNode(node, { offset }) // 'a'
s.removeNode(node)
s.moveNode(node, 0)
s.overwriteNode(node, 'foo')

For more APIs, see docs and magic-string.

Sponsors

License

MIT License © 2023-PRESENT 三咲智子

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