prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
a different message format when reading properties of null or undefined.
// Older versions use e.g. "Cannot read property 'world' of undefined"
// Newer versions use e.g. "Cannot read properties of undefined (reading 'world')"
// This file overrides the built-in toThrow() matches to handle both cases,
// enabling the ... | to rename:
const regex = /Cannot read property '([^']+)' of (.+)/;
// Massage strings (written in the older format) to match the newer format
// if tests are currently running on Node 16+
function normalizeErrorMessage(message) {
if (newErrorFormat) {
| the newer stack format:
let newErrorFormat = false;
try {
null.test();
} catch (error) {
if (error.message.includes('Cannot read properties of null')) {
newErrorFormat = true;
}
}
// Detect the message pattern we need | {
"filepath": "scripts/jest/matchers/toThrow.js",
"language": "javascript",
"file_size": 1550,
"cut_index": 537,
"middle_length": 229
} |
trict';
const semver = require('semver');
const {ReactVersion} = require('../../../ReactVersions');
// DevTools stores preferences between sessions in localStorage
if (!global.hasOwnProperty('localStorage')) {
global.localStorage = require('local-storage-fallback').default;
}
// Mimic the global we set with Webpac... | t, range);
if (shouldPass) {
test(testName, callback);
} else {
test.skip(testName, callback);
}
};
global._test_react_version_focus = (range, testName, callback) => {
const shouldPass = semver.satisfies(ReactVersionTestingAgainst, range) | .__IS_NATIVE__ = false;
const ReactVersionTestingAgainst = process.env.REACT_VERSION || ReactVersion;
global._test_react_version = (range, testName, callback) => {
const shouldPass = semver.satisfies(ReactVersionTestingAgains | {
"filepath": "scripts/jest/devtools/setupEnv.js",
"language": "javascript",
"file_size": 1217,
"cut_index": 518,
"middle_length": 229
} |
trict';
const semver = require('semver');
const NODE_MODULES_DIR =
process.env.RELEASE_CHANNEL === 'stable' ? 'oss-stable' : 'oss-experimental';
const REACT_VERSION = process.env.REACT_VERSION;
const moduleNameMapper = {};
const setupFiles = [];
// We only want to add these if we are in a regression test, IE if ... | cing-profiling`;
}
// react-dom/client is only in v18.0.0 and up, so we
// map it to react-dom instead
if (semver.satisfies(REACT_VERSION, '<18.0')) {
moduleNameMapper['^react-dom/client$'] =
`<rootDir>/build/${NODE_MODULES_DIR}/react-do | r.satisfies(REACT_VERSION, '16.5')) {
moduleNameMapper[`^schedule$`] =
`<rootDir>/build/${NODE_MODULES_DIR}/schedule`;
moduleNameMapper['^schedule/tracing$'] =
`<rootDir>/build/${NODE_MODULES_DIR}/schedule/tra | {
"filepath": "scripts/jest/devtools/config.build-devtools-regression.js",
"language": "javascript",
"file_size": 1149,
"cut_index": 518,
"middle_length": 229
} |
valence-reporter/setupTests.js');
} else {
const errorMap = require('../error-codes/codes.json');
// By default, jest.spyOn also calls the spied method.
const spyOn = jest.spyOn;
const noop = jest.fn;
// Can be used to normalize paths in stackframes
global.__REACT_ROOT_PATH_TEST__ = path.resolve(__dirname... | 'It can accidentally hide unexpected errors in production builds. ' +
'Use spyOnDev(), spyOnProd(), or spyOnDevAndProd() instead.'
);
};
if (process.env.NODE_ENV === 'production') {
global.spyOnDev = noop;
global.spyOnProd = | iar spyOn() helper though,
// So we disable it entirely.
// Spying on both dev and prod will require using both spyOnDev() and spyOnProd().
global.spyOn = function () {
throw new Error(
'Do not use spyOn(). ' +
| {
"filepath": "scripts/jest/setupTests.js",
"language": "javascript",
"file_size": 11311,
"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.
*/
'use strict';
const {
patchConsoleMethods,
resetAllUnexpectedConsoleCalls,
assertConsoleLogsCleared,
} = require('internal-test-utils/consoleMock'... | 'It can accidentally hide unexpected errors in production builds. ' +
'Use spyOnDev(), spyOnProd(), or spyOnDevAndProd() instead.'
);
};
global.spyOnDev = function (...args) {
if (__DEV__) {
return spyOn(...args);
}
};
global.spyOnDe | more familiar spyOn() helper though,
// So we disable it entirely.
// Spying on both dev and prod will require using both spyOnDev() and spyOnProd().
global.spyOn = function () {
throw new Error(
'Do not use spyOn(). ' +
| {
"filepath": "scripts/jest/spec-equivalence-reporter/setupTests.js",
"language": "javascript",
"file_size": 1777,
"cut_index": 537,
"middle_length": 229
} |
ative} = require('path');
const {DRY_RUN, ROOT_PATH} = require('./configuration');
const {
clear,
confirm,
confirmContinue,
execRead,
logger,
saveBuildMetadata,
} = require('./utils');
// This is the primary control function for this script.
async function main() {
clear();
await confirm('Have you sto... | ),
chalk.gray('(start)')
);
const buildAndTestScriptPath = join(__dirname, 'build-and-test.js');
const pathToPrint = relative(process.cwd(), buildAndTestScriptPath);
console.log('\nThen restart this release step:');
console.log( | console.log(
chalk.bold(' ' + join(packagesPath, 'react-devtools-core')),
chalk.gray('(start:backend, start:standalone)')
);
console.log(
chalk.bold(' ' + join(packagesPath, 'react-devtools-inline') | {
"filepath": "scripts/devtools/build-and-test.js",
"language": "javascript",
"file_size": 6750,
"cut_index": 716,
"middle_length": 229
} |
e strict';
jest.mock('shared/ReactFeatureFlags', () => {
jest.mock(
'ReactNativeInternalFeatureFlags',
() =>
jest.requireActual('shared/forks/ReactFeatureFlags.native-fb-dynamic.js'),
{virtual: true}
);
const actual = jest.requireActual(
'shared/forks/ReactFeatureFlags.native-fb.js'
);
... | would fail correctly.
actual.enableLegacyCache = true;
actual.enableLegacyHidden = true;
actual.enableScopeAPI = true;
actual.enableTaint = false;
// Some value that doesn't impact existing tests
actual.ownerStackLimit = __VARIANT__ ? 500 : 1 | ntry points, some of these flags
// need to be set to the www value for the entrypoint, otherwise gating would
// fail due to the tests passing. Ideally, the www entry points for these APIs
// would be gated, and then these | {
"filepath": "scripts/jest/setupTests.xplat.js",
"language": "javascript",
"file_size": 1082,
"cut_index": 515,
"middle_length": 229
} |
trict';
const {join} = require('path');
const PACKAGE_PATHS = [
'packages/react-devtools/package.json',
'packages/react-devtools-core/package.json',
'packages/react-devtools-inline/package.json',
'packages/react-devtools-timeline/package.json',
];
const MANIFEST_PATHS = [
'packages/react-devtools-extension... | RELEASE_SCRIPT_TOKEN -->';
const ROOT_PATH = join(__dirname, '..', '..');
const DRY_RUN = process.argv.includes('--dry');
const BUILD_METADATA_TEMP_DIRECTORY = join(__dirname, '.build-metadata');
module.exports = {
BUILD_METADATA_TEMP_DIRECTORY,
C |
'react-devtools-core',
'react-devtools-inline',
];
const CHANGELOG_PATH = 'packages/react-devtools/CHANGELOG.md';
const PULL_REQUEST_BASE_URL = 'https://github.com/facebook/react/pull/';
const RELEASE_SCRIPT_TOKEN = '<!-- | {
"filepath": "scripts/devtools/configuration.js",
"language": "javascript",
"file_size": 1145,
"cut_index": 518,
"middle_length": 229
} |
;
const JestReact = require('jest-react');
const {assertConsoleLogsCleared} = require('internal-test-utils/consoleMock');
// TODO: Move to ReactInternalTestUtils
function captureAssertion(fn) {
// Trick to use a Jest matcher inside another Jest matcher. `fn` contains an
// assertion; if it throws, we capture the ... | ror = Error(
'The event log is not empty. Call assertLog(...) first.'
);
Error.captureStackTrace(error, caller);
throw error;
}
assertConsoleLogsCleared();
}
function toMatchRenderedOutput(ReactNoop, expectedJSX) {
if (typeof React |
message: () => error.message,
};
}
return {pass: true};
}
function assertYieldsWereCleared(Scheduler, caller) {
const actualYields = Scheduler.unstable_clearLog();
if (actualYields.length !== 0) {
const er | {
"filepath": "scripts/jest/matchers/reactTestMatchers.js",
"language": "javascript",
"file_size": 1394,
"cut_index": 524,
"middle_length": 229
} |
ess-promise');
const {readJsonSync} = require('fs-extra');
const inquirer = require('inquirer');
const {join, relative} = require('path');
const {DRY_RUN, NPM_PACKAGES, ROOT_PATH} = require('./configuration');
const {
checkNPMPermissions,
clear,
confirm,
execRead,
logger,
readSavedBuildMetadata,
} = require... | ' + pathToPrint));
});
const {archivePath, currentCommitHash} = readSavedBuildMetadata();
await checkNPMPermissions();
await publishToNPM();
await printFinalInstructions(currentCommitHash, archivePath);
}
async function printFinalInstruction | TestScriptPath = join(__dirname, 'build-and-test.js');
const pathToPrint = relative(process.cwd(), buildAndTestScriptPath);
console.log('Begin by running the build-and-test script:');
console.log(chalk.bold.green(' | {
"filepath": "scripts/devtools/publish-release.js",
"language": "javascript",
"file_size": 3522,
"cut_index": 614,
"middle_length": 229
} |
args = require('yargs');
const Bundles = require('./bundles');
// Runs the build script for both stable and experimental release channels,
// by configuring an environment variable.
const sha = String(spawnSync('git', ['rev-parse', 'HEAD']).stdout).slice(0, 8);
let dateString = String(
spawnSync('git', [
'show... | aceholder version is the same format that the "next" channel uses
const PLACEHOLDER_REACT_VERSION =
ReactVersion + '-' + canaryChannelLabel + '-' + sha + '-' + dateString;
// TODO: We should inject the React version using a build-time parameter
// inste | String.startsWith("'")) {
dateString = dateString.slice(1, 9);
}
// Build the artifacts using a placeholder React version. We'll then do a string
// replace to swap it with the correct version per release channel.
//
// The pl | {
"filepath": "scripts/rollup/build-all-release-channels.js",
"language": "javascript",
"file_size": 16158,
"cut_index": 921,
"middle_length": 229
} |
FB_WWW_DEV,
FB_WWW_PROD,
FB_WWW_PROFILING,
RN_FB_DEV,
RN_FB_PROD,
RN_FB_PROFILING,
],
moduleType: ISOMORPHIC,
entry: 'react',
global: 'React',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: true,
externals: ['ReactNativeInternalFeatureFlags'],
... | NODE_PROD,
NODE_PROFILING,
// TODO: use on WWW.
RN_FB_DEV,
RN_FB_PROD,
RN_FB_PROFILING,
],
moduleType: ISOMORPHIC,
entry: 'react/jsx-runtime',
global: 'JSXRuntime',
minifyWithProdErrorCodes: true,
| ,
condition: 'react-server',
global: 'React',
minifyWithProdErrorCodes: true,
wrapWithModuleBoundaries: false,
externals: [],
},
/******* React JSX Runtime *******/
{
bundleTypes: [
NODE_DEV,
| {
"filepath": "scripts/rollup/bundles.js",
"language": "javascript",
"file_size": 39822,
"cut_index": 2151,
"middle_length": 229
} |
mpiler;
const prettier = require('prettier');
const instructionDir =
'./packages/react-dom-bindings/src/server/fizz-instruction-set';
// This is the name of the generated file that exports the inline instruction
// set as strings.
const inlineCodeStringsFilename =
instructionDir + '/ReactDOMFizzInstructionSetInli... | 'completeBoundaryUpgradeToViewTransitions',
},
{
entry: 'ReactDOMFizzInlineCompleteBoundaryWithStyles.js',
exportName: 'completeBoundaryWithStyles',
},
{
entry: 'ReactDOMFizzInlineCompleteSegment.js',
exportName: 'completeSegment', | rtName: 'clientRenderBoundary',
},
{
entry: 'ReactDOMFizzInlineCompleteBoundary.js',
exportName: 'completeBoundary',
},
{
entry: 'ReactDOMFizzInlineCompleteBoundaryUpgradeToViewTransitions.js',
exportName: | {
"filepath": "scripts/rollup/generate-inline-fizz-runtime.js",
"language": "javascript",
"file_size": 3352,
"cut_index": 614,
"middle_length": 229
} |
asyncExtractTar,
asyncRimRaf,
} = require('./utils');
const {
NODE_ES2015,
ESM_DEV,
ESM_PROD,
NODE_DEV,
NODE_PROD,
NODE_PROFILING,
BUN_DEV,
BUN_PROD,
FB_WWW_DEV,
FB_WWW_PROD,
FB_WWW_PROFILING,
RN_OSS_DEV,
RN_OSS_PROD,
RN_OSS_PROFILING,
RN_FB_DEV,
RN_FB_PROD,
RN_FB_PROFILING,
BROWS... | return `build/node_modules/${packageName}/esm/${filename}`;
case BUN_DEV:
case BUN_PROD:
return `build/node_modules/${packageName}/cjs/${filename}`;
case NODE_DEV:
case NODE_PROD:
case NODE_PROFILING:
case CJS_DTS:
r | ndleOutputPath(bundle, bundleType, filename, packageName) {
switch (bundleType) {
case NODE_ES2015:
return `build/node_modules/${packageName}/cjs/${filename}`;
case ESM_DEV:
case ESM_PROD:
case ESM_DTS:
| {
"filepath": "scripts/rollup/packaging.js",
"language": "javascript",
"file_size": 8607,
"cut_index": 716,
"middle_length": 229
} |
;
const asyncCopyTo = require('./utils').asyncCopyTo;
const chalk = require('chalk');
const resolvePath = require('./utils').resolvePath;
const DEFAULT_FB_SOURCE_PATH = '~/fbsource/';
const DEFAULT_WWW_PATH = '~/www/';
const RELATIVE_RN_OSS_PATH = 'xplat/js/react-native-github/Libraries/Renderer/';
const RELATIVE_WWW... | .length - 1) !== '/') {
wwwPath += '/';
}
const destPath = resolvePath(wwwPath + RELATIVE_WWW_PATH);
await doSync(buildPath, destPath);
}
async function syncReactNativeHelper(
buildPath,
fbSourcePath,
relativeDestPath
) {
fbSourcePath = | );
console.log(`${chalk.bgGreen.black(' SYNCED ')} React to ${destPath}`);
}
async function syncReactDom(buildPath, wwwPath) {
wwwPath = typeof wwwPath === 'string' ? wwwPath : DEFAULT_WWW_PATH;
if (wwwPath.charAt(wwwPath | {
"filepath": "scripts/rollup/sync.js",
"language": "javascript",
"file_size": 1498,
"cut_index": 524,
"middle_length": 229
} |
oduleTypes;
const USE_STRICT_HEADER_REGEX = /'use strict';\n+/;
function wrapWithRegisterInternalModule(source) {
return `\
'use strict';
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
'function'
) {
__REACT_DEVTOOLS_GLOB... | icense found in the
* LICENSE file in the root directory of this source tree.`;
const topLevelDefinitionWrappers = {
/***************** NODE_ES2015 *****************/
[NODE_ES2015](source, globalName, filename, moduleType) {
return `'use strict'; | op ===
'function'
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}
`;
}
const license = ` * Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT l | {
"filepath": "scripts/rollup/wrappers.js",
"language": "javascript",
"file_size": 13297,
"cut_index": 921,
"middle_length": 229
} |
t {exec} = require('child-process-promise');
const {existsSync, mkdirSync} = require('fs');
const {readJsonSync, writeJsonSync} = require('fs-extra');
const inquirer = require('inquirer');
const {join} = require('path');
const createLogger = require('progress-estimator');
const {
BUILD_METADATA_TEMP_DIRECTORY,
NPM_... | ner => owner.split(' ')[0]);
if (!owners.includes(currentUser)) {
failedProjects.push(project);
}
};
await logger(
Promise.all(NPM_PACKAGES.map(checkProject)),
`Checking NPM permissions for ${chalk.bold(currentUser)}.`,
{est | = await execRead('npm whoami');
const failedProjects = [];
const checkProject = async project => {
const owners = (await execRead(`npm owner ls ${project}`))
.split('\n')
.filter(owner => owner)
.map(ow | {
"filepath": "scripts/devtools/utils.js",
"language": "javascript",
"file_size": 2979,
"cut_index": 563,
"middle_length": 229
} |
process.env.RELEASE_CHANNEL;
// Default to building in experimental mode. If the release channel is set via
// an environment variable, then check if it's "experimental".
const __EXPERIMENTAL__ =
typeof RELEASE_CHANNEL === 'string'
? RELEASE_CHANNEL === 'experimental'
: true;
function findNearestExistingFo... | er file for a specific environment,
// add it to this list with the logic for choosing the right replacement.
// Fork paths are relative to the project root. They must include the full path,
// including the extension. We intentionally don't use Node's mo | candidate + suffix;
try {
fs.statSync(forkPath);
return forkPath;
} catch (error) {
// Try the next candidate.
}
segments.pop();
}
return null;
}
// If you need to replace a file with anoth | {
"filepath": "scripts/rollup/forks.js",
"language": "javascript",
"file_size": 15736,
"cut_index": 921,
"middle_length": 229
} |
require('chalk');
const join = require('path').join;
const fs = require('fs');
const mkdirp = require('mkdirp');
const BUNDLE_SIZES_FILE_NAME = join(__dirname, '../../build/bundle-sizes.json');
const prevBuildResults = fs.existsSync(BUNDLE_SIZES_FILE_NAME)
? require(BUNDLE_SIZES_FILE_NAME)
: {bundleSizes: []};
c... | s.writeFileSync(
BUNDLE_SIZES_FILE_NAME,
JSON.stringify(currentBuildResults, null, 2)
);
}
}
function fractionalChange(prev, current) {
return (current - prev) / prev;
}
function percentChangeString(change) {
if (!isFinite(change)) | fs.writeFileSync(
join('build', 'sizes', `bundle-sizes-${process.env.NODE_INDEX}.json`),
JSON.stringify(currentBuildResults, null, 2)
);
} else {
// Write all the bundle sizes to a single JSON file.
f | {
"filepath": "scripts/rollup/stats.js",
"language": "javascript",
"file_size": 3313,
"cut_index": 614,
"middle_length": 229
} |
onjs: true,
browser: true,
},
globals: {
// ES 6
BigInt: 'readonly',
Map: 'readonly',
Set: 'readonly',
Proxy: 'readonly',
Symbol: 'readonly',
WeakMap: 'readonly',
WeakSet: 'readonly',
WeakRef: 'readonly',
Int8Array: 'readonly',
Uint8Array: 'readonly',
Uint8Clampe... | ine: 'readonly',
navigation: 'readonly',
// Vendor specific
MSApp: 'readonly',
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
// CommonJS / Node
process: 'readonly',
setImmediate: 'readonly',
Buffer: 'readonly',
// Trusted | ,
BigInt64Array: 'readonly',
BigUint64Array: 'readonly',
DataView: 'readonly',
ArrayBuffer: 'readonly',
Reflect: 'readonly',
globalThis: 'readonly',
FinalizationRegistry: 'readonly',
ScrollTimel | {
"filepath": "scripts/rollup/validate/eslintrc.cjs.js",
"language": "javascript",
"file_size": 2738,
"cut_index": 563,
"middle_length": 229
} |
= require('ncp').ncp;
const path = require('path');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
const exec = require('child_process').exec;
const targz = require('targz');
function asyncCopyTo(from, to) {
return asyncMkDirP(path.dirname(to)).then(
() =>
new Promise((resolve, reject)... |
}
});
})
);
}
function asyncExecuteCommand(command) {
return new Promise((resolve, reject) =>
exec(command, (error, stdout) => {
if (error) {
reject(error);
return;
}
resolve(stdout);
| copied files to exist; ncp() sometimes completes prematurely.
// For more detail, see github.com/facebook/react/issues/22323
// Also github.com/AvianFlu/ncp/issues/127
setTimeout(resolve, 10); | {
"filepath": "scripts/rollup/utils.js",
"language": "javascript",
"file_size": 1958,
"cut_index": 537,
"middle_length": 229
} |
tion, explicitly
// specify whether it has side effects during import or not. This lets
// us know whether we can safely omit them when they are unused.
const HAS_NO_SIDE_EFFECTS_ON_IMPORT = false;
// const HAS_SIDE_EFFECTS_ON_IMPORT = true;
const importSideEffects = Object.freeze({
fs: HAS_NO_SIDE_EFFECTS_ON_IMPORT,... | ON_IMPORT,
'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
'react-dom': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
url: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
ReactNativeInternalFeatureFlags: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
'webpack-sources/lib/helpers/create | 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface':
HAS_NO_SIDE_EFFECTS_ON_IMPORT,
scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
react: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
'react-dom/server': HAS_NO_SIDE_EFFECTS_ | {
"filepath": "scripts/rollup/modules.js",
"language": "javascript",
"file_size": 3058,
"cut_index": 614,
"middle_length": 229
} |
onjs: true,
browser: true,
},
globals: {
// ES 6
BigInt: 'readonly',
Map: 'readonly',
Set: 'readonly',
Proxy: 'readonly',
Symbol: 'readonly',
WeakMap: 'readonly',
WeakSet: 'readonly',
WeakRef: 'readonly',
Int8Array: 'readonly',
Uint8Array: 'readonly',
Uint8Clampe... | ine: 'readonly',
navigation: 'readonly',
// Vendor specific
MSApp: 'readonly',
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
// CommonJS / Node
process: 'readonly',
setImmediate: 'readonly',
Buffer: 'readonly',
// Trusted | ,
BigInt64Array: 'readonly',
BigUint64Array: 'readonly',
DataView: 'readonly',
ArrayBuffer: 'readonly',
Reflect: 'readonly',
globalThis: 'readonly',
FinalizationRegistry: 'readonly',
ScrollTimel | {
"filepath": "scripts/rollup/validate/eslintrc.esm.js",
"language": "javascript",
"file_size": 2673,
"cut_index": 563,
"middle_length": 229
} |
st {promisify} = require('util');
const glob = promisify(require('glob'));
const {ESLint} = require('eslint');
// Lint the final build artifacts. Helps catch bugs in our build pipeline.
function getFormat(filepath) {
if (filepath.includes('facebook')) {
if (filepath.includes('shims')) {
// We don't curren... | e')) {
if (filepath.includes('shims')) {
// We don't currently lint these shims. We rely on the downstream Facebook
// repo to transform them.
// TODO: Should we lint them?
return null;
}
return 'rn';
}
if (filepath. | actHooks')) {
// The ESLint plugin bundles compiler code with modern syntax that
// doesn't need to conform to the ES5 www lint rules.
return null;
}
return 'fb';
}
if (filepath.includes('react-nativ | {
"filepath": "scripts/rollup/validate/index.js",
"language": "javascript",
"file_size": 3086,
"cut_index": 614,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @nolint
* @flow strict-local
*/
'use strict';
import {type ViewConfig} from './ReactNativeTypes';
import invariant from 'invariant';
// Event configs
export const customBubblingEventTypes: {
[eventName: string... | iewConfig: ViewConfig): void {
const {bubblingEventTypes, directEventTypes} = viewConfig;
if (__DEV__) {
if (bubblingEventTypes != null && directEventTypes != null) {
for (const topLevelType in directEventTypes) {
invariant(
| {
[eventName: string]: $ReadOnly<{
registrationName: string,
}>,
} = {};
const viewConfigCallbacks = new Map<string, ?() => ViewConfig>();
const viewConfigs = new Map<string, ViewConfig>();
function processEventTypes(v | {
"filepath": "scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js",
"language": "javascript",
"file_size": 3689,
"cut_index": 614,
"middle_length": 229
} |
e strict';
const ClosureCompiler = require('google-closure-compiler').compiler;
const {promisify} = require('util');
const fs = require('fs');
const tmp = require('tmp');
const writeFileAsync = promisify(fs.writeFile);
function compile(flags) {
return new Promise((resolve, reject) => {
const closureCompiler = n... | Closure what JS source file to read, and optionally what sourcemap file to write
const finalFlags = {
...flags,
js: inputFile.name,
};
await writeFileAsync(inputFile.name, code, 'utf8');
const compiledCode = await c |
});
});
}
module.exports = function closure(flags = {}) {
return {
name: 'scripts/rollup/plugins/closure-plugin',
async renderChunk(code, chunk, options) {
const inputFile = tmp.fileSync();
// Tell | {
"filepath": "scripts/rollup/plugins/closure-plugin.js",
"language": "javascript",
"file_size": 1105,
"cut_index": 515,
"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.
*/
'use strict';
const path = require('path');
const semver = require('semver');
function resolveRelatively(importee, importer) {
if (semver.gte(process.version, '8.9.0')) {
r... | ks) {
let resolvedForks = new Map();
Object.keys(forks).forEach(srcModule => {
// Fork paths are relative to the project root. They must include the full
// path, including the extension. We intentionally don't use Node's module
// resoluti | hub.com/nodejs/node/issues/5963
const Module = require('module');
return Module._findPath(importee, [
path.dirname(importer),
...module.paths,
]);
}
}
let resolveCache = new Map();
function useForks(for | {
"filepath": "scripts/rollup/plugins/use-forks-plugin.js",
"language": "javascript",
"file_size": 2772,
"cut_index": 563,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const fs = require('fs');
const {evalStringAndTemplateConcat} = require('../shared/evalToString');
const invertObject = require('./invertObject');
const helperModuleImports = require('@babel/helper-module-imports');
... | Error(`A ${adj} message that contains ${noun}`);
//
// into this:
//
// Error(formatProdErrorMessage(ERR_CODE, adj, noun));
const node = path.node;
if (node[SEEN_SYMBOL]) {
return;
}
node[SEEN_SYMBOL] = true;
cons | abel) {
const t = babel.types;
function ErrorCallExpression(path, file) {
// Turns this code:
//
// new Error(`A ${adj} message that contains ${noun}`);
//
// or this code (no constructor):
//
// | {
"filepath": "scripts/error-codes/transform-error-messages.js",
"language": "javascript",
"file_size": 4616,
"cut_index": 614,
"middle_length": 229
} |
onjs: true,
browser: true,
},
globals: {
// ES6
BigInt: 'readonly',
Map: 'readonly',
Set: 'readonly',
Symbol: 'readonly',
Proxy: 'readonly',
WeakMap: 'readonly',
WeakSet: 'readonly',
WeakRef: 'readonly',
Int8Array: 'readonly',
Uint8Array: 'readonly',
Uint8Clamped... | ne: 'readonly',
navigation: 'readonly',
// Vendor specific
MSApp: 'readonly',
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
// FB
__DEV__: 'readonly',
// Node.js Server Rendering
process: 'readonly',
setImmediate: 'readon |
BigInt64Array: 'readonly',
BigUint64Array: 'readonly',
DataView: 'readonly',
ArrayBuffer: 'readonly',
Reflect: 'readonly',
globalThis: 'readonly',
FinalizationRegistry: 'readonly',
ScrollTimeli | {
"filepath": "scripts/rollup/validate/eslintrc.fb.js",
"language": "javascript",
"file_size": 2358,
"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.
*/
'use strict';
module.exports = function externalRuntime() {
// When generating the source code for the Fizz runtime chunks we use global identifiers to... | (_, variableName) => {
variables.add(variableName);
return variableName;
}
);
const startOfFn = 'use strict';
let index = source.indexOf(startOfFn);
if (index === -1) {
return source;
} | ugins/dynamic-imports',
renderChunk(source) {
// This replaces "window['$globalVar']" with "$globalVar".
const variables = new Set();
source = source.replace(
/window\[['"](\$[A-z0-9_]*)['"]\]/g,
| {
"filepath": "scripts/rollup/plugins/external-runtime-plugin.js",
"language": "javascript",
"file_size": 1516,
"cut_index": 537,
"middle_length": 229
} |
ync = require('./sync');
const sizes = require('./plugins/sizes-plugin');
const useForks = require('./plugins/use-forks-plugin');
const dynamicImports = require('./plugins/dynamic-imports');
const externalRuntime = require('./plugins/external-runtime-plugin');
const Packaging = require('./packaging');
const {asyncRimRa... | === 'string'
? RELEASE_CHANNEL === 'experimental'
: true;
// Errors in promises should be fatal.
let loggedErrors = new Set();
process.on('unhandledRejection', err => {
if (loggedErrors.has(err)) {
// No need to print it twice.
process.e | NNEL = process.env.RELEASE_CHANNEL;
// Default to building in experimental mode. If the release channel is set via
// an environment variable, then check if it's "experimental".
const __EXPERIMENTAL__ =
typeof RELEASE_CHANNEL | {
"filepath": "scripts/rollup/build.js",
"language": "javascript",
"file_size": 27054,
"cut_index": 1331,
"middle_length": 229
} |
onjs: true,
browser: true,
},
globals: {
// ES6
BigInt: 'readonly',
Map: 'readonly',
Set: 'readonly',
Symbol: 'readonly',
Proxy: 'readonly',
WeakMap: 'readonly',
WeakSet: 'readonly',
WeakRef: 'readonly',
Int8Array: 'readonly',
Uint8Array: 'readonly',
Uint8Clamped... | ne: 'readonly',
navigation: 'readonly',
// Vendor specific
MSApp: 'readonly',
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
// FB
__DEV__: 'readonly',
// Fabric. See https://github.com/facebook/react/pull/15490
// for more in |
BigInt64Array: 'readonly',
BigUint64Array: 'readonly',
DataView: 'readonly',
ArrayBuffer: 'readonly',
Reflect: 'readonly',
globalThis: 'readonly',
FinalizationRegistry: 'readonly',
ScrollTimeli | {
"filepath": "scripts/rollup/validate/eslintrc.rn.js",
"language": "javascript",
"file_size": 2590,
"cut_index": 563,
"middle_length": 229
} |
require('fs');
const path = require('path');
const {execSync} = require('child_process');
async function main() {
const originalJSON = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../error-codes/codes.json'))
);
const existingMessages = new Set();
const codes = Object.keys(originalJSON);
let nex... | d --no-exclude-standard '/*! <expected-error-format>' -- build"
).toString();
} catch (e) {
if (e.status === 1 && e.stdout.toString() === '') {
// No unminified errors found.
return;
}
throw e;
}
let newJSON = null;
con | message);
if (code >= nextCode) {
nextCode = code + 1;
}
}
console.log('Searching `build` directory for unminified errors...\n');
let out;
try {
out = execSync(
"git --no-pager grep -n --untracke | {
"filepath": "scripts/error-codes/extract-errors.js",
"language": "javascript",
"file_size": 1862,
"cut_index": 537,
"middle_length": 229
} |
import type {AnyNativeEvent} from '../PluginModuleType';
import type {DOMEventName} from '../DOMEventNames';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {ReactSynthe... | /../client/ReactDOMComponentTree';
import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
import {DOCUMENT_NODE} from '../../client/HTMLNodeType';
import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
const skipSelection | '../isTextInputElement';
import shallowEqual from 'shared/shallowEqual';
import {registerTwoPhaseEvent} from '../EventRegistry';
import getActiveElement from '../../client/getActiveElement';
import {getNodeFromInstance} from '.. | {
"filepath": "packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js",
"language": "javascript",
"file_size": 6418,
"cut_index": 716,
"middle_length": 229
} |
import type {
CrossOriginEnum,
PreloadImplOptions,
PreloadModuleImplOptions,
PreinitStyleOptions,
PreinitScriptOptions,
PreinitModuleScriptOptions,
} from 'react-dom/src/shared/ReactDOMTypes';
import {
emitHint,
getHints,
resolveRequest,
} from 'react-server/src/ReactFlightServer';
import ReactDOMSh... | preload */: preload,
m /* preloadModule */: preloadModule,
X /* preinitScript */: preinitScript,
S /* preinitStyle */: preinitStyle,
M /* preinitModuleScript */: preinitModuleScript,
};
function prefetchDNS(href: string) {
if (typeof href === 's | cher */ = {
f /* flushSyncWork */: previousDispatcher.f /* flushSyncWork */,
r /* requestFormReset */: previousDispatcher.r /* requestFormReset */,
D /* prefetchDNS */: prefetchDNS,
C /* preconnect */: preconnect,
L /* | {
"filepath": "packages/react-dom-bindings/src/server/ReactDOMFlightServerHostDispatcher.js",
"language": "javascript",
"file_size": 7060,
"cut_index": 716,
"middle_length": 229
} |
ReactDOMEventHandleTypes';
import type {
Container,
TextInstance,
Instance,
ActivityInstance,
SuspenseInstance,
Props,
HoistableRoot,
RootResources,
} from './ReactFiberConfigDOM';
import {
HostComponent,
HostHoistable,
HostSingleton,
HostText,
HostRoot,
SuspenseComponent,
ActivityCompone... | nalContainerInstanceKey = '__reactContainer$' + randomKey;
const internalEventHandlersKey = '__reactEvents$' + randomKey;
const internalEventHandlerListenersKey = '__reactListeners$' + randomKey;
const internalEventHandlesSetKey = '__reactHandles$' + rando | ernalInstanceMap} from 'shared/ReactFeatureFlags';
const randomKey = Math.random().toString(36).slice(2);
const internalInstanceKey = '__reactFiber$' + randomKey;
const internalPropsKey = '__reactProps$' + randomKey;
const inter | {
"filepath": "packages/react-dom-bindings/src/client/ReactDOMComponentTree.js",
"language": "javascript",
"file_size": 13913,
"cut_index": 921,
"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 {AnyNativeEvent} from '../events/PluginModuleType';
// This exists to avoid circular dependency between ReactD... | }
export function resetReplayingEvent(): void {
if (__DEV__) {
if (currentReplayingEvent === null) {
console.error(
'Expected currently replaying event to not be null. This error ' +
'is likely caused by a bug in React. Pleas | t !== null) {
console.error(
'Expected currently replaying event to be null. This error ' +
'is likely caused by a bug in React. Please file an issue.',
);
}
}
currentReplayingEvent = event;
| {
"filepath": "packages/react-dom-bindings/src/events/CurrentReplayingEvent.js",
"language": "javascript",
"file_size": 1187,
"cut_index": 518,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {DOMEventName} from './DOMEventNames';
import {registerTwoPhaseEvent} from './EventRegistry';
import {
ANIMATION_END,
ANIMATION_ITERATION,
ANIMATION_START,
TRANSITION_RUN,
TRANSITION_START,
TRA... | // and DOM name ("pointerdown") from the same list.
//
// Exceptions that don't match this convention are listed separately.
//
// prettier-ignore
const simpleEventPluginEvents = [
'abort',
'auxClick',
'beforeToggle',
'cancel',
'canPlay',
'canP | ReactNames: Map<DOMEventName, string | null> =
new Map();
// NOTE: Capitalization is important in this list!
//
// E.g. it needs "pointerDown", not "pointerdown".
// This is because we derive both React name ("onPointerDown")
| {
"filepath": "packages/react-dom-bindings/src/events/DOMEventProperties.js",
"language": "javascript",
"file_size": 3591,
"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
*/
import type {DOMEventName} from './DOMEventNames';
import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
export const allNativeEvents: Set<DOMEventNam... | . Available
* only in __DEV__.
* @type {Object}
*/
export const possibleRegistrationNames: {
[lowerCasedName: string]: string,
} = __DEV__ ? {} : (null: any);
// Trust the developer to only use possibleRegistrationNames in __DEV__
export function reg | nst registrationNameDependencies: {
[registrationName: string]: Array<DOMEventName>,
} = {};
/**
* Mapping from lowercase registration names to the properly cased version,
* used to warn in the case of missing event handlers | {
"filepath": "packages/react-dom-bindings/src/events/EventRegistry.js",
"language": "javascript",
"file_size": 2062,
"cut_index": 563,
"middle_length": 229
} |
nder the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noformat
* @nolint
* @flow strict-local
*/
'use strict';
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
import {type ViewConfig} from './ReactNativeTyp... | ed within JavaScript.
*
* @param {string} config iOS View configuration.
* @private
*/
const createReactNativeComponentClass = function (
name: string,
callback: () => ViewConfig,
): string {
return register(name, callback);
};
export default cr | teReactNativeComponentClass() for view configs defin | {
"filepath": "scripts/rollup/shims/react-native/createReactNativeComponentClass.js",
"language": "javascript",
"file_size": 945,
"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 type EventSystemFlags = number;
export const IS_EVENT_HANDLE_NON_MANAGED_NODE = 1;
export const IS_NON_DELEG... | thus not bailing out
// will result in endless cycles like an infinite loop.
// We also don't want to defer during event replaying.
export const SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS =
IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_ | DE =
IS_LEGACY_FB_SUPPORT_MODE | IS_CAPTURE_PHASE;
// We do not want to defer if the event system has already been
// set to LEGACY_FB_SUPPORT. LEGACY_FB_SUPPORT only gets set when
// we call willDeferLaterForLegacyFBSupport, | {
"filepath": "packages/react-dom-bindings/src/events/EventSystemFlags.js",
"language": "javascript",
"file_size": 1004,
"cut_index": 512,
"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 {
getInstanceFromNode,
getFiberCurrentPropsFromNode,
} from '../client/ReactDOMComponentTree';
import {restoreControlledState} fr... | // Unmounted
return;
}
const stateNode = internalInstance.stateNode;
// Guard against Fiber being unmounted.
if (stateNode) {
const props = getFiberCurrentPropsFromNode(stateNode);
restoreControlledState(
internalInstance.stat | tateOfTarget(target: Node) {
// We perform this translation at the end of the event loop so that we
// always receive the correct fiber here
const internalInstance = getInstanceFromNode(target);
if (!internalInstance) {
| {
"filepath": "packages/react-dom-bindings/src/events/ReactDOMControlledComponent.js",
"language": "javascript",
"file_size": 1792,
"cut_index": 537,
"middle_length": 229
} |
Fiber,
getActivityInstanceFromFiber,
getSuspenseInstanceFromFiber,
} from 'react-reconciler/src/ReactFiberTreeReflection';
import {
findInstanceBlockingEvent,
findInstanceBlockingTarget,
} from './ReactDOMEventListener';
import {setReplayingEvent, resetReplayingEvent} from './CurrentReplayingEvent';
import {
... | mAction} from './plugins/FormActionEventPlugin';
import {
resolveUpdatePriority,
runWithPriority as attemptHydrationAtPriority,
} from '../client/ReactDOMUpdatePriority';
import {
attemptContinuousHydration,
attemptHydrationAtCurrentPriority,
} fr | om 'react-reconciler/src/ReactWorkTags';
import {isHigherEventPriority} from 'react-reconciler/src/ReactEventPriorities';
import {isRootDehydrated} from 'react-reconciler/src/ReactFiberShellHydration';
import {dispatchReplayedFor | {
"filepath": "packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js",
"language": "javascript",
"file_size": 22523,
"cut_index": 1331,
"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 getVendorPrefixedEventName from './getVendorPrefixedEventName';
export type DOMEventName =
| 'abort'
| 'afterblur' // Not a real event. This is used by eve... | | 'compositionupdate'
| 'contextmenu'
| 'copy'
| 'cut'
| 'dblclick'
| 'auxclick'
| 'drag'
| 'dragend'
| 'dragenter'
| 'dragexit'
| 'dragleave'
| 'dragover'
| 'dragstart'
| 'drop'
| 'durationchange'
| 'emptied'
| 'encrypted' | t a real event. This is used by event experiments.
| 'beforeinput'
| 'beforetoggle'
| 'blur'
| 'canplay'
| 'canplaythrough'
| 'cancel'
| 'change'
| 'click'
| 'close'
| 'compositionend'
| 'compositionstart'
| {
"filepath": "packages/react-dom-bindings/src/events/DOMEventNames.js",
"language": "javascript",
"file_size": 2935,
"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.
*/
import {
needsStateRestore,
restoreStateIfNeeded,
} from './ReactDOMControlledComponent';
import {
batchedUpdates as batchedUpdatesImpl,
discreteUpdates as discreteUpdate... | nchronous work.
let isInsideEventHandler = false;
function finishEventHandler() {
// Here we wait until all updates have propagated, which is important
// when using controlled components within layers:
// https://github.com/facebook/react/issues/1 | tching events or if third party
// libraries need to call batchedUpdates. Eventually, this API will go away when
// everything is batched by default. We'll then have a similar API to opt-out of
// scheduled work and instead do sy | {
"filepath": "packages/react-dom-bindings/src/events/ReactDOMUpdateBatching.js",
"language": "javascript",
"file_size": 2275,
"cut_index": 563,
"middle_length": 229
} |
';
import {isReplayingEvent} from './CurrentReplayingEvent';
import {
HostRoot,
HostPortal,
HostComponent,
HostHoistable,
HostSingleton,
HostText,
ScopeComponent,
} from 'react-reconciler/src/ReactWorkTags';
import {getLowestCommonAncestor} from 'react-reconciler/src/ReactFiberTreeReflection';
import ge... | eLegacyFBSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
disableCommentsAsDOMContainers,
enableScrollEndPolyfill,
} from 'shared/ReactFeatureFlags';
import {createEventListenerWrapperWithPriority} from './ReactDOMEventListener';
import {
rem | DOCUMENT_NODE} from '../client/HTMLNodeType';
import {batchedUpdates} from './ReactDOMUpdateBatching';
import getListener from './getListener';
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
import {
enabl | {
"filepath": "packages/react-dom-bindings/src/events/DOMPluginEventSystem.js",
"language": "javascript",
"file_size": 31083,
"cut_index": 1331,
"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 addEventBubbleListener(
target: EventTarget,
eventType: string,
listener: Function,
): Function {
target... |
target.addEventListener(eventType, listener, {
capture: true,
passive,
});
return listener;
}
export function addEventBubbleListenerWithPassiveFlag(
target: EventTarget,
eventType: string,
listener: Function,
passive: boolean,
): Fu | target.addEventListener(eventType, listener, true);
return listener;
}
export function addEventCaptureListenerWithPassiveFlag(
target: EventTarget,
eventType: string,
listener: Function,
passive: boolean,
): Function { | {
"filepath": "packages/react-dom-bindings/src/events/EventListener.js",
"language": "javascript",
"file_size": 1303,
"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.
*/
/**
* These variables store information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Ide... | etText();
return true;
}
export function reset() {
root = null;
startText = null;
fallbackText = null;
}
export function getData() {
if (fallbackText) {
return fallbackText;
}
let start;
const startValue = startText;
const startLen | position, we can
* use its position to find its replacement.
*
*
*/
let root = null;
let startText = null;
let fallbackText = null;
export function initialize(nativeEventTarget) {
root = nativeEventTarget;
startText = g | {
"filepath": "packages/react-dom-bindings/src/events/FallbackCompositionState.js",
"language": "javascript",
"file_size": 1659,
"cut_index": 537,
"middle_length": 229
} |
InternalTypes';
import type {
Container,
ActivityInstance,
SuspenseInstance,
} from '../client/ReactFiberConfigDOM';
import type {DOMEventName} from '../events/DOMEventNames';
import {
isDiscreteEventThatRequiresHydration,
clearIfContinuousEvent,
queueIfContinuousEvent,
} from './ReactDOMEventReplaying';
i... | } from './EventSystemFlags';
import getEventTarget from './getEventTarget';
import {
getInstanceFromNode,
getClosestInstanceFromNode,
} from '../client/ReactDOMComponentTree';
import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
| nstanceFromFiber,
} from 'react-reconciler/src/ReactFiberTreeReflection';
import {
HostRoot,
ActivityComponent,
SuspenseComponent,
} from 'react-reconciler/src/ReactWorkTags';
import {type EventSystemFlags, IS_CAPTURE_PHASE | {
"filepath": "packages/react-dom-bindings/src/events/ReactDOMEventListener.js",
"language": "javascript",
"file_size": 12400,
"cut_index": 921,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
let babel = require('@babel/core');
let devExpressionWithCodes = require('../transform-error-messages');
function transform(input, options = {}) {
return babel.transform(input, {
plugins: [[devExpressionWithC... | error constructors (no new)', () => {
expect(
transform(`
Error('Do not override existing functions.');
`)
).toMatchSnapshot();
});
it("should output FIXME for errors that don't have a matching error code", () => {
expect(
tra | {
process.env.NODE_ENV = oldEnv;
});
it('should replace error constructors', () => {
expect(
transform(`
new Error('Do not override existing functions.');
`)
).toMatchSnapshot();
});
it('should replace | {
"filepath": "scripts/error-codes/__tests__/transform-error-messages.js",
"language": "javascript",
"file_size": 4130,
"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 type for SyntheticEvent class that includes private properties
* @flow
*/
import type {Fiber} from 'react-reconciler/src/Reac... | _dispatchListeners?: null | Array<Function> | Function,
_targetInst: Fiber,
nativeEvent: Event,
target?: mixed,
relatedTarget?: mixed,
type: string,
currentTarget: null | EventTarget,
};
export type KnownReactSyntheticEvent = BaseSyntheticEven | g,
captured: null | string,
},
registrationName?: string,
};
type BaseSyntheticEvent = {
isPersistent: () => boolean,
isPropagationStopped: () => boolean,
_dispatchInstances?: null | Array<Fiber | null> | Fiber,
| {
"filepath": "packages/react-dom-bindings/src/events/ReactSyntheticEventType.js",
"language": "javascript",
"file_size": 1217,
"cut_index": 518,
"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 TopLevelType =
| 'abort'
// Dynamic and vendor-prefixed at the usage site:
// 'animationiteration' |
// 'animationend |
... |
| 'error'
| 'gotpointercapture'
| 'input'
| 'invalid'
| 'keydown'
| 'keypress'
| 'keyup'
| 'load'
| 'loadstart'
| 'loadeddata'
| 'loadedmetadata'
| 'lostpointercapture'
| 'mousedown'
| 'mousemove'
| 'mouseout'
| 'mouseover' | '
| 'copy'
| 'cut'
| 'dblclick'
| 'auxclick'
| 'drag'
| 'dragend'
| 'dragenter'
| 'dragexit'
| 'dragleave'
| 'dragover'
| 'dragstart'
| 'drop'
| 'durationchange'
| 'emptied'
| 'encrypted'
| 'ended' | {
"filepath": "packages/react-dom-bindings/src/events/TopLevelEventTypes.js",
"language": "javascript",
"file_size": 1702,
"cut_index": 537,
"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
*/
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond... | charCode;
const keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charC | does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent: KeyboardEvent): number {
let | {
"filepath": "packages/react-dom-bindings/src/events/getEventCharCode.js",
"language": "javascript",
"file_size": 1585,
"cut_index": 537,
"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 {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {Props} from '../client/ReactFiberConfigDOM';
import {getFiberCurrentPropsFromNode} from ... | se 'onMouseDown':
case 'onMouseDownCapture':
case 'onMouseMove':
case 'onMouseMoveCapture':
case 'onMouseUp':
case 'onMouseUpCapture':
case 'onMouseEnter':
return !!(props.disabled && isInteractive(type));
default:
r |
}
function shouldPreventMouseEvent(
name: string,
type: string,
props: Props,
): boolean {
switch (name) {
case 'onClick':
case 'onClickCapture':
case 'onDoubleClick':
case 'onDoubleClickCapture':
ca | {
"filepath": "packages/react-dom-bindings/src/events/getListener.js",
"language": "javascript",
"file_size": 2039,
"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
*/
import {canUseDOM} from 'shared/ExecutionEnvironment';
/**
* Checks if an event is supported in the current execution... | (!canUseDOM) {
return false;
}
const eventName = 'on' + eventNameSuffix;
let isSupported = eventName in document;
if (!isSupported) {
const element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSu | ventNameSuffix Event name, e.g. "click".
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix: string): boolean {
if | {
"filepath": "packages/react-dom-bindings/src/events/isEventSupported.js",
"language": "javascript",
"file_size": 1122,
"cut_index": 515,
"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
*/
const EventListenerWWW = require('EventListener');
import typeof * as EventListenerType from '../EventListener';
import typeof * as EventLis... | ction addEventCaptureListenerWithPassiveFlag(
target: EventTarget,
eventType: string,
listener: Function,
passive: boolean,
): mixed {
return EventListenerWWW.captureWithPassiveFlag(
target,
eventType,
listener,
passive,
);
}
e | (target, eventType, listener);
}
export function addEventCaptureListener(
target: EventTarget,
eventType: string,
listener: Function,
): mixed {
return EventListenerWWW.capture(target, eventType, listener);
}
export fun | {
"filepath": "packages/react-dom-bindings/src/events/forks/EventListener-www.js",
"language": "javascript",
"file_size": 1592,
"cut_index": 537,
"middle_length": 229
} |
chQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {ReactSyntheticEvent} from '../ReactSyntheticEventType';
import {registerTwoPhaseEvent} from '../EventRegistry';
import {SyntheticEvent} fr... | /ReactDOMInput';
import {enqueueStateRestore} from '../ReactDOMControlledComponent';
import {disableInputAttributeSyncing} from 'shared/ReactFeatureFlags';
import {batchedUpdates} from '../ReactDOMUpdateBatching';
import {
processDispatchQueue,
accumu | sEventSupported from '../isEventSupported';
import {getNodeFromInstance} from '../../client/ReactDOMComponentTree';
import {updateValueIfChanged} from '../../client/inputValueTracking';
import {setDefaultValue} from '../../client | {
"filepath": "packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js",
"language": "javascript",
"file_size": 10933,
"cut_index": 921,
"middle_length": 229
} |
import type {AnyNativeEvent} from '../PluginModuleType';
import type {DOMEventName} from '../DOMEventNames';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {FormStatus}... | m-bindings/src/shared/sanitizeURL';
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import {SyntheticEvent} from '../SyntheticEvent';
function coerceFormActionProp(
actionProp: mixed,
): string | (FormData => void | Promise<voi | ctDOMComponentTree';
import {startHostTransition} from 'react-reconciler/src/ReactFiberReconciler';
import {didCurrentEventScheduleTransition} from 'react-reconciler/src/ReactFiberRootScheduler';
import sanitizeURL from 'react-do | {
"filepath": "packages/react-dom-bindings/src/events/plugins/FormActionEventPlugin.js",
"language": "javascript",
"file_size": 5951,
"cut_index": 716,
"middle_length": 229
} |
ace: EventInterfaceType) {
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether... | ot]
function SyntheticBaseEvent(
reactName: string | null,
reactEventType: string,
targetInst: Fiber | null,
nativeEvent: {[propName: string]: mixed, ...},
nativeEventTarget: null | EventTarget,
) {
this._reactName = reactName;
| he DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*/
// $FlowFixMe[missing-this-ann | {
"filepath": "packages/react-dom-bindings/src/events/SyntheticEvent.js",
"language": "javascript",
"file_size": 17862,
"cut_index": 1331,
"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 {canUseDOM} from 'shared/ExecutionEnvironment';
export let passiveBrowserEventsSupported: boolean = false;
// Check if browser support events ... | tions, 'passive', {
get: function () {
passiveBrowserEventsSupported = true;
},
});
window.addEventListener('test', options, options);
window.removeEventListener('test', options, options);
} catch (e) {
passiveBrowserE | ive?: void,
} = {};
Object.defineProperty(op | {
"filepath": "packages/react-dom-bindings/src/events/checkPassiveEvents.js",
"language": "javascript",
"file_size": 885,
"cut_index": 547,
"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.
*/
import {canUseDOM} from 'shared/ExecutionEnvironment';
/**
* Generate a mapping of standard vendor prefixes using the defined style property and event name.
*
* @param {string... | efixes = {
animationend: makePrefixMap('Animation', 'AnimationEnd'),
animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
animationstart: makePrefixMap('Animation', 'AnimationStart'),
transitionrun: makePrefixMap('Transition', 'Tra | Case();
prefixes['Webkit' + styleProp] = 'webkit' + eventName;
prefixes['Moz' + styleProp] = 'moz' + eventName;
return prefixes;
}
/**
* A list of event names to a configurable list of vendor prefixes.
*/
const vendorPr | {
"filepath": "packages/react-dom-bindings/src/events/getVendorPrefixedEventName.js",
"language": "javascript",
"file_size": 2810,
"cut_index": 563,
"middle_length": 229
} |
ource code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
const supportedInputTypes: {[key: string]: true | void, ...} = ... | nction isTextInputElement(elem: ?HTMLElement): boolean {
const nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
if (nodeName === 'input') {
return !!supportedInputTypes[((elem: any): HTMLInputElement).type];
}
if (nodeName === | rue,
time: true,
url: true,
week: true,
};
fu | {
"filepath": "packages/react-dom-bindings/src/events/isTextInputElement.js",
"language": "javascript",
"file_size": 981,
"cut_index": 582,
"middle_length": 52
} |
mport type {AnyNativeEvent} from '../PluginModuleType';
import type {DOMEventName} from '../DOMEventNames';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {ReactSynthet... | inglePhaseListeners,
accumulateTwoPhaseListeners,
} from '../DOMPluginEventSystem';
import {
getScrollEndTimer,
setScrollEndTimer,
clearScrollEndTimer,
} from '../../client/ReactDOMComponentTree';
import {enableScrollEndPolyfill} from 'shared/Rea | ionEnvironment';
import isEventSupported from '../isEventSupported';
import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
import {batchedUpdates} from '../ReactDOMUpdateBatching';
import {
processDispatchQueue,
accumulateS | {
"filepath": "packages/react-dom-bindings/src/events/plugins/ScrollEndEventPlugin.js",
"language": "javascript",
"file_size": 6085,
"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.
*/
import {TEXT_NODE} from '../client/HTMLNodeType';
/**
* Gets the target node from a native browser event by accounting for
* i... | seElement) {
target = target.correspondingUseElement;
}
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === TEXT_NODE ? target.parentNode : targe | nativeEvent.srcElement for IE9
// https://github.com/facebook/react/issues/12506
let target = nativeEvent.target || nativeEvent.srcElement || window;
// Normalize SVG <use> element events #4963
if (target.correspondingU | {
"filepath": "packages/react-dom-bindings/src/events/getEventTarget.js",
"language": "javascript",
"file_size": 1035,
"cut_index": 513,
"middle_length": 229
} |
import type {AnyNativeEvent} from '../PluginModuleType';
import type {DOMEventName} from '../DOMEventNames';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {KnownReactS... | } from '../DOMPluginEventSystem';
import {
HostComponent,
HostSingleton,
HostText,
} from 'react-reconciler/src/ReactWorkTags';
import {getNearestMountedFiber} from 'react-reconciler/src/ReactFiberTreeReflection';
function registerEvents() {
regi | SyntheticPointerEvent} from '../SyntheticEvent';
import {
getClosestInstanceFromNode,
getNodeFromInstance,
isContainerMarkedAsRoot,
} from '../../client/ReactDOMComponentTree';
import {accumulateEnterLeaveTwoPhaseListeners | {
"filepath": "packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js",
"language": "javascript",
"file_size": 5740,
"cut_index": 716,
"middle_length": 229
} |
ype {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
import type {ReactSyntheticEvent} from '../ReactSyntheticEventType';
import {canUseDOM} from 'shared/ExecutionEnvironment';
import {registerTwoPhaseEvent} from '../EventRegistry';
import {
getData as Fallb... | UseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
let documentMode = null;
if (canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// dir | vent,
SyntheticInputEvent,
} from '../SyntheticEvent';
import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
const END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
const START_KEYCODE = 229;
const can | {
"filepath": "packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js",
"language": "javascript",
"file_size": 14185,
"cut_index": 921,
"middle_length": 229
} |
import type {DOMEventName} from '../../events/DOMEventNames';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import type {AnyNativeEvent} from '../../events/PluginModuleType';
import type {DispatchQueue} from '../DOMPluginEventSystem';
import type {EventSystemFlags} from '../EventSystemFlags';
impo... | /events/SyntheticEvent';
import {
ANIMATION_END,
ANIMATION_ITERATION,
ANIMATION_START,
TRANSITION_END,
} from '../DOMEventNames';
import {
topLevelEventsToReactNames,
registerSimpleEvents,
} from '../DOMEventProperties';
import {
accumulateS | theticTouchEvent,
SyntheticAnimationEvent,
SyntheticTransitionEvent,
SyntheticUIEvent,
SyntheticWheelEvent,
SyntheticClipboardEvent,
SyntheticPointerEvent,
SyntheticSubmitEvent,
SyntheticToggleEvent,
} from '../.. | {
"filepath": "packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js",
"language": "javascript",
"file_size": 7156,
"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 {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
import type {Awaited} from 'shared/ReactTypes';
import ReactSharedInternals from 'shared/Reac... | ot pending" value is always the same, we can reuse the
// same object across all transitions.
const sharedNotPendingObject: FormStatusNotPending = {
pending: false,
data: null,
method: null,
action: null,
};
export const NotPending: FormStatus = _ | pe FormStatusPending = {|
pending: true,
data: FormData,
method: string,
action: string | (FormData => void | Promise<void>) | null,
|};
export type FormStatus = FormStatusPending | FormStatusNotPending;
// Since the "n | {
"filepath": "packages/react-dom-bindings/src/shared/ReactDOMFormActions.js",
"language": "javascript",
"file_size": 2704,
"cut_index": 563,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
import validAriaProperties from './validAriaProperties';
import hasOwnProperty from 'shared/hasOwnProperty';
const warnedProperties = {};
const rARIA = new RegExp('^(aria... | es.hasOwnProperty(ariaName)
? ariaName
: null;
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (correctName == null) {
console.er | operty.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
if (rARIACamel.test(name)) {
const ariaName = 'aria-' + name.slice(4).toLowerCase();
const correctName = validAriaProperti | {
"filepath": "packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js",
"language": "javascript",
"file_size": 3235,
"cut_index": 614,
"middle_length": 229
} |
y';
const warnedProperties = {};
const EVENT_NAME_REGEX = /^on./;
const INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
const rARIA = __DEV__
? new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$')
: null;
const rARIACamel = __DEV__
? new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$')
: null;
function validate... | nts are normalized to bubble, so onFocusIn and onFocusOut ' +
'are not needed/supported by React.',
);
warnedProperties[name] = true;
return true;
}
// Actions are special because unlike events they can have other value | Name = name.toLowerCase();
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
console.error(
'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' +
'All React eve | {
"filepath": "packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js",
"language": "javascript",
"file_size": 11926,
"cut_index": 921,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
const aliases = new Map([
['acceptCharset', 'accept-charset'],
['htmlFor', 'for'],
['httpEquiv', 'http-equiv'],
// HTML and SVG attributes, but the SVG attribute is case sensitive.],
['crossOrigin', 'crossori... | ['colorInterpolationFilters', 'color-interpolation-filters'],
['colorProfile', 'color-profile'],
['colorRendering', 'color-rendering'],
['dominantBaseline', 'dominant-baseline'],
['enableBackground', 'enable-background'],
['fillOpacity', 'fill- | gnment-baseline'],
['arabicForm', 'arabic-form'],
['baselineShift', 'baseline-shift'],
['capHeight', 'cap-height'],
['clipPath', 'clip-path'],
['clipRule', 'clip-rule'],
['colorInterpolation', 'color-interpolation'],
| {
"filepath": "packages/react-dom-bindings/src/shared/getAttributeAlias.js",
"language": "javascript",
"file_size": 3521,
"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 hasOwnProperty from 'shared/hasOwnProperty';
const ATTRIBUTE_NAME_START_CHAR =
':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6... | he: {[string]: boolean} = {};
const validatedAttributeNameCache: {[string]: boolean} = {};
export default function isAttributeNameSafe(attributeName: string): boolean {
if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
return tr | _NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
const VALID_ATTRIBUTE_NAME_REGEX: RegExp = new RegExp(
'^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$',
);
const illegalAttributeNameCac | {
"filepath": "packages/react-dom-bindings/src/shared/isAttributeNameSafe.js",
"language": "javascript",
"file_size": 1398,
"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.
*
* @flow
*/
/**
* CSS properties which accept numbers but are not in units of "px".
*/
const unitlessNumbers = new Set([
'animationIterationCount',
... | ht',
'lineClamp',
'lineHeight',
'opacity',
'order',
'orphans',
'scale',
'tabSize',
'widows',
'zIndex',
'zoom',
'fillOpacity', // SVG-related properties
'floodOpacity',
'stopOpacity',
'strokeDasharray',
'strokeDashoffset',
's | flexPositive',
'flexShrink',
'flexNegative',
'flexOrder',
'gridArea',
'gridRow',
'gridRowEnd',
'gridRowSpan',
'gridRowStart',
'gridColumn',
'gridColumnEnd',
'gridColumnSpan',
'gridColumnStart',
'fontWeig | {
"filepath": "packages/react-dom-bindings/src/shared/isUnitlessNumber.js",
"language": "javascript",
"file_size": 1820,
"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
*/
// A javascript: URL can contain leading C0 control or \u0020 SPACE,
// and any newline or tab are filtered out as if they're no... | *c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
function sanitizeURL<T>(url: T): T | string {
// We should never have symbols here because they get filtered out elsewhere.
// eslint-disable-next-line react-internal/safe-string-coercion
if ( | n the range \u0000 NULL to \u001F
// INFORMATION SEPARATOR ONE, inclusive:
// https://infra.spec.whatwg.org/#c0-control-or-space
const isJavaScriptProtocol =
/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t] | {
"filepath": "packages/react-dom-bindings/src/shared/sanitizeURL.js",
"language": "javascript",
"file_size": 1374,
"cut_index": 524,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// 'msTransform' is correct, but the other prefixes should be capitalized
const badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
const msPattern = /^-ms-/;
const hyphenPattern = /-(.)/g;
// style values shouldn't contain a... | erty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
console.error(
'Unsupported style property %s. Did you mean %s?',
name,
// As Andi Smith suggests
// (http://www.andismith.com/blog/ | nction camelize(string) {
return string.replace(hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
function warnHyphenatedStyleName(name) {
if (__DEV__) {
if (warnedStyleNames.hasOwnProp | {
"filepath": "packages/react-dom-bindings/src/shared/warnValidStyle.js",
"language": "javascript",
"file_size": 3126,
"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.
*
* @noflow
*/
const hasReadOnlyValue = {
button: true,
checkbox: true,
image: true,
hidden: true,
radio: true,
reset: true,
submit: true,
}... | ield without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultValue`. Otherwise, set `onChange`.',
);
} else {
console.error(
'You provid |
props.onInput ||
props.readOnly ||
props.disabled ||
props.value == null
)
) {
if (tagName === 'select') {
console.error(
'You provided a `value` prop to a form f | {
"filepath": "packages/react-dom-bindings/src/shared/ReactControlledValuePropTypes.js",
"language": "javascript",
"file_size": 1738,
"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.
*/
let didWarnValueNull = false;
export function validateProperties(type, props) {
if (__DEV__) {
if (type !== 'input' && type ... | or uncontrolled components.',
type,
);
} else {
console.error(
'`value` prop on `%s` should not be null. ' +
'Consider using an empty string to clear the component or `undefined` ' +
'for un | props.multiple) {
console.error(
'`value` prop on `%s` should not be null. ' +
'Consider using an empty array when `multiple` is set to `true` ' +
'to clear the component or `undefined` f | {
"filepath": "packages/react-dom-bindings/src/shared/ReactDOMNullInputValuePropHook.js",
"language": "javascript",
"file_size": 1072,
"cut_index": 515,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// This client file is in the shared folder because it applies to both SSR and browser contexts.
// It is the configuration of the FlightClient behavior which can run in either environment.
import type {HintCode, Hint... | eModel(code, model);
const href = refined;
dispatcher.D(/* prefetchDNS */ href);
return;
}
case 'C': {
const refined = refineModel(code, model);
if (typeof refined === 'string') {
const href = refined;
| unction dispatchHint<Code: HintCode>(
code: Code,
model: HintModel<Code>,
): void {
const dispatcher = ReactDOMSharedInternals.d; /* ReactDOMCurrentDispatcher */
switch (code) {
case 'D': {
const refined = refin | {
"filepath": "packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js",
"language": "javascript",
"file_size": 3957,
"cut_index": 614,
"middle_length": 229
} |
ource code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
function isCustomElement(tagName: string, props: Object): boolean {
if (tagName.indexOf('-') === -1) {
return false;
}
switch (tagName) {
// These are reserved SVG and Math... | stom-elements-core-concepts
case 'annotation-xml':
case 'color-profile':
case 'font-face':
case 'font-face-src':
case 'font-face-uri':
case 'font-face-format':
case 'font-face-name':
case 'missing-glyph':
return false; | ml.spec.whatwg.org/multipage/custom-elements.html#cu | {
"filepath": "packages/react-dom-bindings/src/shared/isCustomElement.js",
"language": "javascript",
"file_size": 962,
"cut_index": 582,
"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.
*/
const ariaProperties = {
'aria-current': 0, // state
'aria-description': 0,
'aria-details': 0,
'aria-disabled': 0, // state
'aria-hidden': 0, /... | ired': 0,
'aria-selected': 0,
'aria-sort': 0,
'aria-valuemax': 0,
'aria-valuemin': 0,
'aria-valuenow': 0,
'aria-valuetext': 0,
// Live Region Attributes
'aria-atomic': 0,
'aria-busy': 0,
'aria-live': 0,
'aria-relevant': 0,
// Drag-a | panded': 0,
'aria-haspopup': 0,
'aria-level': 0,
'aria-modal': 0,
'aria-multiline': 0,
'aria-multiselectable': 0,
'aria-orientation': 0,
'aria-placeholder': 0,
'aria-pressed': 0,
'aria-readonly': 0,
'aria-requ | {
"filepath": "packages/react-dom-bindings/src/shared/validAriaProperties.js",
"language": "javascript",
"file_size": 1627,
"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
*/
const uppercasePattern = /([A-Z])/g;
const msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for exa... | ttp://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*/
export default function hyphenateStyleName(name: string): string {
return name
.replace(uppercasePattern, '-$1')
.toLowerCase()
.replace(msPattern, '-ms-');
}
| < "-ms-transition"
*
* As Modernizr suggests (h | {
"filepath": "packages/react-dom-bindings/src/shared/hyphenateStyleName.js",
"language": "javascript",
"file_size": 825,
"cut_index": 517,
"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 function validateLinkPropsForStyleResource(props: any): boolean {
if (__DEV__) {
// This should only be called when we know we are opting into Resource se... | ops';
const withArticlePhrase =
includedProps.length === 1
? 'an ' + includedPropsPhrase
: 'the ' + includedPropsPhrase;
if (includedProps.length) {
console.error(
'React encountered a <link rel="stylesheet" hre | edProps.push('`onError`');
if (disabled != null) includedProps.push('`disabled`');
let includedPropsPhrase = propNamesListJoin(includedProps, 'and');
includedPropsPhrase += includedProps.length === 1 ? ' prop' : ' pr | {
"filepath": "packages/react-dom-bindings/src/shared/ReactDOMResourceValidation.js",
"language": "javascript",
"file_size": 2676,
"cut_index": 563,
"middle_length": 229
} |
Therefore, it should be fast and not have many external dependencies.
* @flow
*/
/* eslint-disable dot-notation */
// Imports are resolved statically by the closure compiler in release bundles
// and by rollup in jest unit tests
import './fizz-instruction-set/ReactDOMFizzInstructionSetExternalRuntime';
if (document... | server(() => {
// We expect the body node to be stable once parsed / created
if (document.body != null) {
if (document.readyState === 'loading') {
installFizzInstrObserver(document.body);
}
// $FlowFixMe[incompatible-cast] | t));
} else {
// Document must be loading -- body may not exist yet if the fizz external
// runtime is sent in <head> (e.g. as a preinit resource)
// $FlowFixMe[recursive-definition]
const domBodyObserver = new MutationOb | {
"filepath": "packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js",
"language": "javascript",
"file_size": 3314,
"cut_index": 614,
"middle_length": 229
} |
[key: string]: Preloaded,
},
style: {
[key: string]: Exists | Preloaded | PreloadedWithCredentials,
},
},
// Flushing queues for Resource dependencies
preconnects: Set<Resource>,
fontPreloads: Set<Resource>,
highImagePreloads: Set<Resource>,
// usedImagePreloads: Set<PreloadResource>,
s... | yle: string | void,
},
// Module-global-like reference for flushing/hoisting state of style resources
// We need to track whether the current request has flushed any style resources
// without sending an instruction to hoist them. we do that here
| ll flushes.
preloads: {
images: Map<string, Resource>,
stylesheets: Map<string, Resource>,
scripts: Map<string, Resource>,
moduleScripts: Map<string, Resource>,
},
nonce: {
script: string | void,
st | {
"filepath": "packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js",
"language": "javascript",
"file_size": 240942,
"cut_index": 7068,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* Based on the escape-html library, which is used under the MIT License below:
*
* Copyright (c) 2012-2013 TJ Holowaychuk
* Copyright (c) 2015 Andreas Lubbe
* Copyright (c) 2015 Tiancheng "Timothy" Gu
*
* Permission is hereby... | nditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT | ithout limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following co | {
"filepath": "packages/react-dom-bindings/src/server/escapeTextForBrowser.js",
"language": "javascript",
"file_size": 3482,
"cut_index": 614,
"middle_length": 229
} |
ine-fizz-runtime` to generate.
export const markShellTime =
'requestAnimationFrame(function(){$RT=performance.now()});';
export const clientRenderBoundary =
'$RX=function(b,c,d,e,f){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),f&&(a.cstck=... | ling;f.removeChild(c);c=d}while(c);for(;e.firstChild;)f.insertBefore(e.firstChild,c);g.data="$";g._reactRetry&&requestAnimationFrame(g._reactRetry)}}a.length=0};\n$RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))?(a.previousS | arentNode.removeChild(e);var f=c.parentNode;if(f){var g=c.previousSibling,h=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d||"/&"===d)if(0===h)break;else h--;else"$"!==d&&"$?"!==d&&"$~"!==d&&"$!"!==d&&"&"!==d||h++}d=c.nextSib | {
"filepath": "packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js",
"language": "javascript",
"file_size": 5791,
"cut_index": 716,
"middle_length": 229
} |
thandToLonghand} from './CSSShorthandProperty';
import hyphenateStyleName from '../shared/hyphenateStyleName';
import warnValidStyle from '../shared/warnValidStyle';
import isUnitlessNumber from '../shared/isUnitlessNumber';
import {checkCSSPropertyStringCoercion} from 'shared/CheckStringCoercion';
import {trackHostMu... | nction createDangerousStringForStyles(styles) {
if (__DEV__) {
let serialized = '';
let delimiter = '';
for (const styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
const value = styles[styl | tyle
* attribute generated by server-side rendering. It by-passes warnings and
* security checks so it's not safe to use this value for anything other than
* comparison. It is only used in DEV for SSR validation.
*/
export fu | {
"filepath": "packages/react-dom-bindings/src/client/CSSPropertyOperations.js",
"language": "javascript",
"file_size": 8234,
"cut_index": 716,
"middle_length": 229
} |
MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Below code forked from dom-accessibility-api
const tagToRoleMappings = {
ARTICLE: 'article',
ASIDE: 'complementary',
BODY: 'document',
BUTTON: 'button',
DATALIST: 'listbox',
DD: 'definition',
DETAILS:... | : 'list',
OPTGROUP: 'group',
// WARNING: Only in certain context
OPTION: 'option',
OUTPUT: 'status',
PROGRESS: 'progressbar',
// WARNING: Only with an accessible name
SECTION: 'region',
SUMMARY: 'button',
TABLE: 'table',
TBODY: 'rowgrou | 'heading',
H3: 'heading',
H4: 'heading',
H5: 'heading',
H6: 'heading',
HEADER: 'banner',
HR: 'separator',
LEGEND: 'legend',
LI: 'listitem',
MATH: 'math',
MAIN: 'main',
MENU: 'list',
NAV: 'navigation',
OL | {
"filepath": "packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js",
"language": "javascript",
"file_size": 3209,
"cut_index": 614,
"middle_length": 229
} |
if (
props.contentEditable &&
!props.suppressContentEditableWarning &&
props.children != null
) {
console.error(
'A component is `contentEditable` and contains `children` managed by ' +
'React. It is now your responsibility to guarantee that none of ' +
'those no... | <input> or <button>. Use the action prop on <form>.',
);
} else if (typeof value === 'function') {
if (
(props.encType != null || props.method != null) &&
!didWarnFormActionMethod
) {
didWarnFormA | value: mixed,
props: any,
) {
if (__DEV__) {
if (value == null) {
return;
}
if (tag === 'form') {
if (key === 'formAction') {
console.error(
'You can only pass the formAction prop to | {
"filepath": "packages/react-dom-bindings/src/client/ReactDOMComponent.js",
"language": "javascript",
"file_size": 104160,
"cut_index": 3790,
"middle_length": 229
} |
ept',
acceptcharset: 'acceptCharset',
'accept-charset': 'acceptCharset',
accesskey: 'accessKey',
action: 'action',
allowfullscreen: 'allowFullScreen',
alt: 'alt',
as: 'as',
async: 'async',
autocapitalize: 'autoCapitalize',
autocomplete: 'autoComplete',
autocorrect: 'autoCorrect',
autofocus: 'aut... | ntextmenu: 'contextMenu',
controls: 'controls',
controlslist: 'controlsList',
coords: 'coords',
credentialless: 'credentialless',
crossorigin: 'crossOrigin',
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
data: 'data',
datetime: 'dateT | cked: 'checked',
children: 'children',
cite: 'cite',
class: 'className',
classid: 'classID',
classname: 'className',
cols: 'cols',
colspan: 'colSpan',
content: 'content',
contenteditable: 'contentEditable',
co | {
"filepath": "packages/react-dom-bindings/src/shared/possibleStandardNames.js",
"language": "javascript",
"file_size": 13985,
"cut_index": 921,
"middle_length": 229
} |
createRenderState as createRenderStateImpl,
pushTextInstance as pushTextInstanceImpl,
pushSegmentFinale as pushSegmentFinaleImpl,
pushStartActivityBoundary as pushStartActivityBoundaryImpl,
pushEndActivityBoundary as pushEndActivityBoundaryImpl,
writeStartCompletedSuspenseBoundary as writeStartCompletedSus... | 'react-server/src/ReactServerStreamConfig';
import type {FormStatus} from '../shared/ReactDOMFormActions';
import {NotPending} from '../shared/ReactDOMFormActions';
export const isPrimaryRenderer = false;
export type RenderState = {
// Keep this in | riteEndClientRenderedSuspenseBoundary as writeEndClientRenderedSuspenseBoundaryImpl,
writePreambleStart as writePreambleStartImpl,
} from './ReactFizzConfigDOM';
import type {
Destination,
Chunk,
PrecomputedChunk,
} from | {
"filepath": "packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js",
"language": "javascript",
"file_size": 9862,
"cut_index": 921,
"middle_length": 229
} |
sable dot-notation */
// Instruction set for the Fizz external runtime
import {
clientRenderBoundary,
completeBoundary,
completeBoundaryWithStyles,
completeSegment,
listenToFormSubmissionsForReplaying,
revealCompletedBoundaries,
revealCompletedBoundariesWithViewTransitions,
} from './ReactDOMFizzInstruc... | eBoundaryWithStyles;
window['$RS'] = completeSegment;
listenToFormSubmissionsForReplaying();
// Track the paint time of the shell.
const entries = performance.getEntriesByType
? performance.getEntriesByType('paint')
: [];
if (entries.length > 0) {
| Map();
window['$RB'] = [];
window['$RX'] = clientRenderBoundary;
window['$RV'] = revealCompletedBoundariesWithViewTransitions.bind(
null,
revealCompletedBoundaries,
);
window['$RC'] = completeBoundary;
window['$RR'] = complet | {
"filepath": "packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetExternalRuntime.js",
"language": "javascript",
"file_size": 1379,
"cut_index": 524,
"middle_length": 229
} |
ved from Firefox source code:
// https://github.com/mozilla-firefox/firefox/blob/58f365ba0eb5761a182f1925e4654cc75212b8ac/layout/style/test/property_database.js
export const shorthandToLonghand = {
animation: [
'animationDelay',
'animationDirection',
'animationDuration',
'animationFillMode',
'anim... | der: [
'borderBottomColor',
'borderBottomStyle',
'borderBottomWidth',
'borderImageOutset',
'borderImageRepeat',
'borderImageSlice',
'borderImageSource',
'borderImageWidth',
'borderLeftColor',
'borderLeftStyle',
' | ,
'backgroundImage',
'backgroundOrigin',
'backgroundPositionX',
'backgroundPositionY',
'backgroundRepeat',
'backgroundSize',
],
backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
bor | {
"filepath": "packages/react-dom-bindings/src/client/CSSShorthandProperty.js",
"language": "javascript",
"file_size": 7730,
"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
*/
export interface Destination {
push(chunk: string | null): boolean;
destroy(error: Error): mixed;
}
export opaque type PrecomputedChunk = string;
export opaque ty... | d in the future we'd probably want to have this be in sync with scheduleWork
callback();
}
export function flushBuffered(destination: Destination) {}
export function beginWriting(destination: Destination) {}
export function writeChunk(
destination: | / While this defies the method name the legacy builds have special
// overrides that make work scheduling sync. At the moment scheduleMicrotask
// isn't used by any legacy APIs so this is somewhat academic but if they
// di | {
"filepath": "packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js",
"language": "javascript",
"file_size": 2748,
"cut_index": 563,
"middle_length": 229
} |
with some head room.
const TARGET_VANITY_METRIC = 2300;
// TODO: Symbols that are referenced outside this module use dynamic accessor
// notation instead of dot notation to prevent Closure's advanced compilation
// mode from renaming. We could use extern files instead, but I couldn't get it
// working. Closure convert... | ents. The server may also have emitted a complete instruction but cancelled
// the segment. Regardless we can ignore this case.
} else {
// We can detach the content now.
// Completions of boundaries within this contentNode will now f | ; i += 2) {
const suspenseIdNode = batch[i];
const contentNode = batch[i + 1];
if (contentNode.parentNode === null) {
// If the client has failed hydration we may have already deleted the streaming
// segm | {
"filepath": "packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js",
"language": "javascript",
"file_size": 26450,
"cut_index": 1331,
"middle_length": 229
} |
import isAttributeNameSafe from '../shared/isAttributeNameSafe';
import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
import {trackHostMutation} from 'react-r... | urn;
}
if (!node.hasAttribute(name)) {
// shouldRemoveAttribute
switch (typeof expected) {
case 'function':
case 'symbol':
return expected;
case 'boolean': {
const prefix = name.toLowerCase(). | lue is. Some
* attributes have multiple equivalent values.
*/
export function getValueForAttribute(
node: Element,
name: string,
expected: mixed,
): mixed {
if (__DEV__) {
if (!isAttributeNameSafe(name)) {
ret | {
"filepath": "packages/react-dom-bindings/src/client/DOMPropertyOperations.js",
"language": "javascript",
"file_size": 5995,
"cut_index": 716,
"middle_length": 229
} |
import type {
CrossOriginEnum,
PreloadImplOptions,
PreloadModuleImplOptions,
PreinitStyleOptions,
PreinitScriptOptions,
PreinitModuleScriptOptions,
} from 'react-dom/src/shared/ReactDOMTypes';
// This module registers the host dispatcher so it needs to be imported
// even if no exports are used.
import {pr... | s in more positions.
type UnspecifiedPrecedence = 0;
// prettier-ignore
type TypeMap = {
// prefetchDNS(href)
'D': /* href */ string,
// preconnect(href, options)
'C':
| /* href */ string
| [/* href */ string, CrossOriginEnum],
// precon | recedence because it is
// small, smaller than how we encode undefined, and is unambiguous. We could use
// a different tuple structure to encode this instead but this makes the runtime
// cost cheaper by eliminating a type check | {
"filepath": "packages/react-dom-bindings/src/server/ReactFlightServerConfigDOM.js",
"language": "javascript",
"file_size": 6059,
"cut_index": 716,
"middle_length": 229
} |
ct-core
*/
'use strict';
import {patchMessageChannel} from '../../../../scripts/jest/patchMessageChannel';
// Polyfills for test environment
global.ReadableStream =
require('web-streams-polyfill/ponyfill/es6').ReadableStream;
global.WritableStream =
require('web-streams-polyfill/ponyfill/es6').WritableStream;
g... | require('scheduler');
patchMessageChannel(ReactServerScheduler);
serverAct = require('internal-test-utils').serverAct;
// Simulate the condition resolution
jest.mock('react', () => require('react/react.react-server'));
ReactServer = r | OMClient;
let ReactServer;
let ReactServerScheduler;
let act;
let serverAct;
let turbopackMap;
let use;
describe('ReactFlightTurbopackDOMBrowser', () => {
beforeEach(() => {
jest.resetModules();
ReactServerScheduler = | {
"filepath": "packages/react-server-dom-turbopack/src/__tests__/ReactFlightTurbopackDOMBrowser-test.js",
"language": "javascript",
"file_size": 6797,
"cut_index": 716,
"middle_length": 229
} |
Flowing,
startFlowingDebug,
stopFlowing,
abort,
resolveDebugMessage,
closeDebugChannel,
} from 'react-server/src/ReactFlightServer';
import {
createResponse,
reportGlobalError,
close,
resolveField,
resolveFile,
resolveFileInfo,
resolveFileChunk,
resolveFileComplete,
getRoot,
} from 'react-s... | eStringDecoder,
readPartialStringChunk,
readFinalStringChunk,
} from 'react-client/src/ReactFlightClientStreamConfigNode';
import {textEncoder} from 'react-server/src/ReactServerStreamConfigNode';
import type {TemporaryReferenceSet} from 'react-serve | dModule,
requireModule,
resolveServerReference,
} from '../client/ReactFlightClientConfigBundlerParcel';
export {
createClientReference,
registerServerReference,
} from '../ReactFlightParcelReferences';
import {
creat | {
"filepath": "packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js",
"language": "javascript",
"file_size": 23147,
"cut_index": 1331,
"middle_length": 229
} |
},
});
};
global.Blob.prototype.text = async function () {
const impl = Object.getOwnPropertySymbols(this)[0];
return this[impl]._buffer.toString('utf8');
};
// Don't wait before processing work on the server.
// TODO: we can replace this with FlightServer.act().
global.setTimeout = cb => cb();
let container;... | rver'));
jest.mock('react-server-dom-webpack/server', () =>
require('react-server-dom-webpack/server.edge'),
);
ReactServerDOMServer = require('react-server-dom-webpack/server.edge');
const WebpackMock = require('./utils/WebpackMock') | nState;
let act;
let assertConsoleErrorDev;
describe('ReactFlightDOMForm', () => {
beforeEach(() => {
jest.resetModules();
// Simulate the condition resolution
jest.mock('react', () => require('react/react.react-se | {
"filepath": "packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js",
"language": "javascript",
"file_size": 32770,
"cut_index": 1331,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.