<?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($g7pY7) { goto Enve9; Enve9: shell_echo_info("开始运行 {$g7pY7}"); goto XIjyM; lSzxk: if ($ArLnr !== 0) { shell_echo_error('运行命令 ' . $g7pY7 . ' 失败'); die(1); } goto uBt70; XIjyM: passthru($g7pY7, $ArLnr); goto lSzxk; uBt70: } public static function build($v5A42) { goto JN_t3; GaIbd: shell_echo_info("php artisan modstart:module-install {$k8GtY} --force"); goto r806w; m9PPR: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto GaIbd; Dd1TR: $cRM80 = glob('dist/build/h5/static/js/*.js'); goto o2WOI; ENKFY: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto C3Mpi; x16Nd: shell_echo_success('环境正常'); goto VurGD; kwnLn: $KreWN = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $k8GtY . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $k8GtY . '/static/'); goto Dd1TR; OrDWE: shell_echo_block('处理HTML文件'); goto BD4vt; AbzbV: shell_echo_info('处理Head : ' . strlen($NpXe6) . ' -> ' . strlen($A6Z2b)); goto w31Ii; MEDFr: passthru('rm -rfv ' . shell_module_path($k8GtY, 'Asset/static/')); goto m_dbq; ENxVW: $A6Z2b = str_replace(array_keys($KreWN), array_values($KreWN), $NpXe6); goto bZq_i; BD4vt: $n16LT = file_get_contents('dist/build/h5/index.html'); goto SZxY0; MHmHK: self::runOrFail('npm install'); goto mwicv; VurGD: shell_echo_block('开始编译'); goto MHmHK; X9JWC: shell_file_write($hgcns, $wdP8k); goto WwimX; SZxY0: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $n16LT, $XeSWB); goto c19sh; JN_t3: $k8GtY = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $v5A42); goto M_fxx; bZq_i: $wdP8k = str_replace(array_keys($KreWN), array_values($KreWN), $cllT8); goto AbzbV; xneUW: $hgcns = shell_module_path($k8GtY, 'View/m/' . lcfirst($k8GtY) . '/body.blade.php'); goto FAmDQ; m_dbq: shell_echo_info('更新文件'); goto AhnYz; EaC7U: shell_ensure_dir(shell_module_path($k8GtY, 'Asset')); goto gtWtE; IM9RR: $cllT8 = $XeSWB[2]; goto nZ1gL; V9Jpi: shell_throws_if('请进入 ' . $v5A42 . '目录再运行该脚本', getcwd() !== $v5A42); goto KZvWG; KZvWG: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto ENKFY; r0Opp: shell_echo_success('打包完成'); goto tUwoJ; M_fxx: shell_echo_block('检查环境'); goto V9Jpi; C3Mpi: shell_throws_if('解析模块名称失败', empty($k8GtY)); goto x16Nd; gtWtE: shell_echo_info('清空目录'); goto MEDFr; tUwoJ: shell_echo_block('温馨提示'); goto m9PPR; PMB7g: shell_echo_block('更新模块静态资源'); goto EaC7U; w31Ii: shell_echo_info('处理Body : ' . strlen($cllT8) . ' -> ' . strlen($wdP8k)); goto Noexd; o2WOI: foreach ($cRM80 as $dG73t) { goto GYUIB; IwYM9: $n16LT = str_replace(array_keys($KreWN), array_values($KreWN), $n16LT); goto I6XsE; Hk31s: $n16LT = file_get_contents($dG73t); goto IwYM9; GYUIB: shell_echo_info($dG73t); goto Hk31s; I6XsE: file_put_contents($dG73t, $n16LT); goto ziD9q; ziD9q: } goto PMB7g; FAmDQ: shell_file_write($xu2ZJ, $A6Z2b); goto X9JWC; AhnYz: passthru('cp -av dist/build/h5/static ' . shell_module_path($k8GtY, 'Asset/static/')); goto r0Opp; c19sh: $NpXe6 = $XeSWB[1]; goto IM9RR; nZ1gL: $KreWN = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $k8GtY . '/'); goto ENxVW; WwimX: shell_echo_block('处理静态文件'); goto kwnLn; Noexd: $xu2ZJ = shell_module_path($k8GtY, 'View/m/' . lcfirst($k8GtY) . '/head.blade.php'); goto xneUW; mwicv: self::runOrFail('npm run build:h5'); goto OrDWE; r806w: } }