"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeConfigs = exports.getInitConfig = exports.getDefaultConfig = exports.FileTag = exports.QPC_CONFIG_FILENAME = exports.QPC_DIR = exports.osFromTarget = exports.archFromTarget = exports.TARGETS = void 0;
const object_hash_1 = require("object-hash");
exports.TARGETS = [
    "python-x86_64-linux",
    "python-x86_64-windows",
    "python-x86_64-macos",
    "python-arm64-macos",
    "python-arm64-linux",
    // "python-universal",
    //
    "node-x86_64-linux",
    "node-x86_64-windows",
    "node-x86_64-macos",
    "node-arm64-macos",
    "node-arm64-linux",
    "node-universal",
    //
    "wasm-unknown-unknown",
];
const archFromTarget = (target) => {
    if (target.includes("x86_64")) {
        return "x86_64";
    }
    else if (target.includes("arm64")) {
        return "arm64";
    }
    return "unknown";
};
exports.archFromTarget = archFromTarget;
const osFromTarget = (target) => {
    if (target.includes("linux")) {
        return "linux";
    }
    else if (target.includes("windows")) {
        return "windows";
    }
    else if (target.includes("macos")) {
        return "macos";
    }
    return "unknown";
};
exports.osFromTarget = osFromTarget;
exports.QPC_DIR = ".qpace";
exports.QPC_CONFIG_FILENAME = ".qpace.json";
var FileTag;
(function (FileTag) {
    FileTag["QPC_PYTHON_WHEEL"] = "qpc_python_wheel";
})(FileTag || (exports.FileTag = FileTag = {}));
const getDefaultConfig = () => {
    return {
        rust: {
            qpaceCoreCrate: "qpace_core",
        },
        python: {
            package: "qpace_artifact",
            qpacePackage: "qpace",
        },
        node: {
            package: "qpace_artifact",
            qpacePackage: "qpace",
        },
        web: {
            package: "qpace_artifact",
            qpacePackage: "qpace",
        },
        emit: false,
        out: "build",
        include: ["**/*.pine"],
        exclude: [
            "node_modules",
            "build",
            "dist",
            "target",
            "__pycache__",
            exports.QPC_DIR,
        ],
    };
};
exports.getDefaultConfig = getDefaultConfig;
const getInitConfig = () => {
    const pckgName = `qpace_script_${(0, object_hash_1.MD5)(Date.now()).slice(0, 6)}`;
    return {
        install: true,
        test: true,
        python: {
            package: pckgName,
        },
        node: {
            package: pckgName,
            packageManager: "auto",
        },
        web: {
            package: pckgName,
        },
        outDir: "build",
        include: ["**/*.pine"],
    };
};
exports.getInitConfig = getInitConfig;
const mergeConfigs = (config, newConfig) => {
    return {
        ...config,
        ...newConfig,
        rust: {
            ...config.rust,
            ...newConfig.rust,
        },
        python: {
            ...config.python,
            ...newConfig.python,
        },
        node: {
            ...config.node,
            ...newConfig.node,
        },
        web: {
            ...config.web,
            ...newConfig.web,
        },
    };
};
exports.mergeConfigs = mergeConfigs;
//# sourceMappingURL=config.js.map