@nx/devkit 20.4.0-canary.20250124-45847a6 → 20.4.0-canary.20250125-15fc599
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/devkit",
|
3
|
-
"version": "20.4.0-canary.
|
3
|
+
"version": "20.4.0-canary.20250125-15fc599",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -2,5 +2,6 @@ export interface AsyncPushCallbacks<T> {
|
|
2
2
|
next: (value: T) => void;
|
3
3
|
done: () => void;
|
4
4
|
error: (err: unknown) => void;
|
5
|
+
registerCleanup?: (cb: () => void | Promise<void>) => void;
|
5
6
|
}
|
6
7
|
export declare function createAsyncIterable<T = unknown>(listener: (ls: AsyncPushCallbacks<T>) => void): AsyncIterable<T>;
|
@@ -4,6 +4,7 @@ exports.createAsyncIterable = createAsyncIterable;
|
|
4
4
|
function createAsyncIterable(listener) {
|
5
5
|
let done = false;
|
6
6
|
let error = null;
|
7
|
+
let cleanup;
|
7
8
|
const pushQueue = [];
|
8
9
|
const pullQueue = [];
|
9
10
|
return {
|
@@ -33,6 +34,9 @@ function createAsyncIterable(listener) {
|
|
33
34
|
}
|
34
35
|
done = true;
|
35
36
|
},
|
37
|
+
registerCleanup: (cb) => {
|
38
|
+
cleanup = cb;
|
39
|
+
},
|
36
40
|
});
|
37
41
|
return {
|
38
42
|
next() {
|
@@ -51,6 +55,12 @@ function createAsyncIterable(listener) {
|
|
51
55
|
}
|
52
56
|
});
|
53
57
|
},
|
58
|
+
async return() {
|
59
|
+
if (cleanup) {
|
60
|
+
await cleanup();
|
61
|
+
}
|
62
|
+
return { value: undefined, done: true };
|
63
|
+
},
|
54
64
|
};
|
55
65
|
},
|
56
66
|
};
|