"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("@pnpm/client");
const package_store_1 = require("@pnpm/package-store");
const LRU = require("lru-cache");
const fs = require("mz/fs");
exports.default = async (opts) => {
    var _a;
    const { resolve, fetchers } = client_1.default({
        authConfig: opts.rawConfig,
        ca: opts.ca,
        cert: opts.cert,
        fullMetadata: false,
        httpProxy: opts.httpProxy,
        httpsProxy: opts.httpsProxy,
        key: opts.key,
        localAddress: opts.localAddress,
        metaCache: new LRU({
            max: 10000,
            maxAge: 120 * 1000,
        }),
        noProxy: opts.noProxy,
        offline: opts.offline,
        preferOffline: opts.preferOffline,
        retry: {
            factor: opts.fetchRetryFactor,
            maxTimeout: opts.fetchRetryMaxtimeout,
            minTimeout: opts.fetchRetryMintimeout,
            retries: opts.fetchRetries,
        },
        storeDir: opts.storeDir,
        strictSSL: (_a = opts.strictSsl) !== null && _a !== void 0 ? _a : true,
        userAgent: opts.userAgent,
    });
    await fs.mkdir(opts.storeDir, { recursive: true });
    return {
        ctrl: await package_store_1.default(resolve, fetchers, {
            ignoreFile: opts.ignoreFile,
            networkConcurrency: opts.networkConcurrency,
            packageImportMethod: opts.packageImportMethod,
            storeDir: opts.storeDir,
            verifyStoreIntegrity: typeof opts.verifyStoreIntegrity === 'boolean' ?
                opts.verifyStoreIntegrity : true,
        }),
        dir: opts.storeDir,
    };
};
//# sourceMappingURL=createNewStoreController.js.map