Skip to content

Commit 0cc1865

Browse files
committed
Cleanup dependencies
Signed-off-by: Sora Morimoto <[email protected]>
1 parent 007b577 commit 0cc1865

File tree

3 files changed

+70
-272
lines changed

3 files changed

+70
-272
lines changed

package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"test:--another-array-type": "node tests/spec/another-array-type/test.js",
5757
"test:--axios": "node tests/spec/axios/test.js",
5858
"test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js",
59-
"test:--cli": "rimraf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
59+
"test:--cli": "shx rm -rf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
6060
"test:--default-as-success": "node tests/spec/defaultAsSuccess/test.js",
6161
"test:--default-response": "node tests/spec/defaultResponse/test.js",
6262
"test:--dot-path-params": "node tests/spec/dot-path-params/test.js",
@@ -103,29 +103,31 @@
103103
"dependencies": {
104104
"@types/swagger-schema-official": "2.0.25",
105105
"cosmiconfig": "9.0.0",
106-
"didyoumean": "^1.2.2",
107-
"eta": "^2.2.0",
106+
"didyoumean": "1.2.2",
107+
"eta": "2.2.0",
108108
"js-yaml": "4.1.0",
109109
"lodash": "4.17.21",
110110
"make-dir": "4.0.0",
111-
"nanoid": "3.3.6",
111+
"nanoid": "3.3.7",
112112
"node-emoji": "2.1.3",
113-
"node-fetch": "^3.3.1",
114113
"prettier": "3.2.5",
115114
"swagger-schema-official": "2.0.0-bab6bed",
116115
"swagger2openapi": "7.0.8",
117116
"typescript": "5.4.5"
118117
},
119118
"devDependencies": {
120119
"@biomejs/biome": "1.7.2",
121-
"@types/lodash": "^4.14.195",
122-
"@types/node": "^20.4.1",
123-
"@types/prettier": "^3.0.0",
124-
"axios": "^1.4.0",
125-
"cross-env": "^7.0.3",
126-
"dotenv": "^16.3.1",
127-
"git-diff": "^2.0.6",
128-
"rimraf": "^5.0.1"
120+
"@types/lodash": "4.17.1",
121+
"@types/node": "20.12.8",
122+
"@types/prettier": "3.0.0",
123+
"axios": "1.6.8",
124+
"cross-env": "7.0.3",
125+
"dotenv": "16.4.5",
126+
"git-diff": "2.0.6",
127+
"shx": "0.3.4"
129128
},
130-
"packageManager": "[email protected]"
129+
"packageManager": "[email protected]",
130+
"engines": {
131+
"node": ">=18.0.0"
132+
}
131133
}

src/util/request.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const _ = require("lodash");
22
const https = require("node:https");
3-
const fetch = require("node-fetch-h2");
43

54
class Request {
65
/**
@@ -22,19 +21,27 @@ class Request {
2221
* @param url {string}
2322
* @param disableStrictSSL
2423
* @param authToken
25-
* @param options {Partial<import("node-fetch").RequestInit>}
24+
* @param options {Partial<RequestInit>}
2625
* @return {Promise<string>}
2726
*/
2827
async download({ url, disableStrictSSL, authToken, ...options }) {
2928
/**
30-
* @type {Partial<import("node-fetch").RequestInit>}
29+
* @type {Partial<RequestInit>}
3130
*/
3231
const requestOptions = {};
3332

3433
if (disableStrictSSL && !_.startsWith(url, "http://")) {
35-
requestOptions.agent = new https.Agent({
36-
rejectUnauthorized: false,
34+
const undiciGlobalDispatcher =
35+
global[Symbol.for("undici.globalDispatcher.1")];
36+
if (!undiciGlobalDispatcher) {
37+
throw new Error("Could not find the global Undici dispatcher");
38+
}
39+
const newDispatcher = new undiciGlobalDispatcher.constructor({
40+
connect: {
41+
rejectUnauthorized: false,
42+
},
3743
});
44+
global[unidiciGlobalDispatcherSymbol] = newDispatcher;
3845
}
3946
if (authToken) {
4047
requestOptions.headers = {

0 commit comments

Comments
 (0)