@modern-js/create-request 1.0.0-rc.9 → 1.1.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.
- package/README.md +19 -21
- package/dist/js/modern/node.js +3 -2
- package/dist/js/node/node.js +3 -2
- package/dist/js/treeshaking/node.js +1 -1
- package/package.json +20 -6
package/README.md
CHANGED
|
@@ -2,31 +2,29 @@
|
|
|
2
2
|
<p align="center">
|
|
3
3
|
<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>
|
|
4
4
|
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
现代 Web 工程体系
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://modernjs.dev" target="blank">
|
|
9
|
+
modernjs.dev
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
<p align="center">
|
|
13
|
+
The meta-framework suite designed from scratch for frontend-focused modern web development
|
|
14
|
+
</p>
|
|
5
15
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## 背景
|
|
9
|
-
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
|
10
|
-
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
|
11
|
-
|
|
12
|
-
## 计划
|
|
13
|
-
|
|
14
|
-
Modern.js 的 1.0.0.rc 版已经发到 npm,目前在做测试改进,README 文档之后统一提供(现阶段加入测试和开发,可以发 [issue](https://github.com/modern-js-dev/modern.js/issues) 留微信联系),完整的文档站计划在10月14日上线
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
# Introduction
|
|
27
17
|
|
|
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.
|
|
28
19
|
|
|
20
|
+
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
|
29
21
|
|
|
22
|
+
## Getting Started
|
|
30
23
|
|
|
24
|
+
- [Quick Start](https://modernjs.dev/docs/start)
|
|
25
|
+
- [Guides](https://modernjs.dev/docs/guides)
|
|
26
|
+
- [API References](https://modernjs.dev/docs/apis)
|
|
31
27
|
|
|
28
|
+
## Contributing
|
|
32
29
|
|
|
30
|
+
- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)
|
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';
|
|
@@ -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
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/create-request",
|
|
3
|
-
"
|
|
3
|
+
"description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
|
|
4
|
+
"homepage": "https://modernjs.dev",
|
|
5
|
+
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
6
|
+
"repository": "modern-js-dev/modern.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"react",
|
|
10
|
+
"framework",
|
|
11
|
+
"modern",
|
|
12
|
+
"modern.js"
|
|
13
|
+
],
|
|
14
|
+
"version": "1.1.1",
|
|
4
15
|
"jsnext:source": "./src/index.ts",
|
|
5
16
|
"types": "./dist/types/index.d.ts",
|
|
6
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -20,14 +31,13 @@
|
|
|
20
31
|
"default": "./dist/js/treeshaking/browser.js"
|
|
21
32
|
},
|
|
22
33
|
"./client": "./dist/js/treeshaking/browser.js",
|
|
34
|
+
"./modern": "./dist/js/modern/browser.js",
|
|
23
35
|
"./server": "./dist/js/node/node.js",
|
|
24
36
|
"./hook": "./dist/js/node/hook.js"
|
|
25
37
|
},
|
|
26
38
|
"dependencies": {
|
|
27
39
|
"@babel/runtime": "^7",
|
|
28
|
-
"@modern-js/
|
|
29
|
-
"@modern-js/utils": "^1.0.0-rc.9",
|
|
30
|
-
"@modern-js/plugin-ssr": "^1.0.0-rc.9",
|
|
40
|
+
"@modern-js/utils": "^1.1.2",
|
|
31
41
|
"node-fetch": "^2.6.1",
|
|
32
42
|
"path-to-regexp": "^6.2.0"
|
|
33
43
|
},
|
|
@@ -38,8 +48,12 @@
|
|
|
38
48
|
"@types/react": "^17",
|
|
39
49
|
"@types/react-dom": "^17",
|
|
40
50
|
"typescript": "^4",
|
|
41
|
-
"@modern-js/plugin-testing": "^1.
|
|
42
|
-
"@modern-js/module-tools": "^1.
|
|
51
|
+
"@modern-js/plugin-testing": "^1.1.0",
|
|
52
|
+
"@modern-js/module-tools": "^1.1.0",
|
|
53
|
+
"@modern-js/plugin-ssr": "^1.1.1"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@modern-js/plugin-ssr": "^1.1.1"
|
|
43
57
|
},
|
|
44
58
|
"sideEffects": false,
|
|
45
59
|
"publishConfig": {
|