MCPcopy
hub / github.com/vitejs/vite / getCodeWithSourcemap

Function getCodeWithSourcemap

packages/vite/src/node/server/sourcemap.ts:143–159  ·  view source on GitHub ↗
(
  type: 'js' | 'css',
  code: string,
  map: SourceMap,
)

Source from the content-addressed store, hash-verified

141}
142
143export function getCodeWithSourcemap(
144 type: 'js' | 'css',
145 code: string,
146 map: SourceMap,
147): string {
148 if (debug) {
149 code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`
150 }
151
152 if (type === 'js') {
153 code += `\n//# sourceMappingURL=${genSourceMapUrl(map)}`
154 } else if (type === 'css') {
155 code += `\n/*# sourceMappingURL=${genSourceMapUrl(map)} */`
156 }
157
158 return code
159}
160
161export function applySourcemapIgnoreList(
162 map: ExistingRawSourceMap,

Callers 3

sendFunction · 0.90
devHtmlHookFunction · 0.90
getContentWithSourcemapFunction · 0.90

Calls 1

genSourceMapUrlFunction · 0.85

Tested by

no test coverage detected