Skip to content

Commit

Permalink
chore: use node: protocol imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Mar 27, 2023
1 parent c2e1f49 commit e62300a
Show file tree
Hide file tree
Showing 74 changed files with 93 additions and 89 deletions.
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os from 'os';
import v8 from 'v8';
import os from 'node:os';
import v8 from 'node:v8';
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';

const ci = !!process.env.CI;
Expand Down
2 changes: 1 addition & 1 deletion lib/config/decrypt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from 'crypto';
import crypto from 'node:crypto';
import is from '@sindresorhus/is';
import * as openpgp from 'openpgp';
import { logger } from '../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientRequest } from 'http';
import { ClientRequest } from 'node:http';
import type {
Context,
Span,
Expand Down
4 changes: 2 additions & 2 deletions lib/logger/pretty-stdout.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Code originally derived from https://github.com/hadfieldn/node-bunyan-prettystream but since heavily edited
// Neither fork nor original repo appear to be maintained

import { Stream } from 'stream';
import * as util from 'util';
import { Stream } from 'node:stream';
import * as util from 'node:util';
import chalk from 'chalk';
import stringify from 'json-stringify-pretty-compact';
import type { BunyanRecord } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Stream } from 'stream';
import type { Stream } from 'node:stream';
import type { LogLevel } from 'bunyan';

