@openpkg-ts/extract 0.24.1 → 0.25.0

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/bin/tspec.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  detectTsRuntime,
4
4
  extract,
5
5
  resolveCompiledPath
6
- } from "../shared/chunk-2fes3xf8.js";
6
+ } from "../shared/chunk-2zvzqxtn.js";
7
7
 
8
8
  // src/cli/spec.ts
9
9
  import * as fs from "node:fs";
@@ -3112,6 +3112,7 @@ function clearTypeDefinitionCache() {
3112
3112
  typeDefinitionCache = null;
3113
3113
  internalTagCache = null;
3114
3114
  }
3115
+ var YIELD_BATCH_SIZE = 5;
3115
3116
  var BUILTIN_TYPES2 = new Set([
3116
3117
  "Array",
3117
3118
  "ArrayBuffer",
@@ -3206,7 +3207,8 @@ async function extract(options) {
3206
3207
  resolveExternalTypes,
3207
3208
  includeSchema,
3208
3209
  only,
3209
- ignore
3210
+ ignore,
3211
+ onProgress
3210
3212
  } = options;
3211
3213
  const diagnostics = [];
3212
3214
  let exports = [];
@@ -3237,10 +3239,15 @@ async function extract(options) {
3237
3239
  resolveExternalTypes
3238
3240
  });
3239
3241
  ctx.exportedIds = exportedIds;
3240
- for (const symbol of exportedSymbols) {
3242
+ const filteredSymbols = exportedSymbols.filter((s) => shouldIncludeExport(s.getName(), only, ignore));
3243
+ const total = filteredSymbols.length;
3244
+ for (let i = 0;i < filteredSymbols.length; i++) {
3245
+ const symbol = filteredSymbols[i];
3241
3246
  const exportName = symbol.getName();
3242
- if (!shouldIncludeExport(exportName, only, ignore))
3243
- continue;
3247
+ onProgress?.(i + 1, total, exportName);
3248
+ if (i > 0 && i % YIELD_BATCH_SIZE === 0) {
3249
+ await new Promise((r) => setImmediate(r));
3250
+ }
3244
3251
  try {
3245
3252
  const { declaration, targetSymbol } = resolveExportTarget(symbol, typeChecker);
3246
3253
  if (!declaration)
@@ -237,6 +237,8 @@ interface ExtractOptions {
237
237
  only?: string[];
238
238
  /** Ignore these exports (supports * wildcards) */
239
239
  ignore?: string[];
240
+ /** Progress callback for tracking extraction progress */
241
+ onProgress?: (current: number, total: number, item: string) => void;
240
242
  }
241
243
  interface ExtractResult {
242
244
  spec: OpenPkg;
package/dist/src/index.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  valibotAdapter,
49
49
  withDescription,
50
50
  zodAdapter
51
- } from "../shared/chunk-2fes3xf8.js";
51
+ } from "../shared/chunk-2zvzqxtn.js";
52
52
  // src/types/utils.ts
53
53
  function isExported(node) {
54
54
  const modifiers = node.modifiers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/extract",
3
- "version": "0.24.1",
3
+ "version": "0.25.0",
4
4
  "description": "TypeScript export extraction to OpenPkg spec",
5
5
  "keywords": [
6
6
  "openpkg",