repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 8.39 kB
JSON
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\nimport invariant from 'fbjs/lib/invariant';\nclass TaskQueue {\n constructor(_ref) {\n var onMoreTasks = _ref.onMoreTasks;\n this._onMoreTasks = onMoreTasks;\n this._queueStack = [{\n tasks: [],\n popable: true\n }];\n }\n enqueue(task) {\n this._getCurrentQueue().push(task);\n }\n enqueueTasks(tasks) {\n tasks.forEach(task => this.enqueue(task));\n }\n cancelTasks(tasksToCancel) {\n this._queueStack = this._queueStack.map(queue => _objectSpread(_objectSpread({}, queue), {}, {\n tasks: queue.tasks.filter(task => tasksToCancel.indexOf(task) === -1)\n })).filter((queue, idx) => queue.tasks.length > 0 || idx === 0);\n }\n hasTasksToProcess() {\n return this._getCurrentQueue().length > 0;\n }\n processNext() {\n var queue = this._getCurrentQueue();\n if (queue.length) {\n var task = queue.shift();\n try {\n if (typeof task === 'object' && task.gen) {\n this._genPromise(task);\n } else if (typeof task === 'object' && task.run) {\n task.run();\n } else {\n invariant(typeof task === 'function', 'Expected Function, SimpleTask, or PromiseTask, but got:\\n' + JSON.stringify(task, null, 2));\n task();\n }\n } catch (e) {\n e.message = 'TaskQueue: Error with task ' + (task.name || '') + ': ' + e.message;\n throw e;\n }\n }\n }\n _getCurrentQueue() {\n var stackIdx = this._queueStack.length - 1;\n var queue = this._queueStack[stackIdx];\n if (queue.popable && queue.tasks.length === 0 && stackIdx > 0) {\n this._queueStack.pop();\n return this._getCurrentQueue();\n } else {\n return queue.tasks;\n }\n }\n _genPromise(task) {\n var length = this._queueStack.push({\n tasks: [],\n popable: false\n });\n var stackIdx = length - 1;\n var stackItem = this._queueStack[stackIdx];\n task.gen().then(() => {\n stackItem.popable = true;\n this.hasTasksToProcess() && this._onMoreTasks();\n }).catch(ex => {\n setTimeout(() => {\n ex.message = \"TaskQueue: Error resolving Promise in task \" + task.name + \": \" + ex.message;\n throw ex;\n }, 0);\n });\n }\n}\nexport default TaskQueue;","map":{"version":3,"names":["_objectSpread","invariant","TaskQueue","constructor","_ref","onMoreTasks","_onMoreTasks","_queueStack","tasks","popable","enqueue","task","_getCurrentQueue","push","enqueueTasks","forEach","cancelTasks","tasksToCancel","map","queue","filter","indexOf","idx","length","hasTasksToProcess","processNext","shift","gen","_genPromise","run","JSON","stringify","e","message","name","stackIdx","pop","stackItem","then","catch","ex","setTimeout"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/exports/InteractionManager/TaskQueue.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\n/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport invariant from 'fbjs/lib/invariant';\nclass TaskQueue {\n constructor(_ref) {\n var onMoreTasks = _ref.onMoreTasks;\n this._onMoreTasks = onMoreTasks;\n this._queueStack = [{\n tasks: [],\n popable: true\n }];\n }\n enqueue(task) {\n this._getCurrentQueue().push(task);\n }\n enqueueTasks(tasks) {\n tasks.forEach(task => this.enqueue(task));\n }\n cancelTasks(tasksToCancel) {\n this._queueStack = this._queueStack.map(queue => _objectSpread(_objectSpread({}, queue), {}, {\n tasks: queue.tasks.filter(task => tasksToCancel.indexOf(task) === -1)\n })).filter((queue, idx) => queue.tasks.length > 0 || idx === 0);\n }\n hasTasksToProcess() {\n return this._getCurrentQueue().length > 0;\n }\n\n /**\n * Executes the next task in the queue.\n */\n processNext() {\n var queue = this._getCurrentQueue();\n if (queue.length) {\n var task = queue.shift();\n try {\n if (typeof task === 'object' && task.gen) {\n this._genPromise(task);\n } else if (typeof task === 'object' && task.run) {\n task.run();\n } else {\n invariant(typeof task === 'function', 'Expected Function, SimpleTask, or PromiseTask, but got:\\n' + JSON.stringify(task, null, 2));\n task();\n }\n } catch (e) {\n e.message = 'TaskQueue: Error with task ' + (task.name || '') + ': ' + e.message;\n throw e;\n }\n }\n }\n _getCurrentQueue() {\n var stackIdx = this._queueStack.length - 1;\n var queue = this._queueStack[stackIdx];\n if (queue.popable && queue.tasks.length === 0 && stackIdx > 0) {\n this._queueStack.pop();\n return this._getCurrentQueue();\n } else {\n return queue.tasks;\n }\n }\n _genPromise(task) {\n var length = this._queueStack.push({\n tasks: [],\n popable: false\n });\n var stackIdx = length - 1;\n var stackItem = this._queueStack[stackIdx];\n task.gen().then(() => {\n stackItem.popable = true;\n this.hasTasksToProcess() && this._onMoreTasks();\n }).catch(ex => {\n setTimeout(() => {\n ex.message = \"TaskQueue: Error resolving Promise in task \" + task.name + \": \" + ex.message;\n throw ex;\n }, 0);\n });\n }\n}\nexport default TaskQueue;"],"mappings":"AAAA,OAAOA,aAAa,MAAM,sCAAsC;AAWhE,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,MAAMC,SAAS,CAAC;EACdC,WAAWA,CAACC,IAAI,EAAE;IAChB,IAAIC,WAAW,GAAGD,IAAI,CAACC,WAAW;IAClC,IAAI,CAACC,YAAY,GAAGD,WAAW;IAC/B,IAAI,CAACE,WAAW,GAAG,CAAC;MAClBC,KAAK,EAAE,EAAE;MACTC,OAAO,EAAE;IACX,CAAC,CAAC;EACJ;EACAC,OAAOA,CAACC,IAAI,EAAE;IACZ,IAAI,CAACC,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAACF,IAAI,CAAC;EACpC;EACAG,YAAYA,CAACN,KAAK,EAAE;IAClBA,KAAK,CAACO,OAAO,CAACJ,IAAI,IAAI,IAAI,CAACD,OAAO,CAACC,IAAI,CAAC,CAAC;EAC3C;EACAK,WAAWA,CAACC,aAAa,EAAE;IACzB,IAAI,CAACV,WAAW,GAAG,IAAI,CAACA,WAAW,CAACW,GAAG,CAACC,KAAK,IAAInB,aAAa,CAACA,aAAa,CAAC,CAAC,CAAC,EAAEmB,KAAK,CAAC,EAAE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