Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 'lts/*'
# Using `latest` as `lts` could point to previous major version.
# Different versions of Node.js can cause different linting results
# (e.g. dependening on process.getBuiltinModule())
node-version: 'latest'

- name: Install dependencies
run: npm install
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = [
}),
{
rules: {
'n/prefer-node-protocol': ['error'],
'n/no-process-exit': 'error',
'@stylistic/comma-dangle': ['error', {
arrays: 'never',
Expand Down
2 changes: 1 addition & 1 deletion test/jest/parser-timeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global jest, describe, it, beforeEach, afterEach, expect */

// test/jest/parser-timeout.test.js
const EventEmitter = require('events')
const EventEmitter = require('node:events')
const connectH1 = require('../../lib/dispatcher/client-h1')
const { kParser } = require('../../lib/core/symbols')

Expand Down
4 changes: 2 additions & 2 deletions test/types/agent.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable } from 'tsd'
import { Agent, Dispatcher } from '../..'
import { URL } from 'url'
import { URL } from 'node:url'

expectAssignable<Agent>(new Agent())
expectAssignable<Agent>(new Agent({}))
Expand Down
2 changes: 1 addition & 1 deletion test/types/api.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable, expectType } from 'tsd'
import { Dispatcher, request, stream, pipeline, connect, upgrade } from '../..'

Expand Down
4 changes: 2 additions & 2 deletions test/types/balanced-pool.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable } from 'tsd'
import { Dispatcher, BalancedPool, Client } from '../..'
import { URL } from 'url'
import { URL } from 'node:url'

expectAssignable<BalancedPool>(new BalancedPool(''))
expectAssignable<BalancedPool>(new BalancedPool('', {}))
Expand Down
4 changes: 2 additions & 2 deletions test/types/client.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable, expectType } from 'tsd'
import { Client, Dispatcher } from '../..'
import { URL } from 'url'
import { URL } from 'node:url'

expectAssignable<Client>(new Client(''))
expectAssignable<Client>(new Client('', {}))
Expand Down
4 changes: 2 additions & 2 deletions test/types/connector.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expectAssignable } from 'tsd'
import { Client, buildConnector } from '../..'
import { TLSSocket } from 'tls'
import { Socket } from 'net'
import { TLSSocket } from 'node:tls'
import { Socket } from 'node:net'

const connector = buildConnector({ rejectUnauthorized: false, allowH2: false })
expectAssignable<Client>(new Client('', {
Expand Down
2 changes: 1 addition & 1 deletion test/types/diagnostics-channel.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Socket } from 'net'
import { Socket } from 'node:net'
import { expectAssignable } from 'tsd'
import { DiagnosticsChannel, buildConnector } from '../..'

Expand Down
2 changes: 1 addition & 1 deletion test/types/dispatcher.events.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dispatcher } from '../..'
import { expectAssignable } from 'tsd'
import { URL } from 'url'
import { URL } from 'node:url'
import Errors from '../../types/errors'

interface EventHandler {
Expand Down
8 changes: 4 additions & 4 deletions test/types/dispatcher.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IncomingHttpHeaders } from 'http'
import { Duplex, Readable, Writable } from 'stream'
import { IncomingHttpHeaders } from 'node:http'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable, expectType } from 'tsd'
import { Dispatcher, Headers } from '../..'
import { URL } from 'url'
import { Blob } from 'buffer'
import { URL } from 'node:url'
import { Blob } from 'node:buffer'

expectAssignable<Dispatcher>(new Dispatcher())

Expand Down
2 changes: 1 addition & 1 deletion test/types/env-http-proxy-agent.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable } from 'tsd'
import { EnvHttpProxyAgent, setGlobalDispatcher, getGlobalDispatcher, Dispatcher } from '../..'

Expand Down
2 changes: 1 addition & 1 deletion test/types/event-source-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import { expectType, expectAssignable } from 'tsd'

import { EventSource, EventSourceInit, Dispatcher } from '../../'
Expand Down
6 changes: 3 additions & 3 deletions test/types/fetch.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URL } from 'url'
import { Blob } from 'buffer'
import { ReadableStream } from 'stream/web'
import { URL } from 'node:url'
import { Blob } from 'node:buffer'
import { ReadableStream } from 'node:stream/web'
import { expectType, expectError, expectAssignable, expectNotAssignable } from 'tsd'
import {
Agent,
Expand Down
4 changes: 2 additions & 2 deletions test/types/formdata.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Blob, File } from 'buffer'
import { Readable } from 'stream'
import { Blob, File } from 'node:buffer'
import { Readable } from 'node:stream'
import { expectAssignable, expectType } from 'tsd'
import { FormData, SpecIterableIterator } from '../..'
import Dispatcher from '../../types/dispatcher'
Expand Down
2 changes: 1 addition & 1 deletion test/types/header.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IncomingHttpHeaders as CoreIncomingHttpHeaders } from 'http'
import { IncomingHttpHeaders as CoreIncomingHttpHeaders } from 'node:http'
import { expectAssignable, expectNotAssignable } from 'tsd'
import { IncomingHttpHeaders } from '../../types/header'

