Skip to content

Commit feb9205

Browse files
authored
chore(deps): bump jscodeshift to v17.3.0 (#992)
1 parent 490b296 commit feb9205

File tree

9 files changed

+74
-47
lines changed

9 files changed

+74
-47
lines changed

.changeset/soft-bottles-sort.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": minor
3+
---
4+
5+
Bumps jscodeshift to v17.3.0

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
"test": "node --import tsx --test src/**/*.spec.ts"
4343
},
4444
"dependencies": {
45-
"jscodeshift": "17.1.1"
45+
"jscodeshift": "17.3.0"
4646
},
4747
"devDependencies": {
4848
"@biomejs/biome": "1.9.0",
4949
"@changesets/cli": "^2.27.1",
5050
"@tsconfig/node18": "^18.2.4",
51-
"@types/jscodeshift": "^0.12.0",
51+
"@types/jscodeshift": "^17.3.0",
5252
"@types/node": "^18.19.112",
5353
"aws-sdk": "2.1692.0",
5454
"tsx": "^4.7.1",

src/transforms/v2-to-v3/modules/importEqualsModule/getImportSpecifiers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ export const getImportSpecifiers = (
1010
const importSpecifiers = new Set<ImportSpecifierType>();
1111

1212
getImportEqualsDeclarations(j, source, path).forEach((importEqualsDeclaration) => {
13-
importSpecifiers.add({ localName: importEqualsDeclaration.value.id.name });
13+
const localName = importEqualsDeclaration.value.id.name;
14+
if (typeof localName !== "string") {
15+
throw new Error("Please report your use case on https://github.com/aws/aws-sdk-js-codemod");
16+
}
17+
importSpecifiers.add({ localName });
1418
});
1519

1620
return Array.from(importSpecifiers);

src/transforms/v2-to-v3/modules/importEqualsModule/removeImportEquals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const isAnotherSpecifier = (j: JSCodeshift, source: Collection<unknown>, localNa
88
export const removeImportEquals = (j: JSCodeshift, source: Collection<unknown>) =>
99
getImportEqualsDeclarations(j, source).forEach((importEqualsDeclaration) => {
1010
const localName = importEqualsDeclaration.value.id.name;
11+
if (typeof localName !== "string") {
12+
throw new Error("Please report your use case on https://github.com/aws/aws-sdk-js-codemod");
13+
}
1114
const identifiers = source.find(j.Identifier, { name: localName });
1215

1316
// Either the identifier is the only occurence on the page.

src/transforms/v2-to-v3/modules/importModule/getImportSpecifiers.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,28 @@ export const getImportSpecifiers = (
1515
switch (specifier.type) {
1616
case "ImportSpecifier": {
1717
const importedName = specifier.imported.name;
18+
const localName = specifier.local?.name;
19+
if (typeof importedName !== "string" || (localName && typeof localName !== "string")) {
20+
throw new Error(
21+
"Please report your use case on https://github.com/aws/aws-sdk-js-codemod"
22+
);
23+
}
1824
importSpecifiers.add({
1925
importedName,
20-
localName: specifier.local?.name || importedName,
26+
localName: localName || importedName,
2127
});
2228
break;
2329
}
2430
case "ImportNamespaceSpecifier":
2531
case "ImportDefaultSpecifier": {
2632
if (specifier.local) {
27-
importSpecifiers.add({ localName: specifier.local.name });
33+
const localName = specifier.local.name;
34+
if (typeof localName !== "string") {
35+
throw new Error(
36+
"Please report your use case on https://github.com/aws/aws-sdk-js-codemod"
37+
);
38+
}
39+
importSpecifiers.add({ localName });
2840
}
2941
break;
3042
}

src/transforms/v2-to-v3/modules/importModule/removeImport.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export const removeImport = (j: JSCodeshift, source: Collection<unknown>) =>
2222
if (!localName) {
2323
return true;
2424
}
25+
if (typeof localName !== "string") {
26+
throw new Error(
27+
"Please report your use case on https://github.com/aws/aws-sdk-js-codemod"
28+
);
29+
}
2530
const identifiers = source.find(j.Identifier, { name: localName });
2631
const importedName = specifier.type === "ImportSpecifier" && specifier.imported?.name;
2732

src/transforms/v2-to-v3/modules/importSpecifierCompareFn.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,42 @@ export const importSpecifierCompareFn = (
99
specifier2: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier
1010
) => {
1111
if (specifier1.type === "ImportSpecifier" && specifier2.type === "ImportSpecifier") {
12-
return specifier1.imported.name.localeCompare(specifier2.imported.name);
12+
const specifier1ImportedName = specifier1.imported.name;
13+
const specifier2ImportedName = specifier2.imported.name;
14+
if (typeof specifier1ImportedName !== "string" || typeof specifier2ImportedName !== "string") {
15+
throw new Error("Please report your use case on https://github.com/aws/aws-sdk-js-codemod");
16+
}
17+
return specifier1ImportedName.localeCompare(specifier2ImportedName);
1318
}
1419

1520
if (
1621
specifier1.type === "ImportDefaultSpecifier" &&
1722
specifier2.type === "ImportDefaultSpecifier"
1823
) {
19-
if (specifier1.local && specifier2.local)
20-
return specifier1.local.name.localeCompare(specifier2.local.name);
21-
return 0;
24+
if (!specifier1.local || !specifier2.local) {
25+
return 0;
26+
}
27+
const specifier1LocalName = specifier1.local.name;
28+
const specifier2LocalName = specifier2.local.name;
29+
if (typeof specifier1LocalName !== "string" || typeof specifier2LocalName !== "string") {
30+
throw new Error("Please report your use case on https://github.com/aws/aws-sdk-js-codemod");
31+
}
32+
return specifier1LocalName.localeCompare(specifier2LocalName);
2233
}
2334

2435
if (
2536
specifier1.type === "ImportNamespaceSpecifier" &&
2637
specifier2.type === "ImportNamespaceSpecifier"
2738
) {
28-
if (specifier1.local && specifier2.local)
29-
return specifier1.local.name.localeCompare(specifier2.local.name);
30-
return 0;
39+
if (!specifier1.local || !specifier2.local) {
40+
return 0;
41+
}
42+
const specifier1LocalName = specifier1.local.name;
43+
const specifier2LocalName = specifier2.local.name;
44+
if (typeof specifier1LocalName !== "string" || typeof specifier2LocalName !== "string") {
45+
throw new Error("Please report your use case on https://github.com/aws/aws-sdk-js-codemod");
46+
}
47+
return specifier1LocalName.localeCompare(specifier2LocalName);
3148
}
3249

3350
return 0;

src/transforms/v2-to-v3/modules/objectPatternPropertyCompareFn.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {
22
ObjectProperty,
33
Property,
44
PropertyPattern,
5+
RestElement,
56
RestProperty,
67
SpreadProperty,
78
SpreadPropertyPattern,
@@ -13,6 +14,7 @@ export type ObjectPatternProperty =
1314
| SpreadPropertyPattern
1415
| SpreadProperty
1516
| ObjectProperty
17+
| RestElement
1618
| RestProperty;
1719

1820
export const objectPatternPropertyCompareFn = (

yarn.lock

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,13 +1083,13 @@ __metadata:
10831083
languageName: node
10841084
linkType: hard
10851085

1086-
"@types/jscodeshift@npm:^0.12.0":
1087-
version: 0.12.0
1088-
resolution: "@types/jscodeshift@npm:0.12.0"
1086+
"@types/jscodeshift@npm:^17.3.0":
1087+
version: 17.3.0
1088+
resolution: "@types/jscodeshift@npm:17.3.0"
10891089
dependencies:
1090-
ast-types: "npm:^0.14.1"
1091-
recast: "npm:^0.20.3"
1092-
checksum: 10c0/18dea1a12f47daa35063c872a255a7239125187b172ce66639c326bd4b6a500fc8b44a98ec3a8e3fc502786658874a6b35850ac9f4effd9b9aacd1602b033feb
1090+
ast-types: "npm:^0.16.1"
1091+
recast: "npm:^0.23.11"
1092+
checksum: 10c0/56b889b290f12322b43d74c7434b69cef3e1ca8444e37891e08585f716b1c23f44596f650fb92220a8c6e5776d3dbc7d8ece67e950b6f9e733eee8e712128c73
10931093
languageName: node
10941094
linkType: hard
10951095

@@ -1176,15 +1176,6 @@ __metadata:
11761176
languageName: node
11771177
linkType: hard
11781178

1179-
"ast-types@npm:0.14.2, ast-types@npm:^0.14.1":
1180-
version: 0.14.2
1181-
resolution: "ast-types@npm:0.14.2"
1182-
dependencies:
1183-
tslib: "npm:^2.0.1"
1184-
checksum: 10c0/5d66d89b6c07fe092087454b6042dbaf81f2882b176db93861e2b986aafe0bce49e1f1ff59aac775d451c1426ad1e967d250e9e3548f5166ea8a3475e66c169d
1185-
languageName: node
1186-
linkType: hard
1187-
11881179
"ast-types@npm:^0.16.1":
11891180
version: 0.16.1
11901181
resolution: "ast-types@npm:0.16.1"
@@ -1210,10 +1201,10 @@ __metadata:
12101201
"@biomejs/biome": "npm:1.9.0"
12111202
"@changesets/cli": "npm:^2.27.1"
12121203
"@tsconfig/node18": "npm:^18.2.4"
1213-
"@types/jscodeshift": "npm:^0.12.0"
1204+
"@types/jscodeshift": "npm:^17.3.0"
12141205
"@types/node": "npm:^18.19.112"
12151206
aws-sdk: "npm:2.1692.0"
1216-
jscodeshift: "npm:17.1.1"
1207+
jscodeshift: "npm:17.3.0"
12171208
tsx: "npm:^4.7.1"
12181209
typescript: "npm:~5.8.3"
12191210
bin:
@@ -2273,9 +2264,9 @@ __metadata:
22732264
languageName: node
22742265
linkType: hard
22752266

2276-
"jscodeshift@npm:17.1.1":
2277-
version: 17.1.1
2278-
resolution: "jscodeshift@npm:17.1.1"
2267+
"jscodeshift@npm:17.3.0":
2268+
version: 17.3.0
2269+
resolution: "jscodeshift@npm:17.3.0"
22792270
dependencies:
22802271
"@babel/core": "npm:^7.24.7"
22812272
"@babel/parser": "npm:^7.24.7"
@@ -2292,7 +2283,7 @@ __metadata:
22922283
micromatch: "npm:^4.0.7"
22932284
neo-async: "npm:^2.5.0"
22942285
picocolors: "npm:^1.0.1"
2295-
recast: "npm:^0.23.9"
2286+
recast: "npm:^0.23.11"
22962287
tmp: "npm:^0.2.3"
22972288
write-file-atomic: "npm:^5.0.1"
22982289
peerDependencies:
@@ -2302,7 +2293,7 @@ __metadata:
23022293
optional: true
23032294
bin:
23042295
jscodeshift: bin/jscodeshift.js
2305-
checksum: 10c0/bd41e86e6cb6cd7dedb9a5b34740d1a44356e77c22fe70bd6ea20beb5bb4075c8bb2a372ba3d20a798931d678576895ec026f47b368677e0d2a29c5b5e6307bd
2296+
checksum: 10c0/366e3c8ec52597a00919c6eb37007b6bcde0037722b89bda0a4416aec36e34717a7c46d10b3e637ac0a2cf91b986e868063fd1e99a943699ac292f7aef78e3ba
23062297
languageName: node
23072298
linkType: hard
23082299

@@ -2834,19 +2825,7 @@ __metadata:
28342825
languageName: node
28352826
linkType: hard
28362827

2837-
"recast@npm:^0.20.3":
2838-
version: 0.20.5
2839-
resolution: "recast@npm:0.20.5"
2840-
dependencies:
2841-
ast-types: "npm:0.14.2"
2842-
esprima: "npm:~4.0.0"
2843-
source-map: "npm:~0.6.1"
2844-
tslib: "npm:^2.0.1"
2845-
checksum: 10c0/7810216ff36c7376eddd66d3ce6b2df421305fdc983f2122711837911712177d52d804419655e1f29d4bb93016c178cffe442af410bdcf726050ca19af6fed32
2846-
languageName: node
2847-
linkType: hard
2848-
2849-
"recast@npm:^0.23.9":
2828+
"recast@npm:^0.23.11":
28502829
version: 0.23.11
28512830
resolution: "recast@npm:0.23.11"
28522831
dependencies:

0 commit comments

Comments
 (0)