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

Function formatStylusSourceMap

packages/vite/src/node/plugins/css.ts:3103–3120  ·  view source on GitHub ↗
(
  mapBefore: ExistingRawSourceMap | undefined,
  root: string,
)

Source from the content-addressed store, hash-verified

3101}
3102
3103function formatStylusSourceMap(
3104 mapBefore: ExistingRawSourceMap | undefined,
3105 root: string,
3106): ExistingRawSourceMap | undefined {
3107 if (!mapBefore) return undefined
3108 const map = { ...mapBefore }
3109
3110 const resolveFromRoot = (p: string | null) =>
3111 normalizePath(path.resolve(root, p!))
3112
3113 if (map.file) {
3114 map.file = resolveFromRoot(map.file)
3115 }
3116 // Note: the real `Sourcemap#sources` maybe `null`, but rollup typing is not handle it.
3117 map.sources = map.sources!.map(resolveFromRoot)
3118
3119 return map
3120}
3121// #endregion
3122
3123async function getSource(

Callers 1

processFunction · 0.85

Calls 1

resolveFromRootFunction · 0.85

Tested by

no test coverage detected