1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

add typings for basic intellisense

This commit is contained in:
Steve-Mcl 2021-04-29 16:54:29 +01:00
parent 69dafd6c68
commit 1f7884dc70
20 changed files with 379 additions and 0 deletions

View File

@ -0,0 +1,39 @@
node and node-red types for intellisense for monaco
---------------------------------------------------
node-js and node-red types are included in node-red for monaco and any other editor to provide intellisense in the code editor
as node-js v14 is the default recommended target as of writing, the most popular node-js types (see below) have been taken from most up-to-date types from `@types/node` and minified using `dts-minify`
* buffer.d.ts
* console.d.ts
* crypto.d.ts
* fs.d.ts
* globals.d.ts
* http.d.ts
* net.d.ts
* os.d.ts
* process.d.ts
* querystring.d.ts
* string_decoder.d.ts
* url.d.ts
* zlib.d.ts
These are placed in `node_modules/@node-red/editor-client/src/`
The grunt task will place this default set of typings in `node_modules/@node-red/editor-client/public/types/` for consumption by the code editor.
# Instructions
See packages/node_modules/@node-red/editor-client/src/vendor/monaco/README.md
# Alternative / Manual Installation
* `npm install --save @types/node@14.14.43`
* (optional) minify using `dts-minify`
* copy files from `node_modules/@node-red/editor-client/src/` to `(node-red-src)/packages/node_modules/@node-red/editor-client/src/types/node`
* update types for node-red in files to match src definitions...
* (node-red-src)/packages/node_modules/@node-red/editor-client/src/types/node-red/func.d.ts
* (node-red-src)/packages/node_modules/@node-red/editor-client/src/types/node-red/util.d.ts

View File

@ -0,0 +1,101 @@
interface NodeMessage {
topic?: string;
payload?: any;
_msgid?: string;
[other: any]: any; //permit other properties
}
/** @type {NodeMessage} the `msg` object */
var msg: NodeMessage;
/** @type {string} the id of the incoming `msg` (alias of msg._msgid) */
const __msgid__:string;
/**
* @typedef NodeStatus
* @type {object}
* @property {string} [fill] The fill property can be: red, green, yellow, blue or grey.
* @property {string} [shape] The shape property can be: ring or dot.
* @property {string} [text] The text to display
*/
interface NodeStatus {
/** The fill property can be: red, green, yellow, blue or grey */
fill?: string,
/** The shape property can be: ring or dot */
shape?: string,
/** The text to display */
text?: string
}
declare class node {
/**
* Send 1 or more messages asynchronously
* @param {object | object[]} msg The msg object
* @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true`
* @example Send 1 msg to output 1
* ```javascript
* node.send({ payload: "a" });
* ```
* @example Send 2 msg to 2 outputs
* ```javascript
* node.send([{ payload: "output1" }, { payload: "output2" }]);
* ```
* @example Send 3 msg to output 1
* ```javascript
* node.send([[{ payload: 1 }, { payload: 2 }, { payload: 3 }]]);
* ```
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
*/
static send(msg:object, clone:Boolean=true);
/** Inform runtime this instance has completed its operation */
static done();
/** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */
static error(err:string|Error, msg:object=null);
/** Log a warn message to the console and debug sidebar */
static warn(warning:string|Object);
/** Log an info message to the console (not sent to sidebar)' */
static log(info:string|Object);
/** Set the status icon and text underneath the node.
* @param {NodeStatus} status - The status object `{fill, shape, text}`
* @example clear node status
* ```javascript
* node.status({});
* ```
* @example set node status to red ring with text
* ```javascript
* node.status({fill:"red",shape:"ring",text:"error"})
* ```
* @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
*/
static status(status:NodeStatus);
/** the id of this node */
public static readonly id:string;
/** the name of this node */
public static readonly name:string;
/** the number of outputs of this node */
public static readonly outputCount:Number;
}
declare class context {
/** Get a value from context */
static get(name:string, store:string="default");
/** Store a value in context */
static set(name:string, value:Any, store:string="default");
/** Get an array of the keys in the context store */
static keys(store:string="default"):Array ;
}
declare class flow {
/** Get a value from flow context */
static get(name:string, store:string="default");
/** Store a value in flow context */
static set(name:string, value:Any, store:string="default");
/** Get an array of the keys in the flow context store */
static keys(store:string="default"):Array ;
}
declare class global {
/** Get a value from global context */
static get(name:string, store:string="default");
/** Store a value in global context */
static set(name:string, value:Any, store:string="default");
/** Get an array of the keys in the global context store */
static keys(store:string="default"):Array ;
}