export interface LogError {
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stream } from 'stream';
import { Stream } from 'node:stream';
import is from '@sindresorhus/is';
import bunyan from 'bunyan';
import fs from 'fs-extra';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/docker/index.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 { ECR } from '@aws-sdk/client-ecr';
import type { ECRClientConfig } from '@aws-sdk/client-ecr';
import is from '@sindresorhus/is';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/go/base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: types (#7154)
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import URL from 'url';
import URL from 'node:url';
import { logger } from '../../../logger';
import { detectPlatform } from '../../../util/common';
import * as hostRules from '../../../util/host-rules';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/maven/s3.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import {
GetObjectCommand,
HeadObjectCommand,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/maven/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { GetObjectCommand, HeadObjectCommand } from '@aws-sdk/client-s3';
import { DateTime } from 'luxon';
import { XmlDocument } from 'xmldoc';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/npm/get.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 is from '@sindresorhus/is';
import { DateTime } from 'luxon';
import { GlobalConfig } from '../../../config/global';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/npm/npmrc.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 is from '@sindresorhus/is';
import ini from 'ini';
import { GlobalConfig } from '../../../config/global';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/pod/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from 'crypto';
import crypto from 'node:crypto';
import { HOST_DISABLED } from '../../../constants/error-messages';
import { logger } from '../../../logger';
import { ExternalHostError } from '../../../types/errors/external-host-error';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/pypi/index.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 changelogFilenameRegex from 'changelog-filename-regex';
import { logger } from '../../../logger';
import { parse } from '../../../util/html';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/bazel/artifacts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from 'crypto';
import crypto from 'node:crypto';
import { codeBlock } from 'common-tags';
import * as httpMock from '../../../../test/http-mock';
import { partial } from '../../../../test/util';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/git-submodules/extract.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 Git, { SimpleGit } from 'simple-git';
import upath from 'upath';
import { GlobalConfig } from '../../../config/global';
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/gradle-wrapper/artifacts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Stats } from 'fs';
import os from 'os';
import type { Stats } from 'node:fs';
import os from 'node:os';
import { join } from 'upath';
import { envMock, mockExecAll } from '../../../../test/exec-util';
import { Fixtures } from '../../../../test/fixtures';
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/gradle-wrapper/util.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Stats } from 'fs';
import os from 'os';
import type { Stats } from 'node:fs';
import os from 'node:os';
import { fs, partial } from '../../../../test/util';
import { GlobalConfig } from '../../../config/global';
import {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gradle-wrapper/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import { GlobalConfig } from '../../../config/global';
import { logger } from '../../../logger';
import { chmodLocalFile, statLocalFile } from '../../../util/fs';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gradle/artifacts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import { join } from 'upath';
import {
envMock,
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/gradle/parser/handlers.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 upath from 'upath';
import { logger } from '../../../../logger';
import { getSiblingFileName } from '../../../../util/fs';
Expand Down Expand Up @@ -289,7 +289,7 @@ export function handleCustomRegistryUrl(ctx: Ctx): Ctx {
if (registryUrl) {
registryUrl = registryUrl.replace(regEx(/\\/g), '');
try {
const { host, protocol } = url.parse(registryUrl);
const { host, protocol } = URL.parse(registryUrl);
if (host && protocol) {
ctx.registryUrls.push({
registryUrl,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/homebrew/update.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { Fixtures } from '../../../../test/fixtures';
import * as httpMock from '../../../../test/http-mock';
import { updateDependency } from '.';
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/maven-wrapper/artifacts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Stats } from 'fs';
import os from 'os';
import type { Stats } from 'node:fs';
import os from 'node:os';
import type { StatusResult } from 'simple-git';
import { join } from 'upath';
import { envMock, mockExecAll } from '../../../../test/exec-util';
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/maven-wrapper/artifacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Stats } from 'fs';
import os from 'os';
import type { Stats } from 'node:fs';
import os from 'node:os';
import is from '@sindresorhus/is';
import { dirname, join } from 'upath';
import { GlobalConfig } from '../../../config/global';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/npm/detect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import is from '@sindresorhus/is';
import upath from 'upath';
import { logger } from '../../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/puppet/extract.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EOL } from 'os';
import { EOL } from 'node:os';
import { Fixtures } from '../../../../test/fixtures';
import { GitTagsDatasource } from '../../datasource/git-tags';
import { GithubTagsDatasource } from '../../datasource/github-tags';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/puppet/puppetfile-parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EOL } from 'os';
import { EOL } from 'node:os';
import { Fixtures } from '../../../../test/fixtures';
import { parsePuppetfile } from './puppetfile-parser';

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/regex/utils.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 is from '@sindresorhus/is';
import { migrateDatasource } from '../../../config/migrations/custom/datasource-migration';
import type { RegexManagerTemplates } from '../../../config/types';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/terraform/lockfile/hash.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createReadStream } from 'fs';
import { createReadStream } from 'node:fs';
import { DirectoryResult, dir } from 'tmp-promise';
import { Fixtures } from '../../../../../test/fixtures';
import * as httpMock from '../../../../../test/http-mock';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/terraform/lockfile/hash.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from 'crypto';
import crypto from 'node:crypto';
import extract from 'extract-zip';
import upath from 'upath';
import { logger } from '../../../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/azure/azure-helper.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { GitPullRequestMergeStrategy } from 'azure-devops-node-api/interfaces/GitInterfaces.js';

describe('modules/platform/azure/azure-helper', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/azure/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import is from '@sindresorhus/is';
import type { IGitApi } from 'azure-devops-node-api/GitApi';
import {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/azure/util.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { streamToString } from '../../../util/streams';
import {
getBranchNameWithoutRefsheadsPrefix,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/bitbucket-server/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SEE for the reference https://github.com/renovatebot/renovate/blob/c3e9e572b225085448d94aa121c7ec81c14d3955/lib/platform/bitbucket/utils.js
import url from 'url';
import url, { URL } from 'node:url';
import is from '@sindresorhus/is';
import { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages';
import { logger } from '../../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/bitbucket/index.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 is from '@sindresorhus/is';
import JSON5 from 'json5';
import { REPOSITORY_NOT_FOUND } from '../../../constants/error-messages';
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/platform/bitbucket/utils.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 type { MergeStrategy } from '../../../config/types';
import type { BranchStatus } from '../../../types';
import { BitbucketHttp } from '../../../util/http/bitbucket';
Expand Down Expand Up @@ -64,8 +64,8 @@ export const buildStates: Record<BranchStatus, BitbucketBranchState> = {
};

const addMaxLength = (inputUrl: string, pagelen = 100): string => {
const { search, ...parsedUrl } = url.parse(inputUrl, true);
const maxedUrl = url.format({
const { search, ...parsedUrl } = URL.parse(inputUrl, true);
const maxedUrl = URL.format({
...parsedUrl,
query: { ...parsedUrl.query, pagelen },
});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/codecommit/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'buffer';
import { Buffer } from 'node:buffer';
import {
GetCommentsForPullRequestOutput,
ListRepositoriesOutput,
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/github/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: types (#7154)
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import URL from 'url';
import URL from 'node:url';
import is from '@sindresorhus/is';
import delay from 'delay';
import JSON5 from 'json5';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/gitlab/index.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 is from '@sindresorhus/is';
import delay from 'delay';
import JSON5 from 'json5';
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/index.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 type { AllConfig } from '../../config/types';
import type { PlatformId } from '../../constants';
import { PLATFORM_NOT_FOUND } from '../../constants/error-messages';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/cache/package/decorator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import { GlobalConfig } from '../../../config/global';
import * as memCache from '../memory';
import { cache } from './decorator';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/cache/package/file.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import cacache from 'cacache';
import { cleanup, get, init, set } from './file';

Expand Down
2 changes: 1 addition & 1 deletion lib/util/cache/repository/impl/s3.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import {
GetObjectCommand,
GetObjectCommandInput,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/cache/repository/impl/s3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import {
GetObjectCommand,
GetObjectCommandInput,
Expand Down
4 changes: 2 additions & 2 deletions lib/util/compress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promisify } from 'util';
import zlib from 'zlib';
import { promisify } from 'node:util';
import zlib from 'node:zlib';

const brotliCompress = promisify(zlib.brotliCompress);
const brotliDecompress = promisify(zlib.brotliDecompress);
Expand Down
6 changes: 3 additions & 3 deletions lib/util/exec/common.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawn as _spawn } from 'child_process';
import type { SendHandle, Serializable } from 'child_process';
import { Readable } from 'stream';
import { spawn as _spawn } from 'node:child_process';
import type { SendHandle, Serializable } from 'node:child_process';
import { Readable } from 'node:stream';
import { mockedFunction, partial } from '../../../test/util';
import { exec } from './common';
import type { RawExecOptions } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/exec/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChildProcess, spawn } from 'child_process';
import { ChildProcess, spawn } from 'node:child_process';
import { ExecError, ExecErrorData } from './exec-error';
import type { ExecResult, RawExecOptions } from './types';

Expand Down
2 changes: 1 addition & 1 deletion lib/util/exec/hermit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import _findUp from 'find-up';
import upath from 'upath';
import { mockExecAll } from '../../../test/exec-util';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/exec/hermit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import upath from 'upath';
import { GlobalConfig } from '../../config/global';
import { logger } from '../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/exec/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SpawnOptions as ChildProcessSpawnOptions } from 'child_process';
import type { SpawnOptions as ChildProcessSpawnOptions } from 'node:child_process';

export interface ToolConstraint {
toolName: string;
Expand Down
4 changes: 2 additions & 2 deletions lib/util/fs/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stream from 'stream';
import util from 'util';
import stream from 'node:stream';
import util from 'node:util';
import is from '@sindresorhus/is';
import findUp from 'find-up';
import fs from 'fs-extra';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/git/index.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 is from '@sindresorhus/is';
import delay from 'delay';
import fs from 'fs-extra';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/git/private-key.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os from 'os';
import os from 'node:os';
import is from '@sindresorhus/is';
import fs from 'fs-extra';
import upath from 'upath';
Expand Down
6 changes: 5 additions & 1 deletion lib/util/http/dns.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { LookupAllOptions, LookupOneOptions, lookup as _dnsLookup } from 'dns';
import {
LookupAllOptions,
LookupOneOptions,
lookup as _dnsLookup,
} from 'node:dns';
import type { EntryObject, IPFamily, LookupOptions } from 'cacheable-lookup';
import QuickLRU from 'quick-lru';
import { logger } from '../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/util/http/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IncomingHttpHeaders } from 'http';
import type { IncomingHttpHeaders } from 'node:http';
import type {
OptionsOfBufferResponseBody,
OptionsOfJSONResponseBody,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/modules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from 'fs';
import fs from 'node:fs';
import upath from 'upath';

function relatePath(here: string, there: string): string {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/streams.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import { streamToString } from './streams';

describe('util/streams', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/streams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';

export async function streamToString(
stream: NodeJS.ReadableStream
Expand Down
Loading

0 comments on commit e62300a

Please sign in to comment.