Skip to content

Commit 8b09b2d

Browse files
authored
Support parser=ts (#85)
1 parent ea49796 commit 8b09b2d

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

.changeset/nervous-rabbits-visit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": patch
3+
---
4+
5+
Support parser=ts

src/transforms/v2-to-v3/transformer.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ describe("v2-to-v3", () => {
1010
.filter((fileName) => fileName.endsWith(".input.ts"))
1111
.map((fileName) => fileName.replace(".input.ts", ""));
1212

13-
it.each(testFilePrefixes)(`transforms correctly using "%s" data`, (testFilePrefix) => {
14-
const path = join(fixtureDir, testFilePrefix + `.input.ts`);
15-
const source = readFileSync(path, "utf8");
16-
const input = { path, source };
17-
const expectedOutput = readFileSync(join(fixtureDir, testFilePrefix + `.output.ts`), "utf8");
18-
runInlineTest(transformer, null, input, expectedOutput);
13+
describe.each([{}, { parser: "ts" }])("testOptions: %o", (testOptions) => {
14+
it.each(testFilePrefixes)(`transforms correctly using "%s" data`, (testFilePrefix) => {
15+
const path = join(fixtureDir, testFilePrefix + `.input.ts`);
16+
const source = readFileSync(path, "utf8");
17+
const input = { path, source };
18+
const expectedOutput = readFileSync(join(fixtureDir, testFilePrefix + `.output.ts`), "utf8");
19+
runInlineTest(transformer, null, input, expectedOutput, testOptions);
20+
});
1921
});
2022
});

src/transforms/v2-to-v3/utils/addV3ClientRequire.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const addV3ClientRequire = (
2323
init: {
2424
type: "CallExpression",
2525
callee: { type: "Identifier", name: "require" },
26-
arguments: [{ type: "Literal", value: v3ClientPackageName }],
26+
arguments: [{ value: v3ClientPackageName }],
2727
},
2828
});
2929

src/transforms/v2-to-v3/utils/getImportIdentifierName.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export const getImportIdentifierName = (
77
): string | undefined =>
88
source
99
.find(j.ImportDeclaration, {
10-
source: { type: "Literal", value: literalValue },
10+
source: { value: literalValue },
1111
})
1212
.nodes()[0]?.specifiers[0]?.local.name;

src/transforms/v2-to-v3/utils/getRequireIdentifierName.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const getRequireIdentifierName = (
1212
init: {
1313
type: "CallExpression",
1414
callee: { type: "Identifier", name: "require" },
15-
arguments: [{ type: "Literal", value: literalValue }],
15+
arguments: [{ value: literalValue }],
1616
},
1717
})
1818
.nodes()[0]?.id as Identifier

src/transforms/v2-to-v3/utils/getRequireVariableDeclaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const getRequireVariableDeclaration = (
1111
init: {
1212
type: "CallExpression",
1313
callee: { type: "Identifier", name: "require" },
14-
arguments: [{ type: "Literal", value: literalValue }],
14+
arguments: [{ value: literalValue }],
1515
},
1616
},
1717
],

0 commit comments

Comments
 (0)