oipage 0.3.1-alpha.0 → 0.3.2

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 (42) hide show
  1. package/CHANGELOG +61 -61
  2. package/README.md +122 -122
  3. package/bin/options.js +73 -73
  4. package/bin/run +208 -208
  5. package/browserjs/getStyle/index.d.ts +10 -10
  6. package/browserjs/getStyle/index.js +12 -12
  7. package/browserjs/index.d.ts +12 -12
  8. package/browserjs/index.js +8 -8
  9. package/browserjs/onReady/index.d.ts +7 -7
  10. package/browserjs/onReady/index.js +7 -7
  11. package/browserjs/setStyle/index.d.ts +9 -9
  12. package/browserjs/setStyle/index.js +4 -4
  13. package/corejs/animation/index.d.ts +11 -11
  14. package/corejs/animation/index.js +101 -101
  15. package/corejs/index.d.ts +9 -9
  16. package/corejs/index.js +6 -6
  17. package/corejs/throttle/index.d.ts +30 -30
  18. package/corejs/throttle/index.js +49 -49
  19. package/nodejs/core/file.js +162 -162
  20. package/nodejs/core/image.js +4 -4
  21. package/nodejs/core/log.js +89 -89
  22. package/nodejs/core/network.js +39 -39
  23. package/nodejs/core/options.js +48 -48
  24. package/nodejs/core/remote.js +60 -60
  25. package/nodejs/core/responseFileList.js +27 -27
  26. package/nodejs/core/server.js +198 -198
  27. package/nodejs/data/404.js +51 -51
  28. package/nodejs/data/mime.types.js +111 -111
  29. package/nodejs/form/common.js +2 -2
  30. package/nodejs/form/index.js +79 -79
  31. package/nodejs/form/select.js +9 -9
  32. package/nodejs/index.js +57 -57
  33. package/nodejs/loader/simpleScss.js +247 -247
  34. package/nodejs/loader/xhtml.js +520 -520
  35. package/nodejs/reader/plain.js +20 -20
  36. package/package.json +33 -33
  37. package/stylecss/index.css +3 -3
  38. package/stylecss/normalize.css +93 -93
  39. package/stylecss/rasterize.css +317 -317
  40. package/stylecss/skeleton.css +16 -16
  41. package/types/get-options.d.ts +5 -5
  42. package/types/index.d.ts +186 -186
