Skip to content

Commit c6ef519

Browse files
authored
fix: avoid self referencing import for external build transforms (#1453)
1 parent 49958f2 commit c6ef519

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.changeset/sweet-horses-impress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/core": patch
3+
---
4+
5+
avoid self referencing submodule import

packages/core/scripts/lint.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ const walk = require("../../../scripts/utils/walk");
110110
);
111111
}
112112
}
113+
114+
const subModuleImports = [
115+
...new Set(
116+
(sourceCode.toString().match(/(from |import\()"\@smithy\/core\/(.*?)";/g) || []).map(
117+
(_) => _.match(/@smithy\/core\/(.*?)"/)[1]
118+
)
119+
),
120+
];
121+
const ownModule = item.match(/src\/submodules\/(.*?)\//)?.[1];
122+
123+
if (subModuleImports.includes(ownModule)) {
124+
errors.push(`self-referencing submodule import found in ${item}`);
125+
}
113126
}
114127
})().then(() => {
115128
if (errors.length) {

packages/core/src/submodules/protocols/requestBuilder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { resolvedPath } from "@smithy/core/protocols";
21
import { HttpRequest } from "@smithy/protocol-http";
32
import type { SerdeContext } from "@smithy/types";
43

4+
import { resolvedPath } from "./resolve-path";
5+
56
/**
67
* @internal
78
* used in code-generated serde.

0 commit comments

Comments
 (0)