JS: Format with Prettier v2.4.1 [3/n]

Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
This commit is contained in:
Tim Yung
2021-11-02 22:14:16 -07:00
committed by Facebook GitHub Bot
parent 4e587a1b7d
commit 77ecc7ede1
260 changed files with 1751 additions and 2143 deletions
+14 -10
View File
@@ -15,22 +15,24 @@ const fs = require('fs');
const argv = process.argv.slice(2);
let outputPath;
for (let i = 0; i < argv.length;) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
continue;
}
++i;
for (let i = 0; i < argv.length; ) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
continue;
}
++i;
}
if (!argv.length) {
process.stderr.write(
'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n'
'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n',
);
process.exitCode = -1;
} else {
const [packagerSourcemapPath, compilerSourcemapPath] = argv.splice(0, 2);
const packagerSourcemap = JSON.parse(fs.readFileSync(packagerSourcemapPath, 'utf8'));
const packagerSourcemap = JSON.parse(
fs.readFileSync(packagerSourcemapPath, 'utf8'),
);
const compilerSourcemap = JSON.parse(
fs.readFileSync(compilerSourcemapPath, 'utf8'),
);
@@ -53,7 +55,9 @@ if (!argv.length) {
);
}
const composedMapJSON = JSON.stringify(composeSourceMaps([packagerSourcemap, compilerSourcemap]));
const composedMapJSON = JSON.stringify(
composeSourceMaps([packagerSourcemap, compilerSourcemap]),
);
if (outputPath) {
fs.writeFileSync(outputPath, composedMapJSON, 'utf8');
} else {