"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractPackageFile = void 0;
const parser_1 = require("./parser");
const rules_1 = require("./rules");
function extractPackageFile(content, packageFile) {
    const deps = [];
    const fragments = (0, parser_1.parse)(content, packageFile);
    if (!fragments) {
        return null;
    }
    for (let idx = 0; idx < fragments.length; idx += 1) {
        const fragment = fragments[idx];
        const dep = (0, rules_1.extractDepFromFragment)(fragment);
        if (!dep) {
            continue;
        }
        dep.managerData = { idx };
        deps.push(dep);
    }
    return deps.length ? { deps } : null;
}
exports.extractPackageFile = extractPackageFile;
//# sourceMappingURL=extract.js.map