oipage 1.6.0 → 1.7.0-alpha.1
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/.github/FUNDING.yml +11 -11
- package/AUTHORS.txt +6 -6
- package/CHANGELOG +144 -137
- package/LICENSE +20 -20
- package/README.md +95 -95
- package/bin/WebSocket/decodeWsFrame.js +43 -43
- package/bin/WebSocket/encodeWsFrame.js +28 -28
- package/bin/WebSocket/headersToJSON.js +26 -26
- package/bin/WebSocket/index.js +80 -80
- package/bin/data/mineTypes.json +104 -104
- package/bin/disk.js +42 -42
- package/bin/help.js +43 -43
- package/bin/intercept.js +15 -15
- package/bin/network.js +21 -21
- package/bin/run +115 -115
- package/bin/serve.d.ts +55 -55
- package/bin/serve.js +158 -158
- package/bin/template/404.html +186 -186
- package/bin/tools/deleteEmptyFolder.js +23 -23
- package/bin/tools/format.js +75 -75
- package/bin/tools/network.js +42 -42
- package/bin/tools/resolve404.js +83 -83
- package/bin/tools/resolveImport.js +88 -88
- package/bin/website-htmls/components/ui-select-file/index.html +7 -7
- package/bin/website-htmls/components/ui-select-file/index.js +37 -37
- package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
- package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
- package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
- package/bin/website-htmls/dialogs/imageSize/index.scss +138 -138
- package/bin/website-htmls/dialogs/index.js +52 -52
- package/bin/website-htmls/images/addFile.svg +1 -1
- package/bin/website-htmls/images/img-to-pdf.svg +1 -1
- package/bin/website-htmls/index.html +17 -17
- package/bin/website-htmls/main.js +13 -13
- package/bin/website-htmls/pages/App/index.html +6 -6
- package/bin/website-htmls/pages/App/index.js +22 -22
- package/bin/website-htmls/pages/App/index.scss +43 -43
- package/bin/website-htmls/pages/appStore/index.html +24 -24
- package/bin/website-htmls/pages/appStore/index.js +19 -19
- package/bin/website-htmls/pages/appStore/index.scss +41 -41
- package/bin/website-htmls/pages/chart/index.html +8 -8
- package/bin/website-htmls/pages/chart/index.js +72 -72
- package/bin/website-htmls/pages/chart/index.scss +72 -72
- package/bin/website-htmls/pages/image-editor/index.html +27 -27
- package/bin/website-htmls/pages/image-editor/index.js +106 -106
- package/bin/website-htmls/pages/image-editor/index.scss +45 -45
- package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
- package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
- package/bin/website-htmls/pages/img-to-pdf/index.scss +4 -4
- package/bin/website-htmls/router.config.js +19 -19
- package/bin/website-htmls/styles/normalize.css +94 -94
- package/bin/website-plugins/intercept/chart.js +33 -33
- package/bin/website-plugins/intercept/head.js +8 -8
- package/bin/website-plugins/intercept/index.js +8 -8
- package/bin/website-plugins/intercept/oipage-vislite-intercept.js +33 -33
- package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +39 -39
- package/bin/website-plugins/loader/index.js +11 -11
- package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
- package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
- package/nodejs/animation/index.d.ts +19 -19
- package/nodejs/animation/index.js +104 -104
- package/nodejs/cmdlog/index.d.ts +20 -20
- package/nodejs/cmdlog/index.js +75 -75
- package/nodejs/disk/index.d.ts +47 -47
- package/nodejs/disk/index.js +165 -165
- package/nodejs/format/index.d.ts +29 -29
- package/nodejs/format/index.js +107 -107
- package/nodejs/json/index.d.ts +9 -9
- package/nodejs/json/index.js +206 -206
- package/nodejs/logform/index.d.ts +18 -18
- package/nodejs/logform/index.js +94 -94
- package/nodejs/reader/index.d.ts +32 -32
- package/nodejs/reader/index.js +20 -20
- package/nodejs/remote/index.d.ts +32 -0
- package/nodejs/remote/index.js +71 -0
- package/nodejs/throttle/index.d.ts +30 -30
- package/nodejs/throttle/index.js +50 -50
- package/package.json +43 -43
- package/web/XMLHttpRequest/index.d.ts +17 -17
- package/web/XMLHttpRequest/index.js +60 -60
- package/web/animation/index.d.ts +19 -19
- package/web/animation/index.js +104 -104
- package/web/format/index.d.ts +29 -29
- package/web/format/index.js +107 -107
- package/web/json/index.d.ts +9 -9
- package/web/json/index.js +206 -206
- package/web/onReady/index.d.ts +7 -7
- package/web/onReady/index.js +8 -8
- package/web/performChunk/index.d.ts +4 -4
- package/web/performChunk/index.js +19 -19
- package/web/reader/index.d.ts +32 -32
- package/web/reader/index.js +20 -20
- package/web/style/index.d.ts +21 -21
- package/web/style/index.js +19 -19
- package/web/throttle/index.d.ts +30 -30
- package/web/throttle/index.js +50 -50
package/bin/intercept.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
exports.doIntercept = function (url, intercept, request, response, wsHandler) {
|
|
2
|
-
for (let item of intercept) {
|
|
3
|
-
if (item.test.test(url)) {
|
|
4
|
-
item.handler(request, response, wsHandler);
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
exports.testIntercept = function (url, intercept) {
|
|
11
|
-
for (let item of intercept) {
|
|
12
|
-
if (item.test.test(url)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
exports.doIntercept = function (url, intercept, request, response, wsHandler) {
|
|
2
|
+
for (let item of intercept) {
|
|
3
|
+
if (item.test.test(url)) {
|
|
4
|
+
item.handler(request, response, wsHandler);
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.testIntercept = function (url, intercept) {
|
|
11
|
+
for (let item of intercept) {
|
|
12
|
+
if (item.test.test(url)) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
}
|
package/bin/network.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const networkInfo = require("./tools/network");
|
|
2
|
-
|
|
3
|
-
module.exports = function (config) {
|
|
4
|
-
let info = networkInfo(true);
|
|
5
|
-
|
|
6
|
-
// 执行一个个任务
|
|
7
|
-
for (let i = 0; i < config.value.length; i++) {
|
|
8
|
-
|
|
9
|
-
// 打印信息
|
|
10
|
-
if (config.value[i].name === "--log") {
|
|
11
|
-
|
|
12
|
-
for (let iptype of ["IPv4", "IPv6"]) {
|
|
13
|
-
console.log("\n" + iptype);
|
|
14
|
-
for (let i = 0; i < info[iptype].length; i++) {
|
|
15
|
-
console.log(" \x1b[1m\x1b[32m" + info[iptype][i].address + "\x1b[0m " + info[iptype][i].mac);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.log("");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
const networkInfo = require("./tools/network");
|
|
2
|
+
|
|
3
|
+
module.exports = function (config) {
|
|
4
|
+
let info = networkInfo(true);
|
|
5
|
+
|
|
6
|
+
// 执行一个个任务
|
|
7
|
+
for (let i = 0; i < config.value.length; i++) {
|
|
8
|
+
|
|
9
|
+
// 打印信息
|
|
10
|
+
if (config.value[i].name === "--log") {
|
|
11
|
+
|
|
12
|
+
for (let iptype of ["IPv4", "IPv6"]) {
|
|
13
|
+
console.log("\n" + iptype);
|
|
14
|
+
for (let i = 0; i < info[iptype].length; i++) {
|
|
15
|
+
console.log(" \x1b[1m\x1b[32m" + info[iptype][i].address + "\x1b[0m " + info[iptype][i].mac);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log("");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
22
|
};
|
package/bin/run
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
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
|
+
}
|
|
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")();
|
|
116
116
|
}
|
package/bin/serve.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
interface DevServerType {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 服务器端口号
|
|
6
|
-
*/
|
|
7
|
-
port: number
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 服务器根路径
|
|
11
|
-
*/
|
|
12
|
-
baseUrl: string
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 是否开启304缓存,默认开启
|
|
16
|
-
*/
|
|
17
|
-
cache: boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface InterceptType {
|
|
21
|
-
test: RegExp
|
|
22
|
-
handler(request: any, response: any): void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface LoaderType {
|
|
26
|
-
(source: string): string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface ConfigType {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 服务器名称
|
|
33
|
-
*/
|
|
34
|
-
name?: string
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 服务器版本
|
|
38
|
-
*/
|
|
39
|
-
version?: string
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 服务器运行配置
|
|
43
|
-
*/
|
|
44
|
-
devServer: DevServerType
|
|
45
|
-
|
|
46
|
-
intercept?: Array<InterceptType>
|
|
47
|
-
|
|
48
|
-
module?: {
|
|
49
|
-
rules: Array<{
|
|
50
|
-
test: RegExp
|
|
51
|
-
use: LoaderType
|
|
52
|
-
}>
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
1
|
+
|
|
2
|
+
interface DevServerType {
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 服务器端口号
|
|
6
|
+
*/
|
|
7
|
+
port: number
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 服务器根路径
|
|
11
|
+
*/
|
|
12
|
+
baseUrl: string
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 是否开启304缓存,默认开启
|
|
16
|
+
*/
|
|
17
|
+
cache: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface InterceptType {
|
|
21
|
+
test: RegExp
|
|
22
|
+
handler(request: any, response: any): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface LoaderType {
|
|
26
|
+
(source: string): string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ConfigType {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 服务器名称
|
|
33
|
+
*/
|
|
34
|
+
name?: string
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 服务器版本
|
|
38
|
+
*/
|
|
39
|
+
version?: string
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 服务器运行配置
|
|
43
|
+
*/
|
|
44
|
+
devServer: DevServerType
|
|
45
|
+
|
|
46
|
+
intercept?: Array<InterceptType>
|
|
47
|
+
|
|
48
|
+
module?: {
|
|
49
|
+
rules: Array<{
|
|
50
|
+
test: RegExp
|
|
51
|
+
use: LoaderType
|
|
52
|
+
}>
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
56
|
export default function (config?: ConfigType): void
|