Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47d9cde

Browse files
authored
refactor: use node: prefix for imports (#1346)
* refactor: use node: prefix for imports
1 parent 96f9ae2 commit 47d9cde

File tree

9 files changed

+22
-25
lines changed

9 files changed

+22
-25
lines changed

src/body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Body interface provides common methods for Request and Response
66
*/
77

8-
import Stream, {PassThrough} from 'stream';
9-
import {types, deprecate} from 'util';
8+
import Stream, {PassThrough} from 'node:stream';
9+
import {types, deprecate} from 'node:util';
1010

1111
import Blob from 'fetch-blob';
1212

src/headers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Headers class offers convenient helpers
55
*/
66

7-
import {types} from 'util';
8-
import http from 'http';
7+
import {types} from 'node:util';
8+
import http from 'node:http';
99

1010
const validateHeaderName = typeof http.validateHeaderName === 'function' ?
1111
http.validateHeaderName :

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
77
*/
88

9-
import http from 'http';
10-
import https from 'https';
11-
import zlib from 'zlib';
12-
import Stream, {PassThrough, pipeline as pump} from 'stream';
9+
import http from 'node:http';
10+
import https from 'node:https';
11+
import zlib from 'node:zlib';
12+
import Stream, {PassThrough, pipeline as pump} from 'node:stream';
1313
import dataUriToBuffer from 'data-uri-to-buffer';
1414

1515
import {writeToStream, clone} from './body.js';

src/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
88
*/
99

10-
import {format as formatUrl} from 'url';
10+
import {format as formatUrl} from 'node:url';
1111
import Headers from './headers.js';
1212
import Body, {clone, extractContentType, getTotalBytes} from './body.js';
1313
import {isAbortSignal} from './utils/is.js';

src/utils/form-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {randomBytes} from 'crypto';
1+
import {randomBytes} from 'node:crypto';
22

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

test/headers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {format} from 'util';
1+
import {format} from 'node:util';
22
import chai from 'chai';
33
import chaiIterator from 'chai-iterator';
44
import {Headers} from '../src/index.js';

test/main.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Test tools
2-
import zlib from 'zlib';
3-
import crypto from 'crypto';
4-
import http from 'http';
5-
import fs from 'fs';
6-
import stream from 'stream';
7-
import path from 'path';
8-
import {lookup} from 'dns';
9-
import vm from 'vm';
2+
import zlib from 'node:zlib';
3+
import crypto from 'node:crypto';
4+
import http from 'node:http';
5+
import fs from 'node:fs';
6+
import stream from 'node:stream';
7+
import path from 'node:path';
8+
import {lookup} from 'node:dns';
9+
import vm from 'node:vm';
1010
import chai from 'chai';
1111
import chaiPromised from 'chai-as-promised';
1212
import chaiIterator from 'chai-iterator';
@@ -2215,7 +2215,6 @@ describe('node-fetch', () => {
22152215
function lookupSpy(hostname, options, callback) {
22162216
called++;
22172217

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

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

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

test/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import stream from 'stream';
2-
import http from 'http';
1+
import stream from 'node:stream';
2+
import http from 'node:http';
33

44
import AbortController from 'abort-controller';
55
import chai from 'chai';

test/response.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
import * as stream from 'stream';
1+
import * as stream from 'node:stream';
32
import chai from 'chai';
43
import Blob from 'fetch-blob';
54
import {Response} from '../src/index.js';

0 commit comments

Comments
 (0)