msw 0.0.0-fetch.rc-23 → 0.0.0-fetch.rc-24
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/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.js +19 -4
- package/lib/native/index.mjs +19 -4
- package/lib/node/index.js +19 -4
- package/lib/node/index.mjs +19 -4
- package/package.json +1 -1
package/lib/mockServiceWorker.js
CHANGED
package/lib/native/index.js
CHANGED
|
@@ -53,6 +53,13 @@ var import_SetupApi = require("../core/SetupApi.js");
|
|
|
53
53
|
var import_mergeRight = require("../core/utils/internal/mergeRight.js");
|
|
54
54
|
var import_handleRequest = require("../core/utils/handleRequest.js");
|
|
55
55
|
var import_devUtils = require("../core/utils/internal/devUtils.js");
|
|
56
|
+
|
|
57
|
+
// src/node/utils/isNodeException.ts
|
|
58
|
+
function isNodeException(error) {
|
|
59
|
+
return error instanceof Error && "code" in error;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/node/SetupServerApi.ts
|
|
56
63
|
var DEFAULT_LISTEN_OPTIONS = {
|
|
57
64
|
onUnhandledRequest: "warn"
|
|
58
65
|
};
|
|
@@ -71,10 +78,18 @@ var SetupServerApi = class extends import_SetupApi.SetupApi {
|
|
|
71
78
|
*/
|
|
72
79
|
init() {
|
|
73
80
|
this.interceptor.on("request", (_0) => __async(this, [_0], function* ({ request, requestId }) {
|
|
74
|
-
(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
if (typeof import_node_events.setMaxListeners === "function") {
|
|
82
|
+
try {
|
|
83
|
+
(0, import_node_events.setMaxListeners)(
|
|
84
|
+
Math.max(import_node_events.defaultMaxListeners, this.currentHandlers.length),
|
|
85
|
+
request.signal
|
|
86
|
+
);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (!(isNodeException(error) && error.code === "ERR_INVALID_ARG_TYPE")) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
78
93
|
const response = yield (0, import_handleRequest.handleRequest)(
|
|
79
94
|
request,
|
|
80
95
|
requestId,
|
package/lib/native/index.mjs
CHANGED
|
@@ -33,6 +33,13 @@ import { SetupApi } from '../core/SetupApi.mjs';
|
|
|
33
33
|
import { mergeRight } from '../core/utils/internal/mergeRight.mjs';
|
|
34
34
|
import { handleRequest } from '../core/utils/handleRequest.mjs';
|
|
35
35
|
import { devUtils } from '../core/utils/internal/devUtils.mjs';
|
|
36
|
+
|
|
37
|
+
// src/node/utils/isNodeException.ts
|
|
38
|
+
function isNodeException(error) {
|
|
39
|
+
return error instanceof Error && "code" in error;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/node/SetupServerApi.ts
|
|
36
43
|
var DEFAULT_LISTEN_OPTIONS = {
|
|
37
44
|
onUnhandledRequest: "warn"
|
|
38
45
|
};
|
|
@@ -51,10 +58,18 @@ var SetupServerApi = class extends SetupApi {
|
|
|
51
58
|
*/
|
|
52
59
|
init() {
|
|
53
60
|
this.interceptor.on("request", (_0) => __async(this, [_0], function* ({ request, requestId }) {
|
|
54
|
-
setMaxListeners
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
if (typeof setMaxListeners === "function") {
|
|
62
|
+
try {
|
|
63
|
+
setMaxListeners(
|
|
64
|
+
Math.max(defaultMaxListeners, this.currentHandlers.length),
|
|
65
|
+
request.signal
|
|
66
|
+
);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (!(isNodeException(error) && error.code === "ERR_INVALID_ARG_TYPE")) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
58
73
|
const response = yield handleRequest(
|
|
59
74
|
request,
|
|
60
75
|
requestId,
|
package/lib/node/index.js
CHANGED
|
@@ -53,6 +53,13 @@ var import_SetupApi = require("../core/SetupApi.js");
|
|
|
53
53
|
var import_mergeRight = require("../core/utils/internal/mergeRight.js");
|
|
54
54
|
var import_handleRequest = require("../core/utils/handleRequest.js");
|
|
55
55
|
var import_devUtils = require("../core/utils/internal/devUtils.js");
|
|
56
|
+
|
|
57
|
+
// src/node/utils/isNodeException.ts
|
|
58
|
+
function isNodeException(error) {
|
|
59
|
+
return error instanceof Error && "code" in error;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/node/SetupServerApi.ts
|
|
56
63
|
var DEFAULT_LISTEN_OPTIONS = {
|
|
57
64
|
onUnhandledRequest: "warn"
|
|
58
65
|
};
|
|
@@ -71,10 +78,18 @@ var SetupServerApi = class extends import_SetupApi.SetupApi {
|
|
|
71
78
|
*/
|
|
72
79
|
init() {
|
|
73
80
|
this.interceptor.on("request", (_0) => __async(this, [_0], function* ({ request, requestId }) {
|
|
74
|
-
(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
if (typeof import_node_events.setMaxListeners === "function") {
|
|
82
|
+
try {
|
|
83
|
+
(0, import_node_events.setMaxListeners)(
|
|
84
|
+
Math.max(import_node_events.defaultMaxListeners, this.currentHandlers.length),
|
|
85
|
+
request.signal
|
|
86
|
+
);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (!(isNodeException(error) && error.code === "ERR_INVALID_ARG_TYPE")) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
78
93
|
const response = yield (0, import_handleRequest.handleRequest)(
|
|
79
94
|
request,
|
|
80
95
|
requestId,
|
package/lib/node/index.mjs
CHANGED
|
@@ -30,6 +30,13 @@ import { SetupApi } from '../core/SetupApi.mjs';
|
|
|
30
30
|
import { mergeRight } from '../core/utils/internal/mergeRight.mjs';
|
|
31
31
|
import { handleRequest } from '../core/utils/handleRequest.mjs';
|
|
32
32
|
import { devUtils } from '../core/utils/internal/devUtils.mjs';
|
|
33
|
+
|
|
34
|
+
// src/node/utils/isNodeException.ts
|
|
35
|
+
function isNodeException(error) {
|
|
36
|
+
return error instanceof Error && "code" in error;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/node/SetupServerApi.ts
|
|
33
40
|
var DEFAULT_LISTEN_OPTIONS = {
|
|
34
41
|
onUnhandledRequest: "warn"
|
|
35
42
|
};
|
|
@@ -48,10 +55,18 @@ var SetupServerApi = class extends SetupApi {
|
|
|
48
55
|
*/
|
|
49
56
|
init() {
|
|
50
57
|
this.interceptor.on("request", (_0) => __async(this, [_0], function* ({ request, requestId }) {
|
|
51
|
-
setMaxListeners
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
if (typeof setMaxListeners === "function") {
|
|
59
|
+
try {
|
|
60
|
+
setMaxListeners(
|
|
61
|
+
Math.max(defaultMaxListeners, this.currentHandlers.length),
|
|
62
|
+
request.signal
|
|
63
|
+
);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (!(isNodeException(error) && error.code === "ERR_INVALID_ARG_TYPE")) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
55
70
|
const response = yield handleRequest(
|
|
56
71
|
request,
|
|
57
72
|
requestId,
|
package/package.json
CHANGED