@bugsplat/symbol-upload
Version:
Cross platform symbol upload tool
66 lines • 2.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSymbolFileInfos = createSymbolFileInfos;
const promises_1 = require("node:fs/promises");
const node_path_1 = require("node:path");
const dsym_1 = require("./dsym");
const elf_1 = require("./elf");
const pdb_1 = require("./pdb");
const sym_1 = require("./sym");
async function createSymbolFileInfos(symbolFilePath) {
const path = symbolFilePath;
const isFolder = await (0, promises_1.stat)(path).then((stats) => stats.isDirectory());
const extLowerCase = (0, node_path_1.extname)(path).toLowerCase();
const isSymFile = extLowerCase.includes('.sym') && !isFolder;
const isPdbFile = extLowerCase.includes('.pdb') && !isFolder;
const isPeFile = extLowerCase.includes('.exe') || extLowerCase.includes('.dll') && !isFolder;
const isDsymBundle = extLowerCase.includes('.dsym');
const isElfFile = elfExtensions.some((ext) => extLowerCase.includes(ext) && !isFolder);
if (isPdbFile) {
const dbgId = await (0, pdb_1.tryGetPdbGuid)(path);
const moduleName = (0, node_path_1.basename)(path);
return [{
path,
dbgId,
moduleName,
}];
}
if (isPeFile) {
const dbgId = await (0, pdb_1.tryGetPeGuid)(path);
const moduleName = (0, node_path_1.basename)(path);
return [{
path,
dbgId,
moduleName,
}];
}
if (isSymFile) {
const { dbgId, moduleName } = await (0, sym_1.getSymFileInfo)(path);
return [{
path,
dbgId,
moduleName,
}];
}
if (isDsymBundle) {
return (0, dsym_1.getDSymFileInfos)(path);
}
if (isElfFile) {
const dbgId = await (0, elf_1.tryGetElfUUID)(path);
const moduleName = (0, node_path_1.basename)(path);
return [{
path,
dbgId,
moduleName,
}];
}
const dbgId = '';
const moduleName = (0, node_path_1.basename)(path);
return [{
path,
dbgId,
moduleName,
}];
}
const elfExtensions = ['.elf', '.self', '.prx', '.sprx', '.nss'];
//# sourceMappingURL=info.js.map