Skip to content

Commit c1871c9

Browse files
authored
Merge pull request #1922 from cjihrig/core-imports
refactor Node core module imports
2 parents 03aad44 + 695673a commit c1871c9

37 files changed

+58
-72
lines changed

examples/typescript/apply/apply-from-file-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// in a real program use require('@kubernetes/client-node')
22
import * as k8s from '../../../dist';
33
import * as yaml from 'js-yaml';
4-
import { promises as fs } from 'fs';
4+
import * as fs from 'node:fs/promises';
55

66
/**
77
* Replicate the functionality of `kubectl apply`. That is, create the resources defined in the `specFile` if they do
@@ -51,4 +51,4 @@ export async function apply(specPath: string): Promise<k8s.KubernetesObject[]> {
5151
}
5252

5353
return created;
54-
}
54+
}

examples/typescript/exec/exec-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// in a real program use require('@kubernetes/client-node')
22
import * as k8s from '../../../dist';
3-
import * as stream from 'stream';
3+
import * as stream from 'node:stream';
44

55
const command = process.argv[2];
66

examples/typescript/port-forward/port-forward.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// in a real program use require('@kubernetes/client-node')
22
import * as k8s from '../../../dist';
3-
import * as net from 'net';
3+
import * as net from 'node:net';
44

55
const kc = new k8s.KubeConfig();
66
kc.loadFromDefault();

src/attach.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import WebSocket = require('isomorphic-ws');
2-
import querystring = require('querystring');
3-
import stream = require('stream');
2+
import querystring = require('node:querystring');
3+
import stream = require('node:stream');
44

55
import { KubeConfig } from './config';
66
import { isResizable, ResizableStream, TerminalSizeQueue } from './terminal-size-queue';

src/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import https = require('https');
1+
import https = require('node:https');
22

33
import { User } from './config_types';
44
import WebSocket = require('isomorphic-ws');

src/azure_auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as proc from 'child_process';
2-
import https = require('https');
1+
import * as proc from 'node:child_process';
2+
import https = require('node:https');
33
import * as jsonpath from 'jsonpath-plus';
44

55
import { Authenticator } from './auth';

src/azure_auth_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { use, expect } from 'chai';
22
import chaiAsPromised from 'chai-as-promised';
3-
import { join } from 'path';
3+
import { join } from 'node:path';
44

55
import { User, Cluster } from './config_types';
66
import { AzureAuth } from './azure_auth';

src/cache_test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import chaiAsPromised = require('chai-as-promised');
33

44
import * as mock from 'ts-mockito';
55

6-
import http = require('http');
7-
86
import { V1ListMeta, V1Namespace, V1NamespaceList, V1ObjectMeta, V1Pod } from './api';
97
import { deleteItems, deleteObject, ListWatch } from './cache';
108
import { KubeConfig } from './config';

src/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import fs = require('fs');
2-
import https = require('https');
1+
import fs = require('node:fs');
2+
import https = require('node:https');
33
import yaml = require('js-yaml');
4-
import net = require('net');
5-
import path = require('path');
4+
import net = require('node:net');
5+
import path = require('node:path');
66

77
import { Headers, RequestInit } from 'node-fetch';
88
import * as api from './api';
@@ -32,7 +32,7 @@ import {
3232
} from './gen';
3333
import { OpenIDConnectAuth } from './oidc_auth';
3434
import WebSocket = require('isomorphic-ws');
35-
import child_process = require('child_process');
35+
import child_process = require('node:child_process');
3636

3737
const SERVICEACCOUNT_ROOT: string = '/var/run/secrets/kubernetes.io/serviceaccount';
3838
const SERVICEACCOUNT_CA_PATH: string = SERVICEACCOUNT_ROOT + '/ca.crt';

src/config_test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { readFileSync } from 'fs';
2-
import * as https from 'https';
3-
import { Agent, RequestOptions } from 'https';
4-
import { join } from 'path';
1+
import { readFileSync } from 'node:fs';
2+
import * as https from 'node:https';
3+
import { Agent, RequestOptions } from 'node:https';
4+
import { join } from 'node:path';
55

66
import { expect, use } from 'chai';
77
import chaiAsPromised from 'chai-as-promised';
88
import mockfs = require('mock-fs');
9-
import * as path from 'path';
9+
import * as path from 'node:path';
1010

1111
import { Headers } from 'node-fetch';
1212
import { HttpMethod } from '.';

0 commit comments

Comments
 (0)