Skip to content

Commit

Permalink
馃 Merge PR #57498 node: Add support for node: prefix on v14 by @LinusU
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Dec 3, 2021
1 parent c359539 commit ee41314
Show file tree
Hide file tree
Showing 77 changed files with 223 additions and 89 deletions.
4 changes: 4 additions & 0 deletions types/node/v14/assert.d.ts
Expand Up @@ -122,3 +122,7 @@ declare module 'assert' {

export = assert;
}
declare module 'node:assert' {
import assert = require('assert');
export = assert;
}
3 changes: 3 additions & 0 deletions types/node/v14/async_hooks.d.ts
Expand Up @@ -224,3 +224,6 @@ declare module 'async_hooks' {
enterWith(store: T): void;
}
}
declare module 'node:async_hooks' {
export * from 'async_hooks';
}
3 changes: 3 additions & 0 deletions types/node/v14/buffer.d.ts
Expand Up @@ -20,3 +20,6 @@ declare module 'buffer' {

export { BuffType as Buffer };
}
declare module 'node:buffer' {
export * from 'buffer';
}
3 changes: 3 additions & 0 deletions types/node/v14/child_process.d.ts
Expand Up @@ -509,3 +509,6 @@ declare module 'child_process' {
function execFileSync(command: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer;
}
declare module 'node:child_process' {
export * from 'child_process';
}
3 changes: 3 additions & 0 deletions types/node/v14/cluster.d.ts
Expand Up @@ -260,3 +260,6 @@ declare module 'cluster' {

function eventNames(): string[];
}
declare module 'node:cluster' {
export * from 'cluster';
}
4 changes: 4 additions & 0 deletions types/node/v14/console.d.ts
@@ -1,4 +1,8 @@
declare module 'console' {
import console = require('node:console');
export = console;
}
declare module 'node:console' {
import { InspectOptions } from 'util';

global {
Expand Down
5 changes: 5 additions & 0 deletions types/node/v14/constants.d.ts
Expand Up @@ -11,3 +11,8 @@ declare module 'constants' {
typeof fsConstants;
export = exp;
}

declare module 'node:constants' {
import constants = require('constants');
export = constants;
}
3 changes: 3 additions & 0 deletions types/node/v14/crypto.d.ts
Expand Up @@ -1184,3 +1184,6 @@ declare module 'crypto' {
*/
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
}
declare module 'node:crypto' {
export * from 'crypto';
}
3 changes: 3 additions & 0 deletions types/node/v14/dgram.d.ts
Expand Up @@ -139,3 +139,6 @@ declare module 'dgram' {
prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
}
}
declare module 'node:dgram' {
export * from 'dgram';
}
3 changes: 3 additions & 0 deletions types/node/v14/dns.d.ts
Expand Up @@ -382,3 +382,6 @@ declare module 'dns' {
}
}
}
declare module 'node:dns' {
export * from 'dns';
}
3 changes: 3 additions & 0 deletions types/node/v14/domain.d.ts
Expand Up @@ -22,3 +22,6 @@ declare module 'domain' {

function create(): Domain;
}
declare module 'node:domain' {
export * from 'domain';
}
4 changes: 4 additions & 0 deletions types/node/v14/events.d.ts
Expand Up @@ -76,3 +76,7 @@ declare module 'events' {

export = EventEmitter;
}
declare module 'node:events' {
import events = require('events');
export = events;
}
3 changes: 3 additions & 0 deletions types/node/v14/fs.d.ts
Expand Up @@ -2268,3 +2268,6 @@ declare module 'fs' {
bigint?: boolean | undefined;
}
}
declare module 'node:fs' {
export * from 'fs';
}
3 changes: 3 additions & 0 deletions types/node/v14/fs/promises.d.ts
Expand Up @@ -563,3 +563,6 @@ declare module 'fs/promises' {

function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
}
declare module 'node:fs/promises' {
export * from 'fs/promises';
}
3 changes: 3 additions & 0 deletions types/node/v14/http.d.ts
Expand Up @@ -485,3 +485,6 @@ declare module 'http' {
*/
const maxHeaderSize: number;
}
declare module 'node:http' {
export * from 'http';
}
3 changes: 3 additions & 0 deletions types/node/v14/http2.d.ts
Expand Up @@ -956,3 +956,6 @@ declare module 'http2' {
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void
): ClientHttp2Session;
}
declare module 'node:http2' {
export * from 'http2';
}
3 changes: 3 additions & 0 deletions types/node/v14/https.d.ts
Expand Up @@ -137,3 +137,6 @@ declare module 'https' {
function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
let globalAgent: Agent;
}
declare module 'node:https' {
export * from 'https';
}
3 changes: 2 additions & 1 deletion types/node/v14/index.d.ts
@@ -1,4 +1,4 @@
// Type definitions for non-npm package Node.js 14.17
// Type definitions for non-npm package Node.js 14.18
// Project: https://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>
Expand Down Expand Up @@ -41,6 +41,7 @@
// Victor Perin <https://github.com/victorperin>
// Yongsheng Zhang <https://github.com/ZYSzys>
// Bond <https://github.com/bondz>
// Linus Unneb盲ck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// NOTE: These definitions support NodeJS and TypeScript 3.7+
Expand Down
4 changes: 4 additions & 0 deletions types/node/v14/inspector.d.ts
Expand Up @@ -3045,3 +3045,7 @@ declare module 'inspector' {
*/
function waitForDebugger(): void;
}
declare module 'node:inspector' {
import EventEmitter = require('inspector');
export = EventEmitter;
}
4 changes: 4 additions & 0 deletions types/node/v14/module.d.ts
Expand Up @@ -50,3 +50,7 @@ declare module 'module' {
}
export = Module;
}
declare module 'node:module' {
import module = require('module');
export = module;
}
3 changes: 3 additions & 0 deletions types/node/v14/net.d.ts
Expand Up @@ -291,3 +291,6 @@ declare module 'net' {
function isIPv4(input: string): boolean;
function isIPv6(input: string): boolean;
}
declare module 'node:net' {
export * from 'net';
}
3 changes: 3 additions & 0 deletions types/node/v14/os.d.ts
Expand Up @@ -237,3 +237,6 @@ declare module 'os' {
*/
function setPriority(pid: number, priority: number): void;
}
declare module 'node:os' {
export * from 'os';
}
4 changes: 4 additions & 0 deletions types/node/v14/path.d.ts
Expand Up @@ -151,3 +151,7 @@ declare module 'path' {
const path: path.PlatformPath;
export = path;
}
declare module 'node:path' {
import path = require('path');
export = path;
}
3 changes: 3 additions & 0 deletions types/node/v14/perf_hooks.d.ts
Expand Up @@ -269,3 +269,6 @@ declare module 'perf_hooks' {

function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor;
}
declare module 'node:perf_hooks' {
export * from 'perf_hooks';
}
4 changes: 4 additions & 0 deletions types/node/v14/process.d.ts
Expand Up @@ -407,3 +407,7 @@ declare module 'process' {

export = process;
}
declare module 'node:process' {
import process = require('process');
export = process;
}
3 changes: 3 additions & 0 deletions types/node/v14/punycode.d.ts
Expand Up @@ -73,3 +73,6 @@ declare module 'punycode' {
*/
const version: string;
}
declare module 'node:punycode' {
export * from 'punycode';
}
3 changes: 3 additions & 0 deletions types/node/v14/querystring.d.ts
Expand Up @@ -26,3 +26,6 @@ declare module 'querystring' {
function escape(str: string): string;
function unescape(str: string): string;
}
declare module 'node:querystring' {
export * from 'querystring';
}
3 changes: 3 additions & 0 deletions types/node/v14/readline.d.ts
Expand Up @@ -169,3 +169,6 @@ declare module 'readline' {
*/
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
}
declare module 'node:readline' {
export * from 'readline';
}
3 changes: 3 additions & 0 deletions types/node/v14/repl.d.ts
Expand Up @@ -393,3 +393,6 @@ declare module 'repl' {
constructor(err: Error);
}
}
declare module 'node:repl' {
export * from 'repl';
}
4 changes: 4 additions & 0 deletions types/node/v14/stream.d.ts
Expand Up @@ -353,3 +353,7 @@ declare module 'stream' {

export = internal;
}
declare module 'node:stream' {
import stream = require('stream');
export = stream;
}
3 changes: 3 additions & 0 deletions types/node/v14/string_decoder.d.ts
Expand Up @@ -5,3 +5,6 @@ declare module 'string_decoder' {
end(buffer?: Buffer): string;
}
}
declare module 'node:string_decoder' {
export * from 'string_decoder';
}
2 changes: 1 addition & 1 deletion types/node/v14/test/assert.ts
@@ -1,4 +1,4 @@
import assert = require('assert');
import assert = require('node:assert');