View File

@ -0,0 +1,208 @@
/*
How to generate...
1. Generate from packages\node_modules\@node-red\util\lib\util.js using `npx typescript` and a tsconfig.json of...
{
"files": ["packages/node_modules/@node-red/util/lib/util.js"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types",
"strict": false,
"moduleResolution": "node"
}
}
2. remove all the `export ` statements
3. Wrap the remaining code in declare namespace RED { declare namespace util { ... } }
4. check . adjust types like String --> string, Object --> object etc (where appropriate)
*/
declare namespace RED {
/**
* Utility functions for the node-red function sandbox
*/
declare namespace util {
/**
* Encode an object to JSON without losing information about non-JSON types
* such as Buffer and Function.
*
* *This function is closely tied to its reverse within the editor*
*
* @param {Object} msg
* @param {Object} opts
* @return {Object} the encoded object
* @memberof @node-red/util_util
*/
function encodeObject(msg: any, opts: any): any;
/**
* Converts the provided argument to a String, using type-dependent
* methods.
*
* @param {any} o - the property to convert to a String
* @return {string} the stringified version
* @memberof @node-red/util_util
*/
function ensureString(o: any): string;
/**
* Converts the provided argument to a Buffer, using type-dependent
* methods.
*
* @param {any} o - the property to convert to a Buffer
* @return {string} the Buffer version
* @memberof @node-red/util_util
*/
function ensureBuffer(o: any): string;
/**
* Safely clones a message object. This handles msg.req/msg.res objects that must
* not be cloned.
*
* @param {object} msg - the message object to clone
* @return {object} the cloned message
* @memberof @node-red/util_util
*/
function cloneMessage(msg: object): object;
/**
* Compares two objects, handling various JavaScript types.
*
* @param {any} obj1
* @param {any} obj2
* @return {boolean} whether the two objects are the same
* @memberof @node-red/util_util
*/
function compareObjects(obj1: any, obj2: any): boolean;
/**
* Generates a psuedo-unique-random id.
* @return {string} a random-ish id
* @memberof @node-red/util_util
*/
function generateId(): string;
/**
* Gets a property of a message object.
*
* Unlike {@link @node-red/util-util.getObjectProperty}, this function will strip `msg.` from the
* front of the property expression if present.
*
* @param {object} msg - the message object
* @param {string} expr - the property expression
* @return {any} the message property, or undefined if it does not exist
* @throws Will throw an error if the *parent* of the property does not exist
* @memberof @node-red/util_util
*/
function getMessageProperty(msg: object, expr: string): any;
/**
* Sets a property of a message object.
*
* Unlike {@link @node-red/util-util.setObjectProperty}, this function will strip `msg.` from the
* front of the property expression if present.
*
* @param {object} msg - the message object
* @param {string} prop - the property expression
* @param {any} [value] - the value to set
* @param {boolean} [createMissing] - whether to create missing parent properties
* @memberof @node-red/util_util
*/
function setMessageProperty(msg: object, prop: string, value?: any, createMissing?: boolean): boolean;
/**
* Gets a property of an object.
*
* Given the object:
*
* {
* "pet": {
* "type": "cat"
* }
* }
*
* - `pet.type` will return `"cat"`.
* - `pet.name` will return `undefined`
* - `car` will return `undefined`
* - `car.type` will throw an Error (as `car` does not exist)
*
* @param {object} msg - the object
* @param {string} expr - the property expression
* @return {any} the object property, or undefined if it does not exist
* @throws Will throw an error if the *parent* of the property does not exist
* @memberof @node-red/util_util
*/
function getObjectProperty(msg: object, expr: string): any;
/**
* Sets a property of an object.
*
* @param {object} msg - the object
* @param {string} prop - the property expression
* @param {any} [value] - the value to set
* @param {boolean} [createMissing] - whether to create missing parent properties
* @memberof @node-red/util_util
*/
function setObjectProperty(msg: object, prop: string, value?: any, createMissing?: boolean): boolean;
/**
* Evaluates a property value according to its type.
*
* @param {string} value - the raw value
* @param {string} type - the type of the value
* @param {Node} node - the node evaluating the property
* @param {Object} msg - the message object to evaluate against
* @param {Function} callback - (optional) called when the property is evaluated
* @return {any} The evaluated property, if no `callback` is provided
* @memberof @node-red/util_util
*/
function evaluateNodeProperty(value: string, type: string, node: Node, msg: any, callback: Function): any;
/**
* Parses a property expression, such as `msg.foo.bar[3]` to validate it
* and convert it to a canonical version expressed as an Array of property
* names.
*
* For example, `a["b"].c` returns `['a','b','c']`
*
* @param {string} str - the property expression
* @return {any[]} the normalised expression
* @memberof @node-red/util_util
*/
function normalisePropertyExpression(str: string): any[];
/**
* Normalise a node type name to camel case.
*
* For example: `a-random node type` will normalise to `aRandomNodeType`
*
* @param {string} name - the node type
* @return {string} The normalised name
* @memberof @node-red/util_util
*/
function normaliseNodeTypeName(name: string): string;
/**
* Prepares a JSONata expression for evaluation.
* This attaches Node-RED specific functions to the expression.
*
* @param {string} value - the JSONata expression
* @param {Node} node - the node evaluating the property
* @return {any} The JSONata expression that can be evaluated
* @memberof @node-red/util_util
*/
function prepareJSONataExpression(value: string, node: Node): any;
/**
* Evaluates a JSONata expression.
* The expression must have been prepared with {@link @node-red/util-util.prepareJSONataExpression}
* before passing to this function.
*
* @param {Object} expr - the prepared JSONata expression
* @param {Object} msg - the message object to evaluate against
* @param {Function} callback - (optional) called when the expression is evaluated
* @return {any} If no callback was provided, the result of the expression
* @memberof @node-red/util_util
*/
function evaluateJSONataExpression(expr: any, msg: any, callback: Function): any;
/**
* Parses a context property string, as generated by the TypedInput, to extract
* the store name if present.
*
* For example, `#:(file)::foo` results in ` { store: "file", key: "foo" }`.
*
* @param {string} key - the context property string to parse
* @return {any} The parsed property
* @memberof @node-red/util_util
*/
function parseContextStore(key: string): any;
}
}

View File

@ -0,0 +1 @@
declare module'node:buffer'{export*from'buffer';}declare module'buffer'{export const INSPECT_MAX_BYTES:number;export const kMaxLength:number;export const kStringMaxLength:number;export const constants:{MAX_LENGTH:number;MAX_STRING_LENGTH:number;};const BuffType:typeof Buffer;export type TranscodeEncoding="ascii"|"utf8"|"utf16le"|"ucs2"|"latin1"|"binary";export function transcode(source:Uint8Array,fromEnc:TranscodeEncoding,toEnc:TranscodeEncoding):Buffer;export const SlowBuffer:{new(size:number):Buffer;prototype:Buffer;};export{BuffType as Buffer};}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
declare module'node:console'{export=console;}declare module'console'{import{InspectOptions}from'node:util';global{interface Console{Console:NodeJS.ConsoleConstructor;assert(value:any,message?:string,...optionalParams:any[]):void;clear():void;count(label?:string):void;countReset(label?:string):void;debug(message?:any,...optionalParams:any[]):void;dir(obj:any,options?:InspectOptions):void;dirxml(...data:any[]):void;error(message?:any,...optionalParams:any[]):void;group(...label:any[]):void;groupCollapsed(...label:any[]):void;groupEnd():void;info(message?:any,...optionalParams:any[]):void;log(message?:any,...optionalParams:any[]):void;table(tabularData:any,properties?:ReadonlyArray<string>):void;time(label?:string):void;timeEnd(label?:string):void;timeLog(label?:string,...data:any[]):void;trace(message?:any,...optionalParams:any[]):void;warn(message?:any,...optionalParams:any[]):void;profile(label?:string):void;profileEnd(label?:string):void;timeStamp(label?:string):void;}var console:Console;namespace NodeJS{interface ConsoleConstructorOptions{stdout:WritableStream;stderr?:WritableStream;ignoreErrors?:boolean;colorMode?:boolean|'auto';inspectOptions?:InspectOptions;}interface ConsoleConstructor{prototype:Console;new(stdout:WritableStream,stderr?:WritableStream,ignoreErrors?:boolean):Console;new(options:ConsoleConstructorOptions):Console;}interface Global{console:typeof console;}}}export=console;}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
declare module'node:dgram'{export*from'dgram';}declare module'dgram'{import{AddressInfo}from'node:net';import*as dns from'node:dns';import EventEmitter=require('node:events');interface RemoteInfo{address:string;family:'IPv4'|'IPv6';port:number;size:number;}interface BindOptions{port?:number;address?:string;exclusive?:boolean;fd?:number;}type SocketType="udp4"|"udp6";interface SocketOptions{type:SocketType;reuseAddr?:boolean;ipv6Only?:boolean;recvBufferSize?:number;sendBufferSize?:number;lookup?:(hostname:string,options:dns.LookupOneOptions,callback:(err:NodeJS.ErrnoException|null,address:string,family:number)=>void)=>void;}function createSocket(type:SocketType,callback?:(msg:Buffer,rinfo:RemoteInfo)=>void):Socket;function createSocket(options:SocketOptions,callback?:(msg:Buffer,rinfo:RemoteInfo)=>void):Socket;class Socket extends EventEmitter{addMembership(multicastAddress:string,multicastInterface?:string):void;address():AddressInfo;bind(port?:number,address?:string,callback?:()=>void):void;bind(port?:number,callback?:()=>void):void;bind(callback?:()=>void):void;bind(options:BindOptions,callback?:()=>void):void;close(callback?:()=>void):void;connect(port:number,address?:string,callback?:()=>void):void;connect(port:number,callback:()=>void):void;disconnect():void;dropMembership(multicastAddress:string,multicastInterface?:string):void;getRecvBufferSize():number;getSendBufferSize():number;ref():this;remoteAddress():AddressInfo;send(msg:string|Uint8Array|ReadonlyArray<any>,port?:number,address?:string,callback?:(error:Error|null,bytes:number)=>void):void;send(msg:string|Uint8Array|ReadonlyArray<any>,port?:number,callback?:(error:Error|null,bytes:number)=>void):void;send(msg:string|Uint8Array|ReadonlyArray<any>,callback?:(error:Error|null,bytes:number)=>void):void;send(msg:string|Uint8Array,offset:number,length:number,port?:number,address?:string,callback?:(error:Error|null,bytes:number)=>void):void;send(msg:string|Uint8Array,offset:number,length:number,port?:number,callback?:(error:Error|null,bytes:number)=>void):void;send(msg:string|Uint8Array,offset:number,length:number,callback?:(error:Error|null,bytes:number)=>void):void;setBroadcast(flag:boolean):void;setMulticastInterface(multicastInterface:string):void;setMulticastLoopback(flag:boolean):void;setMulticastTTL(ttl:number):void;setRecvBufferSize(size:number):void;setSendBufferSize(size:number):void;setTTL(ttl:number):void;unref():this;addSourceSpecificMembership(sourceAddress:string,groupAddress:string,multicastInterface?:string):void;dropSourceSpecificMembership(sourceAddress:string,groupAddress:string,multicastInterface?:string):void;addListener(event:string,listener:(...args:any[])=>void):this;addListener(event:"close",listener:()=>void):this;addListener(event:"connect",listener:()=>void):this;addListener(event:"error",listener:(err:Error)=>void):this;addListener(event:"listening",listener:()=>void):this;addListener(event:"message",listener:(msg:Buffer,rinfo:RemoteInfo)=>void):this;emit(event:string|symbol,...args:any[]):boolean;emit(event:"close"):boolean;emit(event:"connect"):boolean;emit(event:"error",err:Error):boolean;emit(event:"listening"):boolean;emit(event:"message",msg:Buffer,rinfo:RemoteInfo):boolean;on(event:string,listener:(...args:any[])=>void):this;on(event:"close",listener:()=>void):this;on(event:"connect",listener:()=>void):this;on(event:"error",listener:(err:Error)=>void):this;on(event:"listening",listener:()=>void):this;on(event:"message",listener:(msg:Buffer,rinfo:RemoteInfo)=>void):this;once(event:string,listener:(...args:any[])=>void):this;once(event:"close",listener:()=>void):this;once(event:"connect",listener:()=>void):this;once(event:"error",listener:(err:Error)=>void):this;once(event:"listening",listener:()=>void):this;once(event:"message",listener:(msg:Buffer,rinfo:RemoteInfo)=>void):this;prependListener(event:string,listener:(...args:any[])=>void):this;prependListener(event:"close",listener:()=>void):this;prependListener(event:"connect",listener:()=>void):this;prependListener(event:"error",listener:(err:Error)=>void):this;prependListener(event:"listening",listener:()=>void):this;prependListener(event:"message",listener:(msg:Buffer,rinfo:RemoteInfo)=>void):this;prependOnceListener(event:string,listener:(...args:any[])=>void):this;prependOnceListener(event:"close",listener:()=>void):this;prependOnceListener(event:"connect",listener:()=>void):this;prependOnceListener(event:"error",listener:(err:Error)=>void):this;prependOnceListener(event:"listening",listener:()=>void):this;prependOnceListener(event:"message",listener:(msg:Buffer,rinfo:RemoteInfo)=>void):this;}}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
declare module'node:domain'{export*from'domain';}declare module'domain'{import EventEmitter=require('node:events');global{namespace NodeJS{interface Domain extends EventEmitter{run<T>(fn:(...args:any[])=>T,...args:any[]):T;add(emitter:EventEmitter|Timer):void;remove(emitter:EventEmitter|Timer):void;bind<T extends Function>(cb:T):T;intercept<T extends Function>(cb:T):T;}}}interface Domain extends NodeJS.Domain{}class Domain extends EventEmitter{members:Array<EventEmitter|NodeJS.Timer>;enter():void;exit():void;}function create():Domain;}

View File

@ -0,0 +1 @@
declare module'node:events'{import EventEmitter=require('events');export=EventEmitter;}declare module'events'{interface EventEmitterOptions{captureRejections?:boolean;}interface NodeEventTarget{once(event:string|symbol,listener:(...args:any[])=>void):this;}interface DOMEventTarget{addEventListener(event:string,listener:(...args:any[])=>void,opts?:{once:boolean}):any;}interface EventEmitter extends NodeJS.EventEmitter{}class EventEmitter{constructor(options?:EventEmitterOptions);static once(emitter:NodeEventTarget,event:string|symbol):Promise<any[]>;static once(emitter:DOMEventTarget,event:string):Promise<any[]>;static on(emitter:NodeJS.EventEmitter,event:string):AsyncIterableIterator<any>;static listenerCount(emitter:NodeJS.EventEmitter,event:string|symbol):number;static readonly errorMonitor:unique symbol;static readonly captureRejectionSymbol:unique symbol;static captureRejections:boolean;static defaultMaxListeners:number;}import internal=require('events');namespace EventEmitter{export{internal as EventEmitter};}global{namespace NodeJS{interface EventEmitter{addListener(event:string|symbol,listener:(...args:any[])=>void):this;on(event:string|symbol,listener:(...args:any[])=>void):this;once(event:string|symbol,listener:(...args:any[])=>void):this;removeListener(event:string|symbol,listener:(...args:any[])=>void):this;off(event:string|symbol,listener:(...args:any[])=>void):this;removeAllListeners(event?:string|symbol):this;setMaxListeners(n:number):this;getMaxListeners():number;listeners(event:string|symbol):Function[];rawListeners(event:string|symbol):Function[];emit(event:string|symbol,...args:any[]):boolean;listenerCount(event:string|symbol):number;prependListener(event:string|symbol,listener:(...args:any[])=>void):this;prependOnceListener(event:string|symbol,listener:(...args:any[])=>void):this;eventNames():Array<string|symbol>;}}}export=EventEmitter;}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
declare module'node:os'{export*from'os';}declare module'os'{interface CpuInfo{model:string;speed:number;times:{user:number;nice:number;sys:number;idle:number;irq:number;};}interface NetworkInterfaceBase{address:string;netmask:string;mac:string;internal:boolean;cidr:string|null;}interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase{family:"IPv4";}interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase{family:"IPv6";scopeid:number;}interface UserInfo<T>{username:T;uid:number;gid:number;shell:T;homedir:T;}type NetworkInterfaceInfo=NetworkInterfaceInfoIPv4|NetworkInterfaceInfoIPv6;function hostname():string;function loadavg():number[];function uptime():number;function freemem():number;function totalmem():number;function cpus():CpuInfo[];function type():string;function release():string;function networkInterfaces():NodeJS.Dict<NetworkInterfaceInfo[]>;function homedir():string;function userInfo(options:{encoding:'buffer'}):UserInfo<Buffer>;function userInfo(options?:{encoding:BufferEncoding}):UserInfo<string>;type SignalConstants={[key in NodeJS.Signals]:number;};namespace constants{const UV_UDP_REUSEADDR:number;namespace signals{}const signals:SignalConstants;namespace errno{const E2BIG:number;const EACCES:number;const EADDRINUSE:number;const EADDRNOTAVAIL:number;const EAFNOSUPPORT:number;const EAGAIN:number;const EALREADY:number;const EBADF:number;const EBADMSG:number;const EBUSY:number;const ECANCELED:number;const ECHILD:number;const ECONNABORTED:number;const ECONNREFUSED:number;const ECONNRESET:number;const EDEADLK:number;const EDESTADDRREQ:number;const EDOM:number;const EDQUOT:number;const EEXIST:number;const EFAULT:number;const EFBIG:number;const EHOSTUNREACH:number;const EIDRM:number;const EILSEQ:number;const EINPROGRESS:number;const EINTR:number;const EINVAL:number;const EIO:number;const EISCONN:number;const EISDIR:number;const ELOOP:number;const EMFILE:number;const EMLINK:number;const EMSGSIZE:number;const EMULTIHOP:number;const ENAMETOOLONG:number;const ENETDOWN:number;const ENETRESET:number;const ENETUNREACH:number;const ENFILE:number;const ENOBUFS:number;const ENODATA:number;const ENODEV:number;const ENOENT:number;const ENOEXEC:number;const ENOLCK:number;const ENOLINK:number;const ENOMEM:number;const ENOMSG:number;const ENOPROTOOPT:number;const ENOSPC:number;const ENOSR:number;const ENOSTR:number;const ENOSYS:number;const ENOTCONN:number;const ENOTDIR:number;const ENOTEMPTY:number;const ENOTSOCK:number;const ENOTSUP:number;const ENOTTY:number;const ENXIO:number;const EOPNOTSUPP:number;const EOVERFLOW:number;const EPERM:number;const EPIPE:number;const EPROTO:number;const EPROTONOSUPPORT:number;const EPROTOTYPE:number;const ERANGE:number;const EROFS:number;const ESPIPE:number;const ESRCH:number;const ESTALE:number;const ETIME:number;const ETIMEDOUT:number;const ETXTBSY:number;const EWOULDBLOCK:number;const EXDEV:number;const WSAEINTR:number;const WSAEBADF:number;const WSAEACCES:number;const WSAEFAULT:number;const WSAEINVAL:number;const WSAEMFILE:number;const WSAEWOULDBLOCK:number;const WSAEINPROGRESS:number;const WSAEALREADY:number;const WSAENOTSOCK:number;const WSAEDESTADDRREQ:number;const WSAEMSGSIZE:number;const WSAEPROTOTYPE:number;const WSAENOPROTOOPT:number;const WSAEPROTONOSUPPORT:number;const WSAESOCKTNOSUPPORT:number;const WSAEOPNOTSUPP:number;const WSAEPFNOSUPPORT:number;const WSAEAFNOSUPPORT:number;const WSAEADDRINUSE:number;const WSAEADDRNOTAVAIL:number;const WSAENETDOWN:number;const WSAENETUNREACH:number;const WSAENETRESET:number;const WSAECONNABORTED:number;const WSAECONNRESET:number;const WSAENOBUFS:number;const WSAEISCONN:number;const WSAENOTCONN:number;const WSAESHUTDOWN:number;const WSAETOOMANYREFS:number;const WSAETIMEDOUT:number;const WSAECONNREFUSED:number;const WSAELOOP:number;const WSAENAMETOOLONG:number;const WSAEHOSTDOWN:number;const WSAEHOSTUNREACH:number;const WSAENOTEMPTY:number;const WSAEPROCLIM:number;const WSAEUSERS:number;const WSAEDQUOT:number;const WSAESTALE:number;const WSAEREMOTE:number;const WSASYSNOTREADY:number;const WSAVERNOTSUPPORTED:number;const WSANOTINITIALISED:number;const WSAEDISCON:number;const WSAENOMORE:number;const WSAECANCELLED:number;const WSAEINVALIDPROCTABLE:number;const WSAEINVALIDPROVIDER:number;const WSAEPROVIDERFAILEDINIT:number;const WSASYSCALLFAILURE:number;const WSASERVICE_NOT_FOUND:number;const WSATYPE_NOT_FOUND:number;const WSA_E_NO_MORE:number;const WSA_E_CANCELLED:number;const WSAEREFUSED:number;}namespace priority{const PRIORITY_LOW:number;const PRIORITY_BELOW_NORMAL:number;const PRIORITY_NORMAL:number;const PRIORITY_ABOVE_NORMAL:number;const PRIORITY_HIGH:number;const PRIORITY_HIGHEST:number;}}function arch():string;function version():string;function platform():NodeJS.Platform;function tmpdir():string;const EOL:string;function endianness():"BE"|"LE";function getPriority(pid?:number):number;function setPriority(priority:number):void;function setPriority(pid:number,priority:number):void;}

View File

@ -0,0 +1 @@
declare module'node:path'{import path=require('path');export=path;}declare module'path'{namespace path{interface ParsedPath{root:string;dir:string;base:string;ext:string;name:string;}interface FormatInputPathObject{root?:string;dir?:string;base?:string;ext?:string;name?:string;}interface PlatformPath{normalize(p:string):string;join(...paths:string[]):string;resolve(...pathSegments:string[]):string;isAbsolute(p:string):boolean;relative(from:string,to:string):string;dirname(p:string):string;basename(p:string,ext?:string):string;extname(p:string):string;readonly sep:string;readonly delimiter:string;parse(p:string):ParsedPath;format(pP:FormatInputPathObject):string;toNamespacedPath(path:string):string;readonly posix:PlatformPath;readonly win32:PlatformPath;}}const path:path.PlatformPath;export=path;}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
declare module'node:querystring'{export*from'querystring';}declare module'querystring'{interface StringifyOptions{encodeURIComponent?:(str:string)=>string;}interface ParseOptions{maxKeys?:number;decodeURIComponent?:(str:string)=>string;}interface ParsedUrlQuery extends NodeJS.Dict<string|string[]>{}interface ParsedUrlQueryInput extends NodeJS.Dict<string|number|boolean|ReadonlyArray<string>|ReadonlyArray<number>|ReadonlyArray<boolean>|null>{}function stringify(obj?:ParsedUrlQueryInput,sep?:string,eq?:string,options?:StringifyOptions):string;function parse(str:string,sep?:string,eq?:string,options?:ParseOptions):ParsedUrlQuery;const encode:typeof stringify;const decode:typeof parse;function escape(str:string):string;function unescape(str:string):string;}

