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

Function build

test/MagicString.test.ts:1155–1160  ·  view source on GitHub ↗
(s: MagicString)

Source from the content-addressed store, hash-verified

1153 const original = 'const a = 1;\nconst b = 2;\n\nexport { a, b };\n'
1154
1155 const build = (s: MagicString) => {
1156 s.prepend('// header\n')
1157 s.appendLeft(12, '\nconst inserted = 3;')
1158 s.overwrite(13, 25, 'const b = 20;\nconst c = 30;')
1159 s.append('// footer\n')
1160 }
1161
1162 const generated = new MagicString(original)
1163 build(generated)

Callers 1

Calls 4

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

Tested by

no test coverage detected