{
const { stack } = new assert.AssertionError({});
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/async_hooks.ts
Expand Up @@ -6,7 +6,7 @@ import {
executionAsyncResource,
HookCallbacks,
AsyncLocalStorage,
} from 'async_hooks';
} from 'node:async_hooks';

{
const hooks: HookCallbacks = {
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/buffer.ts
Expand Up @@ -7,7 +7,7 @@ import {
constants,
kMaxLength,
kStringMaxLength,
} from 'buffer';
} from 'node:buffer';

const utf8Buffer = new Buffer('test');
const base64Buffer = new Buffer('', 'base64');
Expand Down
12 changes: 6 additions & 6 deletions types/node/v14/test/child_process.ts
@@ -1,9 +1,9 @@
import * as childProcess from 'child_process';
import * as net from 'net';
import * as fs from 'fs';
import assert = require('assert');
import { promisify } from 'util';
import { Writable, Readable, Pipe } from 'stream';
import * as childProcess from 'node:child_process';
import * as net from 'node:net';
import * as fs from 'node:fs';
import assert = require('node:assert');
import { promisify } from 'node:util';
import { Writable, Readable, Pipe } from 'node:stream';

{
childProcess.exec("echo test");
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/cluster.ts
@@ -1,4 +1,4 @@
import * as cluster from 'cluster';
import * as cluster from 'node:cluster';

cluster.fork();
Object.keys(cluster.workers).forEach(key => {
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/constants.ts
@@ -1,4 +1,4 @@
import * as constants from 'constants';
import * as constants from 'node:constants';
{
let str: string;
let num: number;
Expand Down
6 changes: 3 additions & 3 deletions types/node/v14/test/crypto.ts
@@ -1,6 +1,6 @@
import * as crypto from 'crypto';
import assert = require('assert');
import { promisify } from 'util';
import * as crypto from 'node:crypto';
import assert = require('node:assert');
import { promisify } from 'node:util';

{
const copied: crypto.Hash = crypto.createHash('md5').copy();
Expand Down
6 changes: 3 additions & 3 deletions types/node/v14/test/dgram.ts
@@ -1,6 +1,6 @@
import * as dgram from 'dgram';
import * as net from 'net';
import * as dns from 'dns';
import * as dgram from 'node:dgram';
import * as net from 'node:net';
import * as dns from 'node:dns';

{
let ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/dns.ts
Expand Up @@ -14,7 +14,7 @@ import {
ALL,
promises,
setDefaultResultOrder,
} from 'dns';
} from 'node:dns';

lookup("nodejs.org", (err, address, family) => {
const _err: NodeJS.ErrnoException | null = err;
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/events.ts
@@ -1,4 +1,4 @@
import events = require('events');
import events = require('node:events');

const emitter: events = new events.EventEmitter();
declare const listener: (...args: any[]) => void;
Expand Down
8 changes: 4 additions & 4 deletions types/node/v14/test/fs.ts
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import assert = require('assert');
import * as util from 'util';
import * as url from 'url';
import * as fs from 'node:fs';
import assert = require('node:assert');
import * as util from 'node:util';
import * as url from 'node:url';

{
fs.writeFile("thebible.txt",
Expand Down
2 changes: 1 addition & 1 deletion types/node/v14/test/global.ts
@@ -1,4 +1,4 @@
import { Readable, Writable } from 'stream';
import { Readable, Writable } from 'node:stream';

{
const x: NodeModule = {} as any;
Expand Down
10 changes: 5 additions & 5 deletions types/node/v14/test/http.ts
@@ -1,8 +1,8 @@
import * as http from 'http';
import * as stream from 'stream';
import * as url from 'url';
import * as net from 'net';
import * as dns from 'dns';
import * as http from 'node:http';
import * as stream from 'node:stream';
import * as url from 'node:url';
import * as net from 'node:net';
import * as dns from 'node:dns';

// http Server
{
Expand Down
14 changes: 7 additions & 7 deletions types/node/v14/test/http2.ts
Expand Up @@ -31,13 +31,13 @@ import {
createServer,
constants,
ServerOptions,
} from 'http2';
import EventEmitter = require('events');
import { Stats } from 'fs';
import { Socket, Server } from 'net';
import { TLSSocket } from 'tls';
import { Duplex, Readable } from 'stream';
import { URL } from 'url';
} from 'node:http2';
import EventEmitter = require('node:events');
import { Stats } from 'node:fs';
import { Socket, Server } from 'node:net';
import { TLSSocket } from 'node:tls';
import { Duplex, Readable } from 'node:stream';
import { URL } from 'node:url';

// Headers & Settings
{
Expand Down
14 changes: 7 additions & 7 deletions types/node/v14/test/https.ts
@@ -1,10 +1,10 @@
import * as http from "http";
import * as https from 'https';
import * as net from 'net';
import * as stream from 'stream';
import * as tls from 'tls';
import * as url from 'url';
import * as dns from 'dns';
import * as http from 'node:http';
import * as https from 'node:https';
import * as net from 'node:net';
import * as stream from 'node:stream';
import * as tls from 'node:tls';
import * as url from 'node:url';
import * as dns from 'node:dns';

// https tests
{
Expand Down

0 comments on commit ee41314

Please sign in to comment.