prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {preinitScriptForSSR} from 'react-client/src/ReactFlightClientConfig';
export type ModuleLoading = null | {
pre... | .]
chunks: Array<string>,
nonce: ?string,
) {
if (moduleLoading !== null) {
for (let i = 1; i < chunks.length; i += 2) {
preinitScriptForSSR(
moduleLoading.prefix + chunks[i],
nonce,
moduleLoading.crossOrigin,
| filenamey, .. | {
"filepath": "packages/react-server-dom-unbundled/src/client/ReactFlightClientConfigTargetNodeServer.js",
"language": "javascript",
"file_size": 802,
"cut_index": 517,
"middle_length": 14
} |
import type {Thenable, ReactCustomFormAction} from 'shared/ReactTypes.js';
import type {
DebugChannel,
FindSourceMapURLCallback,
Response as FlightResponse,
} from 'react-client/src/ReactFlightClient';
import type {ReactServerValue} from 'react-client/src/ReactFlightReplyClient';
import type {
ServerConsumer... | Reply,
createServerReference as createServerReferenceImpl,
} from 'react-client/src/ReactFlightReplyClient';
export {registerServerReference} from 'react-client/src/ReactFlightReplyClient';
import type {TemporaryReferenceSet} from 'react-client/src/Rea | oading,
serverModuleMap: null | ServerManifest,
};
import {
createResponse,
createStreamState,
getRoot,
reportGlobalError,
processBinaryChunk,
close,
} from 'react-client/src/ReactFlightClient';
import {
process | {
"filepath": "packages/react-server-dom-unbundled/src/client/ReactFlightDOMClientEdge.js",
"language": "javascript",
"file_size": 6967,
"cut_index": 716,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Thenable, ReactCustomFormAction} from 'shared/ReactTypes.js';
import type {
DebugChannel,
FindSourceMapURLCallback,
Response,
} from 'react-client/src/ReactFlightClient';
import type {
ServerCons... |
} from 'react-client/src/ReactFlightClient';
export * from './ReactFlightDOMClientEdge';
function noServerCall() {
throw new Error(
'Server Functions cannot be called during initial render. ' +
'This would create a fetch waterfall. Try to us | uleLoading,
serverModuleMap: null | ServerManifest,
};
import type {Readable} from 'stream';
import {
createResponse,
createStreamState,
getRoot,
reportGlobalError,
processStringChunk,
processBinaryChunk,
close, | {
"filepath": "packages/react-server-dom-unbundled/src/client/ReactFlightDOMClientNode.js",
"language": "javascript",
"file_size": 3946,
"cut_index": 614,
"middle_length": 229
} |
r s;
if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-server-dom-unbundled-server.node.production.js');
} else {
s = require('./cjs/react-server-dom-unbundled-server.node.development.js');
}
exports.renderToReadableStream = s.renderToReadableStream;
exports.renderToPipeableStream = s.renderToP... | s.decodeFormState;
exports.registerServerReference = s.registerServerReference;
exports.registerClientReference = s.registerClientReference;
exports.createClientModuleProxy = s.createClientModuleProxy;
exports.createTemporaryReferenceSet = s.createTempora | deAction = s.decodeAction;
exports.decodeFormState = | {
"filepath": "packages/react-server-dom-unbundled/npm/server.node.js",
"language": "javascript",
"file_size": 853,
"cut_index": 529,
"middle_length": 52
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactServerConsoleConfig
const badgeFormat = '%c%s%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use... | args: Array<any>,
badgeName: string,
): () => any {
let offset = 0;
switch (methodName) {
case 'dir':
case 'dirxml':
case 'groupEnd':
case 'table': {
// These methods cannot be colorized because they don't take a formatting str | );' +
'color: #000000;' +
'color: light-dark(#000000, #ffffff);' +
'border-radius: 2px';
const resetStyle = '';
const pad = ' ';
const bind = Function.prototype.bind;
export function bindToConsole(
methodName: string,
| {
"filepath": "packages/react-client/src/ReactClientConsoleConfigBrowser.js",
"language": "javascript",
"file_size": 1881,
"cut_index": 537,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {
ReactDebugInfo,
ReactComponentInfo,
ReactStackTrace,
} from 'shared/ReactTypes';
export const IO_NODE = 0;
export const PROMISE_NODE = 1;
export const AWAIT_NODE = 2;
export const UNRESOLVED_PROMIS... | here's no promise intermediate.
promise: null, // not used on I/O
awaited: null, // I/O is only blocked on external.
previous: null | AwaitNode | UnresolvedAwaitNode, // the preceeding await that spawned this new work
};
export type PromiseNode = {
| ull | ReactComponentInfo,
stack: null | ReactStackTrace, // callsite that spawned the I/O
start: number, // start time when the first part of the I/O sequence started
end: number, // we typically don't use this. only when t | {
"filepath": "packages/react-server/src/ReactFlightAsyncSequence.js",
"language": "javascript",
"file_size": 3497,
"cut_index": 614,
"middle_length": 229
} |
import type {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
import type {Request} from './ReactFlightServer';
import type {Thenable, Usable, ReactComponentInfo} from 'shared/ReactTypes';
import type {ThenableState} from './ReactFlightThenable';
import {
REACT_MEMO_CACHE_SENTINEL,
REACT_CONTEXT_TYPE,
} ... | () {
currentRequest = null;
}
export function prepareToUseHooksForComponent(
prevThenableState: ThenableState | null,
componentDebugInfo: null | ReactComponentInfo,
) {
thenableIndexCounter = 0;
thenableState = prevThenableState;
if (__DEV__) | l;
let thenableIndexCounter = 0;
let thenableState = null;
let currentComponentDebugInfo = null;
export function prepareToUseHooksForRequest(request: Request) {
currentRequest = request;
}
export function resetHooksForRequest | {
"filepath": "packages/react-server/src/ReactFlightHooks.js",
"language": "javascript",
"file_size": 5246,
"cut_index": 716,
"middle_length": 229
} |
y: string]: JSONValue}
| $ReadOnlyArray<JSONValue>;
const PENDING = 'pending';
const BLOCKED = 'blocked';
const RESOLVED_MODEL = 'resolved_model';
const INITIALIZED = 'fulfilled';
const ERRORED = 'rejected';
const __PROTO__ = '__proto__';
type RESPONSE_SYMBOL_TYPE = 'RESPONSE_SYMBOL'; // Fake symbol type.
const RE... | ll | Array<InitializationReference | (mixed => mixed)>,
then(resolve: (T) => mixed, reject?: (mixed) => mixed): void,
};
type ResolvedModelChunk<T> = {
status: 'resolved_model',
value: string,
reason: {id: number, [RESPONSE_SYMBOL_TYPE]: Response}, | ializationReference | (mixed => mixed)>,
then(resolve: (T) => mixed, reject?: (mixed) => mixed): void,
};
type BlockedChunk<T> = {
status: 'blocked',
value: null | Array<InitializationReference | (T => mixed)>,
reason: nu | {
"filepath": "packages/react-server/src/ReactFlightReplyServer.js",
"language": "javascript",
"file_size": 60885,
"cut_index": 2151,
"middle_length": 229
} |
umber = callsite[2];
const columnNumber = callsite[3];
if (
filterStackFrame(url, functionName, lineNumber, columnNumber) &&
// Don't consider anonymous code first party even if the filter wants to include them in the stack.
url !== ''
) {
if (bestMatch === '') {
// If we had... | o save bandwidth even in DEV. We'll also replay these stacks on the client so by
// stripping them early we avoid that overhead. Otherwise we'd normally just rely on
// the DevTools or framework's ignore lists to filter them out.
const filterStackFra | nctionName;
}
}
return '';
}
function filterStackTrace(
request: Request,
stack: ReactStackTrace,
): ReactStackTrace {
// Since stacks can be quite large and we pass a lot of them, we filter them out eagerly
// t | {
"filepath": "packages/react-server/src/ReactFlightServer.js",
"language": "javascript",
"file_size": 223425,
"cut_index": 7068,
"middle_length": 229
} |
Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
declare const $$$config: any;
export opaque type ClientManifest = mixed;
export opaque type ClientReference<T> = mixed; /... | tClientReferenceKey = $$$config.getClientReferenceKey;
export const resolveClientReferenceMetadata =
$$$config.resolveClientReferenceMetadata;
export const getServerReferenceId = $$$config.getServerReferenceId;
export const getServerReferenceBoundArgumen | type ServerReferenceId: any = mixed;
export opaque type ClientReferenceKey: any = mixed;
export const isClientReference = $$$config.isClientReference;
export const isServerReference = $$$config.isServerReference;
export const ge | {
"filepath": "packages/react-server/src/ReactFlightServerConfigBundlerCustom.js",
"language": "javascript",
"file_size": 1134,
"cut_index": 518,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
const TEMPORARY_REFERENCE_TAG = Symbol.for('react.temporary.reference');
export opaque type TemporaryReferenceSet = WeakMap<
TemporaryReference<any>,
string,
>;
// eslint-disable-next-line no-unused-vars
export i... |
return temporaryReferences.get(temporaryReference);
}
const proxyHandlers: Proxy$traps<mixed> = {
get: function (
target: Function,
name: string | symbol,
receiver: Proxy<Function>,
) {
switch (name) {
// These names are read | t): boolean {
return reference.$$typeof === TEMPORARY_REFERENCE_TAG;
}
export function resolveTemporaryReference<T>(
temporaryReferences: TemporaryReferenceSet,
temporaryReference: TemporaryReference<T>,
): void | string { | {
"filepath": "packages/react-server/src/ReactFlightServerTemporaryReferences.js",
"language": "javascript",
"file_size": 4133,
"cut_index": 614,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '%c%s%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fixed background if lig... | FlightClient replays inside
// a FlightServer and we capture those replays.
export function unbadgeConsole(
methodName: string,
args: Array<any>,
): null | string {
let offset = 0;
switch (methodName) {
case 'dir':
case 'dirxml':
case ' | +
'color: light-dark(#000000, #ffffff);' +
'border-radius: 2px';
const padLength = 1;
// This mutates the args to remove any badges that was added by a FlightClient and
// returns the name in the badge. This is used when a | {
"filepath": "packages/react-server/src/ReactServerConsoleConfigBrowser.js",
"language": "javascript",
"file_size": 2031,
"cut_index": 563,
"middle_length": 229
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '[%s]';
const padLength = 1;
const pad = ' ';
// This mutates the args to ... | nnot be colorized because they don't take a formatting string.
// So we wouldn't have added any badge in the first place.
// $FlowFixMe
return null;
}
case 'assert': {
// assert takes formatting options as the second argumen | function unbadgeConsole(
methodName: string,
args: Array<any>,
): null | string {
let offset = 0;
switch (methodName) {
case 'dir':
case 'dirxml':
case 'groupEnd':
case 'table': {
// These methods ca | {
"filepath": "packages/react-server/src/ReactServerConsoleConfigPlain.js",
"language": "javascript",
"file_size": 1687,
"cut_index": 537,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/* global Bun */
import type {Writable} from 'stream';
type BunReadableStreamController = ReadableStreamController & {
end(): mixed,
write(data: Chunk | BinaryChunk): void,
error(error: Error): void,
flush?: ... | t function flushBuffered(destination: Destination) {
// Bun direct streams provide a flush function.
// If we don't have any more data to send right now.
// Flush whatever is in the buffer to the wire.
if (typeof destination.flush === 'function') { | = string;
export opaque type Chunk = string;
export type BinaryChunk = $ArrayBufferView;
export function scheduleWork(callback: () => void) {
setTimeout(callback, 0);
}
export const scheduleMicrotask = queueMicrotask;
expor | {
"filepath": "packages/react-server/src/ReactServerStreamConfigBun.js",
"language": "javascript",
"file_size": 4089,
"cut_index": 614,
"middle_length": 229
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export type Destination = {
buffer: string,
done: boolean,
fatal: boolean,
error: mixed,
};
export opaque type PrecomputedChunk = st... | aryChunk,
): void {
destination.buffer += chunk;
}
export function writeChunkAndReturn(
destination: Destination,
chunk: Chunk | PrecomputedChunk | BinaryChunk,
): boolean {
destination.buffer += chunk;
return true;
}
export function completeWr | rt const requestStorage: AsyncLocalStorage<Request | void> = (null: any);
export function beginWriting(destination: Destination) {}
export function writeChunk(
destination: Destination,
chunk: Chunk | PrecomputedChunk | Bin | {
"filepath": "packages/react-server/src/ReactServerStreamConfigFB.js",
"language": "javascript",
"file_size": 1995,
"cut_index": 537,
"middle_length": 229
} |
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';
import * as React from 'react';
const Reac... | {
throw new Error(
'The "react" package in this environment is not configured correctly. ' +
'The "react-server" condition must be enabled in any environment that ' +
'runs React Server Components.',
);
}
export default ReactSharedInt | ternalsServer) | {
"filepath": "packages/react-server/src/ReactSharedInternalsServer.js",
"language": "javascript",
"file_size": 801,
"cut_index": 517,
"middle_length": 14
} |
nents but it should not
// include that I/O as part of its own meta data.
return text + ', ' + (await promise);
}
const stream = ReactServerDOMServer.renderToPipeableStream(<Component />);
const readable = new Stream.PassThrough(streamOptions);
const result = ReactServerDOMClient.createFr... |
"time": 0,
},
{
"env": "Server",
"key": null,
"name": "Component",
"props": {},
"stack": [
[
"Object.<anonymous>",
"/ | if (
__DEV__ &&
gate(
flags =>
flags.enableComponentPerformanceTrack && flags.enableAsyncDebugInfo,
)
) {
expect(getDebugInfo(result)).toMatchInlineSnapshot(`
[
{ | {
"filepath": "packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
"language": "javascript",
"file_size": 96405,
"cut_index": 3790,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
* @jest-environment node
*/
'use strict';
import {AsyncLocalStorage} from 'node:async_hooks';
let act;
let React;
let ReactNoopServer;
function normalizeCodeLocInfo(str) {
return (
str &&
str.rep... | = str.split('\n');
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const line of lines) {
if (line.indexOf(__filename) === -1) {
} else {
ignoreListedStack += '\n' + line.replace(__dirname, '.');
}
}
return ign | name + (/\d/.test(m) ? ' (at **)' : '');
})
);
}
/**
* Removes all stackframes not pointing into this file
*/
function ignoreListStack(str) {
if (!str) {
return str;
}
let ignoreListedStack = '';
const lines | {
"filepath": "packages/react-server/src/__tests__/ReactServer-test.js",
"language": "javascript",
"file_size": 5068,
"cut_index": 614,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// This is a host config that's used for the `react-server` package on npm.
// It is only used by third-party renderers.
//
// Its API lets you pass the host config as an argument.
// However, inside the `react-server`... | ype {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
declare const $$$config: $FlowFixMe;
export opaque type Destination = mixed;
export opaque type RenderState = mixed;
export opaque type HoistableState = mixed;
export opaque type Resumab | $config) {
// /* renderer code */
// }
//
// So `$$$config` looks like a global variable, but it's
// really an argument to a top-level wrapping function.
import type {Request} from 'react-server/src/ReactFizzServer';
import t | {
"filepath": "packages/react-server/src/forks/ReactFizzConfig.noop.js",
"language": "javascript",
"file_size": 4800,
"cut_index": 614,
"middle_length": 229
} |
ight (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Request} from 'react-server/src/ReactFlightServer';
import type {ReactComponentInfo} from 'shared/ReactTypes';
exp... | alStorage<Request | void> = (null: any);
export const supportsComponentStorage = false;
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
(null: any);
export function createHints(): any {
return null;
}
export type Format | nfigPlain';
export type Hints = any;
export type HintCode = any;
// eslint-disable-next-line no-unused-vars
export type HintModel<T: any> = any;
export const supportsRequestStorage = false;
export const requestStorage: AsyncLoc | {
"filepath": "packages/react-server/src/forks/ReactFlightServerConfig.custom.js",
"language": "javascript",
"file_size": 1252,
"cut_index": 524,
"middle_length": 229
} |
import type {ReactFormState} from 'shared/ReactTypes';
import type {
ServerManifest,
ClientReference as ServerReference,
} from 'react-client/src/ReactFlightClientConfig';
import {
resolveServerReference,
preloadModule,
requireModule,
} from 'react-client/src/ReactFlightClientConfig';
import {
createResp... | rgs));
}
function loadServerReference<T>(
bundlerConfig: ServerManifest,
metaData: {
id: ServerReferenceId,
bound: null | Promise<Array<any>>,
},
): Promise<T> {
const id: ServerReferenceId = metaData.id;
if (typeof id !== 'string') {
| throw new Error(
'Server Function has too many bound arguments. Received ' +
args.length +
' but the limit is ' +
MAX_BOUND_ARGS +
'.',
);
}
return fn.bind.apply(fn, [null].concat(a | {
"filepath": "packages/react-server/src/ReactFlightActionServer.js",
"language": "javascript",
"file_size": 6343,
"cut_index": 716,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {LazyComponent} from 'react/src/ReactLazy';
import type {ReactComponentInfo} from 'shared/ReactTypes';
import type {ReactClientValue} from './ReactFlight... | ,
): R {
// The secondArg is always undefined in Server Components since refs error early.
const secondArg = undefined;
setCurrentOwner(componentDebugInfo);
try {
return Component(props, secondArg);
} finally {
setCurrentO | rking the whole bundle instead of these boundaries.
const callComponent = {
react_stack_bottom_frame: function <Props, R>(
Component: (p: Props, arg: void) => R,
props: Props,
componentDebugInfo: ReactComponentInfo | {
"filepath": "packages/react-server/src/ReactFlightCallUserSpace.js",
"language": "javascript",
"file_size": 2701,
"cut_index": 563,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
* Backing FormData is a wrapper around FormData that allows iterating over the
* keys while allowing to evict values from the FormData without affecting the iter... | mber,
// Lazily initialized array of keys. We only need this at the moment
// for referenced FormData.
keys: null | Array<string>,
};
export function peekBackingEntry(backingStore: BackingFormData): string | void {
let keys = backingStore.keys;
| 2);
* const keys = formData.keys();
* keys.next().value; // 'a'
* formData.delete('a');
* keys.next().value; // undefined, but we expect 'b'
* ```
*/
export opaque type BackingFormData = {
data: FormData,
keyPointer: nu | {
"filepath": "packages/react-server/src/ReactFlightReplyBackingFormData.js",
"language": "javascript",
"file_size": 2687,
"cut_index": 563,
"middle_length": 229
} |
import type {ReactStackTrace} from 'shared/ReactTypes';
let framesToSkip: number = 0;
let collectedStackTrace: null | ReactStackTrace = null;
const identifierRegExp = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
function getMethodCallName(callSite: CallSite): string {
const typeName = callSite.getTypeName();
const methodName =... | unctionName.endsWith(' ' + methodName)
) {
result += ' [as ' + methodName + ']';
}
} else {
if (typeName) {
result += typeName + '.';
}
if (methodName) {
result += methodName;
} else {
result += '<anonymous | functionName !== typeName
) {
result += typeName + '.';
}
result += functionName;
if (
methodName &&
functionName !== methodName &&
!functionName.endsWith('.' + methodName) &&
!f | {
"filepath": "packages/react-server/src/ReactFlightStackConfigV8.js",
"language": "javascript",
"file_size": 8446,
"cut_index": 716,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fi... | This is used when a FlightClient replays inside
// a FlightServer and we capture those replays.
export function unbadgeConsole(
methodName: string,
args: Array<any>,
): null | string {
let offset = 0;
switch (methodName) {
case 'dir':
case |
'color: #000000;' +
'color: light-dark(#000000, #ffffff);' +
'border-radius: 2px';
const padLength = 1;
// This mutates the args to remove any badges that was added by a FlightClient and
// returns the name in the badge. | {
"filepath": "packages/react-server/src/ReactServerConsoleConfigServer.js",
"language": "javascript",
"file_size": 2051,
"cut_index": 563,
"middle_length": 229
} |
export type Destination = ReadableStreamController;
export type PrecomputedChunk = Uint8Array;
export opaque type Chunk = Uint8Array;
export type BinaryChunk = Uint8Array;
function handleErrorInNextTick(error: any) {
setTimeout(() => {
throw error;
});
}
const LocalPromise = Promise;
export const scheduleMi... | // transform streams. https://github.com/whatwg/streams/issues/960
}
// Chunks larger than VIEW_SIZE are written directly, without copying into the
// internal view buffer. This must be at least half of Node's internal Buffer
// pool size (8192) to avoid | extTick);
};
export function scheduleWork(callback: () => void) {
setTimeout(callback, 0);
}
export function flushBuffered(destination: Destination) {
// WHATWG Streams do not yet have a way to flush the underlying
| {
"filepath": "packages/react-server/src/ReactServerStreamConfigEdge.js",
"language": "javascript",
"file_size": 6467,
"cut_index": 716,
"middle_length": 229
} |
import type {Writable} from 'stream';
import {TextEncoder} from 'util';
import {createHash} from 'crypto';
interface MightBeFlushable {
flush?: () => void;
}
export type Destination = Writable & MightBeFlushable;
export type PrecomputedChunk = Uint8Array;
export opaque type Chunk = string;
export type BinaryChunk... | n for this purpose.
// For Express, compression middleware adds this method.
destination.flush();
}
}
// Chunks larger than VIEW_SIZE are written directly, without copying into the
// internal view buffer. This must be at least half of Node's in | estination) {
// If we don't have any more data to send right now.
// Flush whatever is in the buffer to the wire.
if (typeof destination.flush === 'function') {
// By convention the Zlib streams provide a flush functio | {
"filepath": "packages/react-server/src/ReactServerStreamConfigNode.js",
"language": "javascript",
"file_size": 7507,
"cut_index": 716,
"middle_length": 229
} |
ct-core
* @jest-environment node
*/
'use strict';
if (typeof Blob === 'undefined') {
global.Blob = require('buffer').Blob;
}
if (typeof File === 'undefined' || typeof FormData === 'undefined') {
global.File = require('undici').File;
global.FormData = require('undici').FormData;
}
function normalizeCodeLocInf... | ribe('ReactFlight', () => {
beforeEach(() => {
// Mock performance.now for timing tests
let time = 0;
advanceTimersByTime = timeMS => {
time += timeMS;
jest.advanceTimersByTime(timeMS);
};
const now = jest.fn().mockImpleme | ot + 1);
}
return ' in ' + name + (/\d/.test(m) ? ' (at **)' : '');
})
);
}
let ReactServer;
let ReactNoopFlightServer;
let Scheduler;
let advanceTimersByTime;
let assertLog;
let assertConsoleErrorDev;
desc | {
"filepath": "packages/react-server/src/__tests__/ReactFlightServer-test.js",
"language": "javascript",
"file_size": 5832,
"cut_index": 716,
"middle_length": 229
} |
, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Request} from 'react-server/src/ReactFlightServer';
import type {ReactComponentInfo} from 'shared/ReactTypes';
export * from 'react-fligh... | d> = (null: any);
export const supportsComponentStorage = false;
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
(null: any);
export * from '../ReactFlightServerConfigDebugNoop';
export * from '../ReactFlightStackConfigV8 | onst requestStorage: AsyncLocalStorage<Request | voi | {
"filepath": "packages/react-server/src/forks/ReactFlightServerConfig.dom-browser-fb.js",
"language": "javascript",
"file_size": 910,
"cut_index": 547,
"middle_length": 52
} |
, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Request} from 'react-server/src/ReactFlightServer';
import type {ReactComponentInfo} from 'shared/ReactTypes';
export * from 'react-serve... | ull: any);
export const supportsComponentStorage = false;
export const componentStorage: AsyncLocalStorage<ReactComponentInfo | void> =
(null: any);
export * from '../ReactFlightServerConfigDebugNoop';
export * from '../ReactFlightStackConfigV8';
expo | questStorage: AsyncLocalStorage<Request | void> = (n | {
"filepath": "packages/react-server/src/forks/ReactFlightServerConfig.dom-browser-esm.js",
"language": "javascript",
"file_size": 903,
"cut_index": 547,
"middle_length": 52
} |
// Ids are base 32 strings whose binary representation corresponds to the
// position of a node in a tree.
// Every time the tree forks into multiple children, we add additional bits to
// the left of the sequence that represent the position of the child within the
// current level of children.
//
// 00101 ... | a level would be indistinguishable from its parent.
//
// If a node has only one child, and does not materialize an id (i.e. does not
// contain a useId hook), then we don't need to allocate any space in the
// sequence. It's treated as a transparent indir | However, you need 5 bits to represent all the forks at
// the current level, so we must account for the empty bits at the end.
//
// For this same reason, slots are 1-indexed instead of 0-indexed. Otherwise,
// the zeroth id at | {
"filepath": "packages/react-server/src/ReactFizzTreeContext.js",
"language": "javascript",
"file_size": 6144,
"cut_index": 716,
"middle_length": 229
} |
nce';
import {
IO_NODE,
PROMISE_NODE,
UNRESOLVED_PROMISE_NODE,
AWAIT_NODE,
UNRESOLVED_AWAIT_NODE,
} from './ReactFlightAsyncSequence';
import {resolveOwner} from './flight/ReactFlightCurrentOwner';
import {resolveRequest, isAwaitInUserspace} from './ReactFlightServer';
import {createHook, executionAsyncId, A... | c functions missing data.
let lastRanAwait: null | AwaitNode = null;
function resolvePromiseOrAwaitNode(
unresolvedNode: UnresolvedAwaitNode | UnresolvedPromiseNode,
endTime: number,
): AwaitNode | PromiseNode {
const resolvedNode: AwaitNode | Promi | ng]
const getAsyncId = AsyncResource.prototype.asyncId;
const pendingOperations: Map<number, AsyncSequence> =
__DEV__ && enableAsyncDebugInfo ? new Map() : (null: any);
// Keep the last resolved await as a workaround for asyn | {
"filepath": "packages/react-server/src/ReactFlightServerConfigDebugNode.js",
"language": "javascript",
"file_size": 16290,
"cut_index": 921,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// A pure JS implementation of a string hashing function. We do not use it for
// security or obfuscation purposes, only to create compact hashes. So we
// prioritize speed over collision avoidance. For example, we use... | o high to be worth it.
//
// The most popular hashing algorithm that meets these requirements in the JS
// ecosystem is MurmurHash3, and almost all implementations I could find used
// some version of the implementation by Gary Court inlined below.
export | Node's crypto module, or Bun.hash. Unfortunately this
// does not include the web standard crypto API because those methods are all
// async. For our purposes, we need it to be sync because the cost of context
// switching is to | {
"filepath": "packages/react-server/src/createFastHashJS.js",
"language": "javascript",
"file_size": 4132,
"cut_index": 614,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// This is a host config that's used for the `react-server` package on npm.
// It is only used by third-party renderers.
//
// Its API lets you pass the host config as an argument.
// However, inside the `react-server`... | ype {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
declare const $$$config: any;
export opaque type Destination = mixed;
export opaque type RenderState = mixed;
export opaque type HoistableState = mixed;
export opaque type ResumableState | $config) {
// /* renderer code */
// }
//
// So `$$$config` looks like a global variable, but it's
// really an argument to a top-level wrapping function.
import type {Request} from 'react-server/src/ReactFizzServer';
import t | {
"filepath": "packages/react-server/src/forks/ReactFizzConfig.custom.js",
"language": "javascript",
"file_size": 4793,
"cut_index": 614,
"middle_length": 229
} |
// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally,
// changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable"
// instead of "Wakeable". Or some other more appropriate name.
import type {
Thenable,
PendingThenabl... | uspense Exception: This is not a real error! It's an implementation " +
'detail of `use` to interrupt the current render. You must either ' +
'rethrow it immediately, or move the `use` call outside of the ' +
'`try/catch` block. Capturing witho | ate = Array<Thenable<any>>;
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
// detect this is caught by userspace, we'll log a warning in development.
export const SuspenseException: mixed = new Error(
"S | {
"filepath": "packages/react-server/src/ReactFlightThenable.js",
"language": "javascript",
"file_size": 7052,
"cut_index": 716,
"middle_length": 229
} |
export type Destination = ReadableStreamController;
export type PrecomputedChunk = Uint8Array;
export opaque type Chunk = Uint8Array;
export type BinaryChunk = Uint8Array;
const channel = new MessageChannel();
const taskQueue = [];
channel.port1.onmessage = () => {
const task = taskQueue.shift();
if (task) {
... | se.resolve(null).then(callback).catch(handleErrorInNextTick);
};
export function flushBuffered(destination: Destination) {
// WHATWG Streams do not yet have a way to flush the underlying
// transform streams. https://github.com/whatwg/streams/is | (() => {
throw error;
});
}
const LocalPromise = Promise;
export const scheduleMicrotask: (callback: () => void) => void =
typeof queueMicrotask === 'function'
? queueMicrotask
: callback => {
LocalPromi | {
"filepath": "packages/react-server/src/ReactServerStreamConfigBrowser.js",
"language": "javascript",
"file_size": 6477,
"cut_index": 716,
"middle_length": 229
} |
ight (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
let hasConfirmedEval = false;
export function checkEvalAvailabilityOnceDev(): void {
if (__DEV__) {
if (!hasConfirmedEval)... | ) in development mode for various debugging features ' +
'like reconstructing callstacks from a different environment.\n' +
'React will never use eval() in production mode',
);
}
}
} else {
// These errors sh | n this environment. ' +
'This can happen if you started the Node.js process with --disallow-code-generation-from-strings, ' +
'or if `eval` was patched by other means. ' +
'React requires eval( | {
"filepath": "packages/react-client/src/ReactClientDebugConfigNode.js",
"language": "javascript",
"file_size": 1290,
"cut_index": 524,
"middle_length": 229
} |
import type {ReactNodeList} from 'shared/ReactTypes';
import type {LazyComponent} from 'react/src/ReactLazy';
import type {ErrorInfo} from 'react-server/src/ReactFizzServer';
import ReactVersion from 'shared/ReactVersion';
import ReactSharedInternalsServer from 'react-server/src/ReactSharedInternalsServer';
import Re... | Chunk,
close as closeFlight,
} from 'react-client/src/ReactFlightClient';
import {
createRequest as createFizzRequest,
startWork as startFizzWork,
startFlowing as startFizzFlowing,
abort as abortFizz,
} from 'react-server/src/ReactFizzServer';
| abortFlight,
} from 'react-server/src/ReactFlightServer';
import {
createResponse as createFlightResponse,
createStreamState as createFlightStreamState,
getRoot as getFlightRoot,
processStringChunk as processFlightString | {
"filepath": "packages/react-markup/src/ReactMarkupServer.js",
"language": "javascript",
"file_size": 7212,
"cut_index": 716,
"middle_length": 229
} |
ct-core
*/
'use strict';
let React;
let ReactMarkup;
function normalizeCodeLocInfo(str) {
return (
str &&
String(str).replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function (m, name) {
return '\n in ' + name + ' (at **)';
})
);
}
if (!__EXPERIMENTAL__) {
it('should not be built in stable', () ... | Component() {
return <div>hello world</div>;
}
const html = await ReactMarkup.experimental_renderToHTML(<Component />);
expect(html).toBe('<div>hello world</div>');
});
it('should be able to render a large string', asyn | ', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactMarkup = require('react-markup');
});
it('should be able to render a simple component', async () => {
function | {
"filepath": "packages/react-markup/src/__tests__/ReactMarkupClient-test.js",
"language": "javascript",
"file_size": 6676,
"cut_index": 716,
"middle_length": 229
} |
ct-core
*/
'use strict';
global.TextDecoder = require('util').TextDecoder;
global.TextEncoder = require('util').TextEncoder;
let React;
let ReactMarkup;
function normalizeCodeLocInfo(str) {
return (
str &&
String(str).replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function (m, name) {
return '\n in ' +... | ct', () => require('react/react.react-server'));
if (__EXPERIMENTAL__) {
jest.mock('react-markup', () =>
require('react-markup/react-markup.react-server'),
);
}
React = require('react');
if (__EXPERIMENTAL | ow new Error('Expected react-markup not to exist in stable.');
});
} else {
describe('ReactMarkup', () => {
beforeEach(() => {
jest.resetModules();
// We run in the react-server condition.
jest.mock('rea | {
"filepath": "packages/react-markup/src/__tests__/ReactMarkupServer-test.js",
"language": "javascript",
"file_size": 8471,
"cut_index": 716,
"middle_length": 229
} |
ing,
url: string,
};
type TransformSourceFunction = (
Source,
TransformSourceContext,
TransformSourceFunction,
) => Promise<{source: Source}>;
type LoadContext = {
conditions: Array<string>,
format: string | null | void,
importAssertions: Object,
};
type LoadFunction = (
string,
LoadContext,
Load... |
// We stash this in case we end up needing to resolve export * statements later.
stashedResolve = defaultResolve;
if (!context.conditions.includes('react-server')) {
context = {
...context,
conditions: [...context.conditions, 'react | e: null | GetSourceFunction = null;
let stashedResolve: null | ResolveFunction = null;
export async function resolve(
specifier: string,
context: ResolveContext,
defaultResolve: ResolveFunction,
): Promise<{url: string}> { | {
"filepath": "packages/react-server-dom-esm/src/ReactFlightESMNodeLoader.js",
"language": "javascript",
"file_size": 23836,
"cut_index": 1331,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
export type ServerReference<T: Function> = T & {
$$typeof: symbol,
$$id: string,
$$bound: null | Array<ReactClientValue>,
$$location?: ... | ference: Object): boolean {
return reference.$$typeof === SERVER_REFERENCE_TAG;
}
export function registerClientReference<T>(
proxyImplementation: any,
id: string,
exportName: string,
): ClientReference<T> {
return Object.defineProperties(proxyI | ');
const SERVER_REFERENCE_TAG = Symbol.for('react.server.reference');
export function isClientReference(reference: Object): boolean {
return reference.$$typeof === CLIENT_REFERENCE_TAG;
}
export function isServerReference(re | {
"filepath": "packages/react-server-dom-esm/src/ReactFlightESMReferences.js",
"language": "javascript",
"file_size": 3529,
"cut_index": 614,
"middle_length": 229
} |
/ReactFlightServerConfigESMBundler';
import type {ServerManifest} from 'react-client/src/ReactFlightClientConfig';
import type {Busboy} from 'busboy';
import type {Writable} from 'stream';
import type {Thenable} from 'shared/ReactTypes';
import type {Duplex} from 'stream';
import {Readable} from 'stream';
import {
... | ction,
decodeFormState,
} from 'react-server/src/ReactFlightActionServer';
export {
registerServerReference,
registerClientReference,
} from '../ReactFlightESMReferences';
import {
createStringDecoder,
readPartialStringChunk,
readFinalStringC | ightServer';
import {
createResponse,
reportGlobalError,
close,
resolveField,
resolveFileInfo,
resolveFileChunk,
resolveFileComplete,
getRoot,
} from 'react-server/src/ReactFlightReplyServer';
import {
decodeA | {
"filepath": "packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js",
"language": "javascript",
"file_size": 14383,
"cut_index": 921,
"middle_length": 229
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {
ClientReference,
ServerReference,
} from '../Rea... | tion getClientReferenceKey(
reference: ClientReference<any>,
): ClientReferenceKey {
return reference.$$id;
}
export function resolveClientReferenceMetadata<T>(
config: ClientManifest,
clientReference: ClientReference<T>,
): ClientReferenceMetadat | ype ClientReferenceMetadata = [
string, // module path
string, // export name
];
export type ClientReferenceKey = string;
export {
isClientReference,
isServerReference,
} from '../ReactFlightESMReferences';
export func | {
"filepath": "packages/react-server-dom-esm/src/server/ReactFlightServerConfigESMBundler.js",
"language": "javascript",
"file_size": 1975,
"cut_index": 537,
"middle_length": 229
} |
import type {
Thenable,
FulfilledThenable,
RejectedThenable,
ReactDebugInfo,
ReactIOInfo,
ReactAsyncInfo,
} from 'shared/ReactTypes';
import type {ModuleLoading} from 'react-client/src/ReactFlightClientConfig';
export type ServerConsumerModuleMap = string; // Module root path
export type ServerManifest =... | s to defined here in this file instead of just
// being exported directly from the WebpackDestination... file is because the
// ClientReferenceMetadata is opaque and we can't unwrap it there.
// This should get inlined and we could also just implement an u | enceMetadata = [
string, // module path
string, // export name
];
// eslint-disable-next-line no-unused-vars
export opaque type ClientReference<T> = {
specifier: string,
name: string,
};
// The reason this function need | {
"filepath": "packages/react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM.js",
"language": "javascript",
"file_size": 6591,
"cut_index": 716,
"middle_length": 229
} |
(c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {preinitModuleForSSR} from 'react-client/src/ReactFlightClientConfig';
export type ModuleLoading =
| null
| string
| {
... | ,
) {
if (typeof moduleLoading === 'string') {
preinitModuleForSSR(moduleLoading + mod, nonce, undefined);
} else if (moduleLoading !== null) {
preinitModuleForSSR(
moduleLoading.prefix + mod,
nonce,
moduleLoading.crossOrigin, | idy, filenamey, ...]
mod: string,
nonce: ?string | {
"filepath": "packages/react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMServer.js",
"language": "javascript",
"file_size": 851,
"cut_index": 529,
"middle_length": 52
} |
import type {Thenable} from 'shared/ReactTypes.js';
import type {
DebugChannel,
DebugChannelCallback,
FindSourceMapURLCallback,
Response as FlightResponse,
} from 'react-client/src/ReactFlightClient';
import type {ReactServerValue} from 'react-client/src/ReactFlightReplyClient';
import {
createResponse,
... | ightTemporaryReferences';
export {createTemporaryReferenceSet} from 'react-client/src/ReactFlightTemporaryReferences';
export type {TemporaryReferenceSet};
type CallServerCallback = <A, T>(string, args: A) => Promise<T>;
export type Options = {
modul | } from 'react-client/src/ReactFlightReplyClient';
export {
createServerReference,
registerServerReference,
} from 'react-client/src/ReactFlightReplyClient';
import type {TemporaryReferenceSet} from 'react-client/src/ReactFl | {
"filepath": "packages/react-server-dom-esm/src/client/ReactFlightDOMClientBrowser.js",
"language": "javascript",
"file_size": 8215,
"cut_index": 716,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Thenable, ReactCustomFormAction} from 'shared/ReactTypes.js';
import type {
DebugChannel,
FindSourceMapURLCallback,
Response,
} from 'react-client/src/ReactFlightClient';
import type {Readable} fro... | Error(
'Server Functions cannot be called during initial render. ' +
'This would create a fetch waterfall. Try to use a Server Component ' +
'to pass data to Client Components instead.',
);
}
export function createServerReference<A: Iter | import {createServerReference as createServerReferenceImpl} from 'react-client/src/ReactFlightReplyClient';
export {registerServerReference} from 'react-client/src/ReactFlightReplyClient';
function noServerCall() {
throw new | {
"filepath": "packages/react-server-dom-esm/src/client/ReactFlightDOMClientNode.js",
"language": "javascript",
"file_size": 3915,
"cut_index": 614,
"middle_length": 229
} |
ensureDir, move, remove, pathExistsSync} = require('fs-extra');
const {join, resolve, basename} = require('path');
const {getGitCommit} = require('./utils');
// These files are copied along with Webpack-bundled files
// to produce the final web extension
const STATIC_FILES = ['icons', 'popups', 'main.html', 'panel.htm... | -channels.js
const currentBuildDir = resolve(
__dirname,
'..',
'..',
'build',
'oss-experimental',
);
if (pathExistsSync(buildDir)) {
return; // all good.
}
if (pathExistsSync(currentBuildDir)) {
await ensureDir(build | d = async () => {
const buildDir = resolve(__dirname, '..', '..', 'build');
const nodeModulesDir = join(buildDir, 'node_modules');
// TODO: remove this check whenever the CI pipeline is complete.
// See build-all-release | {
"filepath": "packages/react-devtools-extensions/build.js",
"language": "javascript",
"file_size": 6392,
"cut_index": 716,
"middle_length": 229
} |
nv node
'use strict';
const {exec, execSync} = require('child_process');
const {readFileSync, writeFileSync} = require('fs');
const {join} = require('path');
const shell = require('shelljs');
const main = async buildId => {
const root = join(__dirname, buildId);
const buildPath = join(root, 'build');
execSync(... | date = new Date();
date = `${date.toLocaleDateString()} β ${date.toLocaleTimeString()}`;
const installationInstructions =
buildId === 'chrome'
? readFileSync(join(__dirname, 'deploy.chrome.html'))
: readFileSync(join(__dirname, 'deplo | (buildPath, 'now.json'));
const file = readFileSync(join(root, 'now.json'));
const json = JSON.parse(file);
const alias = json.alias[0];
const commit = execSync('git rev-parse HEAD').toString().trim().slice(0, 7);
let | {
"filepath": "packages/react-devtools-extensions/deploy.js",
"language": "javascript",
"file_size": 1489,
"cut_index": 524,
"middle_length": 229
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const {execSync} = require('child_process');
const {existsSync, readFileSync} = require('fs');
const {resolve} = require('path');
const GITHUB_URL = 'ht... | IT_SHA file
const commitShaPath = resolve(__dirname, '..', '..', 'build', 'COMMIT_SHA');
if (!existsSync(commitShaPath)) {
throw new Error(
'Could not find build/COMMIT_SHA file. Did you run scripts/release/download-experimental-build | // Mozilla runs this command from a git archive.
// In that context, there is no Git context.
// Using the commit hash specified to download-experimental-build.js script as a fallback.
// Try to read from build/COMM | {
"filepath": "packages/react-devtools-extensions/utils.js",
"language": "javascript",
"file_size": 1786,
"cut_index": 537,
"middle_length": 229
} |
quire('./utils');
const {resolveFeatureFlags} = require('react-devtools-shared/buildUtils');
const SourceMapIgnoreListPlugin = require('react-devtools-shared/SourceMapIgnoreListPlugin');
const {StatsWriterPlugin} = require('webpack-stats-plugin');
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
console.error... | nst IS_FIREFOX = process.env.IS_FIREFOX === 'true';
const IS_EDGE = process.env.IS_EDGE === 'true';
const IS_INTERNAL_VERSION = process.env.FEATURE_FLAG_TARGET === 'extension-fb';
const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss | t DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
const EDITOR_URL = process.env.EDITOR_URL || null;
const LOGGING_URL = process.env.LOGGING_URL || null;
const IS_CHROME = process.env.IS_CHROME === 'true';
co | {
"filepath": "packages/react-devtools-extensions/webpack.config.js",
"language": "javascript",
"file_size": 8674,
"cut_index": 716,
"middle_length": 229
} |
/bin/env node
'use strict';
const chalk = require('chalk');
const {execSync} = require('child_process');
const {existsSync} = require('fs');
const {isAbsolute, join, relative} = require('path');
const {argv} = require('yargs');
const build = require('../build');
const main = async () => {
const {crx, keyPath} = ar... | e,
'..',
'..',
'..',
'node_modules',
'.bin',
'crx'
);
execSync(
`${crxPath} pack ./unpacked -o ReactDevTools.crx -p ${safeKeyPath}`,
{
cwd,
}
);
}
console.log(chalk.green('\nTh | if (crx) {
const cwd = join(__dirname, 'build');
let safeKeyPath = keyPath;
if (!isAbsolute(keyPath)) {
safeKeyPath = join(relative(cwd, process.cwd()), keyPath);
}
const crxPath = join(
__dirnam | {
"filepath": "packages/react-devtools-extensions/chrome/build.js",
"language": "javascript",
"file_size": 1234,
"cut_index": 518,
"middle_length": 229
} |
usr/bin/env node
'use strict';
const chalk = require('chalk');
const {execSync} = require('child_process');
const {join} = require('path');
const {argv} = require('yargs');
const build = require('../build');
const main = async () => {
const {crx} = argv;
await build('edge');
const cwd = join(__dirname, 'bui... | veloper mode"'));
console.log(chalk.yellow('Click "LOAD UNPACKED"'));
console.log(chalk.yellow('Select extension folder - ' + cwd + '\\unpacked'));
console.log(chalk.green('\nYou can test this build by running:'));
console.log(chalk.gray('\n# From | e.log(chalk.green('\nThe Microsoft Edge extension has been built!'));
console.log(chalk.green('\nTo load this extension:'));
console.log(chalk.yellow('Navigate to edge://extensions/'));
console.log(chalk.yellow('Enable "De | {
"filepath": "packages/react-devtools-extensions/edge/build.js",
"language": "javascript",
"file_size": 1091,
"cut_index": 515,
"middle_length": 229
} |
!/usr/bin/env node
'use strict';
const open = require('open');
const os = require('os');
const osName = require('os-name');
const {resolve} = require('path');
const {argv} = require('yargs');
const EXTENSION_PATH = resolve('./edge/build/unpacked');
const START_URL = argv.url || 'https://react.dev/';
const extargs =... | e.toLocaleLowerCase().startsWith('mac')) {
appname = 'Microsoft Edge';
} else if (osname && osname.toLocaleLowerCase().startsWith('linux')) {
//Coming soon
}
if (appname) {
(async () => {
await open(START_URL, {app: [appname, extargs]});
})(); | sname && osnam | {
"filepath": "packages/react-devtools-extensions/edge/test.js",
"language": "javascript",
"file_size": 786,
"cut_index": 513,
"middle_length": 14
} |
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-esm'... | from 'react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWit | de';
export * | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node-esm.js",
"language": "javascript",
"file_size": 800,
"cut_index": 517,
"middle_length": 14
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {DevToolsHook} from 'react-devtools-shared/src/backend/types';
import Agent from 'react-devtools-shared/src/backend/agent';
import Bridge from 'react-devtools-shared/src/bridge';
import {initBacken... | OOK__);
function setup(hook: ?DevToolsHook) {
if (hook == null) {
return;
}
hook.backends.set(COMPACT_VERSION_NAME, {
Agent,
Bridge,
initBackend,
setupNativeStyleEditor,
});
hook.emit('devtools-backend-installed', COMPACT_V | m './utils';
setup(window.__REACT_DEVTOOLS_GLOBAL_H | {
"filepath": "packages/react-devtools-extensions/src/backend.js",
"language": "javascript",
"file_size": 930,
"cut_index": 606,
"middle_length": 52
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export type EvalScriptIds =
| 'checkIfReactPresentInInspectedWindow'
| 'reload'
| 'setBrowserSelectionFromReact'
| 'setReactSelectionFromBrowser'
| 'viewAttributeSource'
| 'viewElementSource';
/*
.fn for ... | tInInspectedWindow: {
fn: () =>
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ &&
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.size > 0,
code: () =>
'window.__REACT_DEVTOOLS_GLOBAL_HOOK__ &&' +
'window.__REACT_DEVTOOLS_GLOBAL_HOOK | not access `Developer Tools Console API` (e.g., inspect(), $0) in this context.
So some fallback functions are no-op or throw error.
*/
export const evalScripts: {[key: EvalScriptIds]: EvalScriptEntry} = {
checkIfReactPresen | {
"filepath": "packages/react-devtools-extensions/src/evalScripts.js",
"language": "javascript",
"file_size": 3372,
"cut_index": 614,
"middle_length": 229
} |
*/
import type {BrowserTheme} from 'react-devtools-shared/src/devtools/views/DevTools';
export function getBrowserTheme(): BrowserTheme {
if (__IS_CHROME__) {
// chrome.devtools.panels added in Chrome 18.
// chrome.devtools.panels.themeName added in Chrome 54.
return chrome.devtools.panels.themeName ===... | ) {
switch (chrome.devtools.panels.themeName) {
case 'dark':
return 'dark';
default:
return 'light';
}
}
}
}
export const COMPACT_VERSION_NAME = 'compact';
export const EXTENSION_CONTAINED_VERSIONS = [ | me
if (chrome.devtools && chrome.devtools.panels | {
"filepath": "packages/react-devtools-extensions/src/utils.js",
"language": "javascript",
"file_size": 860,
"cut_index": 529,
"middle_length": 52
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {exec} from 'child-process-promise';
import {readFileSync} from 'fs';
import path from 'path';
import {rimrafSync} from 'rimraf';
des... | ync(pathToChromeExtensionBuild);
});
describe('for dev builds', () => {
it('should not ignore list anything', async () => {
await exec('yarn build:chrome:local', {
cwd: pathToExtensionsPackage,
});
const sourceMapJSON = | .join(
pathToExtensionsPackage,
'chrome/build',
);
const pathToSourceMap = path.resolve(
pathToChromeExtensionBuild,
'unpacked/build/react_devtools_backend_compact.js.map',
);
afterAll(() => {
rimrafS | {
"filepath": "packages/react-devtools-extensions/src/__tests__/ignoreList-test.js",
"language": "javascript",
"file_size": 1601,
"cut_index": 537,
"middle_length": 229
} |
ight (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export function cloneStyleTags(): Array<HTMLLinkElement | HTMLStyleElement> {
const tags: Array<HTMLLinkElement | HTMLStyleEle... | eValue);
}
tags.push(newLinkTag);
}
}
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const styleTag of document.getElementsByTagName('style')) {
const newStyleTag = document.createElement('style');
// esli | newLinkTag = document.createElement('link');
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const attribute of linkTag.attributes) {
newLinkTag.setAttribute(attribute.nodeName, attribute.nod | {
"filepath": "packages/react-devtools-extensions/src/main/cloneStyleTags.js",
"language": "javascript",
"file_size": 1296,
"cut_index": 524,
"middle_length": 229
} |
InInspectedWindow} from './evalInInspectedWindow';
export function setBrowserSelectionFromReact() {
// This is currently only called on demand when you press "view DOM".
// In the future, if Chrome adds an inspect() that doesn't switch tabs,
// we could make this happen automatically when you select another comp... |
'setReactSelectionFromBrowser',
[],
(didSelectionChange, evalError) => {
if (evalError) {
console.error(evalError);
} else if (didSelectionChange) {
if (!bridge) {
console.error(
'Browser eleme | ;
}
export function setReactSelectionFromBrowser(bridge) {
// When the user chooses a different node in the browser Elements tab,
// copy it over to the hook object so that we can sync the selection.
evalInInspectedWindow( | {
"filepath": "packages/react-devtools-extensions/src/main/elementSelection.js",
"language": "javascript",
"file_size": 1268,
"cut_index": 524,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {EvalScriptIds} from '../evalScripts';
import {evalScripts} from '../evalScripts';
type ExceptionInfo = {
code: ?string,
description: ?string,
isEr... | al script with id "${scriptId}" exists.`);
}
const code = evalScripts[scriptId].code.apply(null, args);
const tabId = chrome.devtools.inspectedWindow.tabId;
const requestId = evalRequestId++;
chrome.runtime.sendMessage({
source: 'devtools-pag | ny}) => void,
>();
function fallbackEvalInInspectedWindow(
scriptId: EvalScriptIds,
args: any[],
callback: (value: any, exceptionInfo: ?ExceptionInfo) => void,
) {
if (!evalScripts[scriptId]) {
throw new Error(`No ev | {
"filepath": "packages/react-devtools-extensions/src/main/evalInInspectedWindow.js",
"language": "javascript",
"file_size": 2997,
"cut_index": 563,
"middle_length": 229
} |
BUG__} from 'react-devtools-shared/src/constants';
let debugIDCounter = 0;
const debugLog = (...args) => {
if (__DEBUG__) {
console.log(...args);
}
};
const fetchFromNetworkCache = (url, resolve, reject) => {
// Debug ID allows us to avoid re-logging (potentially long) URL strings below,
// while also st... | debugLog(
`[main] fetchFromNetworkCache(${debugID}) Found matching URL in HAR`,
url,
);
if (entry.getContent != null) {
entry.getContent(content => {
if (content) {
debugLog(
`[m | {debugID})`, url);
}
chrome.devtools.network.getHAR(harLog => {
for (let i = 0; i < harLog.entries.length; i++) {
const entry = harLog.entries[i];
if (url !== entry.request.url) {
continue;
}
| {
"filepath": "packages/react-devtools-extensions/src/main/fetchFileWithCaching.js",
"language": "javascript",
"file_size": 4797,
"cut_index": 614,
"middle_length": 229
} |
-devtools-shared/src/storage';
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
import {
LOCAL_STORAGE_SUPPORTS_PROFILING_KEY,
LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY,
} from 'react-devtools-shared/src/constants';
import {logEvent} from 'react-devtools-shared/src/Logger';
import {
getAlwa... | ection';
import {evalInInspectedWindow} from './evalInInspectedWindow';
import {startReactPolling} from './reactPolling';
import {cloneStyleTags} from './cloneStyleTags';
import fetchFileWithCaching from './fetchFileWithCaching';
import injectBackendManag | port * as parseHookNames from 'react-devtools-shared/src/hooks/parseHookNames';
import {
setBrowserSelectionFromReact,
setReactSelectionFromBrowser,
} from './elementSelection';
import {viewAttributeSource} from './sourceSel | {
"filepath": "packages/react-devtools-extensions/src/main/index.js",
"language": "javascript",
"file_size": 22225,
"cut_index": 1331,
"middle_length": 229
} |
tedWindow';
class CouldNotFindReactOnThePageError extends Error {
constructor() {
super("Could not find React, or it hasn't been loaded yet");
// Maintains proper stack trace for where our error was thrown (only available on V8)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CouldNot... | er case
function checkIfReactPresentInInspectedWindow(onSuccess, onError) {
evalInInspectedWindow(
'checkIfReactPresentInInspectedWindow',
[],
(pageHasReact, exceptionInfo) => {
if (status === 'aborted') {
onError( | chingAttemptsThreshold,
) {
let status = 'idle';
function abort() {
status = 'aborted';
}
// This function will call onSuccess only if React was found and polling is not aborted, onError will be called for every oth | {
"filepath": "packages/react-devtools-extensions/src/main/reactPolling.js",
"language": "javascript",
"file_size": 2894,
"cut_index": 563,
"middle_length": 229
} |
t contentScriptsToInject = [
{
id: '@react-devtools/proxy',
js: ['build/proxy.js'],
matches: ['<all_urls>'],
persistAcrossSessions: true,
runAt: 'document_start',
world: chrome.scripting.ExecutionWorld.ISOLATED,
},
{
id: '@react-devtools/file-fetcher',
js: ['build/fileFetcher.js'],... | ',
js: ['build/installHook.js'],
matches: ['<all_urls>'],
persistAcrossSessions: true,
runAt: 'document_start',
world: chrome.scripting.ExecutionWorld.MAIN,
},
{
id: '@react-devtools/hook-settings-injector',
js: ['build/hook | ontext',
js: ['build/fallbackEvalContext.js'],
matches: ['<all_urls>'],
persistAcrossSessions: true,
runAt: 'document_start',
world: chrome.scripting.ExecutionWorld.MAIN,
},
{
id: '@react-devtools/hook | {
"filepath": "packages/react-devtools-extensions/src/background/dynamicallyInjectContentScripts.js",
"language": "javascript",
"file_size": 1985,
"cut_index": 537,
"middle_length": 229
} |
ta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/* global chrome */
export function executeScriptInIsolatedWorld({
target,
files,
}: {
files: any,
target: any,
}): Promise<void> {... |
// It's nice to have this required to make active choices.
injectImmediately: boolean,
}): Promise<void> {
return chrome.scripting.executeScript({
target,
files,
injectImmediately,
world: chrome.scripting.ExecutionWorld.MAIN,
});
} | injectImmediately,
}: {
files: any,
target: any, | {
"filepath": "packages/react-devtools-extensions/src/background/executeScript.js",
"language": "javascript",
"file_size": 844,
"cut_index": 535,
"middle_length": 52
} |
* global chrome, ExtensionRuntimePort */
'use strict';
import './dynamicallyInjectContentScripts';
import './tabsManager';
import {
handleDevToolsPageMessage,
handleBackendManagerMessage,
handleReactDevToolsHookMessage,
handleFetchResourceContentScriptMessage,
} from './messageHandlers';
const ports: {
//... | ,
disconnectPipe: null,
};
}
}
function registerExtensionPort(port: ExtensionRuntimePort, tabId: number) {
// $FlowFixMe[incompatible-type]
ports[tabId].extension = port;
port.onDisconnect.addListener(() => {
// This should delete d | pe: Function | null,
},
} = {};
function registerTab(tabId: number) {
// $FlowFixMe[incompatible-type]
if (!ports[tabId]) {
// $FlowFixMe[incompatible-type]
ports[tabId] = {
extension: null,
proxy: null | {
"filepath": "packages/react-devtools-extensions/src/background/index.js",
"language": "javascript",
"file_size": 6343,
"cut_index": 716,
"middle_length": 229
} |
nIconAndPopup from './setExtensionIconAndPopup';
import {executeScriptInMainWorld} from './executeScript';
import {EXTENSION_CONTAINED_VERSIONS} from '../utils';
export function handleReactDevToolsHookMessage(message, sender) {
const {payload} = message;
switch (payload?.type) {
case 'react-renderer-attached... | ately: true,
target: {tabId: sender.tab.id},
files: [`/build/react_devtools_backend_${version}.js`],
});
}
});
break;
}
}
}
export function handleDevToolsPageMessage(message) {
const {payload} | e;
switch (payload?.type) {
case 'require-backends': {
payload.versions.forEach(version => {
if (EXTENSION_CONTAINED_VERSIONS.includes(version)) {
executeScriptInMainWorld({
injectImmedi | {
"filepath": "packages/react-devtools-extensions/src/background/messageHandlers.js",
"language": "javascript",
"file_size": 4598,
"cut_index": 614,
"middle_length": 229
} |
Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
export function injectInternals(internals: Object): boolean ... | {
// DevTools exists, even though it doesn't support Flight.
return true;
}
try {
hook.inject(internals);
} catch (err) {
// Catch all errors because it is unsafe to throw during initialization.
if (__DEV__) {
console.error( | n't a real property on the hook, but it can be set to opt out
// of DevTools integration and associated warnings and logs.
// https://github.com/facebook/react/issues/3877
return true;
}
if (!hook.supportsFlight) | {
"filepath": "packages/react-client/src/ReactFlightClientDevToolsHook.js",
"language": "javascript",
"file_size": 1243,
"cut_index": 518,
"middle_length": 229
} |
=
new WeakMap();
// Serializable values
export type ReactServerValue =
// References are passed by their value
| ServerReference<any>
// The rest are passed as is. Sub-types can be passed in but lose their
// subtype, so the receiver can only accept once of these.
| string
| boolean
| number
| null
... | erObject = {+[key: string]: ReactServerValue};
const __PROTO__ = '__proto__';
function serializeByValueID(id: number): string {
return '$' + id.toString(16);
}
function serializePromiseID(id: number): string {
return '$@' + id.toString(16);
}
funct | rverValue>
| Array<ReactServerValue>
| Map<ReactServerValue, ReactServerValue>
| Set<ReactServerValue>
| FormData
| Date
| ReactServerObject
| Promise<ReactServerValue>; // Thenable<ReactServerValue>
type ReactServ | {
"filepath": "packages/react-client/src/ReactFlightReplyClient.js",
"language": "javascript",
"file_size": 49750,
"cut_index": 2151,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
* @jest-environment node
*/
'use strict';
if (typeof Blob === 'undefined') {
global.Blob = require('buffer').Blob;
}
if (typeof File === 'undefined' || t... | +;
});
Object.defineProperty(performance, 'timeOrigin', {
value: time,
configurable: true,
});
Object.defineProperty(performance, 'now', {
value: now,
configurable: true,
});
jest.resetModules();
jest.mo | eactNoopFlightClient;
let getDebugInfo;
describe('ReactFlight', () => {
beforeEach(() => {
// Mock performance.now for timing tests
let time = 10;
const now = jest.fn().mockImplementation(() => {
return time+ | {
"filepath": "packages/react-client/src/__tests__/ReactFlightDebugChannel-test.js",
"language": "javascript",
"file_size": 2913,
"cut_index": 563,
"middle_length": 229
} |
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-esm'... | * from 'react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM';
export * from 'react-server-dom-esm/src/client/ReactFlightClientConfigTargetESMBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const use | owser';
export | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-browser-esm.js",
"language": "javascript",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
yright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-flight-server-fb';
... | from 'react-flight-server-fb/src/client/ReactFlightClientConfigBundlerFB';
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigTargetFBBrowser';
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigDOMFB';
export cons | er';
export * | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-browser-fb.js",
"language": "javascript",
"file_size": 815,
"cut_index": 522,
"middle_length": 14
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-webpack';
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from '... | k/src/client/ReactFlightClientConfigBundlerWebpackBrowser';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR | dlerWebpack';
export * from 'react-server-dom-webpac | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-browser.js",
"language": "javascript",
"file_size": 923,
"cut_index": 606,
"middle_length": 52
} |
Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-bun';... | type ServerReferenceId = string;
export opaque type ClientReferenceMetadata = mixed;
export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars
export const resolveClientReference: any = null;
export const resolveServerReference: | ';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export opaque type ModuleLoading = mixed;
export opaque type ServerConsumerModuleMap = mixed;
export opaque type ServerManifest = mixed;
export opaque | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-bun.js",
"language": "javascript",
"file_size": 1227,
"cut_index": 518,
"middle_length": 229
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-webpack';
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from '... | rc/client/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = tru | rWebpack';
export * from 'react-server-dom-webpack/s | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-edge-webpack.js",
"language": "javascript",
"file_size": 917,
"cut_index": 606,
"middle_length": 52
} |
Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'not-used';
export * f... | ientReferenceMetadata = mixed;
export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars
export const resolveClientReference: any = null;
export const resolveServerReference: any = null;
export const preloadModule: any = null;
ex | rt type Response = any;
export opaque type ModuleLoading = mixed;
export opaque type ServerConsumerModuleMap = mixed;
export opaque type ServerManifest = mixed;
export opaque type ServerReferenceId = string;
export opaque type Cl | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-legacy.js",
"language": "javascript",
"file_size": 1212,
"cut_index": 518,
"middle_length": 229
} |
yright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-parcel';
... | om 'react-server-dom-parcel/src/client/ReactFlightClientConfigBundlerParcel';
export * from 'react-server-dom-parcel/src/client/ReactFlightClientConfigTargetParcelServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export con | ';
export * fr | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node-parcel.js",
"language": "javascript",
"file_size": 815,
"cut_index": 522,
"middle_length": 14
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-turbopack';
export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * fro... | bopack/src/client/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const use | ndlerTurbopack';
export * from 'react-server-dom-tur | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node-turbopack.js",
"language": "javascript",
"file_size": 931,
"cut_index": 606,
"middle_length": 52
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-markup';
import type {Thenable} from 'shared/ReactTypes';
e... | ue type ClientReference<T> = null; // eslint-disable-line no-unused-vars
export function prepareDestinationForModule(
moduleLoading: ModuleLoading,
nonce: ?string,
metadata: ClientReferenceMetadata,
) {
throw new Error(
'renderToHTML should no | ain';
export type ModuleLoading = null;
export type ServerConsumerModuleMap = null;
export opaque type ServerManifest = null;
export type ServerReferenceId = string;
export opaque type ClientReferenceMetadata = null;
export opaq | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.markup.js",
"language": "javascript",
"file_size": 2601,
"cut_index": 563,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// This is a host config that's used for the internal `react-noop-renderer` package.
//
// Its API lets you pass the host config as an argument.
// However, inside the... | ModuleLoading = mixed;
export opaque type ServerConsumerModuleMap = mixed;
export opaque type ServerManifest = mixed;
export opaque type ServerReferenceId = string;
export opaque type ClientReferenceMetadata = mixed;
export opaque type ClientReference<T> | = function ($$$config) {
// /* renderer code */
// }
//
// So `$$$config` looks like a global variable, but it's
// really an argument to a top-level wrapping function.
declare const $$$config: $FlowFixMe;
export opaque type | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.noop.js",
"language": "javascript",
"file_size": 2133,
"cut_index": 563,
"middle_length": 229
} |
Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactServerConsoleConfig
// This flips color using ANSI, then sets a color styling, then resets.
const badgeFormat = '\x... | const bind = Function.prototype.bind;
export function bindToConsole(
methodName: string,
args: Array<any>,
badgeName: string,
): () => any {
let offset = 0;
switch (methodName) {
case 'dir':
case 'dirxml':
case 'groupEnd':
case ' |
'background: #e6e6e6;' +
'background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));' +
'color: #000000;' +
'color: light-dark(#000000, #ffffff);' +
'border-radius: 2px';
const resetStyle = '';
const pad = ' ';
| {
"filepath": "packages/react-client/src/ReactClientConsoleConfigServer.js",
"language": "javascript",
"file_size": 1974,
"cut_index": 537,
"middle_length": 229
} |
ight (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
let hasConfirmedEval = false;
export function checkEvalAvailabilityOnceDev(): void {
if (__DEV__) {
if (!hasConfirmedEval)... | us debugging features ' +
'like reconstructing callstacks from a different environment.\n' +
'React will never use eval() in production mode',
);
}
}
} else {
// These errors should never make it into a build | n this environment. ' +
'If this page was served with a `Content-Security-Policy` header, ' +
'make sure that `unsafe-eval` is included. ' +
'React requires eval() in development mode for vario | {
"filepath": "packages/react-client/src/ReactClientDebugConfigBrowser.js",
"language": "javascript",
"file_size": 1259,
"cut_index": 524,
"middle_length": 229
} |
, // DEV-only
then(resolve: (T) => mixed, reject?: (mixed) => mixed): void,
};
type HaltedChunk<T> = {
status: 'halted',
value: null,
reason: null,
_children: Array<SomeChunk<any>> | ProfilingResult, // Profiling-only
_debugChunk: null, // DEV-only
_debugInfo: ReactDebugInfo, // DEV-only
then(resolve: (... | & enableComponentPerformanceTrack) {
this._children = [];
}
if (__DEV__) {
this._debugChunk = null;
this._debugInfo = [];
}
}
// We subclass Promise.prototype so that we get other methods like .catch
ReactPromise.prototype = (Object.creat | rroredChunk<T>
| HaltedChunk<T>;
// $FlowFixMe[missing-this-annot]
function ReactPromise(status: any, value: any, reason: any) {
this.status = status;
this.value = value;
this.reason = reason;
if (enableProfilerTimer & | {
"filepath": "packages/react-client/src/ReactFlightClient.js",
"language": "javascript",
"file_size": 174805,
"cut_index": 7068,
"middle_length": 229
} |
e.measure === 'function';
const IO_TRACK = 'Server Requests β';
const COMPONENTS_TRACK = 'Server Components β';
export function markAllTracksInOrder() {
if (supportsUserTiming) {
// Ensure we create the Server Component track groups earlier than the Client Scheduler
// and Client Components. We can always a... | ary',
'Parallel',
'Parallel\u200b', // Padded with zero-width space to give each track a unique name.
'Parallel\u200b\u200b',
'Parallel\u200b\u200b\u200b',
'Parallel\u200b\u200b\u200b\u200b',
'Parallel\u200b\u200b\u200b\u200b\u200b',
'Paralle | undefined,
'primary-light',
);
console.timeStamp(
'Server Components Track',
0.001,
0.001,
'Primary',
COMPONENTS_TRACK,
'primary-light',
);
}
}
const trackNames = [
'Prim | {
"filepath": "packages/react-client/src/ReactFlightPerformanceTrack.js",
"language": "javascript",
"file_size": 18737,
"cut_index": 1331,
"middle_length": 229
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-turbopack';
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from... | turbopack/src/client/ReactFlightClientConfigBundlerTurbopackBrowser';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export cons | gBundlerTurbopack';
export * from 'react-server-dom- | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-browser-turbopack.js",
"language": "javascript",
"file_size": 937,
"cut_index": 606,
"middle_length": 52
} |
a Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-flight-server-fb';
export * from ... | -server-fb/src/client/ReactFlightClientConfigBundlerFB';
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigTargetFBBrowser';
export * from 'react-flight-server-fb/src/client/ReactFlightClientConfigDOMFB';
export const usedWithSSR = fa | 'react-flight | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node-fb.js",
"language": "javascript",
"file_size": 811,
"cut_index": 536,
"middle_length": 14
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-webpack';
export * from 'react-client/src/ReactFlightClientStreamConfigNode';
export * from '... | c/client/ReactFlightClientConfigBundlerWebpackServer';
export * from 'react-server-dom-webpack/src/client/ReactFlightClientConfigTargetWebpackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true | Webpack';
export * from 'react-server-dom-webpack/sr | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node.js",
"language": "javascript",
"file_size": 916,
"cut_index": 606,
"middle_length": 52
} |
import type {ReactNodeList} from 'shared/ReactTypes';
import type {
RenderState,
ResumableState,
PreambleState,
HoistableState,
FormatContext,
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
import {
pushStartInstance as pushStartInstanceImpl,
writePreambleStart as writePreambleStartImpl,
} f... | render.
export const isPrimaryRenderer = false;
// Disable Client Hooks
export const supportsClientAPIs = false;
import {stringToChunk} from 'react-server/src/ReactServerStreamConfig';
export type {
RenderState,
ResumableState,
HoistableState,
| from 'react-dom-bindings/src/shared/ReactDOMFormActions';
import {NotPending} from 'react-dom-bindings/src/shared/ReactDOMFormActions';
import hasOwnProperty from 'shared/hasOwnProperty';
// Allow embedding inside another Fizz | {
"filepath": "packages/react-markup/src/ReactFizzConfigMarkup.js",
"language": "javascript",
"file_size": 6498,
"cut_index": 716,
"middle_length": 229
} |
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
let hasConfirmedEval = false;
export function checkEvalAvailabilityOnceDev(): void {
if (__DEV__) {
if (!hasConfi... | er use eval() in production mode',
);
}
}
} else {
// These errors should never make it into a build so we don't need to encode them in codes.json
// eslint-disable-next-line react-internal/prod-error-codes
throw new Error(
| pported in this environment. ' +
'React requires eval() in development mode for various debugging features ' +
'like reconstructing callstacks from a different environment.\n' +
'React will nev | {
"filepath": "packages/react-client/src/ReactClientDebugConfigPlain.js",
"language": "javascript",
"file_size": 1118,
"cut_index": 515,
"middle_length": 229
} |
expect(this.state.hasError).toBe(false);
}
render() {
if (this.state.hasError) {
return this.state.error.message;
}
return this.props.children;
}
};
});
afterEach(() => {
jest.restoreAllMocks();
});
function clientReference(value) {
retur... | : (
<div>
<Bar text="a" />, <Bar text="b" />
</div>
),
};
}
const transport = ReactNoopFlightServer.render({
foo: <Foo />,
});
const model = await ReactNoopFlightClient.read(transport);
| ference')},
value: {value: value},
},
);
}
it('can render a Server Component', async () => {
function Bar({text}) {
return text.toUpperCase();
}
function Foo() {
return {
bar | {
"filepath": "packages/react-client/src/__tests__/ReactFlight-test.js",
"language": "javascript",
"file_size": 134834,
"cut_index": 7068,
"middle_length": 229
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// This is a host config that's used for the `react-server` package on npm.
// It is only used by third-party renderers.
//
// Its API lets you pass the host config as... | fig: any;
export opaque type ModuleLoading = mixed;
export opaque type ServerConsumerModuleMap = mixed;
export opaque type ServerManifest = mixed;
export opaque type ServerReferenceId = string;
export opaque type ClientReferenceMetadata = mixed;
export op | something like:
//
// module.exports = function ($$$config) {
// /* renderer code */
// }
//
// So `$$$config` looks like a global variable, but it's
// really an argument to a top-level wrapping function.
declare const $$$con | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.custom.js",
"language": "javascript",
"file_size": 2162,
"cut_index": 563,
"middle_length": 229
} |
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom... | el/src/client/ReactFlightClientConfigBundlerParcel';
export * from 'react-server-dom-parcel/src/client/ReactFlightClientConfigTargetParcelBrowser';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = false;
| ConfigBrowser';
export * from 'react-server-dom-parc | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-browser-parcel.js",
"language": "javascript",
"file_size": 820,
"cut_index": 512,
"middle_length": 52
} |
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom... | ndled/src/client/ReactFlightClientConfigBundlerNode';
export * from 'react-server-dom-unbundled/src/client/ReactFlightClientConfigTargetNodeServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const usedWithSSR = true;
| bugConfigNode';
export * from 'react-server-dom-unbu | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-node-unbundled.js",
"language": "javascript",
"file_size": 820,
"cut_index": 512,
"middle_length": 52
} |
ight (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Keep in sync with ReactServerConsoleConfig
const badgeFormat = '[%s]';
const pad = ' ';
const bind = Function.prototype.bind... | able-line react-internal/no-production-logging
}
case 'assert': {
// assert takes formatting options as the second argument.
offset = 1;
}
}
const newArgs = args.slice(0);
if (typeof newArgs[offset] === 'string') {
newArg | case 'groupEnd':
case 'table': {
// These methods cannot be colorized because they don't take a formatting string.
// $FlowFixMe
return bind.apply(console[methodName], [console].concat(args)); // eslint-dis | {
"filepath": "packages/react-client/src/ReactClientConsoleConfigPlain.js",
"language": "javascript",
"file_size": 1401,
"cut_index": 524,
"middle_length": 229
} |
yright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-parcel';
... | om 'react-server-dom-parcel/src/client/ReactFlightClientConfigBundlerParcel';
export * from 'react-server-dom-parcel/src/client/ReactFlightClientConfigTargetParcelServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export con | ';
export * fr | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-edge-parcel.js",
"language": "javascript",
"file_size": 815,
"cut_index": 522,
"middle_length": 14
} |
iates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactNodeList} from 'shared/ReactTypes';
import type {ErrorInfo} from 'react-server/src/ReactFizzServer';
import ReactVersion from 'shared/ReactVersion';... | => ?string,
};
export function experimental_renderToHTML(
children: ReactNodeList,
options?: MarkupOptions,
): Promise<string> {
return new Promise((resolve, reject) => {
let buffer = '';
const fizzDestination = {
push(chunk: string | | createResumableState,
createRenderState,
createRootFormatContext,
} from './ReactFizzConfigMarkup';
type MarkupOptions = {
identifierPrefix?: string,
signal?: AbortSignal,
onError?: (error: mixed, errorInfo: ErrorInfo) | {
"filepath": "packages/react-markup/src/ReactMarkupClient.js",
"language": "javascript",
"file_size": 2792,
"cut_index": 563,
"middle_length": 229
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
export {default as rendererVersion} from 'shared/ReactVersion';
export const rendererPackageName = 'react-server-dom-turbopack';
export * from 'react-client/src/ReactFlightClientStreamConfigWeb';
export * from... | bopack/src/client/ReactFlightClientConfigBundlerTurbopackServer';
export * from 'react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer';
export * from 'react-dom-bindings/src/shared/ReactFlightClientConfigDOM';
export const use | ndlerTurbopack';
export * from 'react-server-dom-tur | {
"filepath": "packages/react-client/src/forks/ReactFlightClientConfig.dom-edge-turbopack.js",
"language": "javascript",
"file_size": 931,
"cut_index": 606,
"middle_length": 52
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.