MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / build

Function build

test/MagicString/indent.test.ts:228–233  ·  view source on GitHub ↗
(s: MagicString)

Source from the content-addressed store, hash-verified

226 const original = 'const a = 1;\nconst b = 2;\n\nexport { a, b };\n'
227
228 const build = (s: MagicString) => {
229 s.prepend('// header\n')
230 s.appendLeft(12, '\nconst inserted = 3;')
231 s.overwrite(13, 25, 'const b = 20;\nconst c = 30;')
232 s.append('// footer\n')
233 }
234
235 const generated = new MagicString(original)
236 build(generated)

Callers 1

indent.test.tsFile · 0.85

Calls 4

prependMethod · 0.45
appendLeftMethod · 0.45
overwriteMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected