Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add node prefix import for Deno support #212

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/native.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const http = require('http');
const http = require('node:http');

http.createServer((req, res) => {
if (req.url === '/favicon.ico') return;
Expand Down
6 changes: 3 additions & 3 deletions packages/cluster/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cpus } from 'os';
import cluster from 'cluster';
import { createServer } from 'http';
import { cpus } from 'node:os';
import cluster from 'node:cluster';
import { createServer } from 'node:http';

export default function (app, num) {
if (cluster.isMaster) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compression/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// NOTE: supports Node 6.x

import zlib from 'zlib';
import zlib from 'node:zlib';

const NOOP = () => {};
const MIMES = /text|javascript|\/json|xml/i;
Expand Down
6 changes: 3 additions & 3 deletions packages/compression/test/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { suite } from 'uvu';
import * as assert from 'uvu/assert';

import fs from 'fs';
import * as zlib from 'zlib';
import { join } from 'path';
import fs from 'node:fs';
import * as zlib from 'node:zlib';
import { join } from 'node:path';

import { prepare, toAscii } from './util/index';
import compression from '../index';
Expand Down
2 changes: 1 addition & 1 deletion packages/compression/test/util/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IncomingMessage, ServerResponse } from 'http';
import { IncomingMessage, ServerResponse } from 'node:http';

// IncomingMessage
class Request {
Expand Down
2 changes: 1 addition & 1 deletion packages/parse/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { decode } from 'querystring';
import { decode } from 'node:querystring';

const noop = x => x;

Expand Down
3 changes: 2 additions & 1 deletion packages/polka/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import http from 'http';
import http from 'node:http';
import { setImmediate } from 'node:timers';
import { Trouter } from 'trouter';
import { parse } from '@polka/url';

Expand Down
2 changes: 1 addition & 1 deletion packages/polka/test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import http from 'http';
import http from 'node:http';
import { test } from 'uvu';
import * as assert from 'uvu/assert';
import { get, send, post } from 'httpie';
Expand Down
2 changes: 1 addition & 1 deletion packages/redirect/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from 'url';
import { resolve } from 'node:url';

export default function (res, code=302, location='') {
if (!location && typeof code === 'string') {
Expand Down
4 changes: 2 additions & 2 deletions packages/send/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { STATUS_CODES } from 'http';
import { createHash } from 'crypto';
import { STATUS_CODES } from 'node:http';
import { createHash } from 'node:crypto';

const TYPE = 'Content-Type';
const LENGTH = 'Content-Length';
Expand Down
4 changes: 2 additions & 2 deletions packages/send/test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import fs from 'node:fs';
import { join } from 'node:path';
import { suite } from 'uvu';
import { join } from 'path';
import * as assert from 'uvu/assert';
import { Response, toStatusText } from './util';
import send from '../index';
Expand Down
2 changes: 1 addition & 1 deletion packages/send/test/util/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STATUS_CODES } from 'http';
import { STATUS_CODES } from 'node:http';

export const toStatusText = code => STATUS_CODES[code];

Expand Down
2 changes: 1 addition & 1 deletion packages/url/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as qs from 'querystring';
import * as qs from 'node:querystring';

/**
* @typedef ParsedURL
Expand Down
Loading