@modern-js/create-request 1.1.3-beta.2 → 1.2.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.
@@ -23,7 +23,9 @@ export const configure = options => {
23
23
  realAllowedHeaders = allowedHeaders;
24
24
  }
25
25
  };
26
- export const createRequest = (path, method, port, fetch = originFetch) => {
26
+ export const createRequest = (path, method, port, // 后续可能要修改,暂时先保留
27
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
+ fetch = originFetch) => {
27
29
  const getFinalPath = compile(path, {
28
30
  encode: encodeURIComponent
29
31
  });
@@ -25,7 +25,9 @@ export const configure = options => {
25
25
  realAllowedHeaders = allowedHeaders;
26
26
  }
27
27
  };
28
- export const createRequest = (path, method, port, fetch = nodeFetch) => {
28
+ export const createRequest = (path, method, port, // 后续可能要修改,暂时先保留
29
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
+ fetch = nodeFetch) => {
29
31
  const getFinalPath = compile(path, {
30
32
  encode: encodeURIComponent
31
33
  });
@@ -43,7 +45,7 @@ export const createRequest = (path, method, port, fetch = nodeFetch) => {
43
45
  const plainPath = getFinalPath(payload.params);
44
46
  const finalPath = payload.query ? `${plainPath}?${qs.stringify(payload.query)}` : plainPath;
45
47
  const headers = payload.headers || {};
46
- let body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
48
+ let body;
47
49
 
48
50
  for (const key of realAllowedHeaders) {
49
51
  if (typeof webRequestHeaders[key] !== 'undefined') {
@@ -35,7 +35,9 @@ const configure = options => {
35
35
 
36
36
  exports.configure = configure;
37
37
 
38
- const createRequest = (path, method, port, fetch = originFetch) => {
38
+ const createRequest = (path, method, port, // 后续可能要修改,暂时先保留
39
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
40
+ fetch = originFetch) => {
39
41
  const getFinalPath = (0, _pathToRegexp.compile)(path, {
40
42
  encode: encodeURIComponent
41
43
  });
@@ -42,7 +42,9 @@ const configure = options => {
42
42
 
43
43
  exports.configure = configure;
44
44
 
45
- const createRequest = (path, method, port, fetch = _nodeFetch.default) => {
45
+ const createRequest = (path, method, port, // 后续可能要修改,暂时先保留
46
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
+ fetch = _nodeFetch.default) => {
46
48
  const getFinalPath = (0, _pathToRegexp.compile)(path, {
47
49
  encode: encodeURIComponent
48
50
  });
@@ -60,7 +62,7 @@ const createRequest = (path, method, port, fetch = _nodeFetch.default) => {
60
62
  const plainPath = getFinalPath(payload.params);
61
63
  const finalPath = payload.query ? `${plainPath}?${_querystring.default.stringify(payload.query)}` : plainPath;
62
64
  const headers = payload.headers || {};
63
- let body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
65
+ let body;
64
66
 
65
67
  for (const key of realAllowedHeaders) {
66
68
  if (typeof webRequestHeaders[key] !== 'undefined') {
@@ -56,7 +56,7 @@ export var createRequest = function createRequest(path, method, port) {
56
56
  var plainPath = getFinalPath(payload.params);
57
57
  var finalPath = payload.query ? "".concat(plainPath, "?").concat(qs.stringify(payload.query)) : plainPath;
58
58
  var headers = payload.headers || {};
59
- var body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
59
+ var body;
60
60
 
61
61
  var _iterator = _createForOfIteratorHelper(realAllowedHeaders),
62
62
  _step;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.3-beta.2",
14
+ "version": "1.2.2",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -63,14 +63,13 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@babel/runtime": "^7",
66
- "@modern-js/utils": "^1.1.6",
66
+ "@modern-js/utils": "^1.3.4",
67
67
  "node-fetch": "^2.6.1",
68
- "path-to-regexp": "^6.2.0"
68
+ "path-to-regexp": "^6.2.0",
69
+ "@modern-js/plugin-ssr": "^1.2.0"
69
70
  },
70
71
  "devDependencies": {
71
- "@modern-js/module-tools": "^1.1.5",
72
- "@modern-js/plugin-ssr": "^1.1.3",
73
- "@modern-js/plugin-testing": "^1.1.1",
72
+ "@scripts/build": "0.0.0",
74
73
  "@types/jest": "^27.0.3",
75
74
  "@types/node": "^14",
76
75
  "@types/node-fetch": "^2.5.12",
@@ -78,10 +77,9 @@
78
77
  "@types/react-dom": "^17",
79
78
  "isomorphic-fetch": "^3.0.0",
80
79
  "nock": "^13.2.1",
81
- "typescript": "^4"
82
- },
83
- "peerDependencies": {
84
- "@modern-js/plugin-ssr": "^1.1.3"
80
+ "typescript": "^4",
81
+ "jest": "^27",
82
+ "@scripts/jest-config": "0.0.0"
85
83
  },
86
84
  "sideEffects": false,
87
85
  "publishConfig": {
@@ -91,7 +89,7 @@
91
89
  "scripts": {
92
90
  "new": "modern new",
93
91
  "build": "modern build",
94
- "test": "modern test --passWithNoTests"
92
+ "test": "jest --passWithNoTests"
95
93
  },
96
94
  "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"
97
95
  }