Skip to content

Commit

Permalink
refactor: use node: prefix for imports (#1346)
Browse files Browse the repository at this point in the history
* refactor: use node: prefix for imports
  • Loading branch information
dnalborczyk committed Oct 26, 2021
1 parent 96f9ae2 commit 47d9cde
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 25 deletions.
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

0 comments on commit 47d9cde

Please sign in to comment.