MCPcopy Create free account
hub / github.com/vercel/vercel / transformSourceMap

Function transformSourceMap

packages/next/src/utils.ts:4577–4591  ·  view source on GitHub ↗

* Makes the sources more human-readable in the source map * by removing webpack-specific prefixes

(
  sourcemap: RawSourceMap | null
)

Source from the content-addressed store, hash-verified

4575 * by removing webpack-specific prefixes
4576 */
4577function transformSourceMap(
4578 sourcemap: RawSourceMap | null
4579): RawSourceMap | undefined {
4580 if (!sourcemap) return;
4581 const sources = sourcemap.sources
4582 ?.map(source => {
4583 return source.replace(/^webpack:\/\/?_N_E\/(?:\.\/)?/, '');
4584 })
4585 // Hide the Next.js entrypoint
4586 .map(source => {
4587 return source.startsWith('?') ? '[native code]' : source;
4588 });
4589
4590 return { ...sourcemap, sources };
4591}
4592
4593interface LambdaGroupTypeInterface {
4594 isApiLambda: boolean;

Callers 1

getMiddlewareBundleFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected