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