MCPcopy Index your code
hub / github.com/webpack/webpack / createIdentitySourceMap

Function createIdentitySourceMap

lib/typescript/TypeScriptPlugin.js:71–86  ·  view source on GitHub ↗
(resource, originalSource)

Source from the content-addressed store, hash-verified

69 * @returns {RawSourceMap} identity source map
70 */
71const createIdentitySourceMap = (resource, originalSource) => {
72 const lineCount = (originalSource.match(/\n/g) || []).length + 1;
73 // Mappings: each line emits a single segment at column 0 mapping to
74 // column 0 of the same line in the source. `AAAA` for line 1, `;AACA`
75 // for each subsequent line (cumulative source-line delta of +1 per line).
76 const mappings = `AAAA${";AACA".repeat(lineCount - 1)}`;
77
78 return {
79 version: 3,
80 file: resource,
81 sources: [resource],
82 sourcesContent: [originalSource],
83 names: [],
84 mappings
85 };
86};
87
88/**
89 * Compose the strip-types source map with an upstream loader source map so the

Callers 1

_processResultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected