diff --git a/fixtures/schedule/index.html b/fixtures/scheduler/index.html similarity index 98% rename from fixtures/schedule/index.html rename to fixtures/scheduler/index.html index 9d22d50931593..a9ae2ded7ef46 100644 --- a/fixtures/schedule/index.html +++ b/fixtures/scheduler/index.html @@ -2,7 +2,7 @@ - Schedule Test Page + Scheduler Test Page -

Schedule Fixture

+

Scheduler Fixture

This fixture is for manual testing purposes, and the patterns used in implementing it should not be used as a model. This is mainly for anyone @@ -89,14 +89,15 @@

Tests:

If the counter advanced while you were away from this tab, it's correct.
- + + - + + diff --git a/fixtures/tracing/script.js b/fixtures/tracing/script.js index 06113d030173d..309efcf2a7725 100644 --- a/fixtures/tracing/script.js +++ b/fixtures/tracing/script.js @@ -28,15 +28,15 @@ function runAllTests() { function checkSchedulerAPI() { runTest(document.getElementById('checkSchedulerAPI'), () => { if ( - typeof Schedule === 'undefined' || - typeof Schedule.unstable_now !== 'function' || - typeof Schedule.unstable_scheduleWork !== 'function' || - typeof Schedule.unstable_cancelScheduledWork !== 'function' + typeof Scheduler === 'undefined' || + typeof Scheduler.unstable_now !== 'function' || + typeof Scheduler.unstable_scheduleWork !== 'function' || + typeof Scheduler.unstable_cancelScheduledWork !== 'function' ) { throw 'API is not defined'; } - if (Schedule.unstable_now() !== performance.now()) { + if (Scheduler.unstable_now() !== performance.now()) { throw 'API does not work'; } @@ -47,20 +47,20 @@ function checkSchedulerAPI() { function checkSchedulerTracingAPI() { runTest(document.getElementById('checkSchedulerTracingAPI'), () => { if ( - typeof ScheduleTracing === 'undefined' || - typeof ScheduleTracing.unstable_clear !== 'function' || - typeof ScheduleTracing.unstable_getCurrent !== 'function' || - typeof ScheduleTracing.unstable_getThreadID !== 'function' || - typeof ScheduleTracing.unstable_trace !== 'function' || - typeof ScheduleTracing.unstable_wrap !== 'function' + typeof SchedulerTracing === 'undefined' || + typeof SchedulerTracing.unstable_clear !== 'function' || + typeof SchedulerTracing.unstable_getCurrent !== 'function' || + typeof SchedulerTracing.unstable_getThreadID !== 'function' || + typeof SchedulerTracing.unstable_trace !== 'function' || + typeof SchedulerTracing.unstable_wrap !== 'function' ) { throw 'API is not defined'; } try { let interactionsSet; - ScheduleTracing.unstable_trace('test', 123, () => { - interactionsSet = ScheduleTracing.unstable_getCurrent(); + SchedulerTracing.unstable_trace('test', 123, () => { + interactionsSet = SchedulerTracing.unstable_getCurrent(); }); if (interactionsSet.size !== 1) { throw null; @@ -74,10 +74,10 @@ function checkSchedulerTracingAPI() { } const ForwardedSchedulerTracing = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing; + React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing; if ( - ScheduleTracing.unstable_getThreadID() === + SchedulerTracing.unstable_getThreadID() === ForwardedSchedulerTracing.unstable_getThreadID() ) { throw 'API forwarding is broken'; @@ -90,9 +90,9 @@ function checkSchedulerTracingSubscriptionsAPI() { document.getElementById('checkSchedulerTracingSubscriptionsAPI'), () => { if ( - typeof ScheduleTracing === 'undefined' || - typeof ScheduleTracing.unstable_subscribe !== 'function' || - typeof ScheduleTracing.unstable_unsubscribe !== 'function' + typeof SchedulerTracing === 'undefined' || + typeof SchedulerTracing.unstable_subscribe !== 'function' || + typeof SchedulerTracing.unstable_unsubscribe !== 'function' ) { throw 'API is not defined'; } @@ -114,9 +114,9 @@ function checkSchedulerTracingSubscriptionsAPI() { }; try { - ScheduleTracing.unstable_subscribe(subscriber); - ScheduleTracing.unstable_trace('foo', 123, () => {}); - ScheduleTracing.unstable_unsubscribe(subscriber); + SchedulerTracing.unstable_subscribe(subscriber); + SchedulerTracing.unstable_trace('foo', 123, () => {}); + SchedulerTracing.unstable_unsubscribe(subscriber); if (onInteractionTracedCalls.length !== 1) { throw null; } @@ -124,7 +124,7 @@ function checkSchedulerTracingSubscriptionsAPI() { if (interaction.name !== 'foo' || interaction.timestamp !== 123) { throw null; } - ScheduleTracing.unstable_trace('bar', 456, () => {}); + SchedulerTracing.unstable_trace('bar', 456, () => {}); if (onInteractionTracedCalls.length !== 1) { throw null; } @@ -134,13 +134,13 @@ function checkSchedulerTracingSubscriptionsAPI() { const ForwardedSchedulerTracing = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .ScheduleTracing; + .SchedulerTracing; try { ForwardedSchedulerTracing.unstable_subscribe(subscriber); - ScheduleTracing.unstable_trace('foo', 123, () => {}); + SchedulerTracing.unstable_trace('foo', 123, () => {}); ForwardedSchedulerTracing.unstable_trace('bar', 456, () => {}); - ScheduleTracing.unstable_unsubscribe(subscriber); + SchedulerTracing.unstable_unsubscribe(subscriber); if (onInteractionTracedCalls.length !== 3) { throw null; } @@ -172,7 +172,7 @@ function checkEndToEndIntegration() { const onRender = (...args) => onRenderCalls.push(args); const container = document.createElement('div'); - ScheduleTracing.unstable_trace('render', 123, () => { + SchedulerTracing.unstable_trace('render', 123, () => { ReactDOM.render( React.createElement( React.unstable_Profiler, diff --git a/fixtures/unstable-async/suspense/src/components/App.js b/fixtures/unstable-async/suspense/src/components/App.js index b62d1646f12fd..82198ce8d8c79 100644 --- a/fixtures/unstable-async/suspense/src/components/App.js +++ b/fixtures/unstable-async/suspense/src/components/App.js @@ -1,6 +1,9 @@ import React, {Placeholder, PureComponent} from 'react'; -import {unstable_scheduleWork} from 'schedule'; -import {unstable_trace as trace, unstable_wrap as wrap} from 'schedule/tracing'; +import {unstable_scheduleWork} from 'scheduler'; +import { + unstable_trace as trace, + unstable_wrap as wrap, +} from 'scheduler/tracing'; import {createResource} from 'simple-cache-provider'; import {cache} from '../cache'; import Spinner from './Spinner'; diff --git a/fixtures/unstable-async/suspense/src/index.js b/fixtures/unstable-async/suspense/src/index.js index 622b5c92e3979..d6287c50daa5c 100644 --- a/fixtures/unstable-async/suspense/src/index.js +++ b/fixtures/unstable-async/suspense/src/index.js @@ -1,6 +1,6 @@ import React, {Fragment, PureComponent} from 'react'; import {unstable_createRoot, render} from 'react-dom'; -import {unstable_trace as trace} from 'schedule/tracing'; +import {unstable_trace as trace} from 'scheduler/tracing'; import {cache} from './cache'; import { setFakeRequestTime, diff --git a/fixtures/unstable-async/time-slicing/README.md b/fixtures/unstable-async/time-slicing/README.md index d2bbd291bc6ab..538bc259e2dec 100644 --- a/fixtures/unstable-async/time-slicing/README.md +++ b/fixtures/unstable-async/time-slicing/README.md @@ -18,7 +18,7 @@ There are also known bugs and inefficiencies in master so **don't use this fixtu # 1: Build react from source cd /path/to/react yarn -yarn build dom-client,core,simple-cache-provider,schedule --type=NODE +yarn build dom-client,core,simple-cache-provider,scheduler --type=NODE # 2: Install fixture dependencies cd fixtures/unstable-async/time-slicing/ diff --git a/fixtures/unstable-async/time-slicing/src/index.js b/fixtures/unstable-async/time-slicing/src/index.js index 4ac0cb8ff4a3a..291bc8ab13fe5 100644 --- a/fixtures/unstable-async/time-slicing/src/index.js +++ b/fixtures/unstable-async/time-slicing/src/index.js @@ -1,6 +1,6 @@ import React, {PureComponent} from 'react'; import {flushSync, render} from 'react-dom'; -import {unstable_scheduleWork} from 'schedule'; +import {unstable_scheduleWork} from 'scheduler'; import _ from 'lodash'; import Charts from './Charts'; import Clock from './Clock'; diff --git a/packages/react-art/package.json b/packages/react-art/package.json index 0277cdc8660be..78daa8273509c 100644 --- a/packages/react-art/package.json +++ b/packages/react-art/package.json @@ -23,7 +23,7 @@ "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "peerDependencies": { "react": "^16.0.0" diff --git a/packages/react-art/src/ReactARTHostConfig.js b/packages/react-art/src/ReactARTHostConfig.js index 8afef7410a30d..ea75201cb4872 100644 --- a/packages/react-art/src/ReactARTHostConfig.js +++ b/packages/react-art/src/ReactARTHostConfig.js @@ -9,7 +9,7 @@ export { unstable_now as now, unstable_scheduleWork as scheduleDeferredCallback, unstable_cancelScheduledWork as cancelDeferredCallback, -} from 'schedule'; +} from 'scheduler'; import Transform from 'art/core/transform'; import Mode from 'art/modes/current'; import invariant from 'shared/invariant'; diff --git a/packages/react-dom/package.json b/packages/react-dom/package.json index 0b9c999555cd8..5706ca6d7779a 100644 --- a/packages/react-dom/package.json +++ b/packages/react-dom/package.json @@ -16,7 +16,7 @@ "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "peerDependencies": { "react": "^16.0.0" diff --git a/packages/react-dom/src/client/ReactDOMHostConfig.js b/packages/react-dom/src/client/ReactDOMHostConfig.js index 423a54f004d1f..fedb694200c9a 100644 --- a/packages/react-dom/src/client/ReactDOMHostConfig.js +++ b/packages/react-dom/src/client/ReactDOMHostConfig.js @@ -64,7 +64,7 @@ export { unstable_now as now, unstable_scheduleWork as scheduleDeferredCallback, unstable_cancelScheduledWork as cancelDeferredCallback, -} from 'schedule'; +} from 'scheduler'; let SUPPRESS_HYDRATION_WARNING; if (__DEV__) { diff --git a/packages/react-native-renderer/package.json b/packages/react-native-renderer/package.json index 96302c1465cfb..f0d95ad57e718 100644 --- a/packages/react-native-renderer/package.json +++ b/packages/react-native-renderer/package.json @@ -6,7 +6,7 @@ "dependencies": { "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "peerDependencies": { "react": "^16.0.0" diff --git a/packages/react-reconciler/package.json b/packages/react-reconciler/package.json index c45ec1f813be2..db7aebeb046a6 100644 --- a/packages/react-reconciler/package.json +++ b/packages/react-reconciler/package.json @@ -28,7 +28,7 @@ "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "browserify": { "transform": [ diff --git a/packages/react-reconciler/src/ReactFiberRoot.js b/packages/react-reconciler/src/ReactFiberRoot.js index d9af7688f789b..aa43e82c57dfb 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.js +++ b/packages/react-reconciler/src/ReactFiberRoot.js @@ -10,13 +10,13 @@ import type {Fiber} from './ReactFiber'; import type {ExpirationTime} from './ReactFiberExpirationTime'; import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig'; -import type {Interaction} from 'schedule/src/Tracing'; +import type {Interaction} from 'scheduler/src/Tracing'; import {noTimeout} from './ReactFiberHostConfig'; import {createHostRootFiber} from './ReactFiber'; import {NoWork} from './ReactFiberExpirationTime'; import {enableSchedulerTracing} from 'shared/ReactFeatureFlags'; -import {unstable_getThreadID} from 'schedule/tracing'; +import {unstable_getThreadID} from 'scheduler/tracing'; /* eslint-disable no-use-before-define */ // TODO: This should be lifted into the renderer. diff --git a/packages/react-reconciler/src/ReactFiberScheduler.js b/packages/react-reconciler/src/ReactFiberScheduler.js index 533d2e3fd9dbe..d5860628f0d4e 100644 --- a/packages/react-reconciler/src/ReactFiberScheduler.js +++ b/packages/react-reconciler/src/ReactFiberScheduler.js @@ -10,9 +10,9 @@ import type {Fiber} from './ReactFiber'; import type {Batch, FiberRoot} from './ReactFiberRoot'; import type {ExpirationTime} from './ReactFiberExpirationTime'; -import type {Interaction} from 'schedule/src/Tracing'; +import type {Interaction} from 'scheduler/src/Tracing'; -import {__interactionsRef, __subscriberRef} from 'schedule/tracing'; +import {__interactionsRef, __subscriberRef} from 'scheduler/tracing'; import { invokeGuardedCallback, hasCaughtError, diff --git a/packages/react-reconciler/src/__tests__/ReactTracing-test.internal.js b/packages/react-reconciler/src/__tests__/ReactTracing-test.internal.js index 258facfbeb5da..3228614fee0a9 100644 --- a/packages/react-reconciler/src/__tests__/ReactTracing-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactTracing-test.internal.js @@ -17,7 +17,7 @@ describe('ReactTracing', () => { const ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.enableSchedulerTracing = false; - require('schedule/tracing'); + require('scheduler/tracing'); ReactFeatureFlags.enableSchedulerTracing = true; diff --git a/packages/react-test-renderer/package.json b/packages/react-test-renderer/package.json index 76b60366c849b..e5627e265540d 100644 --- a/packages/react-test-renderer/package.json +++ b/packages/react-test-renderer/package.json @@ -18,7 +18,7 @@ "object-assign": "^4.1.1", "prop-types": "^15.6.2", "react-is": "^16.5.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "peerDependencies": { "react": "^16.0.0" diff --git a/packages/react/package.json b/packages/react/package.json index 7c774fd27b954..8c5b3f3c93608 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -24,7 +24,7 @@ "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "schedule": "^0.5.0" + "scheduler": "^0.9.0" }, "browserify": { "transform": [ diff --git a/packages/react/src/ReactSharedInternals.js b/packages/react/src/ReactSharedInternals.js index d72669275634a..34db8d778ae71 100644 --- a/packages/react/src/ReactSharedInternals.js +++ b/packages/react/src/ReactSharedInternals.js @@ -10,7 +10,7 @@ import { unstable_cancelScheduledWork, unstable_now, unstable_scheduleWork, -} from 'schedule'; +} from 'scheduler'; import { __interactionsRef, __subscriberRef, @@ -21,7 +21,7 @@ import { unstable_trace, unstable_unsubscribe, unstable_wrap, -} from 'schedule/tracing'; +} from 'scheduler/tracing'; import ReactCurrentOwner from './ReactCurrentOwner'; import ReactDebugCurrentFrame from './ReactDebugCurrentFrame'; @@ -38,12 +38,12 @@ if (__UMD__) { // This re-export is only required for UMD bundles; // CJS bundles use the shared NPM package. Object.assign(ReactSharedInternals, { - Schedule: { + Scheduler: { unstable_cancelScheduledWork, unstable_now, unstable_scheduleWork, }, - ScheduleTracing: { + SchedulerTracing: { __interactionsRef, __subscriberRef, unstable_clear, diff --git a/packages/react/src/__tests__/ReactProfiler-test.internal.js b/packages/react/src/__tests__/ReactProfiler-test.internal.js index eeede71999faa..bfb4e19bf3650 100644 --- a/packages/react/src/__tests__/ReactProfiler-test.internal.js +++ b/packages/react/src/__tests__/ReactProfiler-test.internal.js @@ -42,7 +42,7 @@ function loadModules({ ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = replayFailedUnitOfWorkWithInvokeGuardedCallback; React = require('react'); - SchedulerTracing = require('schedule/tracing'); + SchedulerTracing = require('scheduler/tracing'); if (useNoopRenderer) { ReactNoop = require('react-noop-renderer'); @@ -1460,7 +1460,7 @@ describe('Profiler', () => { ); expect(onInteractionScheduledWorkCompleted).not.toHaveBeenCalled(); - // The schedule/tracing package will notify of work started for the default thread, + // The scheduler/tracing package will notify of work started for the default thread, // But React shouldn't notify until it's been flushed. expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0); expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0); @@ -1518,7 +1518,7 @@ describe('Profiler', () => { // Update state again to verify our traced interaction isn't registered twice instance.setState({count: 2}); - // The schedule/tracing package will notify of work started for the default thread, + // The scheduler/tracing package will notify of work started for the default thread, // But React shouldn't notify until it's been flushed. expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0); expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0); @@ -1621,7 +1621,7 @@ describe('Profiler', () => { ); expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(2); - // The schedule/tracing package will notify of work started for the default thread, + // The scheduler/tracing package will notify of work started for the default thread, // But React shouldn't notify until it's been flushed. expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(0); expect(getWorkForReactThreads(onWorkStopped)).toHaveLength(0); @@ -1799,7 +1799,7 @@ describe('Profiler', () => { expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(1); // Work might be started multiple times before being completed. - // This is okay; it's part of the schedule/tracing contract. + // This is okay; it's part of the scheduler/tracing contract. expect(getWorkForReactThreads(onWorkStarted)).toHaveLength(3); expect(getWorkForReactThreads(onWorkStarted)[1][0]).toMatchInteractions( [interactionLowPri, interactionHighPri], diff --git a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js index 72478df0a37fa..3e486eefa36aa 100644 --- a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js @@ -39,7 +39,7 @@ describe('ReactProfiler DevTools integration', () => { ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.enableProfilerTimer = true; ReactFeatureFlags.enableSchedulerTracing = true; - SchedulerTracing = require('schedule/tracing'); + SchedulerTracing = require('scheduler/tracing'); React = require('react'); ReactTestRenderer = require('react-test-renderer'); diff --git a/packages/schedule/npm/index.js b/packages/schedule/npm/index.js deleted file mode 100644 index eb2ab2662e5c4..0000000000000 --- a/packages/schedule/npm/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/schedule.production.min.js'); -} else { - module.exports = require('./cjs/schedule.development.js'); -} diff --git a/packages/schedule/npm/tracing-profiling.js b/packages/schedule/npm/tracing-profiling.js deleted file mode 100644 index f704f9ba13e81..0000000000000 --- a/packages/schedule/npm/tracing-profiling.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/schedule-tracing.profiling.min.js'); -} else { - module.exports = require('./cjs/schedule-tracing.development.js'); -} diff --git a/packages/schedule/npm/tracing.js b/packages/schedule/npm/tracing.js deleted file mode 100644 index f33597849d8a7..0000000000000 --- a/packages/schedule/npm/tracing.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/schedule-tracing.production.min.js'); -} else { - module.exports = require('./cjs/schedule-tracing.development.js'); -} diff --git a/packages/schedule/README.md b/packages/scheduler/README.md similarity index 63% rename from packages/schedule/README.md rename to packages/scheduler/README.md index 8c3d157025154..10e4937a05b96 100644 --- a/packages/schedule/README.md +++ b/packages/scheduler/README.md @@ -1,4 +1,4 @@ -# `schedule` +# `scheduler` This is a package for cooperative scheduling in a browser environment. It is currently used internally by React, but we plan to make it more generic. @@ -6,4 +6,4 @@ The public API for this package is not yet finalized. ### Thanks -The React team thanks [Haoliang Gao](https://github.com/popomore) for donating the `schedule` package name. +The React team thanks [Anton Podviaznikov](https://podviaznikov.com/) for donating the `scheduler` package name. diff --git a/packages/schedule/index.js b/packages/scheduler/index.js similarity index 86% rename from packages/schedule/index.js rename to packages/scheduler/index.js index 35fb937f17473..aa14495a61abf 100644 --- a/packages/schedule/index.js +++ b/packages/scheduler/index.js @@ -7,4 +7,4 @@ 'use strict'; -export * from './src/Schedule'; +export * from './src/Scheduler'; diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js new file mode 100644 index 0000000000000..77770b0c219e2 --- /dev/null +++ b/packages/scheduler/npm/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); +} else { + module.exports = require('./cjs/scheduler.development.js'); +} diff --git a/packages/scheduler/npm/tracing-profiling.js b/packages/scheduler/npm/tracing-profiling.js new file mode 100644 index 0000000000000..cb2d20c025226 --- /dev/null +++ b/packages/scheduler/npm/tracing-profiling.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler-tracing.profiling.min.js'); +} else { + module.exports = require('./cjs/scheduler-tracing.development.js'); +} diff --git a/packages/scheduler/npm/tracing.js b/packages/scheduler/npm/tracing.js new file mode 100644 index 0000000000000..1e318bd901b5d --- /dev/null +++ b/packages/scheduler/npm/tracing.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler-tracing.production.min.js'); +} else { + module.exports = require('./cjs/scheduler-tracing.development.js'); +} diff --git a/packages/schedule/npm/umd/schedule-tracing.development.js b/packages/scheduler/npm/umd/scheduler-tracing.development.js similarity index 81% rename from packages/schedule/npm/umd/schedule-tracing.development.js rename to packages/scheduler/npm/umd/scheduler-tracing.development.js index e361c64ac666e..f793ead9cc5c7 100644 --- a/packages/schedule/npm/umd/schedule-tracing.development.js +++ b/packages/scheduler/npm/umd/scheduler-tracing.development.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.ScheduleTracing = factory(global)); + : (global.SchedulerTracing = factory(global)); })(this, function(global) { function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( this, arguments ); } function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( this, arguments ); } function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( this, arguments ); @@ -39,14 +39,14 @@ function unstable_subscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( this, arguments ); } function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( this, arguments ); @@ -54,14 +54,14 @@ function unstable_unsubscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( this, arguments ); } function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( this, arguments ); diff --git a/packages/schedule/npm/umd/schedule-tracing.production.min.js b/packages/scheduler/npm/umd/scheduler-tracing.production.min.js similarity index 81% rename from packages/schedule/npm/umd/schedule-tracing.production.min.js rename to packages/scheduler/npm/umd/scheduler-tracing.production.min.js index e361c64ac666e..f793ead9cc5c7 100644 --- a/packages/schedule/npm/umd/schedule-tracing.production.min.js +++ b/packages/scheduler/npm/umd/scheduler-tracing.production.min.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.ScheduleTracing = factory(global)); + : (global.SchedulerTracing = factory(global)); })(this, function(global) { function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( this, arguments ); } function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( this, arguments ); } function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( this, arguments ); @@ -39,14 +39,14 @@ function unstable_subscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( this, arguments ); } function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( this, arguments ); @@ -54,14 +54,14 @@ function unstable_unsubscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( this, arguments ); } function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( this, arguments ); diff --git a/packages/schedule/npm/umd/schedule-tracing.profiling.min.js b/packages/scheduler/npm/umd/scheduler-tracing.profiling.min.js similarity index 81% rename from packages/schedule/npm/umd/schedule-tracing.profiling.min.js rename to packages/scheduler/npm/umd/scheduler-tracing.profiling.min.js index e361c64ac666e..f793ead9cc5c7 100644 --- a/packages/schedule/npm/umd/schedule-tracing.profiling.min.js +++ b/packages/scheduler/npm/umd/scheduler-tracing.profiling.min.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.ScheduleTracing = factory(global)); + : (global.SchedulerTracing = factory(global)); })(this, function(global) { function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_clear.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( this, arguments ); } function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getCurrent.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( this, arguments ); } function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_getThreadID.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( this, arguments ); @@ -39,14 +39,14 @@ function unstable_subscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_subscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( this, arguments ); } function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_trace.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( this, arguments ); @@ -54,14 +54,14 @@ function unstable_unsubscribe() { // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_unsubscribe.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( this, arguments ); } function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ScheduleTracing.unstable_wrap.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( this, arguments ); diff --git a/packages/schedule/npm/umd/schedule.production.min.js b/packages/scheduler/npm/umd/scheduler.development.js similarity index 85% rename from packages/schedule/npm/umd/schedule.production.min.js rename to packages/scheduler/npm/umd/scheduler.development.js index 43a338f741b52..67f9f903956d5 100644 --- a/packages/schedule/npm/umd/schedule.production.min.js +++ b/packages/scheduler/npm/umd/scheduler.development.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Schedule = factory(global)); + : (global.Scheduler = factory(global)); })(this, function(global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply( this, arguments ); } function unstable_cancelScheduledWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply( this, arguments ); diff --git a/packages/schedule/npm/umd/schedule.profiling.min.js b/packages/scheduler/npm/umd/scheduler.production.min.js similarity index 85% rename from packages/schedule/npm/umd/schedule.profiling.min.js rename to packages/scheduler/npm/umd/scheduler.production.min.js index 43a338f741b52..67f9f903956d5 100644 --- a/packages/schedule/npm/umd/schedule.profiling.min.js +++ b/packages/scheduler/npm/umd/scheduler.production.min.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Schedule = factory(global)); + : (global.Scheduler = factory(global)); })(this, function(global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply( this, arguments ); } function unstable_cancelScheduledWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply( this, arguments ); diff --git a/packages/schedule/npm/umd/schedule.development.js b/packages/scheduler/npm/umd/scheduler.profiling.min.js similarity index 85% rename from packages/schedule/npm/umd/schedule.development.js rename to packages/scheduler/npm/umd/scheduler.profiling.min.js index 43a338f741b52..67f9f903956d5 100644 --- a/packages/schedule/npm/umd/schedule.development.js +++ b/packages/scheduler/npm/umd/scheduler.profiling.min.js @@ -14,24 +14,24 @@ ? (module.exports = factory(require('react'))) : typeof define === 'function' && define.amd // eslint-disable-line no-undef ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Schedule = factory(global)); + : (global.Scheduler = factory(global)); })(this, function(global) { function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_now.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( this, arguments ); } function unstable_scheduleWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_scheduleWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleWork.apply( this, arguments ); } function unstable_cancelScheduledWork() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Schedule.unstable_cancelScheduledWork.apply( + return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelScheduledWork.apply( this, arguments ); diff --git a/packages/schedule/package.json b/packages/scheduler/package.json similarity index 91% rename from packages/schedule/package.json rename to packages/scheduler/package.json index 3c5415cfa38c7..480105fdc7cd5 100644 --- a/packages/schedule/package.json +++ b/packages/scheduler/package.json @@ -1,6 +1,6 @@ { - "name": "schedule", - "version": "0.5.0", + "name": "scheduler", + "version": "0.9.0", "description": "Cooperative scheduler for the browser environment.", "main": "index.js", "repository": "facebook/react", diff --git a/packages/schedule/src/Schedule.js b/packages/scheduler/src/Scheduler.js similarity index 100% rename from packages/schedule/src/Schedule.js rename to packages/scheduler/src/Scheduler.js diff --git a/packages/schedule/src/Tracing.js b/packages/scheduler/src/Tracing.js similarity index 100% rename from packages/schedule/src/Tracing.js rename to packages/scheduler/src/Tracing.js diff --git a/packages/schedule/src/TracingSubscriptions.js b/packages/scheduler/src/TracingSubscriptions.js similarity index 98% rename from packages/schedule/src/TracingSubscriptions.js rename to packages/scheduler/src/TracingSubscriptions.js index ffddd4a4ebbf2..ca5c5ad77269c 100644 --- a/packages/schedule/src/TracingSubscriptions.js +++ b/packages/scheduler/src/TracingSubscriptions.js @@ -10,7 +10,7 @@ import type {Interaction, Subscriber} from './Tracing'; import {enableSchedulerTracing} from 'shared/ReactFeatureFlags'; -import {__subscriberRef} from 'schedule/tracing'; +import {__subscriberRef} from 'scheduler/tracing'; let subscribers: Set = (null: any); if (enableSchedulerTracing) { diff --git a/packages/schedule/src/__tests__/Schedule-test.internal.js b/packages/scheduler/src/__tests__/Scheduler-test.internal.js similarity index 95% rename from packages/schedule/src/__tests__/Schedule-test.internal.js rename to packages/scheduler/src/__tests__/Scheduler-test.internal.js index a01a10c6d9d84..eaaae4ec911ce 100644 --- a/packages/schedule/src/__tests__/Schedule-test.internal.js +++ b/packages/scheduler/src/__tests__/Scheduler-test.internal.js @@ -18,7 +18,7 @@ let yieldedValues; let yieldValue; let clearYieldedValues; -describe('Schedule', () => { +describe('Scheduler', () => { beforeEach(() => { jest.useFakeTimers(); jest.resetModules(); @@ -94,9 +94,9 @@ describe('Schedule', () => { global.Date.now = () => currentTime; window._schedMock = [requestCallback, cancelCallback, getTimeRemaining]; - const Schedule = require('schedule'); - scheduleWork = Schedule.unstable_scheduleWork; - cancelScheduledWork = Schedule.unstable_cancelScheduledWork; + const Scheduler = require('scheduler'); + scheduleWork = Scheduler.unstable_scheduleWork; + cancelScheduledWork = Scheduler.unstable_cancelScheduledWork; }); it('flushes work incrementally', () => { diff --git a/packages/schedule/src/__tests__/ScheduleDOM-test.js b/packages/scheduler/src/__tests__/SchedulerDOM-test.js similarity index 97% rename from packages/schedule/src/__tests__/ScheduleDOM-test.js rename to packages/scheduler/src/__tests__/SchedulerDOM-test.js index 46a11e1f4a63f..ae9c0826c46ee 100644 --- a/packages/schedule/src/__tests__/ScheduleDOM-test.js +++ b/packages/scheduler/src/__tests__/SchedulerDOM-test.js @@ -9,14 +9,14 @@ 'use strict'; -let Schedule; +let Scheduler; type FrameTimeoutConfigType = { // should only specify one or the other timeLeftInFrame: ?number, timePastFrameDeadline: ?number, }; -describe('ScheduleDOM', () => { +describe('SchedulerDOM', () => { let rAFCallbacks = []; let postMessageCallback; let postMessageEvents = []; @@ -94,12 +94,12 @@ describe('ScheduleDOM', () => { return currentTime; }; jest.resetModules(); - Schedule = require('schedule'); + Scheduler = require('scheduler'); }); describe('scheduleWork', () => { it('calls the callback within the frame when not blocked', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const cb = jest.fn(); scheduleWork(cb); advanceOneFrame({timeLeftInFrame: 15}); @@ -111,7 +111,7 @@ describe('ScheduleDOM', () => { describe('with multiple callbacks', () => { it('accepts multiple callbacks and calls within frame when not blocked', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => callbackLog.push('A')); const callbackB = jest.fn(() => callbackLog.push('B')); @@ -137,7 +137,7 @@ describe('ScheduleDOM', () => { }); it("accepts callbacks betweeen animationFrame and postMessage and doesn't stall", () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => callbackLog.push('A')); const callbackB = jest.fn(() => callbackLog.push('B')); @@ -167,7 +167,7 @@ describe('ScheduleDOM', () => { 'schedules callbacks in correct order and' + 'keeps calling them if there is time', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => { callbackLog.push('A'); @@ -194,7 +194,7 @@ describe('ScheduleDOM', () => { ); it('schedules callbacks in correct order when callbacks have many nested scheduleWork calls', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => { callbackLog.push('A'); @@ -229,7 +229,7 @@ describe('ScheduleDOM', () => { }); it('schedules callbacks in correct order when they use scheduleWork to schedule themselves', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; let callbackAIterations = 0; const callbackA = jest.fn(() => { @@ -260,7 +260,7 @@ describe('ScheduleDOM', () => { describe('when there is no more time left in the frame', () => { it('calls any callback which has timed out, waits for others', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; startOfLatestFrame = 1000000000000; currentTime = startOfLatestFrame - 10; const callbackLog = []; @@ -295,7 +295,7 @@ describe('ScheduleDOM', () => { describe('when there is some time left in the frame', () => { it('calls timed out callbacks and then any more pending callbacks, defers others if time runs out', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; startOfLatestFrame = 1000000000000; currentTime = startOfLatestFrame - 10; const callbackLog = []; @@ -346,7 +346,7 @@ describe('ScheduleDOM', () => { const { unstable_scheduleWork: scheduleWork, unstable_cancelScheduledWork: cancelScheduledWork, - } = Schedule; + } = Scheduler; const cb = jest.fn(); const callbackId = scheduleWork(cb); expect(cb).toHaveBeenCalledTimes(0); @@ -360,7 +360,7 @@ describe('ScheduleDOM', () => { const { unstable_scheduleWork: scheduleWork, unstable_cancelScheduledWork: cancelScheduledWork, - } = Schedule; + } = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => callbackLog.push('A')); const callbackB = jest.fn(() => callbackLog.push('B')); @@ -384,7 +384,7 @@ describe('ScheduleDOM', () => { const { unstable_scheduleWork: scheduleWork, unstable_cancelScheduledWork: cancelScheduledWork, - } = Schedule; + } = Scheduler; const callbackLog = []; let callbackBId; const callbackA = jest.fn(() => { @@ -421,7 +421,7 @@ describe('ScheduleDOM', () => { * */ it('still calls all callbacks within same frame', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => callbackLog.push('A')); const callbackB = jest.fn(() => { @@ -467,7 +467,7 @@ describe('ScheduleDOM', () => { * */ it('and with some timed out callbacks, still calls all callbacks within same frame', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => { callbackLog.push('A'); @@ -513,7 +513,7 @@ describe('ScheduleDOM', () => { * */ it('still calls all callbacks within same frame', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => { callbackLog.push('A'); @@ -574,7 +574,7 @@ describe('ScheduleDOM', () => { * */ it('and with all timed out callbacks, still calls all callbacks within same frame', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; const callbackLog = []; const callbackA = jest.fn(() => { callbackLog.push('A'); @@ -655,7 +655,7 @@ describe('ScheduleDOM', () => { * */ it('still calls all callbacks within same frame', () => { - const {unstable_scheduleWork: scheduleWork} = Schedule; + const {unstable_scheduleWork: scheduleWork} = Scheduler; startOfLatestFrame = 1000000000000; currentTime = startOfLatestFrame - 10; catchPostMessageErrors = true; diff --git a/packages/schedule/src/__tests__/ScheduleUMDBundle-test.internal.js b/packages/scheduler/src/__tests__/SchedulerUMDBundle-test.internal.js similarity index 72% rename from packages/schedule/src/__tests__/ScheduleUMDBundle-test.internal.js rename to packages/scheduler/src/__tests__/SchedulerUMDBundle-test.internal.js index 36552fdde5d56..5b6f04a2a1cc5 100644 --- a/packages/schedule/src/__tests__/ScheduleUMDBundle-test.internal.js +++ b/packages/scheduler/src/__tests__/SchedulerUMDBundle-test.internal.js @@ -35,29 +35,29 @@ describe('Scheduling UMD bundle', () => { it('should define the same scheduling API', () => { const api = require('../../index'); - const umdAPIDev = require('../../npm/umd/schedule.development'); - const umdAPIProd = require('../../npm/umd/schedule.production.min'); - const umdAPIProfiling = require('../../npm/umd/schedule.profiling.min'); + const umdAPIDev = require('../../npm/umd/scheduler.development'); + const umdAPIProd = require('../../npm/umd/scheduler.production.min'); + const umdAPIProfiling = require('../../npm/umd/scheduler.profiling.min'); const secretAPI = require('react/src/ReactSharedInternals').default; validateForwardedAPIs(api, [ umdAPIDev, umdAPIProd, umdAPIProfiling, - secretAPI.Schedule, + secretAPI.Scheduler, ]); }); it('should define the same tracing API', () => { const api = require('../../tracing'); - const umdAPIDev = require('../../npm/umd/schedule-tracing.development'); - const umdAPIProd = require('../../npm/umd/schedule-tracing.production.min'); - const umdAPIProfiling = require('../../npm/umd/schedule-tracing.profiling.min'); + const umdAPIDev = require('../../npm/umd/scheduler-tracing.development'); + const umdAPIProd = require('../../npm/umd/scheduler-tracing.production.min'); + const umdAPIProfiling = require('../../npm/umd/scheduler-tracing.profiling.min'); const secretAPI = require('react/src/ReactSharedInternals').default; validateForwardedAPIs(api, [ umdAPIDev, umdAPIProd, umdAPIProfiling, - secretAPI.ScheduleTracing, + secretAPI.SchedulerTracing, ]); }); }); diff --git a/packages/schedule/src/__tests__/Tracing-test.internal.js b/packages/scheduler/src/__tests__/Tracing-test.internal.js similarity index 99% rename from packages/schedule/src/__tests__/Tracing-test.internal.js rename to packages/scheduler/src/__tests__/Tracing-test.internal.js index 60497138c77f5..658b69313ca5b 100644 --- a/packages/schedule/src/__tests__/Tracing-test.internal.js +++ b/packages/scheduler/src/__tests__/Tracing-test.internal.js @@ -29,7 +29,7 @@ describe('Tracing', () => { ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing; - SchedulerTracing = require('schedule/tracing'); + SchedulerTracing = require('scheduler/tracing'); } describe('enableSchedulerTracing enabled', () => { diff --git a/packages/schedule/src/__tests__/Tracing-test.js b/packages/scheduler/src/__tests__/Tracing-test.js similarity index 95% rename from packages/schedule/src/__tests__/Tracing-test.js rename to packages/scheduler/src/__tests__/Tracing-test.js index 3ccdff39c283f..5259be4792560 100644 --- a/packages/schedule/src/__tests__/Tracing-test.js +++ b/packages/scheduler/src/__tests__/Tracing-test.js @@ -14,7 +14,7 @@ describe('Tracing', () => { beforeEach(() => { jest.resetModules(); - SchedulerTracing = require('schedule/tracing'); + SchedulerTracing = require('scheduler/tracing'); }); it('should return the value of a traced function', () => { diff --git a/packages/schedule/src/__tests__/TracingSubscriptions-test.internal.js b/packages/scheduler/src/__tests__/TracingSubscriptions-test.internal.js similarity index 99% rename from packages/schedule/src/__tests__/TracingSubscriptions-test.internal.js rename to packages/scheduler/src/__tests__/TracingSubscriptions-test.internal.js index f9a67816952d5..6eff59a6cf864 100644 --- a/packages/schedule/src/__tests__/TracingSubscriptions-test.internal.js +++ b/packages/scheduler/src/__tests__/TracingSubscriptions-test.internal.js @@ -42,7 +42,7 @@ describe('TracingSubscriptions', () => { ReactFeatureFlags = require('shared/ReactFeatureFlags'); ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing; - SchedulerTracing = require('schedule/tracing'); + SchedulerTracing = require('scheduler/tracing'); throwInOnInteractionScheduledWorkCompleted = false; throwInOnInteractionTraced = false; diff --git a/packages/schedule/tracing.js b/packages/scheduler/tracing.js similarity index 100% rename from packages/schedule/tracing.js rename to packages/scheduler/tracing.js diff --git a/packages/shared/forks/Schedule.umd.js b/packages/shared/forks/Scheduler.umd.js similarity index 94% rename from packages/shared/forks/Schedule.umd.js rename to packages/shared/forks/Scheduler.umd.js index 8f38d1b02d412..86ad51ac79735 100644 --- a/packages/shared/forks/Schedule.umd.js +++ b/packages/shared/forks/Scheduler.umd.js @@ -15,6 +15,6 @@ const { unstable_cancelScheduledWork, unstable_now, unstable_scheduleWork, -} = ReactInternals.Schedule; +} = ReactInternals.Scheduler; export {unstable_cancelScheduledWork, unstable_now, unstable_scheduleWork}; diff --git a/packages/shared/forks/ScheduleTracing.umd.js b/packages/shared/forks/SchedulerTracing.umd.js similarity index 95% rename from packages/shared/forks/ScheduleTracing.umd.js rename to packages/shared/forks/SchedulerTracing.umd.js index fd406bbab9f3b..0129a7fc4a149 100644 --- a/packages/shared/forks/ScheduleTracing.umd.js +++ b/packages/shared/forks/SchedulerTracing.umd.js @@ -21,7 +21,7 @@ const { unstable_trace, unstable_unsubscribe, unstable_wrap, -} = ReactInternals.ScheduleTracing; +} = ReactInternals.SchedulerTracing; export { __interactionsRef, diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 2035acf5bfef8..b5d6afdc2eab5 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -385,16 +385,16 @@ const bundles = [ /******* React Scheduler (experimental) *******/ { - label: 'schedule', + label: 'scheduler', bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], moduleType: ISOMORPHIC, - entry: 'schedule', - global: 'Schedule', + entry: 'scheduler', + global: 'Scheduler', externals: [], }, { - label: 'schedule-tracing', + label: 'scheduler-tracing', bundleTypes: [ FB_WWW_DEV, FB_WWW_PROD, @@ -404,8 +404,8 @@ const bundles = [ NODE_PROFILING, ], moduleType: ISOMORPHIC, - entry: 'schedule/tracing', - global: 'ScheduleTracing', + entry: 'scheduler/tracing', + global: 'SchedulerTracing', externals: [], }, ]; diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 22ef8ca0c26be..bbb22d7a8c950 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -119,7 +119,7 @@ const forks = Object.freeze({ return null; }, - schedule: (bundleType, entry, dependencies) => { + scheduler: (bundleType, entry, dependencies) => { switch (bundleType) { case UMD_DEV: case UMD_PROD: @@ -131,14 +131,14 @@ const forks = Object.freeze({ } // Optimization: for UMDs, use the API that is already a part of the React // package instead of requiring it to be loaded via a separate