Skip to content

Conversation

suprajaven
Copy link
Contributor

Problem

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.

Solution

Add back the dependency.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@suprajaven suprajaven requested a review from a team as a code owner May 28, 2025 13:52
@suprajaven suprajaven merged commit d8890a6 into main May 28, 2025
4 checks passed
@suprajaven suprajaven deleted the dependency-update branch May 28, 2025 14:00
TrevorBurnham added a commit to TrevorBurnham/language-server-runtimes that referenced this pull request Aug 23, 2025
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.
TrevorBurnham added a commit to TrevorBurnham/language-server-runtimes that referenced this pull request Aug 23, 2025
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.
TrevorBurnham added a commit to TrevorBurnham/language-server-runtimes that referenced this pull request Aug 23, 2025
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).
TrevorBurnham added a commit to TrevorBurnham/language-server-runtimes that referenced this pull request Aug 23, 2025
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).
@TrevorBurnham
Copy link

I've opened a new PR to replace the aws-sdk dependency while retaining type safety: #668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants