async-later
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -1,553 +0,5 @@ | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __require = typeof require !== "undefined" ? require : (x) => { | ||
throw new Error('Dynamic require of "' + x + '" is not supported'); | ||
}; | ||
var __esm = (fn, res) => function __init() { | ||
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res; | ||
}; | ||
var __commonJS = (cb, mod) => function __require2() { | ||
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var __reExport = (target, module, desc) => { | ||
if (module && typeof module === "object" || typeof module === "function") { | ||
for (let key of __getOwnPropNames(module)) | ||
if (!__hasOwnProp.call(target, key) && key !== "default") | ||
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
}; | ||
var __toModule = (module) => { | ||
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module); | ||
}; | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/typeof.js | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function _typeof2(obj2) { | ||
return typeof obj2; | ||
}; | ||
} else { | ||
_typeof = function _typeof2(obj2) { | ||
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
var init_typeof = __esm({ | ||
"../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/typeof.js"() { | ||
} | ||
}); | ||
// ../../common/temp/node_modules/.pnpm/regenerator-runtime@0.13.9/node_modules/regenerator-runtime/runtime.js | ||
var require_runtime = __commonJS({ | ||
"../../common/temp/node_modules/.pnpm/regenerator-runtime@0.13.9/node_modules/regenerator-runtime/runtime.js"(exports, module) { | ||
init_typeof(); | ||
var runtime = function(exports2) { | ||
"use strict"; | ||
var Op = Object.prototype; | ||
var hasOwn = Op.hasOwnProperty; | ||
var undefined2; | ||
var $Symbol = typeof Symbol === "function" ? Symbol : {}; | ||
var iteratorSymbol = $Symbol.iterator || "@@iterator"; | ||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; | ||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; | ||
function define(obj, key, value) { | ||
Object.defineProperty(obj, key, { | ||
value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
return obj[key]; | ||
} | ||
try { | ||
define({}, ""); | ||
} catch (err) { | ||
define = function define2(obj, key, value) { | ||
return obj[key] = value; | ||
}; | ||
} | ||
function wrap(innerFn, outerFn, self, tryLocsList) { | ||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; | ||
var generator = Object.create(protoGenerator.prototype); | ||
var context = new Context(tryLocsList || []); | ||
generator._invoke = makeInvokeMethod(innerFn, self, context); | ||
return generator; | ||
} | ||
exports2.wrap = wrap; | ||
function tryCatch(fn, obj, arg) { | ||
try { | ||
return { | ||
type: "normal", | ||
arg: fn.call(obj, arg) | ||
}; | ||
} catch (err) { | ||
return { | ||
type: "throw", | ||
arg: err | ||
}; | ||
} | ||
} | ||
var GenStateSuspendedStart = "suspendedStart"; | ||
var GenStateSuspendedYield = "suspendedYield"; | ||
var GenStateExecuting = "executing"; | ||
var GenStateCompleted = "completed"; | ||
var ContinueSentinel = {}; | ||
function Generator() { | ||
} | ||
function GeneratorFunction() { | ||
} | ||
function GeneratorFunctionPrototype() { | ||
} | ||
var IteratorPrototype = {}; | ||
define(IteratorPrototype, iteratorSymbol, function() { | ||
return this; | ||
}); | ||
var getProto = Object.getPrototypeOf; | ||
var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); | ||
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { | ||
IteratorPrototype = NativeIteratorPrototype; | ||
} | ||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); | ||
GeneratorFunction.prototype = GeneratorFunctionPrototype; | ||
define(Gp, "constructor", GeneratorFunctionPrototype); | ||
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); | ||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); | ||
function defineIteratorMethods(prototype) { | ||
["next", "throw", "return"].forEach(function(method) { | ||
define(prototype, method, function(arg) { | ||
return this._invoke(method, arg); | ||
}); | ||
}); | ||
} | ||
exports2.isGeneratorFunction = function(genFun) { | ||
var ctor = typeof genFun === "function" && genFun.constructor; | ||
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; | ||
}; | ||
exports2.mark = function(genFun) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); | ||
} else { | ||
genFun.__proto__ = GeneratorFunctionPrototype; | ||
define(genFun, toStringTagSymbol, "GeneratorFunction"); | ||
} | ||
genFun.prototype = Object.create(Gp); | ||
return genFun; | ||
}; | ||
exports2.awrap = function(arg) { | ||
return { | ||
__await: arg | ||
}; | ||
}; | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
var record = tryCatch(generator[method], generator, arg); | ||
if (record.type === "throw") { | ||
reject(record.arg); | ||
} else { | ||
var result = record.arg; | ||
var value = result.value; | ||
if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { | ||
return PromiseImpl.resolve(value.__await).then(function(value2) { | ||
invoke("next", value2, resolve, reject); | ||
}, function(err) { | ||
invoke("throw", err, resolve, reject); | ||
}); | ||
} | ||
return PromiseImpl.resolve(value).then(function(unwrapped) { | ||
result.value = unwrapped; | ||
resolve(result); | ||
}, function(error) { | ||
return invoke("throw", error, resolve, reject); | ||
}); | ||
} | ||
} | ||
var previousPromise; | ||
function enqueue(method, arg) { | ||
function callInvokeWithMethodAndArg() { | ||
return new PromiseImpl(function(resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
}); | ||
} | ||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); | ||
} | ||
this._invoke = enqueue; | ||
} | ||
defineIteratorMethods(AsyncIterator.prototype); | ||
define(AsyncIterator.prototype, asyncIteratorSymbol, function() { | ||
return this; | ||
}); | ||
exports2.AsyncIterator = AsyncIterator; | ||
exports2.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) | ||
PromiseImpl = Promise; | ||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); | ||
return exports2.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { | ||
return result.done ? result.value : iter.next(); | ||
}); | ||
}; | ||
function makeInvokeMethod(innerFn, self, context) { | ||
var state = GenStateSuspendedStart; | ||
return function invoke(method, arg) { | ||
if (state === GenStateExecuting) { | ||
throw new Error("Generator is already running"); | ||
} | ||
if (state === GenStateCompleted) { | ||
if (method === "throw") { | ||
throw arg; | ||
} | ||
return doneResult(); | ||
} | ||
context.method = method; | ||
context.arg = arg; | ||
while (true) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
var delegateResult = maybeInvokeDelegate(delegate, context); | ||
if (delegateResult) { | ||
if (delegateResult === ContinueSentinel) | ||
continue; | ||
return delegateResult; | ||
} | ||
} | ||
if (context.method === "next") { | ||
context.sent = context._sent = context.arg; | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw context.arg; | ||
} | ||
context.dispatchException(context.arg); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
} | ||
state = GenStateExecuting; | ||
var record = tryCatch(innerFn, self, context); | ||
if (record.type === "normal") { | ||
state = context.done ? GenStateCompleted : GenStateSuspendedYield; | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
} | ||
return { | ||
value: record.arg, | ||
done: context.done | ||
}; | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
} | ||
} | ||
}; | ||
} | ||
function maybeInvokeDelegate(delegate, context) { | ||
var method = delegate.iterator[context.method]; | ||
if (method === undefined2) { | ||
context.delegate = null; | ||
if (context.method === "throw") { | ||
if (delegate.iterator["return"]) { | ||
context.method = "return"; | ||
context.arg = undefined2; | ||
maybeInvokeDelegate(delegate, context); | ||
if (context.method === "throw") { | ||
return ContinueSentinel; | ||
} | ||
} | ||
context.method = "throw"; | ||
context.arg = new TypeError("The iterator does not provide a 'throw' method"); | ||
} | ||
return ContinueSentinel; | ||
} | ||
var record = tryCatch(method, delegate.iterator, context.arg); | ||
if (record.type === "throw") { | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
var info = record.arg; | ||
if (!info) { | ||
context.method = "throw"; | ||
context.arg = new TypeError("iterator result is not an object"); | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
if (info.done) { | ||
context[delegate.resultName] = info.value; | ||
context.next = delegate.nextLoc; | ||
if (context.method !== "return") { | ||
context.method = "next"; | ||
context.arg = undefined2; | ||
} | ||
} else { | ||
return info; | ||
} | ||
context.delegate = null; | ||
return ContinueSentinel; | ||
} | ||
defineIteratorMethods(Gp); | ||
define(Gp, toStringTagSymbol, "Generator"); | ||
define(Gp, iteratorSymbol, function() { | ||
return this; | ||
}); | ||
define(Gp, "toString", function() { | ||
return "[object Generator]"; | ||
}); | ||
function pushTryEntry(locs) { | ||
var entry = { | ||
tryLoc: locs[0] | ||
}; | ||
if (1 in locs) { | ||
entry.catchLoc = locs[1]; | ||
} | ||
if (2 in locs) { | ||
entry.finallyLoc = locs[2]; | ||
entry.afterLoc = locs[3]; | ||
} | ||
this.tryEntries.push(entry); | ||
} | ||
function resetTryEntry(entry) { | ||
var record = entry.completion || {}; | ||
record.type = "normal"; | ||
delete record.arg; | ||
entry.completion = record; | ||
} | ||
function Context(tryLocsList) { | ||
this.tryEntries = [{ | ||
tryLoc: "root" | ||
}]; | ||
tryLocsList.forEach(pushTryEntry, this); | ||
this.reset(true); | ||
} | ||
exports2.keys = function(object) { | ||
var keys = []; | ||
for (var key in object) { | ||
keys.push(key); | ||
} | ||
keys.reverse(); | ||
return function next() { | ||
while (keys.length) { | ||
var key2 = keys.pop(); | ||
if (key2 in object) { | ||
next.value = key2; | ||
next.done = false; | ||
return next; | ||
} | ||
} | ||
next.done = true; | ||
return next; | ||
}; | ||
}; | ||
function values(iterable) { | ||
if (iterable) { | ||
var iteratorMethod = iterable[iteratorSymbol]; | ||
if (iteratorMethod) { | ||
return iteratorMethod.call(iterable); | ||
} | ||
if (typeof iterable.next === "function") { | ||
return iterable; | ||
} | ||
if (!isNaN(iterable.length)) { | ||
var i = -1, next = function next2() { | ||
while (++i < iterable.length) { | ||
if (hasOwn.call(iterable, i)) { | ||
next2.value = iterable[i]; | ||
next2.done = false; | ||
return next2; | ||
} | ||
} | ||
next2.value = undefined2; | ||
next2.done = true; | ||
return next2; | ||
}; | ||
return next.next = next; | ||
} | ||
} | ||
return { | ||
next: doneResult | ||
}; | ||
} | ||
exports2.values = values; | ||
function doneResult() { | ||
return { | ||
value: undefined2, | ||
done: true | ||
}; | ||
} | ||
Context.prototype = { | ||
constructor: Context, | ||
reset: function reset(skipTempReset) { | ||
this.prev = 0; | ||
this.next = 0; | ||
this.sent = this._sent = undefined2; | ||
this.done = false; | ||
this.delegate = null; | ||
this.method = "next"; | ||
this.arg = undefined2; | ||
this.tryEntries.forEach(resetTryEntry); | ||
if (!skipTempReset) { | ||
for (var name in this) { | ||
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { | ||
this[name] = undefined2; | ||
} | ||
} | ||
} | ||
}, | ||
stop: function stop() { | ||
this.done = true; | ||
var rootEntry = this.tryEntries[0]; | ||
var rootRecord = rootEntry.completion; | ||
if (rootRecord.type === "throw") { | ||
throw rootRecord.arg; | ||
} | ||
return this.rval; | ||
}, | ||
dispatchException: function dispatchException(exception) { | ||
if (this.done) { | ||
throw exception; | ||
} | ||
var context = this; | ||
function handle(loc, caught) { | ||
record.type = "throw"; | ||
record.arg = exception; | ||
context.next = loc; | ||
if (caught) { | ||
context.method = "next"; | ||
context.arg = undefined2; | ||
} | ||
return !!caught; | ||
} | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
var record = entry.completion; | ||
if (entry.tryLoc === "root") { | ||
return handle("end"); | ||
} | ||
if (entry.tryLoc <= this.prev) { | ||
var hasCatch = hasOwn.call(entry, "catchLoc"); | ||
var hasFinally = hasOwn.call(entry, "finallyLoc"); | ||
if (hasCatch && hasFinally) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} else if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else if (hasCatch) { | ||
if (this.prev < entry.catchLoc) { | ||
return handle(entry.catchLoc, true); | ||
} | ||
} else if (hasFinally) { | ||
if (this.prev < entry.finallyLoc) { | ||
return handle(entry.finallyLoc); | ||
} | ||
} else { | ||
throw new Error("try statement without catch or finally"); | ||
} | ||
} | ||
} | ||
}, | ||
abrupt: function abrupt(type, arg) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { | ||
var finallyEntry = entry; | ||
break; | ||
} | ||
} | ||
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { | ||
finallyEntry = null; | ||
} | ||
var record = finallyEntry ? finallyEntry.completion : {}; | ||
record.type = type; | ||
record.arg = arg; | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
return ContinueSentinel; | ||
} | ||
return this.complete(record); | ||
}, | ||
complete: function complete(record, afterLoc) { | ||
if (record.type === "throw") { | ||
throw record.arg; | ||
} | ||
if (record.type === "break" || record.type === "continue") { | ||
this.next = record.arg; | ||
} else if (record.type === "return") { | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
} else if (record.type === "normal" && afterLoc) { | ||
this.next = afterLoc; | ||
} | ||
return ContinueSentinel; | ||
}, | ||
finish: function finish(finallyLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.finallyLoc === finallyLoc) { | ||
this.complete(entry.completion, entry.afterLoc); | ||
resetTryEntry(entry); | ||
return ContinueSentinel; | ||
} | ||
} | ||
}, | ||
"catch": function _catch(tryLoc) { | ||
for (var i = this.tryEntries.length - 1; i >= 0; --i) { | ||
var entry = this.tryEntries[i]; | ||
if (entry.tryLoc === tryLoc) { | ||
var record = entry.completion; | ||
if (record.type === "throw") { | ||
var thrown = record.arg; | ||
resetTryEntry(entry); | ||
} | ||
return thrown; | ||
} | ||
} | ||
throw new Error("illegal catch attempt"); | ||
}, | ||
delegateYield: function delegateYield(iterable, resultName, nextLoc) { | ||
this.delegate = { | ||
iterator: values(iterable), | ||
resultName, | ||
nextLoc | ||
}; | ||
if (this.method === "next") { | ||
this.arg = undefined2; | ||
} | ||
return ContinueSentinel; | ||
} | ||
}; | ||
return exports2; | ||
}((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" ? module.exports : {}); | ||
try { | ||
regeneratorRuntime = runtime; | ||
} catch (accidentalStrictMode) { | ||
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") { | ||
globalThis.regeneratorRuntime = runtime; | ||
} else { | ||
Function("r", "regeneratorRuntime = r")(runtime); | ||
} | ||
} | ||
} | ||
}); | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/regenerator/index.js | ||
var require_regenerator = __commonJS({ | ||
"../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/regenerator/index.js"(exports, module) { | ||
module.exports = require_runtime(); | ||
} | ||
}); | ||
// src/resolve-later.ts | ||
function resolveLater() { | ||
var resolve; | ||
var promise = new Promise(function(resolveCallback) { | ||
let resolve; | ||
const promise = new Promise((resolveCallback) => { | ||
resolve = resolveCallback; | ||
@@ -560,179 +12,9 @@ }); | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) | ||
return arr; | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) | ||
return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) | ||
break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) | ||
_i["return"](); | ||
} finally { | ||
if (_d) | ||
throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) | ||
len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) | ||
return; | ||
if (typeof o === "string") | ||
return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) | ||
n = o.constructor.name; | ||
if (n === "Map" || n === "Set") | ||
return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/AwaitValue.js | ||
function _AwaitValue(value) { | ||
this.wrapped = value; | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js | ||
function _awaitAsyncGenerator(value) { | ||
return new _AwaitValue(value); | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function(resolve, reject) { | ||
var request = { | ||
key, | ||
arg, | ||
resolve, | ||
reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
var wrappedAwait = value instanceof _AwaitValue; | ||
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function(arg2) { | ||
if (wrappedAwait) { | ||
resume(key === "return" ? "return" : "next", arg2); | ||
return; | ||
} | ||
settle(result.done ? "return" : "normal", arg2); | ||
}, function(err) { | ||
resume("throw", err); | ||
}); | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen["return"] !== "function") { | ||
this["return"] = void 0; | ||
} | ||
} | ||
AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() { | ||
return this; | ||
}; | ||
AsyncGenerator.prototype.next = function(arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype["throw"] = function(arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype["return"] = function(arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js | ||
function _wrapAsyncGenerator(fn) { | ||
return function() { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
} | ||
// src/iterate-later.ts | ||
var import_regenerator = __toModule(require_regenerator()); | ||
function iterateLater() { | ||
var nextInLine = resolveLater(); | ||
var queue = [nextInLine]; | ||
var completed = {}; | ||
var next = function next2(value) { | ||
var _nextInLine = nextInLine, _nextInLine2 = _slicedToArray(_nextInLine, 2), _ = _nextInLine2[0], resolve = _nextInLine2[1]; | ||
let nextInLine = resolveLater(); | ||
const queue = [nextInLine]; | ||
const completed = {}; | ||
const next = (value) => { | ||
const [_, resolve] = nextInLine; | ||
resolve(value); | ||
@@ -742,43 +24,13 @@ nextInLine = resolveLater(); | ||
}; | ||
var iterate = /* @__PURE__ */ function() { | ||
var _ref = _wrapAsyncGenerator(/* @__PURE__ */ import_regenerator.default.mark(function _callee() { | ||
var _globalThis$process, _globalThis$process$e, _ref2, _ref3, nextValue; | ||
return import_regenerator.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!(queue.length > 0)) { | ||
_context.next = 12; | ||
break; | ||
} | ||
_ref2 = queue.pop(), _ref3 = _slicedToArray(_ref2, 1), nextValue = _ref3[0]; | ||
_context.next = 4; | ||
return _awaitAsyncGenerator(nextValue); | ||
case 4: | ||
_context.t0 = _context.sent; | ||
_context.t1 = completed; | ||
if (!(_context.t0 !== _context.t1)) { | ||
_context.next = 9; | ||
break; | ||
} | ||
_context.next = 9; | ||
return nextValue; | ||
case 9: | ||
if (globalThis !== null && globalThis !== void 0 && (_globalThis$process = globalThis.process) !== null && _globalThis$process !== void 0 && (_globalThis$process$e = _globalThis$process.env) !== null && _globalThis$process$e !== void 0 && _globalThis$process$e.VERBOSE) | ||
console.debug("In queue: ".concat(queue.length)); | ||
_context.next = 0; | ||
break; | ||
case 12: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return function iterate2() { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var complete = function complete2() { | ||
var _nextInLine3 = nextInLine, _nextInLine4 = _slicedToArray(_nextInLine3, 2), _ = _nextInLine4[0], resolve = _nextInLine4[1]; | ||
const iterate = async function* () { | ||
while (queue.length > 0) { | ||
const [nextValue] = queue.pop(); | ||
if (await nextValue !== completed) | ||
yield nextValue; | ||
if (globalThis?.process?.env?.VERBOSE) | ||
console.debug(`In queue: ${queue.length}`); | ||
} | ||
}; | ||
const complete = () => { | ||
const [_, resolve] = nextInLine; | ||
resolve(completed); | ||
@@ -790,68 +42,5 @@ }; | ||
// src/to-async-iterable.ts | ||
var import_regenerator2 = __toModule(require_regenerator()); | ||
function _createForOfIteratorHelper(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (!it) { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray2(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) | ||
o = it; | ||
var i = 0; | ||
var F = function F2() { | ||
}; | ||
return { s: F, n: function n() { | ||
if (i >= o.length) | ||
return { done: true }; | ||
return { done: false, value: o[i++] }; | ||
}, e: function e(_e) { | ||
throw _e; | ||
}, f: F }; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var normalCompletion = true, didErr = false, err; | ||
return { s: function s() { | ||
it = it.call(o); | ||
}, n: function n() { | ||
var step = it.next(); | ||
normalCompletion = step.done; | ||
return step; | ||
}, e: function e(_e2) { | ||
didErr = true; | ||
err = _e2; | ||
}, f: function f() { | ||
try { | ||
if (!normalCompletion && it["return"] != null) | ||
it["return"](); | ||
} finally { | ||
if (didErr) | ||
throw err; | ||
} | ||
} }; | ||
} | ||
function _unsupportedIterableToArray2(o, minLen) { | ||
if (!o) | ||
return; | ||
if (typeof o === "string") | ||
return _arrayLikeToArray2(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) | ||
n = o.constructor.name; | ||
if (n === "Map" || n === "Set") | ||
return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray2(o, minLen); | ||
} | ||
function _arrayLikeToArray2(arr, len) { | ||
if (len == null || len > arr.length) | ||
len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
} | ||
function asyncIterableFromObservable(observable) { | ||
var _iterateLater = iterateLater(), _iterateLater2 = _slicedToArray(_iterateLater, 3), iterable = _iterateLater2[0], next = _iterateLater2[1], complete = _iterateLater2[2]; | ||
observable.subscribe(next, function(error) { | ||
return next(Promise.reject(error)); | ||
}, complete); | ||
const [iterable, next, complete] = iterateLater(); | ||
observable.subscribe(next, (error) => next(Promise.reject(error)), complete); | ||
return iterable; | ||
@@ -864,70 +53,13 @@ } | ||
return asyncIterableFromObservable(value); | ||
var iterate; | ||
let iterate; | ||
if (typeof value[Symbol.iterator] === "function") { | ||
iterate = /* @__PURE__ */ function() { | ||
var _ref = _wrapAsyncGenerator(/* @__PURE__ */ import_regenerator2.default.mark(function _callee() { | ||
var _iterator, _step, element; | ||
return import_regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_iterator = _createForOfIteratorHelper(value); | ||
_context.prev = 1; | ||
_iterator.s(); | ||
case 3: | ||
if ((_step = _iterator.n()).done) { | ||
_context.next = 9; | ||
break; | ||
} | ||
element = _step.value; | ||
_context.next = 7; | ||
return element; | ||
case 7: | ||
_context.next = 3; | ||
break; | ||
case 9: | ||
_context.next = 14; | ||
break; | ||
case 11: | ||
_context.prev = 11; | ||
_context.t0 = _context["catch"](1); | ||
_iterator.e(_context.t0); | ||
case 14: | ||
_context.prev = 14; | ||
_iterator.f(); | ||
return _context.finish(14); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, null, [[1, 11, 14, 17]]); | ||
})); | ||
return function iterate2() { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
iterate = async function* () { | ||
for (const element of value) { | ||
yield await element; | ||
} | ||
}; | ||
} else { | ||
iterate = /* @__PURE__ */ function() { | ||
var _ref2 = _wrapAsyncGenerator(/* @__PURE__ */ import_regenerator2.default.mark(function _callee2() { | ||
return import_regenerator2.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.next = 2; | ||
return _awaitAsyncGenerator(value); | ||
case 2: | ||
_context2.next = 4; | ||
return _context2.sent; | ||
case 4: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2); | ||
})); | ||
return function iterate2() { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
}(); | ||
iterate = async function* () { | ||
yield await value; | ||
}; | ||
} | ||
@@ -937,137 +69,25 @@ return iterate(); | ||
function toAsyncIterable(value) { | ||
return typeof value === "undefined" ? function(curriedValue) { | ||
return _toAsyncIterable(curriedValue); | ||
} : _toAsyncIterable(value); | ||
return typeof value === "undefined" ? (curriedValue) => _toAsyncIterable(curriedValue) : _toAsyncIterable(value); | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
function _asyncToGenerator(fn) { | ||
return function() { | ||
var self = this, args = arguments; | ||
return new Promise(function(resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
// src/partition.ts | ||
function partition(index, iterable) { | ||
let current = 0; | ||
const [partitionFirst, nextFirst, completeFirst] = iterateLater(); | ||
const [partitionSecond, nextSecond, completeSecond] = iterateLater(); | ||
const iterate = async () => { | ||
for await (const value of iterable) { | ||
if (current == index) { | ||
completeFirst(); | ||
} | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
if (current < index) { | ||
nextFirst(value); | ||
} else { | ||
nextSecond(value); | ||
} | ||
_next(void 0); | ||
}); | ||
current++; | ||
} | ||
completeFirst(); | ||
completeSecond(); | ||
}; | ||
} | ||
// ../../common/temp/node_modules/.pnpm/@babel+runtime@7.15.4/node_modules/@babel/runtime/helpers/esm/asyncIterator.js | ||
function _asyncIterator(iterable) { | ||
var method; | ||
if (typeof Symbol !== "undefined") { | ||
if (Symbol.asyncIterator) | ||
method = iterable[Symbol.asyncIterator]; | ||
if (method == null && Symbol.iterator) | ||
method = iterable[Symbol.iterator]; | ||
} | ||
if (method == null) | ||
method = iterable["@@asyncIterator"]; | ||
if (method == null) | ||
method = iterable["@@iterator"]; | ||
if (method == null) | ||
throw new TypeError("Object is not async iterable"); | ||
return method.call(iterable); | ||
} | ||
// src/partition.ts | ||
var import_regenerator3 = __toModule(require_regenerator()); | ||
function partition(index, iterable) { | ||
var current = 0; | ||
var _iterateLater = iterateLater(), _iterateLater2 = _slicedToArray(_iterateLater, 3), partitionFirst = _iterateLater2[0], nextFirst = _iterateLater2[1], completeFirst = _iterateLater2[2]; | ||
var _iterateLater3 = iterateLater(), _iterateLater4 = _slicedToArray(_iterateLater3, 3), partitionSecond = _iterateLater4[0], nextSecond = _iterateLater4[1], completeSecond = _iterateLater4[2]; | ||
var iterate = /* @__PURE__ */ function() { | ||
var _ref = _asyncToGenerator(/* @__PURE__ */ import_regenerator3.default.mark(function _callee() { | ||
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, value; | ||
return import_regenerator3.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_iteratorAbruptCompletion = false; | ||
_didIteratorError = false; | ||
_context.prev = 2; | ||
_iterator = _asyncIterator(iterable); | ||
case 4: | ||
_context.next = 6; | ||
return _iterator.next(); | ||
case 6: | ||
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
value = _step.value; | ||
if (current == index) { | ||
completeFirst(); | ||
} | ||
if (current < index) { | ||
nextFirst(value); | ||
} else { | ||
nextSecond(value); | ||
} | ||
current++; | ||
case 11: | ||
_iteratorAbruptCompletion = false; | ||
_context.next = 4; | ||
break; | ||
case 14: | ||
_context.next = 20; | ||
break; | ||
case 16: | ||
_context.prev = 16; | ||
_context.t0 = _context["catch"](2); | ||
_didIteratorError = true; | ||
_iteratorError = _context.t0; | ||
case 20: | ||
_context.prev = 20; | ||
_context.prev = 21; | ||
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { | ||
_context.next = 25; | ||
break; | ||
} | ||
_context.next = 25; | ||
return _iterator["return"](); | ||
case 25: | ||
_context.prev = 25; | ||
if (!_didIteratorError) { | ||
_context.next = 28; | ||
break; | ||
} | ||
throw _iteratorError; | ||
case 28: | ||
return _context.finish(25); | ||
case 29: | ||
return _context.finish(20); | ||
case 30: | ||
completeFirst(); | ||
completeSecond(); | ||
case 32: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, null, [[2, 16, 20, 30], [21, , 25, 29]]); | ||
})); | ||
return function iterate2() { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
iterate(); | ||
@@ -1078,75 +98,13 @@ return [partitionFirst, partitionSecond]; | ||
// src/value.ts | ||
var import_regenerator4 = __toModule(require_regenerator()); | ||
function _valueAt(index, iterable) { | ||
var current, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, value; | ||
return import_regenerator4.default.async(function _valueAt$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
current = 0; | ||
_iteratorAbruptCompletion = false; | ||
_didIteratorError = false; | ||
_context.prev = 3; | ||
_iterator = _asyncIterator(iterable); | ||
case 5: | ||
_context.next = 7; | ||
return import_regenerator4.default.awrap(_iterator.next()); | ||
case 7: | ||
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) { | ||
_context.next = 15; | ||
break; | ||
} | ||
value = _step.value; | ||
if (!(current == index)) { | ||
_context.next = 11; | ||
break; | ||
} | ||
return _context.abrupt("return", value); | ||
case 11: | ||
current++; | ||
case 12: | ||
_iteratorAbruptCompletion = false; | ||
_context.next = 5; | ||
break; | ||
case 15: | ||
_context.next = 21; | ||
break; | ||
case 17: | ||
_context.prev = 17; | ||
_context.t0 = _context["catch"](3); | ||
_didIteratorError = true; | ||
_iteratorError = _context.t0; | ||
case 21: | ||
_context.prev = 21; | ||
_context.prev = 22; | ||
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { | ||
_context.next = 26; | ||
break; | ||
} | ||
_context.next = 26; | ||
return import_regenerator4.default.awrap(_iterator["return"]()); | ||
case 26: | ||
_context.prev = 26; | ||
if (!_didIteratorError) { | ||
_context.next = 29; | ||
break; | ||
} | ||
throw _iteratorError; | ||
case 29: | ||
return _context.finish(26); | ||
case 30: | ||
return _context.finish(21); | ||
case 31: | ||
throw new ReferenceError("Index ".concat(index, " not found in iterable")); | ||
case 32: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, null, null, [[3, 17, 21, 31], [22, , 26, 30]], Promise); | ||
async function _valueAt(index, iterable) { | ||
let current = 0; | ||
for await (const value of iterable) { | ||
if (current == index) | ||
return value; | ||
current++; | ||
} | ||
throw new ReferenceError(`Index ${index} not found in iterable`); | ||
} | ||
function valueAt(index, iterable) { | ||
return iterable ? _valueAt(index, iterable) : function(curriedIterable) { | ||
return _valueAt(index, curriedIterable); | ||
}; | ||
return iterable ? _valueAt(index, iterable) : (curriedIterable) => _valueAt(index, curriedIterable); | ||
} | ||
@@ -1156,124 +114,21 @@ function firstValue(iterable) { | ||
} | ||
function _lastValue(_x) { | ||
return _lastValue2.apply(this, arguments); | ||
async function _lastValue(iterable) { | ||
let value; | ||
let wasEmpty = true; | ||
for await (value of iterable) { | ||
wasEmpty = false; | ||
} | ||
if (!wasEmpty && value) { | ||
return value; | ||
} | ||
throw new ReferenceError("Cannot get last value of empty iterable"); | ||
} | ||
function _lastValue2() { | ||
_lastValue2 = _asyncToGenerator(/* @__PURE__ */ import_regenerator4.default.mark(function _callee(iterable) { | ||
var value, wasEmpty, _iteratorAbruptCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2; | ||
return import_regenerator4.default.wrap(function _callee$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
wasEmpty = true; | ||
_iteratorAbruptCompletion2 = false; | ||
_didIteratorError2 = false; | ||
_context2.prev = 3; | ||
_iterator2 = _asyncIterator(iterable); | ||
case 5: | ||
_context2.next = 7; | ||
return _iterator2.next(); | ||
case 7: | ||
if (!(_iteratorAbruptCompletion2 = !(_step2 = _context2.sent).done)) { | ||
_context2.next = 13; | ||
break; | ||
} | ||
value = _step2.value; | ||
wasEmpty = false; | ||
case 10: | ||
_iteratorAbruptCompletion2 = false; | ||
_context2.next = 5; | ||
break; | ||
case 13: | ||
_context2.next = 19; | ||
break; | ||
case 15: | ||
_context2.prev = 15; | ||
_context2.t0 = _context2["catch"](3); | ||
_didIteratorError2 = true; | ||
_iteratorError2 = _context2.t0; | ||
case 19: | ||
_context2.prev = 19; | ||
_context2.prev = 20; | ||
if (!(_iteratorAbruptCompletion2 && _iterator2["return"] != null)) { | ||
_context2.next = 24; | ||
break; | ||
} | ||
_context2.next = 24; | ||
return _iterator2["return"](); | ||
case 24: | ||
_context2.prev = 24; | ||
if (!_didIteratorError2) { | ||
_context2.next = 27; | ||
break; | ||
} | ||
throw _iteratorError2; | ||
case 27: | ||
return _context2.finish(24); | ||
case 28: | ||
return _context2.finish(19); | ||
case 29: | ||
if (wasEmpty) { | ||
_context2.next = 31; | ||
break; | ||
} | ||
return _context2.abrupt("return", value); | ||
case 31: | ||
throw new ReferenceError("Cannot get last value of empty iterable"); | ||
case 32: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee, null, [[3, 15, 19, 29], [20, , 24, 28]]); | ||
})); | ||
return _lastValue2.apply(this, arguments); | ||
} | ||
function lastValue(iterable) { | ||
return iterable ? _lastValue(iterable) : function(curriedIterable) { | ||
return _lastValue(curriedIterable); | ||
}; | ||
return iterable ? _lastValue(iterable) : (curriedIterable) => _lastValue(curriedIterable); | ||
} | ||
// src/concurrently.ts | ||
var import_regenerator5 = __toModule(require_regenerator()); | ||
function concurrently() { | ||
return _concurrently.apply(this, arguments); | ||
async function concurrently(...functions) { | ||
return Promise.all(functions.map(async (fn) => fn())); | ||
} | ||
function _concurrently() { | ||
_concurrently = _asyncToGenerator(/* @__PURE__ */ import_regenerator5.default.mark(function _callee2() { | ||
var _len, functions, _key, _args2 = arguments; | ||
return import_regenerator5.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
for (_len = _args2.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { | ||
functions[_key] = _args2[_key]; | ||
} | ||
return _context2.abrupt("return", Promise.all(functions.map(/* @__PURE__ */ function() { | ||
var _ref = _asyncToGenerator(/* @__PURE__ */ import_regenerator5.default.mark(function _callee(fn) { | ||
return import_regenerator5.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
return _context.abrupt("return", fn()); | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return function(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()))); | ||
case 2: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2); | ||
})); | ||
return _concurrently.apply(this, arguments); | ||
} | ||
export { | ||
@@ -1280,0 +135,0 @@ asyncIterableFromObservable, |
@@ -115,3 +115,3 @@ // src/resolve-later.ts | ||
} | ||
if (!wasEmpty) { | ||
if (!wasEmpty && value) { | ||
return value; | ||
@@ -118,0 +118,0 @@ } |
{ | ||
"name": "async-later", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Functional directives for Promise and AsyncIterable", | ||
@@ -9,9 +9,12 @@ "types": "src/index.ts", | ||
"browser": "./dist/browser/esm.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "node scripts/build.mjs", | ||
"test": "VERBOSE=1 node --experimental-specifier-resolution=node dist/test.js | tap-spec-emoji" | ||
"build": "node scripts/build.js", | ||
"test:node": "tape dist/node/test.cjs | tap-spec; nyc report ---reporter=text", | ||
"test:web": "rushx build && cat dist/browser/test.js | testling -u", | ||
"lint": "eslint ./src --fix" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/functionland/borg/tree/main/libraries/async-later" | ||
"url": "https://github.com/functionland/fula/tree/main/libraries/async-later" | ||
}, | ||
@@ -29,13 +32,23 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/tape": "^4.13.2", | ||
"esbuild": "^0.12.17", | ||
"streaming-iterables": "^6.0.0", | ||
"tap-spec-emoji": "^6.1.2", | ||
"tape": "^5.3.0", | ||
"typescript": "^4.3.5", | ||
"build-helpers": "~0.0.1", | ||
"esbuild": "~0.14.25", | ||
"streaming-iterables": "~6.2.0", | ||
"tap-spec": "~5.0.0", | ||
"ts-node": "~10.6.0", | ||
"nyc": "~15.1.0", | ||
"nodemon": "~2.0.15", | ||
"tape": "~5.5.2", | ||
"@types/tape": "~4.13.2", | ||
"browserify": "~17.0.0", | ||
"testling": "~1.7.3", | ||
"typescript": "~4.6.2", | ||
"esbuild-plugin-babel": "~0.2.3", | ||
"@babel/core": "~7.15.5", | ||
"@babel/preset-typescript": "~7.15.0", | ||
"@babel/preset-env": "~7.15.6", | ||
"@babel/plugin-transform-runtime": "~7.15.0" | ||
"@babel/core": "~7.17.5", | ||
"@babel/preset-typescript": "~7.16.7", | ||
"@babel/preset-env": "~7.16.11", | ||
"eslint": "~8.10.0", | ||
"@typescript-eslint/eslint-plugin": "~5.13.0", | ||
"@typescript-eslint/parser": "~5.13.0", | ||
"@esbuild-plugins/node-globals-polyfill": "~0.1.1", | ||
"@esbuild-plugins/node-modules-polyfill": "~0.1.4" | ||
}, | ||
@@ -45,7 +58,8 @@ "exports": { | ||
"browser": { | ||
"default": "./dist/browser/esm.js" | ||
"require": "./dist/browser/cjs.cjs", | ||
"import": "./dist/browser/esm.js" | ||
}, | ||
"node": { | ||
"require":"./dist/node/cjs.js", | ||
"import":"./dist/node/esm.js" | ||
"require":"./dist/node/cjs.cjs", | ||
"import": "./dist/node/esm.js" | ||
} | ||
@@ -55,4 +69,4 @@ } | ||
"dependencies": { | ||
"@babel/runtime": "~7.15.4" | ||
"@babel/runtime": "~7.17.2" | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
export async function concurrently<T>(...functions: (() => T | PromiseLike<T>)[]) { | ||
return Promise.all(functions.map(async fn => fn())); | ||
export async function concurrently<T>( | ||
...functions: (() => T | PromiseLike<T>)[] | ||
) { | ||
return Promise.all(functions.map(async (fn) => fn())); | ||
} |
// Pending: https://stackoverflow.com/questions/68761267/capture-generic-type-of-passed-function-for-overloads-in-typescript | ||
// TODO: refactor "./value.ts" with this when/if resolved | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export function curried<TLeadingParameters extends any[], TLastParameter, TReturn>( | ||
@@ -25,12 +26,1 @@ fn: (...args: [...TLeadingParameters, TLastParameter]) => TReturn | ||
function a<T>(b: string, c: number, d: T[]) { | ||
return [b, c, ...d]; | ||
} | ||
const b = curried(a)('hi', 42)([1, 2, 3]); // b: unknown[] | ||
const c = curried(a)<number>('hi', 42)([1, 2, 3]); | ||
// works, but needs the generic specified, | ||
// these are to be used in pipeline: | ||
// https://github.com/reconbot/streaming-iterables/blob/9199a03fcfd21c0c18a73f5f0d353f021465f31b/lib/pipeline.ts#L62 | ||
// so it's a hard sell to @reconbot | ||
const d = overloadWithCurried(a)('hi', 42)([1, 2, 3]); // d: unknown[] |
export type Resolve<T> = (value?: T | PromiseLike<T>) => void; | ||
export interface ObservableLike<T> { | ||
subscribe(next: (value?: T) => void, error: (error: any) => void, complete: () => void):any; | ||
subscribe( | ||
next: (value?: T) => void, | ||
error: (error: any) => void, | ||
complete: () => void | ||
): any; | ||
} | ||
@@ -6,0 +10,0 @@ |
@@ -5,8 +5,8 @@ import { Resolve } from '.'; | ||
let resolve; | ||
const promise = new Promise<T>(resolveCallback => { | ||
resolve = resolveCallback; | ||
}); | ||
if(resolve!== undefined) | ||
return [promise, resolve] ; | ||
throw('Something Wrong') | ||
const promise = | ||
new Promise<T> ((resolveCallback) => { | ||
resolve = resolveCallback; | ||
}); | ||
if (resolve !== undefined) return [promise, resolve]; | ||
throw 'Something Wrong'; | ||
} |
@@ -25,3 +25,3 @@ async function _valueAt<T>(index: number, iterable: Iterable<T> | AsyncIterable<T>) { | ||
async function _lastValue<T>(iterable: Iterable<T> | AsyncIterable<T>) { | ||
let value: T; | ||
let value: T | undefined; | ||
let wasEmpty = true; | ||
@@ -31,4 +31,3 @@ for await (value of iterable) { | ||
} | ||
if (!wasEmpty) { | ||
// @ts-ignore | ||
if (!wasEmpty && value) { | ||
return value; | ||
@@ -35,0 +34,0 @@ } |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1606492
22
17456
Yes
21
3
3
+ Added@babel/runtime@7.17.9(transitive)
- Removed@babel/runtime@7.15.4(transitive)
Updated@babel/runtime@~7.17.2