@oipage/cli 0.3.0 → 1.0.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 (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 → mimeTypes.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,14 +1,14 @@
1
- import { createApp } from "zipaper"
2
-
3
- import App from "./pages/App/index.js"
4
- import router from "./router.config.js"
5
- import dialogs from "./dialogs/index.js"
6
- import uiSelectFile from "./components/ui-select-file/index.js"
7
-
8
- // https://oi-contrib.github.io/Zipaper/index.html
9
-
10
- createApp(App)
11
- .use(router) // 路由
12
- .use(dialogs) // 弹框
13
- .component("ui-select-file", uiSelectFile)
1
+ import { createApp } from "zipaper"
2
+
3
+ import App from "./pages/App/index.js"
4
+ import router from "./router.config.js"
5
+ import dialogs from "./dialogs/index.js"
6
+ import uiSelectFile from "./components/ui-select-file/index.js"
7
+
8
+ // https://oi-contrib.github.io/Zipaper/index.html
9
+
10
+ createApp(App)
11
+ .use(router) // 路由
12
+ .use(dialogs) // 弹框
13
+ .component("ui-select-file", uiSelectFile)
14
14
  .mount(document.getElementById("root")) // 挂载到页面
@@ -1,7 +1,7 @@
1
- <router></router>
2
- <div id="dialog-root">
3
- <div class="mask" z-on:click="closeDialog"></div>
4
- </div>
5
- <a class="fork" href="https://github.com/oi-contrib/oipage-cli" target="_blank">
6
- Fork me on Github
1
+ <router></router>
2
+ <div id="dialog-root">
3
+ <div class="mask" z-on:click="closeDialog"></div>
4
+ </div>
5
+ <a class="fork" href="https://github.com/oi-contrib/oipage-cli" target="_blank">
6
+ Fork me on Github
7
7
  </a>
@@ -1,23 +1,23 @@
1
- import { defineElement } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
-
10
- }
11
- },
12
- methods: {
13
-
14
- // 点击遮罩关闭弹框
15
- closeDialog() {
16
- this.$closeDialog()
17
- }
18
-
19
- },
20
- style: {
21
- content: style
22
- }
1
+ import { defineElement } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+
10
+ }
11
+ },
12
+ methods: {
13
+
14
+ // 点击遮罩关闭弹框
15
+ closeDialog() {
16
+ this.$closeDialog()
17
+ }
18
+
19
+ },
20
+ style: {
21
+ content: style
22
+ }
23
23
  })
@@ -1,44 +1,44 @@
1
- #dialog-root {
2
- width: 0;
3
- height: 0;
4
- position: fixed;
5
- left: 0;
6
- top: 0;
7
- z-index: 101;
8
-
9
- .mask {
10
- width: 100vw;
11
- height: 100vh;
12
- background-color: #0000004f;
13
-
14
- &:last-child {
15
- display: none;
16
- }
17
- }
18
-
19
- .content {
20
- display: none;
21
- position: absolute;
22
- left: 50vw;
23
- top: 50vh;
24
- transform: translateX(-50%) translateY(-50%);
25
-
26
- &:last-child {
27
- display: block;
28
- }
29
- }
30
- }
31
-
32
- .fork {
33
- line-height: 30px;
34
- position: fixed;
35
- background-color: #607D8B;
36
- text-align: center;
37
- color: white;
38
- outline: 2px dashed #607D8B;
39
- width: 200px;
40
- transform: rotate(45deg);
41
- right: -45px;
42
- top: 45px;
43
- z-index: 1;
1
+ #dialog-root {
2
+ width: 0;
3
+ height: 0;
4
+ position: fixed;
5
+ left: 0;
6
+ top: 0;
7
+ z-index: 101;
8
+
9
+ .mask {
10
+ width: 100vw;
11
+ height: 100vh;
12
+ background-color: #0000004f;
13
+
14
+ &:last-child {
15
+ display: none;
16
+ }
17
+ }
18
+
19
+ .content {
20
+ display: none;
21
+ position: absolute;
22
+ left: 50vw;
23
+ top: 50vh;
24
+ transform: translateX(-50%) translateY(-50%);
25
+
26
+ &:last-child {
27
+ display: block;
28
+ }
29
+ }
30
+ }
31
+
32
+ .fork {
33
+ line-height: 30px;
34
+ position: fixed;
35
+ background-color: #607D8B;
36
+ text-align: center;
37
+ color: white;
38
+ outline: 2px dashed #607D8B;
39
+ width: 200px;
40
+ transform: rotate(45deg);
41
+ right: -45px;
42
+ top: 45px;
43
+ z-index: 1;
44
44
  }
