"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractPackageFile = void 0;
const logger_1 = require("../../../logger");
const schema_utils_1 = require("../../../util/schema-utils");
const bazel_dep_1 = require("./bazel-dep");
const parser_1 = require("./parser");
function extractPackageFile(content, packageFile) {
    try {
        const records = (0, parser_1.parse)(content);
        return (0, schema_utils_1.LooseArray)(bazel_dep_1.ToBazelDep)
            .transform((deps) => (deps.length ? { deps } : null))
            .parse(records);
    }
    catch (err) {
        logger_1.logger.debug({ err, packageFile }, 'Failed to parse bazel module file.');
        return null;
    }
}
exports.extractPackageFile = extractPackageFile;
//# sourceMappingURL=extract.js.map