Skip to content

Commit

Permalink
rsimha feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri committed Sep 23, 2021
1 parent de5c258 commit 787e2ec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions build-system/tasks/check-sourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ function checkSourcemapMappings(sourcemapJson, map) {
throw new Error('Could not find mappings array');
}

// In closure builds there is a newline immediately after the AMP_CONFIG.
// This whole segment has no mapping to the original source.
// Therefore we must skip the zeroth sub-array, indicated by a ';'.
// In esbuild builds there is no newline after the config, so the
// first line is fair game.
const firstLineIndex = shouldUseClosure() ? 1 : 0;

// See https://www.npmjs.com/package/sourcemap-codec#usage.
const firstLineMapping = decode(sourcemapJson.mappings)[
// In closure builds there is a newline immediately after the AMP_CONFIG.
// This whole segment has no mapping to the original source.
// Therefore we must skip the zeroth sub-array, indicated by a ';'.

// In esbuild compiled binaries there is no newline after the config, so the first line is fair game.
shouldUseClosure() ? 1 : 0
][0];
const firstLineMapping = decode(sourcemapJson.mappings)[firstLineIndex][0];
const [, sourceIndex = 0, sourceCodeLine = 0, sourceCodeColumn] =
firstLineMapping;

Expand Down

0 comments on commit 787e2ec

Please sign in to comment.