UNPKG

nullvoid

Version:
48 lines 1.63 kB
"use strict"; /** * Placeholder SARIF module - will be migrated next */ Object.defineProperty(exports, "__esModule", { value: true }); exports.generateSarifOutput = generateSarifOutput; exports.writeSarifFile = writeSarifFile; function generateSarifOutput(result) { // Placeholder implementation return { $schema: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", version: "2.1.0", runs: [{ tool: { driver: { name: "NullVoid", version: "1.3.18" } }, results: result.threats.map(threat => ({ ruleId: threat.type, message: { text: threat.message }, level: threat.severity.toLowerCase(), locations: [{ physicalLocation: { artifactLocation: { uri: threat.package } } }] })) }] }; } async function writeSarifFile(filePath, sarifOutput) { const fs = require('fs'); const path = require('path'); // Ensure directory exists const dir = path.dirname(filePath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } // Write file fs.writeFileSync(filePath, JSON.stringify(sarifOutput, null, 2)); } //# sourceMappingURL=sarif.js.map