oipage 1.6.0-beta.0 → 1.6.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG CHANGED
@@ -109,7 +109,7 @@ v1.5.0:
109
109
  1、优化run命令日志打印
110
110
  - 新增功能
111
111
  1、开发服务器 / 应用市场
112
- * 聊天工具
112
+ * 群聊天
113
113
  * 图片编辑器
114
114
  * 图片转PDF
115
115
  2、API功能(Node.js)
@@ -118,6 +118,10 @@ v1.5.0:
118
118
  v1.6.0:
119
119
  date:
120
120
  changes:
121
+ - 修复bug
122
+ 1、修复logform在run下无法正常使用问题
123
+ (关联issue: https://github.com/oi-contrib/OIPage/issues/4 )
124
+ 2、修复服务器错误修改XHR等请求数据问题
121
125
  - 优化改造
122
126
  1、命令行帮助打印更可读
123
127
  - 新增功能
package/README.md CHANGED
@@ -78,7 +78,7 @@ oipage-cli serve -p 8080
78
78
 
79
79
  为了方便日常使用,内置了一个应用市场网站,比如有如下功能:
80
80
 
81
- ### 群聊贴
81
+ ### 群聊天
82
82
 
83
83
  <img src="./snipping/chart.png" />
84
84
 
package/bin/run CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  process.title = 'OIPage';
6
6
 
7
- const { exec } = require('child_process');
7
+ const { spawn } = require('child_process');
8
8
  const { join } = require("path");
9
9
  const { existsSync, lstatSync } = require("fs");
10
10
  const { mergeOption } = require("vislite");
@@ -84,26 +84,19 @@ else if (process.argv[2] === "run") {
84
84
 
85
85
  for (let index = 0; index < tasks.length; index++) {
86
86
 
87
- const child = exec(tasks[index] + (runArgs[index] ? (" " + runArgs[index]) : ""));
87
+ // 补充动态参数的支持
88
+ // npm run bug:issue5 ":-p 9090"
89
+ // 2025年12月1日 于南京
90
+ let task = (tasks[index] + (runArgs[index] ? (" " + runArgs[index]) : "")).split(" ");
91
+ let command = task.shift();
88
92
 
89
- // 监听子线程的stdout
90
- child.stdout.on('data', (data) => {
91
- process.stdout.write(`${data}`);
92
- });
93
-
94
- // 监听子线程的stderr
95
- child.stderr.on('data', (data) => {
96
- process.stdout.write(`${data}`);
97
- });
98
-
99
- // 子线程结束处理
100
- child.on('close', (code) => {
101
- console.log(`子线程${index + 1}结束,退出码 ${code}`);
102
- });
93
+ // 修复exec无法正常使用logform问题
94
+ // npm run bug:issue4
95
+ // 2025年12月2日 于南京
96
+ spawn(command, task, {
103
97
 
104
- // 子线程出错处理
105
- child.on('error', (error) => {
106
- console.error(`子线程${index + 1}错误: ${error.message}`);
98
+ // https://nodejs.org/api/child_process.html#child_process_options_stdio
99
+ stdio: 'inherit'
107
100
  });
108
101
  }
109
102
 
package/bin/serve.js CHANGED
@@ -51,6 +51,10 @@ module.exports = function (config) {
51
51
  // 如果存在且是文件
52
52
  else if (existsSync(filePath) && !lstatSync(filePath).isDirectory()) {
53
53
 
54
+ // 判断是否是请求而无需进一步解析
55
+ // 2025年12月5日 于南京
56
+ let isXHR = headers["sec-fetch-dest"] === "empty";
57
+
54
58
  let dotName = /\./.test(filePath) ? filePath.match(/\.([^.]+)$/)[1] : "";
55
59
  let fileType = mineTypes[dotName]; // 文件类型
56
60
  let fileInfo = statSync(filePath);
@@ -72,7 +76,7 @@ module.exports = function (config) {
72
76
  if (lastModified <= ifModifiedSince) {
73
77
  response.writeHead('304', responseHeader);
74
78
  response.end();
75
- console.log("<i> \x1b[1m\x1b[32m[" + name + "] Cache File: " + url + "\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");
79
+ console.log("<i> \x1b[1m\x1b[32m[" + name + "] Cache File: " + url + "\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304" + (isXHR ? " 请求" : "") + "\x1b[0m");
76
80
  return;
77
81
  }
78
82
  }
@@ -109,7 +113,7 @@ module.exports = function (config) {
109
113
 
110
114
  sendType = "Read";
111
115
  response.writeHead('200', responseHeader);
112
- response.write(resolveImport(source, fileType !== "application/javascript"));
116
+ response.write(isXHR ? source : resolveImport(source, fileType !== "application/javascript"));
113
117
  response.end();
114
118
  }
115
119
 
@@ -123,7 +127,7 @@ module.exports = function (config) {
123
127
  createReadStream(filePath).pipe(response);
124
128
  }
125
129
 
126
- console.log("<i> \x1b[1m\x1b[32m[" + name + "] " + sendType + " File: " + url + '\x1b[0m ' + new Date().toLocaleString());
130
+ console.log("<i> \x1b[1m\x1b[32m[" + name + "] " + sendType + " File: " + url + '\x1b[0m ' + new Date().toLocaleString() + "\x1b[33m\x1b[1m" + (isXHR ? " 请求" : "") + "\x1b[0m");
127
131
  }
128
132
 
129
133
  // 否则就是404
@@ -6,7 +6,7 @@
6
6
  <li z-on:click.prevent="goto" tag="chart">
7
7
  <img src="./images/chart.png" />
8
8
  <h2>
9
- 群聊贴
9
+ 群聊天
10
10
  </h2>
11
11
  </li>
12
12
  <li z-on:click="goto" tag="image-editor">
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.6.0-beta.0
2
+ * animation of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * cmdlog of OIPage v1.6.0-beta.0
2
+ * cmdlog of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * disk of OIPage v1.6.0-beta.0
2
+ * disk of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.6.0-beta.0
2
+ * format of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.6.0-beta.0
2
+ * json of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {reader} = require("../reader/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * logform of OIPage v1.6.0-beta.0
2
+ * logform of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {linelog} = require("../cmdlog/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.6.0-beta.0
2
+ * reader of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.6.0-beta.0
2
+ * throttle of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "oipage",
3
- "version": "1.6.0-beta.0",
3
+ "version": "1.6.0-beta.2",
4
4
  "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
5
  "sideEffects": false,
6
6
  "scripts": {
7
7
  "dev": "node ./build/index.js watch",
8
8
  "build": "node ./build/index.js",
9
- "serve": "node ./bin/run serve --config ./oipage.config.js"
9
+ "serve": "node ./bin/run serve --config ./oipage.config.js",
10
+ "bug:issue5": "node ./bin/run run \"node ./bin/run serve\"",
11
+ "bug:issue4": "node ./bin/run run \"node ./test/logform/index.spec.js\""
10
12
  },
11
13
  "bin": {
12
14
  "oipage-cli": "bin/run"
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * XMLHttpRequest of OIPage v1.6.0-beta.0
2
+ * XMLHttpRequest of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.6.0-beta.0
2
+ * animation of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.6.0-beta.0
2
+ * format of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/web/json/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.6.0-beta.0
2
+ * json of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  import {reader} from "../reader/index.js";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * onReady of OIPage v1.6.0-beta.0
2
+ * onReady of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * performChunk of OIPage v1.6.0-beta.0
2
+ * performChunk of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.6.0-beta.0
2
+ * reader of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * style of OIPage v1.6.0-beta.0
2
+ * style of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.6.0-beta.0
2
+ * throttle of OIPage v1.6.0-beta.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5