@kubb/ast 5.0.0-beta.27 → 5.0.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils.ts +12 -1
package/dist/index.js
CHANGED
|
@@ -1190,6 +1190,11 @@ function combineImports(imports, exports, source) {
|
|
|
1190
1190
|
if (!importNameMemo.has(key)) importNameMemo.set(key, n);
|
|
1191
1191
|
return importNameMemo.get(key);
|
|
1192
1192
|
};
|
|
1193
|
+
const pathsWithUsedNamedImport = /* @__PURE__ */ new Set();
|
|
1194
|
+
for (const node of imports) {
|
|
1195
|
+
if (!Array.isArray(node.name)) continue;
|
|
1196
|
+
if (node.name.some((item) => typeof item === "string" ? isUsed(item) : isUsed(item.name ?? item.propertyName))) pathsWithUsedNamedImport.add(node.path);
|
|
1197
|
+
}
|
|
1193
1198
|
const result = [];
|
|
1194
1199
|
const namedByPath = /* @__PURE__ */ new Map();
|
|
1195
1200
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1220,7 +1225,7 @@ function combineImports(imports, exports, source) {
|
|
|
1220
1225
|
namedByPath.set(key, newItem);
|
|
1221
1226
|
}
|
|
1222
1227
|
} else {
|
|
1223
|
-
if (name && !isUsed(name)) continue;
|
|
1228
|
+
if (name && !isUsed(name) && !pathsWithUsedNamedImport.has(path)) continue;
|
|
1224
1229
|
const key = importKey(path, name, isTypeOnly);
|
|
1225
1230
|
if (!seen.has(key)) {
|
|
1226
1231
|
result.push(curr);
|