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

Function flatten

tests/Bundle/toMagicString.test.ts:169–177  ·  view source on GitHub ↗
(location?: number)

Source from the content-addressed store, hash-verified

167
168 it('ignores sourcemap locations past the end of their source', () => {
169 const flatten = (location?: number) => {
170 const a = new MagicString('ab')
171 if (location !== undefined)
172 a.addSourcemapLocation(location)
173 const b = new Bundle()
174 b.addSource(a)
175 b.addSource(new MagicString('cd'))
176 return b.toMagicString().generateDecodedMap()
177 }
178
179 // 3 is past the end of 'ab' but would land on 'd' once offset into the bundle
180 assert.deepEqual(flatten(3), flatten())

Callers 1

Calls 4

addSourcemapLocationMethod · 0.95
addSourceMethod · 0.95
toMagicStringMethod · 0.95
generateDecodedMapMethod · 0.45

Tested by

no test coverage detected