mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 11:02:48 +08:00
开始处理函数库
This commit is contained in:
@@ -73,6 +73,8 @@ if (!function_exists('xdebug')) {
|
|||||||
*/
|
*/
|
||||||
function xdebug($data, $type = 'xdebug', $suffix = null, $force = false, $file = null)
|
function xdebug($data, $type = 'xdebug', $suffix = null, $force = false, $file = null)
|
||||||
{
|
{
|
||||||
|
// 调试
|
||||||
|
__DIR__;
|
||||||
!is_dir(runtime_path() . 'xdebug/') && mkdir(runtime_path() . 'xdebug/');
|
!is_dir(runtime_path() . 'xdebug/') && mkdir(runtime_path() . 'xdebug/');
|
||||||
if (is_null($file)) {
|
if (is_null($file)) {
|
||||||
$file = is_null($suffix) ? runtime_path() . 'xdebug/' . date('Ymd') . '.txt' : runtime_path() . 'xdebug/' . date('Ymd') . "_{$suffix}" . '.txt';
|
$file = is_null($suffix) ? runtime_path() . 'xdebug/' . date('Ymd') . '.txt' : runtime_path() . 'xdebug/' . date('Ymd') . "_{$suffix}" . '.txt';
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use PhpParser\NodeTraverser;
|
|||||||
use PhpParser\NodeVisitorAbstract;
|
use PhpParser\NodeVisitorAbstract;
|
||||||
use PhpParser\ParserFactory;
|
use PhpParser\ParserFactory;
|
||||||
use app\common\tools\phpparser\PrettyPrinterTools as Standard;
|
use app\common\tools\phpparser\PrettyPrinterTools as Standard;
|
||||||
|
use PhpParser\Comment;
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
use think\console\input\Argument;
|
use think\console\input\Argument;
|
||||||
@@ -143,13 +144,6 @@ class Dist extends Command
|
|||||||
|
|
||||||
$this->buildMainClassFile($lib_php_path);
|
$this->buildMainClassFile($lib_php_path);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$lib_function_file = '/lib.' . uniqid() . '.php';
|
$lib_function_file = '/lib.' . uniqid() . '.php';
|
||||||
$lib_function_path = $this->distPath . '/lib' . $lib_function_file;
|
$lib_function_path = $this->distPath . '/lib' . $lib_function_file;
|
||||||
$this->buildFunctionFile($lib_function_path);
|
$this->buildFunctionFile($lib_function_path);
|
||||||
@@ -219,6 +213,11 @@ class Dist extends Command
|
|||||||
file_put_contents($lib_dir_const_path, $dir_const_code);
|
file_put_contents($lib_dir_const_path, $dir_const_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildDirConstCode($stmt)
|
||||||
|
{
|
||||||
|
# code...
|
||||||
|
}
|
||||||
|
|
||||||
public function buildFunctionFile($lib_function_path)
|
public function buildFunctionFile($lib_function_path)
|
||||||
{
|
{
|
||||||
$function_path = Config::get('dist.function_path', []);
|
$function_path = Config::get('dist.function_path', []);
|
||||||
@@ -257,10 +256,16 @@ class Dist extends Command
|
|||||||
$this->mainClass->constDirList[$const_key] = dirname($name);
|
$this->mainClass->constDirList[$const_key] = dirname($name);
|
||||||
return new ConstFetch(new Name($const_key));
|
return new ConstFetch(new Name($const_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($node instanceof Comment){
|
||||||
|
return NodeTraverser::REMOVE_NODE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$traverser->traverse($stmts);
|
||||||
|
|
||||||
foreach ($stmts as $stmt_item) {
|
foreach ($stmts as $stmt_item) {
|
||||||
$function_stmts[] = $stmt_item;
|
$function_stmts[] = $stmt_item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ return [
|
|||||||
// 不支持项目以外的位置定义
|
// 不支持项目以外的位置定义
|
||||||
// 只能包含函数,不支持命名空间
|
// 只能包含函数,不支持命名空间
|
||||||
// 这些代码不能包含__DIR__、__FILE__等代码位置常量,不会影响打包,但代码逻辑会被破坏
|
// 这些代码不能包含__DIR__、__FILE__等代码位置常量,不会影响打包,但代码逻辑会被破坏
|
||||||
|
// 将忽略注释和注解,代码业务请不要依赖注解
|
||||||
'function_path' => [
|
'function_path' => [
|
||||||
'app/common.php'
|
'app/common.php'
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user