urllib 3.19.0 → 3.19.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.
package/README.md CHANGED
@@ -288,7 +288,7 @@ Fork [undici benchmarks script](https://github.com/fengmk2/undici/blob/urllib-be
288
288
 
289
289
  ## Contributors
290
290
 
291
- |[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/288288?v=4" width="100px;"/><br/><sub><b>xingrz</b></sub>](https://github.com/xingrz)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/327019?v=4" width="100px;"/><br/><sub><b>JacksonTian</b></sub>](https://github.com/JacksonTian)<br/>|
291
+ |[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/288288?v=4" width="100px;"/><br/><sub><b>xingrz</b></sub>](https://github.com/xingrz)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/327019?v=4" width="100px;"/><br/><sub><b>JacksonTian</b></sub>](https://github.com/JacksonTian)<br/>|
292
292
  | :---: | :---: | :---: | :---: | :---: | :---: |
293
293
  |[<img src="https://avatars.githubusercontent.com/u/543405?v=4" width="100px;"/><br/><sub><b>ibigbug</b></sub>](https://github.com/ibigbug)<br/>|[<img src="https://avatars.githubusercontent.com/u/14790466?v=4" width="100px;"/><br/><sub><b>greenkeeperio-bot</b></sub>](https://github.com/greenkeeperio-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/5381764?v=4" width="100px;"/><br/><sub><b>paambaati</b></sub>](https://github.com/paambaati)<br/>|[<img src="https://avatars.githubusercontent.com/u/1433247?v=4" width="100px;"/><br/><sub><b>denghongcai</b></sub>](https://github.com/denghongcai)<br/>|
294
294
  |[<img src="https://avatars.githubusercontent.com/u/4635838?v=4" width="100px;"/><br/><sub><b>gemwuu</b></sub>](https://github.com/gemwuu)<br/>|[<img src="https://avatars.githubusercontent.com/u/2842176?v=4" width="100px;"/><br/><sub><b>XadillaX</b></sub>](https://github.com/XadillaX)<br/>|[<img src="https://avatars.githubusercontent.com/u/1147375?v=4" width="100px;"/><br/><sub><b>alsotang</b></sub>](https://github.com/alsotang)<br/>|[<img src="https://avatars.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars.githubusercontent.com/u/19908330?v=4" width="100px;"/><br/><sub><b>hyj1991</b></sub>](https://github.com/hyj1991)<br/>|[<img src="https://avatars.githubusercontent.com/u/1747852?v=4" width="100px;"/><br/><sub><b>isayme</b></sub>](https://github.com/isayme)<br/>|
@@ -297,7 +297,7 @@ Fork [undici benchmarks script](https://github.com/fengmk2/undici/blob/urllib-be
297
297
  |[<img src="https://avatars.githubusercontent.com/u/3689968?v=4" width="100px;"/><br/><sub><b>Amunu</b></sub>](https://github.com/Amunu)<br/>|[<img src="https://avatars.githubusercontent.com/in/9426?v=4" width="100px;"/><br/><sub><b>azure-pipelines[bot]</b></sub>](https://github.com/apps/azure-pipelines)<br/>|[<img src="https://avatars.githubusercontent.com/u/108602490?v=4" width="100px;"/><br/><sub><b>capsice</b></sub>](https://github.com/capsice)<br/>|[<img src="https://avatars.githubusercontent.com/u/1281323?v=4" width="100px;"/><br/><sub><b>changzhiwin</b></sub>](https://github.com/changzhiwin)<br/>|[<img src="https://avatars.githubusercontent.com/u/929503?v=4" width="100px;"/><br/><sub><b>yuzhigang33</b></sub>](https://github.com/yuzhigang33)<br/>|[<img src="https://avatars.githubusercontent.com/u/5574625?v=4" width="100px;"/><br/><sub><b>elrrrrrrr</b></sub>](https://github.com/elrrrrrrr)<br/>|
298
298
  [<img src="https://avatars.githubusercontent.com/u/981128?v=4" width="100px;"/><br/><sub><b>fishbar</b></sub>](https://github.com/fishbar)<br/>|[<img src="https://avatars.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars.githubusercontent.com/u/17476119?v=4" width="100px;"/><br/><sub><b>mars-coder</b></sub>](https://github.com/mars-coder)<br/>|[<img src="https://avatars.githubusercontent.com/u/929179?v=4" width="100px;"/><br/><sub><b>rockdai</b></sub>](https://github.com/rockdai)<br/>|[<img src="https://avatars.githubusercontent.com/u/2196373?v=4" width="100px;"/><br/><sub><b>dickeylth</b></sub>](https://github.com/dickeylth)<br/>|[<img src="https://avatars.githubusercontent.com/u/13050025?v=4" width="100px;"/><br/><sub><b>aladdin-add</b></sub>](https://github.com/aladdin-add)<br/>
299
299
 
300
- This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Mon Apr 24 2023 17:42:08 GMT+0800`.
300
+ This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Sep 16 2023 01:02:26 GMT+0800`.
301
301
 
302
302
  <!-- GITCONTRIBUTOR_END -->
303
303
 
@@ -73,7 +73,7 @@ class HttpClientRequestTimeoutError extends Error {
73
73
  Error.captureStackTrace(this, this.constructor);
74
74
  }
75
75
  }
76
- exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.19.0');
76
+ exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.19.2');
77
77
  function getFileName(stream) {
78
78
  const filePath = stream.path;
79
79
  if (filePath) {
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ import type { Except } from 'type-fest';
3
+ import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
4
+ export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
5
+ 'set-cookie'?: string | string[];
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
- /// <reference types="node" />
5
- import { Readable, Writable } from 'node:stream';
6
- import type { IncomingHttpHeaders } from 'node:http';
4
+ import type { Readable, Writable } from 'node:stream';
7
5
  import type { Dispatcher } from 'undici';
6
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
8
7
  import type { HttpClientResponse } from './Response.js';
9
8
  export type HttpMethod = Dispatcher.HttpMethod;
10
9
  export type RequestURL = string | URL;
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Readable } from 'node:stream';
4
- import { IncomingHttpHeaders } from 'node:http';
2
+ import type { Readable } from 'node:stream';
3
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
5
4
  export type SocketInfo = {
6
5
  id: number;
7
6
  localAddress: string;
@@ -4,7 +4,8 @@ export declare function curl<T = any>(url: RequestURL, options?: RequestOptions)
4
4
  export { MockAgent, ProxyAgent, Agent, Dispatcher, setGlobalDispatcher, getGlobalDispatcher, } from 'undici';
5
5
  export { HttpClient, HttpClient as HttpClient2, HEADER_USER_AGENT as USER_AGENT, RequestDiagnosticsMessage, ResponseDiagnosticsMessage, } from './HttpClient.js';
6
6
  export { RequestOptions, RequestOptions as RequestOptions2, RequestURL, HttpMethod, FixJSONCtlCharsHandler, FixJSONCtlChars, } from './Request.js';
7
- export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
7
+ export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse, } from './Response.js';
8
+ export { IncomingHttpHeaders, } from './IncomingHttpHeaders.js';
8
9
  declare const _default: {
9
10
  request: typeof request;
10
11
  curl: typeof curl;
@@ -67,7 +67,7 @@ class HttpClientRequestTimeoutError extends Error {
67
67
  Error.captureStackTrace(this, this.constructor);
68
68
  }
69
69
  }
70
- export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.19.0');
70
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.19.2');
71
71
  function getFileName(stream) {
72
72
  const filePath = stream.path;
73
73
  if (filePath) {
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { Except } from 'type-fest';
3
+ import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
4
+ export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
5
+ 'set-cookie'?: string | string[];
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,9 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  /// <reference types="node" resolution-mode="require"/>
4
- /// <reference types="node" resolution-mode="require"/>
5
- import { Readable, Writable } from 'node:stream';
6
- import type { IncomingHttpHeaders } from 'node:http';
4
+ import type { Readable, Writable } from 'node:stream';
7
5
  import type { Dispatcher } from 'undici';
6
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
8
7
  import type { HttpClientResponse } from './Response.js';
9
8
  export type HttpMethod = Dispatcher.HttpMethod;
10
9
  export type RequestURL = string | URL;
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- import { Readable } from 'node:stream';
4
- import { IncomingHttpHeaders } from 'node:http';
2
+ import type { Readable } from 'node:stream';
3
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
5
4
  export type SocketInfo = {
6
5
  id: number;
7
6
  localAddress: string;
@@ -4,7 +4,8 @@ export declare function curl<T = any>(url: RequestURL, options?: RequestOptions)
4
4
  export { MockAgent, ProxyAgent, Agent, Dispatcher, setGlobalDispatcher, getGlobalDispatcher, } from 'undici';
5
5
  export { HttpClient, HttpClient as HttpClient2, HEADER_USER_AGENT as USER_AGENT, RequestDiagnosticsMessage, ResponseDiagnosticsMessage, } from './HttpClient.js';
6
6
  export { RequestOptions, RequestOptions as RequestOptions2, RequestURL, HttpMethod, FixJSONCtlCharsHandler, FixJSONCtlChars, } from './Request.js';
7
- export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
7
+ export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse, } from './Response.js';
8
+ export { IncomingHttpHeaders, } from './IncomingHttpHeaders.js';
8
9
  declare const _default: {
9
10
  request: typeof request;
10
11
  curl: typeof curl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urllib",
3
- "version": "3.19.0",
3
+ "version": "3.19.2",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
@@ -38,7 +38,6 @@
38
38
  },
39
39
  "./package.json": "./package.json"
40
40
  },
41
- "typings": "./dist/commonjs/index.d.ts",
42
41
  "files": [
43
42
  "dist",
44
43
  "src"
@@ -50,7 +49,7 @@
50
49
  "scripts": {
51
50
  "lint": "eslint src test --ext .ts --cache",
52
51
  "prebuild": "npm run clean",
53
- "build": "tsc --version && tshy && npm run build:version",
52
+ "build": "tsc --version && tshy && tshy-after && npm run build:version",
54
53
  "postbuild": "rm -rf *.tsbuildinfo",
55
54
  "build:version": "node ./scripts/replace_urllib_version.js",
56
55
  "build:cjs:test": "cd test/cjs && rm -rf node_modules && npm link ../.. && node index.js",
@@ -77,6 +76,7 @@
77
76
  "mime-types": "^2.1.35",
78
77
  "pump": "^3.0.0",
79
78
  "qs": "^6.11.2",
79
+ "type-fest": "^4.3.1",
80
80
  "undici": "^5.22.1",
81
81
  "ylru": "^1.3.2"
82
82
  },
@@ -102,11 +102,13 @@
102
102
  "selfsigned": "^2.0.1",
103
103
  "tar-stream": "^2.2.0",
104
104
  "tshy": "^1.0.0-3",
105
+ "tshy-after": "^1.0.0",
105
106
  "typescript": "^5.0.4",
106
107
  "vitest": "^0.32.0"
107
108
  },
108
109
  "engines": {
109
110
  "node": ">= 14.19.3"
110
111
  },
111
- "license": "MIT"
112
+ "license": "MIT",
113
+ "types": "./dist/commonjs/index.d.ts"
112
114
  }
package/src/HttpClient.ts CHANGED
@@ -2,7 +2,6 @@ import diagnosticsChannel from 'node:diagnostics_channel';
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { LookupFunction } from 'node:net';
4
4
  import { STATUS_CODES } from 'node:http';
5
- import type { IncomingHttpHeaders } from 'node:http';
6
5
  import { debuglog } from 'node:util';
7
6
  import {
8
7
  createGunzip,
@@ -31,6 +30,7 @@ import pump from 'pump';
31
30
  // Compatible with old style formstream
32
31
  import FormStream from 'formstream';
33
32
  import { HttpAgent, CheckAddressFunction } from './HttpAgent.js';
33
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
34
34
  import { RequestURL, RequestOptions, HttpMethod, RequestMeta } from './Request.js';
35
35
  import { RawResponseWithMeta, HttpClientResponse, SocketInfo } from './Response.js';
36
36
  import { parseJSON, sleep, digestAuthHeader, globalId, performanceTime, isReadable } from './utils.js';
@@ -0,0 +1,7 @@
1
+ import type { Except } from 'type-fest';
2
+ import type { IncomingHttpHeaders as HTTPIncomingHttpHeaders } from 'node:http';
3
+
4
+ // fix set-cookie type define https://github.com/nodejs/undici/pull/1893
5
+ export interface IncomingHttpHeaders extends Except<HTTPIncomingHttpHeaders, 'set-cookie'> {
6
+ 'set-cookie'?: string | string[];
7
+ }
package/src/Request.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { Readable, Writable } from 'node:stream';
2
- import type { IncomingHttpHeaders } from 'node:http';
1
+ import type { Readable, Writable } from 'node:stream';
3
2
  import type { Dispatcher } from 'undici';
4
- import type {
5
- HttpClientResponse,
6
- } from './Response.js';
3
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
4
+ import type { HttpClientResponse } from './Response.js';
7
5
 
8
6
  export type HttpMethod = Dispatcher.HttpMethod;
9
7
 
package/src/Response.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Readable } from 'node:stream';
2
- import { IncomingHttpHeaders } from 'node:http';
1
+ import type { Readable } from 'node:stream';
2
+ import type { IncomingHttpHeaders } from './IncomingHttpHeaders.js';
3
3
 
4
4
  export type SocketInfo = {
5
5
  id: number;
package/src/index.ts CHANGED
@@ -46,7 +46,13 @@ export {
46
46
  FixJSONCtlCharsHandler, FixJSONCtlChars,
47
47
  } from './Request.js';
48
48
 
49
- export { SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse } from './Response.js';
49
+ export {
50
+ SocketInfo, Timing, RawResponseWithMeta, HttpClientResponse,
51
+ } from './Response.js';
52
+ export {
53
+ IncomingHttpHeaders,
54
+ } from './IncomingHttpHeaders.js';
55
+
50
56
 
51
57
  export default {
52
58
  request,