@oipage/cli 0.3.0 → 1.0.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 (92) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +76 -47
  4. package/LICENSE +20 -20
  5. package/README.md +204 -132
  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 +106 -106
  10. package/bin/data/mineTypes.json +108 -104
  11. package/bin/disk.js +42 -42
  12. package/bin/help.js +63 -55
  13. package/bin/intercept.js +15 -15
  14. package/bin/network.js +21 -21
  15. package/bin/notebook/data.js +185 -0
  16. package/bin/notebook/index.js +168 -9
  17. package/bin/proxy.js +82 -82
  18. package/bin/run +146 -146
  19. package/bin/serve.js +455 -318
  20. package/bin/template/404.html +184 -184
  21. package/bin/tools/deleteEmptyFolder.js +33 -33
  22. package/bin/tools/format.js +75 -75
  23. package/bin/tools/isBinary.js +83 -83
  24. package/bin/tools/moduleForm.js +548 -0
  25. package/bin/tools/network.js +42 -42
  26. package/bin/tools/openBrowser.js +34 -34
  27. package/bin/tools/resolve404.js +98 -98
  28. package/bin/tools/resolveImport.js +278 -97
  29. package/bin/tools/resolvePackage.js +412 -0
  30. package/bin/website-htmls/components/ui-select-file/index.html +8 -8
  31. package/bin/website-htmls/components/ui-select-file/index.js +42 -42
  32. package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
  33. package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
  34. package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
  35. package/bin/website-htmls/dialogs/imageSize/index.scss +140 -140
  36. package/bin/website-htmls/dialogs/index.js +52 -52
  37. package/bin/website-htmls/images/addFile.svg +1 -1
  38. package/bin/website-htmls/images/img-to-pdf.svg +1 -1
  39. package/bin/website-htmls/index.html +17 -17
  40. package/bin/website-htmls/main.js +13 -13
  41. package/bin/website-htmls/pages/App/index.html +6 -6
  42. package/bin/website-htmls/pages/App/index.js +22 -22
  43. package/bin/website-htmls/pages/App/index.scss +43 -43
  44. package/bin/website-htmls/pages/appStore/index.html +7 -7
  45. package/bin/website-htmls/pages/appStore/index.js +19 -19
  46. package/bin/website-htmls/pages/appStore/index.scss +54 -54
  47. package/bin/website-htmls/pages/chart/index.html +8 -8
  48. package/bin/website-htmls/pages/chart/index.js +72 -72
  49. package/bin/website-htmls/pages/chart/index.scss +71 -71
  50. package/bin/website-htmls/pages/home/index.html +19 -19
  51. package/bin/website-htmls/pages/home/index.js +19 -19
  52. package/bin/website-htmls/pages/home/index.scss +87 -87
  53. package/bin/website-htmls/pages/image-editor/index.html +27 -27
  54. package/bin/website-htmls/pages/image-editor/index.js +106 -106
  55. package/bin/website-htmls/pages/image-editor/index.scss +69 -69
  56. package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
  57. package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
  58. package/bin/website-htmls/pages/img-to-pdf/index.scss +9 -9
  59. package/bin/website-htmls/pages/recorder-screen/index.html +15 -15
  60. package/bin/website-htmls/pages/recorder-screen/index.js +227 -227
  61. package/bin/website-htmls/pages/recorder-screen/index.scss +52 -52
  62. package/bin/website-htmls/router.config.js +29 -29
  63. package/bin/website-htmls/styles/common.css +44 -44
  64. package/bin/website-htmls/styles/normalize.css +94 -94
  65. package/bin/website-plugins/intercept/chart.js +33 -33
  66. package/bin/website-plugins/intercept/getPackage.js +17 -17
  67. package/bin/website-plugins/intercept/head.js +8 -8
  68. package/bin/website-plugins/intercept/index.js +4 -8
  69. package/bin/website-plugins/loader/index.js +11 -11
  70. package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
  71. package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
  72. package/docs/css/base.css +122 -0
  73. package/docs/css/components.css +180 -0
  74. package/docs/css/layout.css +295 -0
  75. package/docs/css/responsive.css +49 -0
  76. package/docs/images/file-list.webp +0 -0
  77. package/docs/images/logo-topbar.svg +5 -0
  78. package/docs/images/logo.png +0 -0
  79. package/docs/images/logo.svg +6 -0
  80. package/docs/images/manual.webp +0 -0
  81. package/docs/images/terminal-serve.webp +0 -0
  82. package/docs/index.html +1392 -0
  83. package/docs/js/copy.js +37 -0
  84. package/docs/js/nav.js +111 -0
  85. package/docs/js/search.js +241 -0
  86. package/docs/js/theme.js +17 -0
  87. package/package.json +42 -42
  88. package/src/index.js +26 -29
  89. package/types/serve.d.ts +83 -83
  90. package/bin/website-plugins/intercept/oipage-vislite-intercept.js +0 -56
  91. package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +0 -37
  92. package/docs/config.md +0 -107
