| 69 | * @returns {RawSourceMap} identity source map |
| 70 | */ |
| 71 | const 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 |