@ms-cloudpack/cli 0.77.0 → 0.77.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoDisposableList.d.ts","sourceRoot":"","sources":["../../src/utilities/AutoDisposableList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"AutoDisposableList.d.ts","sourceRoot":"","sources":["../../src/utilities/AutoDisposableList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyB;IAE9C,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAK/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAqBtC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export class AutoDisposableList {
|
|
2
|
-
disposables =
|
|
2
|
+
disposables = new Set();
|
|
3
3
|
add(item) {
|
|
4
|
-
this.disposables.
|
|
4
|
+
this.disposables.add(item);
|
|
5
5
|
return item;
|
|
6
6
|
}
|
|
7
7
|
async dispose() {
|
|
8
8
|
let errorCount = 0;
|
|
9
|
-
|
|
9
|
+
const disposables = Array.from(this.disposables);
|
|
10
|
+
await Promise.all(disposables.map(async (d) => {
|
|
10
11
|
try {
|
|
11
12
|
await d.dispose?.();
|
|
12
13
|
}
|
|
@@ -15,6 +16,8 @@ export class AutoDisposableList {
|
|
|
15
16
|
errorCount++;
|
|
16
17
|
}
|
|
17
18
|
}));
|
|
19
|
+
// Clear the set after attempting to dispose all items
|
|
20
|
+
this.disposables.clear();
|
|
18
21
|
if (errorCount) {
|
|
19
22
|
throw new Error(`Failed to dispose ${errorCount} disposable(s)`);
|
|
20
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoDisposableList.js","sourceRoot":"","sources":["../../src/utilities/AutoDisposableList.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"AutoDisposableList.js","sourceRoot":"","sources":["../../src/utilities/AutoDisposableList.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IACZ,WAAW,GAAG,IAAI,GAAG,EAAc,CAAC;IAE9C,GAAG,CAAuB,IAAO;QACtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YAC1B,IAAI,CAAC;gBACH,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YACtB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,sBAAuB,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;gBACnE,UAAU,EAAE,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QAEF,sDAAsD;QACtD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAEzB,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,qBAAqB,UAAU,gBAAgB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { Disposable } from '../types/Disposable.js';\n\nexport class AutoDisposableList {\n private readonly disposables = new Set<Disposable>();\n\n public add<T extends Disposable>(item: T): T {\n this.disposables.add(item);\n return item;\n }\n\n public async dispose(): Promise<void> {\n let errorCount = 0;\n const disposables = Array.from(this.disposables);\n await Promise.all(\n disposables.map(async (d) => {\n try {\n await d.dispose?.();\n } catch (err) {\n console.error(`Failed to dispose: ${(err as Error).stack || err}`);\n errorCount++;\n }\n }),\n );\n\n // Clear the set after attempting to dispose all items\n this.disposables.clear();\n\n if (errorCount) {\n throw new Error(`Failed to dispose ${errorCount} disposable(s)`);\n }\n }\n}\n"]}
|
package/package.json
CHANGED