@@ -1,53 +1,53 @@
1
- .recorder-screen-view {
2
- .controls {
3
- position: absolute;
4
- top: 5px;
5
- right: 200px;
6
- display: flex;
7
- align-items: center;
8
- z-index: 10;
9
-
10
- &>button {
11
- height: 35px;
12
- padding: 0 30px;
13
- border: none;
14
- cursor: pointer;
15
- background-color: red;
16
- color: white;
17
- border-radius: 5px;
18
- margin-right: 20px;
19
-
20
- &[active='no'] {
21
- background-color: rgb(239, 139, 139);
22
- cursor: not-allowed;
23
- }
24
- }
25
-
26
- .audio-options {
27
- display: flex;
28
- background-color: rgba(255, 255, 255, 0.9);
29
- padding: 5px 10px;
30
- border-radius: 5px;
31
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
32
-
33
- label {
34
- display: flex;
35
- align-items: center;
36
- margin: 5px 0;
37
- font-size: 14px;
38
- color: #333;
39
- cursor: pointer;
40
-
41
- input[type="checkbox"] {
42
- margin-right: 8px;
43
- }
44
- }
45
- }
46
- }
47
-
48
- &>video {
49
- width: 100vw;
50
- height: calc(100vh - 50px);
51
- background-color: black;
52
- }
1
+ .recorder-screen-view {
2
+ .controls {
3
+ position: absolute;
4
+ top: 5px;
5
+ right: 200px;
6
+ display: flex;
7
+ align-items: center;
8
+ z-index: 10;
9
+
10
+ &>button {
11
+ height: 35px;
12
+ padding: 0 30px;
13
+ border: none;
14
+ cursor: pointer;
15
+ background-color: red;
16
+ color: white;
17
+ border-radius: 5px;
18
+ margin-right: 20px;
19
+
20
+ &[active='no'] {
21
+ background-color: rgb(239, 139, 139);
22
+ cursor: not-allowed;
23
+ }
24
+ }
25
+
26
+ .audio-options {
27
+ display: flex;
28
+ background-color: rgba(255, 255, 255, 0.9);
29
+ padding: 5px 10px;
30
+ border-radius: 5px;
31
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
32
+
33
+ label {
34
+ display: flex;
35
+ align-items: center;
36
+ margin: 5px 0;
37
+ font-size: 14px;
38
+ color: #333;
39
+ cursor: pointer;
40
+
41
+ input[type="checkbox"] {
42
+ margin-right: 8px;
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ &>video {
49
+ width: 100vw;
50
+ height: calc(100vh - 50px);
51
+ background-color: black;
52
+ }
53
53
  }
@@ -1,30 +1,30 @@
1
- import { defineRouter } from "zipaper"
2
-
3
- export default defineRouter({
4
- routers: [{
5
- path: "/",
6
- redirect: "/appStore"
7
- }, {
8
- path: "/appStore",
9
- component: () => import("./pages/appStore/index.js"),
10
- children: [{
11
- path: "/",
12
- redirect: "/home"
13
- }, {
14
- path: "/home",
15
- component: () => import("./pages/home/index.js"),
16
- }, {
17
- path: "/chart",
18
- component: () => import("./pages/chart/index.js"),
19
- }, {
20
- path: "/image-editor",
21
- component: () => import("./pages/image-editor/index.js"),
22
- }, {
23
- path: "/img-to-pdf",
24
- component: () => import("./pages/img-to-pdf/index.js"),
25
- }, {
26
- path: "/recorder-screen",
27
- component: () => import("./pages/recorder-screen/index.js"),
28
- }]
29
- }]
1
+ import { defineRouter } from "zipaper"
2
+
3
+ export default defineRouter({
4
+ routers: [{
5
+ path: "/",
6
+ redirect: "/appStore"
7
+ }, {
8
+ path: "/appStore",
9
+ component: () => import("./pages/appStore/index.js"),
10
+ children: [{
11
+ path: "/",
12
+ redirect: "/home"
13
+ }, {
14
+ path: "/home",
15
+ component: () => import("./pages/home/index.js"),
16
+ }, {
17
+ path: "/chart",
18
+ component: () => import("./pages/chart/index.js"),
19
+ }, {
20
+ path: "/image-editor",
21
+ component: () => import("./pages/image-editor/index.js"),
22
+ }, {
23
+ path: "/img-to-pdf",
24
+ component: () => import("./pages/img-to-pdf/index.js"),
25
+ }, {
26
+ path: "/recorder-screen",
27
+ component: () => import("./pages/recorder-screen/index.js"),
28
+ }]
29
+ }]
30
30
  })
@@ -1,44 +1,44 @@
1
- /* Global base styles for improved look and responsiveness */
2
- html, body {
3
- height: 100%;
4
- margin: 0;
5
- padding: 0;
6
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
7
- background: #f7f9fc;
8
- color: #0f1723;
9
- -webkit-font-smoothing: antialiased;
10
- }
11
-
12
- .container {
13
- max-width: 1100px;
14
- margin: 0 auto;
15
- padding: 16px;
16
- box-sizing: border-box;
17
- }
18
-
19
- /* Buttons and inputs */
20
- button {
21
- font-family: inherit;
22
- border-radius: 8px;
23
- padding: 8px 12px;
24
- background: #111827;
25
- color: #fff;
26
- border: none;
27
- cursor: pointer;
28
- }
29
-
30
- input[type="text"], input[type="search"], input, textarea {
31
- font-family: inherit;
32
- padding: 8px 10px;
33
- border-radius: 8px;
34
- border: 1px solid #e6e9ee;
35
- outline: none;
36
- }
37
-
38
- /* Utility helpers */
39
- .hidden { display: none !important; }
40
-
41
- @media (prefers-color-scheme: dark) {
42
- html, body { background: #0b1220; color: #e6eef8; }
43
- button { background: #e6eef8; color: #0b1220; }
44
- }
1
+ /* Global base styles for improved look and responsiveness */
2
+ html, body {
3
+ height: 100%;
4
+ margin: 0;
5
+ padding: 0;
6
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
7
+ background: #f7f9fc;
8
+ color: #0f1723;
9
+ -webkit-font-smoothing: antialiased;
10
+ }
11
+
12
+ .container {
13
+ max-width: 1100px;
14
+ margin: 0 auto;
15
+ padding: 16px;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ /* Buttons and inputs */
20
+ button {
21
+ font-family: inherit;
22
+ border-radius: 8px;
23
+ padding: 8px 12px;
24
+ background: #111827;
25
+ color: #fff;
26
+ border: none;
27
+ cursor: pointer;
28
+ }
29
+
30
+ input[type="text"], input[type="search"], input, textarea {
31
+ font-family: inherit;
32
+ padding: 8px 10px;
33
+ border-radius: 8px;
34
+ border: 1px solid #e6e9ee;
35
+ outline: none;
36
+ }
37
+
38
+ /* Utility helpers */
39
+ .hidden { display: none !important; }
40
+
41
+ @media (prefers-color-scheme: dark) {
42
+ html, body { background: #0b1220; color: #e6eef8; }
43
+ button { background: #e6eef8; color: #0b1220; }
44
+ }
@@ -1,95 +1,95 @@
1
- /* 统一不同浏览器的基础样式 */
2
-
3
- html {
4
- /* 防止iPhone在坚屏转向横屏时放大文字 */
5
- -ms-text-size-adjust: 100%;
6
- -webkit-text-size-adjust: 100%;
7
- /* 统一行高 */
8
- line-height: 1.15;
9
- }
10
-
11
- button,
12
- input,
13
- select {
14
- /* 兼容部分手机下border不显示问题 */
15
- border: 1px solid #b2b2bd;
16
- }
17
-
18
- article,
19
- footer,
20
- header,
21
- nav,
22
- section {
23
- /* 修正旧浏览器未定义的块级元素 */
24
- display: block;
25
- }
26
-
27
- canvas,
28
- svg {
29
- /* 修正旧浏览器未定义的行内块元素 */
30
- display: inline-block;
31
- }
32
-
33
- * {
34
- /* 统一不同浏览器盒子尺寸计算方法 */
35
- box-sizing: border-box;
36
- }
37
-
38
- ::-ms-clear,
39
- ::-ms-reveal {
40
- /* 去掉IE浏览器输入框叉叉和眼睛 */
41
- display: none;
42
- }
43
-
44
- img {
45
- /* 针对火狐浏览器在img标签没有src时候的差异修复 */
46
- display: inline-block;
47
- }
48
-
49
- html {
50
- /* 设置默认字体为统一的安全字体 */
51
- font-family: sans-serif;
52
- }
53
-
54
- a {
55
- /* 默认去掉下划线 */
56
- text-decoration: none;
57
- }
58
-
59
- li {
60
- /* 去掉前置索引 */
61
- list-style-type: none;
62
- }
63
-
64
- ul,
65
- ol,
66
- li,
67
- p,
68
- h1,
69
- h2,
70
- h3,
71
- h4,
72
- h5,
73
- h6 {
74
- /* 去掉不喜欢的间距 */
75
- -webkit-margin-before: 0;
76
- -webkit-margin-after: 0;
77
- -webkit-padding-start: 0;
78
- /* 去掉不喜欢的间距,针对火狐浏览器等 */
79
- margin-block-end: 0;
80
- margin-block-start: 0;
81
- padding-inline-start: 0;
82
- /* 修改IE和其它浏览器不一致问题 */
83
- padding: 0;
84
- margin: 0;
85
- }
86
-
87
- body {
88
- /* 去掉默认的8px */
89
- margin: 0;
90
- }
91
-
92
- table {
93
- /* 设置默认表格边框合并为一个单一的边框 */
94
- border-collapse: collapse;
1
+ /* 统一不同浏览器的基础样式 */
2
+
3
+ html {
4
+ /* 防止iPhone在坚屏转向横屏时放大文字 */
5
+ -ms-text-size-adjust: 100%;
6
+ -webkit-text-size-adjust: 100%;
7
+ /* 统一行高 */
8
+ line-height: 1.15;
9
+ }
10
+
11
+ button,
12
+ input,
13
+ select {
14
+ /* 兼容部分手机下border不显示问题 */
15
+ border: 1px solid #b2b2bd;
16
+ }
17
+
18
+ article,
19
+ footer,
20
+ header,
21
+ nav,
22
+ section {
23
+ /* 修正旧浏览器未定义的块级元素 */
24
+ display: block;
25
+ }
26
+
27
+ canvas,
28
+ svg {
29
+ /* 修正旧浏览器未定义的行内块元素 */
30
+ display: inline-block;
31
+ }
32
+
33
+ * {
34
+ /* 统一不同浏览器盒子尺寸计算方法 */
35
+ box-sizing: border-box;
36
+ }
37
+
38
+ ::-ms-clear,
39
+ ::-ms-reveal {
40
+ /* 去掉IE浏览器输入框叉叉和眼睛 */
41
+ display: none;
42
+ }
43
+
44
+ img {
45
+ /* 针对火狐浏览器在img标签没有src时候的差异修复 */
46
+ display: inline-block;
47
+ }
48
+
49
+ html {
50
+ /* 设置默认字体为统一的安全字体 */
51
+ font-family: sans-serif;
52
+ }
53
+
54
+ a {
55
+ /* 默认去掉下划线 */
56
+ text-decoration: none;
57
+ }
58
+
59
+ li {
60
+ /* 去掉前置索引 */
61
+ list-style-type: none;
62
+ }
63
+
64
+ ul,
65
+ ol,
66
+ li,
67
+ p,
68
+ h1,
69
+ h2,
70
+ h3,
71
+ h4,
72
+ h5,
73
+ h6 {
74
+ /* 去掉不喜欢的间距 */
75
+ -webkit-margin-before: 0;
76
+ -webkit-margin-after: 0;
77
+ -webkit-padding-start: 0;
78
+ /* 去掉不喜欢的间距,针对火狐浏览器等 */
79
+ margin-block-end: 0;
80
+ margin-block-start: 0;
81
+ padding-inline-start: 0;
82
+ /* 修改IE和其它浏览器不一致问题 */
83
+ padding: 0;
84
+ margin: 0;
85
+ }
86
+
87
+ body {
88
+ /* 去掉默认的8px */
89
+ margin: 0;
90
+ }
91
+
92
+ table {
93
+ /* 设置默认表格边框合并为一个单一的边框 */
94
+ border-collapse: collapse;
95
95
  }
@@ -1,34 +1,34 @@
1
- const headFactory = require("./head.js");
2
-
3
- const head = headFactory();
4
-
5
- // 聊天
6
- module.exports = {
7
- test: /^\/chart\//,
8
- handler(request, response, wsHandler) {
9
- let url = decodeURIComponent(request.url);
10
-
11
- let requestData = "";
12
-
13
- request.on('data', (chunk) => {
14
- requestData += chunk;
15
- });
16
-
17
- request.on('end', () => {
18
-
19
- if (/sendMsg$/.test(url)) {
20
- wsHandler.notifyBrowser({
21
- payloadData: requestData
22
- });
23
- }
24
-
25
- head["Content-Type"] = "application/json;charset=utf-8";
26
- response.writeHead(200, head);
27
- response.write(JSON.stringify({
28
- code: "000000"
29
- }));
30
- response.end();
31
-
32
- });
33
- }
1
+ const headFactory = require("./head.js");
2
+
3
+ const head = headFactory();
4
+
5
+ // 聊天
6
+ module.exports = {
7
+ test: /^\/chart\//,
8
+ handler(request, response, wsHandler) {
9
+ let url = decodeURIComponent(request.url);
10
+
11
+ let requestData = "";
12
+
13
+ request.on('data', (chunk) => {
14
+ requestData += chunk;
15
+ });
16
+
17
+ request.on('end', () => {
18
+
19
+ if (/sendMsg$/.test(url)) {
20
+ wsHandler.notifyBrowser({
21
+ payloadData: requestData
22
+ });
23
+ }
24
+
25
+ head["Content-Type"] = "application/json;charset=utf-8";
26
+ response.writeHead(200, head);
27
+ response.write(JSON.stringify({
28
+ code: "000000"
29
+ }));
30
+ response.end();
31
+
32
+ });
33
+ }
34
34
  };
@@ -1,18 +1,18 @@
1
- const { readFileSync } = require("fs");
2
- const { join } = require("path");
3
- const { existsSync } = require("fs");
4
-
5
- module.exports = function (filpath) {
6
-
7
- let node_modulesPath = join(__dirname, "../../../node_modules");
8
-
9
- while (!existsSync(join(node_modulesPath, filpath)) && node_modulesPath != join(node_modulesPath, "../")) {
10
- node_modulesPath = join(node_modulesPath, "../");
11
- }
12
-
13
- let source = readFileSync(join(node_modulesPath, filpath), {
14
- encoding: "utf8"
15
- });
16
-
17
- return source;
1
+ const { readFileSync } = require("fs");
2
+ const { join } = require("path");
3
+ const { existsSync } = require("fs");
4
+
5
+ module.exports = function (filpath) {
6
+
7
+ let node_modulesPath = join(__dirname, "../../../node_modules");
8
+
9
+ while (!existsSync(join(node_modulesPath, filpath)) && node_modulesPath != join(node_modulesPath, "../")) {
10
+ node_modulesPath = join(node_modulesPath, "../");
11
+ }
12
+
13
+ let source = readFileSync(join(node_modulesPath, filpath), {
14
+ encoding: "utf8"
15
+ });
16
+
17
+ return source;
18
18
  };
@@ -1,9 +1,9 @@
1
- const pkg = require("../../../package.json");
2
-
3
- module.exports = function () {
4
- return {
5
- 'Access-Control-Allow-Origin': '*',
6
- 'Server': 'Powered by @oipage/cli:website@' + pkg.version,
7
- 'Content-Type': 'text/plain;charset=utf-8'
8
- };
1
+ const pkg = require("../../../package.json");
2
+
3
+ module.exports = function () {
4
+ return {
5
+ 'Access-Control-Allow-Origin': '*',
6
+ 'Server': 'Powered by @oipage/cli:website@' + pkg.version,
7
+ 'Content-Type': 'text/plain;charset=utf-8'
8
+ };
9
9
  };
@@ -1,9 +1,5 @@
1
- const OIPageZipaperIntercept = require("./oipage-zipaper-intercept.js");
2
- const OIPageVISLiteIntercept = require("./oipage-vislite-intercept.js");
3
- const ChartIntercept = require("./chart.js");
4
-
5
- module.exports = [
6
- OIPageZipaperIntercept,
7
- OIPageVISLiteIntercept,
8
- ChartIntercept
1
+ const ChartIntercept = require("./chart.js");
2
+
3
+ module.exports = [
4
+ ChartIntercept
9
5
  ];
@@ -1,12 +1,12 @@
1
- const OIPageScssLoader = require("./oipage-scss-loader.js");
2
- const OIPageHtmlLoader = require("./oipage-html-loader.js");
3
-
4
- module.exports = {
5
- rules: [{
6
- test: /\.scss$/,
7
- use: OIPageScssLoader
8
- }, {
9
- test: /\.html$/,
10
- use: OIPageHtmlLoader
11
- }]
1
+ const OIPageScssLoader = require("./oipage-scss-loader.js");
2
+ const OIPageHtmlLoader = require("./oipage-html-loader.js");
3
+
4
+ module.exports = {
5
+ rules: [{
6
+ test: /\.scss$/,
7
+ use: OIPageScssLoader
8
+ }, {
9
+ test: /\.html$/,
10
+ use: OIPageHtmlLoader
11
+ }]
12
12
  };
@@ -1,8 +1,8 @@
1
- const { parseTemplate } = require("xhtml-to-json");
2
-
3
- module.exports = function (source) {
4
- if (this.entry) return source;
5
-
6
- this.setFileType("application/javascript");
7
- return `export default ${JSON.stringify(parseTemplate(source).toJson())}`;
1
+ const { parseTemplate } = require("xhtml-to-json");
2
+
3
+ module.exports = function (source) {
4
+ if (this.entry) return source;
5
+
6
+ this.setFileType("application/javascript");
7
+ return `export default ${JSON.stringify(parseTemplate(source).toJson())}`;
8
8
  };