"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const pFilter = require("p-filter");
const extendOptions_1 = require("./extendOptions");
const getContext_1 = require("./getContext");
const pkgIsUntouched_1 = require("../pkgIsUntouched");
const shrinkwrap_1 = require("../fs/shrinkwrap");
function default_1(maybeOpts) {
    return __awaiter(this, void 0, void 0, function* () {
        const opts = extendOptions_1.default(maybeOpts);
        const ctx = yield getContext_1.default(opts);
        if (!ctx.shrinkwrap)
            return [];
        const pkgPaths = Object.keys(ctx.shrinkwrap.packages || {})
            .map(id => shrinkwrap_1.shortIdToFullId(id, ctx.shrinkwrap.registry))
            .filter(pkgId => ctx.skipped.indexOf(pkgId) === -1)
            .map(pkgPath => path.join(ctx.storePath, pkgPath));
        return yield pFilter(pkgPaths, (pkgPath) => __awaiter(this, void 0, void 0, function* () { return !(yield pkgIsUntouched_1.default(pkgPath)); }));
    });
}
exports.default = default_1;
//# sourceMappingURL=storeStatus.js.map