13,362 matches across 25 files for func main
snippet_mode: auto · sorted by relevance
30 ElementTypeClass,
31 ElementTypeContext,
32▶ ElementTypeFunction,
33 ElementTypeForwardRef,
34 ElementTypeHostComponent,
· · ·
180 Plugins,
181} from 'react-devtools-shared/src/frontend/types';
182▶import type {ReactFunctionLocation} from 'shared/ReactTypes';
183import type {
184 FiberInstance,
· · ·
197import {formatOwnerStack} from '../shared/DevToolsOwnerStack';
198
199▶function createFiberInstance(fiber: Fiber): FiberInstance {
200 return {
201 kind: FIBER_INSTANCE,
· · ·
214
215// This is used to represent a filtered Fiber but still lets us find its host instance.
216▶function createFilteredFiberInstance(fiber: Fiber): FilteredFiberInstance {
217 return {
218 kind: FILTERED_FIBER_INSTANCE,
· · ·
230}
231
232▶function createVirtualInstance(
233 debugEntry: ReactComponentInfo,
234): VirtualInstance {
+ 354 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';
· · ·
414import {claimQueuedTransitionTypes} from './ReactFiberTransitionTypes';
415
416▶const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
417
418type ExecutionContext = number;
· · ·
454
455// When this is true, the work-in-progress fiber just suspended (or errored) and
456▶// we've yet to unwind the stack. In some cases, we may yield to the main thread
457// after this happens. If the fiber is pinged before we resume, we can retry
458// immediately instead of unwinding the stack.
+ 200 more matches in this file
79
80import {
81▶ clientRenderBoundary as clientRenderFunction,
82 completeBoundary as completeBoundaryFunction,
83 completeBoundaryUpgradeToViewTransitions as upgradeToViewTransitionsInstruction,
· · ·
82▶ completeBoundary as completeBoundaryFunction,
83 completeBoundaryUpgradeToViewTransitions as upgradeToViewTransitionsInstruction,
84 completeBoundaryWithStyles as styleInsertionFunction,
· · ·
84▶ completeBoundaryWithStyles as styleInsertionFunction,
85 completeSegment as completeSegmentFunction,
86 formReplaying as formReplayingRuntime,
· · ·
85▶ completeSegment as completeSegmentFunction,
86 formReplaying as formReplayingRuntime,
87 markShellTime,
· · ·
126export type InstructionState = number;
127const NothingSent /* */ = 0b000000000;
128▶const SentCompleteSegmentFunction /* */ = 0b000000001;
129const SentCompleteBoundaryFunction /* */ = 0b000000010;
130const 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,
· · ·
134import {setCurrentFiber} from './ReactCurrentFiber';
135import {
136▶ resolveFunctionForHotReloading,
137 resolveForwardRefForHotReloading,
138 resolveClassForHotReloading,
· · ·
264 createFiberFromOffscreen,
265 createWorkInProgress,
266▶ isSimpleFunctionComponent,
267 isFunctionClassComponent,
268} from './ReactFiber';
+ 152 more matches in this file
178import {
179 disableLegacyContext,
180▶ disableLegacyContextForFunctionComponents,
181 enableScopeAPI,
182 enableAsyncIterableChildren,
· · ·
430};
431
432▶function createPreamble(): Preamble {
433 return {
434 content: createPreambleState(),
· · ·
447// as little as 80%. We can receive half of that each 500ms - at best. In practice,
448// a little bandwidth is lost to processing and contention - e.g. CSS and images that
449▶// are downloaded along with the main content. So we estimate about half of that to be
450// the lower end throughput. In other words, we expect that you can at least show
451// about 12.5kb of content per 500ms. Not counting starting latency for the first
· · ·
454const DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800;
455
456▶function getBlockingRenderMaxSize(request: Request): number {
457 // We want to make sure that we can block the reveal of a well designed complete
458 // shell but if you have constructed a too large shell (e.g. by not adding any
· · ·
489}
490
491▶function isEligibleForOutlining(
492 request: Request,
493 boundary: SuspenseBoundary,
+ 184 more matches in this file
297export * from 'react-reconciler/src/ReactFiberConfigWithNoPersistence';
298
299▶function getOwnerDocumentFromRootContainer(
300 rootContainerElement: Element | Document | DocumentFragment,
301): Document {
· · ·
305}
306
307▶export function getRootHostContext(
308 rootContainerInstance: Container,
309): HostContext {
· · ·
360}
361
362▶function getOwnHostContext(namespaceURI: string): HostContextNamespace {
363 switch (namespaceURI) {
364 case SVG_NAMESPACE:
· · ·
371}
372
373▶function getChildHostContextProd(
374 parentNamespace: HostContextNamespace,
375 type: string,
· · ·
394}
395
396▶export function getChildHostContext(
397 parentHostContext: HostContext,
398 type: string,
+ 257 more matches in this file
17 ReactIOInfo,
18 ReactStackTrace,
19▶ ReactFunctionLocation,
20 ReactErrorInfoDev,
21} from 'shared/ReactTypes';
· · ·
242
243// $FlowFixMe[missing-this-annot]
244▶function ReactPromise(status: any, value: any, reason: any) {
245 this.status = status;
246 this.value = value;
· · ·
257ReactPromise.prototype = Object.create(Promise.prototype) as any;
258// TODO: This doesn't return a new Promise chain unlike the real .then
259▶ReactPromise.prototype.then = function <T>(
260 this: SomeChunk<T>,
261 resolve: (value: T) => mixed,
· · ·
297 switch (chunk.status) {
298 case INITIALIZED:
299▶ if (typeof resolve === 'function') {
300 resolve(chunk.value);
301 }
· · ·
303 case PENDING:
304 case BLOCKED:
305▶ if (typeof resolve === 'function') {
306 if (chunk.value === null) {
307 chunk.value = [] as Array<InitializationReference | (T => mixed)>;
+ 191 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
63 ReactStackTrace,
64 ReactCallSite,
65▶ ReactFunctionLocation,
66 ReactErrorInfo,
67 ReactErrorInfoDev,
· · ·
169const doNotLimit: WeakSet<Reference> = __DEV__ ? new WeakSet() : (null as any);
170
171▶function defaultFilterStackFrame(
172 filename: string,
173 functionName: string,
· · ·
173▶ functionName: string,
174): boolean {
175 return (
· · ·
180}
181
182▶function devirtualizeURL(url: string): string {
183 if (url.startsWith('about://React/')) {
184 // This callsite is a virtual fake callsite that came from another Flight client.
· · ·
195}
196
197▶function isPromiseCreationInternal(url: string, functionName: string): boolean {
198 // Various internals of the JS VM can create Promises but the call frame of the
199 // internals are not very interesting for our purposes so we need to skip those.
+ 253 more matches in this file
47
48import {
49▶ FunctionComponent,
50 ClassComponent,
51 HostRoot,
· · ·
67 LazyComponent,
68 IncompleteClassComponent,
69▶ IncompleteFunctionComponent,
70 ScopeComponent,
71 OffscreenComponent,
· · ·
168 getRenderTargetTime,
169 getWorkInProgressTransitions,
170▶ shouldRemainOnPreviousScreen,
171 markSpawnedRetryLane,
172} from './ReactFiberWorkLoop';
· · ·
197 * a PlacementAndUpdate.
198 */
199▶function markUpdate(workInProgress: Fiber) {
200 workInProgress.flags |= Update;
201}
· · ·
205 * it received an update that requires a clone of the tree above.
206 */
207▶function markCloned(workInProgress: Fiber) {
208 // $FlowFixMe[constant-condition]
209 if (supportsPersistence) {
+ 32 more matches in this file
15} from '../CompilerError';
16import {CompileErrorDetail} from './Options';
17▶import {ExternalFunction, ReactFunctionType} from '../HIR/Environment';
18import {CodegenFunction} from '../ReactiveScopes';
19import {isComponentDeclaration} from '../Utils/ComponentDeclaration';
· · ·
18▶import {CodegenFunction} from '../ReactiveScopes';
19import {isComponentDeclaration} from '../Utils/ComponentDeclaration';
20import {isHookDeclaration} from '../Utils/HookDeclaration';
· · ·
21import {assertExhaustive} from '../Utils/utils';
22▶import {insertGatedFunctionDeclaration} from './Gating';
23import {
24 addImportsToProgram,
· · ·
34import {compileFn} from './Pipeline';
35import {
36▶ filterSuppressionsThatAffectFunction,
37 findProgramSuppressions,
38 suppressionsToCompilerError,
· · ·
51const DYNAMIC_GATING_DIRECTIVE = new RegExp('^use memo if\\(([^\\)]*)\\)$');
52
53▶export function tryFindDirectiveEnablingMemoization(
54 directives: Array<t.Directive>,
55 opts: ParsedPluginOptions,
+ 171 more matches in this file
4// LICENSE file in the root directory of this source tree.
5
6▶//! Main entrypoint for the React Compiler.
7//!
8//! This module is a port of Program.ts from the TypeScript compiler. It orchestrates
· · ·
11//! 2. Validating restricted imports
12//! 3. Finding program-level suppressions
13▶//! 4. Discovering functions to compile (components, hooks)
14//! 5. Processing each function through the compilation pipeline
15//! 6. Applying compiled functions back to the AST
· · ·
14▶//! 5. Processing each function through the compilation pipeline
15//! 6. Applying compiled functions back to the AST
16
· · ·
15▶//! 6. Applying compiled functions back to the AST
16
17use rustc_hash::{FxHashMap, FxHashSet};
· · ·
40use react_compiler_diagnostics::ErrorCategory;
41use react_compiler_diagnostics::SourceLocation;
42▶use react_compiler_hir::ReactFunctionType;
43use react_compiler_hir::environment_config::EnvironmentConfig;
44use react_compiler_lowering::FunctionNode;
+ 373 more matches in this file
105 requestDeferredLane,
106 markSkippedUpdateLanes,
107▶ isInvalidExecutionContextForEventFunction,
108} from './ReactFiberWorkLoop';
109
· · ·
200};
201
202▶// The effect "instance" is a shared object that remains the same for the entire
203// lifetime of an effect. In Rust terms, a RefCell. We use it to store the
204// "destroy" function that is returned from an effect, because that is stateful.
· · ·
204▶// "destroy" function that is returned from an effect, because that is stateful.
205// The field is `undefined` if the effect is unmounted, or if the effect ran
206// but is not stateful. We don't explicitly track whether the effect is mounted
· · ·
236};
237
238▶type EventFunctionPayload<Args, Return, F: (...Array<Args>) => Return> = {
239 ref: {
240 eventFn: F,
· · ·
244};
245
246▶export type FunctionComponentUpdateQueue = {
247 lastEffect: Effect | null,
248 events: Array<EventFunctionPayload<any, any, any>> | null,
+ 185 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
12use crate::globals::{self};
13use crate::object_shape::BUILT_IN_MIXED_READONLY_ID;
14▶use crate::object_shape::FunctionSignature;
15use crate::object_shape::HookKind;
16use crate::object_shape::HookSignatureBuilder;
· · ·
49 pub types: Vec<Type>,
50 pub scopes: Vec<ReactiveScope>,
51▶ pub functions: Vec<HirFunction>,
52
53 // Error accumulation
· · ·
54 pub errors: CompilerError,
55
56▶ // Function type classification (Component, Hook, Other)
57 pub fn_type: ReactFunctionType,
58
· · ·
57▶ pub fn_type: ReactFunctionType,
58
59 // Output mode (Client, Ssr, Lint)
· · ·
105 default_mutating_hook: Option<Global>,
106
107▶ // Outlined functions: functions extracted from the component during outlining passes
108 outlined_functions: Vec<OutlinedFunctionEntry>,
109
+ 55 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
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
25} from './HIR';
26
27▶export function* eachInstructionLValue(
28 instr: ReactiveInstruction,
29): Iterable<Place> {
· · ·
34}
35
36▶export function* eachInstructionLValueWithKind(
37 instr: ReactiveInstruction,
38): Iterable<[Place, InstructionKind]> {
· · ·
60}
61
62▶export function* eachInstructionValueLValue(
63 value: ReactiveValue,
64): Iterable<Place> {
· · ·
83}
84
85▶export function* eachInstructionOperand(instr: Instruction): Iterable<Place> {
86 yield* eachInstructionValueOperand(instr.value);
87}
· · ·
88▶export function* eachInstructionValueOperand(
89 instrValue: InstructionValue,
90): Iterable<Place> {
+ 24 more matches in this file
27 * character to exclude identifiers like "user".
28 */
29▶function isHookName(s: string): boolean {
30 return s === 'use' || /^use[A-Z0-9]/.test(s);
31}
· · ·
35 * containing a hook name.
36 */
37▶function isHook(node: Node): boolean {
38 if (node.type === 'Identifier') {
39 return isHookName(node.name);
· · ·
55 * always start with an uppercase letter.
56 */
57▶function isComponentName(node: Node): boolean {
58 return node.type === 'Identifier' && /^[A-Z]/.test(node.name);
59}
· · ·
60
61▶function isReactFunction(node: Node, functionName: string): boolean {
62 return (
63 ('name' in node && node.name === functionName) ||
· · ·
63▶ ('name' in node && node.name === functionName) ||
64 (node.type === 'MemberExpression' &&
65 'name' in node.object &&
+ 90 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
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
20use react_compiler_hir::visitors::{ScopeBlockInfo, ScopeBlockTraversal};
21use react_compiler_hir::{
22▶ BasicBlock, BlockId, DeclarationId, DependencyPathEntry, EvaluationOrder, FunctionId,
23 GotoVariant, HirFunction, IdentifierId, Instruction, InstructionId, InstructionKind,
24 InstructionValue, MutableRange, ParamPattern, Place, PlaceOrSpread, PropertyLiteral,
· · ·
23▶ GotoVariant, HirFunction, IdentifierId, Instruction, InstructionId, InstructionKind,
24 InstructionValue, MutableRange, ParamPattern, Place, PlaceOrSpread, PropertyLiteral,
25 ReactFunctionType, ReactiveScopeDependency, ScopeId, Terminal, Type, visitors,
· · ·
25▶ ReactFunctionType, ReactiveScopeDependency, ScopeId, Terminal, Type, visitors,
26};
27
· · ·
30// =============================================================================
31
32▶/// Main entry point: propagate scope dependencies through the HIR.
33/// Corresponds to TS `propagateScopeDependenciesHIR(fn)`.
34pub fn propagate_scope_dependencies_hir(func: &mut HirFunction, env: &mut Environment) {
· · ·
34▶pub fn propagate_scope_dependencies_hir(func: &mut HirFunction, env: &mut Environment) {
35 let used_outside_declaring_scope = find_temporaries_used_outside_declaring_scope(func, env);
36 let temporaries = collect_temporaries_sidemap(func, env, &used_outside_declaring_scope);
+ 148 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
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,
· · ·
300let needsFormReset = false;
301
302▶const PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
303
304let nextEffect: Fiber | null = null;
· · ·
318let rootViewTransitionNameCanceled: boolean = false;
319
320▶function isHydratingParent(current: Fiber, finishedWork: Fiber): boolean {
321 if (finishedWork.tag === ActivityComponent) {
322 const prevState: ActivityState | null = current.memoizedState;
· · ·
341}
342
343▶export function commitBeforeMutationEffects(
344 root: FiberRoot,
345 firstChild: Fiber,
+ 113 more matches in this file