oipage 1.7.0-alpha.3 → 1.7.0-alpha.4

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/bin/run CHANGED
@@ -1,116 +1,121 @@
1
- #!/usr/bin/env node
2
-
3
- 'use strict';
4
-
5
- process.title = 'OIPage';
6
-
7
- const { spawn } = require('child_process');
8
- const { join } = require("path");
9
- const { existsSync, lstatSync } = require("fs");
10
- const { mergeOption } = require("vislite");
11
- const { formatArgv } = require("./tools/format.js");
12
-
13
- // 开发服务器
14
- if (process.argv[2] === "serve") {
15
-
16
- let argvObj = formatArgv(process.argv, {
17
- "-p": "--port",
18
- "-c": "--config"
19
- });
20
-
21
- let config = {
22
- devServer: {
23
- port: 8080,
24
- baseUrl: "./",
25
- cache: true,
26
- intercept: []
27
- },
28
- module: {
29
- rules: []
30
- }
31
- };
32
-
33
- // 如果设置了配置文件
34
- if (argvObj["--config"]) {
35
- let configPath = join(process.cwd(), argvObj["--config"][0] || "./oipage.config.js");
36
- if (existsSync(configPath) && !lstatSync(configPath).isDirectory()) {
37
- let configValue = require(configPath);
38
- mergeOption(config, configValue);
39
- } else {
40
- console.log("\x1b[0m\x1b[31m" + configPath + "\x1b[0m");
41
- throw new Error("OIPage: The configuration file does not exist or is not a file.");
42
- }
43
- }
44
-
45
- if ((argvObj["--port"] || [])[0]) config.devServer.port = (argvObj["--port"] || [])[0];
46
- if ((argvObj["--baseUrl"] || [])[0]) config.devServer.baseUrl = (argvObj["--baseUrl"] || [])[0];
47
- if ((argvObj["--cache"] || [])[0]) config.devServer.cache = (argvObj["--cache"] || [])[0] === "true";
48
-
49
- require("./serve.js")(config);
50
- }
51
-
52
- // 磁盘操作
53
- else if (process.argv[2] === "disk") {
54
-
55
- let argvObj = formatArgv(process.argv, {
56
- "-f": "--force",
57
- "-d": "--delete",
58
- "-m": "--move",
59
- "-c": "--copy",
60
- "-l": "--link"
61
- }, true);
62
-
63
- require("./disk.js")(argvObj);
64
- }
65
-
66
- // 运行多命令
67
- else if (process.argv[2] === "run") {
68
-
69
- let argvObj = formatArgv(process.argv, {});
70
-
71
- let tasks = [], runArgs = [];
72
- for (let index = 0; index < argvObj.args.length; index++) {
73
-
74
- // 参数
75
- if (/^:/.test(argvObj.args[index])) {
76
- runArgs.push(argvObj.args[index].replace(/^:/, ""));
77
- }
78
-
79
- // 任务
80
- else {
81
- tasks.push(argvObj.args[index]);
82
- }
83
- }
84
-
85
- for (let index = 0; index < tasks.length; index++) {
86
-
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();
92
-
93
- // 修复exec无法正常使用logform问题
94
- // npm run bug:issue4
95
- // 2025年12月2日 于南京
96
- spawn(command, task, {
97
-
98
- // https://nodejs.org/api/child_process.html#child_process_options_stdio
99
- stdio: 'inherit'
100
- });
101
- }
102
-
103
- }
104
-
105
- // 网络相关
106
- else if (process.argv[2] === "network") {
107
-
108
- let argvObj = formatArgv(process.argv, {}, true);
109
-
110
- require("./network.js")(argvObj);
111
- }
112
-
113
- // 默认,帮助
114
- else {
115
- require("./help.js")();
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ process.title = 'OIPage';
6
+
7
+ const { spawn } = require('child_process');
8
+ const { join } = require("path");
9
+ const { existsSync, lstatSync } = require("fs");
10
+ const { mergeOption } = require("vislite");
11
+ const { formatArgv } = require("./tools/format.js");
12
+
13
+ // 开发服务器
14
+ if (process.argv[2] === "serve") {
15
+
16
+ let argvObj = formatArgv(process.argv, {
17
+ "-p": "--port",
18
+ "-c": "--config"
19
+ });
20
+
21
+ let config = {
22
+ devServer: {
23
+ port: 8080,
24
+ baseUrl: "./",
25
+ cache: true,
26
+ intercept: []
27
+ },
28
+ module: {
29
+ rules: []
30
+ }
31
+ };
32
+
33
+ // 如果设置了配置文件
34
+ if (argvObj["--config"]) {
35
+ let configPath = join(process.cwd(), argvObj["--config"][0] || "./oipage.config.js");
36
+ if (existsSync(configPath) && !lstatSync(configPath).isDirectory()) {
37
+ let configValue = require(configPath);
38
+ mergeOption(config, configValue);
39
+ } else {
40
+ console.log("\x1b[0m\x1b[31m" + configPath + "\x1b[0m");
41
+ throw new Error("OIPage: The configuration file does not exist or is not a file.");
42
+ }
43
+ }
44
+
45
+ if ((argvObj["--port"] || [])[0]) config.devServer.port = (argvObj["--port"] || [])[0];
46
+ if ((argvObj["--baseUrl"] || [])[0]) config.devServer.baseUrl = (argvObj["--baseUrl"] || [])[0];
47
+ if ((argvObj["--cache"] || [])[0]) config.devServer.cache = (argvObj["--cache"] || [])[0] === "true";
48
+
49
+ require("./serve.js")(config);
50
+ }
51
+
52
+ // 磁盘操作
53
+ else if (process.argv[2] === "disk") {
54
+
55
+ let argvObj = formatArgv(process.argv, {
56
+ "-f": "--force",
57
+ "-d": "--delete",
58
+ "-m": "--move",
59
+ "-c": "--copy",
60
+ "-l": "--link"
61
+ }, true);
62
+
63
+ require("./disk.js")(argvObj);
64
+ }
65
+
66
+ // 运行多命令
67
+ else if (process.argv[2] === "run") {
68
+
69
+ let argvObj = formatArgv(process.argv, {});
70
+
71
+ let tasks = [], runArgs = [];
72
+ for (let index = 0; index < argvObj.args.length; index++) {
73
+
74
+ // 参数
75
+ if (/^:/.test(argvObj.args[index])) {
76
+ runArgs.push(argvObj.args[index].replace(/^:/, ""));
77
+ }
78
+
79
+ // 任务
80
+ else {
81
+ tasks.push(argvObj.args[index]);
82
+ }
83
+ }
84
+
85
+ for (let index = 0; index < tasks.length; index++) {
86
+
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();
92
+
93
+ // 修复exec无法正常使用logform问题
94
+ // npm run bug:issue4
95
+ // 2025年12月2日 于南京
96
+ spawn(command, task, {
97
+
98
+ // https://nodejs.org/api/child_process.html#child_process_options_stdio
99
+ stdio: 'inherit',
100
+
101
+ // 修复https://github.com/oi-contrib/OIPage/issues/8
102
+ // 在Unix系统中使用`/bin/sh`,在Windows系统中使用`process.env.ComSpec`
103
+ // 2025年12月28日 于南京
104
+ shell: true
105
+ });
106
+ }
107
+
108
+ }
109
+
110
+ // 网络相关
111
+ else if (process.argv[2] === "network") {
112
+
113
+ let argvObj = formatArgv(process.argv, {}, true);
114
+
115
+ require("./network.js")(argvObj);
116
+ }
117
+
118
+ // 默认,帮助
119
+ else {
120
+ require("./help.js")();
116
121
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.7.0-alpha.3
2
+ * animation of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * cmdlog of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * disk of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * format of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * json of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * logform of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * reader of OIPage v1.7.0-alpha.4
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * remote of OIPage v1.7.0-alpha.3
2
+ * remote of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * throttle of OIPage v1.7.0-alpha.4
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oipage",
3
- "version": "1.7.0-alpha.3",
3
+ "version": "1.7.0-alpha.4",
4
4
  "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
5
  "sideEffects": false,
6
6
  "typings": "./types/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * XMLHttpRequest of OIPage v1.7.0-alpha.3
2
+ * XMLHttpRequest of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * animation of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * format of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * json of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * onReady of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * performChunk of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * reader of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * style of OIPage v1.7.0-alpha.4
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.7.0-alpha.3
2
+ * throttle of OIPage v1.7.0-alpha.4
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5