Skip to content

Commit

Permalink
Use node protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Nov 6, 2022
1 parent 574dc12 commit 8ff17a8
Show file tree
Hide file tree
Showing 60 changed files with 86 additions and 88 deletions.
10 changes: 5 additions & 5 deletions benchmark/tasks.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This is an example of tasks, used mostly for debugging
import { execFile } from 'child_process'
import { randomInt, createHash } from 'crypto'
import { readFile, writeFile, unlink } from 'fs/promises'
import { execFile } from 'node:child_process'
import { randomInt, createHash } from 'node:crypto'
import { readFile, writeFile, unlink } from 'node:fs/promises'
// eslint-disable-next-line no-shadow
import { setTimeout } from 'timers/promises'
import { promisify } from 'util'
import { setTimeout } from 'node:timers/promises'
import { promisify } from 'node:util'

import got from 'got'
import { tmpName } from 'tmp-promise'
Expand Down
4 changes: 2 additions & 2 deletions src/bin/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'

import { readPackageUp } from 'read-pkg-up'
import UpdateNotifier from 'update-notifier'
Expand Down
2 changes: 1 addition & 1 deletion src/bin/top.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { argv } from 'process'
import { argv } from 'node:process'

import yargs from 'yargs'
// eslint-disable-next-line n/file-extension-in-import
Expand Down
4 changes: 2 additions & 2 deletions src/config/load/contents.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extname } from 'path'
import { inspect } from 'util'
import { extname } from 'node:path'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
4 changes: 2 additions & 2 deletions src/config/load/default.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readdir } from 'fs/promises'
import { relative, normalize } from 'path'
import { readdir } from 'node:fs/promises'
import { relative, normalize } from 'node:path'

import { findUp } from 'find-up'
import pLocate from 'p-locate'
Expand Down
2 changes: 1 addition & 1 deletion src/config/load/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname } from 'path'
import { dirname } from 'node:path'

import { UserError } from '../../error/main.js'
import { addBases } from '../cwd.js'
Expand Down
2 changes: 1 addition & 1 deletion src/config/load/resolve.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRequire } from 'module'
import { createRequire } from 'node:module'

import { AnyError } from '../../error/main.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/call/suffix.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { AnyError } from '../error.js'

Expand Down
8 changes: 4 additions & 4 deletions src/config/normalize/lib/keywords/list/cwd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { statSync } from 'fs'
import { stat } from 'fs/promises'
import { resolve } from 'path'
import { cwd as getCwd } from 'process'
import { statSync } from 'node:fs'
import { stat } from 'node:fs/promises'
import { resolve } from 'node:path'
import { cwd as getCwd } from 'node:process'

