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

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.
Files changed (98) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +144 -137
  4. package/LICENSE +20 -20
  5. package/README.md +95 -95
  6. package/bin/WebSocket/decodeWsFrame.js +43 -43
  7. package/bin/WebSocket/encodeWsFrame.js +28 -28
  8. package/bin/WebSocket/headersToJSON.js +26 -26
  9. package/bin/WebSocket/index.js +80 -80
  10. package/bin/data/mineTypes.json +104 -104
  11. package/bin/disk.js +42 -42
  12. package/bin/help.js +43 -43
  13. package/bin/intercept.js +15 -15
  14. package/bin/network.js +21 -21
  15. package/bin/run +115 -115
  16. package/bin/serve.d.ts +55 -55
  17. package/bin/serve.js +158 -158
  18. package/bin/template/404.html +186 -186
  19. package/bin/tools/deleteEmptyFolder.js +23 -23
  20. package/bin/tools/format.js +75 -75
  21. package/bin/tools/network.js +42 -42
  22. package/bin/tools/resolve404.js +83 -83
  23. package/bin/tools/resolveImport.js +88 -88
  24. package/bin/website-htmls/components/ui-select-file/index.html +7 -7
  25. package/bin/website-htmls/components/ui-select-file/index.js +37 -37
  26. package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
  27. package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
  28. package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
  29. package/bin/website-htmls/dialogs/imageSize/index.scss +138 -138
  30. package/bin/website-htmls/dialogs/index.js +52 -52
  31. package/bin/website-htmls/images/addFile.svg +1 -1
  32. package/bin/website-htmls/images/img-to-pdf.svg +1 -1
  33. package/bin/website-htmls/index.html +17 -17
  34. package/bin/website-htmls/main.js +13 -13
  35. package/bin/website-htmls/pages/App/index.html +6 -6
  36. package/bin/website-htmls/pages/App/index.js +22 -22
  37. package/bin/website-htmls/pages/App/index.scss +43 -43
  38. package/bin/website-htmls/pages/appStore/index.html +24 -24
  39. package/bin/website-htmls/pages/appStore/index.js +19 -19
  40. package/bin/website-htmls/pages/appStore/index.scss +41 -41
  41. package/bin/website-htmls/pages/chart/index.html +8 -8
  42. package/bin/website-htmls/pages/chart/index.js +72 -72
  43. package/bin/website-htmls/pages/chart/index.scss +72 -72
  44. package/bin/website-htmls/pages/image-editor/index.html +27 -27
  45. package/bin/website-htmls/pages/image-editor/index.js +106 -106
  46. package/bin/website-htmls/pages/image-editor/index.scss +45 -45
  47. package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
  48. package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
  49. package/bin/website-htmls/pages/img-to-pdf/index.scss +4 -4
  50. package/bin/website-htmls/router.config.js +19 -19
  51. package/bin/website-htmls/styles/normalize.css +94 -94
  52. package/bin/website-plugins/intercept/chart.js +33 -33
  53. package/bin/website-plugins/intercept/head.js +8 -8
  54. package/bin/website-plugins/intercept/index.js +8 -8
  55. package/bin/website-plugins/intercept/oipage-vislite-intercept.js +33 -33
  56. package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +39 -39
  57. package/bin/website-plugins/loader/index.js +11 -11
  58. package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
  59. package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
  60. package/nodejs/animation/index.d.ts +19 -19
  61. package/nodejs/animation/index.js +104 -104
  62. package/nodejs/cmdlog/index.d.ts +20 -20
  63. package/nodejs/cmdlog/index.js +75 -75
  64. package/nodejs/disk/index.d.ts +47 -47
  65. package/nodejs/disk/index.js +165 -165
  66. package/nodejs/format/index.d.ts +29 -29
  67. package/nodejs/format/index.js +107 -107
  68. package/nodejs/json/index.d.ts +9 -9
  69. package/nodejs/json/index.js +206 -206
  70. package/nodejs/logform/index.d.ts +18 -18
  71. package/nodejs/logform/index.js +94 -94
  72. package/nodejs/reader/index.d.ts +32 -32
  73. package/nodejs/reader/index.js +20 -20
  74. package/nodejs/remote/index.d.ts +17 -0
  75. package/nodejs/remote/index.js +71 -0
  76. package/nodejs/throttle/index.d.ts +30 -30
  77. package/nodejs/throttle/index.js +50 -50
  78. package/package.json +43 -43
  79. package/snipping/chart.png +0 -0
  80. package/snipping/image-editor.png +0 -0
  81. package/web/XMLHttpRequest/index.d.ts +17 -17
  82. package/web/XMLHttpRequest/index.js +60 -60
  83. package/web/animation/index.d.ts +19 -19
  84. package/web/animation/index.js +104 -104
  85. package/web/format/index.d.ts +29 -29
  86. package/web/format/index.js +107 -107
  87. package/web/json/index.d.ts +9 -9
  88. package/web/json/index.js +206 -206
  89. package/web/onReady/index.d.ts +7 -7
  90. package/web/onReady/index.js +8 -8
  91. package/web/performChunk/index.d.ts +4 -4
  92. package/web/performChunk/index.js +19 -19
  93. package/web/reader/index.d.ts +32 -32
  94. package/web/reader/index.js +20 -20
  95. package/web/style/index.d.ts +21 -21
  96. package/web/style/index.js +19 -19
  97. package/web/throttle/index.d.ts +30 -30
  98. 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