From 7d3d67f0d059f17b295aabc054d632209ec3fd7b Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 17 Dec 2022 10:51:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=B4=A2=E5=BC=95=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/command/build/Dist.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/common/command/build/Dist.php b/app/common/command/build/Dist.php index b09f324..e8efbdd 100644 --- a/app/common/command/build/Dist.php +++ b/app/common/command/build/Dist.php @@ -201,7 +201,7 @@ class Dist extends Command $this->buildIncludeIndexFile(); - + $this->log('输出到文件夹'); $this->outputToDistApp(); @@ -211,7 +211,7 @@ class Dist extends Command $this->log('清理临时目录'); $this->clearTempDir(); - + $this->write('编译完成'); } @@ -875,10 +875,16 @@ class Dist extends Command new Arg(new String_('1')) ] )); + $include_path = []; - $file_stmts[] = new Expression(new Include_(new Concat(new Dir, new String_($this->includeLibPath['magic_var_map'])), Include_::TYPE_REQUIRE_ONCE)); - $file_stmts[] = new Expression(new Include_(new Concat(new Dir, new String_($this->includeLibPath['function_lib_file'])), Include_::TYPE_REQUIRE_ONCE)); - $file_stmts[] = new Expression(new Include_(new Concat(new Dir, new String_($this->includeLibPath['main_class_file'])), Include_::TYPE_REQUIRE_ONCE)); + $include_path[] = $this->includeLibPath['magic_var_map']; + $include_path[] = $this->includeLibPath['function_lib_file']; + $include_path[] = $this->includeLibPath['main_class_file']; + + foreach ($include_path as $path) { + $_path = substr($path, 3); + $file_stmts[] = new Expression(new Include_(new Concat(new Dir, new String_($_path)), Include_::TYPE_REQUIRE_ONCE)); + } $prettyPrinter = new MinifyPrinterTools(); @@ -991,7 +997,7 @@ class Dist extends Command $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); $stmts = $parser->parse($content); - + try { $this->checkStmts($stmts, $name); } catch (\Throwable $th) { @@ -1045,7 +1051,4 @@ class Dist extends Command return null; } - - - }