Skip to content

Commit cb3872c

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 simply moved `aws-sdk` from `dependencies` to `devDependencies`. That change was reverted by aws#535. The reason for the revert was this claim from @suprajaven: > The package is currently not declaring a dependency but it is actually > using aws-sdk. The overall impact is not noted because when used in > conjunction with language servers package ( which has this dependency > present) the overall build is not broken. I believe this is a misunderstanding: The reason the dependency could be safely moved to `devDependencies` is that all of the references to that package were actually just importing types, which means they weren't used at runtime. Here I've gone a step further and replaced the `aws-sdk` dependency with `@types/aws-sdk2-types`. These types were pulled directly from `aws-sdk@2`, so they should match: DefinitelyTyped/DefinitelyTyped#64111 This change ensures that `aws-sdk` won't be used at runtime. As a bonus, it makes this repo's `node_modules` nearly 100MB lighter, which should speed up builds and other development processes.
1 parent bb3e636 commit cb3872c

File tree

8 files changed

+22
-120
lines changed

8 files changed

+22
-120
lines changed

package-lock.json

Lines changed: 11 additions & 109 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
@@ -52,12 +52,12 @@
5252
"registry-js": "^1.16.1"
5353
},
5454
"devDependencies": {
55+
"@types/aws-sdk2-types": "^0.0.5",
5556
"@types/mocha": "^10.0.9",
5657
"@types/mock-fs": "^4.13.4",
5758
"@types/node": "^22.15.17",
5859
"@types/node-forge": "^1.3.11",
5960
"assert": "^2.0.0",
60-
"aws-sdk": "^2.1692.0",
6161
"copyfiles": "^2.4.1",
6262
"husky": "^9.1.7",
6363
"json-schema-to-typescript": "^15.0.4",

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 type { 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 type { 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 type { 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 type { 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

runtimes/server-interface/sdk-initializator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Service } from 'aws-sdk'
2-
import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
1+
import { Service } from 'aws-sdk2-types'
2+
import { ServiceConfigurationOptions } from 'aws-sdk2-types/lib/service'
33

44
// aws sdk v2 clients constructor type
55
export type SDKClientConstructorV2<T, P extends ServiceConfigurationOptions> = new (config?: P) => T

runtimes/testing/TestFeatures.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import {
3030
InitializeParams,
3131
} from '../protocol'
3232
import { IdentityManagement } from '../server-interface/identity-management'
33-
import type { Service } from 'aws-sdk'
34-
import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
33+
import { Service } from 'aws-sdk2-types'
34+
import { ServiceConfigurationOptions } from 'aws-sdk2-types/lib/service'
3535

3636
/**
3737
* A test helper package to test Server implementations. Accepts a single callback

0 commit comments

Comments
 (0)