@expo/cli 0.18.7 → 0.18.9
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.
- package/build/bin/cli +1 -1
- package/build/src/login/index.js +1 -2
- package/build/src/login/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +9 -1
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +2 -0
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +3 -3
- package/static/canary/react-is/cjs/react-is.development.js +200 -0
- package/static/canary/react-is/cjs/react-is.production.js +130 -0
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +22899 -24003
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +5190 -4270
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +5206 -4094
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +23165 -24313
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5298 -4377
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11347 -0
- package/static/canary/scheduler/cjs/scheduler-unstable_mock.development.js +711 -0
- package/static/canary/scheduler/cjs/scheduler-unstable_mock.production.js +415 -0
- package/static/canary/scheduler/cjs/scheduler-unstable_post_task.development.js +208 -0
- package/static/canary/scheduler/cjs/scheduler-unstable_post_task.production.js +145 -0
- package/static/canary/scheduler/cjs/scheduler.development.js +625 -0
- package/static/canary/scheduler/cjs/scheduler.native.development.js +538 -0
- package/static/canary/scheduler/cjs/scheduler.native.production.js +329 -0
- package/static/canary/scheduler/cjs/scheduler.production.js +341 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* scheduler-unstable_mock.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
function push(heap, node) {
|
|
13
|
+
var index = heap.length;
|
|
14
|
+
heap.push(node);
|
|
15
|
+
a: for (; 0 < index; ) {
|
|
16
|
+
var parentIndex = (index - 1) >>> 1,
|
|
17
|
+
parent = heap[parentIndex];
|
|
18
|
+
if (0 < compare(parent, node))
|
|
19
|
+
(heap[parentIndex] = node), (heap[index] = parent), (index = parentIndex);
|
|
20
|
+
else break a;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function peek(heap) {
|
|
24
|
+
return 0 === heap.length ? null : heap[0];
|
|
25
|
+
}
|
|
26
|
+
function pop(heap) {
|
|
27
|
+
if (0 === heap.length) return null;
|
|
28
|
+
var first = heap[0],
|
|
29
|
+
last = heap.pop();
|
|
30
|
+
if (last !== first) {
|
|
31
|
+
heap[0] = last;
|
|
32
|
+
a: for (
|
|
33
|
+
var index = 0, length = heap.length, halfLength = length >>> 1;
|
|
34
|
+
index < halfLength;
|
|
35
|
+
|
|
36
|
+
) {
|
|
37
|
+
var leftIndex = 2 * (index + 1) - 1,
|
|
38
|
+
left = heap[leftIndex],
|
|
39
|
+
rightIndex = leftIndex + 1,
|
|
40
|
+
right = heap[rightIndex];
|
|
41
|
+
if (0 > compare(left, last))
|
|
42
|
+
rightIndex < length && 0 > compare(right, left)
|
|
43
|
+
? ((heap[index] = right),
|
|
44
|
+
(heap[rightIndex] = last),
|
|
45
|
+
(index = rightIndex))
|
|
46
|
+
: ((heap[index] = left),
|
|
47
|
+
(heap[leftIndex] = last),
|
|
48
|
+
(index = leftIndex));
|
|
49
|
+
else if (rightIndex < length && 0 > compare(right, last))
|
|
50
|
+
(heap[index] = right), (heap[rightIndex] = last), (index = rightIndex);
|
|
51
|
+
else break a;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return first;
|
|
55
|
+
}
|
|
56
|
+
function compare(a, b) {
|
|
57
|
+
var diff = a.sortIndex - b.sortIndex;
|
|
58
|
+
return 0 !== diff ? diff : a.id - b.id;
|
|
59
|
+
}
|
|
60
|
+
var taskQueue = [],
|
|
61
|
+
timerQueue = [],
|
|
62
|
+
taskIdCounter = 1,
|
|
63
|
+
currentTask = null,
|
|
64
|
+
currentPriorityLevel = 3,
|
|
65
|
+
isPerformingWork = !1,
|
|
66
|
+
isHostCallbackScheduled = !1,
|
|
67
|
+
isHostTimeoutScheduled = !1,
|
|
68
|
+
currentMockTime = 0,
|
|
69
|
+
scheduledCallback = null,
|
|
70
|
+
scheduledTimeout = null,
|
|
71
|
+
timeoutTime = -1,
|
|
72
|
+
yieldedValues = null,
|
|
73
|
+
expectedNumberOfYields = -1,
|
|
74
|
+
didStop = !1,
|
|
75
|
+
isFlushing = !1,
|
|
76
|
+
needsPaint = !1,
|
|
77
|
+
shouldYieldForPaint = !1,
|
|
78
|
+
disableYieldValue = !1;
|
|
79
|
+
function advanceTimers(currentTime) {
|
|
80
|
+
for (var timer = peek(timerQueue); null !== timer; ) {
|
|
81
|
+
if (null === timer.callback) pop(timerQueue);
|
|
82
|
+
else if (timer.startTime <= currentTime)
|
|
83
|
+
pop(timerQueue),
|
|
84
|
+
(timer.sortIndex = timer.expirationTime),
|
|
85
|
+
push(taskQueue, timer);
|
|
86
|
+
else break;
|
|
87
|
+
timer = peek(timerQueue);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function handleTimeout(currentTime) {
|
|
91
|
+
isHostTimeoutScheduled = !1;
|
|
92
|
+
advanceTimers(currentTime);
|
|
93
|
+
if (!isHostCallbackScheduled)
|
|
94
|
+
if (null !== peek(taskQueue))
|
|
95
|
+
(isHostCallbackScheduled = !0), (scheduledCallback = flushWork);
|
|
96
|
+
else {
|
|
97
|
+
var firstTimer = peek(timerQueue);
|
|
98
|
+
null !== firstTimer &&
|
|
99
|
+
((currentTime = firstTimer.startTime - currentTime),
|
|
100
|
+
(scheduledTimeout = handleTimeout),
|
|
101
|
+
(timeoutTime = currentMockTime + currentTime));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function flushWork(hasTimeRemaining, initialTime) {
|
|
105
|
+
isHostCallbackScheduled = !1;
|
|
106
|
+
isHostTimeoutScheduled &&
|
|
107
|
+
((isHostTimeoutScheduled = !1),
|
|
108
|
+
(scheduledTimeout = null),
|
|
109
|
+
(timeoutTime = -1));
|
|
110
|
+
isPerformingWork = !0;
|
|
111
|
+
var previousPriorityLevel = currentPriorityLevel;
|
|
112
|
+
try {
|
|
113
|
+
a: {
|
|
114
|
+
advanceTimers(initialTime);
|
|
115
|
+
for (
|
|
116
|
+
currentTask = peek(taskQueue);
|
|
117
|
+
null !== currentTask &&
|
|
118
|
+
(!(currentTask.expirationTime > initialTime) ||
|
|
119
|
+
(hasTimeRemaining && !shouldYieldToHost()));
|
|
120
|
+
|
|
121
|
+
) {
|
|
122
|
+
var callback = currentTask.callback;
|
|
123
|
+
if ("function" === typeof callback) {
|
|
124
|
+
currentTask.callback = null;
|
|
125
|
+
currentPriorityLevel = currentTask.priorityLevel;
|
|
126
|
+
var continuationCallback = callback(
|
|
127
|
+
currentTask.expirationTime <= initialTime
|
|
128
|
+
);
|
|
129
|
+
initialTime = currentMockTime;
|
|
130
|
+
if ("function" === typeof continuationCallback) {
|
|
131
|
+
if (
|
|
132
|
+
((currentTask.callback = continuationCallback),
|
|
133
|
+
advanceTimers(initialTime),
|
|
134
|
+
shouldYieldForPaint)
|
|
135
|
+
) {
|
|
136
|
+
var JSCompiler_inline_result = (needsPaint = !0);
|
|
137
|
+
break a;
|
|
138
|
+
}
|
|
139
|
+
} else
|
|
140
|
+
currentTask === peek(taskQueue) && pop(taskQueue),
|
|
141
|
+
advanceTimers(initialTime);
|
|
142
|
+
} else pop(taskQueue);
|
|
143
|
+
currentTask = peek(taskQueue);
|
|
144
|
+
}
|
|
145
|
+
if (null !== currentTask) JSCompiler_inline_result = !0;
|
|
146
|
+
else {
|
|
147
|
+
var firstTimer = peek(timerQueue);
|
|
148
|
+
if (null !== firstTimer) {
|
|
149
|
+
var ms = firstTimer.startTime - initialTime;
|
|
150
|
+
scheduledTimeout = handleTimeout;
|
|
151
|
+
timeoutTime = currentMockTime + ms;
|
|
152
|
+
}
|
|
153
|
+
JSCompiler_inline_result = !1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return JSCompiler_inline_result;
|
|
157
|
+
} finally {
|
|
158
|
+
(currentTask = null),
|
|
159
|
+
(currentPriorityLevel = previousPriorityLevel),
|
|
160
|
+
(isPerformingWork = !1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function shouldYieldToHost() {
|
|
164
|
+
return (0 === expectedNumberOfYields && null === yieldedValues) ||
|
|
165
|
+
(-1 !== expectedNumberOfYields &&
|
|
166
|
+
null !== yieldedValues &&
|
|
167
|
+
yieldedValues.length >= expectedNumberOfYields) ||
|
|
168
|
+
(shouldYieldForPaint && needsPaint)
|
|
169
|
+
? (didStop = !0)
|
|
170
|
+
: !1;
|
|
171
|
+
}
|
|
172
|
+
function unstable_flushAllWithoutAsserting() {
|
|
173
|
+
if (isFlushing) throw Error("Already flushing work.");
|
|
174
|
+
if (null !== scheduledCallback) {
|
|
175
|
+
var cb = scheduledCallback;
|
|
176
|
+
isFlushing = !0;
|
|
177
|
+
try {
|
|
178
|
+
var hasMoreWork = !0;
|
|
179
|
+
do hasMoreWork = cb(!0, currentMockTime);
|
|
180
|
+
while (hasMoreWork);
|
|
181
|
+
hasMoreWork || (scheduledCallback = null);
|
|
182
|
+
return !0;
|
|
183
|
+
} finally {
|
|
184
|
+
isFlushing = !1;
|
|
185
|
+
}
|
|
186
|
+
} else return !1;
|
|
187
|
+
}
|
|
188
|
+
exports.log = function (value) {
|
|
189
|
+
"disabledLog" === console.log.name ||
|
|
190
|
+
disableYieldValue ||
|
|
191
|
+
(null === yieldedValues
|
|
192
|
+
? (yieldedValues = [value])
|
|
193
|
+
: yieldedValues.push(value));
|
|
194
|
+
};
|
|
195
|
+
exports.reset = function () {
|
|
196
|
+
if (isFlushing) throw Error("Cannot reset while already flushing work.");
|
|
197
|
+
currentMockTime = 0;
|
|
198
|
+
scheduledTimeout = scheduledCallback = null;
|
|
199
|
+
timeoutTime = -1;
|
|
200
|
+
yieldedValues = null;
|
|
201
|
+
expectedNumberOfYields = -1;
|
|
202
|
+
needsPaint = isFlushing = didStop = !1;
|
|
203
|
+
};
|
|
204
|
+
exports.unstable_IdlePriority = 5;
|
|
205
|
+
exports.unstable_ImmediatePriority = 1;
|
|
206
|
+
exports.unstable_LowPriority = 4;
|
|
207
|
+
exports.unstable_NormalPriority = 3;
|
|
208
|
+
exports.unstable_Profiling = null;
|
|
209
|
+
exports.unstable_UserBlockingPriority = 2;
|
|
210
|
+
exports.unstable_advanceTime = function (ms) {
|
|
211
|
+
"disabledLog" === console.log.name ||
|
|
212
|
+
disableYieldValue ||
|
|
213
|
+
((currentMockTime += ms),
|
|
214
|
+
null !== scheduledTimeout &&
|
|
215
|
+
timeoutTime <= currentMockTime &&
|
|
216
|
+
(scheduledTimeout(currentMockTime),
|
|
217
|
+
(timeoutTime = -1),
|
|
218
|
+
(scheduledTimeout = null)));
|
|
219
|
+
};
|
|
220
|
+
exports.unstable_cancelCallback = function (task) {
|
|
221
|
+
task.callback = null;
|
|
222
|
+
};
|
|
223
|
+
exports.unstable_clearLog = function () {
|
|
224
|
+
if (null === yieldedValues) return [];
|
|
225
|
+
var values = yieldedValues;
|
|
226
|
+
yieldedValues = null;
|
|
227
|
+
return values;
|
|
228
|
+
};
|
|
229
|
+
exports.unstable_continueExecution = function () {
|
|
230
|
+
isHostCallbackScheduled ||
|
|
231
|
+
isPerformingWork ||
|
|
232
|
+
((isHostCallbackScheduled = !0), (scheduledCallback = flushWork));
|
|
233
|
+
};
|
|
234
|
+
exports.unstable_flushAll = function () {
|
|
235
|
+
if (null !== yieldedValues)
|
|
236
|
+
throw Error(
|
|
237
|
+
"Log is not empty. Assert on the log of yielded values before flushing additional work."
|
|
238
|
+
);
|
|
239
|
+
unstable_flushAllWithoutAsserting();
|
|
240
|
+
if (null !== yieldedValues)
|
|
241
|
+
throw Error(
|
|
242
|
+
"While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
|
|
246
|
+
exports.unstable_flushExpired = function () {
|
|
247
|
+
if (isFlushing) throw Error("Already flushing work.");
|
|
248
|
+
if (null !== scheduledCallback) {
|
|
249
|
+
isFlushing = !0;
|
|
250
|
+
try {
|
|
251
|
+
scheduledCallback(!1, currentMockTime) || (scheduledCallback = null);
|
|
252
|
+
} finally {
|
|
253
|
+
isFlushing = !1;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
exports.unstable_flushNumberOfYields = function (count) {
|
|
258
|
+
if (isFlushing) throw Error("Already flushing work.");
|
|
259
|
+
if (null !== scheduledCallback) {
|
|
260
|
+
var cb = scheduledCallback;
|
|
261
|
+
expectedNumberOfYields = count;
|
|
262
|
+
isFlushing = !0;
|
|
263
|
+
try {
|
|
264
|
+
count = !0;
|
|
265
|
+
do count = cb(!0, currentMockTime);
|
|
266
|
+
while (count && !didStop);
|
|
267
|
+
count || (scheduledCallback = null);
|
|
268
|
+
} finally {
|
|
269
|
+
(expectedNumberOfYields = -1), (isFlushing = didStop = !1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
exports.unstable_flushUntilNextPaint = function () {
|
|
274
|
+
if (isFlushing) throw Error("Already flushing work.");
|
|
275
|
+
if (null !== scheduledCallback) {
|
|
276
|
+
var cb = scheduledCallback;
|
|
277
|
+
shouldYieldForPaint = !0;
|
|
278
|
+
needsPaint = !1;
|
|
279
|
+
isFlushing = !0;
|
|
280
|
+
try {
|
|
281
|
+
var hasMoreWork = !0;
|
|
282
|
+
do hasMoreWork = cb(!0, currentMockTime);
|
|
283
|
+
while (hasMoreWork && !didStop);
|
|
284
|
+
hasMoreWork || (scheduledCallback = null);
|
|
285
|
+
} finally {
|
|
286
|
+
isFlushing = didStop = shouldYieldForPaint = !1;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return !1;
|
|
290
|
+
};
|
|
291
|
+
exports.unstable_forceFrameRate = function () {};
|
|
292
|
+
exports.unstable_getCurrentPriorityLevel = function () {
|
|
293
|
+
return currentPriorityLevel;
|
|
294
|
+
};
|
|
295
|
+
exports.unstable_getFirstCallbackNode = function () {
|
|
296
|
+
return peek(taskQueue);
|
|
297
|
+
};
|
|
298
|
+
exports.unstable_hasPendingWork = function () {
|
|
299
|
+
return null !== scheduledCallback;
|
|
300
|
+
};
|
|
301
|
+
exports.unstable_next = function (eventHandler) {
|
|
302
|
+
switch (currentPriorityLevel) {
|
|
303
|
+
case 1:
|
|
304
|
+
case 2:
|
|
305
|
+
case 3:
|
|
306
|
+
var priorityLevel = 3;
|
|
307
|
+
break;
|
|
308
|
+
default:
|
|
309
|
+
priorityLevel = currentPriorityLevel;
|
|
310
|
+
}
|
|
311
|
+
var previousPriorityLevel = currentPriorityLevel;
|
|
312
|
+
currentPriorityLevel = priorityLevel;
|
|
313
|
+
try {
|
|
314
|
+
return eventHandler();
|
|
315
|
+
} finally {
|
|
316
|
+
currentPriorityLevel = previousPriorityLevel;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
exports.unstable_now = function () {
|
|
320
|
+
return currentMockTime;
|
|
321
|
+
};
|
|
322
|
+
exports.unstable_pauseExecution = function () {};
|
|
323
|
+
exports.unstable_requestPaint = function () {
|
|
324
|
+
needsPaint = !0;
|
|
325
|
+
};
|
|
326
|
+
exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
|
|
327
|
+
switch (priorityLevel) {
|
|
328
|
+
case 1:
|
|
329
|
+
case 2:
|
|
330
|
+
case 3:
|
|
331
|
+
case 4:
|
|
332
|
+
case 5:
|
|
333
|
+
break;
|
|
334
|
+
default:
|
|
335
|
+
priorityLevel = 3;
|
|
336
|
+
}
|
|
337
|
+
var previousPriorityLevel = currentPriorityLevel;
|
|
338
|
+
currentPriorityLevel = priorityLevel;
|
|
339
|
+
try {
|
|
340
|
+
return eventHandler();
|
|
341
|
+
} finally {
|
|
342
|
+
currentPriorityLevel = previousPriorityLevel;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
exports.unstable_scheduleCallback = function (
|
|
346
|
+
priorityLevel,
|
|
347
|
+
callback,
|
|
348
|
+
options
|
|
349
|
+
) {
|
|
350
|
+
var currentTime = currentMockTime;
|
|
351
|
+
"object" === typeof options && null !== options
|
|
352
|
+
? ((options = options.delay),
|
|
353
|
+
(options =
|
|
354
|
+
"number" === typeof options && 0 < options
|
|
355
|
+
? currentTime + options
|
|
356
|
+
: currentTime))
|
|
357
|
+
: (options = currentTime);
|
|
358
|
+
switch (priorityLevel) {
|
|
359
|
+
case 1:
|
|
360
|
+
var timeout = -1;
|
|
361
|
+
break;
|
|
362
|
+
case 2:
|
|
363
|
+
timeout = 250;
|
|
364
|
+
break;
|
|
365
|
+
case 5:
|
|
366
|
+
timeout = 1073741823;
|
|
367
|
+
break;
|
|
368
|
+
case 4:
|
|
369
|
+
timeout = 1e4;
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
timeout = 5e3;
|
|
373
|
+
}
|
|
374
|
+
timeout = options + timeout;
|
|
375
|
+
priorityLevel = {
|
|
376
|
+
id: taskIdCounter++,
|
|
377
|
+
callback: callback,
|
|
378
|
+
priorityLevel: priorityLevel,
|
|
379
|
+
startTime: options,
|
|
380
|
+
expirationTime: timeout,
|
|
381
|
+
sortIndex: -1
|
|
382
|
+
};
|
|
383
|
+
options > currentTime
|
|
384
|
+
? ((priorityLevel.sortIndex = options),
|
|
385
|
+
push(timerQueue, priorityLevel),
|
|
386
|
+
null === peek(taskQueue) &&
|
|
387
|
+
priorityLevel === peek(timerQueue) &&
|
|
388
|
+
(isHostTimeoutScheduled
|
|
389
|
+
? ((scheduledTimeout = null), (timeoutTime = -1))
|
|
390
|
+
: (isHostTimeoutScheduled = !0),
|
|
391
|
+
(scheduledTimeout = handleTimeout),
|
|
392
|
+
(timeoutTime = currentMockTime + (options - currentTime))))
|
|
393
|
+
: ((priorityLevel.sortIndex = timeout),
|
|
394
|
+
push(taskQueue, priorityLevel),
|
|
395
|
+
isHostCallbackScheduled ||
|
|
396
|
+
isPerformingWork ||
|
|
397
|
+
((isHostCallbackScheduled = !0), (scheduledCallback = flushWork)));
|
|
398
|
+
return priorityLevel;
|
|
399
|
+
};
|
|
400
|
+
exports.unstable_setDisableYieldValue = function (newValue) {
|
|
401
|
+
disableYieldValue = newValue;
|
|
402
|
+
};
|
|
403
|
+
exports.unstable_shouldYield = shouldYieldToHost;
|
|
404
|
+
exports.unstable_wrapCallback = function (callback) {
|
|
405
|
+
var parentPriorityLevel = currentPriorityLevel;
|
|
406
|
+
return function () {
|
|
407
|
+
var previousPriorityLevel = currentPriorityLevel;
|
|
408
|
+
currentPriorityLevel = parentPriorityLevel;
|
|
409
|
+
try {
|
|
410
|
+
return callback.apply(this, arguments);
|
|
411
|
+
} finally {
|
|
412
|
+
currentPriorityLevel = previousPriorityLevel;
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* scheduler-unstable_post_task.development.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
if (process.env.NODE_ENV !== "production") {
|
|
14
|
+
(function() {
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
// TODO: Use symbols?
|
|
18
|
+
var ImmediatePriority = 1;
|
|
19
|
+
var UserBlockingPriority = 2;
|
|
20
|
+
var NormalPriority = 3;
|
|
21
|
+
var LowPriority = 4;
|
|
22
|
+
var IdlePriority = 5;
|
|
23
|
+
|
|
24
|
+
var perf = window.performance;
|
|
25
|
+
var setTimeout = window.setTimeout; // Use experimental Chrome Scheduler postTask API.
|
|
26
|
+
|
|
27
|
+
var scheduler = global.scheduler;
|
|
28
|
+
var getCurrentTime = perf.now.bind(perf);
|
|
29
|
+
var unstable_now = getCurrentTime; // Scheduler periodically yields in case there is other work on the main
|
|
30
|
+
// thread, like user events. By default, it yields multiple times per frame.
|
|
31
|
+
// It does not attempt to align with frame boundaries, since most tasks don't
|
|
32
|
+
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
|
33
|
+
|
|
34
|
+
var yieldInterval = 5;
|
|
35
|
+
var deadline = 0;
|
|
36
|
+
var currentPriorityLevel_DEPRECATED = NormalPriority; // Always yield at the end of the frame.
|
|
37
|
+
|
|
38
|
+
function unstable_shouldYield() {
|
|
39
|
+
return getCurrentTime() >= deadline;
|
|
40
|
+
}
|
|
41
|
+
function unstable_requestPaint() {// Since we yield every frame regardless, `requestPaint` has no effect.
|
|
42
|
+
}
|
|
43
|
+
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
44
|
+
var postTaskPriority;
|
|
45
|
+
|
|
46
|
+
switch (priorityLevel) {
|
|
47
|
+
case ImmediatePriority:
|
|
48
|
+
case UserBlockingPriority:
|
|
49
|
+
postTaskPriority = 'user-blocking';
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case LowPriority:
|
|
53
|
+
case NormalPriority:
|
|
54
|
+
postTaskPriority = 'user-visible';
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case IdlePriority:
|
|
58
|
+
postTaskPriority = 'background';
|
|
59
|
+
break;
|
|
60
|
+
|
|
61
|
+
default:
|
|
62
|
+
postTaskPriority = 'user-visible';
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var controller = new TaskController({
|
|
67
|
+
priority: postTaskPriority
|
|
68
|
+
});
|
|
69
|
+
var postTaskOptions = {
|
|
70
|
+
delay: typeof options === 'object' && options !== null ? options.delay : 0,
|
|
71
|
+
signal: controller.signal
|
|
72
|
+
};
|
|
73
|
+
var node = {
|
|
74
|
+
_controller: controller
|
|
75
|
+
};
|
|
76
|
+
scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, callback), postTaskOptions).catch(handleAbortError);
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function runTask(priorityLevel, postTaskPriority, node, callback) {
|
|
81
|
+
deadline = getCurrentTime() + yieldInterval;
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
currentPriorityLevel_DEPRECATED = priorityLevel;
|
|
85
|
+
var didTimeout_DEPRECATED = false;
|
|
86
|
+
var result = callback(didTimeout_DEPRECATED);
|
|
87
|
+
|
|
88
|
+
if (typeof result === 'function') {
|
|
89
|
+
// Assume this is a continuation
|
|
90
|
+
var continuation = result;
|
|
91
|
+
var continuationOptions = {
|
|
92
|
+
signal: node._controller.signal
|
|
93
|
+
};
|
|
94
|
+
var nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation);
|
|
95
|
+
|
|
96
|
+
if (scheduler.yield !== undefined) {
|
|
97
|
+
scheduler.yield(continuationOptions).then(nextTask).catch(handleAbortError);
|
|
98
|
+
} else {
|
|
99
|
+
scheduler.postTask(nextTask, continuationOptions).catch(handleAbortError);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
// We're inside a `postTask` promise. If we don't handle this error, then it
|
|
104
|
+
// will trigger an "Unhandled promise rejection" error. We don't want that,
|
|
105
|
+
// but we do want the default error reporting behavior that normal
|
|
106
|
+
// (non-Promise) tasks get for unhandled errors.
|
|
107
|
+
//
|
|
108
|
+
// So we'll re-throw the error inside a regular browser task.
|
|
109
|
+
setTimeout(function () {
|
|
110
|
+
throw error;
|
|
111
|
+
});
|
|
112
|
+
} finally {
|
|
113
|
+
currentPriorityLevel_DEPRECATED = NormalPriority;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function handleAbortError(error) {// Abort errors are an implementation detail. We don't expose the
|
|
118
|
+
// TaskController to the user, nor do we expose the promise that is returned
|
|
119
|
+
// from `postTask`. So we should suppress them, since there's no way for the
|
|
120
|
+
// user to handle them.
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function unstable_cancelCallback(node) {
|
|
124
|
+
var controller = node._controller;
|
|
125
|
+
controller.abort();
|
|
126
|
+
}
|
|
127
|
+
function unstable_runWithPriority(priorityLevel, callback) {
|
|
128
|
+
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
|
129
|
+
currentPriorityLevel_DEPRECATED = priorityLevel;
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
return callback();
|
|
133
|
+
} finally {
|
|
134
|
+
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function unstable_getCurrentPriorityLevel() {
|
|
138
|
+
return currentPriorityLevel_DEPRECATED;
|
|
139
|
+
}
|
|
140
|
+
function unstable_next(callback) {
|
|
141
|
+
var priorityLevel;
|
|
142
|
+
|
|
143
|
+
switch (currentPriorityLevel_DEPRECATED) {
|
|
144
|
+
case ImmediatePriority:
|
|
145
|
+
case UserBlockingPriority:
|
|
146
|
+
case NormalPriority:
|
|
147
|
+
// Shift down to normal priority
|
|
148
|
+
priorityLevel = NormalPriority;
|
|
149
|
+
break;
|
|
150
|
+
|
|
151
|
+
default:
|
|
152
|
+
// Anything lower than normal priority should remain at the current level.
|
|
153
|
+
priorityLevel = currentPriorityLevel_DEPRECATED;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
|
158
|
+
currentPriorityLevel_DEPRECATED = priorityLevel;
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
return callback();
|
|
162
|
+
} finally {
|
|
163
|
+
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function unstable_wrapCallback(callback) {
|
|
167
|
+
var parentPriorityLevel = currentPriorityLevel_DEPRECATED;
|
|
168
|
+
return function () {
|
|
169
|
+
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
|
170
|
+
currentPriorityLevel_DEPRECATED = parentPriorityLevel;
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
return callback();
|
|
174
|
+
} finally {
|
|
175
|
+
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function unstable_forceFrameRate() {}
|
|
180
|
+
function unstable_pauseExecution() {}
|
|
181
|
+
function unstable_continueExecution() {}
|
|
182
|
+
function unstable_getFirstCallbackNode() {
|
|
183
|
+
return null;
|
|
184
|
+
} // Currently no profiling build
|
|
185
|
+
|
|
186
|
+
var unstable_Profiling = null;
|
|
187
|
+
|
|
188
|
+
exports.unstable_IdlePriority = IdlePriority;
|
|
189
|
+
exports.unstable_ImmediatePriority = ImmediatePriority;
|
|
190
|
+
exports.unstable_LowPriority = LowPriority;
|
|
191
|
+
exports.unstable_NormalPriority = NormalPriority;
|
|
192
|
+
exports.unstable_Profiling = unstable_Profiling;
|
|
193
|
+
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
|
194
|
+
exports.unstable_cancelCallback = unstable_cancelCallback;
|
|
195
|
+
exports.unstable_continueExecution = unstable_continueExecution;
|
|
196
|
+
exports.unstable_forceFrameRate = unstable_forceFrameRate;
|
|
197
|
+
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
|
198
|
+
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
|
199
|
+
exports.unstable_next = unstable_next;
|
|
200
|
+
exports.unstable_now = unstable_now;
|
|
201
|
+
exports.unstable_pauseExecution = unstable_pauseExecution;
|
|
202
|
+
exports.unstable_requestPaint = unstable_requestPaint;
|
|
203
|
+
exports.unstable_runWithPriority = unstable_runWithPriority;
|
|
204
|
+
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
|
205
|
+
exports.unstable_shouldYield = unstable_shouldYield;
|
|
206
|
+
exports.unstable_wrapCallback = unstable_wrapCallback;
|
|
207
|
+
})();
|
|
208
|
+
}
|