@rushstack/node-core-library
Advanced tools
Comparing version 3.42.1 to 3.42.2
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "3.42.2", | ||
"tag": "@rushstack/node-core-library_v3.42.2", | ||
"date": "Fri, 08 Oct 2021 08:08:34 GMT", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "Fix an issue where Async.foreEachAsync can never resolve when operating on a large array." | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "3.42.1", | ||
@@ -7,0 +19,0 @@ "tag": "@rushstack/node-core-library_v3.42.1", |
# Change Log - @rushstack/node-core-library | ||
This log was last generated on Thu, 07 Oct 2021 07:13:35 GMT and should not be manually modified. | ||
This log was last generated on Fri, 08 Oct 2021 08:08:34 GMT and should not be manually modified. | ||
## 3.42.2 | ||
Fri, 08 Oct 2021 08:08:34 GMT | ||
### Patches | ||
- Fix an issue where Async.foreEachAsync can never resolve when operating on a large array. | ||
## 3.42.1 | ||
@@ -6,0 +13,0 @@ Thu, 07 Oct 2021 07:13:35 GMT |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.18.9" | ||
"packageVersion": "7.18.14" | ||
} | ||
] | ||
} |
@@ -58,40 +58,47 @@ "use strict"; | ||
static async forEachAsync(iterable, callback, options) { | ||
const concurrency = (options === null || options === void 0 ? void 0 : options.concurrency) && options.concurrency > 0 ? options.concurrency : Infinity; | ||
let operationsInProgress = 1; | ||
const iterator = (iterable[Symbol.iterator] || | ||
iterable[Symbol.asyncIterator]).call(iterable); | ||
let arrayIndex = 0; | ||
let iteratorIsDone = false; | ||
await new Promise((resolve, reject) => { | ||
async function onOperationCompletionAsync() { | ||
operationsInProgress--; | ||
if (operationsInProgress === 0 && iteratorIsDone) { | ||
resolve(); | ||
} | ||
while (operationsInProgress < concurrency) { | ||
const nextIteratorResult = await iterator.next(); | ||
const concurrency = (options === null || options === void 0 ? void 0 : options.concurrency) && options.concurrency > 0 ? options.concurrency : Infinity; | ||
let operationsInProgress = 0; | ||
const iterator = (iterable[Symbol.iterator] || | ||
iterable[Symbol.asyncIterator]).call(iterable); | ||
let arrayIndex = 0; | ||
let iteratorIsComplete = false; | ||
let promiseHasResolvedOrRejected = false; | ||
async function queueOperationsAsync() { | ||
while (operationsInProgress < concurrency && !iteratorIsComplete && !promiseHasResolvedOrRejected) { | ||
const currentIteratorResult = await iterator.next(); | ||
// eslint-disable-next-line require-atomic-updates | ||
iteratorIsDone = !!nextIteratorResult.done; | ||
if (!iteratorIsDone) { | ||
iteratorIsComplete = !!currentIteratorResult.done; | ||
if (!iteratorIsComplete) { | ||
operationsInProgress++; | ||
try { | ||
Promise.resolve(callback(nextIteratorResult.value, arrayIndex++)) | ||
.then(() => onOperationCompletionAsync()) | ||
.catch(reject); | ||
} | ||
catch (error) { | ||
Promise.resolve(callback(currentIteratorResult.value, arrayIndex++)) | ||
.then(async () => { | ||
operationsInProgress--; | ||
await onOperationCompletionAsync(); | ||
}) | ||
.catch((error) => { | ||
promiseHasResolvedOrRejected = true; | ||
reject(error); | ||
} | ||
}); | ||
} | ||
else { | ||
if (arrayIndex === 0) { | ||
// If arrayIndex was never incremented and the iterator is done, we were handed an empty iterator | ||
// and we should resolve | ||
resolve(); | ||
} | ||
break; | ||
} | ||
if (iteratorIsComplete) { | ||
await onOperationCompletionAsync(); | ||
} | ||
} | ||
async function onOperationCompletionAsync() { | ||
if (!promiseHasResolvedOrRejected) { | ||
if (operationsInProgress === 0 && iteratorIsComplete) { | ||
promiseHasResolvedOrRejected = true; | ||
resolve(); | ||
} | ||
else if (!iteratorIsComplete) { | ||
await queueOperationsAsync(); | ||
} | ||
} | ||
} | ||
onOperationCompletionAsync().catch(reject); | ||
queueOperationsAsync().catch((error) => { | ||
promiseHasResolvedOrRejected = true; | ||
reject(error); | ||
}); | ||
}); | ||
@@ -98,0 +105,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -5,2 +5,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypeUuid = exports.StringBufferTerminalProvider = exports.ConsoleTerminalProvider = exports.TerminalProviderSeverity = exports.TextAttribute = exports.ColorValue = exports.Colors = exports.Terminal = exports.StringBuilder = exports.LegacyAdapters = exports.FileWriter = exports.FileSystem = exports.Sort = exports.Text = exports.Path = exports.PackageNameParser = exports.PackageName = exports.PackageJsonLookup = exports.ProtectableMap = exports.MapExtensions = exports.LockFile = exports.JsonSchema = exports.JsonFile = exports.InternalError = exports.Import = exports.Executable = exports.EnvironmentMap = exports.Enum = exports.Async = exports.AnsiEscape = exports.AlreadyReportedError = void 0; | ||
/** | ||
@@ -7,0 +8,0 @@ * Core libraries that every NodeJS toolchain project should use. |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -95,3 +95,3 @@ return result; | ||
if (LegacyAdapters._useTimsort) { | ||
timsort_1.sort(array, compare); | ||
(0, timsort_1.sort)(array, compare); | ||
} | ||
@@ -98,0 +98,0 @@ else { |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
@@ -19,3 +19,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -22,0 +22,0 @@ return result; |
{ | ||
"name": "@rushstack/node-core-library", | ||
"version": "3.42.1", | ||
"version": "3.42.2", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -24,4 +24,4 @@ "main": "lib/index.js", | ||
"@rushstack/eslint-config": "2.4.2", | ||
"@rushstack/heft": "0.38.1", | ||
"@rushstack/heft-node-rig": "1.2.13", | ||
"@rushstack/heft": "0.41.3", | ||
"@rushstack/heft-node-rig": "1.2.22", | ||
"@types/fs-extra": "7.0.0", | ||
@@ -28,0 +28,0 @@ "@types/heft-jest": "1.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1008673
14031