bin/jud-devtool.js
function buildAndStart() {
    if (/^https?:\/\//.test(Program.file)) {
        var url = Program.file.replace(/^(https?:\/\/)([^/:]+)(?=:\d+|\/)/, function (m, a, b) {
            if (!/\d+\.\d+\.\d+\.\d+/.test(a)) {
                return a + Hosts.findRealHost(b);
            }
            else {
                return m;
            }
        });
        Config.entryBundleUrl = url;
        startServerAndLaunchDevtool();
    }
    else {
        var filePath = Path.resolve(Program.file);
        var ext = Path.extname(filePath);
        if (!Fs.existsSync(filePath)) {
            console.error(filePath + ': No such file or directory');
            return Exit(0);
        }
        if (ext == '.ju' || ext == '.vue') {
            console.log('building...');
            console.time('Build completed!');
            buildFileAndWatchIt(Program.mode, filePath).then(function () {
                console.timeEnd('Build completed!');
                startServerAndLaunchDevtool(Program.file);
            }, function (err) {
                if (err) {
                    console.log(err, err.stack);
                }
                Exit(0);
            })

        }
        else if (ext == '.js') {
            buildFileAndWatchIt('copy', filePath).then(function () {
                startServerAndLaunchDevtool(Program.file);
            })
        }
        else if (!ext) {
            //处理目录
            if (Fs.statSync(filePath).isDirectory()) {
                Config.root = filePath;
                startServerAndLaunchDevtool(Program.entry)
            }
            else {
                console.error(Program.file + ' is not a directory!');
                Exit(0);
            }
        }
        else {
            console.error('Error:unsupported file type: ', ext);
            return Exit(0);
        }
    }
}
function buildAndStart() {
    if (/^https?:\/\//.test(Program.file)) {
        var url = Program.file.replace(/^(https?:\/\/)([^/:]+)(?=:\d+|\/)/, function (m, a, b) {
            if (!/\d+\.\d+\.\d+\.\d+/.test(a)) {
                return a + Hosts.findRealHost(b);
            }
            else {
                return m;
            }
        });
        Config.entryBundleUrl = url;
        startServerAndLaunchDevtool();
    }
    else {
        var filePath = Path.resolve(Program.file);
        var ext = Path.extname(filePath);
        if (!Fs.existsSync(filePath)) {
            console.error(filePath + ': No such file or directory');
            return Exit(0);
        }
        if (ext == '.ju' || ext == '.vue') {
            console.log('building...');
            console.time('Build completed!');
            buildFileAndWatchIt(Program.mode, filePath).then(function () {
                console.timeEnd('Build completed!');
                startServerAndLaunchDevtool(Program.file);
            }, function (err) {
                if (err) {
                    console.log(err, err.stack);
                }
                Exit(0);
            })

        }
        else if (ext == '.js') {
            buildFileAndWatchIt('copy', filePath).then(function () {
                startServerAndLaunchDevtool(Program.file);
            })
        }
        else if (!ext) {
            //处理目录
            if (Fs.statSync(filePath).isDirectory()) {
                Config.root = filePath;
                startServerAndLaunchDevtool(Program.entry)
            }
            else {
                console.error(Program.file + ' is not a directory!');
                Exit(0);
            }
        }
        else {
            console.error('Error:unsupported file type: ', ext);
            return Exit(0);
        }
    }
}
//////////////////////////////////////////////////////////////////////////