@@ -1,8 +1,8 @@
1
- <div class="appstore-view">
2
- <header>
3
- <span title="返回首页" class="btn" z-on:click="goto('/appStore/home')">
4
- 应用市场
5
- </span>
6
- </header>
7
- <router></router>
1
+ <div class="appstore-view">
2
+ <header>
3
+ <span title="返回首页" class="btn" z-on:click="goto('/appStore/home')">
4
+ 应用市场
5
+ </span>
6
+ </header>
7
+ <router></router>
8
8
  </div>
@@ -1,20 +1,20 @@
1
- import { defineElement, ref } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
-
10
- }
11
- },
12
- methods: {
13
- goto(url) {
14
- this.$goto(url)
15
- }
16
- },
17
- style: {
18
- content: style
19
- }
1
+ import { defineElement, ref } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+
10
+ }
11
+ },
12
+ methods: {
13
+ goto(url) {
14
+ this.$goto(url)
15
+ }
16
+ },
17
+ style: {
18
+ content: style
19
+ }
20
20
  })
@@ -1,55 +1,55 @@
1
- .appstore-view {
2
-
3
- header {
4
- height: 50px;
5
- line-height: 50px;
6
- background-color: white;
7
- box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
8
- background-image: url("./images/logo.png");
9
- background-size: auto 90%;
10
- background-repeat: no-repeat;
11
- background-position-x: 5px;
12
- padding-left: 55px;
13
- font-size: 18px;
14
- user-select: none;
15
-
16
- &>.btn {
17
- display: inline-block;
18
- cursor: pointer;
19
- font-weight: 400;
20
-
21
- &:hover {
22
- text-decoration: underline;
23
- font-weight: 800;
24
- }
25
- }
26
- }
27
-
28
- ul {
29
- text-align: left;
30
- padding: 20px 10px;
31
-
32
- &>li {
33
- text-align: center;
34
- display: inline-block;
35
- margin: 10px;
36
- width: 90px;
37
-
38
- &:hover {
39
- text-decoration: underline;
40
- cursor: pointer;
41
- }
42
-
43
- &>img {
44
- border-radius: 10px;
45
- width: 50px;
46
- }
47
-
48
- &>h2 {
49
- font-size: 14px;
50
- line-height: 2em;
51
- }
52
- }
53
- }
54
-
1
+ .appstore-view {
2
+
3
+ header {
4
+ height: 50px;
5
+ line-height: 50px;
6
+ background-color: white;
7
+ box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
8
+ background-image: url("./images/logo.png");
9
+ background-size: auto 90%;
10
+ background-repeat: no-repeat;
11
+ background-position-x: 5px;
12
+ padding-left: 55px;
13
+ font-size: 18px;
14
+ user-select: none;
15
+
16
+ &>.btn {
17
+ display: inline-block;
18
+ cursor: pointer;
19
+ font-weight: 400;
20
+
21
+ &:hover {
22
+ text-decoration: underline;
23
+ font-weight: 800;
24
+ }
25
+ }
26
+ }
27
+
28
+ ul {
29
+ text-align: left;
30
+ padding: 20px 10px;
31
+
32
+ &>li {
33
+ text-align: center;
34
+ display: inline-block;
35
+ margin: 10px;
36
+ width: 90px;
37
+
38
+ &:hover {
39
+ text-decoration: underline;
40
+ cursor: pointer;
41
+ }
42
+
43
+ &>img {
44
+ border-radius: 10px;
45
+ width: 50px;
46
+ }
47
+
48
+ &>h2 {
49
+ font-size: 14px;
50
+ line-height: 2em;
51
+ }
52
+ }
53
+ }
54
+
55
55
  }
@@ -1,9 +1,9 @@
1
- <form z-on:submit.prevent="doSubmit">
2
- <div class="chart-view">
3
- <div class="content" id="chart-content-id"></div>
4
- <div class="input">
5
- <input placeholder="请输入内容......" z-model="msg" spellcheck="false" autocomplete="off" />
6
- <button type="submit">发送</button>
7
- </div>
8
- </div>
1
+ <form z-on:submit.prevent="doSubmit">
2
+ <div class="chart-view">
3
+ <div class="content" id="chart-content-id"></div>
4
+ <div class="input">
5
+ <input placeholder="请输入内容......" z-model="msg" spellcheck="false" autocomplete="off" />
6
+ <button type="submit">发送</button>
7
+ </div>
8
+ </div>
9
9
  </form>
@@ -1,73 +1,73 @@
1
- import { defineElement, ref } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
- uniqueid: new Date().valueOf() + "#" + (Math.random() * 10000).toFixed(0),
10
- msg: ref("")
11
- }
12
- },
13
- created() {
14
-
15
- let ws = new WebSocket('ws://' + window.location.hostname + ':' + (+window.location.port + 1) + '/');
16
-
17
- // 连接成功
18
- ws.addEventListener('open', () => {
19
- ws.send('客户端和服务器建立连接成功!(' + this.uniqueid + ')');
20
- });
21
-
22
- // 监听来自服务器的数据
23
- ws.addEventListener('message', (event) => {
24
- let data = JSON.parse(event.data);
25
-
26
- let contentEl = document.getElementById("chart-content-id");
27
-
28
- let itemEl = document.createElement("div");
29
- contentEl.appendChild(itemEl);
30
-
31
- itemEl.setAttribute("class", "item");
32
-
33
- if (data.uniqueid === this.uniqueid) {
34
- itemEl.setAttribute("tag", "sender");
35
- } else {
36
- itemEl.setAttribute("tag", "receiver");
37
- }
38
-
39
- let textEl = document.createElement("div");
40
- textEl.innerText = data.msg;
41
- itemEl.appendChild(textEl);
42
- textEl.setAttribute("class", "text");
43
-
44
- itemEl.scrollIntoView({
45
- behavior: 'smooth',
46
- block: 'end',
47
- inline: 'nearest'
48
- });
49
- });
50
-
51
- },
52
- methods: {
53
- doSubmit() {
54
- fetch("./chart/sendMsg", {
55
- method: "POST",
56
- headers: {
57
- "Content-Type": "application/json;charset=utf-8"
58
- },
59
- body: JSON.stringify({
60
- msg: this.msg,
61
- uniqueid: this.uniqueid
62
- })
63
- }).then(() => {
64
- this.msg = "";
65
- }).catch(() => {
66
- alert("发送失败!");
67
- });
68
- }
69
- },
70
- style: {
71
- content: style
72
- }
1
+ import { defineElement, ref } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+ uniqueid: new Date().valueOf() + "#" + (Math.random() * 10000).toFixed(0),
10
+ msg: ref("")
11
+ }
12
+ },
13
+ created() {
14
+
15
+ let ws = new WebSocket('ws://' + window.location.hostname + ':' + (+window.location.port + 1) + '/');
16
+
17
+ // 连接成功
18
+ ws.addEventListener('open', () => {
19
+ ws.send('客户端和服务器建立连接成功!(' + this.uniqueid + ')');
20
+ });
21
+
22
+ // 监听来自服务器的数据
23
+ ws.addEventListener('message', (event) => {
24
+ let data = JSON.parse(event.data);
25
+
26
+ let contentEl = document.getElementById("chart-content-id");
27
+
28
+ let itemEl = document.createElement("div");
29
+ contentEl.appendChild(itemEl);
30
+
31
+ itemEl.setAttribute("class", "item");
32
+
33
+ if (data.uniqueid === this.uniqueid) {
34
+ itemEl.setAttribute("tag", "sender");
35
+ } else {
36
+ itemEl.setAttribute("tag", "receiver");
37
+ }
38
+
39
+ let textEl = document.createElement("div");
40
+ textEl.innerText = data.msg;
41
+ itemEl.appendChild(textEl);
42
+ textEl.setAttribute("class", "text");
43
+
44
+ itemEl.scrollIntoView({
45
+ behavior: 'smooth',
46
+ block: 'end',
47
+ inline: 'nearest'
48
+ });
49
+ });
50
+
51
+ },
52
+ methods: {
53
+ doSubmit() {
54
+ fetch("./chart/sendMsg", {
55
+ method: "POST",
56
+ headers: {
57
+ "Content-Type": "application/json;charset=utf-8"
58
+ },
59
+ body: JSON.stringify({
60
+ msg: this.msg,
61
+ uniqueid: this.uniqueid
62
+ })
63
+ }).then(() => {
64
+ this.msg = "";
65
+ }).catch(() => {
66
+ alert("发送失败!");
67
+ });
68
+ }
69
+ },
70
+ style: {
71
+ content: style
72
+ }
73
73
  })