@@ -1,49 +1,49 @@
1
- /**
2
- *
3
- * 命令行参数解析
4
- *
5
- * @param {JSON} config 命令参数缩小到全写的映射
6
- * @param {Array} argv 需要判断类型的值
7
- *
8
- * @returns {JSON} 返回整理后的参数
9
- *
10
- */
11
- module.exports = function (config, argv) {
12
-
13
- let resultConfig = {
14
- __terminal__: []
15
- }, flag = null;
16
- for (let i = 2; i < argv.length; i++) {
17
-
18
- // 如果是新的配置
19
- if (/^--[0-9a-zA-Z]+$/.test(argv[i]) || /^-[0-9a-zA-Z]$/.test(argv[i])) {
20
- let key = argv[i];
21
-
22
- // 如果是缩写,需要映射
23
- if (key.length == 2) {
24
- key = config[key];
25
-
26
- // 如果是错误缩写
27
- if (!key) {
28
- flag = null;
29
- continue;
30
- }
31
- }
32
-
33
- flag = key.replace(/^--/, "");
34
- resultConfig[flag] = [];
35
- }
36
-
37
- // 如果是普通的参数
38
- else if (flag != null) {
39
- resultConfig[flag].push(argv[i]);
40
- }
41
-
42
- else {
43
- resultConfig.__terminal__.push(argv[i]);
44
- }
45
-
46
- }
47
-
48
- return resultConfig;
1
+ /**
2
+ *
3
+ * 命令行参数解析
4
+ *
5
+ * @param {JSON} config 命令参数缩小到全写的映射
6
+ * @param {Array} argv 需要判断类型的值
7
+ *
8
+ * @returns {JSON} 返回整理后的参数
9
+ *
10
+ */
11
+ module.exports = function (config, argv) {
12
+
13
+ let resultConfig = {
14
+ __terminal__: []
15
+ }, flag = null;
16
+ for (let i = 2; i < argv.length; i++) {
17
+
18
+ // 如果是新的配置
19
+ if (/^--[0-9a-zA-Z]+$/.test(argv[i]) || /^-[0-9a-zA-Z]$/.test(argv[i])) {
20
+ let key = argv[i];
21
+
22
+ // 如果是缩写,需要映射
23
+ if (key.length == 2) {
24
+ key = config[key];
25
+
26
+ // 如果是错误缩写
27
+ if (!key) {
28
+ flag = null;
29
+ continue;
30
+ }
31
+ }
32
+
33
+ flag = key.replace(/^--/, "");
34
+ resultConfig[flag] = [];
35
+ }
36
+
37
+ // 如果是普通的参数
38
+ else if (flag != null) {
39
+ resultConfig[flag].push(argv[i]);
40
+ }
41
+
42
+ else {
43
+ resultConfig.__terminal__.push(argv[i]);
44
+ }
45
+
46
+ }
47
+
48
+ return resultConfig;
49
49
  };
@@ -1,60 +1,60 @@
1
- const https = require('https');
2
- const http = require('http');
3
-
4
- exports.get = function (url, options = {}) {
5
- return new Promise((resolve, reject) => {
6
-
7
- let handler = /^https/.test(url) ? https : http;
8
-
9
- handler.get(url, res => {
10
- res.on('data', (data) => {
11
- if (options.json) {
12
- resolve(JSON.parse(data.toString('utf8')));
13
- } else {
14
- resolve(data);
15
- }
16
- });
17
- }).on('error', (e) => {
18
- reject(e);
19
- });
20
- });
21
- };
22
-
23
- exports.post = function (url, options = {}) {
24
- return new Promise((resolve, reject) => {
25
-
26
- let handler = /^https/.test(url) ? https : http;
27
-
28
- let execArray = /https*:\/\/([^\/]+)(.+)?/.exec(url);
29
- let hostport = execArray[1].split(":");
30
-
31
- const req = handler.request({
32
- hostname: hostport[0],
33
- port: hostport[1] || 80,
34
- path: execArray[2] || "/",
35
- method: "POST",
36
- headers: options.header || {}
37
- }, (res) => {
38
- res.setEncoding('utf8');
39
-
40
- let data = "";
41
- res.on('data', (chunk) => {
42
- data += chunk;
43
- });
44
- res.on('end', () => {
45
- if (options.json) {
46
- resolve(JSON.parse(data.toString('utf8')));
47
- } else {
48
- resolve(data);
49
- }
50
- });
51
- });
52
-
53
- req.write(options.params || "{}");
54
-
55
- req.on('error', (e) => {
56
- reject(e);
57
- });
58
- req.end();
59
- });
60
- };
1
+ const https = require('https');
2
+ const http = require('http');
3
+
4
+ exports.get = function (url, options = {}) {
5
+ return new Promise((resolve, reject) => {
6
+
7
+ let handler = /^https/.test(url) ? https : http;
8
+
9
+ handler.get(url, res => {
10
+ res.on('data', (data) => {
11
+ if (options.json) {
12
+ resolve(JSON.parse(data.toString('utf8')));
13
+ } else {
14
+ resolve(data);
15
+ }
16
+ });
17
+ }).on('error', (e) => {
18
+ reject(e);
19
+ });
20
+ });
21
+ };
22
+
23
+ exports.post = function (url, options = {}) {
24
+ return new Promise((resolve, reject) => {
25
+
26
+ let handler = /^https/.test(url) ? https : http;
27
+
28
+ let execArray = /https*:\/\/([^\/]+)(.+)?/.exec(url);
29
+ let hostport = execArray[1].split(":");
30
+
31
+ const req = handler.request({
32
+ hostname: hostport[0],
33
+ port: hostport[1] || 80,
34
+ path: execArray[2] || "/",
35
+ method: "POST",
36
+ headers: options.header || {}
37
+ }, (res) => {
38
+ res.setEncoding('utf8');
39
+
40
+ let data = "";
41
+ res.on('data', (chunk) => {
42
+ data += chunk;
43
+ });
44
+ res.on('end', () => {
45
+ if (options.json) {
46
+ resolve(JSON.parse(data.toString('utf8')));
47
+ } else {
48
+ resolve(data);
49
+ }
50
+ });
51
+ });
52
+
53
+ req.write(options.params || "{}");
54
+
55
+ req.on('error', (e) => {
56
+ reject(e);
57
+ });
58
+ req.end();
59
+ });
60
+ };
@@ -1,28 +1,28 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const Template_404 = require('../data/404');
5
-
6
- // 读取当前路径下的文件,方便服务器404的时候导航
7
- module.exports = function (fullUrl) {
8
-
9
- let files, content = fullUrl;
10
- try {
11
- files = fs.readdirSync(fullUrl);
12
- } catch (e) {
13
- try {
14
- content = path.resolve(fullUrl, '../');
15
- files = fs.readdirSync(content);
16
- } catch (e) {
17
- files = [];
18
- }
19
- }
20
-
21
- let template = "<a href='../'>..</a>";
22
- for (let i in files) {
23
- let isDirectory = fs.lstatSync(path.join(content, files[i])).isDirectory();
24
- template += "<a class='" + (isDirectory ? "folder" : "file") + "' href='./" + files[i] + (isDirectory ? "/" : "") + "'>" + files[i] + "</a>";
25
- }
26
-
27
- return Template_404(template);
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const Template_404 = require('../data/404');
5
+
6
+ // 读取当前路径下的文件,方便服务器404的时候导航
7
+ module.exports = function (fullUrl) {
8
+
9
+ let files, content = fullUrl;
10
+ try {
11
+ files = fs.readdirSync(fullUrl);
12
+ } catch (e) {
13
+ try {
14
+ content = path.resolve(fullUrl, '../');
15
+ files = fs.readdirSync(content);
16
+ } catch (e) {
17
+ files = [];
18
+ }
19
+ }
20
+
21
+ let template = "<a href='../'>..</a>";
22
+ for (let i in files) {
23
+ let isDirectory = fs.lstatSync(path.join(content, files[i])).isDirectory();
24
+ template += "<a class='" + (isDirectory ? "folder" : "file") + "' href='./" + files[i] + (isDirectory ? "/" : "") + "'>" + files[i] + "</a>";
25
+ }
26
+
27
+ return Template_404(template);
28
28
  };