import { c as cliArgs, d as defaultCliArgs, w as watch, a as compile } from './index.esm2.js';
export { c as cliArgs, d as defaultCliArgs } from './index.esm2.js';
import 'tslib';
import '@component-controls/logger';
import 'webpack';
import 'path';
import 'fs';
import '@component-controls/config';
import '@component-controls/core';
import '@component-controls/core/node-utils';
import '@component-controls/loader/plugin';
import '@component-controls/webpack-configs';
import 'yargs';

const getArgs = (options) => {
    const argv = cliArgs([...defaultCliArgs, ...(options || [])]);
    return argv.help().alias('help', 'h').argv;
};
const run = async (options) => {
    const argv = getArgs(options);
    process.env.NODE_ENV = argv.mode;
    const exec = argv.watch ? watch : compile;
    await exec({
        configPath: argv.config,
        presets: argv.presets,
        bundleName: argv.bundle,
        distFolder: argv.dist,
        staticFolder: argv.static,
        logOptions: {
            logLevel: argv.loglevel,
        },
    });
};

export { getArgs, run };
