diff --git a/src/attach.ts b/src/attach.ts index fc119bcf69..62037313bb 100644 --- a/src/attach.ts +++ b/src/attach.ts @@ -1,6 +1,6 @@ -import WebSocket = require('isomorphic-ws'); -import querystring = require('node:querystring'); -import stream = require('node:stream'); +import WebSocket from 'isomorphic-ws'; +import querystring from 'node:querystring'; +import stream from 'node:stream'; import { KubeConfig } from './config'; import { isResizable, ResizableStream, TerminalSizeQueue } from './terminal-size-queue'; diff --git a/src/attach_test.ts b/src/attach_test.ts index 841394f69d..8d87cd00cd 100644 --- a/src/attach_test.ts +++ b/src/attach_test.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import WebSocket = require('isomorphic-ws'); +import WebSocket from 'isomorphic-ws'; import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers'; import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito'; diff --git a/src/auth.ts b/src/auth.ts index 2d1e8fd9fa..69f76bed5d 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,7 +1,7 @@ -import https = require('node:https'); +import https from 'node:https'; import { User } from './config_types'; -import WebSocket = require('isomorphic-ws'); +import WebSocket from 'isomorphic-ws'; export interface Authenticator { isAuthProvider(user: User): boolean; diff --git a/src/azure_auth.ts b/src/azure_auth.ts index 6b7355d417..8ab35760e3 100644 --- a/src/azure_auth.ts +++ b/src/azure_auth.ts @@ -1,6 +1,6 @@ -import * as proc from 'node:child_process'; -import https = require('node:https'); -import * as jsonpath from 'jsonpath-plus'; +import proc from 'node:child_process'; +import https from 'node:https'; +import jsonpath from 'jsonpath-plus'; import { Authenticator } from './auth'; import { User } from './config_types'; diff --git a/src/cache_test.ts b/src/cache_test.ts index 113353af4a..876494ede7 100644 --- a/src/cache_test.ts +++ b/src/cache_test.ts @@ -1,7 +1,7 @@ import { expect, use } from 'chai'; -import chaiAsPromised = require('chai-as-promised'); +import chaiAsPromised from 'chai-as-promised'; -import * as mock from 'ts-mockito'; +import mock from 'ts-mockito'; import { V1ListMeta, V1Namespace, V1NamespaceList, V1ObjectMeta, V1Pod } from './api'; import { deleteItems, deleteObject, ListWatch } from './cache'; @@ -11,7 +11,7 @@ import { ListPromise } from './informer'; use(chaiAsPromised); -import nock = require('nock'); +import nock from 'nock'; import { Watch } from './watch'; const server = 'http://foo.company.com'; diff --git a/src/config.ts b/src/config.ts index 97d9cab546..453f7b1925 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,11 +1,11 @@ -import fs = require('node:fs'); -import https = require('node:https'); -import yaml = require('js-yaml'); -import net = require('node:net'); -import path = require('node:path'); +import fs from 'node:fs'; +import https from 'node:https'; +import yaml from 'js-yaml'; +import net from 'node:net'; +import path from 'node:path'; import { Headers, RequestInit } from 'node-fetch'; -import * as api from './api'; +import { RequestContext } from './api'; import { Authenticator } from './auth'; import { AzureAuth } from './azure_auth'; import { @@ -31,8 +31,8 @@ import { ServerConfiguration, } from './gen'; import { OpenIDConnectAuth } from './oidc_auth'; -import WebSocket = require('isomorphic-ws'); -import child_process = require('node:child_process'); +import WebSocket from 'isomorphic-ws'; +import child_process from 'node:child_process'; const SERVICEACCOUNT_ROOT: string = '/var/run/secrets/kubernetes.io/serviceaccount'; const SERVICEACCOUNT_CA_PATH: string = SERVICEACCOUNT_ROOT + '/ca.crt'; @@ -212,7 +212,7 @@ export class KubeConfig implements SecurityAuthentication { * Applies SecurityAuthentication to RequestContext of an API Call from API Client * @param context */ - public async applySecurityAuthentication(context: api.RequestContext): Promise { + public async applySecurityAuthentication(context: RequestContext): Promise { const cluster = this.getCurrentCluster(); const user = this.getCurrentUser(); diff --git a/src/config_test.ts b/src/config_test.ts index 0b22693b58..08e61a60ad 100644 --- a/src/config_test.ts +++ b/src/config_test.ts @@ -1,12 +1,11 @@ import { readFileSync } from 'node:fs'; -import * as https from 'node:https'; +import https from 'node:https'; import { Agent, RequestOptions } from 'node:https'; -import { join } from 'node:path'; +import path, { join } from 'node:path'; import { expect, use } from 'chai'; import chaiAsPromised from 'chai-as-promised'; -import mockfs = require('mock-fs'); -import * as path from 'node:path'; +import mockfs from 'mock-fs'; import { Headers } from 'node-fetch'; import { HttpMethod } from '.'; diff --git a/src/config_types.ts b/src/config_types.ts index 793f594574..e35ae6f7cf 100644 --- a/src/config_types.ts +++ b/src/config_types.ts @@ -1,4 +1,4 @@ -import * as fs from 'node:fs'; +import fs from 'node:fs'; export enum ActionOnInvalid { THROW = 'throw', diff --git a/src/cp.ts b/src/cp.ts index 925589b2af..e07b6149a2 100644 --- a/src/cp.ts +++ b/src/cp.ts @@ -1,7 +1,7 @@ -import * as fs from 'node:fs'; +import fs from 'node:fs'; import { WritableStreamBuffer } from 'stream-buffers'; import * as tar from 'tar'; -import * as tmp from 'tmp-promise'; +import tmp from 'tmp-promise'; import { KubeConfig } from './config'; import { Exec } from './exec'; diff --git a/src/cp_test.ts b/src/cp_test.ts index 5ef7361d0f..961f4081b0 100644 --- a/src/cp_test.ts +++ b/src/cp_test.ts @@ -1,6 +1,6 @@ import { anything, anyFunction, instance, mock, verify, when } from 'ts-mockito'; -import * as querystring from 'node:querystring'; -import WebSocket = require('isomorphic-ws'); +import querystring from 'node:querystring'; +import WebSocket from 'isomorphic-ws'; import { CallAwaiter } from '../test'; import { KubeConfig } from './config'; diff --git a/src/exec.ts b/src/exec.ts index ee1cddc3aa..d7a4bab8c6 100644 --- a/src/exec.ts +++ b/src/exec.ts @@ -1,6 +1,6 @@ -import WebSocket = require('isomorphic-ws'); -import querystring = require('node:querystring'); -import stream = require('stream'); +import WebSocket from 'isomorphic-ws'; +import querystring from 'node:querystring'; +import stream from 'stream'; import { V1Status } from './api'; import { KubeConfig } from './config'; diff --git a/src/exec_auth.ts b/src/exec_auth.ts index c2d4b6b7c0..34425af5b6 100644 --- a/src/exec_auth.ts +++ b/src/exec_auth.ts @@ -1,10 +1,10 @@ import { OutgoingHttpHeaders } from 'node:http'; -import https = require('node:https'); +import https from 'node:https'; import { Authenticator } from './auth'; import { User } from './config_types'; -import child_process = require('node:child_process'); +import child_process from 'node:child_process'; export interface CredentialStatus { readonly token: string; diff --git a/src/exec_auth_test.ts b/src/exec_auth_test.ts index 9622d1542a..8514d927fe 100644 --- a/src/exec_auth_test.ts +++ b/src/exec_auth_test.ts @@ -9,7 +9,7 @@ import { ExecAuth } from './exec_auth'; import { User } from './config_types'; import { fail } from 'node:assert'; -import child_process = require('node:child_process'); +import child_process from 'node:child_process'; describe('ExecAuth', () => { it('should claim correctly', () => { diff --git a/src/file_auth.ts b/src/file_auth.ts index 2623c4fb6f..0868d650f4 100644 --- a/src/file_auth.ts +++ b/src/file_auth.ts @@ -1,5 +1,5 @@ -import fs = require('node:fs'); -import https = require('node:https'); +import fs from 'node:fs'; +import https from 'node:https'; import { Authenticator } from './auth'; import { User } from './config_types'; diff --git a/src/gcp_auth.ts b/src/gcp_auth.ts index 7eac957ef9..6c33918832 100644 --- a/src/gcp_auth.ts +++ b/src/gcp_auth.ts @@ -1,6 +1,6 @@ -import * as proc from 'node:child_process'; -import https = require('node:https'); -import * as jsonpath from 'jsonpath-plus'; +import proc from 'node:child_process'; +import https from 'node:https'; +import jsonpath from 'jsonpath-plus'; import { Authenticator } from './auth'; import { User } from './config_types'; diff --git a/src/integration_test.ts b/src/integration_test.ts index e61a36f775..214daa786d 100644 --- a/src/integration_test.ts +++ b/src/integration_test.ts @@ -1,6 +1,6 @@ import { expect, use } from 'chai'; -import chaiAsPromised = require('chai-as-promised'); -import nock = require('nock'); +import chaiAsPromised from 'chai-as-promised'; +import nock from 'nock'; import { CoreV1Api } from './api'; import { KubeConfig } from './config'; diff --git a/src/metrics_test.ts b/src/metrics_test.ts index 7da08f9938..042772a9df 100644 --- a/src/metrics_test.ts +++ b/src/metrics_test.ts @@ -1,6 +1,6 @@ import { fail } from 'node:assert'; import { expect } from 'chai'; -import nock = require('nock'); +import nock from 'nock'; import { KubeConfig } from './config'; import { V1Status, ApiException } from './gen'; import { Metrics, NodeMetricsList, PodMetricsList } from './metrics'; diff --git a/src/object_test.ts b/src/object_test.ts index d6ea3e050d..7883afe870 100644 --- a/src/object_test.ts +++ b/src/object_test.ts @@ -1,6 +1,6 @@ import { fail } from 'node:assert'; import { expect } from 'chai'; -import nock = require('nock'); +import nock from 'nock'; import { Configuration, V1APIResource, V1APIResourceList, V1Secret } from './api'; import { KubeConfig } from './config'; import { KubernetesObjectApi } from './object'; diff --git a/src/portforward.ts b/src/portforward.ts index 09f3b519a6..642514211a 100644 --- a/src/portforward.ts +++ b/src/portforward.ts @@ -1,6 +1,6 @@ -import WebSocket = require('isomorphic-ws'); -import querystring = require('node:querystring'); -import stream = require('node:stream'); +import WebSocket from 'isomorphic-ws'; +import querystring from 'node:querystring'; +import stream from 'node:stream'; import { KubeConfig } from './config'; import { WebSocketHandler, WebSocketInterface } from './web-socket-handler'; diff --git a/src/proto-client.ts b/src/proto-client.ts index c607e2a62f..3e5df9eab8 100644 --- a/src/proto-client.ts +++ b/src/proto-client.ts @@ -1,4 +1,4 @@ -import http = require('node:http'); +import http from 'node:http'; import { KubeConfig } from './config'; diff --git a/src/top_test.ts b/src/top_test.ts index 25329e7169..758370d81f 100644 --- a/src/top_test.ts +++ b/src/top_test.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import nock = require('nock'); +import nock from 'nock'; import { KubeConfig } from './config'; import { Metrics, PodMetricsList } from './metrics'; import { topPods } from './top'; diff --git a/src/watch_test.ts b/src/watch_test.ts index 1545a70a8e..bee22d190a 100644 --- a/src/watch_test.ts +++ b/src/watch_test.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import nock = require('nock'); +import nock from 'nock'; import { PassThrough } from 'node:stream'; import { KubeConfig } from './config'; import { Cluster, Context, User } from './config_types'; diff --git a/src/web-socket-handler.ts b/src/web-socket-handler.ts index 79fba98ab8..28370331c3 100644 --- a/src/web-socket-handler.ts +++ b/src/web-socket-handler.ts @@ -1,5 +1,5 @@ -import WebSocket = require('isomorphic-ws'); -import stream = require('node:stream'); +import WebSocket from 'isomorphic-ws'; +import stream from 'node:stream'; import { V1Status } from './api'; import { KubeConfig } from './config'; diff --git a/src/web-socket-handler_test.ts b/src/web-socket-handler_test.ts index c490f8579b..db5567dd12 100644 --- a/src/web-socket-handler_test.ts +++ b/src/web-socket-handler_test.ts @@ -1,7 +1,7 @@ import { Readable } from 'node:stream'; import { setImmediate as setImmediatePromise } from 'node:timers/promises'; import { expect } from 'chai'; -import WebSocket = require('isomorphic-ws'); +import WebSocket from 'isomorphic-ws'; import { WritableStreamBuffer } from 'stream-buffers'; import { V1Status } from './api'; diff --git a/src/yaml.ts b/src/yaml.ts index 84c57145db..7682392ae6 100644 --- a/src/yaml.ts +++ b/src/yaml.ts @@ -1,4 +1,4 @@ -import * as yaml from 'js-yaml'; +import yaml from 'js-yaml'; export function loadYaml(data: string, opts?: yaml.LoadOptions): T { return yaml.load(data, opts) as any as T;