"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, {
        storeController: store.ctrl,
        storeDir: store.dir,
    });
    if (!input || !input.length) {
        return supi_1.mutateModules([
            {
                dependencyNames: input,
                manifest: await readImporterManifest_1.readImporterManifestOnly(opts.dir, opts),
                mutation: 'unlinkSome',
                rootDir: opts.dir,
            },
        ], unlinkOpts);
    }
    return supi_1.mutateModules([
        {
            manifest: await readImporterManifest_1.readImporterManifestOnly(opts.dir, opts),
            mutation: 'unlink',
            rootDir: opts.dir,
        },
    ], unlinkOpts);
}
exports.default = default_1;
