@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15

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.
Files changed (134) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +113 -1
  3. package/assert.d.ts +162 -248
  4. package/async_hooks.d.ts +20 -5
  5. package/buffer.buffer.d.ts +24 -6
  6. package/buffer.d.ts +63 -168
  7. package/child_process.d.ts +117 -223
  8. package/cluster.d.ts +251 -329
  9. package/compatibility/iterators.d.ts +15 -0
  10. package/console.d.ts +60 -346
  11. package/constants.d.ts +15 -1
  12. package/crypto.d.ts +713 -1149
  13. package/dgram.d.ts +30 -50
  14. package/diagnostics_channel.d.ts +16 -3
  15. package/dns/promises.d.ts +15 -0
  16. package/dns.d.ts +150 -131
  17. package/domain.d.ts +25 -14
  18. package/events.d.ts +858 -719
  19. package/fs/promises.d.ts +117 -53
  20. package/fs.d.ts +729 -484
  21. package/globals.d.ts +142 -344
  22. package/globals.typedarray.d.ts +94 -0
  23. package/http.d.ts +358 -246
  24. package/http2.d.ts +578 -711
  25. package/https.d.ts +85 -216
  26. package/index.d.ts +39 -3
  27. package/inspector/promises.d.ts +54 -0
  28. package/inspector.d.ts +180 -3936
  29. package/inspector.generated.d.ts +4242 -0
  30. package/module.d.ts +60 -95
  31. package/my-shim.d.ts +15 -0
  32. package/net.d.ts +102 -186
  33. package/os.d.ts +32 -6
  34. package/package.json +3 -8
  35. package/path/posix.d.ts +20 -0
  36. package/path/win32.d.ts +20 -0
  37. package/path.d.ts +132 -122
  38. package/perf_hooks.d.ts +310 -644
  39. package/process.d.ts +192 -138
  40. package/punycode.d.ts +17 -2
  41. package/querystring.d.ts +16 -1
  42. package/quic.d.ts +926 -0
  43. package/readline/promises.d.ts +16 -1
  44. package/readline.d.ts +80 -118
  45. package/repl.d.ts +98 -96
  46. package/sea.d.ts +25 -1
  47. package/sqlite.d.ts +277 -13
  48. package/stream/consumers.d.ts +22 -7
  49. package/stream/promises.d.ts +148 -12
  50. package/stream/web.d.ts +187 -494
  51. package/stream.d.ts +608 -490
  52. package/string_decoder.d.ts +18 -3
  53. package/test/reporters.d.ts +112 -0
  54. package/test.d.ts +238 -199
  55. package/timers/promises.d.ts +16 -1
  56. package/timers.d.ts +16 -129
  57. package/tls.d.ts +163 -163
  58. package/trace_events.d.ts +21 -6
  59. package/ts5.6/buffer.buffer.d.ts +25 -8
  60. package/ts5.6/compatibility/float16array.d.ts +15 -0
  61. package/ts5.6/globals.typedarray.d.ts +31 -0
  62. package/ts5.6/index.d.ts +39 -3
  63. package/ts5.7/compatibility/float16array.d.ts +15 -0
  64. package/ts5.7/index.d.ts +39 -3
  65. package/tty.d.ts +70 -13
  66. package/undici-types/agent.d.ts +20 -4
  67. package/undici-types/api.d.ts +15 -0
  68. package/undici-types/balanced-pool.d.ts +15 -0
  69. package/undici-types/cache-interceptor.d.ts +15 -0
  70. package/undici-types/cache.d.ts +15 -0
  71. package/undici-types/client-stats.d.ts +31 -0
  72. package/undici-types/client.d.ts +21 -5
  73. package/undici-types/connector.d.ts +15 -0
  74. package/undici-types/content-type.d.ts +15 -0
  75. package/undici-types/cookies.d.ts +15 -0
  76. package/undici-types/diagnostics-channel.d.ts +24 -1
  77. package/undici-types/dispatcher.d.ts +18 -8
  78. package/undici-types/env-http-proxy-agent.d.ts +17 -1
  79. package/undici-types/errors.d.ts +20 -15
  80. package/undici-types/eventsource.d.ts +24 -4
  81. package/undici-types/fetch.d.ts +16 -0
  82. package/undici-types/formdata.d.ts +15 -0
  83. package/undici-types/global-dispatcher.d.ts +15 -0
  84. package/undici-types/global-origin.d.ts +15 -0
  85. package/undici-types/h2c-client.d.ts +15 -2
  86. package/undici-types/handlers.d.ts +16 -1
  87. package/undici-types/header.d.ts +15 -0
  88. package/undici-types/index.d.ts +21 -1
  89. package/undici-types/interceptors.d.ts +20 -0
  90. package/undici-types/mock-agent.d.ts +18 -0
  91. package/undici-types/mock-call-history.d.ts +15 -0
  92. package/undici-types/mock-client.d.ts +17 -0
  93. package/undici-types/mock-errors.d.ts +15 -0
  94. package/undici-types/mock-interceptor.d.ts +17 -1
  95. package/undici-types/mock-pool.d.ts +17 -0
  96. package/undici-types/package.json +1 -1
  97. package/undici-types/patch.d.ts +15 -0
  98. package/undici-types/pool-stats.d.ts +15 -0
  99. package/undici-types/pool.d.ts +17 -0
  100. package/undici-types/proxy-agent.d.ts +16 -0
  101. package/undici-types/readable.d.ts +15 -0
  102. package/undici-types/retry-agent.d.ts +15 -0
  103. package/undici-types/retry-handler.d.ts +24 -0
  104. package/undici-types/snapshot-agent.d.ts +125 -0
  105. package/undici-types/util.d.ts +15 -0
  106. package/undici-types/utility.d.ts +15 -0
  107. package/undici-types/webidl.d.ts +126 -36
  108. package/undici-types/websocket.d.ts +18 -1
  109. package/url.d.ts +107 -587
  110. package/util/types.d.ts +571 -0
  111. package/util.d.ts +158 -792
  112. package/v8.d.ts +82 -7
  113. package/vm.d.ts +267 -108
  114. package/wasi.d.ts +38 -2
  115. package/web-globals/abortcontroller.d.ts +75 -0
  116. package/web-globals/blob.d.ts +39 -0
  117. package/web-globals/console.d.ts +25 -0
  118. package/web-globals/crypto.d.ts +55 -0
  119. package/web-globals/domexception.d.ts +84 -0
  120. package/web-globals/encoding.d.ts +27 -0
  121. package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
  122. package/web-globals/fetch.d.ts +70 -0
  123. package/web-globals/importmeta.d.ts +29 -0
  124. package/web-globals/messaging.d.ts +39 -0
  125. package/web-globals/navigator.d.ts +41 -0
  126. package/web-globals/performance.d.ts +61 -0
  127. package/web-globals/storage.d.ts +40 -0
  128. package/web-globals/streams.d.ts +131 -0
  129. package/web-globals/timers.d.ts +60 -0
  130. package/web-globals/url.d.ts +40 -0
  131. package/worker_threads.d.ts +306 -349
  132. package/zlib.d.ts +59 -94
  133. package/ts5.1/compatibility/disposable.d.ts +0 -13
  134. package/ts5.1/index.d.ts +0 -100