Expand Down
4 changes: 2 additions & 2 deletions test/types/pool.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Duplex, Readable, Writable } from 'stream'
import { Duplex, Readable, Writable } from 'node:stream'
import { expectAssignable, expectType } from 'tsd'
import { Dispatcher, Pool, Client } from '../..'
import { URL } from 'url'
import { URL } from 'node:url'

expectAssignable<Pool>(new Pool(''))
expectAssignable<Pool>(new Pool('', {}))
Expand Down
2 changes: 1 addition & 1 deletion test/types/proxy-agent.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expectAssignable } from 'tsd'
import { URL } from 'url'
import { URL } from 'node:url'
import { ProxyAgent, setGlobalDispatcher, getGlobalDispatcher, Agent, Pool } from '../..'

expectAssignable<ProxyAgent>(new ProxyAgent(''))
Expand Down
2 changes: 1 addition & 1 deletion test/types/readable.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectAssignable } from 'tsd'
import BodyReadable from '../../types/readable'
import { Blob } from 'buffer'
import { Blob } from 'node:buffer'

expectAssignable<BodyReadable>(new BodyReadable({
abort: () => null,
Expand Down
2 changes: 1 addition & 1 deletion test/types/websocket.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReadableStream, WritableStream } from 'stream/web'
import { ReadableStream, WritableStream } from 'node:stream/web'
import { expectType } from 'tsd'
import { WebSocketStream, ErrorEvent } from '../../types'

Expand Down
2 changes: 1 addition & 1 deletion test/utils/esm-wrapper.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tspl } from '@matteo.collina/tspl'
import { createServer } from 'http'
import { createServer } from 'node:http'
import { test, after } from 'node:test'
import { once } from 'node:events'
import {
Expand Down
2 changes: 1 addition & 1 deletion types/agent.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import Pool from './pool'
import Dispatcher from './dispatcher'
import TClientStats from './client-stats'
Expand Down
4 changes: 2 additions & 2 deletions types/api.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { URL, UrlObject } from 'url'
import { Duplex } from 'stream'
import { URL, UrlObject } from 'node:url'
import { Duplex } from 'node:stream'
import Dispatcher from './dispatcher'

/** Performs an HTTP request. */
Expand Down
2 changes: 1 addition & 1 deletion types/balanced-pool.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Pool from './pool'
import Dispatcher from './dispatcher'
import { URL } from 'url'
import { URL } from 'node:url'

export default BalancedPool

Expand Down
2 changes: 1 addition & 1 deletion types/client.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
import buildConnector from './connector'
import TClientStats from './client-stats'
Expand Down
4 changes: 2 additions & 2 deletions types/connector.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TLSSocket, ConnectionOptions } from 'tls'
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net'
import { TLSSocket, ConnectionOptions } from 'node:tls'
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'node:net'

export default buildConnector
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
Expand Down
4 changes: 2 additions & 2 deletions types/diagnostics-channel.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Socket } from 'net'
import { URL } from 'url'
import { Socket } from 'node:net'
import { URL } from 'node:url'
import buildConnector from './connector'
import Dispatcher from './dispatcher'

Expand Down
8 changes: 4 additions & 4 deletions types/dispatcher.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { URL } from 'url'
import { Duplex, Readable, Writable } from 'stream'
import { EventEmitter } from 'events'
import { Blob } from 'buffer'
import { URL } from 'node:url'
import { Duplex, Readable, Writable } from 'node:stream'
import { EventEmitter } from 'node:events'
import { Blob } from 'node:buffer'
import { IncomingHttpHeaders } from './header'
import BodyReadable from './readable'
import { FormData } from './formdata'
Expand Down
6 changes: 3 additions & 3 deletions types/fetch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license)
/// <reference types="node" />

import { Blob } from 'buffer'
import { URL, URLSearchParams } from 'url'
import { ReadableStream } from 'stream/web'
import { Blob } from 'node:buffer'
import { URL, URLSearchParams } from 'node:url'
import { ReadableStream } from 'node:stream/web'
import { FormData } from './formdata'
import { HeaderRecord } from './header'
import Dispatcher from './dispatcher'
Expand Down
2 changes: 1 addition & 1 deletion types/formdata.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT)
/// <reference types="node" />

import { File } from 'buffer'
import { File } from 'node:buffer'
import { SpecIterableIterator } from './fetch'

/**
Expand Down
2 changes: 1 addition & 1 deletion types/h2c-client.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
import buildConnector from './connector'

Expand Down
2 changes: 1 addition & 1 deletion types/pool.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Client from './client'
import TPoolStats from './pool-stats'
import { URL } from 'url'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'

export default Pool
Expand Down
4 changes: 2 additions & 2 deletions types/readable.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Readable } from 'stream'
import { Blob } from 'buffer'
import { Readable } from 'node:stream'
import { Blob } from 'node:buffer'

export default BodyReadable

Expand Down
6 changes: 3 additions & 3 deletions types/websocket.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference types="node" />

import type { Blob } from 'buffer'
import type { ReadableStream, WritableStream } from 'stream/web'
import type { MessagePort } from 'worker_threads'
import type { Blob } from 'node:buffer'
import type { ReadableStream, WritableStream } from 'node:stream/web'
import type { MessagePort } from 'node:worker_threads'
import {
EventInit,
EventListenerOptions,
Expand Down