@@ -1,72 +1,72 @@
1
- .chart-view {
2
- padding: 20px 12px 90px;
3
- box-sizing: border-box;
4
-
5
- .content {
6
- margin: 0 auto 12px;
7
- max-width: 720px;
8
- height: calc(100vh - 200px);
9
- background: #ffffff;
10
- border-radius: 12px;
11
- padding: 12px;
12
- overflow: auto;
13
- box-shadow: 0 8px 20px rgba(15,23,42,0.06);
14
- }
15
-
16
- .content::-webkit-scrollbar { width: 8px; }
17
- .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 8px; }
18
-
19
- .item {
20
- display: flex;
21
- margin: 8px 0;
22
- width: 100%;
23
- justify-content: flex-start;
24
- }
25
-
26
- .item[tag="sender"] { justify-content: flex-end; }
27
-
28
- .item .text {
29
- background-color: #eef2ff;
30
- padding: 8px 12px;
31
- max-width: 68%;
32
- border-radius: 12px;
33
- font-size: 14px;
34
- word-break: break-word;
35
- }
36
-
37
- .item[tag="sender"] .text { background-color: #dcfce7; }
38
-
39
- .input {
40
- position: fixed;
41
- left: 50%;
42
- transform: translateX(-50%);
43
- bottom: 18px;
44
- width: calc(100% - 32px);
45
- max-width: 720px;
46
- display: flex;
47
- gap: 8px;
48
- background: transparent;
49
- }
50
-
51
- .input > input {
52
- flex: 1;
53
- border: 1px solid #e6e9ee;
54
- border-radius: 10px;
55
- padding: 8px 12px;
56
- box-sizing: border-box;
57
- }
58
-
59
- .input > button {
60
- width: 84px;
61
- border-radius: 10px;
62
- background: #111827;
63
- color: #fff;
64
- border: none;
65
- }
66
-
67
- @media (max-width: 480px) {
68
- .content { height: calc(100vh - 180px); padding: 10px; }
69
- .item .text { max-width: 78%; font-size: 13px; }
70
- .input { width: calc(100% - 24px); bottom: 12px; }
71
- }
1
+ .chart-view {
2
+ padding: 20px 12px 90px;
3
+ box-sizing: border-box;
4
+
5
+ .content {
6
+ margin: 0 auto 12px;
7
+ max-width: 720px;
8
+ height: calc(100vh - 200px);
9
+ background: #ffffff;
10
+ border-radius: 12px;
11
+ padding: 12px;
12
+ overflow: auto;
13
+ box-shadow: 0 8px 20px rgba(15,23,42,0.06);
14
+ }
15
+
16
+ .content::-webkit-scrollbar { width: 8px; }
17
+ .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 8px; }
18
+
19
+ .item {
20
+ display: flex;
21
+ margin: 8px 0;
22
+ width: 100%;
23
+ justify-content: flex-start;
24
+ }
25
+
26
+ .item[tag="sender"] { justify-content: flex-end; }
27
+
28
+ .item .text {
29
+ background-color: #eef2ff;
30
+ padding: 8px 12px;
31
+ max-width: 68%;
32
+ border-radius: 12px;
33
+ font-size: 14px;
34
+ word-break: break-word;
35
+ }
36
+
37
+ .item[tag="sender"] .text { background-color: #dcfce7; }
38
+
39
+ .input {
40
+ position: fixed;
41
+ left: 50%;
42
+ transform: translateX(-50%);
43
+ bottom: 18px;
44
+ width: calc(100% - 32px);
45
+ max-width: 720px;
46
+ display: flex;
47
+ gap: 8px;
48
+ background: transparent;
49
+ }
50
+
51
+ .input > input {
52
+ flex: 1;
53
+ border: 1px solid #e6e9ee;
54
+ border-radius: 10px;
55
+ padding: 8px 12px;
56
+ box-sizing: border-box;
57
+ }
58
+
59
+ .input > button {
60
+ width: 84px;
61
+ border-radius: 10px;
62
+ background: #111827;
63
+ color: #fff;
64
+ border: none;
65
+ }
66
+
67
+ @media (max-width: 480px) {
68
+ .content { height: calc(100vh - 180px); padding: 10px; }
69
+ .item .text { max-width: 78%; font-size: 13px; }
70
+ .input { width: calc(100% - 24px); bottom: 12px; }
71
+ }
72
72
  }