rsnext/packages/next/compiled/p-limit/index.js
JJ Kasper e8408c7086
Pre-compile more dependencies (#32627)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-20 14:01:35 +01:00

1 line
No EOL
1.5 KiB
JavaScript

(()=>{var e={631:e=>{class Node{constructor(e){this.value=e;this.next=undefined}}class Queue{constructor(){this.clear()}enqueue(e){const t=new Node(e);if(this._head){this._tail.next=t;this._tail=t}else{this._head=t;this._tail=t}this._size++}dequeue(){const e=this._head;if(!e){return}this._head=this._head.next;this._size--;return e.value}clear(){this._head=undefined;this._tail=undefined;this._size=0}get size(){return this._size}*[Symbol.iterator](){let e=this._head;while(e){yield e.value;e=e.next}}}e.exports=Queue},805:(e,t,i)=>{"use strict";const r=i(631);const pLimit=e=>{if(!((Number.isInteger(e)||e===Infinity)&&e>0)){throw new TypeError("Expected `concurrency` to be a number from 1 and up")}const t=new r;let i=0;const next=()=>{i--;if(t.size>0){t.dequeue()()}};const run=async(e,t,...r)=>{i++;const s=(async()=>e(...r))();t(s);try{await s}catch{}next()};const enqueue=(r,s,...n)=>{t.enqueue(run.bind(null,r,s,...n));(async()=>{await Promise.resolve();if(i<e&&t.size>0){t.dequeue()()}})()};const generator=(e,...t)=>new Promise((i=>{enqueue(e,i,...t)}));Object.defineProperties(generator,{activeCount:{get:()=>i},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}});return generator};e.exports=pLimit}};var t={};function __nccwpck_require__(i){var r=t[i];if(r!==undefined){return r.exports}var s=t[i]={exports:{}};var n=true;try{e[i](s,s.exports,__nccwpck_require__);n=false}finally{if(n)delete t[i]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(805);module.exports=i})();