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

Function build

tests/MagicString/indent.test.ts:237–242  ·  view source on GitHub ↗
(s: MagicString)

Source from the content-addressed store, hash-verified

235 const original = 'const a = 1;\nconst b = 2;\n\nexport { a, b };\n'
236
237 const build = (s: MagicString) => {
238 s.prepend('// header\n')
239 s.appendLeft(12, '\nconst inserted = 3;')
240 s.overwrite(13, 25, 'const b = 20;\nconst c = 30;')
241 s.append('// footer\n')
242 }
243
244 const generated = new MagicString(original)
245 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