fix(ngcc): handle missing sources when flattening source-maps (#35718)
If a package has a source-map but it does not provide the actual content of the sources, then the source-map flattening was crashing. Now we ignore such mappings that have no source since we are not able to compute the merged mapping if there is no source file. Fixes #35709 PR Close #35718
This commit is contained in:

committed by
Matias Niemelä

parent
01ab168774
commit
72c4fda613
@ -290,11 +290,16 @@ export function parseMappings(
|
||||
const generatedLineMappings = rawMappings[generatedLine];
|
||||
for (const rawMapping of generatedLineMappings) {
|
||||
if (rawMapping.length >= 4) {
|
||||
const originalSource = sources[rawMapping[1] !];
|
||||
if (originalSource === null || originalSource === undefined) {
|
||||
// the original source is missing so ignore this mapping
|
||||
continue;
|
||||
}
|
||||
const generatedColumn = rawMapping[0];
|
||||
const name = rawMapping.length === 5 ? rawMap.names[rawMapping[4]] : undefined;
|
||||
const mapping: Mapping = {
|
||||
generatedSegment: {line: generatedLine, column: generatedColumn},
|
||||
originalSource: sources[rawMapping[1] !] !,
|
||||
originalSource,
|
||||
originalSegment: {line: rawMapping[2] !, column: rawMapping[3] !}, name
|
||||
};
|
||||
mappings.push(mapping);
|
||||
|
Reference in New Issue
Block a user