undici 5.26.3 → 5.26.4

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,4 +1,4 @@
1
- #Interface: DispatchInterceptor
1
+ # Interface: DispatchInterceptor
2
2
 
3
3
  Extends: `Function`
4
4
 
@@ -104,6 +104,10 @@ class StreamHandler extends AsyncResource {
104
104
  { callback, body: res, contentType, statusCode, statusMessage, headers }
105
105
  )
106
106
  } else {
107
+ if (factory === null) {
108
+ return
109
+ }
110
+
107
111
  res = this.runInAsyncScope(factory, null, {
108
112
  statusCode,
109
113
  headers,
@@ -152,7 +156,7 @@ class StreamHandler extends AsyncResource {
152
156
  onData (chunk) {
153
157
  const { res } = this
154
158
 
155
- return res.write(chunk)
159
+ return res ? res.write(chunk) : true
156
160
  }
157
161
 
158
162
  onComplete (trailers) {
@@ -160,6 +164,10 @@ class StreamHandler extends AsyncResource {
160
164
 
161
165
  removeSignal(this)
162
166
 
167
+ if (!res) {
168
+ return
169
+ }
170
+
163
171
  this.trailers = util.parseHeaders(trailers)
164
172
 
165
173
  res.end()
@@ -268,7 +268,7 @@ function consumeEnd (consume) {
268
268
  pos += buf.byteLength
269
269
  }
270
270
 
271
- resolve(dst)
271
+ resolve(dst.buffer)
272
272
  } else if (type === 'blob') {
273
273
  if (!Blob) {
274
274
  Blob = require('buffer').Blob
package/lib/client.js CHANGED
@@ -1070,7 +1070,9 @@ function onParserTimeout (parser) {
1070
1070
 
1071
1071
  function onSocketReadable () {
1072
1072
  const { [kParser]: parser } = this
1073
- parser.readMore()
1073
+ if (parser) {
1074
+ parser.readMore()
1075
+ }
1074
1076
  }
1075
1077
 
1076
1078
  function onSocketError (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "5.26.3",
3
+ "version": "5.26.4",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -67,11 +67,10 @@
67
67
  "index-fetch.js",
68
68
  "lib",
69
69
  "types",
70
- "docs",
71
- "scripts/esbuild-build.mjs"
70
+ "docs"
72
71
  ],
73
72
  "scripts": {
74
- "build:node": "node scripts/esbuild-build.mjs",
73
+ "build:node": "npx esbuild@0.19.4 index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names",
75
74
  "prebuild:wasm": "node build/wasm.js --prebuild",
76
75
  "build:wasm": "node build/wasm.js --docker",
77
76
  "lint": "standard | snazzy",
@@ -85,7 +84,7 @@
85
84
  "test:tdd": "tap test/*.js test/diagnostics-channel/*.js -w",
86
85
  "test:typescript": "node scripts/verifyVersion.js 14 || tsd && tsc --skipLibCheck test/imports/undici-import.ts",
87
86
  "test:websocket": "node scripts/verifyVersion.js 18 || tap test/websocket/*.js",
88
- "test:wpt": "node scripts/verifyVersion 18 || (node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node --no-warnings test/wpt/start-websockets.mjs)",
87
+ "test:wpt": "node scripts/verifyVersion 18 || (node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node --no-warnings --expose-internals test/wpt/start-websockets.mjs)",
89
88
  "coverage": "nyc --reporter=text --reporter=html npm run test",
90
89
  "coverage:ci": "nyc --reporter=lcov npm run test",
91
90
  "bench": "PORT=3042 concurrently -k -s first npm:bench:server npm:bench:run",
@@ -110,7 +109,6 @@
110
109
  "delay": "^5.0.0",
111
110
  "dns-packet": "^5.4.0",
112
111
  "docsify-cli": "^4.4.3",
113
- "esbuild": "^0.19.4",
114
112
  "form-data": "^4.0.0",
115
113
  "formdata-node": "^4.3.1",
116
114
  "https-pem": "^3.0.0",
@@ -1,24 +0,0 @@
1
- import * as esbuild from 'esbuild'
2
- import fs from 'node:fs'
3
-
4
- const bundle = {
5
- name: 'bundle',
6
- setup (build) {
7
- build.onLoad({ filter: /lib(\/|\\)fetch(\/|\\)index.js/ }, async (args) => {
8
- const text = await fs.promises.readFile(args.path, 'utf8')
9
-
10
- return {
11
- contents: `var esbuildDetection = 1;${text}`,
12
- loader: 'js'
13
- }
14
- })
15
- }
16
- }
17
-
18
- await esbuild.build({
19
- entryPoints: ['index-fetch.js'],
20
- bundle: true,
21
- outfile: 'undici-fetch.js',
22
- plugins: [bundle],
23
- platform: 'node'
24
- })