package/url.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * The `node:url` module provides utilities for URL resolution and parsing. It can
3
18
  * be accessed using:
@@ -5,11 +20,11 @@
5
20
  * ```js
6
21
  * import url from 'node:url';
7
22
  * ```
8
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js)
9
24
  */
10
25
 
11
26
  declare module "node:url" {
12
- import { Blob as NodeBlob } from 'node:buffer';
27
+ import { Blob, NonSharedBuffer } from 'node:buffer';
13
28
  import { ClientRequestArgs } from 'node:http';
14
29
  import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring';
15
30
  // Input to `url.format`
@@ -72,20 +87,44 @@ declare module "node:url" {
72
87
  * A `URIError` is thrown if the `auth` property is present but cannot be decoded.
73
88
  *
74
89
  * `url.parse()` uses a lenient, non-standard algorithm for parsing URL
75
- * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted
76
- * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead.
90
+ * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487)
91
+ * and incorrect handling of usernames and passwords. Do not use with untrusted
92
+ * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
93
+ * [WHATWG URL](https://nodejs.org/docs/latest-v25.x/api/url.html#the-whatwg-url-api) API instead, for example:
94
+ *
95
+ * ```js
96
+ * function getURL(req) {
97
+ * const proto = req.headers['x-forwarded-proto'] || 'https';
98
+ * const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
99
+ * return new URL(req.url || '/', `${proto}://${host}`);
100
+ * }
101
+ * ```
102
+ *
103
+ * The example above assumes well-formed headers are forwarded from a reverse
104
+ * proxy to your Node.js server. If you are not using a reverse proxy, you should
105
+ * use the example below:
106
+ *
107
+ * ```js
108
+ * function getURL(req) {
109
+ * return new URL(req.url || '/', 'https://example.com');
110
+ * }
111
+ * ```
77
112
  * @since v0.1.25
78
113
  * @deprecated Use the WHATWG URL API instead.
79
114
  * @param urlString The URL string to parse.
80
- * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
81
- * on the returned URL object will be an unparsed, undecoded string.
82
- * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the
83
- * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
115
+ * @param parseQueryString If `true`, the `query` property will always
116
+ * be set to an object returned by the [`querystring`](https://nodejs.org/docs/latest-v25.x/api/querystring.html) module's `parse()`
117
+ * method. If `false`, the `query` property on the returned URL object will be an
118
+ * unparsed, undecoded string. **Default:** `false`.
119
+ * @param slashesDenoteHost If `true`, the first token after the literal
120
+ * string `//` and preceding the next `/` will be interpreted as the `host`.
121
+ * For instance, given `//foo/bar`, the result would be
122
+ * `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
123
+ * **Default:** `false`.
84
124
  */
85
- function parse(urlString: string): UrlWithStringQuery;
86
125
  function parse(
87
126
  urlString: string,
88
- parseQueryString: false | undefined,
127
+ parseQueryString?: false,
89
128
  slashesDenoteHost?: boolean,
90
129
  ): UrlWithStringQuery;
91
130
  function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
@@ -316,6 +355,17 @@ declare module "node:url" {
316
355
  * @return The fully-resolved platform-specific Node.js file path.
317
356
  */
318
357
  function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
358
+ /**
359
+ * Like `url.fileURLToPath(...)` except that instead of returning a string
360
+ * representation of the path, a `Buffer` is returned. This conversion is
361
+ * helpful when the input URL contains percent-encoded segments that are
362
+ * not valid UTF-8 / Unicode sequences.
363
+ * @since v24.3.0
364
+ * @param url The file URL string or URL object to convert to a path.
365
+ * @returns The fully-resolved platform-specific Node.js file path
366
+ * as a `Buffer`.
367
+ */
368
+ function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer;
319
369
  /**
320
370
  * This function ensures that `path` is resolved absolutely, and that the URL
321
371
  * control characters are correctly encoded when converting into a File URL.
@@ -384,378 +434,8 @@ declare module "node:url" {
384
434
  */
385
435
  unicode?: boolean | undefined;
386
436
  }
387
- /**
388
- * Browser-compatible `URL` class, implemented by following the WHATWG URL
389
- * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself.
390
- * The `URL` class is also available on the global object.
391
- *
392
- * In accordance with browser conventions, all properties of `URL` objects
393
- * are implemented as getters and setters on the class prototype, rather than as
394
- * data properties on the object itself. Thus, unlike `legacy urlObject`s,
395
- * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
396
- * return `true`.
397
- * @since v7.0.0, v6.13.0
398
- */
399
- class URL {
400
- /**
401
- * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
402
- *
403
- * ```js
404
- * import {
405
- * Blob,
406
- * resolveObjectURL,
407
- * } from 'node:buffer';
408
- *
409
- * const blob = new Blob(['hello']);
410
- * const id = URL.createObjectURL(blob);
411
- *
412
- * // later...
413
- *
414
- * const otherBlob = resolveObjectURL(id);
415
- * console.log(otherBlob.size);
416
- * ```
417
- *
418
- * The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it.
419
- *
420
- * `Blob` objects are registered within the current thread. If using Worker
421
- * Threads, `Blob` objects registered within one Worker will not be available
422
- * to other workers or the main thread.
423
- * @since v16.7.0
424
- */
425
- static createObjectURL(blob: NodeBlob): string;
426
- /**
427
- * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
428
- * ID that isn't registered will silently fail.
429
- * @since v16.7.0
430
- * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
431
- */
432
- static revokeObjectURL(id: string): void;
433
- /**
434
- * Checks if an `input` relative to the `base` can be parsed to a `URL`.
435
- *
436
- * ```js
437
- * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
438
- *
439
- * const isNotValid = URL.canParse('/foo'); // false
440
- * ```
441
- * @since v19.9.0
442
- * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
443
- * `converted to a string` first.
444
- * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
445
- */
446
- static canParse(input: string, base?: string): boolean;
447
- /**
448
- * Parses a string as a URL. If `base` is provided, it will be used as the base URL for the purpose of resolving non-absolute `input` URLs.
449
- * Returns `null` if `input` is not a valid.
450
- * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
451
- * `converted to a string` first.
452
- * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
453
- * @since v22.1.0
454
- */
455
- static parse(input: string, base?: string): URL | null;
456
- constructor(input: string | { toString: () => string }, base?: string | URL);
457
- /**
458
- * Gets and sets the fragment portion of the URL.
459
- *
460
- * ```js
461
- * const myURL = new URL('https://example.org/foo#bar');
462
- * console.log(myURL.hash);
463
- * // Prints #bar
464
- *
465
- * myURL.hash = 'baz';
466
- * console.log(myURL.href);
467
- * // Prints https://example.org/foo#baz
468
- * ```
469
- *
470
- * Invalid URL characters included in the value assigned to the `hash` property
471
- * are `percent-encoded`. The selection of which characters to
472
- * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
473
- */
474
- hash: string;
475
- /**
476
- * Gets and sets the host portion of the URL.
477
- *
478
- * ```js
479
- * const myURL = new URL('https://example.org:81/foo');
480
- * console.log(myURL.host);
481
- * // Prints example.org:81
482
- *
483
- * myURL.host = 'example.com:82';
484
- * console.log(myURL.href);
485
- * // Prints https://example.com:82/foo
486
- * ```
487
- *
488
- * Invalid host values assigned to the `host` property are ignored.
489
- */
490
- host: string;
491
- /**
492
- * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the
493
- * port.
494
- *
495
- * ```js
496
- * const myURL = new URL('https://example.org:81/foo');
497
- * console.log(myURL.hostname);
498
- * // Prints example.org
499
- *
500
- * // Setting the hostname does not change the port
501
- * myURL.hostname = 'example.com';
502
- * console.log(myURL.href);
503
- * // Prints https://example.com:81/foo
504
- *
505
- * // Use myURL.host to change the hostname and port
506
- * myURL.host = 'example.org:82';
507
- * console.log(myURL.href);
508
- * // Prints https://example.org:82/foo
509
- * ```
510
- *
511
- * Invalid host name values assigned to the `hostname` property are ignored.
512
- */
513
- hostname: string;
514
- /**
515
- * Gets and sets the serialized URL.
516
- *
517
- * ```js
518
- * const myURL = new URL('https://example.org/foo');
519
- * console.log(myURL.href);
520
- * // Prints https://example.org/foo
521
- *
522
- * myURL.href = 'https://example.com/bar';
523
- * console.log(myURL.href);
524
- * // Prints https://example.com/bar
525
- * ```
526
- *
527
- * Getting the value of the `href` property is equivalent to calling {@link toString}.
528
- *
529
- * Setting the value of this property to a new value is equivalent to creating a
530
- * new `URL` object using `new URL(value)`. Each of the `URL` object's properties will be modified.
531
- *
532
- * If the value assigned to the `href` property is not a valid URL, a `TypeError` will be thrown.
533
- */
534
- href: string;
535
- /**
536
- * Gets the read-only serialization of the URL's origin.
537
- *
538
- * ```js
539
- * const myURL = new URL('https://example.org/foo/bar?baz');
540
- * console.log(myURL.origin);
541
- * // Prints https://example.org
542
- * ```
543
- *
544
- * ```js
545
- * const idnURL = new URL('https://測試');
546
- * console.log(idnURL.origin);
547
- * // Prints https://xn--g6w251d
548
- *
549
- * console.log(idnURL.hostname);
550
- * // Prints xn--g6w251d
551
- * ```
552
- */
553
- readonly origin: string;
554
- /**
555
- * Gets and sets the password portion of the URL.
556
- *
557
- * ```js
558
- * const myURL = new URL('https://abc:xyz@example.com');
559
- * console.log(myURL.password);
560
- * // Prints xyz
561
- *
562
- * myURL.password = '123';
563
- * console.log(myURL.href);
564
- * // Prints https://abc:123@example.com/
565
- * ```
566
- *
567
- * Invalid URL characters included in the value assigned to the `password` property
568
- * are `percent-encoded`. The selection of which characters to
569
- * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
570
- */
571
- password: string;
572
- /**
573
- * Gets and sets the path portion of the URL.
574
- *
575
- * ```js
576
- * const myURL = new URL('https://example.org/abc/xyz?123');
577
- * console.log(myURL.pathname);
578
- * // Prints /abc/xyz
579
- *
580
- * myURL.pathname = '/abcdef';
581
- * console.log(myURL.href);
582
- * // Prints https://example.org/abcdef?123
583
- * ```
584
- *
585
- * Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
586
- * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
587
- */
588
- pathname: string;
589
- /**
590
- * Gets and sets the port portion of the URL.
591
- *
592
- * The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will
593
- * result in the `port` value becoming
594
- * the empty string (`''`).
595
- *
596
- * The port value can be an empty string in which case the port depends on
597
- * the protocol/scheme:
598
- *
599
- * <omitted>
600
- *
601
- * Upon assigning a value to the port, the value will first be converted to a
602
- * string using `.toString()`.
603
- *
604
- * If that string is invalid but it begins with a number, the leading number is
605
- * assigned to `port`.
606
- * If the number lies outside the range denoted above, it is ignored.
607
- *
608
- * ```js
609
- * const myURL = new URL('https://example.org:8888');
610
- * console.log(myURL.port);
611
- * // Prints 8888
612
- *
613
- * // Default ports are automatically transformed to the empty string
614
- * // (HTTPS protocol's default port is 443)
615
- * myURL.port = '443';
616
- * console.log(myURL.port);
617
- * // Prints the empty string
618
- * console.log(myURL.href);
619
- * // Prints https://example.org/
620
- *
621
- * myURL.port = 1234;
622
- * console.log(myURL.port);
623
- * // Prints 1234
624
- * console.log(myURL.href);
625
- * // Prints https://example.org:1234/
626
- *
627
- * // Completely invalid port strings are ignored
628
- * myURL.port = 'abcd';
629
- * console.log(myURL.port);
630
- * // Prints 1234
631
- *
632
- * // Leading numbers are treated as a port number
633
- * myURL.port = '5678abcd';
634
- * console.log(myURL.port);
635
- * // Prints 5678
636
- *
637
- * // Non-integers are truncated
638
- * myURL.port = 1234.5678;
639
- * console.log(myURL.port);
640
- * // Prints 1234
641
- *
642
- * // Out-of-range numbers which are not represented in scientific notation
643
- * // will be ignored.
644
- * myURL.port = 1e10; // 10000000000, will be range-checked as described below
645
- * console.log(myURL.port);
646
- * // Prints 1234
647
- * ```
648
- *
649
- * Numbers which contain a decimal point,
650
- * such as floating-point numbers or numbers in scientific notation,
651
- * are not an exception to this rule.
652
- * Leading numbers up to the decimal point will be set as the URL's port,
653
- * assuming they are valid:
654
- *
655
- * ```js
656
- * myURL.port = 4.567e21;
657
- * console.log(myURL.port);
658
- * // Prints 4 (because it is the leading number in the string '4.567e21')
659
- * ```
660
- */
661
- port: string;
662
- /**
663
- * Gets and sets the protocol portion of the URL.
664
- *
665
- * ```js
666
- * const myURL = new URL('https://example.org');
667
- * console.log(myURL.protocol);
668
- * // Prints https:
669
- *
670
- * myURL.protocol = 'ftp';
671
- * console.log(myURL.href);
672
- * // Prints ftp://example.org/
673
- * ```
674
- *
675
- * Invalid URL protocol values assigned to the `protocol` property are ignored.
676
- */
677
- protocol: string;
678
- /**
679
- * Gets and sets the serialized query portion of the URL.
680
- *
681
- * ```js
682
- * const myURL = new URL('https://example.org/abc?123');
683
- * console.log(myURL.search);
684
- * // Prints ?123
685
- *
686
- * myURL.search = 'abc=xyz';
687
- * console.log(myURL.href);
688
- * // Prints https://example.org/abc?abc=xyz
689
- * ```
690
- *
691
- * Any invalid URL characters appearing in the value assigned the `search` property will be `percent-encoded`. The selection of which
692
- * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
693
- */
694
- search: string;
695
- /**
696
- * Gets the `URLSearchParams` object representing the query parameters of the
697
- * URL. This property is read-only but the `URLSearchParams` object it provides
698
- * can be used to mutate the URL instance; to replace the entirety of query
699
- * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details.
700
- *
701
- * Use care when using `.searchParams` to modify the `URL` because,
702
- * per the WHATWG specification, the `URLSearchParams` object uses
703
- * different rules to determine which characters to percent-encode. For
704
- * instance, the `URL` object will not percent encode the ASCII tilde (`~`)
705
- * character, while `URLSearchParams` will always encode it:
706
- *
707
- * ```js
708
- * const myURL = new URL('https://example.org/abc?foo=~bar');
709
- *
710
- * console.log(myURL.search); // prints ?foo=~bar
711
- *
712
- * // Modify the URL via searchParams...
713
- * myURL.searchParams.sort();
714
- *
715
- * console.log(myURL.search); // prints ?foo=%7Ebar
716
- * ```
717
- */
718
- readonly searchParams: URLSearchParams;
719
- /**
720
- * Gets and sets the username portion of the URL.
721
- *
722
- * ```js
723
- * const myURL = new URL('https://abc:xyz@example.com');
724
- * console.log(myURL.username);
725
- * // Prints abc
726
- *
727
- * myURL.username = '123';
728
- * console.log(myURL.href);
729
- * // Prints https://123:xyz@example.com/
730
- * ```
731
- *
732
- * Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
733
- * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
734
- */
735
- username: string;
736
- /**
737
- * The `toString()` method on the `URL` object returns the serialized URL. The
738
- * value returned is equivalent to that of {@link href} and {@link toJSON}.
739
- */
740
- toString(): string;
741
- /**
742
- * The `toJSON()` method on the `URL` object returns the serialized URL. The
743
- * value returned is equivalent to that of {@link href} and {@link toString}.
744
- *
745
- * This method is automatically called when an `URL` object is serialized
746
- * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).
747
- *
748
- * ```js
749
- * const myURLs = [
750
- * new URL('https://www.example.com'),
751
- * new URL('https://test.example.org'),
752
- * ];
753
- * console.log(JSON.stringify(myURLs));
754
- * // Prints ["https://www.example.com/","https://test.example.org/"]
755
- * ```
756
- */
757
- toJSON(): string;
758
- }
437
+ // #region web types
438
+ type URLPatternInput = string | URLPatternInit;
759
439
  interface URLPatternComponentResult {
760
440
  input: string;
761
441
  groups: Record<string, string | undefined>;
@@ -775,7 +455,7 @@ declare module "node:url" {
775
455
  ignoreCase?: boolean;
776
456
  }
777
457
  interface URLPatternResult {
778
- inputs: (string | URLPatternInit)[];
458
+ inputs: URLPatternInput[];
779
459
  protocol: URLPatternComponentResult;
780
460
  username: URLPatternComponentResult;
781
461
  password: URLPatternComponentResult;
@@ -785,14 +465,30 @@ declare module "node:url" {
785
465
  search: URLPatternComponentResult;
786
466
  hash: URLPatternComponentResult;
787
467
  }
788
- /**
789
- * @since v23.8.0
790
- * @experimental
791
- */
792
- class URLPattern {
793
- constructor(input: string | URLPatternInit, baseURL: string, options?: URLPatternOptions);
794
- constructor(input?: string | URLPatternInit, options?: URLPatternOptions);
795
- exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
468
+ interface URL {
469
+ hash: string;
470
+ host: string;
471
+ hostname: string;
472
+ href: string;
473
+ readonly origin: string;
474
+ password: string;
475
+ pathname: string;
476
+ port: string;
477
+ protocol: string;
478
+ search: string;
479
+ readonly searchParams: URLSearchParams;
480
+ username: string;
481
+ toJSON(): string;
482
+ }
483
+ var URL: {
484
+ prototype: URL;
485
+ new(url: string | URL, base?: string | URL): URL;
486
+ canParse(input: string | URL, base?: string | URL): boolean;
487
+ createObjectURL(blob: Blob): string;
488
+ parse(input: string | URL, base?: string | URL): URL | null;
489
+ revokeObjectURL(id: string): void;
490
+ };
491
+ interface URLPattern {
796
492
  readonly hasRegExpGroups: boolean;
797
493
  readonly hash: string;
798
494
  readonly hostname: string;
@@ -801,212 +497,36 @@ declare module "node:url" {
801
497
  readonly port: string;
802
498
  readonly protocol: string;
803
499
  readonly search: string;
804
- test(input?: string | URLPatternInit, baseURL?: string): boolean;
805
500
  readonly username: string;
501
+ exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
502
+ test(input?: URLPatternInput, baseURL?: string | URL): boolean;
806
503
  }
807
- interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
808
- [Symbol.iterator](): URLSearchParamsIterator<T>;
809
- }
810
- /**
811
- * The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the
812
- * four following constructors.
813
- * The `URLSearchParams` class is also available on the global object.
814
- *
815
- * The WHATWG `URLSearchParams` interface and the `querystring` module have
816
- * similar purpose, but the purpose of the `querystring` module is more
817
- * general, as it allows the customization of delimiter characters (`&#x26;` and `=`).
818
- * On the other hand, this API is designed purely for URL query strings.
819
- *
820
- * ```js
821
- * const myURL = new URL('https://example.org/?abc=123');
822
- * console.log(myURL.searchParams.get('abc'));
823
- * // Prints 123
824
- *
825
- * myURL.searchParams.append('abc', 'xyz');
826
- * console.log(myURL.href);
827
- * // Prints https://example.org/?abc=123&#x26;abc=xyz
828
- *
829
- * myURL.searchParams.delete('abc');
830
- * myURL.searchParams.set('a', 'b');
831
- * console.log(myURL.href);
832
- * // Prints https://example.org/?a=b
833
- *
834
- * const newSearchParams = new URLSearchParams(myURL.searchParams);
835
- * // The above is equivalent to
836
- * // const newSearchParams = new URLSearchParams(myURL.search);
837
- *
838
- * newSearchParams.append('a', 'c');
839
- * console.log(myURL.href);
840
- * // Prints https://example.org/?a=b
841
- * console.log(newSearchParams.toString());
842
- * // Prints a=b&#x26;a=c
843
- *
844
- * // newSearchParams.toString() is implicitly called
845
- * myURL.search = newSearchParams;
846
- * console.log(myURL.href);
847
- * // Prints https://example.org/?a=b&#x26;a=c
848
- * newSearchParams.delete('a');
849
- * console.log(myURL.href);
850
- * // Prints https://example.org/?a=b&#x26;a=c
851
- * ```
852
- * @since v7.5.0, v6.13.0
853
- */
854
- class URLSearchParams implements Iterable<[string, string]> {
855
- constructor(
856
- init?:
857
- | URLSearchParams
858
- | string
859
- | Record<string, string | readonly string[]>
860
- | Iterable<[string, string]>
861
- | ReadonlyArray<[string, string]>,
862
- );
863
- /**
864
- * Append a new name-value pair to the query string.
865
- */
504
+ var URLPattern: {
505
+ prototype: URLPattern;
506
+ new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
507
+ new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
508
+ };
509
+ interface URLSearchParams {
510
+ readonly size: number;
866
511
  append(name: string, value: string): void;
867
- /**
868
- * If `value` is provided, removes all name-value pairs
869
- * where name is `name` and value is `value`.
870
- *
871
- * If `value` is not provided, removes all name-value pairs whose name is `name`.
872
- */
873
512
  delete(name: string, value?: string): void;
874
- /**
875
- * Returns an ES6 `Iterator` over each of the name-value pairs in the query.
876
- * Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`.
877
- *
878
- * Alias for `urlSearchParams[@@iterator]()`.
879
- */
880
- entries(): URLSearchParamsIterator<[string, string]>;
881
- /**
882
- * Iterates over each name-value pair in the query and invokes the given function.
883
- *
884
- * ```js
885
- * const myURL = new URL('https://example.org/?a=b&#x26;c=d');
886
- * myURL.searchParams.forEach((value, name, searchParams) => {
887
- * console.log(name, value, myURL.searchParams === searchParams);
888
- * });
889
- * // Prints:
890
- * // a b true
891
- * // c d true
892
- * ```
893
- * @param fn Invoked for each name-value pair in the query
894
- * @param thisArg To be used as `this` value for when `fn` is called
895
- */
896
- forEach<TThis = this>(
897
- fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
898
- thisArg?: TThis,
899
- ): void;
900
- /**
901
- * Returns the value of the first name-value pair whose name is `name`. If there
902
- * are no such pairs, `null` is returned.
903
- * @return or `null` if there is no name-value pair with the given `name`.
904
- */
905
513
  get(name: string): string | null;
906
- /**
907
- * Returns the values of all name-value pairs whose name is `name`. If there are
908
- * no such pairs, an empty array is returned.
909
- */
910
514
  getAll(name: string): string[];
911
- /**
912
- * Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument.
913
- *
914
- * If `value` is provided, returns `true` when name-value pair with
915
- * same `name` and `value` exists.
916
- *
917
- * If `value` is not provided, returns `true` if there is at least one name-value
918
- * pair whose name is `name`.
919
- */
920
515
  has(name: string, value?: string): boolean;
921
- /**
922
- * Returns an ES6 `Iterator` over the names of each name-value pair.
923
- *
924
- * ```js
925
- * const params = new URLSearchParams('foo=bar&#x26;foo=baz');
926
- * for (const name of params.keys()) {
927
- * console.log(name);
928
- * }
929
- * // Prints:
930
- * // foo
931
- * // foo
932
- * ```
933
- */
934
- keys(): URLSearchParamsIterator<string>;
935
- /**
936
- * Sets the value in the `URLSearchParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`,
937
- * set the first such pair's value to `value` and remove all others. If not,
938
- * append the name-value pair to the query string.
939
- *
940
- * ```js
941
- * const params = new URLSearchParams();
942
- * params.append('foo', 'bar');
943
- * params.append('foo', 'baz');
944
- * params.append('abc', 'def');
945
- * console.log(params.toString());
946
- * // Prints foo=bar&#x26;foo=baz&#x26;abc=def
947
- *
948
- * params.set('foo', 'def');
949
- * params.set('xyz', 'opq');
950
- * console.log(params.toString());
951
- * // Prints foo=def&#x26;abc=def&#x26;xyz=opq
952
- * ```
953
- */
954
516
  set(name: string, value: string): void;
955
- /**
956
- * The total number of parameter entries.
957
- * @since v19.8.0
958
- */
959
- readonly size: number;
960
- /**
961
- * Sort all existing name-value pairs in-place by their names. Sorting is done
962
- * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
963
- * with the same name is preserved.
964
- *
965
- * This method can be used, in particular, to increase cache hits.
966
- *
967
- * ```js
968
- * const params = new URLSearchParams('query[]=abc&#x26;type=search&#x26;query[]=123');
969
- * params.sort();
970
- * console.log(params.toString());
971
- * // Prints query%5B%5D=abc&#x26;query%5B%5D=123&#x26;type=search
972
- * ```
973
- * @since v7.7.0, v6.13.0
974
- */
975
517
  sort(): void;
976
- /**
977
- * Returns the search parameters serialized as a string, with characters
978
- * percent-encoded where necessary.
979
- */
980
- toString(): string;
981
- /**
982
- * Returns an ES6 `Iterator` over the values of each name-value pair.
983
- */
984
- values(): URLSearchParamsIterator<string>;
518
+ forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
985
519
  [Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
520
+ entries(): URLSearchParamsIterator<[string, string]>;
521
+ keys(): URLSearchParamsIterator<string>;
522
+ values(): URLSearchParamsIterator<string>;
986
523
  }
987
- import {
988
- URL as _URL,
989
- URLPattern as _URLPattern,
990
- URLPatternInit as _URLPatternInit,
991
- URLPatternResult as _URLPatternResult,
992
- URLSearchParams as _URLSearchParams,
993
- } from 'node:url';
994
- global {
995
- interface URL extends _URL {}
996
- var URL: typeof globalThis extends {
997
- onmessage: any;
998
- URL: infer T;
999
- } ? T
1000
- : typeof _URL;
1001
- interface URLSearchParams extends _URLSearchParams {}
1002
- var URLSearchParams: typeof globalThis extends {
1003
- onmessage: any;
1004
- URLSearchParams: infer T;
1005
- } ? T
1006
- : typeof _URLSearchParams;
1007
- interface URLPatternInit extends _URLPatternInit {}
1008
- interface URLPatternResult extends _URLPatternResult {}
1009
- interface URLPattern extends _URLPattern {}
1010
- var URLPattern: typeof _URLPattern;
524
+ var URLSearchParams: {
525
+ prototype: URLSearchParams;
526
+ new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
527
+ };
528
+ interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
529
+ [Symbol.iterator](): URLSearchParamsIterator<T>;
1011
530
  }
531
+ // #endregion
1012
532
  }