const normalize = function (definition) {
validateCwd(definition)
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/list/glob.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { basename } from 'path'
import { basename } from 'node:path'

import fastGlob from 'fast-glob'
import { isNotJunk } from 'junk'
Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/keywords/list/path/access.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { constants, accessSync } from 'fs'
import { access } from 'fs/promises'
import { constants, accessSync } from 'node:fs'
import { access } from 'node:fs/promises'

import { READ_KEYWORD, WRITE_KEYWORD, EXEC_KEYWORD } from './normalize.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/list/path/exist.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { constants } from 'fs'
import { constants } from 'node:fs'

import { checkAccess, checkAccessAsync } from './access.js'
import { EXIST_KEYWORD } from './normalize.js'
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/list/path/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'node:path'

import { validateDefinedString } from '../../normalize/common.js'

Expand Down
4 changes: 2 additions & 2 deletions src/config/normalize/lib/keywords/list/path/type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { statSync } from 'fs'
import { stat } from 'fs/promises'
import { statSync } from 'node:fs'
import { stat } from 'node:fs/promises'

import { FILE_KEYWORD, DIR_KEYWORD } from './normalize.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/normalize/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { DefinitionError } from '../../error.js'
import { BUILTIN_KEYWORDS } from '../list/main.js'
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/normalize/name.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/normalize/props.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { KeywordError } from '../../error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/keywords/normalize/validate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { excludeKeys } from 'filter-obj'
import isPlainObj from 'is-plain-obj'
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/rule/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { DefinitionError } from '../error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/rule/normalize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'
import { normalizeQuery } from 'wild-wild-parser'
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/rule/props.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { DefinitionError } from '../error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/rule/serial.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import { DefinitionError } from '../error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/rules.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable max-lines */
import { cwd as getCwd } from 'process'
import { cwd as getCwd } from 'node:process'

import {
DEFAULT_INPUTS,
Expand Down
2 changes: 1 addition & 1 deletion src/config/npx.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { env } from 'process'
import { env } from 'node:process'

import { isConfigFileModule } from './load/resolve.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/plugin/lib/import.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pathToFileURL } from 'url'
import { pathToFileURL } from 'node:url'

import isPlainObj from 'is-plain-obj'

Expand Down
4 changes: 2 additions & 2 deletions src/config/plugin/lib/location_type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isAbsolute } from 'path'
import { fileURLToPath } from 'url'
import { isAbsolute } from 'node:path'
import { fileURLToPath } from 'node:url'

import { resolveModuleLocation } from './module.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/plugin/lib/module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRequire } from 'module'
import { createRequire } from 'node:module'

import { AnyError } from './error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/config/plugin/lib/shared.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import {
serializeQuery,
Expand Down
2 changes: 1 addition & 1 deletion src/history/data/fs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdir, readFile, writeFile, unlink, mkdir } from 'fs/promises'
import { readdir, readFile, writeFile, unlink, mkdir } from 'node:fs/promises'

import { pathExists } from 'path-exists'
import { isDirectory, isFile } from 'path-type'
Expand Down
2 changes: 1 addition & 1 deletion src/history/merge/id.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomUUID } from 'crypto'
import { randomUUID } from 'node:crypto'

import { validate as isUuid } from 'uuid'

Expand Down
2 changes: 1 addition & 1 deletion src/report/contents/insert.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFile } from 'fs/promises'
import { readFile } from 'node:fs/promises'

import { detectNewlineGraceful } from 'detect-newline'
import { pathExists } from 'path-exists'
Expand Down
4 changes: 2 additions & 2 deletions src/report/contents/output.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mkdir } from 'fs/promises'
import { dirname } from 'path'
import { mkdir } from 'node:fs/promises'
import { dirname } from 'node:path'

import writeFileAtomic from 'write-file-atomic'

Expand Down
6 changes: 3 additions & 3 deletions src/report/tty.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { stdin, stdout } from 'process'
import { cursorTo, clearScreenDown } from 'readline'
import { promisify } from 'util'
import { stdin, stdout } from 'node:process'
import { cursorTo, clearScreenDown } from 'node:readline'
import { promisify } from 'node:util'

import isInteractive from 'is-interactive'

Expand Down
4 changes: 2 additions & 2 deletions src/run/logs/create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { open, mkdir, unlink } from 'fs/promises'
import { dirname } from 'path'
import { open, mkdir, unlink } from 'node:fs/promises'
import { dirname } from 'node:path'

import { tmpName } from 'tmp-promise'

Expand Down
4 changes: 2 additions & 2 deletions src/run/logs/error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Buffer } from 'buffer'
import { open } from 'fs/promises'
import { Buffer } from 'node:buffer'
import { open } from 'node:fs/promises'

import { AnyError, StopError } from '../../error/main.js'

Expand Down
4 changes: 2 additions & 2 deletions src/run/logs/stream.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createWriteStream } from 'fs'
import { promisify } from 'util'
import { createWriteStream } from 'node:fs'
import { promisify } from 'node:util'

// Start file stream for the runner process to write to
export const startLogsStream = function (logsFd) {
Expand Down
4 changes: 2 additions & 2 deletions src/run/measure/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createServer } from 'http'
import { promisify } from 'util'
import { createServer } from 'node:http'
import { promisify } from 'node:util'

