@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.cjs
CHANGED
|
@@ -1213,6 +1213,11 @@ function combineImports(imports, exports, source) {
|
|
|
1213
1213
|
if (!importNameMemo.has(key)) importNameMemo.set(key, n);
|
|
1214
1214
|
return importNameMemo.get(key);
|
|
1215
1215
|
};
|
|
1216
|
+
const pathsWithUsedNamedImport = /* @__PURE__ */ new Set();
|
|
1217
|
+
for (const node of imports) {
|
|
1218
|
+
if (!Array.isArray(node.name)) continue;
|
|
1219
|
+
if (node.name.some((item) => typeof item === "string" ? isUsed(item) : isUsed(item.name ?? item.propertyName))) pathsWithUsedNamedImport.add(node.path);
|
|
1220
|
+
}
|
|
1216
1221
|
const result = [];
|
|
1217
1222
|
const namedByPath = /* @__PURE__ */ new Map();
|
|
1218
1223
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1243,7 +1248,7 @@ function combineImports(imports, exports, source) {
|
|
|
1243
1248
|
namedByPath.set(key, newItem);
|
|
1244
1249
|
}
|
|
1245
1250
|
} else {
|
|
1246
|
-
if (name && !isUsed(name)) continue;
|
|
1251
|
+
if (name && !isUsed(name) && !pathsWithUsedNamedImport.has(path)) continue;
|
|
1247
1252
|
const key = importKey(path, name, isTypeOnly);
|
|
1248
1253
|
if (!seen.has(key)) {
|
|
1249
1254
|
result.push(curr);
|