@expo/cli 0.23.0 → 0.23.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.
Files changed (76) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/customize/templates.js +15 -1
  3. package/build/src/customize/templates.js.map +1 -1
  4. package/build/src/lint/ESlintPrerequisite.js +30 -46
  5. package/build/src/lint/ESlintPrerequisite.js.map +1 -1
  6. package/build/src/start/doctor/apple/XcodePrerequisite.js +1 -1
  7. package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
  8. package/build/src/start/server/metro/MetroTerminalReporter.js +28 -1
  9. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  10. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +19 -19
  11. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  12. package/build/src/start/server/metro/instantiateMetro.js +2 -2
  13. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  14. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +21 -2
  15. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  16. package/build/src/start/server/metro/metroErrorInterface.js +19 -8
  17. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  18. package/build/src/start/server/metro/withMetroMultiPlatform.js +0 -9
  19. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  20. package/build/src/start/server/middleware/inspector/JsInspector.js +2 -25
  21. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  22. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  23. package/build/src/utils/telemetry/utils/context.js +1 -1
  24. package/package.json +8 -8
  25. package/static/canary/react-is/cjs/react-is.development.js +118 -185
  26. package/static/canary/react-is/cjs/react-is.production.js +2 -2
  27. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +16582 -26565
  28. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +3495 -3357
  29. package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +3929 -3801
  30. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16869 -27032
  31. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3535 -3428
  32. package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4198 -4095
  33. package/static/canary/scheduler/cjs/scheduler-unstable_mock.development.js +387 -684
  34. package/static/canary/scheduler/cjs/scheduler-unstable_mock.production.js +0 -9
  35. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.development.js +137 -195
  36. package/static/canary/scheduler/cjs/scheduler-unstable_post_task.production.js +0 -5
  37. package/static/canary/scheduler/cjs/scheduler.development.js +339 -600
  38. package/static/canary/scheduler/cjs/scheduler.native.development.js +324 -512
  39. package/static/canary/scheduler/cjs/scheduler.native.production.js +6 -5
  40. package/static/canary/scheduler/cjs/scheduler.production.js +16 -17
  41. package/static/canary-full/react/cjs/react-compiler-runtime.development.js +13 -68
  42. package/static/canary-full/react/cjs/react-jsx-dev-runtime.development.js +317 -1251
  43. package/static/canary-full/react/cjs/react-jsx-dev-runtime.react-server.development.js +353 -1286
  44. package/static/canary-full/react/cjs/react-jsx-runtime.development.js +326 -1279
  45. package/static/canary-full/react/cjs/react-jsx-runtime.react-server.development.js +353 -1286
  46. package/static/canary-full/react/cjs/react.development.js +1204 -2771
  47. package/static/canary-full/react/cjs/react.production.js +25 -20
  48. package/static/canary-full/react/cjs/react.react-server.development.js +783 -2162
  49. package/static/canary-full/react/cjs/react.react-server.production.js +13 -63
  50. package/static/canary-full/react/package.json +1 -1
  51. package/static/canary-full/react-dom/cjs/react-dom-client.development.js +24847 -37099
  52. package/static/canary-full/react-dom/cjs/react-dom-client.production.js +8261 -7475
  53. package/static/canary-full/react-dom/cjs/react-dom-profiling.development.js +25252 -37571
  54. package/static/canary-full/react-dom/cjs/react-dom-profiling.profiling.js +9442 -8662
  55. package/static/canary-full/react-dom/cjs/react-dom-server-legacy.browser.development.js +8944 -11568
  56. package/static/canary-full/react-dom/cjs/react-dom-server-legacy.browser.production.js +1378 -944
  57. package/static/canary-full/react-dom/cjs/react-dom-server-legacy.node.development.js +8944 -11568
  58. package/static/canary-full/react-dom/cjs/react-dom-server-legacy.node.production.js +1386 -954
  59. package/static/canary-full/react-dom/cjs/react-dom-server.browser.development.js +9344 -11600
  60. package/static/canary-full/react-dom/cjs/react-dom-server.browser.production.js +1545 -954
  61. package/static/canary-full/react-dom/cjs/react-dom-server.bun.development.js +8286 -11064
  62. package/static/canary-full/react-dom/cjs/react-dom-server.bun.production.js +1437 -976
  63. package/static/canary-full/react-dom/cjs/react-dom-server.edge.development.js +9356 -11609
  64. package/static/canary-full/react-dom/cjs/react-dom-server.edge.production.js +1542 -970
  65. package/static/canary-full/react-dom/cjs/react-dom-server.node.development.js +9227 -11571
  66. package/static/canary-full/react-dom/cjs/react-dom-server.node.production.js +1787 -1183
  67. package/static/canary-full/react-dom/cjs/react-dom-test-utils.development.js +13 -59
  68. package/static/canary-full/react-dom/cjs/react-dom.development.js +402 -604
  69. package/static/canary-full/react-dom/cjs/react-dom.production.js +4 -3
  70. package/static/canary-full/react-dom/cjs/react-dom.react-server.development.js +322 -382
  71. package/static/canary-full/react-dom/cjs/react-dom.react-server.production.js +6 -7
  72. package/static/canary-full/react-dom/package.json +5 -5
  73. package/static/canary-full/react-dom/static.browser.js +1 -0
  74. package/static/canary-full/react-dom/static.edge.js +1 -0
  75. package/static/canary-full/react-dom/static.node.js +1 -0
  76. package/static/template/eslint.config.js +10 -0
