Skip to content

Commit 15fb1ea

Browse files
authored
chore: set esModuleInterop to true in packages (#1516)
1 parent 601ba0a commit 15fb1ea

File tree

14 files changed

+31
-29
lines changed

14 files changed

+31
-29
lines changed

packages/client-documentation-generator/src/sdk-client-source-update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Converter } from "typedoc/dist/lib/converter";
33
import { Component, ConverterComponent } from "typedoc/dist/lib/converter/components";
44
import { Context } from "typedoc/dist/lib/converter/context";
55
import { SourceFile } from "typedoc/dist/lib/models";
6-
import * as ts from "typescript";
6+
import ts from "typescript";
77

88
const basePathsToIgnore = ["model"];
99

packages/credential-provider-imds/src/remoteProvider/httpRequest.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ProviderError } from "@aws-sdk/property-provider";
22
import { createServer } from "http";
3-
import * as nock from "nock";
3+
import nock from "nock";
44

55
import { httpRequest } from "./httpRequest";
66

packages/credential-provider-ini/src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jest.mock("fs", () => {
3333

3434
return fs;
3535
});
36-
import * as fs from "fs";
36+
import fs from "fs";
3737
const { __addMatcher, __clearMatchers } = fs as any;
3838

3939
jest.mock("os", () => {

packages/credential-provider-process/src/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jest.mock("fs", () => {
3232

3333
return fs;
3434
});
35-
import * as fs from "fs";
35+
import fs from "fs";
3636
const { __addFsMatcher, __clearFsMatchers } = fs as any;
3737

3838
jest.mock("os", () => {
@@ -79,7 +79,7 @@ jest.mock("child_process", () => {
7979

8080
return child_process;
8181
});
82-
import * as child_process from "child_process";
82+
import child_process from "child_process";
8383
const { __addChildProcessMatcher, __clearChildProcessMatchers } = child_process as any;
8484

8585
const DEFAULT_CREDS = {

packages/fetch-http-handler/src/fetch-http-handler.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AbortController } from "@aws-sdk/abort-controller";
22
import { HttpRequest } from "@aws-sdk/protocol-http";
33

44
import { FetchHttpHandler } from "./fetch-http-handler";
5-
import * as timeouts from "./request-timeout";
5+
import { requestTimeout } from "./request-timeout";
66

77
const mockRequest = jest.fn();
88
let mockResponse: any;
@@ -150,7 +150,7 @@ describe.skip(FetchHttpHandler.name, () => {
150150
const mockFetch = jest.fn().mockResolvedValue(mockResponse);
151151
(global as any).fetch = mockFetch;
152152

153-
timeoutSpy = jest.spyOn(timeouts, "requestTimeout");
153+
timeoutSpy = jest.spyOn({ requestTimeout }, "requestTimeout");
154154
const fetchHttpHandler = new FetchHttpHandler({
155155
requestTimeout: 500,
156156
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as index from "./index";
1+
import { FetchHttpHandler } from "./index";
22

33
describe("index", () => {
44
it("exports FetchHttpHandler", () => {
5-
expect(typeof index.FetchHttpHandler).toBe("function");
5+
expect(typeof FetchHttpHandler).toBe("function");
66
});
77
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as index from "./index";
1+
import { NodeHttpHandler } from "./index";
22

33
describe("index", () => {
44
it("exports NodeHttpHandler", () => {
5-
expect(typeof index.NodeHttpHandler).toBe("function");
5+
expect(typeof NodeHttpHandler).toBe("function");
66
});
77
});

packages/node-http-handler/src/node-http-handler.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { AbortController } from "@aws-sdk/abort-controller";
22
import { HttpRequest } from "@aws-sdk/protocol-http";
33
import { Server as HttpServer } from "http";
4-
import * as http from "http";
4+
import http from "http";
55
import { Server as HttpsServer } from "https";
6-
import * as https from "https";
6+
import https from "https";
77
import { AddressInfo } from "net";
88

99
import { NodeHttpHandler } from "./node-http-handler";

packages/node-http-handler/src/node-http-handler.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http";
22
import { buildQueryString } from "@aws-sdk/querystring-builder";
33
import { HttpHandlerOptions } from "@aws-sdk/types";
4-
import * as http from "http";
5-
import * as https from "https";
4+
import { Agent as hAgent, request as hRequest } from "http";
5+
import { Agent as hsAgent, request as hsRequest, RequestOptions } from "https";
66

77
import { getTransformedHeaders } from "./get-transformed-headers";
88
import { setConnectionTimeout } from "./set-connection-timeout";
@@ -25,13 +25,13 @@ export interface NodeHttpOptions {
2525
*/
2626
socketTimeout?: number;
2727

28-
httpAgent?: http.Agent;
29-
httpsAgent?: https.Agent;
28+
httpAgent?: hAgent;
29+
httpsAgent?: hsAgent;
3030
}
3131

3232
export class NodeHttpHandler implements HttpHandler {
33-
private readonly httpAgent: http.Agent;
34-
private readonly httpsAgent: https.Agent;
33+
private readonly httpAgent: hAgent;
34+
private readonly httpsAgent: hsAgent;
3535
private readonly connectionTimeout?: number;
3636
private readonly socketTimeout?: number;
3737
// Node http handler is hard-coded to http/1.1: https://github.com/nodejs/node/blob/ff5664b83b89c55e4ab5d5f60068fb457f1f5872/lib/_http_server.js#L286
@@ -41,8 +41,8 @@ export class NodeHttpHandler implements HttpHandler {
4141
this.connectionTimeout = connectionTimeout;
4242
this.socketTimeout = socketTimeout;
4343
const keepAlive = true;
44-
this.httpAgent = httpAgent || new http.Agent({ keepAlive });
45-
this.httpsAgent = httpsAgent || new https.Agent({ keepAlive });
44+
this.httpAgent = httpAgent || new hAgent({ keepAlive });
45+
this.httpsAgent = httpsAgent || new hsAgent({ keepAlive });
4646
}
4747

4848
destroy(): void {
@@ -63,7 +63,7 @@ export class NodeHttpHandler implements HttpHandler {
6363
// determine which http(s) client to use
6464
const isSSL = request.protocol === "https:";
6565
const queryString = buildQueryString(request.query || {});
66-
const nodeHttpsOptions: https.RequestOptions = {
66+
const nodeHttpsOptions: RequestOptions = {
6767
headers: request.headers,
6868
host: request.hostname,
6969
method: request.method,
@@ -73,7 +73,8 @@ export class NodeHttpHandler implements HttpHandler {
7373
};
7474

7575
// create the http request
76-
const req = (isSSL ? https : http).request(nodeHttpsOptions, (res) => {
76+
const requestFunc = isSSL ? hsRequest : hRequest;
77+
const req = requestFunc(nodeHttpsOptions, (res) => {
7778
const httpResponse = new HttpResponse({
7879
statusCode: res.statusCode || -1,
7980
headers: getTransformedHeaders(res.headers),

packages/shared-ini-file-loader/src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jest.mock("fs", () => {
3131

3232
return fs;
3333
});
34-
import * as fs from "fs";
34+
import fs from "fs";
3535
const { __addMatcher, __clearMatchers } = fs as any;
3636

3737
jest.mock("os", () => {

0 commit comments

Comments
 (0)