@modern-js/create-request 1.1.2-rc.0 → 1.1.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.
@@ -1,6 +1,29 @@
1
1
  import { compile, pathToRegexp } from 'path-to-regexp';
2
- const globalFetch = fetch;
3
- export const createRequest = (path, method, port, fetch = globalFetch) => {
2
+ import { handleRes } from "./handleRes";
3
+ let realRequest;
4
+ let realAllowedHeaders;
5
+
6
+ const originFetch = (...params) => fetch(...params) // eslint-disable-next-line promise/prefer-await-to-then
7
+ .then(handleRes);
8
+
9
+ export const configure = options => {
10
+ const {
11
+ request,
12
+ interceptor,
13
+ allowedHeaders
14
+ } = options;
15
+ realRequest = request || originFetch;
16
+
17
+ if (interceptor && !request) {
18
+ realRequest = interceptor(fetch);
19
+ }
20
+
21
+ if (Array.isArray(allowedHeaders)) {
22
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
+ realAllowedHeaders = allowedHeaders;
24
+ }
25
+ };
26
+ export const createRequest = (path, method, port, fetch = originFetch) => {
4
27
  const getFinalPath = compile(path, {
5
28
  encode: encodeURIComponent
6
29
  });
@@ -8,7 +31,7 @@ export const createRequest = (path, method, port, fetch = globalFetch) => {
8
31
  pathToRegexp(path, keys);
9
32
 
10
33
  const sender = async (...args) => {
11
- const fetcher = getFetcher(sender) || fetch;
34
+ const fetcher = realRequest || fetch;
12
35
  const payload = typeof args[args.length - 1] === 'object' ? args[args.length - 1] : {};
13
36
  payload.params = payload.params || {};
14
37
  keys.forEach((key, index) => {
@@ -46,22 +69,13 @@ export const createRequest = (path, method, port, fetch = globalFetch) => {
46
69
  return fetcher(finalURL, {
47
70
  method,
48
71
  body,
49
- headers // eslint-disable-next-line promise/prefer-await-to-then
50
-
51
- }).then(res => res.json());
72
+ headers
73
+ });
52
74
  };
53
75
 
54
76
  return sender;
55
77
  };
56
78
 
57
- const getFetcher = sender => {
58
- if (sender.fetch) {
59
- return sender.fetch;
60
- }
61
-
62
- return fetch;
63
- };
64
-
65
79
  const qsStringify = input => {
66
80
  const tupleList = [];
67
81
 
@@ -0,0 +1,23 @@
1
+ const handleRes = res => {
2
+ const contentType = res.headers.get('content-type');
3
+
4
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/json') || contentType !== null && contentType !== void 0 && contentType.includes('text/json')) {
5
+ return res.json();
6
+ }
7
+
8
+ if (contentType !== null && contentType !== void 0 && contentType.includes('text/html') || contentType !== null && contentType !== void 0 && contentType.includes('text/plain')) {
9
+ return res.text();
10
+ }
11
+
12
+ if ((contentType !== null && contentType !== void 0 && contentType.includes('application/x-www-form-urlencoded') || contentType !== null && contentType !== void 0 && contentType.includes('multipart/form-data')) && res instanceof Response) {
13
+ return res.formData();
14
+ }
15
+
16
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/octet-stream')) {
17
+ return res.arrayBuffer();
18
+ }
19
+
20
+ return res.text();
21
+ };
22
+
23
+ export { handleRes };
@@ -1,4 +1,6 @@
1
- // eslint-disable-next-line filenames/match-exported
1
+ // eslint-disable-next-line eslint-comments/disable-enable-pair
2
+
3
+ /* eslint-disable filenames/match-exported */
2
4
  import { isBrowser } from '@modern-js/utils';
3
5
  import { createRequest as browser } from "./browser";
4
6
  import { createRequest as node } from "./node";
@@ -2,8 +2,30 @@ 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 = [] // eslint-disable-next-line max-params
6
- ) => {
5
+ import { handleRes } from "./handleRes";
6
+ let realRequest;
7
+ let realAllowedHeaders = [];
8
+
9
+ const originFetch = (...params) => nodeFetch(...params) // eslint-disable-next-line promise/prefer-await-to-then
10
+ .then(handleRes);
11
+
12
+ export const configure = options => {
13
+ const {
14
+ request,
15
+ interceptor,
16
+ allowedHeaders
17
+ } = options;
18
+ realRequest = request || originFetch;
19
+
20
+ if (interceptor && !request) {
21
+ realRequest = interceptor(nodeFetch);
22
+ }
23
+
24
+ if (Array.isArray(allowedHeaders)) {
25
+ realAllowedHeaders = allowedHeaders;
26
+ }
27
+ };
28
+ export const createRequest = (path, method, port, fetch = nodeFetch) => {
7
29
  const getFinalPath = compile(path, {
8
30
  encode: encodeURIComponent
9
31
  });
@@ -23,7 +45,7 @@ export const createRequest = (path, method, port, fetch = nodeFetch, headerWhite
23
45
  const headers = payload.headers || {};
24
46
  let body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
25
47
 
26
- for (const key of headerWhiteList) {
48
+ for (const key of realAllowedHeaders) {
27
49
  headers[key] = webRequestHeaders[key];
28
50
  }
29
51
 
@@ -48,13 +70,13 @@ export const createRequest = (path, method, port, fetch = nodeFetch, headerWhite
48
70
  }
49
71
  }
50
72
 
51
- const url = `http://localhost:${port}${finalPath}`; // eslint-disable-next-line promise/prefer-await-to-then
52
-
53
- return fetch(url, {
73
+ const url = `http://localhost:${port}${finalPath}`;
74
+ const fetcher = realRequest || fetch;
75
+ return fetcher(url, {
54
76
  method,
55
77
  body,
56
78
  headers
57
- }).then(res => res.json());
79
+ });
58
80
  };
59
81
 
60
82
  return sender;
File without changes
@@ -3,13 +3,39 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createRequest = void 0;
6
+ exports.createRequest = exports.configure = void 0;
7
7
 
8
8
  var _pathToRegexp = require("path-to-regexp");
9
9
 
10
- const globalFetch = fetch;
10
+ var _handleRes = require("./handleRes");
11
11
 
12
- const createRequest = (path, method, port, fetch = globalFetch) => {
12
+ let realRequest;
13
+ let realAllowedHeaders;
14
+
15
+ const originFetch = (...params) => fetch(...params) // eslint-disable-next-line promise/prefer-await-to-then
16
+ .then(_handleRes.handleRes);
17
+
18
+ const configure = options => {
19
+ const {
20
+ request,
21
+ interceptor,
22
+ allowedHeaders
23
+ } = options;
24
+ realRequest = request || originFetch;
25
+
26
+ if (interceptor && !request) {
27
+ realRequest = interceptor(fetch);
28
+ }
29
+
30
+ if (Array.isArray(allowedHeaders)) {
31
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
+ realAllowedHeaders = allowedHeaders;
33
+ }
34
+ };
35
+
36
+ exports.configure = configure;
37
+
38
+ const createRequest = (path, method, port, fetch = originFetch) => {
13
39
  const getFinalPath = (0, _pathToRegexp.compile)(path, {
14
40
  encode: encodeURIComponent
15
41
  });
@@ -17,7 +43,7 @@ const createRequest = (path, method, port, fetch = globalFetch) => {
17
43
  (0, _pathToRegexp.pathToRegexp)(path, keys);
18
44
 
19
45
  const sender = async (...args) => {
20
- const fetcher = getFetcher(sender) || fetch;
46
+ const fetcher = realRequest || fetch;
21
47
  const payload = typeof args[args.length - 1] === 'object' ? args[args.length - 1] : {};
22
48
  payload.params = payload.params || {};
23
49
  keys.forEach((key, index) => {
@@ -55,9 +81,8 @@ const createRequest = (path, method, port, fetch = globalFetch) => {
55
81
  return fetcher(finalURL, {
56
82
  method,
57
83
  body,
58
- headers // eslint-disable-next-line promise/prefer-await-to-then
59
-
60
- }).then(res => res.json());
84
+ headers
85
+ });
61
86
  };
62
87
 
63
88
  return sender;
@@ -65,14 +90,6 @@ const createRequest = (path, method, port, fetch = globalFetch) => {
65
90
 
66
91
  exports.createRequest = createRequest;
67
92
 
68
- const getFetcher = sender => {
69
- if (sender.fetch) {
70
- return sender.fetch;
71
- }
72
-
73
- return fetch;
74
- };
75
-
76
93
  const qsStringify = input => {
77
94
  const tupleList = [];
78
95
 
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleRes = void 0;
7
+
8
+ const handleRes = res => {
9
+ const contentType = res.headers.get('content-type');
10
+
11
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/json') || contentType !== null && contentType !== void 0 && contentType.includes('text/json')) {
12
+ return res.json();
13
+ }
14
+
15
+ if (contentType !== null && contentType !== void 0 && contentType.includes('text/html') || contentType !== null && contentType !== void 0 && contentType.includes('text/plain')) {
16
+ return res.text();
17
+ }
18
+
19
+ if ((contentType !== null && contentType !== void 0 && contentType.includes('application/x-www-form-urlencoded') || contentType !== null && contentType !== void 0 && contentType.includes('multipart/form-data')) && res instanceof Response) {
20
+ return res.formData();
21
+ }
22
+
23
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/octet-stream')) {
24
+ return res.arrayBuffer();
25
+ }
26
+
27
+ return res.text();
28
+ };
29
+
30
+ exports.handleRes = handleRes;
@@ -11,7 +11,9 @@ var _browser = require("./browser");
11
11
 
12
12
  var _node = require("./node");
13
13
 
14
- // eslint-disable-next-line filenames/match-exported
14
+ // eslint-disable-next-line eslint-comments/disable-enable-pair
15
+
16
+ /* eslint-disable filenames/match-exported */
15
17
  const createRequest = (...args) => (0, _utils.isBrowser)() ? (0, _browser.createRequest)(...args) : (0, _node.createRequest)(...args);
16
18
 
17
19
  var _default = createRequest;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createRequest = void 0;
6
+ exports.createRequest = exports.configure = void 0;
7
7
 
8
8
  var _querystring = _interopRequireDefault(require("querystring"));
9
9
 
@@ -13,10 +13,36 @@ var _pathToRegexp = require("path-to-regexp");
13
13
 
14
14
  var _node = require("@modern-js/plugin-ssr/node");
15
15
 
16
+ var _handleRes = require("./handleRes");
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
- const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhiteList = [] // eslint-disable-next-line max-params
19
- ) => {
20
+ let realRequest;
21
+ let realAllowedHeaders = [];
22
+
23
+ const originFetch = (...params) => (0, _nodeFetch.default)(...params) // eslint-disable-next-line promise/prefer-await-to-then
24
+ .then(_handleRes.handleRes);
25
+
26
+ const configure = options => {
27
+ const {
28
+ request,
29
+ interceptor,
30
+ allowedHeaders
31
+ } = options;
32
+ realRequest = request || originFetch;
33
+
34
+ if (interceptor && !request) {
35
+ realRequest = interceptor(_nodeFetch.default);
36
+ }
37
+
38
+ if (Array.isArray(allowedHeaders)) {
39
+ realAllowedHeaders = allowedHeaders;
40
+ }
41
+ };
42
+
43
+ exports.configure = configure;
44
+
45
+ const createRequest = (path, method, port, fetch = _nodeFetch.default) => {
20
46
  const getFinalPath = (0, _pathToRegexp.compile)(path, {
21
47
  encode: encodeURIComponent
22
48
  });
@@ -36,7 +62,7 @@ const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhi
36
62
  const headers = payload.headers || {};
37
63
  let body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
38
64
 
39
- for (const key of headerWhiteList) {
65
+ for (const key of realAllowedHeaders) {
40
66
  headers[key] = webRequestHeaders[key];
41
67
  }
42
68
 
@@ -61,13 +87,13 @@ const createRequest = (path, method, port, fetch = _nodeFetch.default, headerWhi
61
87
  }
62
88
  }
63
89
 
64
- const url = `http://localhost:${port}${finalPath}`; // eslint-disable-next-line promise/prefer-await-to-then
65
-
66
- return fetch(url, {
90
+ const url = `http://localhost:${port}${finalPath}`;
91
+ const fetcher = realRequest || fetch;
92
+ return fetcher(url, {
67
93
  method,
68
94
  body,
69
95
  headers
70
- }).then(res => res.json());
96
+ });
71
97
  };
72
98
 
73
99
  return sender;
File without changes
@@ -7,9 +7,32 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
8
 
9
9
  import { compile, pathToRegexp } from 'path-to-regexp';
10
- var globalFetch = fetch;
10
+ import { handleRes } from "./handleRes";
11
+ var realRequest;
12
+ var realAllowedHeaders;
13
+
14
+ var originFetch = function originFetch() {
15
+ return fetch.apply(void 0, arguments) // eslint-disable-next-line promise/prefer-await-to-then
16
+ .then(handleRes);
17
+ };
18
+
19
+ export var configure = function configure(options) {
20
+ var request = options.request,
21
+ interceptor = options.interceptor,
22
+ allowedHeaders = options.allowedHeaders;
23
+ realRequest = request || originFetch;
24
+
25
+ if (interceptor && !request) {
26
+ realRequest = interceptor(fetch);
27
+ }
28
+
29
+ if (Array.isArray(allowedHeaders)) {
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ realAllowedHeaders = allowedHeaders;
32
+ }
33
+ };
11
34
  export var createRequest = function createRequest(path, method, port) {
12
- var fetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : globalFetch;
35
+ var fetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : originFetch;
13
36
  var getFinalPath = compile(path, {
14
37
  encode: encodeURIComponent
15
38
  });
@@ -37,7 +60,7 @@ export var createRequest = function createRequest(path, method, port) {
37
60
  args[_key] = _args[_key];
38
61
  }
39
62
 
40
- fetcher = getFetcher(sender) || fetch;
63
+ fetcher = realRequest || fetch;
41
64
  payload = _typeof(args[args.length - 1]) === 'object' ? args[args.length - 1] : {};
42
65
  payload.params = payload.params || {};
43
66
  keys.forEach(function (key, index) {
@@ -75,10 +98,7 @@ export var createRequest = function createRequest(path, method, port) {
75
98
  return _context.abrupt("return", fetcher(finalURL, {
76
99
  method: method,
77
100
  body: body,
78
- headers: headers // eslint-disable-next-line promise/prefer-await-to-then
79
-
80
- }).then(function (res) {
81
- return res.json();
101
+ headers: headers
82
102
  }));
83
103
 
84
104
  case 11:
@@ -97,14 +117,6 @@ export var createRequest = function createRequest(path, method, port) {
97
117
  return sender;
98
118
  };
99
119
 
100
- var getFetcher = function getFetcher(sender) {
101
- if (sender.fetch) {
102
- return sender.fetch;
103
- }
104
-
105
- return fetch;
106
- };
107
-
108
120
  var qsStringify = function qsStringify(input) {
109
121
  var tupleList = [];
110
122
 
@@ -0,0 +1,23 @@
1
+ var handleRes = function handleRes(res) {
2
+ var contentType = res.headers.get('content-type');
3
+
4
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/json') || contentType !== null && contentType !== void 0 && contentType.includes('text/json')) {
5
+ return res.json();
6
+ }
7
+
8
+ if (contentType !== null && contentType !== void 0 && contentType.includes('text/html') || contentType !== null && contentType !== void 0 && contentType.includes('text/plain')) {
9
+ return res.text();
10
+ }
11
+
12
+ if ((contentType !== null && contentType !== void 0 && contentType.includes('application/x-www-form-urlencoded') || contentType !== null && contentType !== void 0 && contentType.includes('multipart/form-data')) && res instanceof Response) {
13
+ return res.formData();
14
+ }
15
+
16
+ if (contentType !== null && contentType !== void 0 && contentType.includes('application/octet-stream')) {
17
+ return res.arrayBuffer();
18
+ }
19
+
20
+ return res.text();
21
+ };
22
+
23
+ export { handleRes };
@@ -1,4 +1,6 @@
1
- // eslint-disable-next-line filenames/match-exported
1
+ // eslint-disable-next-line eslint-comments/disable-enable-pair
2
+
3
+ /* eslint-disable filenames/match-exported */
2
4
  import { isBrowser } from '@modern-js/utils';
3
5
  import { createRequest as browser } from "./browser";
4
6
  import { createRequest as node } from "./node";
@@ -10,9 +10,31 @@ import qs from 'querystring';
10
10
  import nodeFetch from 'node-fetch';
11
11
  import { compile, pathToRegexp } from 'path-to-regexp';
12
12
  import { useHeaders } from '@modern-js/plugin-ssr/node';
13
+ import { handleRes } from "./handleRes";
14
+ var realRequest;
15
+ var realAllowedHeaders = [];
16
+
17
+ var originFetch = function originFetch() {
18
+ return nodeFetch.apply(void 0, arguments) // eslint-disable-next-line promise/prefer-await-to-then
19
+ .then(handleRes);
20
+ };
21
+
22
+ export var configure = function configure(options) {
23
+ var request = options.request,
24
+ interceptor = options.interceptor,
25
+ allowedHeaders = options.allowedHeaders;
26
+ realRequest = request || originFetch;
27
+
28
+ if (interceptor && !request) {
29
+ realRequest = interceptor(nodeFetch);
30
+ }
31
+
32
+ if (Array.isArray(allowedHeaders)) {
33
+ realAllowedHeaders = allowedHeaders;
34
+ }
35
+ };
13
36
  export var createRequest = function createRequest(path, method, port) {
14
37
  var fetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : nodeFetch;
15
- var headerWhiteList = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
16
38
  var getFinalPath = compile(path, {
17
39
  encode: encodeURIComponent
18
40
  });
@@ -36,7 +58,7 @@ export var createRequest = function createRequest(path, method, port) {
36
58
  var headers = payload.headers || {};
37
59
  var body; // BFF 内网请求需要携带 SSR 请求中的 cookie 和 traceId, 如果有压测头,则添加压测头
38
60
 
39
- var _iterator = _createForOfIteratorHelper(headerWhiteList),
61
+ var _iterator = _createForOfIteratorHelper(realAllowedHeaders),
40
62
  _step;
41
63
 
42
64
  try {
@@ -71,14 +93,12 @@ export var createRequest = function createRequest(path, method, port) {
71
93
  }
72
94
  }
73
95
 
74
- var url = "http://localhost:".concat(port).concat(finalPath); // eslint-disable-next-line promise/prefer-await-to-then
75
-
76
- return fetch(url, {
96
+ var url = "http://localhost:".concat(port).concat(finalPath);
97
+ var fetcher = realRequest || fetch;
98
+ return fetcher(url, {
77
99
  method: method,
78
100
  body: body,
79
101
  headers: headers
80
- }).then(function (res) {
81
- return res.json();
82
102
  });
83
103
  };
84
104
 
File without changes
@@ -1,2 +1,3 @@
1
- import type { RequestCreator } from '.';
1
+ import type { RequestCreator, IOptions } from './types';
2
+ export declare const configure: (options: IOptions) => void;
2
3
  export declare const createRequest: RequestCreator;
@@ -0,0 +1,3 @@
1
+ import { Response as NodeResponse } from 'node-fetch';
2
+ declare const handleRes: (res: Response | NodeResponse) => Promise<any>;
3
+ export { handleRes };
@@ -1,17 +1,4 @@
1
- export declare type BFFRequestPayload = {
2
- params?: Record<string, any>;
3
- query?: Record<string, any>;
4
- body?: string;
5
- formUrlencoded?: never;
6
- formData?: FormData;
7
- data?: Record<string, any>;
8
- headers?: Record<string, any>;
9
- cookies?: Record<string, any>;
10
- };
11
- export declare type Fetcher = typeof fetch;
12
- export declare type Sender = ((...args: any[]) => Promise<any>) & {
13
- fetch?: Fetcher;
14
- };
15
- export declare type RequestCreator = (path: string, method: string, port: number, fetch?: Fetcher, headerWhiteList?: string[]) => Sender;
1
+ import { RequestCreator, IOptions } from './types';
16
2
  declare const createRequest: RequestCreator;
3
+ export declare const configure: (options: IOptions) => void;
17
4
  export default createRequest;
@@ -1,2 +1,4 @@
1
- import type { RequestCreator } from '.';
1
+ import nodeFetch from 'node-fetch';
2
+ import type { RequestCreator, IOptions } from './types';
3
+ export declare const configure: (options: IOptions<typeof nodeFetch>) => void;
2
4
  export declare const createRequest: RequestCreator;
@@ -0,0 +1,21 @@
1
+ import type nodeFetch from 'node-fetch';
2
+ export declare type BFFRequestPayload = {
3
+ params?: Record<string, any>;
4
+ query?: Record<string, any>;
5
+ body?: string;
6
+ formUrlencoded?: never;
7
+ formData?: FormData;
8
+ data?: Record<string, any>;
9
+ headers?: Record<string, any>;
10
+ cookies?: Record<string, any>;
11
+ };
12
+ export declare type Fetch = typeof nodeFetch | typeof fetch;
13
+ export declare type Sender = ((...args: any[]) => Promise<any>) & {
14
+ fetch?: Fetch;
15
+ };
16
+ export declare type RequestCreator = (path: string, method: string, port: number, fetch?: Fetch, headerWhiteList?: string[]) => Sender;
17
+ export declare type IOptions<F = typeof fetch> = {
18
+ request?: F;
19
+ interceptor?: (request: F) => F;
20
+ allowedHeaders?: string[];
21
+ };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.2-rc.0",
14
+ "version": "1.1.2",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -37,23 +37,25 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@babel/runtime": "^7",
40
- "@modern-js/utils": "^1.1.4-rc.0",
40
+ "@modern-js/utils": "^1.1.6",
41
41
  "node-fetch": "^2.6.1",
42
42
  "path-to-regexp": "^6.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/jest": "^26",
45
+ "@modern-js/module-tools": "^1.1.4",
46
+ "@modern-js/plugin-ssr": "^1.1.3",
47
+ "@modern-js/plugin-testing": "^1.2.2",
48
+ "@types/jest": "^27.0.3",
46
49
  "@types/node": "^14",
47
50
  "@types/node-fetch": "^2.5.12",
48
51
  "@types/react": "^17",
49
52
  "@types/react-dom": "^17",
50
- "typescript": "^4",
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"
53
+ "isomorphic-fetch": "^3.0.0",
54
+ "nock": "^13.2.1",
55
+ "typescript": "^4"
54
56
  },
55
57
  "peerDependencies": {
56
- "@modern-js/plugin-ssr": "^1.1.2-rc.0"
58
+ "@modern-js/plugin-ssr": "^1.1.3"
57
59
  },
58
60
  "sideEffects": false,
59
61
  "publishConfig": {
package/hook.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/types/hook';