Skip to content

Commit

Permalink
Use node: protocol for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 16, 2022
1 parent e582542 commit 955da76
Show file tree
Hide file tree
Showing 32 changed files with 60 additions and 60 deletions.
2 changes: 1 addition & 1 deletion benchmarks/hello/hello-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import http from 'http';
import http from 'node:http';

const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain', 'Content-Length': 12});
Expand Down
2 changes: 1 addition & 1 deletion docs/Rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ encoding comes in handy.
```js
import mojo from '@mojojs/core';
import {Stream} from 'stream';
import {Stream} from 'node:stream';

const app = mojo();

Expand Down
2 changes: 1 addition & 1 deletion examples/responses.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Application demonstrating the various HTTP response variants for debugging
*/
import {Stream} from 'stream';
import {Stream} from 'node:stream';
import mojo from '../lib/core.js';

const app = mojo();
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ServerOptions,
TestUserAgentOptions
} from './types.js';
import {Readable} from 'stream';
import {Readable} from 'node:stream';
import {CLI} from './cli.js';
import {Context} from './context.js';
import {Hooks} from './hooks.js';
Expand Down
6 changes: 3 additions & 3 deletions src/body.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {JSONValue} from './types.js';
import type {Readable, Writable} from 'stream';
import {on} from 'events';
import zlib from 'zlib';
import type {Readable, Writable} from 'node:stream';
import {on} from 'node:events';
import zlib from 'node:zlib';
import {Params} from './body/params.js';
import {Headers} from './headers.js';
import DOM from '@mojojs/dom';
Expand Down
2 changes: 1 addition & 1 deletion src/body/params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {URLSearchParams} from 'url';
import {URLSearchParams} from 'node:url';

/**
* GET/POST parameter class.
Expand Down
4 changes: 2 additions & 2 deletions src/cgi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {MojoApp, ServerResponseBody} from './types.js';
import type {Readable} from 'stream';
import {Stream} from 'stream';
import type {Readable} from 'node:stream';
import {Stream} from 'node:stream';
import {ServerRequest} from './server/request.js';
import {ServerResponse} from './server/response.js';
import {httpStatusMessages} from './util.js';
Expand Down
2 changes: 1 addition & 1 deletion src/cli/create-full-app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {App} from '../app.js';
import crypto from 'crypto';
import crypto from 'node:crypto';
import {version} from '../core.js';
import * as util from '../util.js';
import Path from '@mojojs/path';
Expand Down
2 changes: 1 addition & 1 deletion src/cli/repl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {MojoApp} from '../types.js';
import repl from 'repl';
import repl from 'node:repl';

/**
* Repl command.
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {UserAgent} from './user-agent.js';
import type {WebSocket} from './websocket.js';
import type Path from '@mojojs/path';
import type {BusboyConfig} from 'busboy';
import EventEmitter from 'events';
import EventEmitter from 'node:events';
import {Params} from './body/params.js';
import {SafeString} from './util.js';

Expand Down
4 changes: 2 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {WriteStream} from 'fs';
import assert from 'assert';
import type {WriteStream} from 'node:fs';
import assert from 'node:assert';
import chalk from 'chalk';

interface LogContext {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/default-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {MojoApp, MojoContext, RenderOptions, TagAttrs, URLOptions, URLTarget} from '../types.js';
import type {InspectOptions} from 'util';
import {inspect} from 'util';
import type {InspectOptions} from 'node:util';
import {inspect} from 'node:util';
import {Logger} from '../logger.js';
import {SafeString} from '../util.js';
import {exceptionContext} from '../util.js';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/tmpl-engine.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {App} from '../app.js';
import type {MojoContext, RenderOptions} from '../types.js';
import {createHash} from 'crypto';
import {createHash} from 'node:crypto';
import {Cache} from '../cache.js';
import Path from '@mojojs/path';
import Template from '@mojojs/template';
Expand Down
4 changes: 2 additions & 2 deletions src/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {MojoContext, RenderOptions} from './types.js';
import {promisify} from 'util';
import {gzip} from 'zlib';
import {promisify} from 'node:util';
import {gzip} from 'node:zlib';
import Path from '@mojojs/path';
import yaml from 'js-yaml';

Expand Down
14 changes: 7 additions & 7 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {MojoApp, ServerOptions, ServerResponseBody} from './types.js';
import type {Socket} from 'net';
import cluster from 'cluster';
import http from 'http';
import https from 'https';
import os from 'os';
import {Stream} from 'stream';
import {URL} from 'url';
import type {Socket} from 'node:net';
import cluster from 'node:cluster';
import http from 'node:http';
import https from 'node:https';
import os from 'node:os';
import {Stream} from 'node:stream';
import {URL} from 'node:url';
import {ServerRequest} from './server/request.js';
import {ServerResponse} from './server/response.js';
import {WebSocket} from './websocket.js';
Expand Down
4 changes: 2 additions & 2 deletions src/server/response.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {Context} from '../context.js';
import type {CookieOptions} from '../types.js';
import type {Stream} from 'stream';
import EventEmitter from 'events';
import type {Stream} from 'node:stream';
import EventEmitter from 'node:events';
import {Headers} from '../headers.js';
import {stringifyCookie} from './cookie.js';

Expand Down
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {App} from './app.js';
import type {Context} from './context.js';
import type {SessionData} from './types.js';
import crypto from 'crypto';
import {promisify} from 'util';
import crypto from 'node:crypto';
import {promisify} from 'node:util';

const scrypt = promisify(crypto.scrypt);
const randomBytes = promisify(crypto.randomBytes);
Expand Down
2 changes: 1 addition & 1 deletion src/static.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {MojoContext} from './types.js';
import crypto from 'crypto';
import crypto from 'node:crypto';
import Path from '@mojojs/path';

/**
Expand Down
10 changes: 5 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import type {App} from './app.js';
import type {Context} from './context.js';
import type {SafeString} from './util.js';
import type {ValidatorResult} from './validator/result.js';
import type {Agent} from 'http';
import type {Readable} from 'stream';
import type {Stream} from 'stream';
import type {Agent} from 'node:http';
import type {Readable} from 'node:stream';
import type {Stream} from 'node:stream';
import type {URL} from 'node:url';
import type {InspectOptions} from 'node:util';
import type {CookieJar} from 'tough-cookie';
import type {URL} from 'url';
import type {InspectOptions} from 'util';

export type {JSONValue, JSONObject} from '@mojojs/util';

Expand Down
4 changes: 2 additions & 2 deletions src/user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {UserAgentOptions, UserAgentRequestOptions, UserAgentWebSocketOptions} from './types.js';
import type {UserAgentResponse} from './user-agent/response.js';
import type {WebSocket} from './websocket.js';
import EventEmitter from 'events';
import {URL} from 'url';
import EventEmitter from 'node:events';
import {URL} from 'node:url';
import {CookieJar} from './user-agent/cookie-jar.js';
import {HTTPTransport} from './user-agent/transport/http.js';
import {HTTPSTransport} from './user-agent/transport/https.js';
Expand Down
4 changes: 2 additions & 2 deletions src/user-agent/cookie-jar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {URL} from 'url';
import {format} from 'url';
import type {URL} from 'node:url';
import {format} from 'node:url';
import tough from 'tough-cookie';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/user-agent/response.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Readable} from 'stream';
import type {Readable} from 'node:stream';
import {Body} from '../body.js';

interface UserAgentResponseOptions {
Expand Down
6 changes: 3 additions & 3 deletions src/user-agent/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type {
} from '../types.js';
import type {WebSocket} from '../websocket.js';
import type {UserAgentResponse} from './response.js';
import type {URL} from 'url';
import assert from 'assert/strict';
import {on} from 'events';
import type {URL} from 'node:url';
import assert from 'node:assert/strict';
import {on} from 'node:events';
import {MockUserAgent} from './mock.js';
import DOM from '@mojojs/dom';
import {jsonPointer} from '@mojojs/util';
Expand Down
8 changes: 4 additions & 4 deletions src/user-agent/transport/http.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {UserAgentRequestOptions} from '../../types.js';
import type {Socket} from 'net';
import type {URL} from 'url';
import http from 'http';
import Stream from 'stream';
import type {Socket} from 'node:net';
import type {URL} from 'node:url';
import http from 'node:http';
import Stream from 'node:stream';
import {UserAgentResponse} from '../response.js';
import {termEscape} from '@mojojs/util';

Expand Down
6 changes: 3 additions & 3 deletions src/user-agent/transport/https.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {UserAgentRequestOptions} from '../../types.js';
import type http from 'http';
import type {URL} from 'url';
import https from 'https';
import type http from 'node:http';
import type {URL} from 'node:url';
import https from 'node:https';
import {HTTPTransport} from './http.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/user-agent/transport/ws.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {UserAgentWebSocketOptions} from '../../types.js';
import type {Socket} from 'net';
import type {Socket} from 'node:net';
import {WebSocket} from '../../websocket.js';
import {UserAgentResponse} from '../response.js';
import WS from 'ws';
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {Mode} from 'fs';
import {setTimeout} from 'timers/promises';
import type {Mode} from 'node:fs';
import {setTimeout} from 'node:timers/promises';
import Path from '@mojojs/path';
import Template from '@mojojs/template';
import chalk from 'chalk';
Expand Down
2 changes: 1 addition & 1 deletion src/websocket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {JSONValue, WebSocketBackend} from './types.js';
import type {UserAgentResponse} from './user-agent/response.js';
import EventEmitter, {on} from 'events';
import EventEmitter, {on} from 'node:events';

interface WebSocketControlEvents {
close: (this: WebSocket, ...args: any[]) => void;
Expand Down
2 changes: 1 addition & 1 deletion test/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Stream} from 'stream';
import {Stream} from 'node:stream';
import mojo, {Session} from '../lib/core.js';
import t from 'tap';

Expand Down
2 changes: 1 addition & 1 deletion test/cgi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Stream} from 'stream';
import {Stream} from 'node:stream';
import mojo, {CGI} from '../lib/core.js';
import * as util from '../lib/util.js';
import {captureOutput} from '@mojojs/util';
Expand Down
2 changes: 1 addition & 1 deletion test/hook-app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Stream from 'stream';
import Stream from 'node:stream';
import mojo from '../lib/core.js';
import * as util from '../lib/util.js';
import t from 'tap';
Expand Down
2 changes: 1 addition & 1 deletion test/user-agent.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import http from 'http';
import http from 'node:http';
import mojo from '../lib/core.js';
import {Server} from '../lib/server.js';
import {UserAgent} from '../lib/user-agent.js';
Expand Down

0 comments on commit 955da76

Please sign in to comment.