enable symbolicate for sectioned sourcemaps (#23572)

Summary:
`react-native-symbolicate` usage output claim to work with 4 arguments, though the code supports 3. Furthermore, `Symbolication.parseFileName` is getting a lineNumber argument instead of fileName. Described issues disable usage of sectioned source map symbolication, which was discussed in https://github.com/getsentry/sentry-cli/issues/408.
Duplicate of https://github.com/facebook/react-native/pull/23514 without modified commit history

[General] [Fixed] - enable symbolicate for sectioned/indexed/segmented source maps
Pull Request resolved: https://github.com/facebook/react-native/pull/23572

Differential Revision: D14179787

Pulled By: cpojer

fbshipit-source-id: 15f983c285fc6ac5570d01550fc939b975375bfa
This commit is contained in:
Martynas Bardauskas 2019-02-21 19:39:04 -08:00 коммит произвёл Facebook Github Bot
Родитель fc6f161020
Коммит 9cb93abc47
3 изменённых файлов: 9 добавлений и 3 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -50,7 +50,7 @@ const execute = (args: Array<string>, stdin: string): Promise<string> =>
afterAll(() => {
try {
fs.unlinkSync(resolve('testfile.temp.cpuprofile'));
} catch {}
} catch (e) {}
});
const TESTFILE_MAP = resolve('testfile.js.map');
@ -65,6 +65,11 @@ test('symbolicating a single entry', async () =>
'thrower.js:18:null\n',
));
test('symbolicating a sectioned source map', async () =>
await expect(
execute([resolve('testfile.sectioned.js.map'), '353.js', '1', '72']),
).resolves.toEqual('nested-thrower.js:6:start\n'));
test('symbolicating a profiler map', async () =>
await expect(
execute([TESTFILE_MAP, resolve('testfile.profmap')]),

Просмотреть файл

@ -27,7 +27,7 @@ const fs = require('fs');
const through2 = require('through2');
const argv = process.argv.slice(2);
if (argv.length < 1 || argv.length > 3) {
if (argv.length < 1 || argv.length > 4) {
/* eslint no-path-concat: "off" */
const usages = [
'Usage: ' + __filename + ' <source-map-file>',
@ -109,7 +109,7 @@ if (argv.length === 0) {
// read-from-argv form.
let moduleIds, lineNumber, columnNumber;
if (argv[0].endsWith('.js')) {
moduleIds = Symbolication.parseFileName(argv[1]);
moduleIds = Symbolication.parseFileName(argv[0]);
argv.shift();
} else {
moduleIds = {segmentId: 0, localId: undefined};