import { TARGET_SAMPLE_DURATION } from './loop.js'

Expand Down
4 changes: 2 additions & 2 deletions src/run/preview/start_end/keypress.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import process from 'process'
import { emitKeypressEvents } from 'readline'
import process from 'node:process'
import { emitKeypressEvents } from 'node:readline'

import { isTtyInput } from '../../../report/tty.js'
import { refreshPreview } from '../update/main.js'
Expand Down
2 changes: 1 addition & 1 deletion src/run/preview/start_end/resize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import process from 'process'
import process from 'node:process'

import { refreshPreview } from '../update/main.js'

Expand Down
3 changes: 1 addition & 2 deletions src/run/process/error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line fp/no-events
import { once } from 'events'
import { once } from 'node:events'

import { PluginError, UserError } from '../../error/main.js'

Expand Down
5 changes: 2 additions & 3 deletions src/run/process/ipc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line fp/no-events
import { once } from 'events'
import { promisify } from 'util'
import { once } from 'node:events'
import { promisify } from 'node:util'

import getStream from 'get-stream'

Expand Down
2 changes: 1 addition & 1 deletion src/run/stop/handle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import process from 'process'
import process from 'node:process'

import { waitForEvents, waitForDelay } from '../../utils/timeout.js'
import { addAction, removeAction } from '../preview/action.js'
Expand Down
2 changes: 1 addition & 1 deletion src/run/stop/signals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import process from 'process'
import process from 'node:process'

// Ensure default handlers for those signals are not used.
// Create a new `noop` function at each call, in case this function is called
Expand Down
2 changes: 1 addition & 1 deletion src/runners/cli/handler/start/validate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/cli/launch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'node:url'

const HANDLER_MAIN_PATH = fileURLToPath(
new URL('handler/main.js', import.meta.url),
Expand Down
2 changes: 1 addition & 1 deletion src/runners/common/ipc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { argv } from 'process'
import { argv } from 'node:process'

import got from 'got'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/common/validate/file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/node/config/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { version as currentNodeVersion } from 'process'
import { version as currentNodeVersion } from 'node:process'

import semver from 'semver'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/node/handler/start/default.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promisify } from 'util'
import { promisify } from 'node:util'

import { mapValues } from '../../../../utils/map.js'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/node/handler/start/require_config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pathToFileURL } from 'url'
import { pathToFileURL } from 'node:url'

import { ConfigError } from '../../../common/error.js'

Expand Down
2 changes: 1 addition & 1 deletion src/runners/node/handler/start/validate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util'
import { inspect } from 'node:util'

import isPlainObj from 'is-plain-obj'

Expand Down
4 changes: 2 additions & 2 deletions src/runners/node/launch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { version as currentVersion } from 'process'
import { fileURLToPath } from 'url'
import { version as currentVersion } from 'node:process'
import { fileURLToPath } from 'node:url'

const HANDLER_MAIN_PATH = fileURLToPath(
new URL('handler/main.js', import.meta.url),
Expand Down
2 changes: 1 addition & 1 deletion src/top/system/add.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cpus as listCpus, totalmem } from 'os'
import { cpus as listCpus, totalmem } from 'node:os'

import envCi from 'env-ci'
import osName from 'os-name'
Expand Down
4 changes: 2 additions & 2 deletions src/top/system/versions/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'

import { readPackageUp } from 'read-pkg-up'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/equal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isDeepStrictEqual } from 'util'
import { isDeepStrictEqual } from 'node:util'

// Compare two arrays deeply and unorderedly
export const isSameArray = function (arrayA, arrayB) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extname } from 'path'
import { pathToFileURL } from 'url'
import { extname } from 'node:path'
import { pathToFileURL } from 'node:url'

import { UserError } from '../error/main.js'

Expand Down
Loading

0 comments on commit 8ff17a8

Please sign in to comment.