mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
* Extract base Jest config This makes it easier to change the source config without affecting the build test config. * Statically import the host config This changes react-reconciler to import HostConfig instead of getting it through a function argument. Rather than start with packages like ReactDOM that want to inline it, I started with React Noop and ensured that *custom* renderers using react-reconciler package still work. To do this, I'm making HostConfig module in the reconciler look at a global variable by default (which, in case of the react-reconciler npm package, ends up being the host config argument in the top-level scope). This is still very broken. * Add scaffolding for importing an inlined renderer * Fix the build * ES exports for renderer methods * ES modules for host configs * Remove closures from the reconciler * Check each renderer's config with Flow * Fix uncovered Flow issue We know nextHydratableInstance doesn't get mutated inside this function, but Flow doesn't so it thinks it may be null. Help Flow. * Prettier * Get rid of enable*Reconciler flags They are not as useful anymore because for almost all cases (except third party renderers) we *know* whether it supports mutation or persistence. This refactoring means react-reconciler and react-reconciler/persistent third-party packages now ship the same thing. Not ideal, but this seems worth how simpler the code becomes. We can later look into addressing it by having a single toggle instead. * Prettier again * Fix Flow config creation issue * Fix imprecise Flow typing * Revert accidental changes
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
process.on('unhandledRejection', err => {
|
|
throw err;
|
|
});
|
|
|
|
const chalk = require('chalk');
|
|
const runFlow = require('../flow/runFlow');
|
|
const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
|
|
|
|
// This script is using `flow status` for a quick check with a server.
|
|
// Use it for local development.
|
|
|
|
const primaryRenderer = inlinedHostConfigs.find(
|
|
info => info.isFlowTyped && info.shortName === process.argv[2]
|
|
);
|
|
if (!primaryRenderer) {
|
|
console.log(
|
|
'The ' +
|
|
chalk.red('yarn flow') +
|
|
' command now requires you to pick a primary renderer:'
|
|
);
|
|
console.log();
|
|
inlinedHostConfigs.forEach(rendererInfo => {
|
|
if (rendererInfo.isFlowTyped) {
|
|
console.log(' * ' + chalk.cyan('yarn flow ' + rendererInfo.shortName));
|
|
}
|
|
});
|
|
console.log();
|
|
console.log('If you are not sure, run ' + chalk.green('yarn flow dom') + '.');
|
|
console.log(
|
|
'This will still typecheck non-DOM packages, although less precisely.'
|
|
);
|
|
console.log();
|
|
console.log('Note that checks for all renderers will run on CI.');
|
|
console.log(
|
|
'You can also do this locally with ' +
|
|
chalk.cyan('yarn flow-ci') +
|
|
' but it will be slow.'
|
|
);
|
|
console.log();
|
|
process.exit(1);
|
|
}
|
|
|
|
runFlow(primaryRenderer.shortName, ['status']);
|