<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Developer; use ModStart\Core\Util\PlatformUtil; use ModStart\Core\Util\ReUtil; include_once __DIR__ . '/../Shell/include.php'; class UniappUtil { public static function runOrFail($umOI_) { goto Z66c2; REbta: if ($B21po !== 0) { shell_echo_error('运行命令 ' . $umOI_ . ' 失败'); die(1); } goto inKfl; Z66c2: shell_echo_info("开始运行 {$umOI_}"); goto Qkb71; Qkb71: passthru($umOI_, $B21po); goto REbta; inKfl: } public static function build($vm4GG) { goto KGhzL; ju_D3: shell_throws_if('解析模块名称失败', empty($X3Epx)); goto tP4CZ; pYv9t: $SIXEW = shell_module_path($X3Epx, 'View/m/' . lcfirst($X3Epx) . '/body.blade.php'); goto Bi6Be; PCwhv: shell_echo_success('打包完成'); goto PMWoF; sbyEU: shell_echo_block('处理静态文件'); goto bTgYl; tP4CZ: shell_echo_success('环境正常'); goto AdLq8; G1BVX: shell_echo_info('更新文件'); goto EpgMt; SmNx0: self::runOrFail('npm run build:h5'); goto OS53l; oLAwl: $uilwH = $hfN7a[2]; goto rNFIC; N6ssr: passthru('rm -rfv ' . shell_module_path($X3Epx, 'Asset/static/')); goto G1BVX; VjrbS: shell_echo_block('更新模块静态资源'); goto UjTXX; kC5iC: $KQYyW = $hfN7a[1]; goto oLAwl; xcPH1: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto J36H0; PMWoF: shell_echo_block('温馨提示'); goto Y4vHG; mLhc8: shell_throws_if('请进入 ' . $vm4GG . '目录再运行该脚本', getcwd() !== $vm4GG); goto xcPH1; mN7BU: $AerE8 = shell_module_path($X3Epx, 'View/m/' . lcfirst($X3Epx) . '/head.blade.php'); goto pYv9t; bCXOO: shell_echo_info("php artisan modstart:module-install {$X3Epx} --force"); goto JscrN; eLbzN: $fKViA = file_get_contents('dist/build/h5/index.html'); goto cAzGI; mN926: $X60Sj = str_replace(array_keys($nMjX1), array_values($nMjX1), $KQYyW); goto PdTk9; EpgMt: passthru('cp -av dist/build/h5/static ' . shell_module_path($X3Epx, 'Asset/static/')); goto PCwhv; PdTk9: $PXJaU = str_replace(array_keys($nMjX1), array_values($nMjX1), $uilwH); goto iEoDX; k87Jr: shell_file_write($SIXEW, $PXJaU); goto sbyEU; J36H0: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto ju_D3; cAzGI: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $fKViA, $hfN7a); goto kC5iC; iEoDX: shell_echo_info('处理Head : ' . strlen($KQYyW) . ' -> ' . strlen($X60Sj)); goto sSvmi; AdLq8: shell_echo_block('开始编译'); goto bGYqX; rYylU: shell_echo_info('清空目录'); goto N6ssr; xz6wF: $dz8Az = glob('dist/build/h5/static/js/*.js'); goto JIGun; bTgYl: $nMjX1 = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $X3Epx . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $X3Epx . '/static/'); goto xz6wF; rNFIC: $nMjX1 = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $X3Epx . '/'); goto mN926; sSvmi: shell_echo_info('处理Body : ' . strlen($uilwH) . ' -> ' . strlen($PXJaU)); goto mN7BU; Y4vHG: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto bCXOO; I9Siq: shell_echo_block('检查环境'); goto mLhc8; OS53l: shell_echo_block('处理HTML文件'); goto eLbzN; UjTXX: shell_ensure_dir(shell_module_path($X3Epx, 'Asset')); goto rYylU; JIGun: foreach ($dz8Az as $obXaA) { goto fm5P6; TIqkp: $fKViA = file_get_contents($obXaA); goto Cn0zA; fm5P6: shell_echo_info($obXaA); goto TIqkp; Cn0zA: $fKViA = str_replace(array_keys($nMjX1), array_values($nMjX1), $fKViA); goto zQfm_; zQfm_: file_put_contents($obXaA, $fKViA); goto LiRRe; LiRRe: } goto VjrbS; Bi6Be: shell_file_write($AerE8, $X60Sj); goto k87Jr; bGYqX: self::runOrFail('npm install'); goto SmNx0; KGhzL: $X3Epx = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $vm4GG); goto I9Siq; JscrN: } }