diff --git a/app/common.php b/app/common.php index 38e72c8..af71042 100644 --- a/app/common.php +++ b/app/common.php @@ -73,6 +73,8 @@ if (!function_exists('xdebug')) { */ function xdebug($data, $type = 'xdebug', $suffix = null, $force = false, $file = null) { + // 调试 + __DIR__; !is_dir(runtime_path() . 'xdebug/') && mkdir(runtime_path() . 'xdebug/'); if (is_null($file)) { $file = is_null($suffix) ? runtime_path() . 'xdebug/' . date('Ymd') . '.txt' : runtime_path() . 'xdebug/' . date('Ymd') . "_{$suffix}" . '.txt'; diff --git a/app/common/command/build/Dist.php b/app/common/command/build/Dist.php index f4c05c7..98da56b 100644 --- a/app/common/command/build/Dist.php +++ b/app/common/command/build/Dist.php @@ -29,6 +29,7 @@ use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use PhpParser\ParserFactory; use app\common\tools\phpparser\PrettyPrinterTools as Standard; +use PhpParser\Comment; use think\console\Command; use think\console\Input; use think\console\input\Argument; @@ -143,13 +144,6 @@ class Dist extends Command $this->buildMainClassFile($lib_php_path); - - - - - - - $lib_function_file = '/lib.' . uniqid() . '.php'; $lib_function_path = $this->distPath . '/lib' . $lib_function_file; $this->buildFunctionFile($lib_function_path); @@ -219,6 +213,11 @@ class Dist extends Command file_put_contents($lib_dir_const_path, $dir_const_code); } + public function buildDirConstCode($stmt) + { + # code... + } + public function buildFunctionFile($lib_function_path) { $function_path = Config::get('dist.function_path', []); @@ -257,10 +256,16 @@ class Dist extends Command $this->mainClass->constDirList[$const_key] = dirname($name); return new ConstFetch(new Name($const_key)); } + + if($node instanceof Comment){ + return NodeTraverser::REMOVE_NODE; + } } }); + $traverser->traverse($stmts); + foreach ($stmts as $stmt_item) { $function_stmts[] = $stmt_item; } diff --git a/config/dist.php b/config/dist.php index 2d5c359..b7e1a08 100644 --- a/config/dist.php +++ b/config/dist.php @@ -5,6 +5,7 @@ return [ // 不支持项目以外的位置定义 // 只能包含函数,不支持命名空间 // 这些代码不能包含__DIR__、__FILE__等代码位置常量,不会影响打包,但代码逻辑会被破坏 + // 将忽略注释和注解,代码业务请不要依赖注解 'function_path' => [ 'app/common.php' ],