@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
|
@@ -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
|
-
|
|
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
|
-
|
|
3243
|
-
|
|
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)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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