fix(ngcc): handle mappings outside the content when flattening source-maps (#35718)
Previously when rendering flattened source-maps, it was assumed that no mapping would come from a line that is outside the lines of the actual source content. It turns out this is not a valid assumption. Now the code that renders flattened source-maps will handle such mappings, with the additional benefit that the rendered source-map will only contain mapping lines up to the last mapping, rather than a mapping line for every content line. Fixes #35709 PR Close #35718
This commit is contained in:

committed by
Matias Niemelä

parent
72c4fda613
commit
73cf7d5cb4
@ -174,7 +174,6 @@ runInEachFileSystem(() => {
|
||||
[5, 0, 1, 20], [7, 0, 1, 22], [12, 0, 1, 27], [14, 0, 1, 28], [15, 0, 1, 29],
|
||||
[9, 0, 2, 13], [10, 0, 2, 14]
|
||||
],
|
||||
[],
|
||||
];
|
||||
|
||||
JS_CONTENT_MAP = fromObject({
|
||||
@ -196,15 +195,12 @@ runInEachFileSystem(() => {
|
||||
'file': 'file.js',
|
||||
'sources': ['file.js'],
|
||||
'names': [],
|
||||
'mappings': encode([
|
||||
[], [], [], [], [], [], [], [], [], [], [], [], [[0, 0, 0, 0]],
|
||||
[], [], [], [], [], [], [], [], []
|
||||
]),
|
||||
'mappings': encode([[], [], [], [], [], [], [], [], [], [], [], [], [[0, 0, 0, 0]]]),
|
||||
'sourcesContent': [JS_CONTENT.contents],
|
||||
});
|
||||
|
||||
const MERGED_OUTPUT_PROGRAM_MAPPINGS: SourceMapMappings =
|
||||
[[], [], [], [], [], [], [], [], [], [], [], [], ...JS_CONTENT_MAPPINGS, []];
|
||||
[[], [], [], [], [], [], [], [], [], [], [], [], ...JS_CONTENT_MAPPINGS];
|
||||
|
||||
MERGED_OUTPUT_PROGRAM_MAP = fromObject({
|
||||
'version': 3,
|
||||
|
Reference in New Issue
Block a user