"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const default_fetcher_1 = require("@pnpm/default-fetcher");
const default_resolver_1 = require("@pnpm/default-resolver");
const package_store_1 = require("@pnpm/package-store");
const LRU = require("lru-cache");
const path = require("path");
exports.default = async (opts) => {
    // TODO: either print a warning or just log if --no-lock is used
    const sopts = Object.assign(opts, {
        locks: opts.lock ? path.join(opts.store, '_locks') : undefined,
        registry: opts.registry || 'https://registry.npmjs.org/',
    });
    const resolve = default_resolver_1.default(Object.assign(sopts, {
        fullMetadata: false,
        metaCache: new LRU({
            max: 10000,
            maxAge: 120 * 1000,
        }),
    }));
    const fetchers = default_fetcher_1.default(sopts);
    return {
        ctrl: await package_store_1.default(resolve, fetchers, {
            locks: sopts.locks,
            lockStaleDuration: sopts.lockStaleDuration,
            networkConcurrency: sopts.networkConcurrency,
            packageImportMethod: sopts.packageImportMethod,
            store: sopts.store,
        }),
        path: sopts.store,
    };
};
//# sourceMappingURL=createStore.js.map