@kubb/ast 5.3.19 → 5.4.1

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 CHANGED
@@ -1328,8 +1328,12 @@ function createPrinter(build) {
1328
1328
  ...nodes,
1329
1329
  ...overrides
1330
1330
  } : nodes;
1331
+ const collectedImports = [];
1331
1332
  const context = {
1332
1333
  options: resolvedOptions,
1334
+ import: (node) => {
1335
+ collectedImports.push(node);
1336
+ },
1333
1337
  transform: (node) => {
1334
1338
  const handler = merged[node.type];
1335
1339
  if (!handler) return null;
@@ -1345,7 +1349,8 @@ function createPrinter(build) {
1345
1349
  name,
1346
1350
  options: resolvedOptions,
1347
1351
  transform: context.transform,
1348
- print: printOverride ? printOverride.bind(context) : context.transform
1352
+ print: printOverride ? printOverride.bind(context) : context.transform,
1353
+ drainImports: () => collectedImports.splice(0)
1349
1354
  };
1350
1355
  };
1351
1356
  }