Skip to content

Commit 2fb5f79

Browse files
committed
chore: replace aws-sdk with @types/aws-sdk2-types
This is a second attempt at fixing aws#417. The first attempt was aws#425, which moved `aws-sdk` from `dependencies` to `devDependencies`. That change was reverted by aws#535. The `aws-sdk` dependency is only being used for TypeScript types. Including it in `dependencies` rather than `devDependencies` ensures that those types are available to package consumers, at the expense of bringing in a 100MB+ dependency. The solution here is to replace the `aws-sdk` dependency with `@types/aws-sdk2-types`, which is a relatively lightweight 2.3MB. These types should be identical, as they were pulled directly from `aws-sdk`: DefinitelyTyped/DefinitelyTyped#64111 I considered inlining the types with dts-bundle-generator, which would allow `@types/aws-sdk2-types` to be moved to `devDependencies`, but this turned out to be impractical with the current export structure, since the types would have to be inlined separately in each `.d.ts` file that uses them. I would recommend that solution if the package moves to having a single defined entrypoint in the future (perhaps in the next major version).
1 parent 6570d12 commit 2fb5f79

File tree

8 files changed

+43
-108
lines changed

8 files changed

+43
-108
lines changed

package-lock.json

Lines changed: 32 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtimes/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"@opentelemetry/sdk-logs": "^0.200.0",
4141
"@opentelemetry/sdk-metrics": "^2.0.1",
4242
"@smithy/node-http-handler": "^4.0.4",
43+
"@types/aws-sdk2-types": "^0.0.5",
4344
"ajv": "^8.17.1",
44-
"aws-sdk": "^2.1692.0",
4545
"hpagent": "^1.2.0",
4646
"jose": "^5.9.6",
4747
"mac-ca": "^3.1.1",

runtimes/runtimes/base-runtime.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ import {
9898
import { IdentityManagement } from '../server-interface/identity-management'
9999
import { WebBase64Encoding } from './encoding'
100100
import { LoggingServer } from './lsp/router/loggingServer'
101-
import { Service } from 'aws-sdk'
102-
import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
101+
import { Service } from 'aws-sdk2-types'
102+
import { ServiceConfigurationOptions } from 'aws-sdk2-types/lib/service'
103103
import { getClientInitializeParamsHandlerFactory } from './util/lspCacheUtil'
104104
import { newAgent } from './agent'
105105
import { ShowSaveFileDialogRequestType, CheckDiagnosticsRequestType } from '../protocol/window'

runtimes/runtimes/standalone.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ import { getServerDataDirPath } from './util/serverDataDirPath'
8787
import { ProxyConfigManager } from './util/standalone/experimentalProxyUtil'
8888
import { Encoding } from './encoding'
8989
import { LoggingServer } from './lsp/router/loggingServer'
90-
import { Service } from 'aws-sdk'
91-
import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
90+
import { Service } from 'aws-sdk2-types'
91+
import { ServiceConfigurationOptions } from 'aws-sdk2-types/lib/service'
9292
import { getTelemetryLspServer } from './util/telemetryLspServer'
9393
import { getClientInitializeParamsHandlerFactory } from './util/lspCacheUtil'
9494
import { makeProxyConfigv2Standalone, makeProxyConfigv3Standalone } from './util/standalone/proxyUtil'

runtimes/runtimes/util/standalone/experimentalProxyUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { readFileSync } from 'node:fs'
77
import * as tls from 'node:tls'
88
import { Agent as HttpsAgent } from 'node:https'
99
import { X509Certificate } from 'node:crypto'
10-
import { ConfigurationOptions } from 'aws-sdk'
10+
import { ConfigurationOptions } from 'aws-sdk2-types'
1111
import { HttpsProxyAgent } from 'hpagent'
1212
import { NodeHttpHandler } from '@smithy/node-http-handler'
1313
import { readMacosCertificates, readLinuxCertificates, readWindowsCertificates } from './certificatesReaders'

runtimes/runtimes/util/standalone/proxyUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Workspace } from '../../../server-interface'
22

3-
import { ConfigurationOptions } from 'aws-sdk'
3+
import { ConfigurationOptions } from 'aws-sdk2-types'
44
import { HttpsProxyAgent } from 'hpagent'
55
import { NodeHttpHandler } from '@smithy/node-http-handler'
66

0 commit comments

Comments
 (0)