"use strict";
const constantDefaults_1 = require("./constantDefaults");
const semver = require("semver");
const pnpm_logger_1 = require("pnpm-logger");
const CAN_PRESERVE_SYMLINKS = semver.satisfies(process.version, '>=6.3.0');
const defaults = () => ({
    fetchRetries: 2,
    fetchRetryFactor: 10,
    fetchRetryMintimeout: 1e4,
    fetchRetryMaxtimeout: 6e4,
    storePath: '~/.pnpm-store',
    globalPath: constantDefaults_1.DEFAULT_GLOBAL_PATH,
    ignoreScripts: false,
    linkLocal: false,
    strictSsl: true,
    tag: 'latest',
    production: process.env.NODE_ENV === 'production',
    cwd: process.cwd(),
    nodeVersion: process.version,
    force: false,
    depth: 0,
    cacheTTL: 60 * 60 * 24,
    flatTree: false,
    engineStrict: false,
    preserveSymlinks: CAN_PRESERVE_SYMLINKS,
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (opts) => {
    if (opts && opts.preserveSymlinks && !CAN_PRESERVE_SYMLINKS) {
        pnpm_logger_1.default.warn('The active Node version does not support --preserve-symlinks');
        delete opts.preserveSymlinks;
    }
    const extendedOpts = Object.assign({}, defaults(), opts);
    if (extendedOpts.flatTree === true && !extendedOpts.preserveSymlinks) {
        throw new Error('`--preserve-symlinks` and so `--flat-tree` are not supported on your system, make sure you are running on Node ≽ 6.3.0');
    }
    return extendedOpts;
};
//# sourceMappingURL=extendOptions.js.map