Socket
Socket
Sign inDemoInstall

scheduler

Package Overview
Dependencies
0
Maintainers
4
Versions
1641
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-5cccacd13-20211101 to 0.0.0-experimental-5d29478716-20240506

cjs/scheduler-unstable_mock.production.js

64

cjs/scheduler-unstable_mock.development.js

@@ -1,5 +0,6 @@

/** @license React vundefined
/**
* @license React
* scheduler-unstable_mock.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -205,15 +206,3 @@ * This source code is licensed under the MIT license found in the

try {
if (enableProfiling) {
try {
return workLoop(hasTimeRemaining, initialTime);
} catch (error) {
if (currentTask !== null) {
var currentTime = getCurrentTime();
markTaskErrored(currentTask, currentTime);
currentTask.isQueued = false;
}
throw error;
}
} else {
var currentTime; if (enableProfiling) ; else {
// No catch in prod code path.

@@ -238,9 +227,13 @@ return workLoop(hasTimeRemaining, initialTime);

break;
}
} // $FlowFixMe[incompatible-use] found when upgrading Flow
var callback = currentTask.callback;
if (typeof callback === 'function') {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
// $FlowFixMe[incompatible-use] found when upgrading Flow
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;

@@ -252,3 +245,13 @@

if (typeof continuationCallback === 'function') {
// If a continuation is returned, immediately yield to the main thread
// regardless of how much time is left in the current time slice.
// $FlowFixMe[incompatible-use] found when upgrading Flow
currentTask.callback = continuationCallback;
advanceTimers(currentTime);
if (shouldYieldForPaint) {
needsPaint = true;
return true;
}
} else {

@@ -259,5 +262,5 @@

}
advanceTimers(currentTime);
}
advanceTimers(currentTime);
} else {

@@ -335,3 +338,5 @@ pop(taskQueue);

function unstable_wrapCallback(callback) {
var parentPriorityLevel = currentPriorityLevel;
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
// $FlowFixMe[missing-this-annot]
return function () {

@@ -563,4 +568,10 @@ // This is a fork of runWithPriority, inlined for performance.

}
return false;
}
function unstable_hasPendingWork() {
return scheduledCallback !== null;
}
function unstable_flushExpired() {

@@ -616,3 +627,3 @@ if (isFlushing) {

function unstable_clearYields() {
function unstable_clearLog() {
if (yieldedValues === null) {

@@ -639,3 +650,3 @@ return [];

function unstable_yieldValue(value) {
function log(value) {
// eslint-disable-next-line react-internal/no-production-logging

@@ -675,4 +686,5 @@ if (console.log.name === 'disabledLog' || disableYieldValue) {

}
var unstable_Profiling = null;
var unstable_Profiling = null;
exports.log = log;
exports.reset = reset;

@@ -687,3 +699,3 @@ exports.unstable_IdlePriority = IdlePriority;

exports.unstable_cancelCallback = unstable_cancelCallback;
exports.unstable_clearYields = unstable_clearYields;
exports.unstable_clearLog = unstable_clearLog;
exports.unstable_continueExecution = unstable_continueExecution;

@@ -698,2 +710,3 @@ exports.unstable_flushAll = unstable_flushAll;

exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
exports.unstable_hasPendingWork = unstable_hasPendingWork;
exports.unstable_next = unstable_next;

@@ -708,4 +721,3 @@ exports.unstable_now = getCurrentTime;

exports.unstable_wrapCallback = unstable_wrapCallback;
exports.unstable_yieldValue = unstable_yieldValue;
})();
}

@@ -1,5 +0,6 @@

/** @license React vundefined
/**
* @license React
* scheduler-unstable_post_task.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -35,4 +36,3 @@ * This source code is licensed under the MIT license found in the

var deadline = 0;
var currentPriorityLevel_DEPRECATED = NormalPriority; // `isInputPending` is not available. Since we have no way of knowing if
// there's pending input, always yield at the end of the frame.
var currentPriorityLevel_DEPRECATED = NormalPriority; // Always yield at the end of the frame.

@@ -67,5 +67,6 @@ function unstable_shouldYield() {

var controller = new TaskController();
var controller = new TaskController({
priority: postTaskPriority
});
var postTaskOptions = {
priority: postTaskPriority,
delay: typeof options === 'object' && options !== null ? options.delay : 0,

@@ -86,4 +87,4 @@ signal: controller.signal

currentPriorityLevel_DEPRECATED = priorityLevel;
var _didTimeout_DEPRECATED = false;
var result = callback(_didTimeout_DEPRECATED);
var didTimeout_DEPRECATED = false;
var result = callback(didTimeout_DEPRECATED);

@@ -93,11 +94,12 @@ if (typeof result === 'function') {

var continuation = result;
var continuationController = new TaskController();
var continuationOptions = {
priority: postTaskPriority,
signal: continuationController.signal
}; // Update the original callback node's controller, since even though we're
// posting a new task, conceptually it's the same one.
signal: node._controller.signal
};
var nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation);
node._controller = continuationController;
scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, continuation), continuationOptions).catch(handleAbortError);
if (scheduler.yield !== undefined) {
scheduler.yield(continuationOptions).then(nextTask).catch(handleAbortError);
} else {
scheduler.postTask(nextTask, continuationOptions).catch(handleAbortError);
}
}

@@ -104,0 +106,0 @@ } catch (error) {

@@ -1,5 +0,6 @@

/** @license React vundefined
/**
* @license React
* scheduler.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -14,14 +15,3 @@ * This source code is licensed under the MIT license found in the

(function() {
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
// Don't require this file directly; it's embedded by Rollup during build.
'use strict';
if (

@@ -34,7 +24,8 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
'use strict';
var enableSchedulerDebugging = false;
var enableProfiling = false;
var frameYieldMs = 5;
var userBlockingPriorityTimeout = 250;
var normalPriorityTimeout = 5000;
var lowPriorityTimeout = 10000;

@@ -133,5 +124,6 @@ function push(heap, node) {

/* eslint-disable no-var */
exports.unstable_now = void 0;
var hasPerformanceNow = // $FlowFixMe[method-unbinding]
typeof performance === 'object' && typeof performance.now === 'function';
var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
if (hasPerformanceNow) {

@@ -155,12 +147,4 @@ var localPerformance = performance;

var maxSigned31BitInt = 1073741823; // Times out immediately
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
var NORMAL_PRIORITY_TIMEOUT = 5000;
var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap
var taskQueue = [];

@@ -181,4 +165,2 @@ var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.

var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
function advanceTimers(currentTime) {

@@ -213,3 +195,3 @@ // Check for tasks that are no longer delayed and add them to the queue.

isHostCallbackScheduled = true;
requestHostCallback(flushWork);
requestHostCallback();
} else {

@@ -225,3 +207,3 @@ var firstTimer = peek(timerQueue);

function flushWork(hasTimeRemaining, initialTime) {
function flushWork(initialTime) {

@@ -241,17 +223,5 @@

try {
if (enableProfiling) {
try {
return workLoop(hasTimeRemaining, initialTime);
} catch (error) {
if (currentTask !== null) {
var currentTime = exports.unstable_now();
markTaskErrored(currentTask, currentTime);
currentTask.isQueued = false;
}
throw error;
}
} else {
var currentTime; if (enableProfiling) ; else {
// No catch in prod code path.
return workLoop(hasTimeRemaining, initialTime);
return workLoop(initialTime);
}

@@ -265,3 +235,3 @@ } finally {

function workLoop(hasTimeRemaining, initialTime) {
function workLoop(initialTime) {
var currentTime = initialTime;

@@ -272,12 +242,16 @@ advanceTimers(currentTime);

while (currentTask !== null && !(enableSchedulerDebugging )) {
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
// This currentTask hasn't expired, and we've reached the deadline.
break;
}
} // $FlowFixMe[incompatible-use] found when upgrading Flow
var callback = currentTask.callback;
if (typeof callback === 'function') {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
// $FlowFixMe[incompatible-use] found when upgrading Flow
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;

@@ -289,3 +263,9 @@

if (typeof continuationCallback === 'function') {
// If a continuation is returned, immediately yield to the main thread
// regardless of how much time is left in the current time slice.
// $FlowFixMe[incompatible-use] found when upgrading Flow
currentTask.callback = continuationCallback;
advanceTimers(currentTime);
return true;
} else {

@@ -296,5 +276,5 @@

}
advanceTimers(currentTime);
}
advanceTimers(currentTime);
} else {

@@ -372,3 +352,5 @@ pop(taskQueue);

function unstable_wrapCallback(callback) {
var parentPriorityLevel = currentPriorityLevel;
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
// $FlowFixMe[missing-this-annot]
return function () {

@@ -407,15 +389,19 @@ // This is a fork of runWithPriority, inlined for performance.

case ImmediatePriority:
timeout = IMMEDIATE_PRIORITY_TIMEOUT;
// Times out immediately
timeout = -1;
break;
case UserBlockingPriority:
timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
// Eventually times out
timeout = userBlockingPriorityTimeout;
break;
case IdlePriority:
timeout = IDLE_PRIORITY_TIMEOUT;
// Never times out
timeout = maxSigned31BitInt;
break;
case LowPriority:
timeout = LOW_PRIORITY_TIMEOUT;
// Eventually times out
timeout = lowPriorityTimeout;
break;

@@ -425,3 +411,4 @@

default:
timeout = NORMAL_PRIORITY_TIMEOUT;
// Eventually times out
timeout = normalPriorityTimeout;
break;

@@ -465,3 +452,3 @@ }

isHostCallbackScheduled = true;
requestHostCallback(flushWork);
requestHostCallback();
}

@@ -480,3 +467,3 @@ }

isHostCallbackScheduled = true;
requestHostCallback(flushWork);
requestHostCallback();
}

@@ -502,3 +489,2 @@ }

var isMessageLoopRunning = false;
var scheduledHostCallback = null;
var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main

@@ -519,3 +505,3 @@ // thread, like user events. By default, it yields multiple times per frame.

return false;
} // The main thread has been blocked for a non-negligible amount of time. We
} // Yield now.

@@ -526,6 +512,4 @@

function requestPaint() {
function requestPaint() {}
}
function forceFrameRate(fps) {

@@ -547,13 +531,12 @@ if (fps < 0 || fps > 125) {

var performWorkUntilDeadline = function () {
if (scheduledHostCallback !== null) {
if (isMessageLoopRunning) {
var currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread
// has been blocked.
startTime = currentTime;
var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the
// error can be observed.
//
// Intentionally not using a try-catch, since that makes some debugging
// techniques harder. Instead, if `scheduledHostCallback` errors, then
// `hasMoreWork` will remain true, and we'll continue the work loop.
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
// remain true, and we'll continue the work loop.

@@ -563,3 +546,3 @@ var hasMoreWork = true;

try {
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
hasMoreWork = flushWork(currentTime);
} finally {

@@ -572,8 +555,5 @@ if (hasMoreWork) {

isMessageLoopRunning = false;
scheduledHostCallback = null;
}
}
} else {
isMessageLoopRunning = false;
} // Yielding to the browser will give it a chance to paint, so we can
}
};

@@ -611,2 +591,3 @@

schedulePerformWorkUntilDeadline = function () {
// $FlowFixMe[not-a-function] nullable value
localSetTimeout(performWorkUntilDeadline, 0);

@@ -616,5 +597,3 @@ };

function requestHostCallback(callback) {
scheduledHostCallback = callback;
function requestHostCallback() {
if (!isMessageLoopRunning) {

@@ -627,2 +606,3 @@ isMessageLoopRunning = true;

function requestHostTimeout(callback, ms) {
// $FlowFixMe[not-a-function] nullable value
taskTimeoutID = localSetTimeout(function () {

@@ -634,9 +614,8 @@ callback(exports.unstable_now());

function cancelHostTimeout() {
// $FlowFixMe[not-a-function] nullable value
localClearTimeout(taskTimeoutID);
taskTimeoutID = -1;
}
var unstable_Profiling = null;
var unstable_requestPaint = requestPaint;
var unstable_Profiling = null;
exports.unstable_IdlePriority = IdlePriority;

@@ -655,3 +634,3 @@ exports.unstable_ImmediatePriority = ImmediatePriority;

exports.unstable_pauseExecution = unstable_pauseExecution;
exports.unstable_requestPaint = unstable_requestPaint;
exports.unstable_requestPaint = requestPaint;
exports.unstable_runWithPriority = unstable_runWithPriority;

@@ -661,13 +640,2 @@ exports.unstable_scheduleCallback = unstable_scheduleCallback;

exports.unstable_wrapCallback = unstable_wrapCallback;
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
// Don't require this file directly; it's embedded by Rollup during build.
if (

@@ -680,4 +648,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/scheduler.production.min.js');
module.exports = require('./cjs/scheduler.production.js');
} else {
module.exports = require('./cjs/scheduler.development.js');
}
{
"name": "scheduler",
"version": "0.0.0-experimental-5cccacd13-20211101",
"version": "0.0.0-experimental-5d29478716-20240506",
"description": "Cooperative scheduler for the browser environment.",
"main": "index.js",
"repository": {

@@ -18,22 +17,12 @@ "type": "git",

},
"homepage": "https://reactjs.org/",
"dependencies": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
},
"homepage": "https://react.dev/",
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"index.native.js",
"unstable_mock.js",
"unstable_post_task.js",
"cjs/",
"umd/"
],
"browserify": {
"transform": [
"loose-envify"
]
}
"cjs/"
]
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/scheduler-unstable_mock.production.min.js');
module.exports = require('./cjs/scheduler-unstable_mock.production.js');
} else {
module.exports = require('./cjs/scheduler-unstable_mock.development.js');
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/scheduler-unstable_post_task.production.min.js');
module.exports = require('./cjs/scheduler-unstable_post_task.production.js');
} else {
module.exports = require('./cjs/scheduler-unstable_post_task.development.js');
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc