aws / aws/aws-sdk-js-codemod

[Feature]: Dynamic imports

Open
#166 2 comments 0 reactions 0 assignees View on GitHub
enhancement p3
Dominant language
TypeScript
Stars
89
Forks
13
Avg merge
9h 59m
Merged PRs (30d)
1

Description

### Self-service

- [ ] I'd be willing to implement this feature

### Input code

```ts
import("aws-sdk")
.then((module) => {
return module.S3;
})
.then(() => {
const AWS = require("aws-sdk");
const s3 = new AWS.S3({});
});

```

### Expected Output

```ts
import("@aws-sdk/client-s3")
.then((module) => {
return module.S3;
})
.then(async () => {
const { S3 } = require("@aws-sdk/client-s3");
const s3 = new S3({});
});

```

### Additional context

Can be observed by checking out this change: https://github.com/awslabs/aws-sdk-js-codemod/compare/main...kuhe:aws-sdk-js-codemod:example/imports?expand=1

And running `npx jest -t dynamic`

Contributor guide

Open the contributing guide

Research direction

Start by checking out the linked example change and run `npx jest -t dynamic` to find the existing dynamic-import coverage. Trace the transformation that handles the shown input, then update it so the output matches the expected `@aws-sdk/client-s3` import and require forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.