oipage 1.7.0-alpha.6 → 1.7.0-rc.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/CHANGELOG CHANGED
@@ -153,8 +153,5 @@ v1.7.0:
153
153
  2、修复开发服务器错误缓存问题
154
154
  3、修改types错误定义(intercept)
155
155
  - 新增功能
156
- 1、API功能(Node.js)
157
- * remote HTTP请求
158
- (包括:get、post)
159
- 2、开发服务器
156
+ 1、开发服务器
160
157
  * 转发功能 proxy
package/bin/proxy.js CHANGED
@@ -6,7 +6,7 @@ module.exports = function (args, proxy) {
6
6
  let intercept = [];
7
7
  for (let key in proxy) {
8
8
  intercept.push({
9
- test: new RegExp(key),
9
+ test: new RegExp("^" + key),
10
10
  handler(request, response) {
11
11
  let proxyItem = proxy[key];
12
12
 
@@ -14,7 +14,7 @@ module.exports = function (args, proxy) {
14
14
  response.writeHead(500, {
15
15
  'Content-Type': "text/plain;charset=utf-8",
16
16
  'Access-Control-Allow-Origin': '*',
17
- 'Server': 'Powered by ' + args.name + '\'s proxy'
17
+ 'Server': 'Powered by ' + args.name + "@" + args.version + ' proxy'
18
18
  });
19
19
  response.write(err);
20
20
  response.end();
@@ -49,13 +49,9 @@ module.exports = function (args, proxy) {
49
49
  ...res.headers
50
50
  }
51
51
 
52
- // 解决跨域问题
53
- if (resHeaders['Access-Control-Allow-Origin'] !== '*' && resHeaders['access-control-allow-origin'] !== '*') resHeaders['Access-Control-Allow-Origin'] = '*'
54
-
55
52
  // 标记响应服务器
56
- delete resHeaders["Server"];
57
53
  delete resHeaders["server"];
58
- resHeaders["Server"] = 'Powered by ' + args.name + '\'s proxy';
54
+ resHeaders["Server"] = 'Powered by ' + args.name + "@" + args.version + ' proxy';
59
55
 
60
56
  // 设置响应头
61
57
  response.writeHead(res.statusCode, resHeaders);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.7.0-alpha.6
2
+ * animation of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * cmdlog of OIPage v1.7.0-alpha.6
2
+ * cmdlog of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * disk of OIPage v1.7.0-alpha.6
2
+ * disk of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.7.0-alpha.6
2
+ * format of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.7.0-alpha.6
2
+ * json of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {reader} = require("../reader/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * logform of OIPage v1.7.0-alpha.6
2
+ * logform of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {linelog} = require("../cmdlog/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.7.0-alpha.6
2
+ * reader of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.7.0-alpha.6
2
+ * throttle of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "oipage",
3
- "version": "1.7.0-alpha.6",
4
- "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
- "sideEffects": false,
6
- "typings": "./types/index.d.ts",
7
- "scripts": {
8
- "dev": "node ./bin/run run \"node ./build/index.js watch\" \"npm run serve\"",
9
- "build": "node ./build/index.js",
10
- "serve": "node ./bin/run serve --config ./oipage.config.js",
11
- "dev:issue10": "node ./bin/run serve --proxy /proxydemo http://127.0.0.1:8080/docs -p 20000",
12
- "bug:issue5": "node ./bin/run run \"node ./bin/run serve\"",
13
- "bug:issue4": "node ./bin/run run \"node ./test/logform/index.spec.js\""
14
- },
15
- "bin": {
16
- "oipage-cli": "bin/run"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/oi-contrib/OIPage.git"
21
- },
22
- "keywords": [
23
- "dev",
24
- "server",
25
- "style",
26
- "css",
27
- "nodejs",
28
- "core",
29
- "oipage",
30
- "browser"
31
- ],
32
- "author": {
33
- "name": "zxl20070701",
34
- "url": "https://zxl20070701.github.io/notebook/home.html"
35
- },
36
- "license": "MIT",
37
- "bugs": {
38
- "url": "https://github.com/oi-contrib/OIPage/issues"
39
- },
40
- "homepage": "https://oi-contrib.github.io/OIPage",
41
- "dependencies": {
42
- "vislite": "^1.5.0",
43
- "xhtml-to-json": "^0.1.0",
44
- "zipaper": "^0.2.0"
45
- }
1
+ {
2
+ "name": "oipage",
3
+ "version": "1.7.0-rc.0",
4
+ "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
+ "sideEffects": false,
6
+ "typings": "./types/index.d.ts",
7
+ "scripts": {
8
+ "dev": "node ./bin/run run \"node ./build/index.js watch\" \"npm run serve\"",
9
+ "build": "node ./build/index.js",
10
+ "serve": "node ./bin/run serve --config ./oipage.config.js",
11
+ "dev:issue10": "node ./bin/run serve --proxy /proxydemo http://127.0.0.1:8080/docs -p 20000",
12
+ "bug:issue5": "node ./bin/run run \"node ./bin/run serve\"",
13
+ "bug:issue4": "node ./bin/run run \"node ./test/logform/index.spec.js\""
14
+ },
15
+ "bin": {
16
+ "oipage-cli": "bin/run"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/oi-contrib/OIPage.git"
21
+ },
22
+ "keywords": [
23
+ "dev",
24
+ "server",
25
+ "style",
26
+ "css",
27
+ "nodejs",
28
+ "core",
29
+ "oipage",
30
+ "browser"
31
+ ],
32
+ "author": {
33
+ "name": "zxl20070701",
34
+ "url": "https://zxl20070701.github.io/notebook/home.html"
35
+ },
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/oi-contrib/OIPage/issues"
39
+ },
40
+ "homepage": "https://oi-contrib.github.io/OIPage",
41
+ "dependencies": {
42
+ "vislite": "^1.5.0",
43
+ "xhtml-to-json": "^0.1.0",
44
+ "zipaper": "^0.2.0"
45
+ }
46
46
  }
package/types/index.d.ts CHANGED
@@ -13,8 +13,6 @@ import "../nodejs/logform/index";
13
13
  declare module "oipage/nodejs/logform/index.js" {}
14
14
  import "../nodejs/reader/index";
15
15
  declare module "oipage/nodejs/reader/index.js" {}
16
- import "../nodejs/remote/index";
17
- declare module "oipage/nodejs/remote/index.js" {}
18
16
  import "../nodejs/throttle/index";
19
17
  declare module "oipage/nodejs/throttle/index.js" {}
20
18
  import "../web/animation/index";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * XMLHttpRequest of OIPage v1.7.0-alpha.6
2
+ * XMLHttpRequest of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.7.0-alpha.6
2
+ * animation of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.7.0-alpha.6
2
+ * format of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/web/json/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.7.0-alpha.6
2
+ * json of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  import {reader} from "../reader/index.js";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * onReady of OIPage v1.7.0-alpha.6
2
+ * onReady of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * performChunk of OIPage v1.7.0-alpha.6
2
+ * performChunk of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.7.0-alpha.6
2
+ * reader of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * style of OIPage v1.7.0-alpha.6
2
+ * style of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.7.0-alpha.6
2
+ * throttle of OIPage v1.7.0-rc.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,37 +0,0 @@
1
- interface resType {
2
-
3
- /**
4
- * 响应码
5
- */
6
- status: number
7
-
8
- /**
9
- * 响应体
10
- */
11
- data: string
12
-
13
- /**
14
- * 响应头
15
- */
16
- headers: {
17
- [key: string]: any
18
- }
19
- }
20
-
21
- export interface getType {
22
- (url: string, headers?: {
23
- [key: string]: any
24
- }): Promise<resType>
25
- }
26
-
27
- export let get: getType
28
-
29
- export interface postType {
30
- (url: string, headers?: {
31
- [key: string]: any
32
- }, params?: {
33
- [key: string]: any
34
- }): Promise<resType>
35
- }
36
-
37
- export let post: postType
@@ -1,61 +0,0 @@
1
- /*!
2
- * remote of OIPage v1.7.0-alpha.6
3
- * git+https://github.com/oi-contrib/OIPage.git
4
- */
5
-
6
- const https = require('https');
7
- const http = require('http');
8
-
9
- function remote(method, url, headers, param) {
10
- return new Promise((resolve, reject) => {
11
- let handler = /^https/.test(url) ? https : http;
12
-
13
- let execArray = /https*:\/\/([^\/]+)(.+)?/.exec(url);
14
- let hostport = execArray[1].split(":");
15
-
16
- // https://nodejs.org/download/release/v16.8.0/docs/api/http.html#http_http_request_options_callback
17
- const req = handler.request({
18
- hostname: hostport[0],
19
- port: hostport[1] || 80,
20
- path: execArray[2] || "/",
21
- method,
22
- headers
23
- }, (res) => {
24
- res.setEncoding("utf8");
25
-
26
- let data = "";
27
- res.on('data', (chunk) => {
28
- data += chunk;
29
- });
30
- res.on('end', () => {
31
-
32
- resolve({
33
- status: res.statusCode,
34
- data: data.toString('utf8'),
35
- headers: res.headers
36
- });
37
- });
38
-
39
- });
40
-
41
- if (param) req.write(param);
42
-
43
- req.on('error', (e) => {
44
- reject(e);
45
- });
46
- req.end();
47
- });
48
- }
49
-
50
- // GET请求
51
- function get(url, headers = {}) {
52
- return remote("GET", url, headers)
53
- };
54
-
55
- // POST请求
56
- function post(url, headers = {}, params = {}) {
57
- return remote("POST", url, headers, JSON.stringify(params));
58
- };
59
-
60
- exports.get = get;
61
- exports.post = post;