"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_core_1 = require("@bluebase/cli-core");
const deepmerge_1 = __importDefault(require("deepmerge"));
const fromRoot_1 = __importDefault(require("../scripts/fromRoot"));
const path_1 = __importDefault(require("path"));
const EnvVars = cli_core_1.Utils.EnvVars;
exports.fromHere = (file) => {
    return path_1.default.resolve(__dirname, file);
};
exports.default = (input, args) => {
    const configs = {
        target: 'node',
        mode: cli_core_1.Utils.isProduction() ? 'production' : 'development',
        host: EnvVars.string('HOST', '0.0.0.0'),
        port: EnvVars.number('PORT', 1337),
        welcomeMessage: EnvVars.string('WELCOME_MSG', 'Hello world!'),
        disableSSR: true,
        browserCacheMaxAge: '365d',
        cspExtensions: {
            childSrc: [],
            connectSrc: [],
            defaultSrc: [],
            fontSrc: [],
            imgSrc: [],
            mediaSrc: [],
            // manifestSrc: [],
            objectSrc: [],
            scriptSrc: [],
            styleSrc: [],
        },
        serviceWorker: {
            enabled: true,
            fileName: 'sw.js',
            includePublicAssets: [
                // NOTE: This will include ALL of our public folder assets.  We do
                // a glob pull of them and then map them to /foo paths as all the
                // public folder assets get served off the root of our application.
                // You may or may not want to be including these assets.  Feel free
                // to remove this or instead include only a very specific set of
                // assets.
                './**/*',
            ],
            offlinePageFileName: 'offline.html',
        },
        // TODO:
        // extensions: [
        // 	'.web.ts', '.ts',
        // 	'.web.tsx', '.tsx',
        // 	'.web.js', '.js',
        // 	'.web.jsx', '.jsx'
        // ],
        extensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
        srcEntryFile: exports.fromHere('../server/index'),
        includePaths: [
            args.configDir,
            cli_core_1.Utils.fromProjectRoot('./src'),
            fromRoot_1.default('node_modules')
            // fromHere('../../server'),
            // fromHere('../../client/App'),
        ],
        outputPath: path_1.default.join(args.buildDir, 'server'),
        nodeExternalsFileTypeWhitelist: [],
    };
    return deepmerge_1.default(input, configs);
};
//# sourceMappingURL=server.config.js.map