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

refactor: use node: prefix for imports #1346

Merged
merged 4 commits into from Oct 26, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/body.js
Expand Up @@ -5,8 +5,8 @@
* Body interface provides common methods for Request and Response
*/

import Stream, {PassThrough} from 'stream';
import {types, deprecate} from 'util';
import Stream, {PassThrough} from 'node:stream';
import {types, deprecate} from 'node:util';

import Blob from 'fetch-blob';

Expand Down
4 changes: 2 additions & 2 deletions src/headers.js
Expand Up @@ -4,8 +4,8 @@
* Headers class offers convenient helpers
*/

import {types} from 'util';
import http from 'http';
import {types} from 'node:util';
import http from 'node:http';

const validateHeaderName = typeof http.validateHeaderName === 'function' ?
http.validateHeaderName :
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Expand Up @@ -6,10 +6,10 @@
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
*/

import http from 'http';
import https from 'https';
import zlib from 'zlib';
import Stream, {PassThrough, pipeline as pump} from 'stream';
import http from 'node:http';
import https from 'node:https';
import zlib from 'node:zlib';
import Stream, {PassThrough, pipeline as pump} from 'node:stream';
import dataUriToBuffer from 'data-uri-to-buffer';

import {writeToStream, clone} from './body.js';
Expand Down
2 changes: 1 addition & 1 deletion src/request.js
Expand Up @@ -7,7 +7,7 @@
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
*/

import {format as formatUrl} from 'url';
import {format as formatUrl} from 'node:url';
import Headers from './headers.js';
import Body, {clone, extractContentType, getTotalBytes} from './body.js';
import {isAbortSignal} from './utils/is.js';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/form-data.js
@@ -1,4 +1,4 @@
import {randomBytes} from 'crypto';
import {randomBytes} from 'node:crypto';

import {isBlob} from './is.js';

Expand Down
2 changes: 1 addition & 1 deletion test/headers.js
@@ -1,4 +1,4 @@
import {format} from 'util';
import {format} from 'node:util';
import chai from 'chai';
import chaiIterator from 'chai-iterator';
import {Headers} from '../src/index.js';
Expand Down
18 changes: 8 additions & 10 deletions test/main.js
@@ -1,12 +1,12 @@
// Test tools
import zlib from 'zlib';
import crypto from 'crypto';
import http from 'http';
import fs from 'fs';
import stream from 'stream';
import path from 'path';
import {lookup} from 'dns';
import vm from 'vm';
import zlib from 'node:zlib';
import crypto from 'node:crypto';
import http from 'node:http';
import fs from 'node:fs';
import stream from 'node:stream';
import path from 'node:path';
import {lookup} from 'node:dns';
import vm from 'node:vm';
import chai from 'chai';
import chaiPromised from 'chai-as-promised';
import chaiIterator from 'chai-iterator';
Expand Down Expand Up @@ -2215,7 +2215,6 @@ describe('node-fetch', () => {
function lookupSpy(hostname, options, callback) {
called++;

// eslint-disable-next-line node/prefer-promises/dns
return lookup(hostname, options, callback);
}

Expand All @@ -2232,7 +2231,6 @@ describe('node-fetch', () => {
function lookupSpy(hostname, options, callback) {
families.push(options.family);

// eslint-disable-next-line node/prefer-promises/dns
return lookup(hostname, {}, callback);
}

Expand Down
4 changes: 2 additions & 2 deletions test/request.js
@@ -1,5 +1,5 @@
import stream from 'stream';
import http from 'http';
import stream from 'node:stream';
import http from 'node:http';

import AbortController from 'abort-controller';
import chai from 'chai';
Expand Down
3 changes: 1 addition & 2 deletions test/response.js
@@ -1,5 +1,4 @@

import * as stream from 'stream';
import * as stream from 'node:stream';
import chai from 'chai';
import Blob from 'fetch-blob';
import {Response} from '../src/index.js';
Expand Down