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.
Files changed (96) 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 +32 -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/web/XMLHttpRequest/index.d.ts +17 -17
  80. package/web/XMLHttpRequest/index.js +60 -60
  81. package/web/animation/index.d.ts +19 -19
  82. package/web/animation/index.js +104 -104
  83. package/web/format/index.d.ts +29 -29
  84. package/web/format/index.js +107 -107
  85. package/web/json/index.d.ts +9 -9
  86. package/web/json/index.js +206 -206
  87. package/web/onReady/index.d.ts +7 -7
  88. package/web/onReady/index.js +8 -8
  89. package/web/performChunk/index.d.ts +4 -4
  90. package/web/performChunk/index.js +19 -19
  91. package/web/reader/index.d.ts +32 -32
  92. package/web/reader/index.js +20 -20
  93. package/web/style/index.d.ts +21 -21
  94. package/web/style/index.js +19 -19
  95. package/web/throttle/index.d.ts +30 -30
  96. package/web/throttle/index.js +50 -50
@@ -1,12 +1,12 @@
1
- # These are supported funding model platforms
2
-
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
12
  custom: ['https://zxl20070701.github.io/notebook/home.html']
package/AUTHORS.txt CHANGED
@@ -1,6 +1,6 @@
1
- Authors ordered by first contribution.
2
-
3
- zxl20070701 <1904314465@qq.com> <https://github.com/zxl20070701>
4
-
5
- -----------------------------------------------------
6
- We thank all of them for their contributions!
1
+ Authors ordered by first contribution.
2
+
3
+ zxl20070701 <1904314465@qq.com> <https://github.com/zxl20070701>
4
+
5
+ -----------------------------------------------------
6
+ We thank all of them for their contributions!
package/CHANGELOG CHANGED
@@ -1,137 +1,144 @@
1
- v1.0.0:
2
- date:2025-02-13
3
- changes:
4
- - 原v0.x的功能将独立一个分支继续维护:https://github.com/oi-contrib/OIPage/blob/v0.x/CHANGELOG
5
- (v0.x保持对零碎方法这种形式的支持和维护,此版本开始将作为一个框架或一个系统的工具箱以提供更高效的使用方式,这是一次彻底的非兼容改造)
6
- - 初始化版本(v1.x)
7
- 1、API功能(浏览器)
8
- * animation 动画
9
- * getStyle 获取节点样式
10
- * setStyle 设置节点样式
11
- * onReady 加载完毕执行
12
- * throttle 节流函数
13
- 2、API功能(Node.js)
14
- * animation 动画
15
- * deeplog 进度打印
16
- * linglog 单行打印
17
- * throttle 节流函数
18
- 3、命令(oipage-cli)
19
- * serve 开发服务器
20
- v1.1.0:
21
- date:2025-02-18
22
- changes:
23
- - 修复bug
24
- 1、通过路径类型判断以修复开发服务器无法设置绝对路径问题
25
- - 优化改造
26
- 1、使用流读取以使开发服务器支持大文件下载
27
- (同时添加下载进度可查)
28
- - 新增功能
29
- 1、API功能(Node.js)
30
- * disk 磁盘相关操作
31
- (包括:deleteDisk、copyDisk)
32
- * logform 表单输入
33
- 2、命令(oipage-cli)
34
- * dist 磁盘操作
35
- * run 运行多命令
36
- v1.2.0:
37
- date:2025-02-25
38
- changes:
39
- - 优化改造
40
- 1、优化npm包目录结构等
41
- - 新增功能
42
- 1、开发服务器
43
- * 添加配置文件
44
- (oipage-cli serve --config ./oipage.config.js)
45
- * 新增对node_modules包引入支持
46
- v1.2.1:
47
- date:2025-03-06
48
- changes:
49
- - 修复bug
50
- 1、开发服务器
51
- * 修复路径不存在时未正确同步修改浏览器地址问题
52
- v1.3.0:(已废弃,请用1.3.1代替)
53
- date:2025-05-18
54
- changes:
55
- - 修复bug
56
- 1、开发服务器
57
- * 修复服务器根路径判断错误导致node_modules包查找错误问题
58
- 2、修复animation动画types类型定义错误问题
59
- - 新增功能
60
- 1、API功能(浏览器)
61
- * reader 文本分析读取器
62
- * performChunk 空闲执行分片函数
63
- * strToJson JSON字符串解析
64
- 2、API功能(Node.js)
65
- * reader 文本分析读取器
66
- * strToJson JSON字符串解析
67
- 3、开发服务器
68
- * 新增 devServer.intercept 请求拦截
69
- * 新增对 if-modified-since和last-modified 之304协商缓存的支持
70
- v1.3.1:
71
- date:2025-05-23
72
- changes:
73
- - 修复bug
74
- 1、开发服务器
75
- * 由于是否入口判断导致import语句未正确解析
76
- * 修复 Last-Modified 格式不规范导致的运行报错
77
- v1.4.0:
78
- date:2025-09-02
79
- changes:
80
- - 修复bug
81
- 1、修复logform运行报错
82
- - 新增功能
83
- 1、API功能(浏览器)
84
- * dateFormat 日期格式化
85
- * numberFormat 数字格式化
86
- * XHRIntercept XHR拦截
87
- 2、API功能(Node.js)
88
- * dateFormat 日期格式化
89
- * numberFormat 数字格式化
90
- 3、开发服务器
91
- * 新增 serve.d.ts 以支持作为API在TypeScript中环境
92
- (仅对内使用,未正式对外暴露API相关文档)
93
- * 添加304是否启用开关
94
- * 应用市场(website内置网站)
95
- v1.4.1:
96
- date:2025-09-02
97
- changes:
98
- - 修复bug
99
- 1、修复开发服务器大文件丢失文件大小问题
100
- v1.5.0:
101
- date:2025-11-13
102
- changes:
103
- - 修复bug
104
- 1、修复404网站在手机浏览器显示高问题
105
- 2、服务器响应类型由 Content-type 改为 Content-Type
106
- 3、修复dateFormat第二个参数无法缺省报错
107
- 4、修复numberFormat不支持负数问题
108
- - 优化改造
109
- 1、优化run命令日志打印
110
- - 新增功能
111
- 1、开发服务器 / 应用市场
112
- * 群聊天
113
- * 图片编辑器
114
- * 图片转PDF
115
- 2、API功能(Node.js)
116
- * disk 磁盘相关操作
117
- (包括:moveDisk、listDisk)
118
- v1.6.0:
119
- date:2025-12-14
120
- changes:
121
- - 修复bug
122
- 1、修复logform在run下无法正常使用问题
123
- (关联issue: https://github.com/oi-contrib/OIPage/issues/4 )
124
- 2、修复服务器错误修改XHR等请求数据问题
125
- - 优化改造
126
- 1、命令行帮助打印更可读
127
- - 新增功能
128
- 1、命令(oipage-cli)
129
- * disk
130
- --link 创建磁盘链接
131
- --delempty 删除空文件夹
132
- * network 网络相关
133
- * run 支持动态参数
134
- (关联issue: https://github.com/oi-contrib/OIPage/issues/5 )
135
- 2、API功能(Node.js)
136
- * disk 磁盘相关操作
137
- (包括:linkDisk)
1
+ v1.0.0:
2
+ date:2025-02-13
3
+ changes:
4
+ - 原v0.x的功能将独立一个分支继续维护:https://github.com/oi-contrib/OIPage/blob/v0.x/CHANGELOG
5
+ (v0.x保持对零碎方法这种形式的支持和维护,此版本开始将作为一个框架或一个系统的工具箱以提供更高效的使用方式,这是一次彻底的非兼容改造)
6
+ - 初始化版本(v1.x)
7
+ 1、API功能(浏览器)
8
+ * animation 动画
9
+ * getStyle 获取节点样式
10
+ * setStyle 设置节点样式
11
+ * onReady 加载完毕执行
12
+ * throttle 节流函数
13
+ 2、API功能(Node.js)
14
+ * animation 动画
15
+ * deeplog 进度打印
16
+ * linglog 单行打印
17
+ * throttle 节流函数
18
+ 3、命令(oipage-cli)
19
+ * serve 开发服务器
20
+ v1.1.0:
21
+ date:2025-02-18
22
+ changes:
23
+ - 修复bug
24
+ 1、通过路径类型判断以修复开发服务器无法设置绝对路径问题
25
+ - 优化改造
26
+ 1、使用流读取以使开发服务器支持大文件下载
27
+ (同时添加下载进度可查)
28
+ - 新增功能
29
+ 1、API功能(Node.js)
30
+ * disk 磁盘相关操作
31
+ (包括:deleteDisk、copyDisk)
32
+ * logform 表单输入
33
+ 2、命令(oipage-cli)
34
+ * dist 磁盘操作
35
+ * run 运行多命令
36
+ v1.2.0:
37
+ date:2025-02-25
38
+ changes:
39
+ - 优化改造
40
+ 1、优化npm包目录结构等
41
+ - 新增功能
42
+ 1、开发服务器
43
+ * 添加配置文件
44
+ (oipage-cli serve --config ./oipage.config.js)
45
+ * 新增对node_modules包引入支持
46
+ v1.2.1:
47
+ date:2025-03-06
48
+ changes:
49
+ - 修复bug
50
+ 1、开发服务器
51
+ * 修复路径不存在时未正确同步修改浏览器地址问题
52
+ v1.3.0:(已废弃,请用1.3.1代替)
53
+ date:2025-05-18
54
+ changes:
55
+ - 修复bug
56
+ 1、开发服务器
57
+ * 修复服务器根路径判断错误导致node_modules包查找错误问题
58
+ 2、修复animation动画types类型定义错误问题
59
+ - 新增功能
60
+ 1、API功能(浏览器)
61
+ * reader 文本分析读取器
62
+ * performChunk 空闲执行分片函数
63
+ * strToJson JSON字符串解析
64
+ 2、API功能(Node.js)
65
+ * reader 文本分析读取器
66
+ * strToJson JSON字符串解析
67
+ 3、开发服务器
68
+ * 新增 devServer.intercept 请求拦截
69
+ * 新增对 if-modified-since和last-modified 之304协商缓存的支持
70
+ v1.3.1:
71
+ date:2025-05-23
72
+ changes:
73
+ - 修复bug
74
+ 1、开发服务器
75
+ * 由于是否入口判断导致import语句未正确解析
76
+ * 修复 Last-Modified 格式不规范导致的运行报错
77
+ v1.4.0:
78
+ date:2025-09-02
79
+ changes:
80
+ - 修复bug
81
+ 1、修复logform运行报错
82
+ - 新增功能
83
+ 1、API功能(浏览器)
84
+ * dateFormat 日期格式化
85
+ * numberFormat 数字格式化
86
+ * XHRIntercept XHR拦截
87
+ 2、API功能(Node.js)
88
+ * dateFormat 日期格式化
89
+ * numberFormat 数字格式化
90
+ 3、开发服务器
91
+ * 新增 serve.d.ts 以支持作为API在TypeScript中环境
92
+ (仅对内使用,未正式对外暴露API相关文档)
93
+ * 添加304是否启用开关
94
+ * 应用市场(website内置网站)
95
+ v1.4.1:
96
+ date:2025-09-02
97
+ changes:
98
+ - 修复bug
99
+ 1、修复开发服务器大文件丢失文件大小问题
100
+ v1.5.0:
101
+ date:2025-11-13
102
+ changes:
103
+ - 修复bug
104
+ 1、修复404网站在手机浏览器显示高问题
105
+ 2、服务器响应类型由 Content-type 改为 Content-Type
106
+ 3、修复dateFormat第二个参数无法缺省报错
107
+ 4、修复numberFormat不支持负数问题
108
+ - 优化改造
109
+ 1、优化run命令日志打印
110
+ - 新增功能
111
+ 1、开发服务器 / 应用市场
112
+ * 群聊天
113
+ * 图片编辑器
114
+ * 图片转PDF
115
+ 2、API功能(Node.js)
116
+ * disk 磁盘相关操作
117
+ (包括:moveDisk、listDisk)
118
+ v1.6.0:
119
+ date:2025-12-14
120
+ changes:
121
+ - 修复bug
122
+ 1、修复logform在run下无法正常使用问题
123
+ (关联issue: https://github.com/oi-contrib/OIPage/issues/4 )
124
+ 2、修复服务器错误修改XHR等请求数据问题
125
+ - 优化改造
126
+ 1、命令行帮助打印更可读
127
+ - 新增功能
128
+ 1、命令(oipage-cli)
129
+ * disk
130
+ --link 创建磁盘链接
131
+ --delempty 删除空文件夹
132
+ * network 网络相关
133
+ * run 支持动态参数
134
+ (关联issue: https://github.com/oi-contrib/OIPage/issues/5 )
135
+ 2、API功能(Node.js)
136
+ * disk 磁盘相关操作
137
+ (包括:linkDisk)
138
+ v1.7.0:
139
+ date:
140
+ changes:
141
+ - 新增功能
142
+ 1、API功能(Node.js)
143
+ * remote HTTP请求
144
+ (包括:get、post)
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) zxl20070701 走一步,再走一步
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) zxl20070701 走一步,再走一步
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,95 +1,95 @@
1
- - 💘 开源不易,去 <i>[Github给个Star](https://github.com/oi-contrib/OIPage) </i>吧!
2
-
3
- <img src='https://oi-contrib.github.io/OIPage/images/logo.png' height='100px'/>
4
-
5
- <p>
6
- <a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=oipage&interval=7">
7
- <img src="https://img.shields.io/npm/dm/oipage.svg" alt="downloads">
8
- </a>
9
- <a href="https://www.npmjs.com/package/oipage">
10
- <img src="https://img.shields.io/npm/v/oipage.svg" alt="npm">
11
- </a>
12
- <a href="https://github.com/oi-contrib/OIPage/issues">
13
- <img src="https://img.shields.io/github/issues/oi-contrib/OIPage" alt="issue">
14
- </a>
15
- <a href="https://github.com/oi-contrib/OIPage" target='_blank'>
16
- <img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/OIPage?style=social">
17
- </a>
18
- <a href="https://github.com/oi-contrib/OIPage">
19
- <img src="https://img.shields.io/github/forks/oi-contrib/OIPage" alt="forks">
20
- </a>
21
- <a href="https://gitee.com/oi-contrib/OIPage" target='_blank'>
22
- <img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/OIPage/badge/star.svg">
23
- </a>
24
- <a href="https://gitee.com/oi-contrib/OIPage">
25
- <img src="https://gitee.com/oi-contrib/OIPage/badge/fork.svg" alt="forks">
26
- </a>
27
- </p>
28
-
29
- <img src="https://nodei.co/npm/oipage.png?downloads=true&amp;downloadRank=true&amp;stars=true" alt="NPM">
30
-
31
- # [OIPage](https://github.com/oi-contrib/OIPage)
32
- 前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等。官网地址:[https://oi-contrib.github.io/OIPage](https://oi-contrib.github.io/OIPage)
33
-
34
- ## 如何使用?
35
-
36
- 你可以作为一个命令行使用,那么你需要全局安装:
37
-
38
- ```shell
39
- npm install -g oipage
40
- ```
41
-
42
- 也可以作为项目开发中的一个功能加强,在 package.json 中配置命令或nodejs文件中引入需要的模块使用,那么就在项目中执行安装命令:
43
-
44
- ```shell
45
- npm install oipage --save
46
- ```
47
-
48
- 安装后,就可以直接作为命令行使用了。你可以打印帮助查看:
49
-
50
- ```shell
51
- oipage-cli
52
- ```
53
-
54
- 比如会出现类似下列内容:
55
-
56
- ```
57
- OIPage@v1.2.0
58
-
59
- 可以使用的命令如下:
60
-
61
- 【1】oipage-cli serve 开发服务器
62
- --port|-p 端口号
63
- --baseUrl 服务器根目录
64
- ......
65
- ```
66
-
67
- 根据提示我们知道,比如第一个命令,其提供了一个快速访问本地资源服务器的功能,比如执行:
68
-
69
- ```shell
70
- oipage-cli serve -p 8080
71
- ```
72
-
73
- 启动成功后,直接访问: http://localhost:8080/ 即可。
74
-
75
- 如果你需要在项目中使用,我们也提供了一些有用的API,具体可以访问[ 在线文档 ](https://oi-contrib.github.io/OIPage)进行了解。
76
-
77
- ## 应用市场
78
-
79
- 为了方便日常使用,内置了一个应用市场网站,比如有如下功能:
80
-
81
- ### 群聊天
82
-
83
- <img src="./snipping/chart.png" />
84
-
85
- ### 图片编辑器
86
-
87
- <img src="./snipping/image-editor.png" />
88
-
89
- 已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/OIPage/issues) 给我们留言,告诉我们你的改进意见。
90
-
91
- ## 版权
92
-
93
- MIT License
94
-
95
- Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
1
+ - 💘 开源不易,去 <i>[Github给个Star](https://github.com/oi-contrib/OIPage) </i>吧!
2
+
3
+ <img src='https://oi-contrib.github.io/OIPage/images/logo.png' height='100px'/>
4
+
5
+ <p>
6
+ <a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=oipage&interval=7">
7
+ <img src="https://img.shields.io/npm/dm/oipage.svg" alt="downloads">
8
+ </a>
9
+ <a href="https://www.npmjs.com/package/oipage">
10
+ <img src="https://img.shields.io/npm/v/oipage.svg" alt="npm">
11
+ </a>
12
+ <a href="https://github.com/oi-contrib/OIPage/issues">
13
+ <img src="https://img.shields.io/github/issues/oi-contrib/OIPage" alt="issue">
14
+ </a>
15
+ <a href="https://github.com/oi-contrib/OIPage" target='_blank'>
16
+ <img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/OIPage?style=social">
17
+ </a>
18
+ <a href="https://github.com/oi-contrib/OIPage">
19
+ <img src="https://img.shields.io/github/forks/oi-contrib/OIPage" alt="forks">
20
+ </a>
21
+ <a href="https://gitee.com/oi-contrib/OIPage" target='_blank'>
22
+ <img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/OIPage/badge/star.svg">
23
+ </a>
24
+ <a href="https://gitee.com/oi-contrib/OIPage">
25
+ <img src="https://gitee.com/oi-contrib/OIPage/badge/fork.svg" alt="forks">
26
+ </a>
27
+ </p>
28
+
29
+ <img src="https://nodei.co/npm/oipage.png?downloads=true&amp;downloadRank=true&amp;stars=true" alt="NPM">
30
+
31
+ # [OIPage](https://github.com/oi-contrib/OIPage)
32
+ 前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等。官网地址:[https://oi-contrib.github.io/OIPage](https://oi-contrib.github.io/OIPage)
33
+
34
+ ## 如何使用?
35
+
36
+ 你可以作为一个命令行使用,那么你需要全局安装:
37
+
38
+ ```shell
39
+ npm install -g oipage
40
+ ```
41
+
42
+ 也可以作为项目开发中的一个功能加强,在 package.json 中配置命令或nodejs文件中引入需要的模块使用,那么就在项目中执行安装命令:
43
+
44
+ ```shell
45
+ npm install oipage --save
46
+ ```
47
+
48
+ 安装后,就可以直接作为命令行使用了。你可以打印帮助查看:
49
+
50
+ ```shell
51
+ oipage-cli
52
+ ```
53
+
54
+ 比如会出现类似下列内容:
55
+
56
+ ```
57
+ OIPage@v1.2.0
58
+
59
+ 可以使用的命令如下:
60
+
61
+ 【1】oipage-cli serve 开发服务器
62
+ --port|-p 端口号
63
+ --baseUrl 服务器根目录
64
+ ......
65
+ ```
66
+
67
+ 根据提示我们知道,比如第一个命令,其提供了一个快速访问本地资源服务器的功能,比如执行:
68
+
69
+ ```shell
70
+ oipage-cli serve -p 8080
71
+ ```
72
+
73
+ 启动成功后,直接访问: http://localhost:8080/ 即可。
74
+
75
+ 如果你需要在项目中使用,我们也提供了一些有用的API,具体可以访问[ 在线文档 ](https://oi-contrib.github.io/OIPage)进行了解。
76
+
77
+ ## 应用市场
78
+
79
+ 为了方便日常使用,内置了一个应用市场网站,比如有如下功能:
80
+
81
+ ### 群聊天
82
+
83
+ <img src="./snipping/chart.png" />
84
+
85
+ ### 图片编辑器
86
+
87
+ <img src="./snipping/image-editor.png" />
88
+
89
+ 已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/OIPage/issues) 给我们留言,告诉我们你的改进意见。
90
+
91
+ ## 版权
92
+
93
+ MIT License
94
+
95
+ Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
@@ -1,43 +1,43 @@
1
-
2
- // 处理收到的数据
3
- module.exports = function decodeWsFrame(data) {
4
- let start = 0;
5
- let frame = {
6
- isFinal: (data[start] & 0x80) === 0x80,
7
- opcode: data[start++] & 0xF,
8
- masked: (data[start] & 0x80) === 0x80,
9
- payloadLen: data[start++] & 0x7F,
10
- maskingKey: '',
11
- payloadData: null
12
- };
13
-
14
- if (frame.payloadLen === 126) {
15
- frame.payloadLen = (data[start++] << 8) + data[start++];
16
- } else if (frame.payloadLen === 127) {
17
- frame.payloadLen = 0;
18
- for (let i = 7; i >= 0; --i) {
19
- frame.payloadLen += (data[start++] << (i * 8));
20
- }
21
- }
22
-
23
- if (frame.payloadLen) {
24
- if (frame.masked) {
25
- const maskingKey = [
26
- data[start++],
27
- data[start++],
28
- data[start++],
29
- data[start++]
30
- ];
31
-
32
- frame.maskingKey = maskingKey;
33
-
34
- frame.payloadData = data
35
- .slice(start, start + frame.payloadLen)
36
- .map((byte, idx) => byte ^ maskingKey[idx % 4]);
37
- } else {
38
- frame.payloadData = data.slice(start, start + frame.payloadLen);
39
- }
40
- }
41
-
42
- return frame;
43
- };
1
+
2
+ // 处理收到的数据
3
+ module.exports = function decodeWsFrame(data) {
4
+ let start = 0;
5
+ let frame = {
6
+ isFinal: (data[start] & 0x80) === 0x80,
7
+ opcode: data[start++] & 0xF,
8
+ masked: (data[start] & 0x80) === 0x80,
9
+ payloadLen: data[start++] & 0x7F,
10
+ maskingKey: '',
11
+ payloadData: null
12
+ };
13
+
14
+ if (frame.payloadLen === 126) {
15
+ frame.payloadLen = (data[start++] << 8) + data[start++];
16
+ } else if (frame.payloadLen === 127) {
17
+ frame.payloadLen = 0;
18
+ for (let i = 7; i >= 0; --i) {
19
+ frame.payloadLen += (data[start++] << (i * 8));
20
+ }
21
+ }
22
+
23
+ if (frame.payloadLen) {
24
+ if (frame.masked) {
25
+ const maskingKey = [
26
+ data[start++],
27
+ data[start++],
28
+ data[start++],
29
+ data[start++]
30
+ ];
31
+
32
+ frame.maskingKey = maskingKey;
33
+
34
+ frame.payloadData = data
35
+ .slice(start, start + frame.payloadLen)
36
+ .map((byte, idx) => byte ^ maskingKey[idx % 4]);
37
+ } else {
38
+ frame.payloadData = data.slice(start, start + frame.payloadLen);
39
+ }
40
+ }
41
+
42
+ return frame;
43
+ };