@modern-js/create-request 1.0.0 → 1.1.2-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/README.md
CHANGED
|
@@ -17,10 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
|
22
|
-
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
|
23
|
-
- [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
|
|
20
|
+
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
|
24
21
|
|
|
25
22
|
## Getting Started
|
|
26
23
|
|
package/dist/js/modern/node.js
CHANGED
|
@@ -2,7 +2,8 @@ import qs from 'querystring';
|
|
|
2
2
|
import nodeFetch from 'node-fetch';
|
|
3
3
|
import { compile, pathToRegexp } from 'path-to-regexp';
|
|
4
4
|
import { useHeaders } from '@modern-js/plugin-ssr/node';
|
|
5
|
-
export const createRequest = (path, method, port, fetch = nodeFetch, headerWhiteList = []
|
|
5
|
+
export const createRequest = (path, method, port, fetch = nodeFetch, headerWhiteList = [] // eslint-disable-next-line max-params
|
|
6
|
+
) => {
|
|
6
7
|
const getFinalPath = compile(path, {
|
|
7
8
|
encode: encodeURIComponent
|
|
8
9
|
});
|
|
@@ -35,7 +36,7 @@ export const createRequest = (path, method, port, fetch = nodeFetch, headerWhite
|
|
|
35
36
|
body = payload.body;
|
|
36
37
|
} else if (payload.formData) {
|
|
37
38
|
body = payload.formData; // https://stackoverflow.com/questions/44919424/bad-content-type-header-no-multipart-boundary-nodejs
|
|
38
|
-
// need multipart boundary
|
|
39
|
+
// need multipart boundary auto attached by node-fetch when multipart is true
|
|
39
40
|
// headers['Content-Type'] = 'multipart/form-data';
|
|
40
41
|
} else if (payload.formUrlencoded) {
|
|
41
42
|
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
package/dist/js/node/node.js
CHANGED
|
@@ -15,7 +15,8 @@ var _node = require("@modern-js/plugin-ssr/node");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhiteList = []
|
|
18
|
+
const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhiteList = [] // eslint-disable-next-line max-params
|
|
19
|
+
) => {
|
|
19
20
|
const getFinalPath = (0, _pathToRegexp.compile)(path, {
|
|
20
21
|
encode: encodeURIComponent
|
|
21
22
|
});
|
|
@@ -48,7 +49,7 @@ const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhi
|
|
|
48
49
|
body = payload.body;
|
|
49
50
|
} else if (payload.formData) {
|
|
50
51
|
body = payload.formData; // https://stackoverflow.com/questions/44919424/bad-content-type-header-no-multipart-boundary-nodejs
|
|
51
|
-
// need multipart boundary
|
|
52
|
+
// need multipart boundary auto attached by node-fetch when multipart is true
|
|
52
53
|
// headers['Content-Type'] = 'multipart/form-data';
|
|
53
54
|
} else if (payload.formUrlencoded) {
|
|
54
55
|
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
6
|
|
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6
6
|
|
|
7
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
8
|
|
|
9
9
|
import qs from 'querystring';
|
|
10
10
|
import nodeFetch from 'node-fetch';
|
|
@@ -59,7 +59,7 @@ export var createRequest = function createRequest(path, method, port) {
|
|
|
59
59
|
body = payload.body;
|
|
60
60
|
} else if (payload.formData) {
|
|
61
61
|
body = payload.formData; // https://stackoverflow.com/questions/44919424/bad-content-type-header-no-multipart-boundary-nodejs
|
|
62
|
-
// need multipart boundary
|
|
62
|
+
// need multipart boundary auto attached by node-fetch when multipart is true
|
|
63
63
|
// headers['Content-Type'] = 'multipart/form-data';
|
|
64
64
|
} else if (payload.formUrlencoded) {
|
|
65
65
|
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.1.2-rc.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@babel/runtime": "^7",
|
|
40
|
-
"@modern-js/
|
|
41
|
-
"@modern-js/utils": "^1.0.0",
|
|
40
|
+
"@modern-js/utils": "^1.1.4-rc.0",
|
|
42
41
|
"node-fetch": "^2.6.1",
|
|
43
42
|
"path-to-regexp": "^6.2.0"
|
|
44
43
|
},
|
|
@@ -49,12 +48,12 @@
|
|
|
49
48
|
"@types/react": "^17",
|
|
50
49
|
"@types/react-dom": "^17",
|
|
51
50
|
"typescript": "^4",
|
|
52
|
-
"@modern-js/plugin-testing": "^1.
|
|
53
|
-
"@modern-js/module-tools": "^1.
|
|
54
|
-
"@modern-js/plugin-ssr": "^1.
|
|
51
|
+
"@modern-js/plugin-testing": "^1.1.1",
|
|
52
|
+
"@modern-js/module-tools": "^1.1.1",
|
|
53
|
+
"@modern-js/plugin-ssr": "^1.1.2-rc.0"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
|
-
"@modern-js/plugin-ssr": "^1.
|
|
56
|
+
"@modern-js/plugin-ssr": "^1.1.2-rc.0"
|
|
58
57
|
},
|
|
59
58
|
"sideEffects": false,
|
|
60
59
|
"publishConfig": {
|
|
@@ -65,5 +64,6 @@
|
|
|
65
64
|
"new": "modern new",
|
|
66
65
|
"build": "modern build",
|
|
67
66
|
"test": "modern test --passWithNoTests"
|
|
68
|
-
}
|
|
67
|
+
},
|
|
68
|
+
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
69
69
|
}
|