9,239 matches across 25 files for func main lang:JavaScript lang:JavaScript
snippet_mode: auto · sorted by relevance
30 ElementTypeClass,
31 ElementTypeContext,
32▶ ElementTypeFunction,
33 ElementTypeForwardRef,
34 ElementTypeHostComponent,
· · ·
177 Plugins,
178} from 'react-devtools-shared/src/frontend/types';
179▶import type {ReactFunctionLocation} from 'shared/ReactTypes';
180import type {
181 FiberInstance,
· · ·
194import {formatOwnerStack} from '../shared/DevToolsOwnerStack';
195
196▶function createFiberInstance(fiber: Fiber): FiberInstance {
197 return {
198 kind: FIBER_INSTANCE,
· · ·
211
212// This is used to represent a filtered Fiber but still lets us find its host instance.
213▶function createFilteredFiberInstance(fiber: Fiber): FilteredFiberInstance {
214 return {
215 kind: FILTERED_FIBER_INSTANCE,
· · ·
227}
228
229▶function createVirtualInstance(
230 debugEntry: ReactComponentInfo,
231): VirtualInstance {
+ 351 more matches in this file
19import type {ActivityState} from './ReactFiberActivityComponent';
20import type {SuspenseState} from './ReactFiberSuspenseComponent';
21▶import type {FunctionComponentUpdateQueue} from './ReactFiberHooks';
22import type {Transition} from 'react/src/ReactStartTransition';
23import type {
· · ·
148 SuspenseListComponent,
149 OffscreenComponent,
150▶ FunctionComponent,
151 ForwardRef,
152 MemoComponent,
· · ·
232 SelectiveHydrationException,
233 beginWork,
234▶ replayFunctionComponent,
235} from './ReactFiberBeginWork';
236import {completeWork} from './ReactFiberCompleteWork';
· · ·
416import {claimQueuedTransitionTypes} from './ReactFiberTransitionTypes';
417
418▶const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
419
420type ExecutionContext = number;
· · ·
456
457// When this is true, the work-in-progress fiber just suspended (or errored) and
458▶// we've yet to unwind the stack. In some cases, we may yield to the main thread
459// after this happens. If the fiber is pinged before we resume, we can retry
460// immediately instead of unwinding the stack.
+ 200 more matches in this file
80
81import {
82▶ clientRenderBoundary as clientRenderFunction,
83 completeBoundary as completeBoundaryFunction,
84 completeBoundaryUpgradeToViewTransitions as upgradeToViewTransitionsInstruction,
· · ·
83▶ completeBoundary as completeBoundaryFunction,
84 completeBoundaryUpgradeToViewTransitions as upgradeToViewTransitionsInstruction,
85 completeBoundaryWithStyles as styleInsertionFunction,
· · ·
85▶ completeBoundaryWithStyles as styleInsertionFunction,
86 completeSegment as completeSegmentFunction,
87 formReplaying as formReplayingRuntime,
· · ·
86▶ completeSegment as completeSegmentFunction,
87 formReplaying as formReplayingRuntime,
88 markShellTime,
· · ·
127export type InstructionState = number;
128const NothingSent /* */ = 0b000000000;
129▶const SentCompleteSegmentFunction /* */ = 0b000000001;
130const SentCompleteBoundaryFunction /* */ = 0b000000010;
131const SentClientRenderFunction /* */ = 0b000000100;
+ 264 more matches in this file
55} from './ReactFiberDevToolsHook';
56import {
57▶ FunctionComponent,
58 ClassComponent,
59 HostRoot,
· · ·
75 LazyComponent,
76 IncompleteClassComponent,
77▶ IncompleteFunctionComponent,
78 ScopeComponent,
79 OffscreenComponent,
· · ·
110import {
111 disableLegacyContext,
112▶ disableLegacyContextForFunctionComponents,
113 enableProfilerCommitHooks,
114 enableProfilerTimer,
· · ·
262 createFiberFromOffscreen,
263 createWorkInProgress,
264▶ isSimpleFunctionComponent,
265 isFunctionClassComponent,
266} from './ReactFiber';
· · ·
265▶ isFunctionClassComponent,
266} from './ReactFiber';
267import {
+ 149 more matches in this file
182import {
183 disableLegacyContext,
184▶ disableLegacyContextForFunctionComponents,
185 enableScopeAPI,
186 enableAsyncIterableChildren,
· · ·
450};
451
452▶function createPreamble(): Preamble {
453 return {
454 content: createPreambleState(),
· · ·
467// as little as 80%. We can receive half of that each 500ms - at best. In practice,
468// a little bandwidth is lost to processing and contention - e.g. CSS and images that
469▶// are downloaded along with the main content. So we estimate about half of that to be
470// the lower end throughput. In other words, we expect that you can at least show
471// about 12.5kb of content per 500ms. Not counting starting latency for the first
· · ·
474const DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800;
475
476▶function getBlockingRenderMaxSize(request: Request): number {
477 // We want to make sure that we can block the reveal of a well designed complete
478 // shell but if you have constructed a too large shell (e.g. by not adding any
· · ·
509}
510
511▶function isEligibleForOutlining(
512 request: Request,
513 boundary: SuspenseBoundary,
+ 189 more matches in this file
304export * from 'react-reconciler/src/ReactFiberConfigWithNoPersistence';
305
306▶function getOwnerDocumentFromRootContainer(
307 rootContainerElement: Element | Document | DocumentFragment,
308): Document {
· · ·
312}
313
314▶export function getRootHostContext(
315 rootContainerInstance: Container,
316): HostContext {
· · ·
367}
368
369▶function getOwnHostContext(namespaceURI: string): HostContextNamespace {
370 switch (namespaceURI) {
371 case SVG_NAMESPACE:
· · ·
378}
379
380▶function getChildHostContextProd(
381 parentNamespace: HostContextNamespace,
382 type: string,
· · ·
401}
402
403▶export function getChildHostContext(
404 parentHostContext: HostContext,
405 type: string,
+ 263 more matches in this file
47 HostPortal,
48 Fragment,
49▶ FunctionComponent,
50} from './ReactWorkTags';
51import isArray from 'shared/isArray';
· · ·
87let currentDebugInfo: null | ReactDebugInfo = null;
88
89▶function pushDebugInfo(
90 debugInfo: null | ReactDebugInfo,
91): null | ReactDebugInfo {
· · ·
107}
108
109▶function getCurrentDebugTask(): null | ConsoleTask {
110 // Get the debug task of the parent Server Component if there is one.
111 if (__DEV__) {
· · ·
129let didWarnAboutGenerators;
130let ownerHasKeyUseWarning;
131▶let ownerHasFunctionTypeWarning;
132let ownerHasSymbolTypeWarning;
133let warnForMissingKey = (
· · ·
147 */
148 ownerHasKeyUseWarning = {} as {[string]: boolean};
149▶ ownerHasFunctionTypeWarning = {} as {[string]: boolean};
150 ownerHasSymbolTypeWarning = {} as {[string]: boolean};
151
+ 98 more matches in this file
17 ReactIOInfo,
18 ReactStackTrace,
19▶ ReactFunctionLocation,
20 ReactErrorInfoDev,
21} from 'shared/ReactTypes';
· · ·
267
268// $FlowFixMe[missing-this-annot]
269▶function ReactPromise(status: any, value: any, reason: any) {
270 this.status = status;
271 this.value = value;
· · ·
282ReactPromise.prototype = Object.create(Promise.prototype) as any;
283// TODO: This doesn't return a new Promise chain unlike the real .then
284▶function reactPromiseThen<T>(
285 this: SomeChunk<T>,
286 resolve: (value: T) => mixed,
· · ·
322 switch (chunk.status) {
323 case INITIALIZED:
324▶ if (typeof resolve === 'function') {
325 resolve(chunk.value);
326 }
· · ·
329 case PENDING_WEAK:
330 case BLOCKED:
331▶ if (typeof resolve === 'function') {
332 if (chunk.value === null) {
333 chunk.value = [] as Array<InitializationReference | (T => mixed)>;
+ 199 more matches in this file
64 ReactStackTrace,
65 ReactCallSite,
66▶ ReactFunctionLocation,
67 ReactErrorInfo,
68 ReactErrorInfoDev,
· · ·
170const doNotLimit: WeakSet<Reference> = __DEV__ ? new WeakSet() : (null as any);
171
172▶function defaultFilterStackFrame(
173 filename: string,
174 functionName: string,
· · ·
174▶ functionName: string,
175): boolean {
176 return (
· · ·
181}
182
183▶function devirtualizeURL(url: string): string {
184 if (url.startsWith('about://React/')) {
185 // This callsite is a virtual fake callsite that came from another Flight client.
· · ·
196}
197
198▶function isPromiseCreationInternal(url: string, functionName: string): boolean {
199 // Various internals of the JS VM can create Promises but the call frame of the
200 // internals are not very interesting for our purposes so we need to skip those.
+ 267 more matches in this file
48
49import {
50▶ FunctionComponent,
51 ClassComponent,
52 HostRoot,
· · ·
68 LazyComponent,
69 IncompleteClassComponent,
70▶ IncompleteFunctionComponent,
71 ScopeComponent,
72 OffscreenComponent,
· · ·
170 getRenderTargetTime,
171 getWorkInProgressTransitions,
172▶ shouldRemainOnPreviousScreen,
173 markSpawnedRetryLane,
174} from './ReactFiberWorkLoop';
· · ·
199 * a PlacementAndUpdate.
200 */
201▶function markUpdate(workInProgress: Fiber) {
202 workInProgress.flags |= Update;
203}
· · ·
207 * it received an update that requires a clone of the tree above.
208 */
209▶function markCloned(workInProgress: Fiber) {
210 // $FlowFixMe[constant-condition]
211 if (supportsPersistence) {
+ 32 more matches in this file
107 requestDeferredLane,
108 markSkippedUpdateLanes,
109▶ isInvalidExecutionContextForEventFunction,
110} from './ReactFiberWorkLoop';
111
· · ·
203};
204
205▶// The effect "instance" is a shared object that remains the same for the entire
206// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
207// "destroy" function that is returned from an effect, because that is stateful.
· · ·
207▶// "destroy" function that is returned from an effect, because that is stateful.
208// The field is `undefined` if the effect is unmounted, or if the effect ran
209// but is not stateful. We don't explicitly track whether the effect is mounted
· · ·
239};
240
241▶type EventFunctionPayload<Args, Return, F: (...Array<Args>) => Return> = {
242 ref: {
243 eventFn: F,
· · ·
247};
248
249▶export type FunctionComponentUpdateQueue = {
250 lastEffect: Effect | null,
251 events: Array<EventFunctionPayload<any, any, any>> | null,
+ 185 more matches in this file
29import type {SuspenseState, RetryQueue} from './ReactFiberSuspenseComponent';
30import type {UpdateQueue} from './ReactFiberClassUpdateQueue';
31▶import type {FunctionComponentUpdateQueue} from './ReactFiberHooks';
32import type {Wakeable, ViewTransitionProps} from 'shared/ReactTypes';
33import type {
· · ·
64} from 'shared/ReactFeatureFlags';
65import {
66▶ FunctionComponent,
67 ForwardRef,
68 ClassComponent,
· · ·
309let needsFormReset = false;
310
311▶const PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
312
313let nextEffect: Fiber | null = null;
· · ·
327let rootViewTransitionNameCanceled: boolean = false;
328
329▶function isHydratingParent(current: Fiber, finishedWork: Fiber): boolean {
330 if (finishedWork.tag === ActivityComponent) {
331 const prevState: ActivityState | null = current.memoizedState;
· · ·
350}
351
352▶export function commitBeforeMutationEffects(
353 root: FiberRoot,
354 firstChild: Fiber,
+ 117 more matches in this file
167const SESSION_ID = `react-devtools-cdt-mcp-${process.pid}-${Date.now()}`;
168
169▶function log(message: string): void {
170 process.stdout.write(`${message}\n`);
171}
· · ·
172
173▶function sleep(ms: number): Promise<void> {
174 return new Promise(resolve => setTimeout(resolve, ms));
175}
· · ·
176
177▶function createError(message: string): Error {
178 // eslint-disable-next-line react-internal/prod-error-codes
179 return new Error(message);
· · ·
180}
181
182▶function ensureBuiltModules(): void {
183 if (!fs.existsSync(BUILT_MODULES_DIR)) {
184 throw createError(
· · ·
189}
190
191▶function getFreePort(): Promise<number> {
192 return new Promise((resolve, reject) => {
193 const server = net.createServer();
+ 68 more matches in this file
43 enableProfilerTimer &&
44 typeof console !== 'undefined' &&
45▶ typeof console.timeStamp === 'function' &&
46 (!__DEV__ ||
47 // In DEV we also rely on performance.measure
· · ·
48 (typeof performance !== 'undefined' &&
49 // $FlowFixMe[method-unbinding]
50▶ typeof performance.measure === 'function'));
51
52const COMPONENTS_TRACK = 'Components ⚛';
· · ·
55let currentTrack: string = 'Blocking'; // Lane
56
57▶export function setCurrentTrackFromLanes(lanes: Lanes): void {
58 currentTrack = getGroupNameOfHighestPriorityLane(lanes);
59}
· · ·
60
61▶export function markAllLanesInOrder() {
62 if (supportsUserTiming) {
63 // Ensure we create all tracks in priority order. Currently performance.mark() are in
· · ·
110}
111
112▶function logComponentTrigger(
113 fiber: Fiber,
114 startTime: number,
+ 35 more matches in this file
67var timerQueue: Array<Task> = [];
68
69▶// Incrementing id counter. Used to maintain insertion order.
70var taskIdCounter = 1;
71
· · ·
83 | null
84 | ((
85▶ hasTimeRemaining: boolean,
86 initialTime: DOMHighResTimeStamp | number,
87 ) => boolean) = null;
· · ·
97var disableYieldValue = false;
98
99▶function setDisableYieldValue(newValue: boolean) {
100 disableYieldValue = newValue;
101}
· · ·
102
103▶function advanceTimers(currentTime: number) {
104 // Check for tasks that are no longer delayed and add them to the queue.
105 let timer = peek(timerQueue);
· · ·
119 }
120 } else {
121▶ // Remaining timers are pending.
122 return;
123 }
+ 35 more matches in this file
123 IdleHydrationLane;
124
125▶// This function is used for the experimental timeline (react-devtools-timeline)
126// It should be kept in sync with the Lanes values above.
127export function getLabelForLane(lane: Lane): string | void {
· · ·
127▶export function getLabelForLane(lane: Lane): string | void {
128 if (enableSchedulingProfiler) {
129 if (lane & SyncHydrationLane) {
· · ·
178let nextRetryLane: Lane = RetryLane1;
179
180▶function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
181 const pendingSyncLanes = lanes & SyncUpdateLanes;
182 if (pendingSyncLanes !== 0) {
· · ·
247}
248
249▶export function getNextLanes(
250 root: FiberRoot,
251 wipLanes: Lanes,
· · ·
301 }
302 } else {
303▶ // The only remaining work is Idle.
304 // TODO: Idle isn't really used anywhere, and the thinking around
305 // speculative rendering has evolved since this was implemented. Consider
+ 71 more matches in this file
60const hasPerformanceNow =
61 // $FlowFixMe[method-unbinding]
62▶ typeof performance === 'object' && typeof performance.now === 'function';
63
64if (hasPerformanceNow) {
· · ·
80var timerQueue: Array<Task> = [];
81
82▶// Incrementing id counter. Used to maintain insertion order.
83var taskIdCounter = 1;
84
· · ·
95
96// Capture local references to native APIs, in case a polyfill overrides them.
97▶const localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
98const localClearTimeout =
99 typeof clearTimeout === 'function' ? clearTimeout : null;
· · ·
99▶ typeof clearTimeout === 'function' ? clearTimeout : null;
100const localSetImmediate =
101 typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
· · ·
102
103▶function advanceTimers(currentTime: number) {
104 // Check for tasks that are no longer delayed and add them to the queue.
105 let timer = peek(timerQueue);
+ 29 more matches in this file
114let currentEventTransitionLane: Lane = NoLane;
115
116▶export function ensureRootIsScheduled(root: FiberRoot): void {
117 // This function is called whenever a root receives an update. It does two
118 // things 1) it ensures the root is in the root schedule, and 2) it ensures
· · ·
117▶ // This function is called whenever a root receives an update. It does two
118 // things 1) it ensures the root is in the root schedule, and 2) it ensures
119 // there's a pending microtask to process the root schedule.
· · ·
152}
153
154▶export function ensureScheduleIsScheduled(): void {
155 // At the end of the current event, go through each of the roots and ensure
156 // there's a task scheduled for each one at the correct priority.
· · ·
169}
170
171▶export function flushSyncWorkOnAllRoots() {
172 // This is allowed to be called synchronously, but the caller should check
173 // the execution context first.
· · ·
175}
176
177▶export function flushSyncWorkOnLegacyRootsOnly() {
178 // This is allowed to be called synchronously, but the caller should check
179 // the execution context first.
+ 22 more matches in this file
1▶(function () {
2 'use strict';
3
· · ·
4▶ var ReactImage0 = function (x) {
5 if (x === 0) {
6 return React.createElement('i', {
· · ·
233 };
234
235▶ var AbstractLink1 = function (x) {
236 if (x === 1) {
237 return React.createElement(
· · ·
244 href: '#',
245 rel: undefined,
246▶ onClick: function () {},
247 },
248 null,
· · ·
277 href: '#',
278 rel: undefined,
279▶ onClick: function () {},
280 },
281 undefined,
+ 277 more matches in this file
22
23const patchConsoleMethod = (methodName, logged) => {
24▶ const newMethod = function (format, ...args) {
25 // Ignore uncaught errors reported by jsdom
26 // and React addendums because they're too noisy.
· · ·
62
63let logMethod;
64▶export function patchConsoleMethods({includeLog} = {includeLog: false}) {
65 patchConsoleMethod('error', loggedErrors);
66 patchConsoleMethod('warn', loggedWarns);
· · ·
73}
74
75▶export function resetAllUnexpectedConsoleCalls() {
76 loggedErrors.length = 0;
77 loggedWarns.length = 0;
· · ·
81}
82
83▶export function clearLogs() {
84 const logs = Array.from(loggedLogs);
85 loggedLogs.length = 0;
· · ·
87}
88
89▶export function clearWarnings() {
90 const warnings = Array.from(loggedWarns);
91 loggedWarns.length = 0;
+ 18 more matches in this file
27 : () => null;
28
29▶function getTaskName(type) {
30 if (type === REACT_FRAGMENT_TYPE) {
31 return '<>';
· · ·
48}
49
50▶function getOwner() {
51 if (__DEV__) {
52 const dispatcher = ReactSharedInternals.A;
· · ·
68
69/** @noinline */
70▶function UnknownOwner() {
71 /** @noinline */
72 return (() => Error('react-stack-top-frame'))();
· · ·
73}
74const createFakeCallStack = {
75▶ react_stack_bottom_frame: function (callStackForError) {
76 return callStackForError();
77 },
· · ·
87 didWarnAboutElementRef = {};
88
89▶ // We use this technique to trick minifiers to preserve the function name.
90 unknownOwnerDebugStack = createFakeCallStack.react_stack_bottom_frame.bind(
91 createFakeCallStack,
+ 25 more matches in this file
17//
18// Both queues share a persistent, singly-linked list structure. To schedule an
19▶// update, we append it to the end of both queues. Each queue maintains a
20// pointer to first update in the persistent list that hasn't been processed.
21// The work-in-progress pointer always has a position equal to or greater than
· · ·
52// during the render phase, only the updates with sufficient priority are
53// included in the result. If we skip an update because it has insufficient
54▶// priority, it remains in the queue to be processed later, during a lower
55// priority render. Crucially, all updates subsequent to a skipped update also
56// remain in the queue *regardless of their priority*. That means high priority
· · ·
56▶// remain in the queue *regardless of their priority*. That means high priority
57// updates are sometimes processed twice, at two separate priorities. We also
58// keep track of a base state, that represents the state before the first
· · ·
174}
175
176▶export function initializeUpdateQueue<State>(fiber: Fiber): void {
177 const queue: UpdateQueue<State> = {
178 baseState: fiber.memoizedState,
· · ·
189}
190
191▶export function cloneUpdateQueue<State>(
192 current: Fiber,
193 workInProgress: Fiber,
+ 23 more matches in this file
24import {describeDiff} from 'react-reconciler/src/ReactFiberHydrationDiffs';
25
26▶function describeAncestors(
27 ancestor: Fiber,
28 child: Fiber,
· · ·
134 'link',
135 'listing',
136▶ 'main',
137 'marquee',
138 'menu',
· · ·
222};
223
224▶function updatedAncestorInfoDev(
225 oldInfo: null | AncestorInfoDev,
226 tag: string,
· · ·
246 ) {
247 // See rules for 'li', 'dd', 'dt' start tags in
248▶ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
249 ancestorInfo.listItemTagAutoclosing = null;
250 ancestorInfo.dlItemTagAutoclosing = null;
· · ·
300 * Returns whether
301 */
302▶function isTagValidWithParent(
303 tag: string,
304 parentTag: ?string,
+ 14 more matches in this file
65const SAFE_ARTIFACT_PATH = /^[A-Za-z0-9_@./+-]+$/;
66
67▶function isSafeArtifactPath(value) {
68 return (
69 typeof value === 'string' &&
· · ·
76}
77
78▶function isSize(value) {
79 return value === null || (Number.isFinite(value) && value >= 0);
80}
· · ·
81
82▶function isSha(value) {
83 return typeof value === 'string' && /^[0-9a-f]{7,40}$/.test(value);
84}
· · ·
91});
92
93▶function kbs(bytes) {
94 // An artifact that exists on only one side has no size on the other. The
95 // report has always shown that as 0.00 kB rather than an empty cell.
· · ·
104});
105
106▶function ratio(baseSize, headSize) {
107 if (baseSize === null) {
108 return Infinity;
+ 18 more matches in this file
35import type RBush from 'rbush';
36
37▶function ScaledRect({
38 className,
39 rect,
· · ·
79}
80
81▶function SuspenseRects({
82 suspenseID,
83 parentRects,
· · ·
105 const visible = suspense.hasUniqueSuspenders || !uniqueSuspendersOnly;
106
107▶ function handleClick(event: SyntheticMouseEvent) {
108 if (event.defaultPrevented) {
109 // Already clicked on an inner rect
· · ·
118 }
119
120▶ function handleDoubleClick(event: SyntheticMouseEvent) {
121 if (event.defaultPrevented) {
122 // Already clicked on an inner rect
· · ·
130 }
131
132▶ function handlePointerOver(event: SyntheticPointerEvent) {
133 if (event.defaultPrevented) {
134 // Already hovered an inner rect
+ 16 more matches in this file