@depup/got-scraping 4.2.1-depup.0

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 ADDED
@@ -0,0 +1,36 @@
1
+ # @depup/got-scraping
2
+
3
+ > Dependency-bumped version of [got-scraping](https://www.npmjs.com/package/got-scraping)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/got-scraping
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [got-scraping](https://www.npmjs.com/package/got-scraping) @ 4.2.1 |
17
+ | Processed | 2026-03-19 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 6 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | got | ^14.2.1 | ^14.6.6 |
26
+ | header-generator | ^2.1.41 | ^2.1.81 |
27
+ | http2-wrapper | ^2.2.0 | ^2.2.1 |
28
+ | ow | ^1.1.1 | ^3.1.1 |
29
+ | quick-lru | ^7.0.0 | ^7.3.0 |
30
+ | tslib | ^2.6.2 | ^2.8.1 |
31
+
32
+ ---
33
+
34
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/got-scraping
35
+
36
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "bumped": {
3
+ "got": {
4
+ "from": "^14.2.1",
5
+ "to": "^14.6.6"
6
+ },
7
+ "header-generator": {
8
+ "from": "^2.1.41",
9
+ "to": "^2.1.81"
10
+ },
11
+ "http2-wrapper": {
12
+ "from": "^2.2.0",
13
+ "to": "^2.2.1"
14
+ },
15
+ "ow": {
16
+ "from": "^1.1.1",
17
+ "to": "^3.1.1"
18
+ },
19
+ "quick-lru": {
20
+ "from": "^7.0.0",
21
+ "to": "^7.3.0"
22
+ },
23
+ "tslib": {
24
+ "from": "^2.6.2",
25
+ "to": "^2.8.1"
26
+ }
27
+ },
28
+ "timestamp": "2026-03-19T03:34:54.411Z",
29
+ "totalUpdated": 6
30
+ }
@@ -0,0 +1,246 @@
1
+ // @ts-ignore Patch needed for ES20xx compatibility while this module uses Node16/NodeNext resolutions
2
+ import * as got from 'got';
3
+ // @ts-ignore Patch needed for ES20xx compatibility while this module uses Node16/NodeNext resolutions
4
+ import { Options, OptionsInit as OptionsInit$1, Agents, CancelableRequest, Response, Request, ExtendOptions, HTTPAlias, PaginationOptions, PaginateData, Got } from 'got';
5
+ // @ts-ignore Patch needed for ES20xx compatibility while this module uses Node16/NodeNext resolutions
6
+ export * from 'got';
7
+ // @ts-ignore Patch needed for ES20xx compatibility while this module uses Node16/NodeNext resolutions
8
+ export { OptionsInit as GotOptionsInit } from 'got';
9
+ import { Agent, ClientRequest, ClientRequestArgs, AgentOptions } from 'node:http';
10
+ import { NetConnectOpts } from 'node:net';
11
+ import { Duplex } from 'node:stream';
12
+ import { URL as URL$1 } from 'node:url';
13
+
14
+ /**
15
+ * @see https://github.com/nodejs/node/blob/533cafcf7e3ab72e98a2478bc69aedfdf06d3a5e/lib/_http_client.js#L129-L162
16
+ * @see https://github.com/nodejs/node/blob/533cafcf7e3ab72e98a2478bc69aedfdf06d3a5e/lib/_http_client.js#L234-L246
17
+ * @see https://github.com/nodejs/node/blob/533cafcf7e3ab72e98a2478bc69aedfdf06d3a5e/lib/_http_client.js#L304-L305
18
+ * Wraps an existing Agent instance,
19
+ * so there's no need to replace `agent.addRequest`.
20
+ */
21
+ declare class WrappedAgent<T extends Agent> implements Agent {
22
+ agent: T;
23
+ constructor(agent: T);
24
+ addRequest(request: ClientRequest, options: ClientRequestArgs): void;
25
+ get keepAlive(): boolean;
26
+ get maxSockets(): Agent['maxSockets'];
27
+ get options(): AgentOptions;
28
+ get defaultPort(): number;
29
+ get protocol(): string;
30
+ destroy(): void;
31
+ get maxFreeSockets(): Agent['maxFreeSockets'];
32
+ get maxTotalSockets(): Agent['maxTotalSockets'];
33
+ get freeSockets(): Agent['freeSockets'];
34
+ get sockets(): Agent['sockets'];
35
+ get requests(): Agent['requests'];
36
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
37
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
38
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
39
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
40
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
41
+ removeAllListeners(eventName?: string | symbol): this;
42
+ setMaxListeners(n: number): this;
43
+ getMaxListeners(): number;
44
+ listeners(eventName: Parameters<Agent['listeners']>[0]): ReturnType<Agent['listeners']>;
45
+ rawListeners(eventName: Parameters<Agent['rawListeners']>[0]): ReturnType<Agent['rawListeners']>;
46
+ emit(eventName: string | symbol, ...args: any[]): boolean;
47
+ eventNames(): (string | symbol)[];
48
+ listenerCount(eventName: string | symbol): number;
49
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
50
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
51
+ createConnection(options: NetConnectOpts, callback?: (err: Error | null, stream: Duplex) => void): Duplex;
52
+ keepSocketAlive(socket: Duplex): void;
53
+ reuseSocket(socket: Duplex, request: ClientRequest): void;
54
+ getName(options?: any): string;
55
+ }
56
+
57
+ /**
58
+ * Transforms the casing of the headers to Pascal-Case.
59
+ */
60
+ declare class TransformHeadersAgent<T extends Agent> extends WrappedAgent<T> {
61
+ /**
62
+ * Transforms the request via header normalization.
63
+ */
64
+ transformRequest(request: ClientRequest, { sortHeaders }: {
65
+ sortHeaders: boolean;
66
+ }): void;
67
+ addRequest(request: ClientRequest, options: ClientRequestArgs): void;
68
+ toPascalCase(header: string): string;
69
+ }
70
+
71
+ declare function browserHeadersHook(options: Options): Promise<void>;
72
+
73
+ declare function customOptionsHook(raw: OptionsInit$1, options: Options): void;
74
+
75
+ declare function http2Hook(options: Options): void;
76
+
77
+ declare function insecureParserHook(options: Options): void;
78
+
79
+ declare function optionsValidationHandler(options: unknown): void;
80
+
81
+ declare function proxyHook(options: Options): Promise<void>;
82
+ declare function getAgents(parsedProxyUrl: URL$1, rejectUnauthorized: boolean): Promise<Agents>;
83
+
84
+ declare function tlsHook(options: Options): void;
85
+
86
+ interface Context {
87
+ proxyUrl?: string;
88
+ headerGeneratorOptions?: Record<string, unknown>;
89
+ useHeaderGenerator?: boolean;
90
+ headerGenerator?: {
91
+ getHeaders: (options: Record<string, unknown>) => Record<string, string>;
92
+ };
93
+ insecureHTTPParser?: boolean;
94
+ sessionToken?: object;
95
+ /** @private */
96
+ sessionData?: unknown;
97
+ /** @private */
98
+ resolveProtocol?: (data: unknown) => {
99
+ alpnProtocol: string;
100
+ } | Promise<{
101
+ alpnProtocol: string;
102
+ }>;
103
+ }
104
+ type OptionsInit = OptionsInit$1 & Context;
105
+
106
+ type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
107
+ type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
108
+ type ExtendedGotRequestFunction = {
109
+ (url: string | URL, options?: ExtendedOptionsOfTextResponseBody): CancelableRequest<Response<string>>;
110
+ <T>(url: string | URL, options?: ExtendedOptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
111
+ (url: string | URL, options?: ExtendedOptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
112
+ (url: string | URL, options?: ExtendedOptionsOfUnknownResponseBody): CancelableRequest<Response>;
113
+ (options: ExtendedOptionsOfTextResponseBody): CancelableRequest<Response<string>>;
114
+ <T>(options: ExtendedOptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
115
+ (options: ExtendedOptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
116
+ (options: ExtendedOptionsOfUnknownResponseBody): CancelableRequest<Response>;
117
+ (url: string | URL, options?: (Merge<ExtendedOptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
118
+ <T>(url: string | URL, options?: (Merge<ExtendedOptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
119
+ (url: string | URL, options?: (Merge<ExtendedOptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
120
+ (options: (Merge<ExtendedOptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
121
+ <T>(options: (Merge<ExtendedOptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
122
+ (options: (Merge<ExtendedOptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
123
+ (url: string | URL, options?: Merge<OptionsInit, {
124
+ isStream: true;
125
+ }>): Request;
126
+ (options: Merge<OptionsInit, {
127
+ isStream: true;
128
+ }>): Request;
129
+ (url: string | URL, options?: OptionsInit): CancelableRequest | Request;
130
+ (options: OptionsInit): CancelableRequest | Request;
131
+ (url: undefined, options: undefined, defaults: Options): CancelableRequest | Request;
132
+ };
133
+ type ExtendedOptionsOfTextResponseBody = Merge<OptionsInit, {
134
+ isStream?: false;
135
+ resolveBodyOnly?: false;
136
+ responseType?: 'text';
137
+ }>;
138
+ type ExtendedOptionsOfJSONResponseBody = Merge<OptionsInit, {
139
+ isStream?: false;
140
+ resolveBodyOnly?: false;
141
+ responseType?: 'json';
142
+ }>;
143
+ type ExtendedOptionsOfBufferResponseBody = Merge<OptionsInit, {
144
+ isStream?: false;
145
+ resolveBodyOnly?: false;
146
+ responseType: 'buffer';
147
+ }>;
148
+ type ExtendedOptionsOfUnknownResponseBody = Merge<OptionsInit, {
149
+ isStream?: false;
150
+ resolveBodyOnly?: false;
151
+ }>;
152
+ type ResponseBodyOnly = {
153
+ resolveBodyOnly: true;
154
+ };
155
+ type ExtendedGotStreamFunction = ((url?: string | URL, options?: Merge<OptionsInit, {
156
+ isStream?: true;
157
+ }>) => Request) & ((options?: Merge<OptionsInit, {
158
+ isStream?: true;
159
+ }>) => Request);
160
+ type ExtendedExtendOptions = ExtendOptions & OptionsInit;
161
+ type ExtendedGotStream = ExtendedGotStreamFunction & Record<HTTPAlias, ExtendedGotStreamFunction>;
162
+ type ExtendedPaginationOptions<ElementType, BodyType> = PaginationOptions<ElementType, BodyType> & {
163
+ paginate?: (data: PaginateData<BodyType, ElementType>) => OptionsInit | false;
164
+ };
165
+ type ExtendedOptionsWithPagination<T = unknown, R = unknown> = Merge<OptionsInit, {
166
+ pagination?: ExtendedPaginationOptions<T, R>;
167
+ }>;
168
+ type ExtendedGotPaginate = {
169
+ /**
170
+ Same as `GotPaginate.each`.
171
+ */
172
+ <T, R = unknown>(url: string | URL, options?: ExtendedOptionsWithPagination<T, R>): AsyncIterableIterator<T>;
173
+ /**
174
+ Same as `GotPaginate.each`.
175
+ */
176
+ <T, R = unknown>(options?: ExtendedOptionsWithPagination<T, R>): AsyncIterableIterator<T>;
177
+ /**
178
+ Returns an async iterator.
179
+
180
+ See pagination.options for more pagination options.
181
+
182
+ @example
183
+ ```
184
+ import { gotScraping } from 'got-scraping';
185
+
186
+ const countLimit = 10;
187
+
188
+ const pagination = gotScraping.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
189
+ pagination: { countLimit }
190
+ });
191
+
192
+ console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
193
+
194
+ for await (const commitData of pagination) {
195
+ console.log(commitData.commit.message);
196
+ }
197
+ ```
198
+ */
199
+ each: (<T, R = unknown>(url: string | URL, options?: ExtendedOptionsWithPagination<T, R>) => AsyncIterableIterator<T>) & (<T, R = unknown>(options?: ExtendedOptionsWithPagination<T, R>) => AsyncIterableIterator<T>);
200
+ /**
201
+ Returns a Promise for an array of all results.
202
+
203
+ See pagination.options for more pagination options.
204
+
205
+ @example
206
+ ```
207
+ import { gotScraping } from 'got-scraping';
208
+
209
+ const countLimit = 10;
210
+
211
+ const results = await gotScraping.paginate.all('https://api.github.com/repos/sindresorhus/got/commits', {
212
+ pagination: { countLimit }
213
+ });
214
+
215
+ console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
216
+ console.log(results);
217
+ ```
218
+ */
219
+ all: (<T, R = unknown>(url: string | URL, options?: ExtendedOptionsWithPagination<T, R>) => Promise<T[]>) & (<T, R = unknown>(options?: ExtendedOptionsWithPagination<T, R>) => Promise<T[]>);
220
+ };
221
+ type GotScraping = {
222
+ stream: ExtendedGotStream;
223
+ paginate: ExtendedGotPaginate;
224
+ defaults: Got['defaults'];
225
+ extend: (...instancesOrOptions: Array<GotScraping | ExtendedExtendOptions>) => GotScraping;
226
+ } & Record<HTTPAlias, ExtendedGotRequestFunction> & ExtendedGotRequestFunction;
227
+
228
+ declare const gotScraping: GotScraping;
229
+
230
+ declare const hooks: {
231
+ init: (typeof customOptionsHook)[];
232
+ beforeRequest: (typeof insecureParserHook)[];
233
+ beforeRedirect: got.BeforeRedirectHook[];
234
+ fixDecompress: got.HandlerFunction;
235
+ insecureParserHook: typeof insecureParserHook;
236
+ sessionDataHook: (options: Options) => void;
237
+ http2Hook: typeof http2Hook;
238
+ proxyHook: typeof proxyHook;
239
+ browserHeadersHook: typeof browserHeadersHook;
240
+ tlsHook: typeof tlsHook;
241
+ optionsValidationHandler: typeof optionsValidationHandler;
242
+ customOptionsHook: typeof customOptionsHook;
243
+ refererHook: got.BeforeRedirectHook;
244
+ };
245
+
246
+ export { Context, ExtendedExtendOptions, ExtendedGotPaginate, ExtendedGotRequestFunction, ExtendedGotStream, ExtendedGotStreamFunction, ExtendedOptionsOfBufferResponseBody, ExtendedOptionsOfJSONResponseBody, ExtendedOptionsOfTextResponseBody, ExtendedOptionsOfUnknownResponseBody, ExtendedOptionsWithPagination, ExtendedPaginationOptions, GotScraping, OptionsInit, ResponseBodyOnly, TransformHeadersAgent, getAgents, gotScraping, hooks };