"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generatePackageDependencies = void 0;
const cals_1 = require("@cloudbase/cals");
const CLOUDBASE_VERSION = '2.6.6-beta.0';
const BASE_DEPS = {
    'miniprogram-gesture': '^1.0.6',
    mobx: '^5',
    'lodash.get': '^4',
    'lodash.set': '^4',
};
/**
 * 注意锁版本
 */
const CLOUDBASE_DEPS = {
    '@cloudbase/auth': CLOUDBASE_VERSION,
    '@cloudbase/weda-client': '1.1.6',
    '@cloudbase/weda-cloud-sdk': '1.0.78',
};
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }) {
    const deps = {};
    if (importJSSDK) {
        deps['@cloudbase/js-sdk'] = CLOUDBASE_VERSION;
    }
    if (mode === 'lib') {
        // eslint-disable-next-line no-restricted-syntax
        for (const key in CLOUDBASE_DEPS) {
            const version = CLOUDBASE_DEPS[key];
            /**
             * lib 模式下采用松散的引用
             */
            deps[key] = /^\d/.test(version) ? `^${version}` : version;
        }
        if (officialLibVersion) {
            deps[cals_1.OFFICIAL_LIB_MP_NPM_PACKAGENAME] = officialLibVersion;
        }
    }
    else {
        for (const key in CLOUDBASE_DEPS) {
            deps[key] = CLOUDBASE_DEPS[key];
        }
    }
    return {
        ...deps,
        ...BASE_DEPS,
    };
}
exports.generatePackageDependencies = generatePackageDependencies;