@@ -8,704 +8,407 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- if (process.env.NODE_ENV !== "production") {
14
- (function() {
15
- 'use strict';
16
-
17
- var enableSchedulerDebugging = false;
18
- var enableProfiling = false;
19
-
20
- function push(heap, node) {
21
- var index = heap.length;
22
- heap.push(node);
23
- siftUp(heap, node, index);
24
- }
25
- function peek(heap) {
26
- return heap.length === 0 ? null : heap[0];
27
- }
28
- function pop(heap) {
29
- if (heap.length === 0) {
30
- return null;
31
- }
32
-
33
- var first = heap[0];
34
- var last = heap.pop();
35
-
36
- if (last !== first) {
37
- heap[0] = last;
38
- siftDown(heap, last, 0);
39
- }
40
-
41
- return first;
42
- }
43
-
44
- function siftUp(heap, node, i) {
45
- var index = i;
46
-
47
- while (index > 0) {
48
- var parentIndex = index - 1 >>> 1;
49
- var parent = heap[parentIndex];
50
-
51
- if (compare(parent, node) > 0) {
52
- // The parent is larger. Swap positions.
53
- heap[parentIndex] = node;
54
- heap[index] = parent;
55
- index = parentIndex;
56
- } else {
57
- // The parent is smaller. Exit.
58
- return;
59
- }
60
- }
61
- }
62
-
63
- function siftDown(heap, node, i) {
64
- var index = i;
65
- var length = heap.length;
66
- var halfLength = length >>> 1;
67
-
68
- while (index < halfLength) {
69
- var leftIndex = (index + 1) * 2 - 1;
70
- var left = heap[leftIndex];
71
- var rightIndex = leftIndex + 1;
72
- var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
73
-
74
- if (compare(left, node) < 0) {
75
- if (rightIndex < length && compare(right, left) < 0) {
76
- heap[index] = right;
77
- heap[rightIndex] = node;
78
- index = rightIndex;
79
- } else {
80
- heap[index] = left;
81
- heap[leftIndex] = node;
82
- index = leftIndex;
11
+ "use strict";
12
+ "production" !== process.env.NODE_ENV &&
13
+ (function () {
14
+ function push(heap, node) {
15
+ var index = heap.length;
16
+ heap.push(node);
17
+ a: for (; 0 < index; ) {
18
+ var parentIndex = (index - 1) >>> 1,
19
+ parent = heap[parentIndex];
20
+ if (0 < compare(parent, node))
21
+ (heap[parentIndex] = node),
22
+ (heap[index] = parent),
23
+ (index = parentIndex);
24
+ else break a;
83
25
  }
84
- } else if (rightIndex < length && compare(right, node) < 0) {
85
- heap[index] = right;
86
- heap[rightIndex] = node;
87
- index = rightIndex;
88
- } else {
89
- // Neither child is smaller. Exit.
90
- return;
91
26
  }
92
- }
93
- }
94
-
95
- function compare(a, b) {
96
- // Compare sort index first, then task id.
97
- var diff = a.sortIndex - b.sortIndex;
98
- return diff !== 0 ? diff : a.id - b.id;
99
- }
100
-
101
- // TODO: Use symbols?
102
- var ImmediatePriority = 1;
103
- var UserBlockingPriority = 2;
104
- var NormalPriority = 3;
105
- var LowPriority = 4;
106
- var IdlePriority = 5;
107
-
108
- function markTaskErrored(task, ms) {
109
- }
110
-
111
- /* eslint-disable no-var */
112
- // Math.pow(2, 30) - 1
113
- // 0b111111111111111111111111111111
114
-
115
- var maxSigned31BitInt = 1073741823; // Times out immediately
116
-
117
- var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
118
-
119
- var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
120
- var NORMAL_PRIORITY_TIMEOUT = 5000;
121
- var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
122
-
123
- var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap
124
-
125
- var taskQueue = [];
126
- var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
127
-
128
- var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
129
- var currentTask = null;
130
- var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
131
-
132
- var isPerformingWork = false;
133
- var isHostCallbackScheduled = false;
134
- var isHostTimeoutScheduled = false;
135
- var currentMockTime = 0;
136
- var scheduledCallback = null;
137
- var scheduledTimeout = null;
138
- var timeoutTime = -1;
139
- var yieldedValues = null;
140
- var expectedNumberOfYields = -1;
141
- var didStop = false;
142
- var isFlushing = false;
143
- var needsPaint = false;
144
- var shouldYieldForPaint = false;
145
- var disableYieldValue = false;
146
-
147
- function setDisableYieldValue(newValue) {
148
- disableYieldValue = newValue;
149
- }
150
-
151
- function advanceTimers(currentTime) {
152
- // Check for tasks that are no longer delayed and add them to the queue.
153
- var timer = peek(timerQueue);
154
-
155
- while (timer !== null) {
156
- if (timer.callback === null) {
157
- // Timer was cancelled.
158
- pop(timerQueue);
159
- } else if (timer.startTime <= currentTime) {
160
- // Timer fired. Transfer to the task queue.
161
- pop(timerQueue);
162
- timer.sortIndex = timer.expirationTime;
163
- push(taskQueue, timer);
164
- } else {
165
- // Remaining timers are pending.
166
- return;
27
+ function peek(heap) {
28
+ return 0 === heap.length ? null : heap[0];
167
29
  }
168
-
169
- timer = peek(timerQueue);
170
- }
171
- }
172
-
173
- function handleTimeout(currentTime) {
174
- isHostTimeoutScheduled = false;
175
- advanceTimers(currentTime);
176
-
177
- if (!isHostCallbackScheduled) {
178
- if (peek(taskQueue) !== null) {
179
- isHostCallbackScheduled = true;
180
- requestHostCallback(flushWork);
181
- } else {
182
- var firstTimer = peek(timerQueue);
183
-
184
- if (firstTimer !== null) {
185
- requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
30
+ function pop(heap) {
31
+ if (0 === heap.length) return null;
32
+ var first = heap[0],
33
+ last = heap.pop();
34
+ if (last !== first) {
35
+ heap[0] = last;
36
+ a: for (
37
+ var index = 0, length = heap.length, halfLength = length >>> 1;
38
+ index < halfLength;
39
+
40
+ ) {
41
+ var leftIndex = 2 * (index + 1) - 1,
42
+ left = heap[leftIndex],
43
+ rightIndex = leftIndex + 1,
44
+ right = heap[rightIndex];
45
+ if (0 > compare(left, last))
46
+ rightIndex < length && 0 > compare(right, left)
47
+ ? ((heap[index] = right),
48
+ (heap[rightIndex] = last),
49
+ (index = rightIndex))
50
+ : ((heap[index] = left),
51
+ (heap[leftIndex] = last),
52
+ (index = leftIndex));
53
+ else if (rightIndex < length && 0 > compare(right, last))
54
+ (heap[index] = right),
55
+ (heap[rightIndex] = last),
56
+ (index = rightIndex);
57
+ else break a;
58
+ }
186
59
  }
60
+ return first;
187
61
  }
188
- }
189
- }
190
-
191
- function flushWork(hasTimeRemaining, initialTime) {
192
-
193
-
194
- isHostCallbackScheduled = false;
195
-
196
- if (isHostTimeoutScheduled) {
197
- // We scheduled a timeout but it's no longer needed. Cancel it.
198
- isHostTimeoutScheduled = false;
199
- cancelHostTimeout();
200
- }
201
-
202
- isPerformingWork = true;
203
- var previousPriorityLevel = currentPriorityLevel;
204
-
205
- try {
206
- var currentTime; if (enableProfiling) ; else {
207
- // No catch in prod code path.
208
- return workLoop(hasTimeRemaining, initialTime);
62
+ function compare(a, b) {
63
+ var diff = a.sortIndex - b.sortIndex;
64
+ return 0 !== diff ? diff : a.id - b.id;
209
65
  }
210
- } finally {
211
- currentTask = null;
212
- currentPriorityLevel = previousPriorityLevel;
213
- isPerformingWork = false;
214
- }
215
- }
216
-
217
- function workLoop(hasTimeRemaining, initialTime) {
218
- var currentTime = initialTime;
219
- advanceTimers(currentTime);
220
- currentTask = peek(taskQueue);
221
-
222
- while (currentTask !== null && !(enableSchedulerDebugging )) {
223
- if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
224
- // This currentTask hasn't expired, and we've reached the deadline.
225
- break;
226
- } // $FlowFixMe[incompatible-use] found when upgrading Flow
227
-
228
-
229
- var callback = currentTask.callback;
230
-
231
- if (typeof callback === 'function') {
232
- // $FlowFixMe[incompatible-use] found when upgrading Flow
233
- currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
234
-
235
- currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
236
-
237
- var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
238
-
239
- var continuationCallback = callback(didUserCallbackTimeout);
240
- currentTime = getCurrentTime();
241
-
242
- if (typeof continuationCallback === 'function') {
243
- // If a continuation is returned, immediately yield to the main thread
244
- // regardless of how much time is left in the current time slice.
245
- // $FlowFixMe[incompatible-use] found when upgrading Flow
246
- currentTask.callback = continuationCallback;
247
-
248
- advanceTimers(currentTime);
249
-
250
- if (shouldYieldForPaint) {
251
- needsPaint = true;
252
- return true;
253
- }
254
- } else {
255
-
256
- if (currentTask === peek(taskQueue)) {
257
- pop(taskQueue);
258
- }
259
-
260
- advanceTimers(currentTime);
66
+ function advanceTimers(currentTime) {
67
+ for (var timer = peek(timerQueue); null !== timer; ) {
68
+ if (null === timer.callback) pop(timerQueue);
69
+ else if (timer.startTime <= currentTime)
70
+ pop(timerQueue),
71
+ (timer.sortIndex = timer.expirationTime),
72
+ push(taskQueue, timer);
73
+ else break;
74
+ timer = peek(timerQueue);
261
75
  }
262
- } else {
263
- pop(taskQueue);
264
- }
265
-
266
- currentTask = peek(taskQueue);
267
- } // Return whether there's additional work
268
-
269
-
270
- if (currentTask !== null) {
271
- return true;
272
- } else {
273
- var firstTimer = peek(timerQueue);
274
-
275
- if (firstTimer !== null) {
276
- requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
277
76
  }
278
-
279
- return false;
280
- }
281
- }
282
-
283
- function unstable_runWithPriority(priorityLevel, eventHandler) {
284
- switch (priorityLevel) {
285
- case ImmediatePriority:
286
- case UserBlockingPriority:
287
- case NormalPriority:
288
- case LowPriority:
289
- case IdlePriority:
290
- break;
291
-
292
- default:
293
- priorityLevel = NormalPriority;
294
- }
295
-
296
- var previousPriorityLevel = currentPriorityLevel;
297
- currentPriorityLevel = priorityLevel;
298
-
299
- try {
300
- return eventHandler();
301
- } finally {
302
- currentPriorityLevel = previousPriorityLevel;
303
- }
304
- }
305
-
306
- function unstable_next(eventHandler) {
307
- var priorityLevel;
308
-
309
- switch (currentPriorityLevel) {
310
- case ImmediatePriority:
311
- case UserBlockingPriority:
312
- case NormalPriority:
313
- // Shift down to normal priority
314
- priorityLevel = NormalPriority;
315
- break;
316
-
317
- default:
318
- // Anything lower than normal priority should remain at the current level.
319
- priorityLevel = currentPriorityLevel;
320
- break;
321
- }
322
-
323
- var previousPriorityLevel = currentPriorityLevel;
324
- currentPriorityLevel = priorityLevel;
325
-
326
- try {
327
- return eventHandler();
328
- } finally {
329
- currentPriorityLevel = previousPriorityLevel;
330
- }
331
- }
332
-
333
- function unstable_wrapCallback(callback) {
334
- var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
335
- // $FlowFixMe[missing-this-annot]
336
-
337
- return function () {
338
- // This is a fork of runWithPriority, inlined for performance.
339
- var previousPriorityLevel = currentPriorityLevel;
340
- currentPriorityLevel = parentPriorityLevel;
341
-
342
- try {
343
- return callback.apply(this, arguments);
344
- } finally {
345
- currentPriorityLevel = previousPriorityLevel;
77
+ function handleTimeout(currentTime) {
78
+ isHostTimeoutScheduled = !1;
79
+ advanceTimers(currentTime);
80
+ if (!isHostCallbackScheduled)
81
+ if (null !== peek(taskQueue))
82
+ (isHostCallbackScheduled = !0), (scheduledCallback = flushWork);
83
+ else {
84
+ var firstTimer = peek(timerQueue);
85
+ null !== firstTimer &&
86
+ ((currentTime = firstTimer.startTime - currentTime),
87
+ (scheduledTimeout = handleTimeout),
88
+ (timeoutTime = currentMockTime + currentTime));
89
+ }
346
90
  }
347
- };
348
- }
349
-
350
- function unstable_scheduleCallback(priorityLevel, callback, options) {
351
- var currentTime = getCurrentTime();
352
- var startTime;
353
-
354
- if (typeof options === 'object' && options !== null) {
355
- var delay = options.delay;
356
-
357
- if (typeof delay === 'number' && delay > 0) {
358
- startTime = currentTime + delay;
359
- } else {
360
- startTime = currentTime;
91
+ function flushWork(hasTimeRemaining, initialTime) {
92
+ isHostCallbackScheduled = !1;
93
+ isHostTimeoutScheduled &&
94
+ ((isHostTimeoutScheduled = !1),
95
+ (scheduledTimeout = null),
96
+ (timeoutTime = -1));
97
+ isPerformingWork = !0;
98
+ var previousPriorityLevel = currentPriorityLevel;
99
+ try {
100
+ a: {
101
+ advanceTimers(initialTime);
102
+ for (
103
+ currentTask = peek(taskQueue);
104
+ null !== currentTask &&
105
+ (!(currentTask.expirationTime > initialTime) ||
106
+ (hasTimeRemaining && !shouldYieldToHost()));
107
+
108
+ ) {
109
+ var callback = currentTask.callback;
110
+ if ("function" === typeof callback) {
111
+ currentTask.callback = null;
112
+ currentPriorityLevel = currentTask.priorityLevel;
113
+ var continuationCallback = callback(
114
+ currentTask.expirationTime <= initialTime
115
+ );
116
+ initialTime = currentMockTime;
117
+ if ("function" === typeof continuationCallback) {
118
+ if (
119
+ ((currentTask.callback = continuationCallback),
120
+ advanceTimers(initialTime),
121
+ shouldYieldForPaint)
122
+ ) {
123
+ var JSCompiler_inline_result = (needsPaint = !0);
124
+ break a;
125
+ }
126
+ } else
127
+ currentTask === peek(taskQueue) && pop(taskQueue),
128
+ advanceTimers(initialTime);
129
+ } else pop(taskQueue);
130
+ currentTask = peek(taskQueue);
131
+ }
132
+ if (null !== currentTask) JSCompiler_inline_result = !0;
133
+ else {
134
+ var firstTimer = peek(timerQueue);
135
+ if (null !== firstTimer) {
136
+ var ms = firstTimer.startTime - initialTime;
137
+ scheduledTimeout = handleTimeout;
138
+ timeoutTime = currentMockTime + ms;
139
+ }
140
+ JSCompiler_inline_result = !1;
141
+ }
142
+ }
143
+ return JSCompiler_inline_result;
144
+ } finally {
145
+ (currentTask = null),
146
+ (currentPriorityLevel = previousPriorityLevel),
147
+ (isPerformingWork = !1);
148
+ }
361
149
  }
362
- } else {
363
- startTime = currentTime;
364
- }
365
-
366
- var timeout;
367
-
368
- switch (priorityLevel) {
369
- case ImmediatePriority:
370
- timeout = IMMEDIATE_PRIORITY_TIMEOUT;
371
- break;
372
-
373
- case UserBlockingPriority:
374
- timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
375
- break;
376
-
377
- case IdlePriority:
378
- timeout = IDLE_PRIORITY_TIMEOUT;
379
- break;
380
-
381
- case LowPriority:
382
- timeout = LOW_PRIORITY_TIMEOUT;
383
- break;
384
-
385
- case NormalPriority:
386
- default:
387
- timeout = NORMAL_PRIORITY_TIMEOUT;
388
- break;
389
- }
390
-
391
- var expirationTime = startTime + timeout;
392
- var newTask = {
393
- id: taskIdCounter++,
394
- callback: callback,
395
- priorityLevel: priorityLevel,
396
- startTime: startTime,
397
- expirationTime: expirationTime,
398
- sortIndex: -1
399
- };
400
-
401
- if (startTime > currentTime) {
402
- // This is a delayed task.
403
- newTask.sortIndex = startTime;
404
- push(timerQueue, newTask);
405
-
406
- if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
407
- // All tasks are delayed, and this is the task with the earliest delay.
408
- if (isHostTimeoutScheduled) {
409
- // Cancel an existing timeout.
410
- cancelHostTimeout();
411
- } else {
412
- isHostTimeoutScheduled = true;
413
- } // Schedule a timeout.
414
-
415
-
416
- requestHostTimeout(handleTimeout, startTime - currentTime);
150
+ function shouldYieldToHost() {
151
+ return (0 === expectedNumberOfYields && null === yieldedValues) ||
152
+ (-1 !== expectedNumberOfYields &&
153
+ null !== yieldedValues &&
154
+ yieldedValues.length >= expectedNumberOfYields) ||
155
+ (shouldYieldForPaint && needsPaint)
156
+ ? (didStop = !0)
157
+ : !1;
417
158
  }
418
- } else {
419
- newTask.sortIndex = expirationTime;
420
- push(taskQueue, newTask);
421
- // wait until the next time we yield.
422
-
423
-
424
- if (!isHostCallbackScheduled && !isPerformingWork) {
425
- isHostCallbackScheduled = true;
426
- requestHostCallback(flushWork);
159
+ function unstable_flushAllWithoutAsserting() {
160
+ if (isFlushing) throw Error("Already flushing work.");
161
+ if (null !== scheduledCallback) {
162
+ var cb = scheduledCallback;
163
+ isFlushing = !0;
164
+ try {
165
+ var hasMoreWork = !0;
166
+ do hasMoreWork = cb(!0, currentMockTime);
167
+ while (hasMoreWork);
168
+ hasMoreWork || (scheduledCallback = null);
169
+ return !0;
170
+ } finally {
171
+ isFlushing = !1;
172
+ }
173
+ } else return !1;
427
174
  }
428
- }
429
-
430
- return newTask;
431
- }
432
-
433
- function unstable_pauseExecution() {
434
- }
435
-
436
- function unstable_continueExecution() {
437
-
438
- if (!isHostCallbackScheduled && !isPerformingWork) {
439
- isHostCallbackScheduled = true;
440
- requestHostCallback(flushWork);
441
- }
442
- }
443
-
444
- function unstable_getFirstCallbackNode() {
445
- return peek(taskQueue);
446
- }
447
-
448
- function unstable_cancelCallback(task) {
449
- // remove from the queue because you can't remove arbitrary nodes from an
450
- // array based heap, only the first one.)
451
-
452
-
453
- task.callback = null;
454
- }
455
-
456
- function unstable_getCurrentPriorityLevel() {
457
- return currentPriorityLevel;
458
- }
459
-
460
- function requestHostCallback(callback) {
461
- scheduledCallback = callback;
462
- }
463
-
464
- function requestHostTimeout(callback, ms) {
465
- scheduledTimeout = callback;
466
- timeoutTime = currentMockTime + ms;
467
- }
468
-
469
- function cancelHostTimeout() {
470
- scheduledTimeout = null;
471
- timeoutTime = -1;
472
- }
473
-
474
- function shouldYieldToHost() {
475
- if (expectedNumberOfYields === 0 && yieldedValues === null || expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) {
476
- // We yielded at least as many values as expected. Stop flushing.
477
- didStop = true;
478
- return true;
479
- }
480
-
481
- return false;
482
- }
483
-
484
- function getCurrentTime() {
485
- return currentMockTime;
486
- }
487
-
488
- function forceFrameRate() {// No-op
489
- }
490
-
491
- function reset() {
492
- if (isFlushing) {
493
- throw new Error('Cannot reset while already flushing work.');
494
- }
495
-
496
- currentMockTime = 0;
497
- scheduledCallback = null;
498
- scheduledTimeout = null;
499
- timeoutTime = -1;
500
- yieldedValues = null;
501
- expectedNumberOfYields = -1;
502
- didStop = false;
503
- isFlushing = false;
504
- needsPaint = false;
505
- } // Should only be used via an assertion helper that inspects the yielded values.
506
-
507
-
508
- function unstable_flushNumberOfYields(count) {
509
- if (isFlushing) {
510
- throw new Error('Already flushing work.');
511
- }
512
-
513
- if (scheduledCallback !== null) {
514
- var cb = scheduledCallback;
515
- expectedNumberOfYields = count;
516
- isFlushing = true;
517
-
518
- try {
519
- var hasMoreWork = true;
520
-
521
- do {
522
- hasMoreWork = cb(true, currentMockTime);
523
- } while (hasMoreWork && !didStop);
524
-
525
- if (!hasMoreWork) {
526
- scheduledCallback = null;
527
- }
528
- } finally {
175
+ var taskQueue = [],
176
+ timerQueue = [],
177
+ taskIdCounter = 1,
178
+ currentTask = null,
179
+ currentPriorityLevel = 3,
180
+ isPerformingWork = !1,
181
+ isHostCallbackScheduled = !1,
182
+ isHostTimeoutScheduled = !1,
183
+ currentMockTime = 0,
184
+ scheduledCallback = null,
185
+ scheduledTimeout = null,
186
+ timeoutTime = -1,
187
+ yieldedValues = null,
188
+ expectedNumberOfYields = -1,
189
+ didStop = !1,
190
+ isFlushing = !1,
191
+ needsPaint = !1,
192
+ shouldYieldForPaint = !1,
193
+ disableYieldValue = !1;
194
+ exports.log = function (value) {
195
+ "disabledLog" === console.log.name ||
196
+ disableYieldValue ||
197
+ (null === yieldedValues
198
+ ? (yieldedValues = [value])
199
+ : yieldedValues.push(value));
200
+ };
201
+ exports.reset = function () {
202
+ if (isFlushing) throw Error("Cannot reset while already flushing work.");
203
+ currentMockTime = 0;
204
+ scheduledTimeout = scheduledCallback = null;
205
+ timeoutTime = -1;
206
+ yieldedValues = null;
529
207
  expectedNumberOfYields = -1;
530
- didStop = false;
531
- isFlushing = false;
532
- }
533
- }
534
- }
535
-
536
- function unstable_flushUntilNextPaint() {
537
- if (isFlushing) {
538
- throw new Error('Already flushing work.');
539
- }
540
-
541
- if (scheduledCallback !== null) {
542
- var cb = scheduledCallback;
543
- shouldYieldForPaint = true;
544
- needsPaint = false;
545
- isFlushing = true;
546
-
547
- try {
548
- var hasMoreWork = true;
549
-
550
- do {
551
- hasMoreWork = cb(true, currentMockTime);
552
- } while (hasMoreWork && !didStop);
553
-
554
- if (!hasMoreWork) {
555
- scheduledCallback = null;
208
+ needsPaint = isFlushing = didStop = !1;
209
+ };
210
+ exports.unstable_IdlePriority = 5;
211
+ exports.unstable_ImmediatePriority = 1;
212
+ exports.unstable_LowPriority = 4;
213
+ exports.unstable_NormalPriority = 3;
214
+ exports.unstable_Profiling = null;
215
+ exports.unstable_UserBlockingPriority = 2;
216
+ exports.unstable_advanceTime = function (ms) {
217
+ "disabledLog" === console.log.name ||
218
+ disableYieldValue ||
219
+ ((currentMockTime += ms),
220
+ null !== scheduledTimeout &&
221
+ timeoutTime <= currentMockTime &&
222
+ (scheduledTimeout(currentMockTime),
223
+ (timeoutTime = -1),
224
+ (scheduledTimeout = null)));
225
+ };
226
+ exports.unstable_cancelCallback = function (task) {
227
+ task.callback = null;
228
+ };
229
+ exports.unstable_clearLog = function () {
230
+ if (null === yieldedValues) return [];
231
+ var values = yieldedValues;
232
+ yieldedValues = null;
233
+ return values;
234
+ };
235
+ exports.unstable_flushAll = function () {
236
+ if (null !== yieldedValues)
237
+ throw Error(
238
+ "Log is not empty. Assert on the log of yielded values before flushing additional work."
239
+ );
240
+ unstable_flushAllWithoutAsserting();
241
+ if (null !== yieldedValues)
242
+ throw Error(
243
+ "While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"
244
+ );
245
+ };
246
+ exports.unstable_flushAllWithoutAsserting =
247
+ unstable_flushAllWithoutAsserting;
248
+ exports.unstable_flushExpired = function () {
249
+ if (isFlushing) throw Error("Already flushing work.");
250
+ if (null !== scheduledCallback) {
251
+ isFlushing = !0;
252
+ try {
253
+ scheduledCallback(!1, currentMockTime) || (scheduledCallback = null);
254
+ } finally {
255
+ isFlushing = !1;
256
+ }
556
257
  }
557
- } finally {
558
- shouldYieldForPaint = false;
559
- didStop = false;
560
- isFlushing = false;
561
- }
562
- }
563
-
564
- return false;
565
- }
566
-
567
- function unstable_hasPendingWork() {
568
- return scheduledCallback !== null;
569
- }
570
-
571
- function unstable_flushExpired() {
572
- if (isFlushing) {
573
- throw new Error('Already flushing work.');
574
- }
575
-
576
- if (scheduledCallback !== null) {
577
- isFlushing = true;
578
-
579
- try {
580
- var hasMoreWork = scheduledCallback(false, currentMockTime);
581
-
582
- if (!hasMoreWork) {
583
- scheduledCallback = null;
258
+ };
259
+ exports.unstable_flushNumberOfYields = function (count) {
260
+ if (isFlushing) throw Error("Already flushing work.");
261
+ if (null !== scheduledCallback) {
262
+ var cb = scheduledCallback;
263
+ expectedNumberOfYields = count;
264
+ isFlushing = !0;
265
+ try {
266
+ count = !0;
267
+ do count = cb(!0, currentMockTime);
268
+ while (count && !didStop);
269
+ count || (scheduledCallback = null);
270
+ } finally {
271
+ (expectedNumberOfYields = -1), (isFlushing = didStop = !1);
272
+ }
584
273
  }
585
- } finally {
586
- isFlushing = false;
587
- }
588
- }
589
- }
590
-
591
- function unstable_flushAllWithoutAsserting() {
592
- // Returns false if no work was flushed.
593
- if (isFlushing) {
594
- throw new Error('Already flushing work.');
595
- }
596
-
597
- if (scheduledCallback !== null) {
598
- var cb = scheduledCallback;
599
- isFlushing = true;
600
-
601
- try {
602
- var hasMoreWork = true;
603
-
604
- do {
605
- hasMoreWork = cb(true, currentMockTime);
606
- } while (hasMoreWork);
607
-
608
- if (!hasMoreWork) {
609
- scheduledCallback = null;
274
+ };
275
+ exports.unstable_flushUntilNextPaint = function () {
276
+ if (isFlushing) throw Error("Already flushing work.");
277
+ if (null !== scheduledCallback) {
278
+ var cb = scheduledCallback;
279
+ shouldYieldForPaint = !0;
280
+ needsPaint = !1;
281
+ isFlushing = !0;
282
+ try {
283
+ var hasMoreWork = !0;
284
+ do hasMoreWork = cb(!0, currentMockTime);
285
+ while (hasMoreWork && !didStop);
286
+ hasMoreWork || (scheduledCallback = null);
287
+ } finally {
288
+ isFlushing = didStop = shouldYieldForPaint = !1;
289
+ }
610
290
  }
611
-
612
- return true;
613
- } finally {
614
- isFlushing = false;
615
- }
616
- } else {
617
- return false;
618
- }
619
- }
620
-
621
- function unstable_clearLog() {
622
- if (yieldedValues === null) {
623
- return [];
624
- }
625
-
626
- var values = yieldedValues;
627
- yieldedValues = null;
628
- return values;
629
- }
630
-
631
- function unstable_flushAll() {
632
- if (yieldedValues !== null) {
633
- throw new Error('Log is not empty. Assert on the log of yielded values before ' + 'flushing additional work.');
634
- }
635
-
636
- unstable_flushAllWithoutAsserting();
637
-
638
- if (yieldedValues !== null) {
639
- throw new Error('While flushing work, something yielded a value. Use an ' + 'assertion helper to assert on the log of yielded values, e.g. ' + 'expect(Scheduler).toFlushAndYield([...])');
640
- }
641
- }
642
-
643
- function log(value) {
644
- // eslint-disable-next-line react-internal/no-production-logging
645
- if (console.log.name === 'disabledLog' || disableYieldValue) {
646
- // If console.log has been patched, we assume we're in render
647
- // replaying and we ignore any values yielding in the second pass.
648
- return;
649
- }
650
-
651
- if (yieldedValues === null) {
652
- yieldedValues = [value];
653
- } else {
654
- yieldedValues.push(value);
655
- }
656
- }
657
-
658
- function unstable_advanceTime(ms) {
659
- // eslint-disable-next-line react-internal/no-production-logging
660
- if (console.log.name === 'disabledLog' || disableYieldValue) {
661
- // If console.log has been patched, we assume we're in render
662
- // replaying and we ignore any time advancing in the second pass.
663
- return;
664
- }
665
-
666
- currentMockTime += ms;
667
-
668
- if (scheduledTimeout !== null && timeoutTime <= currentMockTime) {
669
- scheduledTimeout(currentMockTime);
670
- timeoutTime = -1;
671
- scheduledTimeout = null;
672
- }
673
- }
674
-
675
- function requestPaint() {
676
- needsPaint = true;
677
- }
678
- var unstable_Profiling = null;
679
-
680
- exports.log = log;
681
- exports.reset = reset;
682
- exports.unstable_IdlePriority = IdlePriority;
683
- exports.unstable_ImmediatePriority = ImmediatePriority;
684
- exports.unstable_LowPriority = LowPriority;
685
- exports.unstable_NormalPriority = NormalPriority;
686
- exports.unstable_Profiling = unstable_Profiling;
687
- exports.unstable_UserBlockingPriority = UserBlockingPriority;
688
- exports.unstable_advanceTime = unstable_advanceTime;
689
- exports.unstable_cancelCallback = unstable_cancelCallback;
690
- exports.unstable_clearLog = unstable_clearLog;
691
- exports.unstable_continueExecution = unstable_continueExecution;
692
- exports.unstable_flushAll = unstable_flushAll;
693
- exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
694
- exports.unstable_flushExpired = unstable_flushExpired;
695
- exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields;
696
- exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint;
697
- exports.unstable_forceFrameRate = forceFrameRate;
698
- exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
699
- exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
700
- exports.unstable_hasPendingWork = unstable_hasPendingWork;
701
- exports.unstable_next = unstable_next;
702
- exports.unstable_now = getCurrentTime;
703
- exports.unstable_pauseExecution = unstable_pauseExecution;
704
- exports.unstable_requestPaint = requestPaint;
705
- exports.unstable_runWithPriority = unstable_runWithPriority;
706
- exports.unstable_scheduleCallback = unstable_scheduleCallback;
707
- exports.unstable_setDisableYieldValue = setDisableYieldValue;
708
- exports.unstable_shouldYield = shouldYieldToHost;
709
- exports.unstable_wrapCallback = unstable_wrapCallback;
291
+ return !1;
292
+ };
293
+ exports.unstable_forceFrameRate = function () {};
294
+ exports.unstable_getCurrentPriorityLevel = function () {
295
+ return currentPriorityLevel;
296
+ };
297
+ exports.unstable_hasPendingWork = function () {
298
+ return null !== scheduledCallback;
299
+ };
300
+ exports.unstable_next = function (eventHandler) {
301
+ switch (currentPriorityLevel) {
302
+ case 1:
303
+ case 2:
304
+ case 3:
305
+ var priorityLevel = 3;
306
+ break;
307
+ default:
308
+ priorityLevel = currentPriorityLevel;
309
+ }
310
+ var previousPriorityLevel = currentPriorityLevel;
311
+ currentPriorityLevel = priorityLevel;
312
+ try {
313
+ return eventHandler();
314
+ } finally {
315
+ currentPriorityLevel = previousPriorityLevel;
316
+ }
317
+ };
318
+ exports.unstable_now = function () {
319
+ return currentMockTime;
320
+ };
321
+ exports.unstable_requestPaint = function () {
322
+ needsPaint = !0;
323
+ };
324
+ exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
325
+ switch (priorityLevel) {
326
+ case 1:
327
+ case 2:
328
+ case 3:
329
+ case 4:
330
+ case 5:
331
+ break;
332
+ default:
333
+ priorityLevel = 3;
334
+ }
335
+ var previousPriorityLevel = currentPriorityLevel;
336
+ currentPriorityLevel = priorityLevel;
337
+ try {
338
+ return eventHandler();
339
+ } finally {
340
+ currentPriorityLevel = previousPriorityLevel;
341
+ }
342
+ };
343
+ exports.unstable_scheduleCallback = function (
344
+ priorityLevel,
345
+ callback,
346
+ options
347
+ ) {
348
+ var currentTime = currentMockTime;
349
+ "object" === typeof options && null !== options
350
+ ? ((options = options.delay),
351
+ (options =
352
+ "number" === typeof options && 0 < options
353
+ ? currentTime + options
354
+ : currentTime))
355
+ : (options = currentTime);
356
+ switch (priorityLevel) {
357
+ case 1:
358
+ var timeout = -1;
359
+ break;
360
+ case 2:
361
+ timeout = 250;
362
+ break;
363
+ case 5:
364
+ timeout = 1073741823;
365
+ break;
366
+ case 4:
367
+ timeout = 1e4;
368
+ break;
369
+ default:
370
+ timeout = 5e3;
371
+ }
372
+ timeout = options + timeout;
373
+ priorityLevel = {
374
+ id: taskIdCounter++,
375
+ callback: callback,
376
+ priorityLevel: priorityLevel,
377
+ startTime: options,
378
+ expirationTime: timeout,
379
+ sortIndex: -1
380
+ };
381
+ options > currentTime
382
+ ? ((priorityLevel.sortIndex = options),
383
+ push(timerQueue, priorityLevel),
384
+ null === peek(taskQueue) &&
385
+ priorityLevel === peek(timerQueue) &&
386
+ (isHostTimeoutScheduled
387
+ ? ((scheduledTimeout = null), (timeoutTime = -1))
388
+ : (isHostTimeoutScheduled = !0),
389
+ (scheduledTimeout = handleTimeout),
390
+ (timeoutTime = currentMockTime + (options - currentTime))))
391
+ : ((priorityLevel.sortIndex = timeout),
392
+ push(taskQueue, priorityLevel),
393
+ isHostCallbackScheduled ||
394
+ isPerformingWork ||
395
+ ((isHostCallbackScheduled = !0), (scheduledCallback = flushWork)));
396
+ return priorityLevel;
397
+ };
398
+ exports.unstable_setDisableYieldValue = function (newValue) {
399
+ disableYieldValue = newValue;
400
+ };
401
+ exports.unstable_shouldYield = shouldYieldToHost;
402
+ exports.unstable_wrapCallback = function (callback) {
403
+ var parentPriorityLevel = currentPriorityLevel;
404
+ return function () {
405
+ var previousPriorityLevel = currentPriorityLevel;
406
+ currentPriorityLevel = parentPriorityLevel;
407
+ try {
408
+ return callback.apply(this, arguments);
409
+ } finally {
410
+ currentPriorityLevel = previousPriorityLevel;
411
+ }
412
+ };
413
+ };
710
414
  })();
711
- }