송민석

Add node_modules folder

Showing 1000 changed files with 4620 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +../mime/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../sshpk/bin/sshpk-conv
...\ No newline at end of file ...\ No newline at end of file
1 +../sshpk/bin/sshpk-sign
...\ No newline at end of file ...\ No newline at end of file
1 +../sshpk/bin/sshpk-verify
...\ No newline at end of file ...\ No newline at end of file
1 +../uuid/bin/uuid
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 + MIT License
2 +
3 + Copyright (c) Microsoft Corporation.
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in all
13 + copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 + SOFTWARE
1 +# Installation
2 +> `npm install --save @types/node`
3 +
4 +# Summary
5 +This package contains type definitions for Node.js (https://nodejs.org/).
6 +
7 +# Details
8 +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9 +
10 +### Additional Details
11 + * Last updated: Fri, 03 Jun 2022 13:01:31 GMT
12 + * Dependencies: none
13 + * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14 +
15 +# Credits
16 +These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), and [Matteo Collina](https://github.com/mcollina).
This diff is collapsed. Click to expand it.
1 +declare module 'assert/strict' {
2 + import { strict } from 'node:assert';
3 + export = strict;
4 +}
5 +declare module 'node:assert/strict' {
6 + import { strict } from 'node:assert';
7 + export = strict;
8 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2 +declare module 'constants' {
3 + import { constants as osConstants, SignalConstants } from 'node:os';
4 + import { constants as cryptoConstants } from 'node:crypto';
5 + import { constants as fsConstants } from 'node:fs';
6 +
7 + const exp: typeof osConstants.errno &
8 + typeof osConstants.priority &
9 + SignalConstants &
10 + typeof cryptoConstants &
11 + typeof fsConstants;
12 + export = exp;
13 +}
14 +
15 +declare module 'node:constants' {
16 + import constants = require('constants');
17 + export = constants;
18 +}
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
1 +/**
2 + * The `diagnostics_channel` module provides an API to create named channels
3 + * to report arbitrary message data for diagnostics purposes.
4 + *
5 + * It can be accessed using:
6 + *
7 + * ```js
8 + * import diagnostics_channel from 'diagnostics_channel';
9 + * ```
10 + *
11 + * It is intended that a module writer wanting to report diagnostics messages
12 + * will create one or many top-level channels to report messages through.
13 + * Channels may also be acquired at runtime but it is not encouraged
14 + * due to the additional overhead of doing so. Channels may be exported for
15 + * convenience, but as long as the name is known it can be acquired anywhere.
16 + *
17 + * If you intend for your module to produce diagnostics data for others to
18 + * consume it is recommended that you include documentation of what named
19 + * channels are used along with the shape of the message data. Channel names
20 + * should generally include the module name to avoid collisions with data from
21 + * other modules.
22 + * @experimental
23 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/diagnostics_channel.js)
24 + */
25 +declare module 'diagnostics_channel' {
26 + /**
27 + * Check if there are active subscribers to the named channel. This is helpful if
28 + * the message you want to send might be expensive to prepare.
29 + *
30 + * This API is optional but helpful when trying to publish messages from very
31 + * performance-sensitive code.
32 + *
33 + * ```js
34 + * import diagnostics_channel from 'diagnostics_channel';
35 + *
36 + * if (diagnostics_channel.hasSubscribers('my-channel')) {
37 + * // There are subscribers, prepare and publish message
38 + * }
39 + * ```
40 + * @since v15.1.0, v14.17.0
41 + * @param name The channel name
42 + * @return If there are active subscribers
43 + */
44 + function hasSubscribers(name: string): boolean;
45 + /**
46 + * This is the primary entry-point for anyone wanting to interact with a named
47 + * channel. It produces a channel object which is optimized to reduce overhead at
48 + * publish time as much as possible.
49 + *
50 + * ```js
51 + * import diagnostics_channel from 'diagnostics_channel';
52 + *
53 + * const channel = diagnostics_channel.channel('my-channel');
54 + * ```
55 + * @since v15.1.0, v14.17.0
56 + * @param name The channel name
57 + * @return The named channel object
58 + */
59 + function channel(name: string): Channel;
60 + type ChannelListener = (message: unknown, name: string) => void;
61 + /**
62 + * The class `Channel` represents an individual named channel within the data
63 + * pipeline. It is use to track subscribers and to publish messages when there
64 + * are subscribers present. It exists as a separate object to avoid channel
65 + * lookups at publish time, enabling very fast publish speeds and allowing
66 + * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
67 + * with `new Channel(name)` is not supported.
68 + * @since v15.1.0, v14.17.0
69 + */
70 + class Channel {
71 + readonly name: string;
72 + /**
73 + * Check if there are active subscribers to this channel. This is helpful if
74 + * the message you want to send might be expensive to prepare.
75 + *
76 + * This API is optional but helpful when trying to publish messages from very
77 + * performance-sensitive code.
78 + *
79 + * ```js
80 + * import diagnostics_channel from 'diagnostics_channel';
81 + *
82 + * const channel = diagnostics_channel.channel('my-channel');
83 + *
84 + * if (channel.hasSubscribers) {
85 + * // There are subscribers, prepare and publish message
86 + * }
87 + * ```
88 + * @since v15.1.0, v14.17.0
89 + */
90 + readonly hasSubscribers: boolean;
91 + private constructor(name: string);
92 + /**
93 + * Publish a message to any subscribers to the channel. This will
94 + * trigger message handlers synchronously so they will execute within
95 + * the same context.
96 + *
97 + * ```js
98 + * import diagnostics_channel from 'diagnostics_channel';
99 + *
100 + * const channel = diagnostics_channel.channel('my-channel');
101 + *
102 + * channel.publish({
103 + * some: 'message'
104 + * });
105 + * ```
106 + * @since v15.1.0, v14.17.0
107 + * @param message The message to send to the channel subscribers
108 + */
109 + publish(message: unknown): void;
110 + /**
111 + * Register a message handler to subscribe to this channel. This message handler
112 + * will be run synchronously whenever a message is published to the channel. Any
113 + * errors thrown in the message handler will trigger an `'uncaughtException'`.
114 + *
115 + * ```js
116 + * import diagnostics_channel from 'diagnostics_channel';
117 + *
118 + * const channel = diagnostics_channel.channel('my-channel');
119 + *
120 + * channel.subscribe((message, name) => {
121 + * // Received data
122 + * });
123 + * ```
124 + * @since v15.1.0, v14.17.0
125 + * @param onMessage The handler to receive channel messages
126 + */
127 + subscribe(onMessage: ChannelListener): void;
128 + /**
129 + * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
130 + *
131 + * ```js
132 + * import diagnostics_channel from 'diagnostics_channel';
133 + *
134 + * const channel = diagnostics_channel.channel('my-channel');
135 + *
136 + * function onMessage(message, name) {
137 + * // Received data
138 + * }
139 + *
140 + * channel.subscribe(onMessage);
141 + *
142 + * channel.unsubscribe(onMessage);
143 + * ```
144 + * @since v15.1.0, v14.17.0
145 + * @param onMessage The previous subscribed handler to remove
146 + */
147 + unsubscribe(onMessage: ChannelListener): void;
148 + }
149 +}
150 +declare module 'node:diagnostics_channel' {
151 + export * from 'diagnostics_channel';
152 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/**
2 + * **This module is pending deprecation.** Once a replacement API has been
3 + * finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
4 + * the functionality that domains provide may rely on it for the time being
5 + * but should expect to have to migrate to a different solution
6 + * in the future.
7 + *
8 + * Domains provide a way to handle multiple different IO operations as a
9 + * single group. If any of the event emitters or callbacks registered to a
10 + * domain emit an `'error'` event, or throw an error, then the domain object
11 + * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
12 + * exit immediately with an error code.
13 + * @deprecated Since v1.4.2 - Deprecated
14 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/domain.js)
15 + */
16 +declare module 'domain' {
17 + import EventEmitter = require('node:events');
18 + /**
19 + * The `Domain` class encapsulates the functionality of routing errors and
20 + * uncaught exceptions to the active `Domain` object.
21 + *
22 + * To handle the errors that it catches, listen to its `'error'` event.
23 + */
24 + class Domain extends EventEmitter {
25 + /**
26 + * An array of timers and event emitters that have been explicitly added
27 + * to the domain.
28 + */
29 + members: Array<EventEmitter | NodeJS.Timer>;
30 + /**
31 + * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
32 + * pushes the domain onto the domain
33 + * stack managed by the domain module (see {@link exit} for details on the
34 + * domain stack). The call to `enter()` delimits the beginning of a chain of
35 + * asynchronous calls and I/O operations bound to a domain.
36 + *
37 + * Calling `enter()` changes only the active domain, and does not alter the domain
38 + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
39 + * single domain.
40 + */
41 + enter(): void;
42 + /**
43 + * The `exit()` method exits the current domain, popping it off the domain stack.
44 + * Any time execution is going to switch to the context of a different chain of
45 + * asynchronous calls, it's important to ensure that the current domain is exited.
46 + * The call to `exit()` delimits either the end of or an interruption to the chain
47 + * of asynchronous calls and I/O operations bound to a domain.
48 + *
49 + * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
50 + *
51 + * Calling `exit()` changes only the active domain, and does not alter the domain
52 + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
53 + * single domain.
54 + */
55 + exit(): void;
56 + /**
57 + * Run the supplied function in the context of the domain, implicitly
58 + * binding all event emitters, timers, and lowlevel requests that are
59 + * created in that context. Optionally, arguments can be passed to
60 + * the function.
61 + *
62 + * This is the most basic way to use a domain.
63 + *
64 + * ```js
65 + * const domain = require('domain');
66 + * const fs = require('fs');
67 + * const d = domain.create();
68 + * d.on('error', (er) => {
69 + * console.error('Caught error!', er);
70 + * });
71 + * d.run(() => {
72 + * process.nextTick(() => {
73 + * setTimeout(() => { // Simulating some various async stuff
74 + * fs.open('non-existent file', 'r', (er, fd) => {
75 + * if (er) throw er;
76 + * // proceed...
77 + * });
78 + * }, 100);
79 + * });
80 + * });
81 + * ```
82 + *
83 + * In this example, the `d.on('error')` handler will be triggered, rather
84 + * than crashing the program.
85 + */
86 + run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
87 + /**
88 + * Explicitly adds an emitter to the domain. If any event handlers called by
89 + * the emitter throw an error, or if the emitter emits an `'error'` event, it
90 + * will be routed to the domain's `'error'` event, just like with implicit
91 + * binding.
92 + *
93 + * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
94 + * the domain `'error'` handler.
95 + *
96 + * If the Timer or `EventEmitter` was already bound to a domain, it is removed
97 + * from that one, and bound to this one instead.
98 + * @param emitter emitter or timer to be added to the domain
99 + */
100 + add(emitter: EventEmitter | NodeJS.Timer): void;
101 + /**
102 + * The opposite of {@link add}. Removes domain handling from the
103 + * specified emitter.
104 + * @param emitter emitter or timer to be removed from the domain
105 + */
106 + remove(emitter: EventEmitter | NodeJS.Timer): void;
107 + /**
108 + * The returned function will be a wrapper around the supplied callback
109 + * function. When the returned function is called, any errors that are
110 + * thrown will be routed to the domain's `'error'` event.
111 + *
112 + * ```js
113 + * const d = domain.create();
114 + *
115 + * function readSomeFile(filename, cb) {
116 + * fs.readFile(filename, 'utf8', d.bind((er, data) => {
117 + * // If this throws, it will also be passed to the domain.
118 + * return cb(er, data ? JSON.parse(data) : null);
119 + * }));
120 + * }
121 + *
122 + * d.on('error', (er) => {
123 + * // An error occurred somewhere. If we throw it now, it will crash the program
124 + * // with the normal line number and stack message.
125 + * });
126 + * ```
127 + * @param callback The callback function
128 + * @return The bound function
129 + */
130 + bind<T extends Function>(callback: T): T;
131 + /**
132 + * This method is almost identical to {@link bind}. However, in
133 + * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
134 + *
135 + * In this way, the common `if (err) return callback(err);` pattern can be replaced
136 + * with a single error handler in a single place.
137 + *
138 + * ```js
139 + * const d = domain.create();
140 + *
141 + * function readSomeFile(filename, cb) {
142 + * fs.readFile(filename, 'utf8', d.intercept((data) => {
143 + * // Note, the first argument is never passed to the
144 + * // callback since it is assumed to be the 'Error' argument
145 + * // and thus intercepted by the domain.
146 + *
147 + * // If this throws, it will also be passed to the domain
148 + * // so the error-handling logic can be moved to the 'error'
149 + * // event on the domain instead of being repeated throughout
150 + * // the program.
151 + * return cb(null, JSON.parse(data));
152 + * }));
153 + * }
154 + *
155 + * d.on('error', (er) => {
156 + * // An error occurred somewhere. If we throw it now, it will crash the program
157 + * // with the normal line number and stack message.
158 + * });
159 + * ```
160 + * @param callback The callback function
161 + * @return The intercepted function
162 + */
163 + intercept<T extends Function>(callback: T): T;
164 + }
165 + function create(): Domain;
166 +}
167 +declare module 'node:domain' {
168 + export * from 'domain';
169 +}
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
1 +// Declare "static" methods in Error
2 +interface ErrorConstructor {
3 + /** Create .stack property on a target object */
4 + captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5 +
6 + /**
7 + * Optional override for formatting stack traces
8 + *
9 + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
10 + */
11 + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
12 +
13 + stackTraceLimit: number;
14 +}
15 +
16 +/*-----------------------------------------------*
17 + * *
18 + * GLOBAL *
19 + * *
20 + ------------------------------------------------*/
21 +
22 +// For backwards compability
23 +interface NodeRequire extends NodeJS.Require { }
24 +interface RequireResolve extends NodeJS.RequireResolve { }
25 +interface NodeModule extends NodeJS.Module { }
26 +
27 +declare var process: NodeJS.Process;
28 +declare var console: Console;
29 +
30 +declare var __filename: string;
31 +declare var __dirname: string;
32 +
33 +declare var require: NodeRequire;
34 +declare var module: NodeModule;
35 +
36 +// Same as module.exports
37 +declare var exports: any;
38 +
39 +/**
40 + * Only available if `--expose-gc` is passed to the process.
41 + */
42 +declare var gc: undefined | (() => void);
43 +
44 +//#region borrowed
45 +// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
46 +/** A controller object that allows you to abort one or more DOM requests as and when desired. */
47 +interface AbortController {
48 + /**
49 + * Returns the AbortSignal object associated with this object.
50 + */
51 +
52 + readonly signal: AbortSignal;
53 + /**
54 + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55 + */
56 + abort(): void;
57 +}
58 +
59 +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60 +interface AbortSignal {
61 + /**
62 + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63 + */
64 + readonly aborted: boolean;
65 +}
66 +
67 +declare var AbortController: {
68 + prototype: AbortController;
69 + new(): AbortController;
70 +};
71 +
72 +declare var AbortSignal: {
73 + prototype: AbortSignal;
74 + new(): AbortSignal;
75 + // TODO: Add abort() static
76 +};
77 +//#endregion borrowed
78 +
79 +//#region ArrayLike.at()
80 +interface RelativeIndexable<T> {
81 + /**
82 + * Takes an integer value and returns the item at that index,
83 + * allowing for positive and negative integers.
84 + * Negative integers count back from the last item in the array.
85 + */
86 + at(index: number): T | undefined;
87 +}
88 +interface String extends RelativeIndexable<string> {}
89 +interface Array<T> extends RelativeIndexable<T> {}
90 +interface Int8Array extends RelativeIndexable<number> {}
91 +interface Uint8Array extends RelativeIndexable<number> {}
92 +interface Uint8ClampedArray extends RelativeIndexable<number> {}
93 +interface Int16Array extends RelativeIndexable<number> {}
94 +interface Uint16Array extends RelativeIndexable<number> {}
95 +interface Int32Array extends RelativeIndexable<number> {}
96 +interface Uint32Array extends RelativeIndexable<number> {}
97 +interface Float32Array extends RelativeIndexable<number> {}
98 +interface Float64Array extends RelativeIndexable<number> {}
99 +interface BigInt64Array extends RelativeIndexable<bigint> {}
100 +interface BigUint64Array extends RelativeIndexable<bigint> {}
101 +//#endregion ArrayLike.at() end
102 +
103 +/**
104 + * @since v17.0.0
105 + *
106 + * Creates a deep clone of an object.
107 + */
108 +declare function structuredClone<T>(
109 + value: T,
110 + transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
111 +): T;
112 +
113 +/*----------------------------------------------*
114 +* *
115 +* GLOBAL INTERFACES *
116 +* *
117 +*-----------------------------------------------*/
118 +declare namespace NodeJS {
119 + interface CallSite {
120 + /**
121 + * Value of "this"
122 + */
123 + getThis(): unknown;
124 +
125 + /**
126 + * Type of "this" as a string.
127 + * This is the name of the function stored in the constructor field of
128 + * "this", if available. Otherwise the object's [[Class]] internal
129 + * property.
130 + */
131 + getTypeName(): string | null;
132 +
133 + /**
134 + * Current function
135 + */
136 + getFunction(): Function | undefined;
137 +
138 + /**
139 + * Name of the current function, typically its name property.
140 + * If a name property is not available an attempt will be made to try
141 + * to infer a name from the function's context.
142 + */
143 + getFunctionName(): string | null;
144 +
145 + /**
146 + * Name of the property [of "this" or one of its prototypes] that holds
147 + * the current function
148 + */
149 + getMethodName(): string | null;
150 +
151 + /**
152 + * Name of the script [if this function was defined in a script]
153 + */
154 + getFileName(): string | null;
155 +
156 + /**
157 + * Current line number [if this function was defined in a script]
158 + */
159 + getLineNumber(): number | null;
160 +
161 + /**
162 + * Current column number [if this function was defined in a script]
163 + */
164 + getColumnNumber(): number | null;
165 +
166 + /**
167 + * A call site object representing the location where eval was called
168 + * [if this function was created using a call to eval]
169 + */
170 + getEvalOrigin(): string | undefined;
171 +
172 + /**
173 + * Is this a toplevel invocation, that is, is "this" the global object?
174 + */
175 + isToplevel(): boolean;
176 +
177 + /**
178 + * Does this call take place in code defined by a call to eval?
179 + */
180 + isEval(): boolean;
181 +
182 + /**
183 + * Is this call in native V8 code?
184 + */
185 + isNative(): boolean;
186 +
187 + /**
188 + * Is this a constructor call?
189 + */
190 + isConstructor(): boolean;
191 + }
192 +
193 + interface ErrnoException extends Error {
194 + errno?: number | undefined;
195 + code?: string | undefined;
196 + path?: string | undefined;
197 + syscall?: string | undefined;
198 + }
199 +
200 + interface ReadableStream extends EventEmitter {
201 + readable: boolean;
202 + read(size?: number): string | Buffer;
203 + setEncoding(encoding: BufferEncoding): this;
204 + pause(): this;
205 + resume(): this;
206 + isPaused(): boolean;
207 + pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
208 + unpipe(destination?: WritableStream): this;
209 + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
210 + wrap(oldStream: ReadableStream): this;
211 + [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
212 + }
213 +
214 + interface WritableStream extends EventEmitter {
215 + writable: boolean;
216 + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
217 + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
218 + end(cb?: () => void): this;
219 + end(data: string | Uint8Array, cb?: () => void): this;
220 + end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
221 + }
222 +
223 + interface ReadWriteStream extends ReadableStream, WritableStream { }
224 +
225 + interface RefCounted {
226 + ref(): this;
227 + unref(): this;
228 + }
229 +
230 + type TypedArray =
231 + | Uint8Array
232 + | Uint8ClampedArray
233 + | Uint16Array
234 + | Uint32Array
235 + | Int8Array
236 + | Int16Array
237 + | Int32Array
238 + | BigUint64Array
239 + | BigInt64Array
240 + | Float32Array
241 + | Float64Array;
242 + type ArrayBufferView = TypedArray | DataView;
243 +
244 + interface Require {
245 + (id: string): any;
246 + resolve: RequireResolve;
247 + cache: Dict<NodeModule>;
248 + /**
249 + * @deprecated
250 + */
251 + extensions: RequireExtensions;
252 + main: Module | undefined;
253 + }
254 +
255 + interface RequireResolve {
256 + (id: string, options?: { paths?: string[] | undefined; }): string;
257 + paths(request: string): string[] | null;
258 + }
259 +
260 + interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
261 + '.js': (m: Module, filename: string) => any;
262 + '.json': (m: Module, filename: string) => any;
263 + '.node': (m: Module, filename: string) => any;
264 + }
265 + interface Module {
266 + /**
267 + * `true` if the module is running during the Node.js preload
268 + */
269 + isPreloading: boolean;
270 + exports: any;
271 + require: Require;
272 + id: string;
273 + filename: string;
274 + loaded: boolean;
275 + /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
276 + parent: Module | null | undefined;
277 + children: Module[];
278 + /**
279 + * @since v11.14.0
280 + *
281 + * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
282 + */
283 + path: string;
284 + paths: string[];
285 + }
286 +
287 + interface Dict<T> {
288 + [key: string]: T | undefined;
289 + }
290 +
291 + interface ReadOnlyDict<T> {
292 + readonly [key: string]: T | undefined;
293 + }
294 +}
1 +declare var global: typeof globalThis;
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
1 +// Type definitions for non-npm package Node.js 17.0
2 +// Project: https://nodejs.org/
3 +// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4 +// DefinitelyTyped <https://github.com/DefinitelyTyped>
5 +// Alberto Schiabel <https://github.com/jkomyno>
6 +// Alvis HT Tang <https://github.com/alvis>
7 +// Andrew Makarov <https://github.com/r3nya>
8 +// Benjamin Toueg <https://github.com/btoueg>
9 +// Chigozirim C. <https://github.com/smac89>
10 +// David Junger <https://github.com/touffy>
11 +// Deividas Bakanas <https://github.com/DeividasBakanas>
12 +// Eugene Y. Q. Shen <https://github.com/eyqs>
13 +// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
14 +// Huw <https://github.com/hoo29>
15 +// Kelvin Jin <https://github.com/kjin>
16 +// Klaus Meinhardt <https://github.com/ajafff>
17 +// Lishude <https://github.com/islishude>
18 +// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
19 +// Mohsen Azimi <https://github.com/mohsen1>
20 +// Nicolas Even <https://github.com/n-e>
21 +// Nikita Galkin <https://github.com/galkin>
22 +// Parambir Singh <https://github.com/parambirs>
23 +// Sebastian Silbermann <https://github.com/eps1lon>
24 +// Simon Schick <https://github.com/SimonSchick>
25 +// Thomas den Hollander <https://github.com/ThomasdenH>
26 +// Wilco Bakker <https://github.com/WilcoBakker>
27 +// wwwy3y3 <https://github.com/wwwy3y3>
28 +// Samuel Ainsworth <https://github.com/samuela>
29 +// Kyle Uehlein <https://github.com/kuehlein>
30 +// Thanik Bhongbhibhat <https://github.com/bhongy>
31 +// Marcin Kopacz <https://github.com/chyzwar>
32 +// Trivikram Kamat <https://github.com/trivikr>
33 +// Junxiao Shi <https://github.com/yoursunny>
34 +// Ilia Baryshnikov <https://github.com/qwelias>
35 +// ExE Boss <https://github.com/ExE-Boss>
36 +// Piotr Błażejewicz <https://github.com/peterblazejewicz>
37 +// Anna Henningsen <https://github.com/addaleax>
38 +// Victor Perin <https://github.com/victorperin>
39 +// Yongsheng Zhang <https://github.com/ZYSzys>
40 +// NodeJS Contributors <https://github.com/NodeJS>
41 +// Linus Unnebäck <https://github.com/LinusU>
42 +// wafuwafu13 <https://github.com/wafuwafu13>
43 +// Matteo Collina <https://github.com/mcollina>
44 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45 +
46 +/**
47 + * License for programmatically and manually incorporated
48 + * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
49 + *
50 + * Copyright Node.js contributors. All rights reserved.
51 + * Permission is hereby granted, free of charge, to any person obtaining a copy
52 + * of this software and associated documentation files (the "Software"), to
53 + * deal in the Software without restriction, including without limitation the
54 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
55 + * sell copies of the Software, and to permit persons to whom the Software is
56 + * furnished to do so, subject to the following conditions:
57 + *
58 + * The above copyright notice and this permission notice shall be included in
59 + * all copies or substantial portions of the Software.
60 + *
61 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
66 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
67 + * IN THE SOFTWARE.
68 + */
69 +
70 +// NOTE: These definitions support NodeJS and TypeScript 3.7+.
71 +
72 +// Reference required types from the default lib:
73 +/// <reference lib="es2020" />
74 +/// <reference lib="esnext.asynciterable" />
75 +/// <reference lib="esnext.intl" />
76 +/// <reference lib="esnext.bigint" />
77 +
78 +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
79 +/// <reference path="assert.d.ts" />
80 +/// <reference path="assert/strict.d.ts" />
81 +/// <reference path="globals.d.ts" />
82 +/// <reference path="async_hooks.d.ts" />
83 +/// <reference path="buffer.d.ts" />
84 +/// <reference path="child_process.d.ts" />
85 +/// <reference path="cluster.d.ts" />
86 +/// <reference path="console.d.ts" />
87 +/// <reference path="constants.d.ts" />
88 +/// <reference path="crypto.d.ts" />
89 +/// <reference path="dgram.d.ts" />
90 +/// <reference path="diagnostics_channel.d.ts" />
91 +/// <reference path="dns.d.ts" />
92 +/// <reference path="dns/promises.d.ts" />
93 +/// <reference path="dns/promises.d.ts" />
94 +/// <reference path="domain.d.ts" />
95 +/// <reference path="events.d.ts" />
96 +/// <reference path="fs.d.ts" />
97 +/// <reference path="fs/promises.d.ts" />
98 +/// <reference path="http.d.ts" />
99 +/// <reference path="http2.d.ts" />
100 +/// <reference path="https.d.ts" />
101 +/// <reference path="inspector.d.ts" />
102 +/// <reference path="module.d.ts" />
103 +/// <reference path="net.d.ts" />
104 +/// <reference path="os.d.ts" />
105 +/// <reference path="path.d.ts" />
106 +/// <reference path="perf_hooks.d.ts" />
107 +/// <reference path="process.d.ts" />
108 +/// <reference path="punycode.d.ts" />
109 +/// <reference path="querystring.d.ts" />
110 +/// <reference path="readline.d.ts" />
111 +/// <reference path="repl.d.ts" />
112 +/// <reference path="stream.d.ts" />
113 +/// <reference path="stream/promises.d.ts" />
114 +/// <reference path="stream/consumers.d.ts" />
115 +/// <reference path="stream/web.d.ts" />
116 +/// <reference path="string_decoder.d.ts" />
117 +/// <reference path="timers.d.ts" />
118 +/// <reference path="timers/promises.d.ts" />
119 +/// <reference path="tls.d.ts" />
120 +/// <reference path="trace_events.d.ts" />
121 +/// <reference path="tty.d.ts" />
122 +/// <reference path="url.d.ts" />
123 +/// <reference path="util.d.ts" />
124 +/// <reference path="v8.d.ts" />
125 +/// <reference path="vm.d.ts" />
126 +/// <reference path="wasi.d.ts" />
127 +/// <reference path="worker_threads.d.ts" />
128 +/// <reference path="zlib.d.ts" />
129 +
130 +/// <reference path="globals.global.d.ts" />
This diff could not be displayed because it is too large.
1 +/**
2 + * @since v0.3.7
3 + */
4 +declare module 'module' {
5 + import { URL } from 'node:url';
6 + namespace Module {
7 + /**
8 + * The `module.syncBuiltinESMExports()` method updates all the live bindings for
9 + * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
10 + * does not add or remove exported names from the `ES Modules`.
11 + *
12 + * ```js
13 + * const fs = require('fs');
14 + * const assert = require('assert');
15 + * const { syncBuiltinESMExports } = require('module');
16 + *
17 + * fs.readFile = newAPI;
18 + *
19 + * delete fs.readFileSync;
20 + *
21 + * function newAPI() {
22 + * // ...
23 + * }
24 + *
25 + * fs.newAPI = newAPI;
26 + *
27 + * syncBuiltinESMExports();
28 + *
29 + * import('fs').then((esmFS) => {
30 + * // It syncs the existing readFile property with the new value
31 + * assert.strictEqual(esmFS.readFile, newAPI);
32 + * // readFileSync has been deleted from the required fs
33 + * assert.strictEqual('readFileSync' in fs, false);
34 + * // syncBuiltinESMExports() does not remove readFileSync from esmFS
35 + * assert.strictEqual('readFileSync' in esmFS, true);
36 + * // syncBuiltinESMExports() does not add names
37 + * assert.strictEqual(esmFS.newAPI, undefined);
38 + * });
39 + * ```
40 + * @since v12.12.0
41 + */
42 + function syncBuiltinESMExports(): void;
43 + /**
44 + * `path` is the resolved path for the file for which a corresponding source map
45 + * should be fetched.
46 + * @since v13.7.0, v12.17.0
47 + */
48 + function findSourceMap(path: string, error?: Error): SourceMap;
49 + interface SourceMapPayload {
50 + file: string;
51 + version: number;
52 + sources: string[];
53 + sourcesContent: string[];
54 + names: string[];
55 + mappings: string;
56 + sourceRoot: string;
57 + }
58 + interface SourceMapping {
59 + generatedLine: number;
60 + generatedColumn: number;
61 + originalSource: string;
62 + originalLine: number;
63 + originalColumn: number;
64 + }
65 + /**
66 + * @since v13.7.0, v12.17.0
67 + */
68 + class SourceMap {
69 + /**
70 + * Getter for the payload used to construct the `SourceMap` instance.
71 + */
72 + readonly payload: SourceMapPayload;
73 + constructor(payload: SourceMapPayload);
74 + /**
75 + * Given a line number and column number in the generated source file, returns
76 + * an object representing the position in the original file. The object returned
77 + * consists of the following keys:
78 + */
79 + findEntry(line: number, column: number): SourceMapping;
80 + }
81 + }
82 + interface Module extends NodeModule {}
83 + class Module {
84 + static runMain(): void;
85 + static wrap(code: string): string;
86 + static createRequire(path: string | URL): NodeRequire;
87 + static builtinModules: string[];
88 + static Module: typeof Module;
89 + constructor(id: string, parent?: Module);
90 + }
91 + global {
92 + interface ImportMeta {
93 + url: string;
94 + /**
95 + * @experimental
96 + * This feature is only available with the `--experimental-import-meta-resolve`
97 + * command flag enabled.
98 + *
99 + * Provides a module-relative resolution function scoped to each module, returning
100 + * the URL string.
101 + *
102 + * @param specified The module specifier to resolve relative to `parent`.
103 + * @param parent The absolute parent module URL to resolve from. If none
104 + * is specified, the value of `import.meta.url` is used as the default.
105 + */
106 + resolve?(specified: string, parent?: string | URL): Promise<string>;
107 + }
108 + }
109 + export = Module;
110 +}
111 +declare module 'node:module' {
112 + import module = require('module');
113 + export = module;
114 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "@types/node",
3 + "version": "17.0.39",
4 + "description": "TypeScript definitions for Node.js",
5 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6 + "license": "MIT",
7 + "contributors": [
8 + {
9 + "name": "Microsoft TypeScript",
10 + "url": "https://github.com/Microsoft",
11 + "githubUsername": "Microsoft"
12 + },
13 + {
14 + "name": "DefinitelyTyped",
15 + "url": "https://github.com/DefinitelyTyped",
16 + "githubUsername": "DefinitelyTyped"
17 + },
18 + {
19 + "name": "Alberto Schiabel",
20 + "url": "https://github.com/jkomyno",
21 + "githubUsername": "jkomyno"
22 + },
23 + {
24 + "name": "Alvis HT Tang",
25 + "url": "https://github.com/alvis",
26 + "githubUsername": "alvis"
27 + },
28 + {
29 + "name": "Andrew Makarov",
30 + "url": "https://github.com/r3nya",
31 + "githubUsername": "r3nya"
32 + },
33 + {
34 + "name": "Benjamin Toueg",
35 + "url": "https://github.com/btoueg",
36 + "githubUsername": "btoueg"
37 + },
38 + {
39 + "name": "Chigozirim C.",
40 + "url": "https://github.com/smac89",
41 + "githubUsername": "smac89"
42 + },
43 + {
44 + "name": "David Junger",
45 + "url": "https://github.com/touffy",
46 + "githubUsername": "touffy"
47 + },
48 + {
49 + "name": "Deividas Bakanas",
50 + "url": "https://github.com/DeividasBakanas",
51 + "githubUsername": "DeividasBakanas"
52 + },
53 + {
54 + "name": "Eugene Y. Q. Shen",
55 + "url": "https://github.com/eyqs",
56 + "githubUsername": "eyqs"
57 + },
58 + {
59 + "name": "Hannes Magnusson",
60 + "url": "https://github.com/Hannes-Magnusson-CK",
61 + "githubUsername": "Hannes-Magnusson-CK"
62 + },
63 + {
64 + "name": "Huw",
65 + "url": "https://github.com/hoo29",
66 + "githubUsername": "hoo29"
67 + },
68 + {
69 + "name": "Kelvin Jin",
70 + "url": "https://github.com/kjin",
71 + "githubUsername": "kjin"
72 + },
73 + {
74 + "name": "Klaus Meinhardt",
75 + "url": "https://github.com/ajafff",
76 + "githubUsername": "ajafff"
77 + },
78 + {
79 + "name": "Lishude",
80 + "url": "https://github.com/islishude",
81 + "githubUsername": "islishude"
82 + },
83 + {
84 + "name": "Mariusz Wiktorczyk",
85 + "url": "https://github.com/mwiktorczyk",
86 + "githubUsername": "mwiktorczyk"
87 + },
88 + {
89 + "name": "Mohsen Azimi",
90 + "url": "https://github.com/mohsen1",
91 + "githubUsername": "mohsen1"
92 + },
93 + {
94 + "name": "Nicolas Even",
95 + "url": "https://github.com/n-e",
96 + "githubUsername": "n-e"
97 + },
98 + {
99 + "name": "Nikita Galkin",
100 + "url": "https://github.com/galkin",
101 + "githubUsername": "galkin"
102 + },
103 + {
104 + "name": "Parambir Singh",
105 + "url": "https://github.com/parambirs",
106 + "githubUsername": "parambirs"
107 + },
108 + {
109 + "name": "Sebastian Silbermann",
110 + "url": "https://github.com/eps1lon",
111 + "githubUsername": "eps1lon"
112 + },
113 + {
114 + "name": "Simon Schick",
115 + "url": "https://github.com/SimonSchick",
116 + "githubUsername": "SimonSchick"
117 + },
118 + {
119 + "name": "Thomas den Hollander",
120 + "url": "https://github.com/ThomasdenH",
121 + "githubUsername": "ThomasdenH"
122 + },
123 + {
124 + "name": "Wilco Bakker",
125 + "url": "https://github.com/WilcoBakker",
126 + "githubUsername": "WilcoBakker"
127 + },
128 + {
129 + "name": "wwwy3y3",
130 + "url": "https://github.com/wwwy3y3",
131 + "githubUsername": "wwwy3y3"
132 + },
133 + {
134 + "name": "Samuel Ainsworth",
135 + "url": "https://github.com/samuela",
136 + "githubUsername": "samuela"
137 + },
138 + {
139 + "name": "Kyle Uehlein",
140 + "url": "https://github.com/kuehlein",
141 + "githubUsername": "kuehlein"
142 + },
143 + {
144 + "name": "Thanik Bhongbhibhat",
145 + "url": "https://github.com/bhongy",
146 + "githubUsername": "bhongy"
147 + },
148 + {
149 + "name": "Marcin Kopacz",
150 + "url": "https://github.com/chyzwar",
151 + "githubUsername": "chyzwar"
152 + },
153 + {
154 + "name": "Trivikram Kamat",
155 + "url": "https://github.com/trivikr",
156 + "githubUsername": "trivikr"
157 + },
158 + {
159 + "name": "Junxiao Shi",
160 + "url": "https://github.com/yoursunny",
161 + "githubUsername": "yoursunny"
162 + },
163 + {
164 + "name": "Ilia Baryshnikov",
165 + "url": "https://github.com/qwelias",
166 + "githubUsername": "qwelias"
167 + },
168 + {
169 + "name": "ExE Boss",
170 + "url": "https://github.com/ExE-Boss",
171 + "githubUsername": "ExE-Boss"
172 + },
173 + {
174 + "name": "Piotr Błażejewicz",
175 + "url": "https://github.com/peterblazejewicz",
176 + "githubUsername": "peterblazejewicz"
177 + },
178 + {
179 + "name": "Anna Henningsen",
180 + "url": "https://github.com/addaleax",
181 + "githubUsername": "addaleax"
182 + },
183 + {
184 + "name": "Victor Perin",
185 + "url": "https://github.com/victorperin",
186 + "githubUsername": "victorperin"
187 + },
188 + {
189 + "name": "Yongsheng Zhang",
190 + "url": "https://github.com/ZYSzys",
191 + "githubUsername": "ZYSzys"
192 + },
193 + {
194 + "name": "NodeJS Contributors",
195 + "url": "https://github.com/NodeJS",
196 + "githubUsername": "NodeJS"
197 + },
198 + {
199 + "name": "Linus Unnebäck",
200 + "url": "https://github.com/LinusU",
201 + "githubUsername": "LinusU"
202 + },
203 + {
204 + "name": "wafuwafu13",
205 + "url": "https://github.com/wafuwafu13",
206 + "githubUsername": "wafuwafu13"
207 + },
208 + {
209 + "name": "Matteo Collina",
210 + "url": "https://github.com/mcollina",
211 + "githubUsername": "mcollina"
212 + }
213 + ],
214 + "main": "",
215 + "types": "index.d.ts",
216 + "repository": {
217 + "type": "git",
218 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
219 + "directory": "types/node"
220 + },
221 + "scripts": {},
222 + "dependencies": {},
223 + "typesPublisherContentHash": "00f1dfb6e5a94cedae70d7698ad5bc42913c4de9bbe4415de9fe047fcdb25971",
224 + "typeScriptVersion": "3.9"
225 +}
...\ No newline at end of file ...\ No newline at end of file
1 +declare module 'path/posix' {
2 + import path = require('path');
3 + export = path;
4 +}
5 +declare module 'path/win32' {
6 + import path = require('path');
7 + export = path;
8 +}
9 +/**
10 + * The `path` module provides utilities for working with file and directory paths.
11 + * It can be accessed using:
12 + *
13 + * ```js
14 + * const path = require('path');
15 + * ```
16 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/path.js)
17 + */
18 +declare module 'path' {
19 + namespace path {
20 + /**
21 + * A parsed path object generated by path.parse() or consumed by path.format().
22 + */
23 + interface ParsedPath {
24 + /**
25 + * The root of the path such as '/' or 'c:\'
26 + */
27 + root: string;
28 + /**
29 + * The full directory path such as '/home/user/dir' or 'c:\path\dir'
30 + */
31 + dir: string;
32 + /**
33 + * The file name including extension (if any) such as 'index.html'
34 + */
35 + base: string;
36 + /**
37 + * The file extension (if any) such as '.html'
38 + */
39 + ext: string;
40 + /**
41 + * The file name without extension (if any) such as 'index'
42 + */
43 + name: string;
44 + }
45 + interface FormatInputPathObject {
46 + /**
47 + * The root of the path such as '/' or 'c:\'
48 + */
49 + root?: string | undefined;
50 + /**
51 + * The full directory path such as '/home/user/dir' or 'c:\path\dir'
52 + */
53 + dir?: string | undefined;
54 + /**
55 + * The file name including extension (if any) such as 'index.html'
56 + */
57 + base?: string | undefined;
58 + /**
59 + * The file extension (if any) such as '.html'
60 + */
61 + ext?: string | undefined;
62 + /**
63 + * The file name without extension (if any) such as 'index'
64 + */
65 + name?: string | undefined;
66 + }
67 + interface PlatformPath {
68 + /**
69 + * Normalize a string path, reducing '..' and '.' parts.
70 + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
71 + *
72 + * @param p string path to normalize.
73 + */
74 + normalize(p: string): string;
75 + /**
76 + * Join all arguments together and normalize the resulting path.
77 + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
78 + *
79 + * @param paths paths to join.
80 + */
81 + join(...paths: string[]): string;
82 + /**
83 + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
84 + *
85 + * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
86 + *
87 + * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
88 + * until an absolute path is found. If after using all {from} paths still no absolute path is found,
89 + * the current working directory is used as well. The resulting path is normalized,
90 + * and trailing slashes are removed unless the path gets resolved to the root directory.
91 + *
92 + * @param pathSegments string paths to join. Non-string arguments are ignored.
93 + */
94 + resolve(...pathSegments: string[]): string;
95 + /**
96 + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
97 + *
98 + * @param path path to test.
99 + */
100 + isAbsolute(p: string): boolean;
101 + /**
102 + * Solve the relative path from {from} to {to}.
103 + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
104 + */
105 + relative(from: string, to: string): string;
106 + /**
107 + * Return the directory name of a path. Similar to the Unix dirname command.
108 + *
109 + * @param p the path to evaluate.
110 + */
111 + dirname(p: string): string;
112 + /**
113 + * Return the last portion of a path. Similar to the Unix basename command.
114 + * Often used to extract the file name from a fully qualified path.
115 + *
116 + * @param p the path to evaluate.
117 + * @param ext optionally, an extension to remove from the result.
118 + */
119 + basename(p: string, ext?: string): string;
120 + /**
121 + * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
122 + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
123 + *
124 + * @param p the path to evaluate.
125 + */
126 + extname(p: string): string;
127 + /**
128 + * The platform-specific file separator. '\\' or '/'.
129 + */
130 + readonly sep: string;
131 + /**
132 + * The platform-specific file delimiter. ';' or ':'.
133 + */
134 + readonly delimiter: string;
135 + /**
136 + * Returns an object from a path string - the opposite of format().
137 + *
138 + * @param pathString path to evaluate.
139 + */
140 + parse(p: string): ParsedPath;
141 + /**
142 + * Returns a path string from an object - the opposite of parse().
143 + *
144 + * @param pathString path to evaluate.
145 + */
146 + format(pP: FormatInputPathObject): string;
147 + /**
148 + * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
149 + * If path is not a string, path will be returned without modifications.
150 + * This method is meaningful only on Windows system.
151 + * On POSIX systems, the method is non-operational and always returns path without modifications.
152 + */
153 + toNamespacedPath(path: string): string;
154 + /**
155 + * Posix specific pathing.
156 + * Same as parent object on posix.
157 + */
158 + readonly posix: PlatformPath;
159 + /**
160 + * Windows specific pathing.
161 + * Same as parent object on windows
162 + */
163 + readonly win32: PlatformPath;
164 + }
165 + }
166 + const path: path.PlatformPath;
167 + export = path;
168 +}
169 +declare module 'node:path' {
170 + import path = require('path');
171 + export = path;
172 +}
173 +declare module 'node:path/posix' {
174 + import path = require('path/posix');
175 + export = path;
176 +}
177 +declare module 'node:path/win32' {
178 + import path = require('path/win32');
179 + export = path;
180 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/**
2 + * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users
3 + * currently depending on the `punycode` module should switch to using the
4 + * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
5 + * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
6 + *
7 + * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
8 + * can be accessed using:
9 + *
10 + * ```js
11 + * const punycode = require('punycode');
12 + * ```
13 + *
14 + * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
15 + * primarily intended for use in Internationalized Domain Names. Because host
16 + * names in URLs are limited to ASCII characters only, Domain Names that contain
17 + * non-ASCII characters must be converted into ASCII using the Punycode scheme.
18 + * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
19 + * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`.
20 + *
21 + * The `punycode` module provides a simple implementation of the Punycode standard.
22 + *
23 + * The `punycode` module is a third-party dependency used by Node.js and
24 + * made available to developers as a convenience. Fixes or other modifications to
25 + * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
26 + * @deprecated Since v7.0.0 - Deprecated
27 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/punycode.js)
28 + */
29 +declare module 'punycode' {
30 + /**
31 + * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
32 + * characters to the equivalent string of Unicode codepoints.
33 + *
34 + * ```js
35 + * punycode.decode('maana-pta'); // 'mañana'
36 + * punycode.decode('--dqo34k'); // '☃-⌘'
37 + * ```
38 + * @since v0.5.1
39 + */
40 + function decode(string: string): string;
41 + /**
42 + * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
43 + *
44 + * ```js
45 + * punycode.encode('mañana'); // 'maana-pta'
46 + * punycode.encode('☃-⌘'); // '--dqo34k'
47 + * ```
48 + * @since v0.5.1
49 + */
50 + function encode(string: string): string;
51 + /**
52 + * The `punycode.toUnicode()` method converts a string representing a domain name
53 + * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be
54 + * converted.
55 + *
56 + * ```js
57 + * // decode domain names
58 + * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
59 + * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'
60 + * punycode.toUnicode('example.com'); // 'example.com'
61 + * ```
62 + * @since v0.6.1
63 + */
64 + function toUnicode(domain: string): string;
65 + /**
66 + * The `punycode.toASCII()` method converts a Unicode string representing an
67 + * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the
68 + * domain name will be converted. Calling `punycode.toASCII()` on a string that
69 + * already only contains ASCII characters will have no effect.
70 + *
71 + * ```js
72 + * // encode domain names
73 + * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com'
74 + * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'
75 + * punycode.toASCII('example.com'); // 'example.com'
76 + * ```
77 + * @since v0.6.1
78 + */
79 + function toASCII(domain: string): string;
80 + /**
81 + * @deprecated since v7.0.0
82 + * The version of the punycode module bundled in Node.js is being deprecated.
83 + * In a future major version of Node.js this module will be removed.
84 + * Users currently depending on the punycode module should switch to using
85 + * the userland-provided Punycode.js module instead.
86 + */
87 + const ucs2: ucs2;
88 + interface ucs2 {
89 + /**
90 + * @deprecated since v7.0.0
91 + * The version of the punycode module bundled in Node.js is being deprecated.
92 + * In a future major version of Node.js this module will be removed.
93 + * Users currently depending on the punycode module should switch to using
94 + * the userland-provided Punycode.js module instead.
95 + */
96 + decode(string: string): number[];
97 + /**
98 + * @deprecated since v7.0.0
99 + * The version of the punycode module bundled in Node.js is being deprecated.
100 + * In a future major version of Node.js this module will be removed.
101 + * Users currently depending on the punycode module should switch to using
102 + * the userland-provided Punycode.js module instead.
103 + */
104 + encode(codePoints: ReadonlyArray<number>): string;
105 + }
106 + /**
107 + * @deprecated since v7.0.0
108 + * The version of the punycode module bundled in Node.js is being deprecated.
109 + * In a future major version of Node.js this module will be removed.
110 + * Users currently depending on the punycode module should switch to using
111 + * the userland-provided Punycode.js module instead.
112 + */
113 + const version: string;
114 +}
115 +declare module 'node:punycode' {
116 + export * from 'punycode';
117 +}
1 +/**
2 + * The `querystring` module provides utilities for parsing and formatting URL
3 + * query strings. It can be accessed using:
4 + *
5 + * ```js
6 + * const querystring = require('querystring');
7 + * ```
8 + *
9 + * The `querystring` API is considered Legacy. While it is still maintained,
10 + * new code should use the `URLSearchParams` API instead.
11 + * @deprecated Legacy
12 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/querystring.js)
13 + */
14 +declare module 'querystring' {
15 + interface StringifyOptions {
16 + encodeURIComponent?: ((str: string) => string) | undefined;
17 + }
18 + interface ParseOptions {
19 + maxKeys?: number | undefined;
20 + decodeURIComponent?: ((str: string) => string) | undefined;
21 + }
22 + interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
23 + interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
24 + /**
25 + * The `querystring.stringify()` method produces a URL query string from a
26 + * given `obj` by iterating through the object's "own properties".
27 + *
28 + * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
29 + * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
30 + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
31 + * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
32 + * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
33 + * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
34 + * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
35 + * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
36 + * empty strings.
37 + *
38 + * ```js
39 + * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
40 + * // Returns 'foo=bar&#x26;baz=qux&#x26;baz=quux&#x26;corge='
41 + *
42 + * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
43 + * // Returns 'foo:bar;baz:qux'
44 + * ```
45 + *
46 + * By default, characters requiring percent-encoding within the query string will
47 + * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
48 + *
49 + * ```js
50 + * // Assuming gbkEncodeURIComponent function already exists,
51 + *
52 + * querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
53 + * { encodeURIComponent: gbkEncodeURIComponent });
54 + * ```
55 + * @since v0.1.25
56 + * @param obj The object to serialize into a URL query string
57 + * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
58 + * @param [eq='='] . The substring used to delimit keys and values in the query string.
59 + */
60 + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
61 + /**
62 + * The `querystring.parse()` method parses a URL query string (`str`) into a
63 + * collection of key and value pairs.
64 + *
65 + * For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
66 + *
67 + * ```js
68 + * {
69 + * foo: 'bar',
70 + * abc: ['xyz', '123']
71 + * }
72 + * ```
73 + *
74 + * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
75 + * `obj.hasOwnProperty()`, and others
76 + * are not defined and _will not work_.
77 + *
78 + * By default, percent-encoded characters within the query string will be assumed
79 + * to use UTF-8 encoding. If an alternative character encoding is used, then an
80 + * alternative `decodeURIComponent` option will need to be specified:
81 + *
82 + * ```js
83 + * // Assuming gbkDecodeURIComponent function already exists...
84 + *
85 + * querystring.parse('w=%D6%D0%CE%C4&#x26;foo=bar', null, null,
86 + * { decodeURIComponent: gbkDecodeURIComponent });
87 + * ```
88 + * @since v0.1.25
89 + * @param str The URL query string to parse
90 + * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
91 + * @param [eq='='] . The substring used to delimit keys and values in the query string.
92 + */
93 + function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
94 + /**
95 + * The querystring.encode() function is an alias for querystring.stringify().
96 + */
97 + const encode: typeof stringify;
98 + /**
99 + * The querystring.decode() function is an alias for querystring.parse().
100 + */
101 + const decode: typeof parse;
102 + /**
103 + * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
104 + * query strings.
105 + *
106 + * The `querystring.escape()` method is used by `querystring.stringify()` and is
107 + * generally not expected to be used directly. It is exported primarily to allow
108 + * application code to provide a replacement percent-encoding implementation if
109 + * necessary by assigning `querystring.escape` to an alternative function.
110 + * @since v0.1.25
111 + */
112 + function escape(str: string): string;
113 + /**
114 + * The `querystring.unescape()` method performs decoding of URL percent-encoded
115 + * characters on the given `str`.
116 + *
117 + * The `querystring.unescape()` method is used by `querystring.parse()` and is
118 + * generally not expected to be used directly. It is exported primarily to allow
119 + * application code to provide a replacement decoding implementation if
120 + * necessary by assigning `querystring.unescape` to an alternative function.
121 + *
122 + * By default, the `querystring.unescape()` method will attempt to use the
123 + * JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
124 + * a safer equivalent that does not throw on malformed URLs will be used.
125 + * @since v0.1.25
126 + */
127 + function unescape(str: string): string;
128 +}
129 +declare module 'node:querystring' {
130 + export * from 'querystring';
131 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +// Duplicates of interface in lib.dom.ts.
2 +// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
3 +// Which in turn causes tests to pass that shouldn't pass.
4 +//
5 +// This interface is not, and should not be, exported.
6 +interface Blob {
7 + readonly size: number;
8 + readonly type: string;
9 + arrayBuffer(): Promise<ArrayBuffer>;
10 + slice(start?: number, end?: number, contentType?: string): Blob;
11 + stream(): NodeJS.ReadableStream;
12 + text(): Promise<string>;
13 +}
14 +declare module 'stream/consumers' {
15 + import { Readable } from 'node:stream';
16 + function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
17 + function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
18 + function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
19 + function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
20 + function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
21 +}
22 +declare module 'node:stream/consumers' {
23 + export * from 'stream/consumers';
24 +}
1 +declare module 'stream/promises' {
2 + import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
3 + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
4 + function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
5 + function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
6 + source: A,
7 + transform1: T1,
8 + destination: B,
9 + options?: PipelineOptions
10 + ): PipelinePromise<B>;
11 + function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
12 + source: A,
13 + transform1: T1,
14 + transform2: T2,
15 + destination: B,
16 + options?: PipelineOptions
17 + ): PipelinePromise<B>;
18 + function pipeline<
19 + A extends PipelineSource<any>,
20 + T1 extends PipelineTransform<A, any>,
21 + T2 extends PipelineTransform<T1, any>,
22 + T3 extends PipelineTransform<T2, any>,
23 + B extends PipelineDestination<T3, any>
24 + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
25 + function pipeline<
26 + A extends PipelineSource<any>,
27 + T1 extends PipelineTransform<A, any>,
28 + T2 extends PipelineTransform<T1, any>,
29 + T3 extends PipelineTransform<T2, any>,
30 + T4 extends PipelineTransform<T3, any>,
31 + B extends PipelineDestination<T4, any>
32 + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
33 + function pipeline(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
34 + function pipeline(
35 + stream1: NodeJS.ReadableStream,
36 + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
37 + ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
38 + ): Promise<void>;
39 +}
40 +declare module 'node:stream/promises' {
41 + export * from 'stream/promises';
42 +}
This diff is collapsed. Click to expand it.
1 +/**
2 + * The `string_decoder` module provides an API for decoding `Buffer` objects into
3 + * strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
4 + * characters. It can be accessed using:
5 + *
6 + * ```js
7 + * const { StringDecoder } = require('string_decoder');
8 + * ```
9 + *
10 + * The following example shows the basic use of the `StringDecoder` class.
11 + *
12 + * ```js
13 + * const { StringDecoder } = require('string_decoder');
14 + * const decoder = new StringDecoder('utf8');
15 + *
16 + * const cent = Buffer.from([0xC2, 0xA2]);
17 + * console.log(decoder.write(cent));
18 + *
19 + * const euro = Buffer.from([0xE2, 0x82, 0xAC]);
20 + * console.log(decoder.write(euro));
21 + * ```
22 + *
23 + * When a `Buffer` instance is written to the `StringDecoder` instance, an
24 + * internal buffer is used to ensure that the decoded string does not contain
25 + * any incomplete multibyte characters. These are held in the buffer until the
26 + * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
27 + *
28 + * In the following example, the three UTF-8 encoded bytes of the European Euro
29 + * symbol (`€`) are written over three separate operations:
30 + *
31 + * ```js
32 + * const { StringDecoder } = require('string_decoder');
33 + * const decoder = new StringDecoder('utf8');
34 + *
35 + * decoder.write(Buffer.from([0xE2]));
36 + * decoder.write(Buffer.from([0x82]));
37 + * console.log(decoder.end(Buffer.from([0xAC])));
38 + * ```
39 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/string_decoder.js)
40 + */
41 +declare module 'string_decoder' {
42 + class StringDecoder {
43 + constructor(encoding?: BufferEncoding);
44 + /**
45 + * Returns a decoded string, ensuring that any incomplete multibyte characters at
46 + * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
47 + * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
48 + * @since v0.1.99
49 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
50 + */
51 + write(buffer: Buffer): string;
52 + /**
53 + * Returns any remaining input stored in the internal buffer as a string. Bytes
54 + * representing incomplete UTF-8 and UTF-16 characters will be replaced with
55 + * substitution characters appropriate for the character encoding.
56 + *
57 + * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
58 + * After `end()` is called, the `stringDecoder` object can be reused for new input.
59 + * @since v0.9.3
60 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
61 + */
62 + end(buffer?: Buffer): string;
63 + }
64 +}
65 +declare module 'node:string_decoder' {
66 + export * from 'string_decoder';
67 +}
1 +/**
2 + * The `timer` module exposes a global API for scheduling functions to
3 + * be called at some future period of time. Because the timer functions are
4 + * globals, there is no need to call `require('timers')` to use the API.
5 + *
6 + * The timer functions within Node.js implement a similar API as the timers API
7 + * provided by Web Browsers but use a different internal implementation that is
8 + * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
9 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/timers.js)
10 + */
11 +declare module 'timers' {
12 + import { Abortable } from 'node:events';
13 + import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
14 + interface TimerOptions extends Abortable {
15 + /**
16 + * Set to `false` to indicate that the scheduled `Timeout`
17 + * should not require the Node.js event loop to remain active.
18 + * @default true
19 + */
20 + ref?: boolean | undefined;
21 + }
22 + let setTimeout: typeof global.setTimeout;
23 + let clearTimeout: typeof global.clearTimeout;
24 + let setInterval: typeof global.setInterval;
25 + let clearInterval: typeof global.clearInterval;
26 + let setImmediate: typeof global.setImmediate;
27 + let clearImmediate: typeof global.clearImmediate;
28 + global {
29 + namespace NodeJS {
30 + // compatibility with older typings
31 + interface Timer extends RefCounted {
32 + hasRef(): boolean;
33 + refresh(): this;
34 + [Symbol.toPrimitive](): number;
35 + }
36 + interface Immediate extends RefCounted {
37 + /**
38 + * If true, the `Immediate` object will keep the Node.js event loop active.
39 + * @since v11.0.0
40 + */
41 + hasRef(): boolean;
42 + _onImmediate: Function; // to distinguish it from the Timeout class
43 + }
44 + interface Timeout extends Timer {
45 + /**
46 + * If true, the `Timeout` object will keep the Node.js event loop active.
47 + * @since v11.0.0
48 + */
49 + hasRef(): boolean;
50 + /**
51 + * Sets the timer's start time to the current time, and reschedules the timer to
52 + * call its callback at the previously specified duration adjusted to the current
53 + * time. This is useful for refreshing a timer without allocating a new
54 + * JavaScript object.
55 + *
56 + * Using this on a timer that has already called its callback will reactivate the
57 + * timer.
58 + * @since v10.2.0
59 + * @return a reference to `timeout`
60 + */
61 + refresh(): this;
62 + [Symbol.toPrimitive](): number;
63 + }
64 + }
65 + function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
66 + // util.promisify no rest args compability
67 + // tslint:disable-next-line void-return
68 + function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
69 + namespace setTimeout {
70 + const __promisify__: typeof setTimeoutPromise;
71 + }
72 + function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
73 + function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
74 + // util.promisify no rest args compability
75 + // tslint:disable-next-line void-return
76 + function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
77 + namespace setInterval {
78 + const __promisify__: typeof setIntervalPromise;
79 + }
80 + function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
81 + function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
82 + // util.promisify no rest args compability
83 + // tslint:disable-next-line void-return
84 + function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
85 + namespace setImmediate {
86 + const __promisify__: typeof setImmediatePromise;
87 + }
88 + function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
89 + function queueMicrotask(callback: () => void): void;
90 + }
91 +}
92 +declare module 'node:timers' {
93 + export * from 'timers';
94 +}
1 +/**
2 + * The `timers/promises` API provides an alternative set of timer functions
3 + * that return `Promise` objects. The API is accessible via`require('timers/promises')`.
4 + *
5 + * ```js
6 + * import {
7 + * setTimeout,
8 + * setImmediate,
9 + * setInterval,
10 + * } from 'timers/promises';
11 + * ```
12 + * @since v15.0.0
13 + */
14 +declare module 'timers/promises' {
15 + import { TimerOptions } from 'node:timers';
16 + /**
17 + * ```js
18 + * import {
19 + * setTimeout,
20 + * } from 'timers/promises';
21 + *
22 + * const res = await setTimeout(100, 'result');
23 + *
24 + * console.log(res); // Prints 'result'
25 + * ```
26 + * @since v15.0.0
27 + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
28 + * @param value A value with which the promise is fulfilled.
29 + */
30 + function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
31 + /**
32 + * ```js
33 + * import {
34 + * setImmediate,
35 + * } from 'timers/promises';
36 + *
37 + * const res = await setImmediate('result');
38 + *
39 + * console.log(res); // Prints 'result'
40 + * ```
41 + * @since v15.0.0
42 + * @param value A value with which the promise is fulfilled.
43 + */
44 + function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
45 + /**
46 + * Returns an async iterator that generates values in an interval of `delay` ms.
47 + *
48 + * ```js
49 + * import {
50 + * setInterval,
51 + * } from 'timers/promises';
52 + *
53 + * const interval = 100;
54 + * for await (const startTime of setInterval(interval, Date.now())) {
55 + * const now = Date.now();
56 + * console.log(now);
57 + * if ((now - startTime) > 1000)
58 + * break;
59 + * }
60 + * console.log(Date.now());
61 + * ```
62 + * @since v15.9.0
63 + */
64 + function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
65 +}
66 +declare module 'node:timers/promises' {
67 + export * from 'timers/promises';
68 +}
This diff is collapsed. Click to expand it.
1 +/**
2 + * The `trace_events` module provides a mechanism to centralize tracing information
3 + * generated by V8, Node.js core, and userspace code.
4 + *
5 + * Tracing can be enabled with the `--trace-event-categories` command-line flag
6 + * or by using the `trace_events` module. The `--trace-event-categories` flag
7 + * accepts a list of comma-separated category names.
8 + *
9 + * The available categories are:
10 + *
11 + * * `node`: An empty placeholder.
12 + * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data.
13 + * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
14 + * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
15 + * * `node.console`: Enables capture of `console.time()` and `console.count()`output.
16 + * * `node.dns.native`: Enables capture of trace data for DNS queries.
17 + * * `node.environment`: Enables capture of Node.js Environment milestones.
18 + * * `node.fs.sync`: Enables capture of trace data for file system sync methods.
19 + * * `node.perf`: Enables capture of `Performance API` measurements.
20 + * * `node.perf.usertiming`: Enables capture of only Performance API User Timing
21 + * measures and marks.
22 + * * `node.perf.timerify`: Enables capture of only Performance API timerify
23 + * measurements.
24 + * * `node.promises.rejections`: Enables capture of trace data tracking the number
25 + * of unhandled Promise rejections and handled-after-rejections.
26 + * * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
27 + * * `v8`: The `V8` events are GC, compiling, and execution related.
28 + *
29 + * By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
30 + *
31 + * ```bash
32 + * node --trace-event-categories v8,node,node.async_hooks server.js
33 + * ```
34 + *
35 + * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be
36 + * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default.
37 + *
38 + * ```bash
39 + * node --trace-events-enabled
40 + *
41 + * # is equivalent to
42 + *
43 + * node --trace-event-categories v8,node,node.async_hooks
44 + * ```
45 + *
46 + * Alternatively, trace events may be enabled using the `trace_events` module:
47 + *
48 + * ```js
49 + * const trace_events = require('trace_events');
50 + * const tracing = trace_events.createTracing({ categories: ['node.perf'] });
51 + * tracing.enable(); // Enable trace event capture for the 'node.perf' category
52 + *
53 + * // do work
54 + *
55 + * tracing.disable(); // Disable trace event capture for the 'node.perf' category
56 + * ```
57 + *
58 + * Running Node.js with tracing enabled will produce log files that can be opened
59 + * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
60 + *
61 + * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
62 + * be specified with `--trace-event-file-pattern` that accepts a template
63 + * string that supports `${rotation}` and `${pid}`:
64 + *
65 + * ```bash
66 + * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
67 + * ```
68 + *
69 + * The tracing system uses the same time source
70 + * as the one used by `process.hrtime()`.
71 + * However the trace-event timestamps are expressed in microseconds,
72 + * unlike `process.hrtime()` which returns nanoseconds.
73 + *
74 + * The features from this module are not available in `Worker` threads.
75 + * @experimental
76 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/trace_events.js)
77 + */
78 +declare module 'trace_events' {
79 + /**
80 + * The `Tracing` object is used to enable or disable tracing for sets of
81 + * categories. Instances are created using the
82 + * `trace_events.createTracing()` method.
83 + *
84 + * When created, the `Tracing` object is disabled. Calling the
85 + * `tracing.enable()` method adds the categories to the set of enabled trace
86 + * event categories. Calling `tracing.disable()` will remove the categories
87 + * from the set of enabled trace event categories.
88 + */
89 + interface Tracing {
90 + /**
91 + * A comma-separated list of the trace event categories covered by this
92 + * `Tracing` object.
93 + */
94 + readonly categories: string;
95 + /**
96 + * Disables this `Tracing` object.
97 + *
98 + * Only trace event categories _not_ covered by other enabled `Tracing`
99 + * objects and _not_ specified by the `--trace-event-categories` flag
100 + * will be disabled.
101 + */
102 + disable(): void;
103 + /**
104 + * Enables this `Tracing` object for the set of categories covered by
105 + * the `Tracing` object.
106 + */
107 + enable(): void;
108 + /**
109 + * `true` only if the `Tracing` object has been enabled.
110 + */
111 + readonly enabled: boolean;
112 + }
113 + interface CreateTracingOptions {
114 + /**
115 + * An array of trace category names. Values included in the array are
116 + * coerced to a string when possible. An error will be thrown if the
117 + * value cannot be coerced.
118 + */
119 + categories: string[];
120 + }
121 + /**
122 + * Creates and returns a `Tracing` object for the given set of `categories`.
123 + *
124 + * ```js
125 + * const trace_events = require('trace_events');
126 + * const categories = ['node.perf', 'node.async_hooks'];
127 + * const tracing = trace_events.createTracing({ categories });
128 + * tracing.enable();
129 + * // do stuff
130 + * tracing.disable();
131 + * ```
132 + * @since v10.0.0
133 + * @return .
134 + */
135 + function createTracing(options: CreateTracingOptions): Tracing;
136 + /**
137 + * Returns a comma-separated list of all currently-enabled trace event
138 + * categories. The current set of enabled trace event categories is determined
139 + * by the _union_ of all currently-enabled `Tracing` objects and any categories
140 + * enabled using the `--trace-event-categories` flag.
141 + *
142 + * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
143 + *
144 + * ```js
145 + * const trace_events = require('trace_events');
146 + * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
147 + * const t2 = trace_events.createTracing({ categories: ['node.perf'] });
148 + * const t3 = trace_events.createTracing({ categories: ['v8'] });
149 + *
150 + * t1.enable();
151 + * t2.enable();
152 + *
153 + * console.log(trace_events.getEnabledCategories());
154 + * ```
155 + * @since v10.0.0
156 + */
157 + function getEnabledCategories(): string | undefined;
158 +}
159 +declare module 'node:trace_events' {
160 + export * from 'trace_events';
161 +}
1 +/**
2 + * The `tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes.
3 + * In most cases, it will not be necessary or possible to use this module directly.
4 + * However, it can be accessed using:
5 + *
6 + * ```js
7 + * const tty = require('tty');
8 + * ```
9 + *
10 + * When Node.js detects that it is being run with a text terminal ("TTY")
11 + * attached, `process.stdin` will, by default, be initialized as an instance of`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
12 + * default, be instances of `tty.WriteStream`. The preferred method of determining
13 + * whether Node.js is being run within a TTY context is to check that the value of
14 + * the `process.stdout.isTTY` property is `true`:
15 + *
16 + * ```console
17 + * $ node -p -e "Boolean(process.stdout.isTTY)"
18 + * true
19 + * $ node -p -e "Boolean(process.stdout.isTTY)" | cat
20 + * false
21 + * ```
22 + *
23 + * In most cases, there should be little to no reason for an application to
24 + * manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
25 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/tty.js)
26 + */
27 +declare module 'tty' {
28 + import * as net from 'node:net';
29 + /**
30 + * The `tty.isatty()` method returns `true` if the given `fd` is associated with
31 + * a TTY and `false` if it is not, including whenever `fd` is not a non-negative
32 + * integer.
33 + * @since v0.5.8
34 + * @param fd A numeric file descriptor
35 + */
36 + function isatty(fd: number): boolean;
37 + /**
38 + * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js
39 + * process and there should be no reason to create additional instances.
40 + * @since v0.5.8
41 + */
42 + class ReadStream extends net.Socket {
43 + constructor(fd: number, options?: net.SocketConstructorOpts);
44 + /**
45 + * A `boolean` that is `true` if the TTY is currently configured to operate as a
46 + * raw device. Defaults to `false`.
47 + * @since v0.7.7
48 + */
49 + isRaw: boolean;
50 + /**
51 + * Allows configuration of `tty.ReadStream` so that it operates as a raw device.
52 + *
53 + * When in raw mode, input is always available character-by-character, not
54 + * including modifiers. Additionally, all special processing of characters by the
55 + * terminal is disabled, including echoing input characters.Ctrl+C will no longer cause a `SIGINT` when in this mode.
56 + * @since v0.7.7
57 + * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
58 + * property will be set to the resulting mode.
59 + * @return The read stream instance.
60 + */
61 + setRawMode(mode: boolean): this;
62 + /**
63 + * A `boolean` that is always `true` for `tty.ReadStream` instances.
64 + * @since v0.5.8
65 + */
66 + isTTY: boolean;
67 + }
68 + /**
69 + * -1 - to the left from cursor
70 + * 0 - the entire line
71 + * 1 - to the right from cursor
72 + */
73 + type Direction = -1 | 0 | 1;
74 + /**
75 + * Represents the writable side of a TTY. In normal circumstances,`process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there
76 + * should be no reason to create additional instances.
77 + * @since v0.5.8
78 + */
79 + class WriteStream extends net.Socket {
80 + constructor(fd: number);
81 + addListener(event: string, listener: (...args: any[]) => void): this;
82 + addListener(event: 'resize', listener: () => void): this;
83 + emit(event: string | symbol, ...args: any[]): boolean;
84 + emit(event: 'resize'): boolean;
85 + on(event: string, listener: (...args: any[]) => void): this;
86 + on(event: 'resize', listener: () => void): this;
87 + once(event: string, listener: (...args: any[]) => void): this;
88 + once(event: 'resize', listener: () => void): this;
89 + prependListener(event: string, listener: (...args: any[]) => void): this;
90 + prependListener(event: 'resize', listener: () => void): this;
91 + prependOnceListener(event: string, listener: (...args: any[]) => void): this;
92 + prependOnceListener(event: 'resize', listener: () => void): this;
93 + /**
94 + * `writeStream.clearLine()` clears the current line of this `WriteStream` in a
95 + * direction identified by `dir`.
96 + * @since v0.7.7
97 + * @param callback Invoked once the operation completes.
98 + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
99 + */
100 + clearLine(dir: Direction, callback?: () => void): boolean;
101 + /**
102 + * `writeStream.clearScreenDown()` clears this `WriteStream` from the current
103 + * cursor down.
104 + * @since v0.7.7
105 + * @param callback Invoked once the operation completes.
106 + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
107 + */
108 + clearScreenDown(callback?: () => void): boolean;
109 + /**
110 + * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified
111 + * position.
112 + * @since v0.7.7
113 + * @param callback Invoked once the operation completes.
114 + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
115 + */
116 + cursorTo(x: number, y?: number, callback?: () => void): boolean;
117 + cursorTo(x: number, callback: () => void): boolean;
118 + /**
119 + * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its
120 + * current position.
121 + * @since v0.7.7
122 + * @param callback Invoked once the operation completes.
123 + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
124 + */
125 + moveCursor(dx: number, dy: number, callback?: () => void): boolean;
126 + /**
127 + * Returns:
128 + *
129 + * * `1` for 2,
130 + * * `4` for 16,
131 + * * `8` for 256,
132 + * * `24` for 16,777,216 colors supported.
133 + *
134 + * Use this to determine what colors the terminal supports. Due to the nature of
135 + * colors in terminals it is possible to either have false positives or false
136 + * negatives. It depends on process information and the environment variables that
137 + * may lie about what terminal is used.
138 + * It is possible to pass in an `env` object to simulate the usage of a specific
139 + * terminal. This can be useful to check how specific environment settings behave.
140 + *
141 + * To enforce a specific color support, use one of the below environment settings.
142 + *
143 + * * 2 colors: `FORCE_COLOR = 0` (Disables colors)
144 + * * 16 colors: `FORCE_COLOR = 1`
145 + * * 256 colors: `FORCE_COLOR = 2`
146 + * * 16,777,216 colors: `FORCE_COLOR = 3`
147 + *
148 + * Disabling color support is also possible by using the `NO_COLOR` and`NODE_DISABLE_COLORS` environment variables.
149 + * @since v9.9.0
150 + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
151 + */
152 + getColorDepth(env?: object): number;
153 + /**
154 + * Returns `true` if the `writeStream` supports at least as many colors as provided
155 + * in `count`. Minimum support is 2 (black and white).
156 + *
157 + * This has the same false positives and negatives as described in `writeStream.getColorDepth()`.
158 + *
159 + * ```js
160 + * process.stdout.hasColors();
161 + * // Returns true or false depending on if `stdout` supports at least 16 colors.
162 + * process.stdout.hasColors(256);
163 + * // Returns true or false depending on if `stdout` supports at least 256 colors.
164 + * process.stdout.hasColors({ TMUX: '1' });
165 + * // Returns true.
166 + * process.stdout.hasColors(2 ** 24, { TMUX: '1' });
167 + * // Returns false (the environment setting pretends to support 2 ** 8 colors).
168 + * ```
169 + * @since v11.13.0, v10.16.0
170 + * @param [count=16] The number of colors that are requested (minimum 2).
171 + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
172 + */
173 + hasColors(count?: number): boolean;
174 + hasColors(env?: object): boolean;
175 + hasColors(count: number, env?: object): boolean;
176 + /**
177 + * `writeStream.getWindowSize()` returns the size of the TTY
178 + * corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number
179 + * of columns and rows in the corresponding TTY.
180 + * @since v0.7.7
181 + */
182 + getWindowSize(): [number, number];
183 + /**
184 + * A `number` specifying the number of columns the TTY currently has. This property
185 + * is updated whenever the `'resize'` event is emitted.
186 + * @since v0.7.7
187 + */
188 + columns: number;
189 + /**
190 + * A `number` specifying the number of rows the TTY currently has. This property
191 + * is updated whenever the `'resize'` event is emitted.
192 + * @since v0.7.7
193 + */
194 + rows: number;
195 + /**
196 + * A `boolean` that is always `true`.
197 + * @since v0.5.8
198 + */
199 + isTTY: boolean;
200 + }
201 +}
202 +declare module 'node:tty' {
203 + export * from 'tty';
204 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/**
2 + * The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
3 + * underlying operating system via a collection of POSIX-like functions.
4 + *
5 + * ```js
6 + * import { readFile } from 'fs/promises';
7 + * import { WASI } from 'wasi';
8 + * import { argv, env } from 'process';
9 + *
10 + * const wasi = new WASI({
11 + * args: argv,
12 + * env,
13 + * preopens: {
14 + * '/sandbox': '/some/real/path/that/wasm/can/access'
15 + * }
16 + * });
17 + *
18 + * // Some WASI binaries require:
19 + * // const importObject = { wasi_unstable: wasi.wasiImport };
20 + * const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
21 + *
22 + * const wasm = await WebAssembly.compile(
23 + * await readFile(new URL('./demo.wasm', import.meta.url))
24 + * );
25 + * const instance = await WebAssembly.instantiate(wasm, importObject);
26 + *
27 + * wasi.start(instance);
28 + * ```
29 + *
30 + * To run the above example, create a new WebAssembly text format file named`demo.wat`:
31 + *
32 + * ```text
33 + * (module
34 + * ;; Import the required fd_write WASI function which will write the given io vectors to stdout
35 + * ;; The function signature for fd_write is:
36 + * ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
37 + * (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
38 + *
39 + * (memory 1)
40 + * (export "memory" (memory 0))
41 + *
42 + * ;; Write 'hello world\n' to memory at an offset of 8 bytes
43 + * ;; Note the trailing newline which is required for the text to appear
44 + * (data (i32.const 8) "hello world\n")
45 + *
46 + * (func $main (export "_start")
47 + * ;; Creating a new io vector within linear memory
48 + * (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
49 + * (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
50 + *
51 + * (call $fd_write
52 + * (i32.const 1) ;; file_descriptor - 1 for stdout
53 + * (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
54 + * (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
55 + * (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
56 + * )
57 + * drop ;; Discard the number of bytes written from the top of the stack
58 + * )
59 + * )
60 + * ```
61 + *
62 + * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
63 + *
64 + * ```console
65 + * $ wat2wasm demo.wat
66 + * ```
67 + *
68 + * The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
69 + * example to run.
70 + * @experimental
71 + * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/wasi.js)
72 + */
73 +declare module 'wasi' {
74 + interface WASIOptions {
75 + /**
76 + * An array of strings that the WebAssembly application will
77 + * see as command line arguments. The first argument is the virtual path to the
78 + * WASI command itself.
79 + */
80 + args?: string[] | undefined;
81 + /**
82 + * An object similar to `process.env` that the WebAssembly
83 + * application will see as its environment.
84 + */
85 + env?: object | undefined;
86 + /**
87 + * This object represents the WebAssembly application's
88 + * sandbox directory structure. The string keys of `preopens` are treated as
89 + * directories within the sandbox. The corresponding values in `preopens` are
90 + * the real paths to those directories on the host machine.
91 + */
92 + preopens?: NodeJS.Dict<string> | undefined;
93 + /**
94 + * By default, WASI applications terminate the Node.js
95 + * process via the `__wasi_proc_exit()` function. Setting this option to `true`
96 + * causes `wasi.start()` to return the exit code rather than terminate the
97 + * process.
98 + * @default false
99 + */
100 + returnOnExit?: boolean | undefined;
101 + /**
102 + * The file descriptor used as standard input in the WebAssembly application.
103 + * @default 0
104 + */
105 + stdin?: number | undefined;
106 + /**
107 + * The file descriptor used as standard output in the WebAssembly application.
108 + * @default 1
109 + */
110 + stdout?: number | undefined;
111 + /**
112 + * The file descriptor used as standard error in the WebAssembly application.
113 + * @default 2
114 + */
115 + stderr?: number | undefined;
116 + }
117 + /**
118 + * The `WASI` class provides the WASI system call API and additional convenience
119 + * methods for working with WASI-based applications. Each `WASI` instance
120 + * represents a distinct sandbox environment. For security purposes, each `WASI`instance must have its command-line arguments, environment variables, and
121 + * sandbox directory structure configured explicitly.
122 + * @since v13.3.0, v12.16.0
123 + */
124 + class WASI {
125 + constructor(options?: WASIOptions);
126 + /**
127 + * Attempt to begin execution of `instance` as a WASI command by invoking its`_start()` export. If `instance` does not contain a `_start()` export, or if`instance` contains an `_initialize()`
128 + * export, then an exception is thrown.
129 + *
130 + * `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`. If
131 + * `instance` does not have a `memory` export an exception is thrown.
132 + *
133 + * If `start()` is called more than once, an exception is thrown.
134 + * @since v13.3.0, v12.16.0
135 + */
136 + start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
137 + /**
138 + * Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.
139 + *
140 + * `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`.
141 + * If `instance` does not have a `memory` export an exception is thrown.
142 + *
143 + * If `initialize()` is called more than once, an exception is thrown.
144 + * @since v14.6.0, v12.19.0
145 + */
146 + initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
147 + /**
148 + * `wasiImport` is an object that implements the WASI system call API. This object
149 + * should be passed as the `wasi_snapshot_preview1` import during the instantiation
150 + * of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
151 + * @since v13.3.0, v12.16.0
152 + */
153 + readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
154 + }
155 +}
156 +declare module 'node:wasi' {
157 + export * from 'wasi';
158 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 + MIT License
2 +
3 + Copyright (c) Microsoft Corporation.
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in all
13 + copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 + SOFTWARE
1 +# Installation
2 +> `npm install --save @types/webidl-conversions`
3 +
4 +# Summary
5 +This package contains type definitions for webidl-conversions (https://github.com/jsdom/webidl-conversions#readme).
6 +
7 +# Details
8 +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions.
9 +
10 +### Additional Details
11 + * Last updated: Fri, 02 Jul 2021 18:05:21 GMT
12 + * Dependencies: none
13 + * Global values: none
14 +
15 +# Credits
16 +These definitions were written by [ExE Boss](https://github.com/ExE-Boss).
1 +// Type definitions for webidl-conversions 6.1
2 +// Project: https://github.com/jsdom/webidl-conversions#readme
3 +// Definitions by: ExE Boss <https://github.com/ExE-Boss>
4 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5 +// TypeScript Version: 3.0
6 +
7 +type Parameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? P : never;
8 +
9 +declare namespace WebIDLConversions {
10 + interface Globals {
11 + [key: string]: any;
12 +
13 + Number: (value?: any) => number;
14 + String: (value?: any) => string;
15 + TypeError: new (message?: string) => TypeError;
16 + }
17 +
18 + interface Options {
19 + context?: string | undefined;
20 + globals?: Globals | undefined;
21 + }
22 +
23 + interface IntegerOptions extends Options {
24 + enforceRange?: boolean | undefined;
25 + clamp?: boolean | undefined;
26 + }
27 +
28 + interface StringOptions extends Options {
29 + treatNullAsEmptyString?: boolean | undefined;
30 + }
31 +
32 + interface BufferSourceOptions extends Options {
33 + allowShared?: boolean | undefined;
34 + }
35 +
36 + type IntegerConversion = (V: any, opts?: IntegerOptions) => number;
37 + type StringConversion = (V: any, opts?: StringOptions) => string;
38 + type NumberConversion = (V: any, opts?: Options) => number;
39 +}
40 +
41 +declare const WebIDLConversions: {
42 + any<V>(V: V, opts?: WebIDLConversions.Options): V;
43 + void(V?: any, opts?: WebIDLConversions.Options): void;
44 + boolean(V: any, opts?: WebIDLConversions.Options): boolean;
45 +
46 + byte(V: any, opts?: WebIDLConversions.IntegerOptions): number;
47 + octet(V: any, opts?: WebIDLConversions.IntegerOptions): number;
48 +
49 + short(V: any, opts?: WebIDLConversions.IntegerOptions): number;
50 + ['unsigned short'](V: any, opts?: WebIDLConversions.IntegerOptions): number;
51 +
52 + long(V: any, opts?: WebIDLConversions.IntegerOptions): number;
53 + ['unsigned long'](V: any, opts?: WebIDLConversions.IntegerOptions): number;
54 +
55 + ['long long'](V: any, opts?: WebIDLConversions.IntegerOptions): number;
56 + ['unsigned long long'](V: any, opts?: WebIDLConversions.IntegerOptions): number;
57 +
58 + double(V: any, opts?: WebIDLConversions.Options): number;
59 + ['unrestricted double'](V: any, opts?: WebIDLConversions.Options): number;
60 +
61 + float(V: any, opts?: WebIDLConversions.Options): number;
62 + ['unrestricted float'](V: any, opts?: WebIDLConversions.Options): number;
63 +
64 + DOMString(V: any, opts?: WebIDLConversions.StringOptions): string;
65 + ByteString(V: any, opts?: WebIDLConversions.StringOptions): string;
66 + USVString(V: any, opts?: WebIDLConversions.StringOptions): string;
67 +
68 + object<V>(V: V, opts?: WebIDLConversions.Options): V extends object ? V : V & object;
69 + ArrayBuffer(V: any, opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined }): ArrayBuffer;
70 + ArrayBuffer(V: any, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike;
71 + DataView(V: any, opts?: WebIDLConversions.BufferSourceOptions): DataView;
72 +
73 + Int8Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Int8Array;
74 + Int16Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Int16Array;
75 + Int32Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Int32Array;
76 +
77 + Uint8Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Uint8Array;
78 + Uint16Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Uint16Array;
79 + Uint32Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Uint32Array;
80 + Uint8ClampedArray(V: any, opts?: WebIDLConversions.BufferSourceOptions): Uint8ClampedArray;
81 +
82 + Float32Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Float32Array;
83 + Float64Array(V: any, opts?: WebIDLConversions.BufferSourceOptions): Float64Array;
84 +
85 + ArrayBufferView(V: any, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferView;
86 + BufferSource(V: any, opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined }): ArrayBuffer | ArrayBufferView;
87 + BufferSource(V: any, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike | ArrayBufferView;
88 +
89 + DOMTimeStamp(V: any, opts?: WebIDLConversions.Options): number;
90 +
91 + // tslint:disable:ban-types
92 + /** @deprecated Will be removed in v7.0 */
93 + Function<V>(V: V, opts?: WebIDLConversions.Options): V extends (...args: any[]) => any ? V : Function;
94 +
95 + /** @deprecated Will be removed in v7.0 */
96 + VoidFunction<V>(
97 + V: V,
98 + opts?: WebIDLConversions.Options,
99 + ): V extends (...args: any[]) => any ? (...args: Parameters<V>) => void : Function;
100 +};
101 +
102 +// This can't use ES6 style exports, as those can't have spaces in export names.
103 +export = WebIDLConversions;
1 +{
2 + "name": "@types/webidl-conversions",
3 + "version": "6.1.1",
4 + "description": "TypeScript definitions for webidl-conversions",
5 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions",
6 + "license": "MIT",
7 + "contributors": [
8 + {
9 + "name": "ExE Boss",
10 + "url": "https://github.com/ExE-Boss",
11 + "githubUsername": "ExE-Boss"
12 + }
13 + ],
14 + "main": "",
15 + "types": "index.d.ts",
16 + "repository": {
17 + "type": "git",
18 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
19 + "directory": "types/webidl-conversions"
20 + },
21 + "scripts": {},
22 + "dependencies": {},
23 + "typesPublisherContentHash": "bc47f919faf031afa91cea9b170f96f05eeac452057ba17794386552a99d0ad7",
24 + "typeScriptVersion": "3.6"
25 +}
...\ No newline at end of file ...\ No newline at end of file
1 + MIT License
2 +
3 + Copyright (c) Microsoft Corporation.
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in all
13 + copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 + SOFTWARE
1 +# Installation
2 +> `npm install --save @types/whatwg-url`
3 +
4 +# Summary
5 +This package contains type definitions for whatwg-url (https://github.com/jsdom/whatwg-url#readme).
6 +
7 +# Details
8 +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url.
9 +
10 +### Additional Details
11 + * Last updated: Fri, 02 Jul 2021 18:05:37 GMT
12 + * Dependencies: [@types/webidl-conversions](https://npmjs.com/package/@types/webidl-conversions), [@types/node](https://npmjs.com/package/@types/node)
13 + * Global values: none
14 +
15 +# Credits
16 +These definitions were written by [Alexander Marks](https://github.com/aomarks), and [ExE Boss](https://github.com/ExE-Boss).
1 +declare class URLImpl {
2 + constructor(
3 + globalObject: object,
4 + constructorArgs: readonly [url: string, base?: string],
5 + privateData?: {},
6 + );
7 +
8 + href: string;
9 + readonly origin: string;
10 + protocol: string;
11 + username: string;
12 + password: string;
13 + host: string;
14 + hostname: string;
15 + port: string;
16 + pathname: string;
17 + search: string;
18 + readonly searchParams: URLSearchParams;
19 + hash: string;
20 +
21 + toJSON(): string;
22 +}
23 +export { URLImpl as implementation };
1 +import { Options as WebIDLConversionOptions } from "webidl-conversions";
2 +import { URL } from "../index";
3 +import { implementation as URLImpl } from "./URL-impl";
4 +
5 +/**
6 + * Checks whether `obj` is a `URL` object with an implementation
7 + * provided by this package.
8 + */
9 +export function is(obj: unknown): obj is URL;
10 +
11 +/**
12 + * Checks whether `obj` is a `URLImpl` WebIDL2JS implementation object
13 + * provided by this package.
14 + */
15 +export function isImpl(obj: unknown): obj is URLImpl;
16 +
17 +/**
18 + * Converts the `URL` wrapper into a `URLImpl` object.
19 + *
20 + * @throws {TypeError} If `obj` is not a `URL` wrapper instance provided by this package.
21 + */
22 +export function convert(obj: unknown, options?: WebIDLConversionOptions): URLImpl;
23 +
24 +/**
25 + * Creates a new `URL` instance.
26 + *
27 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
28 + * registry or a `URL` constructor provided by this package
29 + * in the WebIDL2JS constructor registry.
30 + */
31 +export function create(
32 + globalObject: object,
33 + constructorArgs: readonly [url: string, base?: string],
34 + privateData?: {},
35 +): URL;
36 +
37 +/**
38 + * Calls `create()` and returns the internal `URLImpl`.
39 + *
40 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
41 + * registry or a `URL` constructor provided by this package
42 + * in the WebIDL2JS constructor registry.
43 + */
44 +export function createImpl(
45 + globalObject: object,
46 + constructorArgs: readonly [url: string, base?: string],
47 + privateData?: {},
48 +): URLImpl;
49 +
50 +/**
51 + * Initializes the `URL` instance, called by `create()`.
52 + *
53 + * Useful when manually sub-classing a non-constructable wrapper object.
54 + */
55 +export function setup<T extends URL>(
56 + obj: T,
57 + globalObject: object,
58 + constructorArgs: readonly [url: string, base?: string],
59 + privateData?: {},
60 +): T;
61 +
62 +/**
63 + * Creates a new `URL` object without runing the constructor steps.
64 + *
65 + * Useful when implementing specifications that initialize objects
66 + * in different ways than their constructors do.
67 + */
68 +declare function _new(globalObject: object): URLImpl;
69 +export { _new as new };
70 +
71 +/**
72 + * Installs the `URL` constructor onto the `globalObject`.
73 + *
74 + * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
75 + */
76 +export function install(globalObject: object, globalNames: readonly string[]): void;
1 +declare class URLSearchParamsImpl {
2 + constructor(
3 + globalObject: object,
4 + constructorArgs: readonly [
5 + init?:
6 + | ReadonlyArray<readonly [name: string, value: string]>
7 + | { readonly [name: string]: string }
8 + | string,
9 + ],
10 + privateData: { readonly doNotStripQMark?: boolean | undefined },
11 + );
12 +
13 + append(name: string, value: string): void;
14 + delete(name: string): void;
15 + get(name: string): string | null;
16 + getAll(name: string): string[];
17 + has(name: string): boolean;
18 + set(name: string, value: string): void;
19 + sort(): void;
20 +
21 + [Symbol.iterator](): IterableIterator<[name: string, value: string]>;
22 +}
23 +export { URLSearchParamsImpl as implementation };
1 +import { Options as WebIDLConversionOptions } from "webidl-conversions";
2 +import { URLSearchParams } from "../index";
3 +import { implementation as URLSearchParamsImpl } from "./URLSearchParams-impl";
4 +
5 +/**
6 + * Checks whether `obj` is a `URLSearchParams` object with an implementation
7 + * provided by this package.
8 + */
9 +export function is(obj: unknown): obj is URLSearchParams;
10 +
11 +/**
12 + * Checks whether `obj` is a `URLSearchParamsImpl` WebIDL2JS implementation object
13 + * provided by this package.
14 + */
15 +export function isImpl(obj: unknown): obj is URLSearchParamsImpl;
16 +
17 +/**
18 + * Converts the `URLSearchParams` wrapper into a `URLSearchParamsImpl` object.
19 + *
20 + * @throws {TypeError} If `obj` is not a `URLSearchParams` wrapper instance provided by this package.
21 + */
22 +export function convert(obj: unknown, options?: WebIDLConversionOptions): URLSearchParamsImpl;
23 +
24 +/**
25 + * Creates a new `URLSearchParams` instance.
26 + *
27 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
28 + * registry or a `URLSearchParams` constructor provided by this package
29 + * in the WebIDL2JS constructor registry.
30 + */
31 +export function create(
32 + globalObject: object,
33 + constructorArgs?: readonly [
34 + init:
35 + | ReadonlyArray<[name: string, value: string]>
36 + | { readonly [name: string]: string }
37 + | string,
38 + ],
39 + privateData?: { doNotStripQMark?: boolean | undefined },
40 +): URLSearchParams;
41 +
42 +/**
43 + * Calls `create()` and returns the internal `URLSearchParamsImpl`.
44 + *
45 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
46 + * registry or a `URLSearchParams` constructor provided by this package
47 + * in the WebIDL2JS constructor registry.
48 + */
49 +export function createImpl(
50 + globalObject: object,
51 + constructorArgs?: readonly [
52 + init:
53 + | ReadonlyArray<[name: string, value: string]>
54 + | { readonly [name: string]: string }
55 + | string,
56 + ],
57 + privateData?: { doNotStripQMark?: boolean | undefined },
58 +): URLSearchParamsImpl;
59 +
60 +/**
61 + * Initializes the `URLSearchParams` instance, called by `create()`.
62 + *
63 + * Useful when manually sub-classing a non-constructable wrapper object.
64 + */
65 +export function setup<T extends URLSearchParams>(
66 + obj: T,
67 + globalObject: object,
68 + constructorArgs?: readonly [
69 + init:
70 + | ReadonlyArray<[name: string, value: string]>
71 + | { readonly [name: string]: string }
72 + | string,
73 + ],
74 + privateData?: { doNotStripQMark?: boolean | undefined },
75 +): T;
76 +
77 +/**
78 + * Creates a new `URLSearchParams` object without runing the constructor steps.
79 + *
80 + * Useful when implementing specifications that initialize objects
81 + * in different ways than their constructors do.
82 + */
83 +declare function _new(globalObject: object): URLSearchParamsImpl;
84 +export { _new as new };
85 +
86 +/**
87 + * Installs the `URLSearchParams` constructor onto the `globalObject`.
88 + *
89 + * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
90 + */
91 +export function install(globalObject: object, globalNames: readonly string[]): void;
1 +// Type definitions for whatwg-url 8.2
2 +// Project: https://github.com/jsdom/whatwg-url#readme
3 +// Definitions by: Alexander Marks <https://github.com/aomarks>
4 +// ExE Boss <https://github.com/ExE-Boss>
5 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6 +// Minimum TypeScript Version: 3.6
7 +
8 +/// <reference types="node"/>
9 +
10 +/** https://url.spec.whatwg.org/#url-representation */
11 +export interface URLRecord {
12 + scheme: string;
13 + username: string;
14 + password: string;
15 + host: string | number | IPv6Address | null;
16 + port: number | null;
17 + path: string[];
18 + query: string | null;
19 + fragment: string | null;
20 + cannotBeABaseURL?: boolean | undefined;
21 +}
22 +
23 +/** https://url.spec.whatwg.org/#concept-ipv6 */
24 +export type IPv6Address = [number, number, number, number, number, number, number, number];
25 +
26 +/** https://url.spec.whatwg.org/#url-class */
27 +export class URL {
28 + constructor(url: string, base?: string | URL);
29 +
30 + get href(): string;
31 + set href(V: string);
32 +
33 + get origin(): string;
34 +
35 + get protocol(): string;
36 + set protocol(V: string);
37 +
38 + get username(): string;
39 + set username(V: string);
40 +
41 + get password(): string;
42 + set password(V: string);
43 +
44 + get host(): string;
45 + set host(V: string);
46 +
47 + get hostname(): string;
48 + set hostname(V: string);
49 +
50 + get port(): string;
51 + set port(V: string);
52 +
53 + get pathname(): string;
54 + set pathname(V: string);
55 +
56 + get search(): string;
57 + set search(V: string);
58 +
59 + get searchParams(): URLSearchParams;
60 +
61 + get hash(): string;
62 + set hash(V: string);
63 +
64 + toJSON(): string;
65 +
66 + readonly [Symbol.toStringTag]: "URL";
67 +}
68 +
69 +/** https://url.spec.whatwg.org/#interface-urlsearchparams */
70 +export class URLSearchParams {
71 + constructor(
72 + init?:
73 + | ReadonlyArray<readonly [name: string, value: string]>
74 + | Iterable<readonly [name: string, value: string]>
75 + | { readonly [name: string]: string }
76 + | string,
77 + );
78 +
79 + append(name: string, value: string): void;
80 + delete(name: string): void;
81 + get(name: string): string | null;
82 + getAll(name: string): string[];
83 + has(name: string): boolean;
84 + set(name: string, value: string): void;
85 + sort(): void;
86 +
87 + keys(): IterableIterator<string>;
88 + values(): IterableIterator<string>;
89 + entries(): IterableIterator<[name: string, value: string]>;
90 + forEach<THIS_ARG = void>(
91 + callback: (this: THIS_ARG, value: string, name: string, searchParams: this) => void,
92 + thisArg?: THIS_ARG,
93 + ): void;
94 +
95 + readonly [Symbol.toStringTag]: "URLSearchParams";
96 + [Symbol.iterator](): IterableIterator<[name: string, value: string]>;
97 +}
98 +
99 +/** https://url.spec.whatwg.org/#concept-url-parser */
100 +export function parseURL(
101 + input: string,
102 + options?: { readonly baseURL?: string | undefined; readonly encodingOverride?: string | undefined },
103 +): URLRecord | null;
104 +
105 +/** https://url.spec.whatwg.org/#concept-basic-url-parser */
106 +export function basicURLParse(
107 + input: string,
108 + options?: {
109 + baseURL?: string | undefined;
110 + encodingOverride?: string | undefined;
111 + url?: URLRecord | undefined;
112 + stateOverride?: StateOverride | undefined;
113 + },
114 +): URLRecord | null;
115 +
116 +/** https://url.spec.whatwg.org/#scheme-start-state */
117 +export type StateOverride =
118 + | "scheme start"
119 + | "scheme"
120 + | "no scheme"
121 + | "special relative or authority"
122 + | "path or authority"
123 + | "relative"
124 + | "relative slash"
125 + | "special authority slashes"
126 + | "special authority ignore slashes"
127 + | "authority"
128 + | "host"
129 + | "hostname"
130 + | "port"
131 + | "file"
132 + | "file slash"
133 + | "file host"
134 + | "path start"
135 + | "path"
136 + | "cannot-be-a-base-URL path"
137 + | "query"
138 + | "fragment";
139 +
140 +/** https://url.spec.whatwg.org/#concept-url-serializer */
141 +export function serializeURL(urlRecord: URLRecord, excludeFragment?: boolean): string;
142 +
143 +/** https://url.spec.whatwg.org/#concept-host-serializer */
144 +export function serializeHost(host: string | number | IPv6Address): string;
145 +
146 +/** https://url.spec.whatwg.org/#serialize-an-integer */
147 +export function serializeInteger(number: number): string;
148 +
149 +/** https://html.spec.whatwg.org#ascii-serialisation-of-an-origin */
150 +export function serializeURLOrigin(urlRecord: URLRecord): string;
151 +
152 +/** https://url.spec.whatwg.org/#set-the-username */
153 +export function setTheUsername(urlRecord: URLRecord, username: string): void;
154 +
155 +/** https://url.spec.whatwg.org/#set-the-password */
156 +export function setThePassword(urlRecord: URLRecord, password: string): void;
157 +
158 +/** https://url.spec.whatwg.org/#cannot-have-a-username-password-port */
159 +export function cannotHaveAUsernamePasswordPort(urlRecord: URLRecord): boolean;
160 +
161 +/** https://url.spec.whatwg.org/#percent-decode */
162 +export function percentDecode(buffer: Extract<NodeJS.TypedArray, ArrayLike<number>>): Buffer;
1 +{
2 + "name": "@types/whatwg-url",
3 + "version": "8.2.1",
4 + "description": "TypeScript definitions for whatwg-url",
5 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url",
6 + "license": "MIT",
7 + "contributors": [
8 + {
9 + "name": "Alexander Marks",
10 + "url": "https://github.com/aomarks",
11 + "githubUsername": "aomarks"
12 + },
13 + {
14 + "name": "ExE Boss",
15 + "url": "https://github.com/ExE-Boss",
16 + "githubUsername": "ExE-Boss"
17 + }
18 + ],
19 + "main": "",
20 + "types": "index.d.ts",
21 + "typesVersions": {
22 + "<=3.9": {
23 + "*": [
24 + "ts3.9/*"
25 + ]
26 + }
27 + },
28 + "repository": {
29 + "type": "git",
30 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
31 + "directory": "types/whatwg-url"
32 + },
33 + "scripts": {},
34 + "dependencies": {
35 + "@types/node": "*",
36 + "@types/webidl-conversions": "*"
37 + },
38 + "typesPublisherContentHash": "a1260472a5aaba17ca5053dad6f0e88d68682ac63f5ddf4bc333657bdd7e9e96",
39 + "typeScriptVersion": "3.6"
40 +}
...\ No newline at end of file ...\ No newline at end of file
1 +declare class URLImpl {
2 + constructor(
3 + globalObject: object,
4 + [url, base]: readonly [string, string?],
5 + privateData?: {},
6 + );
7 +
8 + href: string;
9 + readonly origin: string;
10 + protocol: string;
11 + username: string;
12 + password: string;
13 + host: string;
14 + hostname: string;
15 + port: string;
16 + pathname: string;
17 + search: string;
18 + readonly searchParams: URLSearchParams;
19 + hash: string;
20 +
21 + toJSON(): string;
22 +}
23 +export { URLImpl as implementation };
1 +import { Options as WebIDLConversionOptions } from "webidl-conversions";
2 +import { URL } from "../index";
3 +import { implementation as URLImpl } from "./URL-impl";
4 +
5 +/**
6 + * Checks whether `obj` is a `URL` object with an implementation
7 + * provided by this package.
8 + */
9 +export function is(obj: unknown): obj is URL;
10 +
11 +/**
12 + * Checks whether `obj` is a `URLImpl` WebIDL2JS implementation object
13 + * provided by this package.
14 + */
15 +export function isImpl(obj: unknown): obj is URLImpl;
16 +
17 +/**
18 + * Converts the `URL` wrapper into a `URLImpl` object.
19 + *
20 + * @throws {TypeError} If `obj` is not a `URL` wrapper instance provided by this package.
21 + */
22 +export function convert(obj: unknown, options?: WebIDLConversionOptions): URLImpl;
23 +
24 +/**
25 + * Creates a new `URL` instance.
26 + *
27 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
28 + * registry or a `URL` constructor provided by this package
29 + * in the WebIDL2JS constructor registry.
30 + */
31 +export function create(
32 + globalObject: object,
33 + [url, base]: readonly [string, string?],
34 + privateData?: {},
35 +): URL;
36 +
37 +/**
38 + * Calls `create()` and returns the internal `URLImpl`.
39 + *
40 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
41 + * registry or a `URL` constructor provided by this package
42 + * in the WebIDL2JS constructor registry.
43 + */
44 +export function createImpl(
45 + globalObject: object,
46 + [url, base]: readonly [string, string?],
47 + privateData?: {},
48 +): URLImpl;
49 +
50 +/**
51 + * Initializes the `URL` instance, called by `create()`.
52 + *
53 + * Useful when manually sub-classing a non-constructable wrapper object.
54 + */
55 +export function setup<T extends URL>(
56 + obj: T,
57 + globalObject: object,
58 + [url, base]: readonly [string, string?],
59 + privateData?: {},
60 +): T;
61 +
62 +/**
63 + * Creates a new `URL` object without runing the constructor steps.
64 + *
65 + * Useful when implementing specifications that initialize objects
66 + * in different ways than their constructors do.
67 + */
68 +declare function _new(globalObject: object): URLImpl;
69 +export { _new as new };
70 +
71 +/**
72 + * Installs the `URL` constructor onto the `globalObject`.
73 + *
74 + * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
75 + */
76 +export function install(globalObject: object, globalNames: readonly string[]): void;
1 +declare class URLSearchParamsImpl {
2 + constructor(
3 + globalObject: object,
4 + [init]: readonly [
5 + (
6 + | ReadonlyArray<readonly [string, string]>
7 + | { readonly [name: string]: string }
8 + | string
9 + )?,
10 + ],
11 + privateData: { readonly doNotStripQMark?: boolean },
12 + );
13 +
14 + append(name: string, value: string): void;
15 + delete(name: string): void;
16 + get(name: string): string | null;
17 + getAll(name: string): string[];
18 + has(name: string): boolean;
19 + set(name: string, value: string): void;
20 + sort(): void;
21 +
22 + [Symbol.iterator](): IterableIterator<[string, string]>;
23 +}
24 +export { URLSearchParamsImpl as implementation };
1 +import { Options as WebIDLConversionOptions } from "webidl-conversions";
2 +import { URLSearchParams } from "../index";
3 +import { implementation as URLSearchParamsImpl } from "./URLSearchParams-impl";
4 +
5 +/**
6 + * Checks whether `obj` is a `URLSearchParams` object with an implementation
7 + * provided by this package.
8 + */
9 +export function is(obj: unknown): obj is URLSearchParams;
10 +
11 +/**
12 + * Checks whether `obj` is a `URLSearchParamsImpl` WebIDL2JS implementation object
13 + * provided by this package.
14 + */
15 +export function isImpl(obj: unknown): obj is URLSearchParamsImpl;
16 +
17 +/**
18 + * Converts the `URLSearchParams` wrapper into a `URLSearchParamsImpl` object.
19 + *
20 + * @throws {TypeError} If `obj` is not a `URLSearchParams` wrapper instance provided by this package.
21 + */
22 +export function convert(obj: unknown, options?: WebIDLConversionOptions): URLSearchParamsImpl;
23 +
24 +/**
25 + * Creates a new `URLSearchParams` instance.
26 + *
27 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
28 + * registry or a `URLSearchParams` constructor provided by this package
29 + * in the WebIDL2JS constructor registry.
30 + */
31 +export function create(
32 + globalObject: object,
33 + [init]?: readonly [
34 + (
35 + | ReadonlyArray<readonly [string, string]>
36 + | { readonly [name: string]: string }
37 + | string
38 + )?,
39 + ],
40 + privateData?: { doNotStripQMark?: boolean },
41 +): URLSearchParams;
42 +
43 +/**
44 + * Calls `create()` and returns the internal `URLSearchParamsImpl`.
45 + *
46 + * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
47 + * registry or a `URLSearchParams` constructor provided by this package
48 + * in the WebIDL2JS constructor registry.
49 + */
50 +export function createImpl(
51 + globalObject: object,
52 + [init]?: readonly [
53 + (
54 + | ReadonlyArray<readonly [string, string]>
55 + | { readonly [name: string]: string }
56 + | string
57 + )?,
58 + ],
59 + privateData?: { doNotStripQMark?: boolean },
60 +): URLSearchParamsImpl;
61 +
62 +/**
63 + * Initializes the `URLSearchParams` instance, called by `create()`.
64 + *
65 + * Useful when manually sub-classing a non-constructable wrapper object.
66 + */
67 +export function setup<T extends URLSearchParams>(
68 + obj: T,
69 + globalObject: object,
70 + [init]?: readonly [
71 + (
72 + | ReadonlyArray<readonly [string, string]>
73 + | { readonly [name: string]: string }
74 + | string
75 + )?,
76 + ],
77 + privateData?: { doNotStripQMark?: boolean },
78 +): T;
79 +
80 +/**
81 + * Creates a new `URLSearchParams` object without runing the constructor steps.
82 + *
83 + * Useful when implementing specifications that initialize objects
84 + * in different ways than their constructors do.
85 + */
86 +declare function _new(globalObject: object): URLSearchParamsImpl;
87 +export { _new as new };
88 +
89 +/**
90 + * Installs the `URLSearchParams` constructor onto the `globalObject`.
91 + *
92 + * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
93 + */
94 +export function install(globalObject: object, globalNames: readonly string[]): void;
1 +/// <reference types="node"/>
2 +
3 +/** https://url.spec.whatwg.org/#url-representation */
4 +export interface URLRecord {
5 + scheme: string;
6 + username: string;
7 + password: string;
8 + host: string | number | IPv6Address | null;
9 + port: number | null;
10 + path: string[];
11 + query: string | null;
12 + fragment: string | null;
13 + cannotBeABaseURL?: boolean;
14 +}
15 +
16 +/** https://url.spec.whatwg.org/#concept-ipv6 */
17 +export type IPv6Address = [number, number, number, number, number, number, number, number];
18 +
19 +/** https://url.spec.whatwg.org/#url-class */
20 +export class URL {
21 + constructor(url: string, base?: string | URL);
22 +
23 + get href(): string;
24 + set href(V: string);
25 +
26 + get origin(): string;
27 +
28 + get protocol(): string;
29 + set protocol(V: string);
30 +
31 + get username(): string;
32 + set username(V: string);
33 +
34 + get password(): string;
35 + set password(V: string);
36 +
37 + get host(): string;
38 + set host(V: string);
39 +
40 + get hostname(): string;
41 + set hostname(V: string);
42 +
43 + get port(): string;
44 + set port(V: string);
45 +
46 + get pathname(): string;
47 + set pathname(V: string);
48 +
49 + get search(): string;
50 + set search(V: string);
51 +
52 + get searchParams(): URLSearchParams;
53 +
54 + get hash(): string;
55 + set hash(V: string);
56 +
57 + toJSON(): string;
58 +
59 + readonly [Symbol.toStringTag]: "URL";
60 +}
61 +
62 +/** https://url.spec.whatwg.org/#interface-urlsearchparams */
63 +export class URLSearchParams {
64 + constructor(
65 + init?:
66 + | ReadonlyArray<readonly [string, string]>
67 + | Iterable<readonly [string, string]>
68 + | { readonly [name: string]: string }
69 + | string,
70 + );
71 +
72 + append(name: string, value: string): void;
73 + delete(name: string): void;
74 + get(name: string): string | null;
75 + getAll(name: string): string[];
76 + has(name: string): boolean;
77 + set(name: string, value: string): void;
78 + sort(): void;
79 +
80 + keys(): IterableIterator<string>;
81 + values(): IterableIterator<string>;
82 + entries(): IterableIterator<[string, string]>;
83 + forEach<THIS_ARG = void>(
84 + callback: (this: THIS_ARG, value: string, name: string, searchParams: this) => void,
85 + thisArg?: THIS_ARG,
86 + ): void;
87 +
88 + readonly [Symbol.toStringTag]: "URLSearchParams";
89 + [Symbol.iterator](): IterableIterator<[string, string]>;
90 +}
91 +
92 +/** https://url.spec.whatwg.org/#concept-url-parser */
93 +export function parseURL(
94 + input: string,
95 + options?: { readonly baseURL?: string; readonly encodingOverride?: string },
96 +): URLRecord | null;
97 +
98 +/** https://url.spec.whatwg.org/#concept-basic-url-parser */
99 +export function basicURLParse(
100 + input: string,
101 + options?: {
102 + baseURL?: string;
103 + encodingOverride?: string;
104 + url?: URLRecord;
105 + stateOverride?: StateOverride;
106 + },
107 +): URLRecord | null;
108 +
109 +/** https://url.spec.whatwg.org/#scheme-start-state */
110 +export type StateOverride =
111 + | "scheme start"
112 + | "scheme"
113 + | "no scheme"
114 + | "special relative or authority"
115 + | "path or authority"
116 + | "relative"
117 + | "relative slash"
118 + | "special authority slashes"
119 + | "special authority ignore slashes"
120 + | "authority"
121 + | "host"
122 + | "hostname"
123 + | "port"
124 + | "file"
125 + | "file slash"
126 + | "file host"
127 + | "path start"
128 + | "path"
129 + | "cannot-be-a-base-URL path"
130 + | "query"
131 + | "fragment";
132 +
133 +/** https://url.spec.whatwg.org/#concept-url-serializer */
134 +export function serializeURL(urlRecord: URLRecord, excludeFragment?: boolean): string;
135 +
136 +/** https://url.spec.whatwg.org/#concept-host-serializer */
137 +export function serializeHost(host: string | number | IPv6Address): string;
138 +
139 +/** https://url.spec.whatwg.org/#serialize-an-integer */
140 +export function serializeInteger(number: number): string;
141 +
142 +/** https://html.spec.whatwg.org#ascii-serialisation-of-an-origin */
143 +export function serializeURLOrigin(urlRecord: URLRecord): string;
144 +
145 +/** https://url.spec.whatwg.org/#set-the-username */
146 +export function setTheUsername(urlRecord: URLRecord, username: string): void;
147 +
148 +/** https://url.spec.whatwg.org/#set-the-password */
149 +export function setThePassword(urlRecord: URLRecord, password: string): void;
150 +
151 +/** https://url.spec.whatwg.org/#cannot-have-a-username-password-port */
152 +export function cannotHaveAUsernamePasswordPort(urlRecord: URLRecord): boolean;
153 +
154 +/** https://url.spec.whatwg.org/#percent-decode */
155 +export function percentDecode(buffer: Extract<NodeJS.TypedArray, ArrayLike<number>>): Buffer;
1 +import * as URL from "./dist/URL";
2 +import * as URLSearchParams from "./dist/URLSearchParams";
3 +
4 +export { URL, URLSearchParams };
1 +import * as URL from "./dist/URL";
2 +import * as URLSearchParams from "./dist/URLSearchParams";
3 +
4 +export { URL, URLSearchParams };
1 +1.3.8 / 2022-02-02
2 +==================
3 +
4 + * deps: mime-types@~2.1.34
5 + - deps: mime-db@~1.51.0
6 + * deps: negotiator@0.6.3
7 +
8 +1.3.7 / 2019-04-29
9 +==================
10 +
11 + * deps: negotiator@0.6.2
12 + - Fix sorting charset, encoding, and language with extra parameters
13 +
14 +1.3.6 / 2019-04-28
15 +==================
16 +
17 + * deps: mime-types@~2.1.24
18 + - deps: mime-db@~1.40.0
19 +
20 +1.3.5 / 2018-02-28
21 +==================
22 +
23 + * deps: mime-types@~2.1.18
24 + - deps: mime-db@~1.33.0
25 +
26 +1.3.4 / 2017-08-22
27 +==================
28 +
29 + * deps: mime-types@~2.1.16
30 + - deps: mime-db@~1.29.0
31 +
32 +1.3.3 / 2016-05-02
33 +==================
34 +
35 + * deps: mime-types@~2.1.11
36 + - deps: mime-db@~1.23.0
37 + * deps: negotiator@0.6.1
38 + - perf: improve `Accept` parsing speed
39 + - perf: improve `Accept-Charset` parsing speed
40 + - perf: improve `Accept-Encoding` parsing speed
41 + - perf: improve `Accept-Language` parsing speed
42 +
43 +1.3.2 / 2016-03-08
44 +==================
45 +
46 + * deps: mime-types@~2.1.10
47 + - Fix extension of `application/dash+xml`
48 + - Update primary extension for `audio/mp4`
49 + - deps: mime-db@~1.22.0
50 +
51 +1.3.1 / 2016-01-19
52 +==================
53 +
54 + * deps: mime-types@~2.1.9
55 + - deps: mime-db@~1.21.0
56 +
57 +1.3.0 / 2015-09-29
58 +==================
59 +
60 + * deps: mime-types@~2.1.7
61 + - deps: mime-db@~1.19.0
62 + * deps: negotiator@0.6.0
63 + - Fix including type extensions in parameters in `Accept` parsing
64 + - Fix parsing `Accept` parameters with quoted equals
65 + - Fix parsing `Accept` parameters with quoted semicolons
66 + - Lazy-load modules from main entry point
67 + - perf: delay type concatenation until needed
68 + - perf: enable strict mode
69 + - perf: hoist regular expressions
70 + - perf: remove closures getting spec properties
71 + - perf: remove a closure from media type parsing
72 + - perf: remove property delete from media type parsing
73 +
74 +1.2.13 / 2015-09-06
75 +===================
76 +
77 + * deps: mime-types@~2.1.6
78 + - deps: mime-db@~1.18.0
79 +
80 +1.2.12 / 2015-07-30
81 +===================
82 +
83 + * deps: mime-types@~2.1.4
84 + - deps: mime-db@~1.16.0
85 +
86 +1.2.11 / 2015-07-16
87 +===================
88 +
89 + * deps: mime-types@~2.1.3
90 + - deps: mime-db@~1.15.0
91 +
92 +1.2.10 / 2015-07-01
93 +===================
94 +
95 + * deps: mime-types@~2.1.2
96 + - deps: mime-db@~1.14.0
97 +
98 +1.2.9 / 2015-06-08
99 +==================
100 +
101 + * deps: mime-types@~2.1.1
102 + - perf: fix deopt during mapping
103 +
104 +1.2.8 / 2015-06-07
105 +==================
106 +
107 + * deps: mime-types@~2.1.0
108 + - deps: mime-db@~1.13.0
109 + * perf: avoid argument reassignment & argument slice
110 + * perf: avoid negotiator recursive construction
111 + * perf: enable strict mode
112 + * perf: remove unnecessary bitwise operator
113 +
114 +1.2.7 / 2015-05-10
115 +==================
116 +
117 + * deps: negotiator@0.5.3
118 + - Fix media type parameter matching to be case-insensitive
119 +
120 +1.2.6 / 2015-05-07
121 +==================
122 +
123 + * deps: mime-types@~2.0.11
124 + - deps: mime-db@~1.9.1
125 + * deps: negotiator@0.5.2
126 + - Fix comparing media types with quoted values
127 + - Fix splitting media types with quoted commas
128 +
129 +1.2.5 / 2015-03-13
130 +==================
131 +
132 + * deps: mime-types@~2.0.10
133 + - deps: mime-db@~1.8.0
134 +
135 +1.2.4 / 2015-02-14
136 +==================
137 +
138 + * Support Node.js 0.6
139 + * deps: mime-types@~2.0.9
140 + - deps: mime-db@~1.7.0
141 + * deps: negotiator@0.5.1
142 + - Fix preference sorting to be stable for long acceptable lists
143 +
144 +1.2.3 / 2015-01-31
145 +==================
146 +
147 + * deps: mime-types@~2.0.8
148 + - deps: mime-db@~1.6.0
149 +
150 +1.2.2 / 2014-12-30
151 +==================
152 +
153 + * deps: mime-types@~2.0.7
154 + - deps: mime-db@~1.5.0
155 +
156 +1.2.1 / 2014-12-30
157 +==================
158 +
159 + * deps: mime-types@~2.0.5
160 + - deps: mime-db@~1.3.1
161 +
162 +1.2.0 / 2014-12-19
163 +==================
164 +
165 + * deps: negotiator@0.5.0
166 + - Fix list return order when large accepted list
167 + - Fix missing identity encoding when q=0 exists
168 + - Remove dynamic building of Negotiator class
169 +
170 +1.1.4 / 2014-12-10
171 +==================
172 +
173 + * deps: mime-types@~2.0.4
174 + - deps: mime-db@~1.3.0
175 +
176 +1.1.3 / 2014-11-09
177 +==================
178 +
179 + * deps: mime-types@~2.0.3
180 + - deps: mime-db@~1.2.0
181 +
182 +1.1.2 / 2014-10-14
183 +==================
184 +
185 + * deps: negotiator@0.4.9
186 + - Fix error when media type has invalid parameter
187 +
188 +1.1.1 / 2014-09-28
189 +==================
190 +
191 + * deps: mime-types@~2.0.2
192 + - deps: mime-db@~1.1.0
193 + * deps: negotiator@0.4.8
194 + - Fix all negotiations to be case-insensitive
195 + - Stable sort preferences of same quality according to client order
196 +
197 +1.1.0 / 2014-09-02
198 +==================
199 +
200 + * update `mime-types`
201 +
202 +1.0.7 / 2014-07-04
203 +==================
204 +
205 + * Fix wrong type returned from `type` when match after unknown extension
206 +
207 +1.0.6 / 2014-06-24
208 +==================
209 +
210 + * deps: negotiator@0.4.7
211 +
212 +1.0.5 / 2014-06-20
213 +==================
214 +
215 + * fix crash when unknown extension given
216 +
217 +1.0.4 / 2014-06-19
218 +==================
219 +
220 + * use `mime-types`
221 +
222 +1.0.3 / 2014-06-11
223 +==================
224 +
225 + * deps: negotiator@0.4.6
226 + - Order by specificity when quality is the same
227 +
228 +1.0.2 / 2014-05-29
229 +==================
230 +
231 + * Fix interpretation when header not in request
232 + * deps: pin negotiator@0.4.5
233 +
234 +1.0.1 / 2014-01-18
235 +==================
236 +
237 + * Identity encoding isn't always acceptable
238 + * deps: negotiator@~0.4.0
239 +
240 +1.0.0 / 2013-12-27
241 +==================
242 +
243 + * Genesis
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# accepts
2 +
3 +[![NPM Version][npm-version-image]][npm-url]
4 +[![NPM Downloads][npm-downloads-image]][npm-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][github-actions-ci-image]][github-actions-ci-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
10 +Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
11 +
12 +In addition to negotiator, it allows:
13 +
14 +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
15 + as well as `('text/html', 'application/json')`.
16 +- Allows type shorthands such as `json`.
17 +- Returns `false` when no types match
18 +- Treats non-existent headers as `*`
19 +
20 +## Installation
21 +
22 +This is a [Node.js](https://nodejs.org/en/) module available through the
23 +[npm registry](https://www.npmjs.com/). Installation is done using the
24 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25 +
26 +```sh
27 +$ npm install accepts
28 +```
29 +
30 +## API
31 +
32 +```js
33 +var accepts = require('accepts')
34 +```
35 +
36 +### accepts(req)
37 +
38 +Create a new `Accepts` object for the given `req`.
39 +
40 +#### .charset(charsets)
41 +
42 +Return the first accepted charset. If nothing in `charsets` is accepted,
43 +then `false` is returned.
44 +
45 +#### .charsets()
46 +
47 +Return the charsets that the request accepts, in the order of the client's
48 +preference (most preferred first).
49 +
50 +#### .encoding(encodings)
51 +
52 +Return the first accepted encoding. If nothing in `encodings` is accepted,
53 +then `false` is returned.
54 +
55 +#### .encodings()
56 +
57 +Return the encodings that the request accepts, in the order of the client's
58 +preference (most preferred first).
59 +
60 +#### .language(languages)
61 +
62 +Return the first accepted language. If nothing in `languages` is accepted,
63 +then `false` is returned.
64 +
65 +#### .languages()
66 +
67 +Return the languages that the request accepts, in the order of the client's
68 +preference (most preferred first).
69 +
70 +#### .type(types)
71 +
72 +Return the first accepted type (and it is returned as the same text as what
73 +appears in the `types` array). If nothing in `types` is accepted, then `false`
74 +is returned.
75 +
76 +The `types` array can contain full MIME types or file extensions. Any value
77 +that is not a full MIME types is passed to `require('mime-types').lookup`.
78 +
79 +#### .types()
80 +
81 +Return the types that the request accepts, in the order of the client's
82 +preference (most preferred first).
83 +
84 +## Examples
85 +
86 +### Simple type negotiation
87 +
88 +This simple example shows how to use `accepts` to return a different typed
89 +respond body based on what the client wants to accept. The server lists it's
90 +preferences in order and will get back the best match between the client and
91 +server.
92 +
93 +```js
94 +var accepts = require('accepts')
95 +var http = require('http')
96 +
97 +function app (req, res) {
98 + var accept = accepts(req)
99 +
100 + // the order of this list is significant; should be server preferred order
101 + switch (accept.type(['json', 'html'])) {
102 + case 'json':
103 + res.setHeader('Content-Type', 'application/json')
104 + res.write('{"hello":"world!"}')
105 + break
106 + case 'html':
107 + res.setHeader('Content-Type', 'text/html')
108 + res.write('<b>hello, world!</b>')
109 + break
110 + default:
111 + // the fallback is text/plain, so no need to specify it above
112 + res.setHeader('Content-Type', 'text/plain')
113 + res.write('hello, world!')
114 + break
115 + }
116 +
117 + res.end()
118 +}
119 +
120 +http.createServer(app).listen(3000)
121 +```
122 +
123 +You can test this out with the cURL program:
124 +```sh
125 +curl -I -H'Accept: text/html' http://localhost:3000/
126 +```
127 +
128 +## License
129 +
130 +[MIT](LICENSE)
131 +
132 +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
133 +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
134 +[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
135 +[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
136 +[node-version-image]: https://badgen.net/npm/node/accepts
137 +[node-version-url]: https://nodejs.org/en/download
138 +[npm-downloads-image]: https://badgen.net/npm/dm/accepts
139 +[npm-url]: https://npmjs.org/package/accepts
140 +[npm-version-image]: https://badgen.net/npm/v/accepts
1 +/*!
2 + * accepts
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var Negotiator = require('negotiator')
16 +var mime = require('mime-types')
17 +
18 +/**
19 + * Module exports.
20 + * @public
21 + */
22 +
23 +module.exports = Accepts
24 +
25 +/**
26 + * Create a new Accepts object for the given req.
27 + *
28 + * @param {object} req
29 + * @public
30 + */
31 +
32 +function Accepts (req) {
33 + if (!(this instanceof Accepts)) {
34 + return new Accepts(req)
35 + }
36 +
37 + this.headers = req.headers
38 + this.negotiator = new Negotiator(req)
39 +}
40 +
41 +/**
42 + * Check if the given `type(s)` is acceptable, returning
43 + * the best match when true, otherwise `undefined`, in which
44 + * case you should respond with 406 "Not Acceptable".
45 + *
46 + * The `type` value may be a single mime type string
47 + * such as "application/json", the extension name
48 + * such as "json" or an array `["json", "html", "text/plain"]`. When a list
49 + * or array is given the _best_ match, if any is returned.
50 + *
51 + * Examples:
52 + *
53 + * // Accept: text/html
54 + * this.types('html');
55 + * // => "html"
56 + *
57 + * // Accept: text/*, application/json
58 + * this.types('html');
59 + * // => "html"
60 + * this.types('text/html');
61 + * // => "text/html"
62 + * this.types('json', 'text');
63 + * // => "json"
64 + * this.types('application/json');
65 + * // => "application/json"
66 + *
67 + * // Accept: text/*, application/json
68 + * this.types('image/png');
69 + * this.types('png');
70 + * // => undefined
71 + *
72 + * // Accept: text/*;q=.5, application/json
73 + * this.types(['html', 'json']);
74 + * this.types('html', 'json');
75 + * // => "json"
76 + *
77 + * @param {String|Array} types...
78 + * @return {String|Array|Boolean}
79 + * @public
80 + */
81 +
82 +Accepts.prototype.type =
83 +Accepts.prototype.types = function (types_) {
84 + var types = types_
85 +
86 + // support flattened arguments
87 + if (types && !Array.isArray(types)) {
88 + types = new Array(arguments.length)
89 + for (var i = 0; i < types.length; i++) {
90 + types[i] = arguments[i]
91 + }
92 + }
93 +
94 + // no types, return all requested types
95 + if (!types || types.length === 0) {
96 + return this.negotiator.mediaTypes()
97 + }
98 +
99 + // no accept header, return first given type
100 + if (!this.headers.accept) {
101 + return types[0]
102 + }
103 +
104 + var mimes = types.map(extToMime)
105 + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
106 + var first = accepts[0]
107 +
108 + return first
109 + ? types[mimes.indexOf(first)]
110 + : false
111 +}
112 +
113 +/**
114 + * Return accepted encodings or best fit based on `encodings`.
115 + *
116 + * Given `Accept-Encoding: gzip, deflate`
117 + * an array sorted by quality is returned:
118 + *
119 + * ['gzip', 'deflate']
120 + *
121 + * @param {String|Array} encodings...
122 + * @return {String|Array}
123 + * @public
124 + */
125 +
126 +Accepts.prototype.encoding =
127 +Accepts.prototype.encodings = function (encodings_) {
128 + var encodings = encodings_
129 +
130 + // support flattened arguments
131 + if (encodings && !Array.isArray(encodings)) {
132 + encodings = new Array(arguments.length)
133 + for (var i = 0; i < encodings.length; i++) {
134 + encodings[i] = arguments[i]
135 + }
136 + }
137 +
138 + // no encodings, return all requested encodings
139 + if (!encodings || encodings.length === 0) {
140 + return this.negotiator.encodings()
141 + }
142 +
143 + return this.negotiator.encodings(encodings)[0] || false
144 +}
145 +
146 +/**
147 + * Return accepted charsets or best fit based on `charsets`.
148 + *
149 + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
150 + * an array sorted by quality is returned:
151 + *
152 + * ['utf-8', 'utf-7', 'iso-8859-1']
153 + *
154 + * @param {String|Array} charsets...
155 + * @return {String|Array}
156 + * @public
157 + */
158 +
159 +Accepts.prototype.charset =
160 +Accepts.prototype.charsets = function (charsets_) {
161 + var charsets = charsets_
162 +
163 + // support flattened arguments
164 + if (charsets && !Array.isArray(charsets)) {
165 + charsets = new Array(arguments.length)
166 + for (var i = 0; i < charsets.length; i++) {
167 + charsets[i] = arguments[i]
168 + }
169 + }
170 +
171 + // no charsets, return all requested charsets
172 + if (!charsets || charsets.length === 0) {
173 + return this.negotiator.charsets()
174 + }
175 +
176 + return this.negotiator.charsets(charsets)[0] || false
177 +}
178 +
179 +/**
180 + * Return accepted languages or best fit based on `langs`.
181 + *
182 + * Given `Accept-Language: en;q=0.8, es, pt`
183 + * an array sorted by quality is returned:
184 + *
185 + * ['es', 'pt', 'en']
186 + *
187 + * @param {String|Array} langs...
188 + * @return {Array|String}
189 + * @public
190 + */
191 +
192 +Accepts.prototype.lang =
193 +Accepts.prototype.langs =
194 +Accepts.prototype.language =
195 +Accepts.prototype.languages = function (languages_) {
196 + var languages = languages_
197 +
198 + // support flattened arguments
199 + if (languages && !Array.isArray(languages)) {
200 + languages = new Array(arguments.length)
201 + for (var i = 0; i < languages.length; i++) {
202 + languages[i] = arguments[i]
203 + }
204 + }
205 +
206 + // no languages, return all requested languages
207 + if (!languages || languages.length === 0) {
208 + return this.negotiator.languages()
209 + }
210 +
211 + return this.negotiator.languages(languages)[0] || false
212 +}
213 +
214 +/**
215 + * Convert extnames to mime.
216 + *
217 + * @param {String} type
218 + * @return {String}
219 + * @private
220 + */
221 +
222 +function extToMime (type) {
223 + return type.indexOf('/') === -1
224 + ? mime.lookup(type)
225 + : type
226 +}
227 +
228 +/**
229 + * Check if mime is valid.
230 + *
231 + * @param {String} type
232 + * @return {String}
233 + * @private
234 + */
235 +
236 +function validMime (type) {
237 + return typeof type === 'string'
238 +}
1 +{
2 + "name": "accepts",
3 + "description": "Higher-level content negotiation",
4 + "version": "1.3.8",
5 + "contributors": [
6 + "Douglas Christopher Wilson <doug@somethingdoug.com>",
7 + "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
8 + ],
9 + "license": "MIT",
10 + "repository": "jshttp/accepts",
11 + "dependencies": {
12 + "mime-types": "~2.1.34",
13 + "negotiator": "0.6.3"
14 + },
15 + "devDependencies": {
16 + "deep-equal": "1.0.1",
17 + "eslint": "7.32.0",
18 + "eslint-config-standard": "14.1.1",
19 + "eslint-plugin-import": "2.25.4",
20 + "eslint-plugin-markdown": "2.2.1",
21 + "eslint-plugin-node": "11.1.0",
22 + "eslint-plugin-promise": "4.3.1",
23 + "eslint-plugin-standard": "4.1.0",
24 + "mocha": "9.2.0",
25 + "nyc": "15.1.0"
26 + },
27 + "files": [
28 + "LICENSE",
29 + "HISTORY.md",
30 + "index.js"
31 + ],
32 + "engines": {
33 + "node": ">= 0.6"
34 + },
35 + "scripts": {
36 + "lint": "eslint .",
37 + "test": "mocha --reporter spec --check-leaks --bail test/",
38 + "test-ci": "nyc --reporter=lcov --reporter=text npm test",
39 + "test-cov": "nyc --reporter=html --reporter=text npm test"
40 + },
41 + "keywords": [
42 + "content",
43 + "negotiation",
44 + "accept",
45 + "accepts"
46 + ]
47 +}
1 +var Ajv = require('ajv');
2 +var ajv = new Ajv({allErrors: true});
3 +
4 +var schema = {
5 + "properties": {
6 + "foo": { "type": "string" },
7 + "bar": { "type": "number", "maximum": 3 }
8 + }
9 +};
10 +
11 +var validate = ajv.compile(schema);
12 +
13 +test({"foo": "abc", "bar": 2});
14 +test({"foo": 2, "bar": 4});
15 +
16 +function test(data) {
17 + var valid = validate(data);
18 + if (valid) console.log('Valid!');
19 + else console.log('Invalid: ' + ajv.errorsText(validate.errors));
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2015-2017 Evgeny Poberezkin
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
22 +
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +
4 +var Cache = module.exports = function Cache() {
5 + this._cache = {};
6 +};
7 +
8 +
9 +Cache.prototype.put = function Cache_put(key, value) {
10 + this._cache[key] = value;
11 +};
12 +
13 +
14 +Cache.prototype.get = function Cache_get(key) {
15 + return this._cache[key];
16 +};
17 +
18 +
19 +Cache.prototype.del = function Cache_del(key) {
20 + delete this._cache[key];
21 +};
22 +
23 +
24 +Cache.prototype.clear = function Cache_clear() {
25 + this._cache = {};
26 +};
1 +'use strict';
2 +
3 +var MissingRefError = require('./error_classes').MissingRef;
4 +
5 +module.exports = compileAsync;
6 +
7 +
8 +/**
9 + * Creates validating function for passed schema with asynchronous loading of missing schemas.
10 + * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
11 + * @this Ajv
12 + * @param {Object} schema schema object
13 + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
14 + * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
15 + * @return {Promise} promise that resolves with a validating function.
16 + */
17 +function compileAsync(schema, meta, callback) {
18 + /* eslint no-shadow: 0 */
19 + /* global Promise */
20 + /* jshint validthis: true */
21 + var self = this;
22 + if (typeof this._opts.loadSchema != 'function')
23 + throw new Error('options.loadSchema should be a function');
24 +
25 + if (typeof meta == 'function') {
26 + callback = meta;
27 + meta = undefined;
28 + }
29 +
30 + var p = loadMetaSchemaOf(schema).then(function () {
31 + var schemaObj = self._addSchema(schema, undefined, meta);
32 + return schemaObj.validate || _compileAsync(schemaObj);
33 + });
34 +
35 + if (callback) {
36 + p.then(
37 + function(v) { callback(null, v); },
38 + callback
39 + );
40 + }
41 +
42 + return p;
43 +
44 +
45 + function loadMetaSchemaOf(sch) {
46 + var $schema = sch.$schema;
47 + return $schema && !self.getSchema($schema)
48 + ? compileAsync.call(self, { $ref: $schema }, true)
49 + : Promise.resolve();
50 + }
51 +
52 +
53 + function _compileAsync(schemaObj) {
54 + try { return self._compile(schemaObj); }
55 + catch(e) {
56 + if (e instanceof MissingRefError) return loadMissingSchema(e);
57 + throw e;
58 + }
59 +
60 +
61 + function loadMissingSchema(e) {
62 + var ref = e.missingSchema;
63 + if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
64 +
65 + var schemaPromise = self._loadingSchemas[ref];
66 + if (!schemaPromise) {
67 + schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
68 + schemaPromise.then(removePromise, removePromise);
69 + }
70 +
71 + return schemaPromise.then(function (sch) {
72 + if (!added(ref)) {
73 + return loadMetaSchemaOf(sch).then(function () {
74 + if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
75 + });
76 + }
77 + }).then(function() {
78 + return _compileAsync(schemaObj);
79 + });
80 +
81 + function removePromise() {
82 + delete self._loadingSchemas[ref];
83 + }
84 +
85 + function added(ref) {
86 + return self._refs[ref] || self._schemas[ref];
87 + }
88 + }
89 + }
90 +}
1 +'use strict';
2 +
3 +// do NOT remove this file - it would break pre-compiled schemas
4 +// https://github.com/ajv-validator/ajv/issues/889
5 +module.exports = require('fast-deep-equal');
1 +'use strict';
2 +
3 +var resolve = require('./resolve');
4 +
5 +module.exports = {
6 + Validation: errorSubclass(ValidationError),
7 + MissingRef: errorSubclass(MissingRefError)
8 +};
9 +
10 +
11 +function ValidationError(errors) {
12 + this.message = 'validation failed';
13 + this.errors = errors;
14 + this.ajv = this.validation = true;
15 +}
16 +
17 +
18 +MissingRefError.message = function (baseId, ref) {
19 + return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
20 +};
21 +
22 +
23 +function MissingRefError(baseId, ref, message) {
24 + this.message = message || MissingRefError.message(baseId, ref);
25 + this.missingRef = resolve.url(baseId, ref);
26 + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
27 +}
28 +
29 +
30 +function errorSubclass(Subclass) {
31 + Subclass.prototype = Object.create(Error.prototype);
32 + Subclass.prototype.constructor = Subclass;
33 + return Subclass;
34 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +var URI = require('uri-js')
4 + , equal = require('fast-deep-equal')
5 + , util = require('./util')
6 + , SchemaObject = require('./schema_obj')
7 + , traverse = require('json-schema-traverse');
8 +
9 +module.exports = resolve;
10 +
11 +resolve.normalizeId = normalizeId;
12 +resolve.fullPath = getFullPath;
13 +resolve.url = resolveUrl;
14 +resolve.ids = resolveIds;
15 +resolve.inlineRef = inlineRef;
16 +resolve.schema = resolveSchema;
17 +
18 +/**
19 + * [resolve and compile the references ($ref)]
20 + * @this Ajv
21 + * @param {Function} compile reference to schema compilation funciton (localCompile)
22 + * @param {Object} root object with information about the root schema for the current schema
23 + * @param {String} ref reference to resolve
24 + * @return {Object|Function} schema object (if the schema can be inlined) or validation function
25 + */
26 +function resolve(compile, root, ref) {
27 + /* jshint validthis: true */
28 + var refVal = this._refs[ref];
29 + if (typeof refVal == 'string') {
30 + if (this._refs[refVal]) refVal = this._refs[refVal];
31 + else return resolve.call(this, compile, root, refVal);
32 + }
33 +
34 + refVal = refVal || this._schemas[ref];
35 + if (refVal instanceof SchemaObject) {
36 + return inlineRef(refVal.schema, this._opts.inlineRefs)
37 + ? refVal.schema
38 + : refVal.validate || this._compile(refVal);
39 + }
40 +
41 + var res = resolveSchema.call(this, root, ref);
42 + var schema, v, baseId;
43 + if (res) {
44 + schema = res.schema;
45 + root = res.root;
46 + baseId = res.baseId;
47 + }
48 +
49 + if (schema instanceof SchemaObject) {
50 + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
51 + } else if (schema !== undefined) {
52 + v = inlineRef(schema, this._opts.inlineRefs)
53 + ? schema
54 + : compile.call(this, schema, root, undefined, baseId);
55 + }
56 +
57 + return v;
58 +}
59 +
60 +
61 +/**
62 + * Resolve schema, its root and baseId
63 + * @this Ajv
64 + * @param {Object} root root object with properties schema, refVal, refs
65 + * @param {String} ref reference to resolve
66 + * @return {Object} object with properties schema, root, baseId
67 + */
68 +function resolveSchema(root, ref) {
69 + /* jshint validthis: true */
70 + var p = URI.parse(ref)
71 + , refPath = _getFullPath(p)
72 + , baseId = getFullPath(this._getId(root.schema));
73 + if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
74 + var id = normalizeId(refPath);
75 + var refVal = this._refs[id];
76 + if (typeof refVal == 'string') {
77 + return resolveRecursive.call(this, root, refVal, p);
78 + } else if (refVal instanceof SchemaObject) {
79 + if (!refVal.validate) this._compile(refVal);
80 + root = refVal;
81 + } else {
82 + refVal = this._schemas[id];
83 + if (refVal instanceof SchemaObject) {
84 + if (!refVal.validate) this._compile(refVal);
85 + if (id == normalizeId(ref))
86 + return { schema: refVal, root: root, baseId: baseId };
87 + root = refVal;
88 + } else {
89 + return;
90 + }
91 + }
92 + if (!root.schema) return;
93 + baseId = getFullPath(this._getId(root.schema));
94 + }
95 + return getJsonPointer.call(this, p, baseId, root.schema, root);
96 +}
97 +
98 +
99 +/* @this Ajv */
100 +function resolveRecursive(root, ref, parsedRef) {
101 + /* jshint validthis: true */
102 + var res = resolveSchema.call(this, root, ref);
103 + if (res) {
104 + var schema = res.schema;
105 + var baseId = res.baseId;
106 + root = res.root;
107 + var id = this._getId(schema);
108 + if (id) baseId = resolveUrl(baseId, id);
109 + return getJsonPointer.call(this, parsedRef, baseId, schema, root);
110 + }
111 +}
112 +
113 +
114 +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
115 +/* @this Ajv */
116 +function getJsonPointer(parsedRef, baseId, schema, root) {
117 + /* jshint validthis: true */
118 + parsedRef.fragment = parsedRef.fragment || '';
119 + if (parsedRef.fragment.slice(0,1) != '/') return;
120 + var parts = parsedRef.fragment.split('/');
121 +
122 + for (var i = 1; i < parts.length; i++) {
123 + var part = parts[i];
124 + if (part) {
125 + part = util.unescapeFragment(part);
126 + schema = schema[part];
127 + if (schema === undefined) break;
128 + var id;
129 + if (!PREVENT_SCOPE_CHANGE[part]) {
130 + id = this._getId(schema);
131 + if (id) baseId = resolveUrl(baseId, id);
132 + if (schema.$ref) {
133 + var $ref = resolveUrl(baseId, schema.$ref);
134 + var res = resolveSchema.call(this, root, $ref);
135 + if (res) {
136 + schema = res.schema;
137 + root = res.root;
138 + baseId = res.baseId;
139 + }
140 + }
141 + }
142 + }
143 + }
144 + if (schema !== undefined && schema !== root.schema)
145 + return { schema: schema, root: root, baseId: baseId };
146 +}
147 +
148 +
149 +var SIMPLE_INLINED = util.toHash([
150 + 'type', 'format', 'pattern',
151 + 'maxLength', 'minLength',
152 + 'maxProperties', 'minProperties',
153 + 'maxItems', 'minItems',
154 + 'maximum', 'minimum',
155 + 'uniqueItems', 'multipleOf',
156 + 'required', 'enum'
157 +]);
158 +function inlineRef(schema, limit) {
159 + if (limit === false) return false;
160 + if (limit === undefined || limit === true) return checkNoRef(schema);
161 + else if (limit) return countKeys(schema) <= limit;
162 +}
163 +
164 +
165 +function checkNoRef(schema) {
166 + var item;
167 + if (Array.isArray(schema)) {
168 + for (var i=0; i<schema.length; i++) {
169 + item = schema[i];
170 + if (typeof item == 'object' && !checkNoRef(item)) return false;
171 + }
172 + } else {
173 + for (var key in schema) {
174 + if (key == '$ref') return false;
175 + item = schema[key];
176 + if (typeof item == 'object' && !checkNoRef(item)) return false;
177 + }
178 + }
179 + return true;
180 +}
181 +
182 +
183 +function countKeys(schema) {
184 + var count = 0, item;
185 + if (Array.isArray(schema)) {
186 + for (var i=0; i<schema.length; i++) {
187 + item = schema[i];
188 + if (typeof item == 'object') count += countKeys(item);
189 + if (count == Infinity) return Infinity;
190 + }
191 + } else {
192 + for (var key in schema) {
193 + if (key == '$ref') return Infinity;
194 + if (SIMPLE_INLINED[key]) {
195 + count++;
196 + } else {
197 + item = schema[key];
198 + if (typeof item == 'object') count += countKeys(item) + 1;
199 + if (count == Infinity) return Infinity;
200 + }
201 + }
202 + }
203 + return count;
204 +}
205 +
206 +
207 +function getFullPath(id, normalize) {
208 + if (normalize !== false) id = normalizeId(id);
209 + var p = URI.parse(id);
210 + return _getFullPath(p);
211 +}
212 +
213 +
214 +function _getFullPath(p) {
215 + return URI.serialize(p).split('#')[0] + '#';
216 +}
217 +
218 +
219 +var TRAILING_SLASH_HASH = /#\/?$/;
220 +function normalizeId(id) {
221 + return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
222 +}
223 +
224 +
225 +function resolveUrl(baseId, id) {
226 + id = normalizeId(id);
227 + return URI.resolve(baseId, id);
228 +}
229 +
230 +
231 +/* @this Ajv */
232 +function resolveIds(schema) {
233 + var schemaId = normalizeId(this._getId(schema));
234 + var baseIds = {'': schemaId};
235 + var fullPaths = {'': getFullPath(schemaId, false)};
236 + var localRefs = {};
237 + var self = this;
238 +
239 + traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
240 + if (jsonPtr === '') return;
241 + var id = self._getId(sch);
242 + var baseId = baseIds[parentJsonPtr];
243 + var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
244 + if (keyIndex !== undefined)
245 + fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
246 +
247 + if (typeof id == 'string') {
248 + id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
249 +
250 + var refVal = self._refs[id];
251 + if (typeof refVal == 'string') refVal = self._refs[refVal];
252 + if (refVal && refVal.schema) {
253 + if (!equal(sch, refVal.schema))
254 + throw new Error('id "' + id + '" resolves to more than one schema');
255 + } else if (id != normalizeId(fullPath)) {
256 + if (id[0] == '#') {
257 + if (localRefs[id] && !equal(sch, localRefs[id]))
258 + throw new Error('id "' + id + '" resolves to more than one schema');
259 + localRefs[id] = sch;
260 + } else {
261 + self._refs[id] = fullPath;
262 + }
263 + }
264 + }
265 + baseIds[jsonPtr] = baseId;
266 + fullPaths[jsonPtr] = fullPath;
267 + });
268 +
269 + return localRefs;
270 +}
1 +'use strict';
2 +
3 +var ruleModules = require('../dotjs')
4 + , toHash = require('./util').toHash;
5 +
6 +module.exports = function rules() {
7 + var RULES = [
8 + { type: 'number',
9 + rules: [ { 'maximum': ['exclusiveMaximum'] },
10 + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
11 + { type: 'string',
12 + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
13 + { type: 'array',
14 + rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
15 + { type: 'object',
16 + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
17 + { 'properties': ['additionalProperties', 'patternProperties'] } ] },
18 + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
19 + ];
20 +
21 + var ALL = [ 'type', '$comment' ];
22 + var KEYWORDS = [
23 + '$schema', '$id', 'id', '$data', '$async', 'title',
24 + 'description', 'default', 'definitions',
25 + 'examples', 'readOnly', 'writeOnly',
26 + 'contentMediaType', 'contentEncoding',
27 + 'additionalItems', 'then', 'else'
28 + ];
29 + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
30 + RULES.all = toHash(ALL);
31 + RULES.types = toHash(TYPES);
32 +
33 + RULES.forEach(function (group) {
34 + group.rules = group.rules.map(function (keyword) {
35 + var implKeywords;
36 + if (typeof keyword == 'object') {
37 + var key = Object.keys(keyword)[0];
38 + implKeywords = keyword[key];
39 + keyword = key;
40 + implKeywords.forEach(function (k) {
41 + ALL.push(k);
42 + RULES.all[k] = true;
43 + });
44 + }
45 + ALL.push(keyword);
46 + var rule = RULES.all[keyword] = {
47 + keyword: keyword,
48 + code: ruleModules[keyword],
49 + implements: implKeywords
50 + };
51 + return rule;
52 + });
53 +
54 + RULES.all.$comment = {
55 + keyword: '$comment',
56 + code: ruleModules.$comment
57 + };
58 +
59 + if (group.type) RULES.types[group.type] = group;
60 + });
61 +
62 + RULES.keywords = toHash(ALL.concat(KEYWORDS));
63 + RULES.custom = {};
64 +
65 + return RULES;
66 +};
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.