oipage 1.4.0-alpha.0 → 1.4.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.
- package/.github/FUNDING.yml +11 -11
- package/AUTHORS.txt +6 -6
- package/CHANGELOG +94 -83
- package/LICENSE +20 -20
- package/README.md +80 -80
- package/bin/data/mineTypes.json +104 -104
- package/bin/disk.js +31 -31
- package/bin/help.js +25 -24
- package/bin/intercept.js +15 -15
- package/bin/run +98 -96
- package/bin/serve.d.ts +56 -55
- package/bin/serve.js +147 -131
- package/bin/template/404.html +183 -171
- 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/dialogs/index.js +43 -0
- package/bin/website-htmls/index.html +18 -0
- package/bin/website-htmls/logo.png +0 -0
- package/bin/website-htmls/main.js +10 -0
- package/bin/website-htmls/pages/App/index.html +4 -0
- package/bin/website-htmls/pages/App/index.js +23 -0
- package/bin/website-htmls/pages/App/index.scss +43 -0
- package/bin/website-htmls/pages/appStore/index.html +6 -0
- package/bin/website-htmls/pages/appStore/index.js +18 -0
- package/bin/website-htmls/pages/appStore/index.scss +27 -0
- package/bin/website-htmls/router.config.js +11 -0
- package/bin/website-htmls/styles/common.css +3 -0
- package/bin/website-htmls/styles/normalize.css +95 -0
- package/bin/website-plugins/intercept/head.js +9 -0
- package/bin/website-plugins/intercept/index.js +5 -0
- package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +40 -0
- package/bin/website-plugins/loader/index.js +12 -0
- package/bin/website-plugins/loader/oipage-html-loader.js +8 -0
- package/bin/website-plugins/loader/oipage-scss-loader.js +150 -0
- 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 +16 -16
- package/nodejs/disk/index.js +78 -78
- package/nodejs/format/index.d.ts +29 -0
- package/nodejs/format/index.js +114 -0
- 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/throttle/index.d.ts +30 -30
- package/nodejs/throttle/index.js +50 -50
- package/package.json +42 -40
- package/web/XMLHttpRequest/index.d.ts +18 -0
- package/web/XMLHttpRequest/index.js +65 -0
- package/web/animation/index.d.ts +19 -19
- package/web/animation/index.js +104 -104
- package/web/format/index.d.ts +29 -0
- package/web/format/index.js +112 -0
- 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
|
@@ -0,0 +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
|
+
}
|
|
23
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
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: #9E9E9E;
|
|
36
|
+
text-align: center;
|
|
37
|
+
color: white;
|
|
38
|
+
outline: 2px dashed #9E9E9E;
|
|
39
|
+
width: 200px;
|
|
40
|
+
transform: rotate(-45deg);
|
|
41
|
+
right: -40px;
|
|
42
|
+
bottom: 44px;
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
14
|
+
},
|
|
15
|
+
style: {
|
|
16
|
+
content: style
|
|
17
|
+
}
|
|
18
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
header {
|
|
2
|
+
height: 50px;
|
|
3
|
+
line-height: 50px;
|
|
4
|
+
background-color: white;
|
|
5
|
+
box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
|
|
6
|
+
background-image: url("./logo.png");
|
|
7
|
+
background-size: auto 90%;
|
|
8
|
+
background-repeat: no-repeat;
|
|
9
|
+
background-position-x: 5px;
|
|
10
|
+
padding-left: 50px;
|
|
11
|
+
font-size: 20px;
|
|
12
|
+
font-weight: 800;
|
|
13
|
+
|
|
14
|
+
.fork {
|
|
15
|
+
line-height: 30px;
|
|
16
|
+
position: fixed;
|
|
17
|
+
background-color: #9E9E9E;
|
|
18
|
+
text-align: center;
|
|
19
|
+
color: white;
|
|
20
|
+
outline: 2px dashed #9E9E9E;
|
|
21
|
+
width: 200px;
|
|
22
|
+
transform: rotate(-45deg);
|
|
23
|
+
right: -40px;
|
|
24
|
+
bottom: 44px;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +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;
|
|
95
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const { readFileSync } = require("fs");
|
|
2
|
+
const { join } = require("path");
|
|
3
|
+
const headFactory = require("./head.js");
|
|
4
|
+
|
|
5
|
+
const head = headFactory();
|
|
6
|
+
|
|
7
|
+
// Zipaper框架
|
|
8
|
+
module.exports = {
|
|
9
|
+
test: /^zipaper$/,
|
|
10
|
+
handler(request, response) {
|
|
11
|
+
head["Content-type"] = "application/javascript;charset=utf-8";
|
|
12
|
+
head["ETag"] = "Zipaper@v" + require("zipaper/package.json").version;
|
|
13
|
+
|
|
14
|
+
if (request.headers["if-none-match"] === head["ETag"]) {
|
|
15
|
+
response.writeHead('304', head);
|
|
16
|
+
response.end();
|
|
17
|
+
console.log("<i> \x1b[1m\x1b[32m[OIPage-dev-server] Cache File: Zipaper\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
response.writeHead(200, head);
|
|
22
|
+
|
|
23
|
+
let source = readFileSync(join(__dirname, "../../../node_modules/zipaper/dist/Zipaper.min.js"), {
|
|
24
|
+
encoding: "utf8"
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
response.write(`let module = { exports: {}};
|
|
28
|
+
let exports = module.exports;
|
|
29
|
+
${source}
|
|
30
|
+
export let createApp = exports.createApp;
|
|
31
|
+
export let defineDirective = exports.defineDirective;
|
|
32
|
+
export let defineElement = exports.defineElement;
|
|
33
|
+
export let defineRouter = exports.defineRouter;
|
|
34
|
+
export let ref = exports.ref;
|
|
35
|
+
export let reactive = exports.reactive;
|
|
36
|
+
export let watcher = exports.watcher;
|
|
37
|
+
`);
|
|
38
|
+
response.end();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +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
|
+
}]
|
|
12
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// 参考:https://github.com/zxl20070701/zxl20070701.github.io/blob/master/bin/loader/scss.js
|
|
2
|
+
let toSelector = function (preSelectorArray, deep) {
|
|
3
|
+
let selectors = preSelectorArray[0], i, j, k;
|
|
4
|
+
for (i = 1; i < deep; i++) {
|
|
5
|
+
let temp = [];
|
|
6
|
+
for (j = 0; j < selectors.length; j++) {
|
|
7
|
+
for (k = 0; k < preSelectorArray[i].length; k++) {
|
|
8
|
+
temp.push(selectors[j] + preSelectorArray[i][k]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
selectors = temp;
|
|
12
|
+
}
|
|
13
|
+
return "\n" + (selectors.join(',')) + "{\n";
|
|
14
|
+
};
|
|
15
|
+
let analyseBlock = function (source) {
|
|
16
|
+
let i = -1, currentChar = null;
|
|
17
|
+
let next = function () {
|
|
18
|
+
currentChar = i++ < source.length - 1 ? source[i] : null;
|
|
19
|
+
return currentChar;
|
|
20
|
+
}
|
|
21
|
+
let nextNValue = function (n) {
|
|
22
|
+
return source.substring(i, n + i > source.length ? source.length : n + i);
|
|
23
|
+
}
|
|
24
|
+
let blocks = [];
|
|
25
|
+
let currentBlock = "";
|
|
26
|
+
next();
|
|
27
|
+
while (true) {
|
|
28
|
+
while (new RegExp("[\\x20\\t\\r\\n\\f]").test(currentChar)) {
|
|
29
|
+
next();
|
|
30
|
+
}
|
|
31
|
+
if (currentChar == null) break;
|
|
32
|
+
if (nextNValue(2) == '/*') {
|
|
33
|
+
|
|
34
|
+
next();
|
|
35
|
+
next();
|
|
36
|
+
currentBlock = "/*";
|
|
37
|
+
|
|
38
|
+
while (nextNValue(2) != '*/' && currentChar != null) {
|
|
39
|
+
currentBlock += currentChar;
|
|
40
|
+
next();
|
|
41
|
+
}
|
|
42
|
+
if (currentChar == null) {
|
|
43
|
+
throw new Error('The comment is not closed.');
|
|
44
|
+
}
|
|
45
|
+
currentBlock += "*/";
|
|
46
|
+
next();
|
|
47
|
+
next();
|
|
48
|
+
blocks.push({
|
|
49
|
+
value: currentBlock,
|
|
50
|
+
type: "comment-double"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (nextNValue(2) == '//') {
|
|
54
|
+
currentBlock = '';
|
|
55
|
+
|
|
56
|
+
while (currentChar != '\n' && currentChar != null) {
|
|
57
|
+
currentBlock += currentChar;
|
|
58
|
+
next();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
blocks.push({
|
|
62
|
+
value: currentBlock,
|
|
63
|
+
type: "comment-single"
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
else if (currentChar == '}') {
|
|
68
|
+
|
|
69
|
+
blocks.push({
|
|
70
|
+
value: "}",
|
|
71
|
+
type: "end"
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
next();
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
|
|
79
|
+
currentBlock = '';
|
|
80
|
+
while (currentChar != '{' && currentChar != ';' && currentChar != null) {
|
|
81
|
+
currentBlock += currentChar;
|
|
82
|
+
next();
|
|
83
|
+
}
|
|
84
|
+
if (currentChar == null) {
|
|
85
|
+
throw new Error('Statement or code block missing closure.');
|
|
86
|
+
}
|
|
87
|
+
blocks.push({
|
|
88
|
+
value: currentBlock + currentChar,
|
|
89
|
+
type: {
|
|
90
|
+
'{': "begin",
|
|
91
|
+
';': 'statement'
|
|
92
|
+
}[currentChar]
|
|
93
|
+
});
|
|
94
|
+
next();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return blocks;
|
|
98
|
+
};
|
|
99
|
+
module.exports = function (source) {
|
|
100
|
+
this.setFileType("application/javascript");
|
|
101
|
+
let blocks = analyseBlock(source + "");
|
|
102
|
+
let i, j, cssCode = "", preSelectorArray = [], deep = 0;
|
|
103
|
+
for (i = 0; i < blocks.length; i++) {
|
|
104
|
+
if (blocks[i].type == 'comment-double') {
|
|
105
|
+
cssCode += blocks[i].value;
|
|
106
|
+
}
|
|
107
|
+
else if (blocks[i].type == 'comment-single') {
|
|
108
|
+
cssCode += "\n/* " + blocks[i].value + " */\n";
|
|
109
|
+
}
|
|
110
|
+
else if (blocks[i].type == 'begin') {
|
|
111
|
+
let preSplit = blocks[i].value.split(',');
|
|
112
|
+
let preSelect = [];
|
|
113
|
+
for (j = 0; j < preSplit.length; j++) {
|
|
114
|
+
preSelect[j] = preSplit[j].replace(/\{$/, '').trim();
|
|
115
|
+
if (/^&/.test(preSelect[j])) {
|
|
116
|
+
preSelect[j] = preSelect[j].replace(/^&/, '');
|
|
117
|
+
} else {
|
|
118
|
+
preSelect[j] = " " + preSelect[j];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
preSelectorArray[deep] = preSelect;
|
|
122
|
+
deep += 1;
|
|
123
|
+
}
|
|
124
|
+
else if (blocks[i].type == 'end') {
|
|
125
|
+
deep -= 1;
|
|
126
|
+
}
|
|
127
|
+
else if (blocks[i].type == 'statement') {
|
|
128
|
+
j = 1;
|
|
129
|
+
let preType = blocks[i - j].type;
|
|
130
|
+
while (['comment-double', 'comment-single'].indexOf(preType) > -1) {
|
|
131
|
+
j += 1;
|
|
132
|
+
preType = blocks[i - j].type;
|
|
133
|
+
}
|
|
134
|
+
if (['end', 'begin'].indexOf(preType) > -1) {
|
|
135
|
+
cssCode += toSelector(preSelectorArray, deep);
|
|
136
|
+
}
|
|
137
|
+
cssCode += "\n" + blocks[i].value + "\n";
|
|
138
|
+
j = 1;
|
|
139
|
+
let nextType = blocks[i + j].type;
|
|
140
|
+
while (['comment-double', 'comment-single'].indexOf(nextType) > -1) {
|
|
141
|
+
j += 1;
|
|
142
|
+
nextType = blocks[i + j].type;
|
|
143
|
+
}
|
|
144
|
+
if (['end', 'begin'].indexOf(nextType) > -1) {
|
|
145
|
+
cssCode += "\n}\n";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return `export default ${JSON.stringify(cssCode)}`;
|
|
150
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
interface animationResult {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 一个函数,调用该函数,可以提前结束动画
|
|
5
|
-
*/
|
|
6
|
-
stop(): void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface animationFun {
|
|
10
|
-
(deep: number): void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* 轮询动画
|
|
15
|
-
*/
|
|
16
|
-
export interface animationType {
|
|
17
|
-
(doback: animationFun, duration?: number, callback?: animationFun): animationResult
|
|
18
|
-
}
|
|
19
|
-
|
|
1
|
+
interface animationResult {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 一个函数,调用该函数,可以提前结束动画
|
|
5
|
+
*/
|
|
6
|
+
stop(): void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface animationFun {
|
|
10
|
+
(deep: number): void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 轮询动画
|
|
15
|
+
*/
|
|
16
|
+
export interface animationType {
|
|
17
|
+
(doback: animationFun, duration?: number, callback?: animationFun): animationResult
|
|
18
|
+
}
|
|
19
|
+
|
|
20
20
|
export let animation: animationType
|