"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const supi_1 = require("supi");
const createStoreController_1 = require("../createStoreController");
const readImporterManifest_1 = require("../readImporterManifest");
async function default_1(input, opts) {
    const store = await createStoreController_1.default(opts);
    const unlinkOpts = Object.assign(opts, {
        store: store.path,
        storeController: store.ctrl,
    });
    if (!input || !input.length) {
        return supi_1.mutateModules([
            {
                dependencyNames: input,
                manifest: await readImporterManifest_1.readImporterManifestOnly(opts.prefix, opts),
                mutation: 'unlinkSome',
                prefix: opts.prefix,
            },
        ], unlinkOpts);
    }
    return supi_1.mutateModules([
        {
            manifest: await readImporterManifest_1.readImporterManifestOnly(opts.prefix, opts),
            mutation: 'unlink',
            prefix: opts.prefix,
        },
    ], unlinkOpts);
}
exports.default = default_1;