View File

@ -0,0 +1 @@
declare module'node:url'{export*from'url';}declare module'url'{import{ParsedUrlQuery,ParsedUrlQueryInput}from'node:querystring';interface UrlObject{auth?:string|null;hash?:string|null;host?:string|null;hostname?:string|null;href?:string|null;pathname?:string|null;protocol?:string|null;search?:string|null;slashes?:boolean|null;port?:string|number|null;query?:string|null|ParsedUrlQueryInput;}interface Url{auth:string|null;hash:string|null;host:string|null;hostname:string|null;href:string;path:string|null;pathname:string|null;protocol:string|null;search:string|null;slashes:boolean|null;port:string|null;query:string|null|ParsedUrlQuery;}interface UrlWithParsedQuery extends Url{query:ParsedUrlQuery;}interface UrlWithStringQuery extends Url{query:string|null;}function parse(urlStr:string):UrlWithStringQuery;function parse(urlStr:string,parseQueryString:false|undefined,slashesDenoteHost?:boolean):UrlWithStringQuery;function parse(urlStr:string,parseQueryString:true,slashesDenoteHost?:boolean):UrlWithParsedQuery;function parse(urlStr:string,parseQueryString:boolean,slashesDenoteHost?:boolean):Url;function format(URL:URL,options?:URLFormatOptions):string;function format(urlObject:UrlObject|string):string;function resolve(from:string,to:string):string;function domainToASCII(domain:string):string;function domainToUnicode(domain:string):string;function fileURLToPath(url:string|URL):string;function pathToFileURL(url:string):URL;interface URLFormatOptions{auth?:boolean;fragment?:boolean;search?:boolean;unicode?:boolean;}class URL{constructor(input:string,base?:string|URL);hash:string;host:string;hostname:string;href:string;readonly origin:string;password:string;pathname:string;port:string;protocol:string;search:string;readonly searchParams:URLSearchParams;username:string;toString():string;toJSON():string;}class URLSearchParams implements Iterable<[string,string]>{constructor(init?:URLSearchParams|string|NodeJS.Dict<string|ReadonlyArray<string>>|Iterable<[string,string]>|ReadonlyArray<[string,string]>);append(name:string,value:string):void;delete(name:string):void;entries():IterableIterator<[string,string]>;forEach(callback:(value:string,name:string,searchParams:this)=>void):void;get(name:string):string|null;getAll(name:string):string[];has(name:string):boolean;keys():IterableIterator<string>;set(name:string,value:string):void;sort():void;toString():string;values():IterableIterator<string>;[Symbol.iterator]():IterableIterator<[string,string]>;}}