Socket
Socket
Sign inDemoInstall

scheduler

Package Overview
Dependencies
Maintainers
4
Versions
1832
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scheduler - npm Package Compare versions

Comparing version 0.0.0-experimental-cb8afda18-20210708 to 0.0.0-experimental-cc1ec60d0d-20240607

cjs/scheduler-unstable_mock.production.js

76

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.
*

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

var currentTask = null;
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.

@@ -145,3 +146,8 @@ var isPerformingWork = false;

var shouldYieldForPaint = false;
var disableYieldValue = false;
function setDisableYieldValue(newValue) {
disableYieldValue = newValue;
}
function advanceTimers(currentTime) {

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

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.

@@ -235,9 +229,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;

@@ -249,3 +247,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 {

@@ -256,5 +264,5 @@

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

@@ -332,3 +340,5 @@ pop(taskQueue);

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

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

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

@@ -613,3 +629,3 @@ if (isFlushing) {

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

@@ -636,5 +652,5 @@ return [];

function unstable_yieldValue(value) {
function log(value) {
// eslint-disable-next-line react-internal/no-production-logging
if (console.log.name === 'disabledLog') {
if (console.log.name === 'disabledLog' || disableYieldValue) {
// If console.log has been patched, we assume we're in render

@@ -654,3 +670,3 @@ // replaying and we ignore any values yielding in the second pass.

// eslint-disable-next-line react-internal/no-production-logging
if (console.log.name === 'disabledLog') {
if (console.log.name === 'disabledLog' || disableYieldValue) {
// If console.log has been patched, we assume we're in render

@@ -673,4 +689,5 @@ // replaying and we ignore any time advancing in the second pass.

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

@@ -685,3 +702,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;

@@ -696,2 +713,3 @@ exports.unstable_flushAll = unstable_flushAll;

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

@@ -703,6 +721,6 @@ exports.unstable_now = getCurrentTime;

exports.unstable_scheduleCallback = unstable_scheduleCallback;
exports.unstable_setDisableYieldValue = setDisableYieldValue;
exports.unstable_shouldYield = shouldYieldToHost;
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.
*

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

'use strict';
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
'function'
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var enableSchedulerDebugging = false;
var enableProfiling = false;
var frameYieldMs = 5;
var userBlockingPriorityTimeout = 250;
var normalPriorityTimeout = 5000;
var lowPriorityTimeout = 10000;

@@ -112,5 +123,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) {

@@ -134,12 +146,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 = [];

@@ -150,3 +154,3 @@ var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.

var currentTask = null;
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.

@@ -190,3 +194,3 @@ var isPerformingWork = false;

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

@@ -202,3 +206,3 @@ var firstTimer = peek(timerQueue);

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

@@ -218,17 +222,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);
}

@@ -242,3 +234,3 @@ } finally {

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

@@ -249,12 +241,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;

@@ -266,3 +262,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 {

@@ -273,5 +275,5 @@

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

@@ -349,3 +351,5 @@ pop(taskQueue);

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

@@ -384,15 +388,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;

@@ -402,3 +410,4 @@

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

@@ -442,3 +451,3 @@ }

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

@@ -457,3 +466,3 @@ }

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

@@ -479,3 +488,2 @@ }

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

@@ -486,17 +494,20 @@ // thread, like user events. By default, it yields multiple times per frame.

var yieldInterval = 5;
var deadline = 0; // TODO: Make this configurable
var frameInterval = frameYieldMs;
var startTime = -1;
function shouldYieldToHost() {
{
// `isInputPending` is not available. Since we have no way of knowing if
// there's pending input, always yield at the end of the frame.
return exports.unstable_now() >= deadline;
}
}
var timeElapsed = exports.unstable_now() - startTime;
function requestPaint() {
if (timeElapsed < frameInterval) {
// The main thread has only been blocked for a really short amount of time;
// smaller than a single frame. Don't yield yet.
return false;
} // Yield now.
return true;
}
function requestPaint() {}
function forceFrameRate(fps) {

@@ -510,6 +521,6 @@ if (fps < 0 || fps > 125) {

if (fps > 0) {
yieldInterval = Math.floor(1000 / fps);
frameInterval = Math.floor(1000 / fps);
} else {
// reset the framerate
yieldInterval = 5;
frameInterval = frameYieldMs;
}

@@ -519,14 +530,12 @@ }

var performWorkUntilDeadline = function () {
if (scheduledHostCallback !== null) {
var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync
// cycle. This means there's always time remaining at the beginning of
// the message event.
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.
deadline = currentTime + yieldInterval;
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.

@@ -536,3 +545,3 @@ var hasMoreWork = true;

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

@@ -545,8 +554,5 @@ if (hasMoreWork) {

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

@@ -584,2 +590,3 @@

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

@@ -589,5 +596,3 @@ };

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

@@ -600,2 +605,3 @@ isMessageLoopRunning = true;

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

@@ -607,9 +613,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;

@@ -628,3 +633,3 @@ exports.unstable_ImmediatePriority = ImmediatePriority;

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

@@ -634,3 +639,11 @@ exports.unstable_scheduleCallback = unstable_scheduleCallback;

exports.unstable_wrapCallback = unstable_wrapCallback;
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
'function'
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}
})();
}
'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-cb8afda18-20210708",
"version": "0.0.0-experimental-cc1ec60d0d-20240607",
"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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc