mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Cleanup legacy flow types in react-native (#56300)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56300 Changelog: [Internal] Reviewed By: marcoww6 Differential Revision: D99004126 fbshipit-source-id: dfedc13c867cb768777e2ba65256a2c40ffb1d08
This commit is contained in:
1 parent
8e202de86e
commit
82bffce573
44 files changed
+106
-105
No files matched your search
@@ -229,7 +229,7 @@ async function buildFile(
|
||||
/*::
|
||||
type PackageJson = {
|
||||
name: string,
|
||||
exports?: {[subpath: string]: string | mixed},
|
||||
exports?: {[subpath: string]: string | unknown},
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
@@ -163,9 +163,9 @@ async function buildDebuggerFrontend(
|
||||
packagePath /*: string */,
|
||||
scratchPath /*: string */,
|
||||
localCheckoutPath /*: ?string */,
|
||||
{branch, gclientSyncOptions, noBuild} /*: $ReadOnly<{
|
||||
{branch, gclientSyncOptions, noBuild} /*: Readonly<{
|
||||
branch: string,
|
||||
gclientSyncOptions: $ReadOnly<{nohooks: boolean}>,
|
||||
gclientSyncOptions: Readonly<{nohooks: boolean}>,
|
||||
noBuild: boolean,
|
||||
}>*/,
|
||||
) /*: Promise<{checkoutPath: string}> */ {
|
||||
@@ -244,7 +244,7 @@ async function checkoutDevToolsFrontend(
|
||||
async function setupGclientWorkspace(
|
||||
scratchPath /*: string */,
|
||||
checkoutPath /*: string */,
|
||||
{nohooks} /*: $ReadOnly<{nohooks: boolean}> */,
|
||||
{nohooks} /*: Readonly<{nohooks: boolean}> */,
|
||||
) {
|
||||
process.stdout.write('Setting up gclient workspace' + '\n');
|
||||
await spawnSafe(
|
||||
@@ -345,12 +345,12 @@ async function copyLicenseToPackage(
|
||||
}
|
||||
|
||||
async function generateBuildInfo(
|
||||
info /*: $ReadOnly<{
|
||||
info /*: Readonly<{
|
||||
checkoutPath: string,
|
||||
isLocalCheckout: boolean,
|
||||
branch: string,
|
||||
packagePath: string,
|
||||
gclientSyncOptions: $ReadOnly<{nohooks: boolean}>,
|
||||
gclientSyncOptions: Readonly<{nohooks: boolean}>,
|
||||
gnArgsSummary: string,
|
||||
noBuild: boolean,
|
||||
}> */,
|
||||
@@ -588,7 +588,7 @@ async function createSyncDiff(
|
||||
{
|
||||
checkoutPath,
|
||||
noBuild,
|
||||
} /*: $ReadOnly<{checkoutPath: string, noBuild: boolean}> */,
|
||||
} /*: Readonly<{checkoutPath: string, noBuild: boolean}> */,
|
||||
) {
|
||||
process.stdout.write('Creating a sync diff\n');
|
||||
const {packagePath, baseGitRevision} = diffBaseInfo;
|
||||
|
||||
@@ -16,7 +16,7 @@ try {
|
||||
isMetaInternal = false;
|
||||
}
|
||||
|
||||
let additionalConfig /*: $ReadOnly<{
|
||||
let additionalConfig /*: Readonly<{
|
||||
appVersionHash: ?string,
|
||||
}> */ = {
|
||||
appVersionHash: null,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
function tryExecNTimes(
|
||||
funcToRetry /*: () => number */,
|
||||
retriesLeft /*: number */,
|
||||
onEveryError /*: ?(() => mixed) */,
|
||||
onEveryError /*: ?(() => unknown) */,
|
||||
) /*: number */ {
|
||||
const exitCode = funcToRetry();
|
||||
if (exitCode === 0) {
|
||||
|
||||
@@ -22,8 +22,8 @@ import type { Dependency, Destination, Platform } from './types';
|
||||
async function buildDepenencies(
|
||||
scheme /*: string */,
|
||||
configuration /*: string */,
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
destinations /*: $ReadOnlyArray<Destination> */,
|
||||
dependencies /*: ReadonlyArray<Dependency> */,
|
||||
destinations /*: ReadonlyArray<Destination> */,
|
||||
rootFolder /*: string */,
|
||||
buildFolder /*: string */,
|
||||
) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {Dependency, Destination, Platform} from './types';
|
||||
|
||||
// CI can't use commas in cache keys, so 'macOS,variant=Mac Catalyst' was creating troubles
|
||||
// This map that converts from platforms to valid Xcodebuild destinations.
|
||||
const platformToDestination /*: $ReadOnly<{|[Platform]: Destination|}> */ = {
|
||||
const platformToDestination /*: Readonly<{|[Platform]: Destination|}> */ = {
|
||||
ios: 'iOS',
|
||||
'ios-simulator': 'iOS Simulator',
|
||||
macos: 'macOS',
|
||||
@@ -92,8 +92,8 @@ async function getCLIConfiguration() /*: Promise<?{|
|
||||
build: boolean,
|
||||
compose: boolean,
|
||||
|},
|
||||
destinations: $ReadOnlyArray<Destination>,
|
||||
dependencies: $ReadOnlyArray<Dependency>,
|
||||
destinations: ReadonlyArray<Destination>,
|
||||
dependencies: ReadonlyArray<Dependency>,
|
||||
configuration: string,
|
||||
identity: ?string,
|
||||
|}> */ {
|
||||
|
||||
@@ -23,7 +23,7 @@ import type { Dependency, Platform } from './types';
|
||||
async function createFramework(
|
||||
scheme /*: string */,
|
||||
configuration /*: string */,
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
dependencies /*: ReadonlyArray<Dependency> */,
|
||||
rootFolder /*: string */,
|
||||
buildFolder /*: string */,
|
||||
identity /*: ?string */,
|
||||
@@ -81,7 +81,7 @@ async function createFramework(
|
||||
*/
|
||||
function copyHeaders(
|
||||
scheme /*: string */,
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
dependencies /*: ReadonlyArray<Dependency> */,
|
||||
rootFolder /*: string */,
|
||||
) {
|
||||
console.log('Copying header files for dependencies...');
|
||||
@@ -114,7 +114,7 @@ function copyHeaders(
|
||||
*/
|
||||
function copyBundles(
|
||||
scheme /*: string */,
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
dependencies /*: ReadonlyArray<Dependency> */,
|
||||
outputFolder /*:string*/,
|
||||
frameworkPaths /*:Array<string>*/,
|
||||
) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import type { Dependency, Platform } from './types';
|
||||
*/
|
||||
|
||||
const platforms /*: $ReadOnlyArray<Platform> */ = [
|
||||
const platforms /*: ReadonlyArray<Platform> */ = [
|
||||
'ios',
|
||||
'ios-simulator',
|
||||
'macos',
|
||||
@@ -25,7 +25,7 @@ const platforms /*: $ReadOnlyArray<Platform> */ = [
|
||||
|
||||
const CPP_STANDARD = 'c++20';
|
||||
|
||||
const dependencies /*: $ReadOnlyArray<Dependency> */ = [
|
||||
const dependencies /*: ReadonlyArray<Dependency> */ = [
|
||||
{
|
||||
name: 'glog',
|
||||
version: '0.3.5',
|
||||
|
||||
@@ -32,7 +32,7 @@ const exec = util.promisify(require('child_process').exec);
|
||||
* according to the configuration provided.
|
||||
*/
|
||||
async function setupDependencies(
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
dependencies /*: ReadonlyArray<Dependency> */,
|
||||
rootFolder /*: string */,
|
||||
) {
|
||||
console.log('✅ Setting up dependencies...');
|
||||
|
||||
@@ -21,7 +21,7 @@ const path = require('path');
|
||||
*/
|
||||
async function createSwiftPackageFile(
|
||||
scheme /*: string */,
|
||||
dependencies /* :$ReadOnlyArray<Dependency> */,
|
||||
dependencies /* :ReadonlyArray<Dependency> */,
|
||||
rootFolder /*: string */,
|
||||
) {
|
||||
console.log(
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
/*::
|
||||
export type Folder = RegExp;
|
||||
|
||||
export type Files = $ReadOnly<{
|
||||
headers: $ReadOnlyArray<string>,
|
||||
sources: $ReadOnlyArray<string>,
|
||||
resources?: $ReadOnlyArray<string>,
|
||||
export type Files = Readonly<{
|
||||
headers: ReadonlyArray<string>,
|
||||
sources: ReadonlyArray<string>,
|
||||
resources?: ReadonlyArray<string>,
|
||||
// Relative path from target root to where the header files should be copied.
|
||||
// Can be used to ensure header search paths like <double-conversion/double-conversion.h>
|
||||
// are correctly resolved.
|
||||
@@ -22,22 +22,22 @@ export type Files = $ReadOnly<{
|
||||
headerSkipFolderNames?: string,
|
||||
}>;
|
||||
|
||||
export type Define = $ReadOnly<{
|
||||
export type Define = Readonly<{
|
||||
name: string,
|
||||
value?: string,
|
||||
}>;
|
||||
|
||||
export type Settings = $ReadOnly<{
|
||||
headerSearchPaths?: $ReadOnlyArray<string>,
|
||||
defines?: $ReadOnlyArray<Define>,
|
||||
cCompilerFlags?: $ReadOnlyArray<string>,
|
||||
cxxCompilerFlags?: $ReadOnlyArray<string>,
|
||||
linkedLibraries?: $ReadOnlyArray<string>,
|
||||
export type Settings = Readonly<{
|
||||
headerSearchPaths?: ReadonlyArray<string>,
|
||||
defines?: ReadonlyArray<Define>,
|
||||
cCompilerFlags?: ReadonlyArray<string>,
|
||||
cxxCompilerFlags?: ReadonlyArray<string>,
|
||||
linkedLibraries?: ReadonlyArray<string>,
|
||||
publicHeaderFiles: string,
|
||||
linkerSettings?: $ReadOnlyArray<string>
|
||||
linkerSettings?: ReadonlyArray<string>
|
||||
}>;
|
||||
|
||||
export type Dependency = $ReadOnly<{
|
||||
export type Dependency = Readonly<{
|
||||
name: string,
|
||||
version: string,
|
||||
url: URL,
|
||||
@@ -45,7 +45,7 @@ export type Dependency = $ReadOnly<{
|
||||
files: Files,
|
||||
settings: Settings,
|
||||
disabled?: boolean,
|
||||
dependencies?: $ReadOnlyArray<string>,
|
||||
dependencies?: ReadonlyArray<string>,
|
||||
}>;
|
||||
|
||||
export type Platform =
|
||||
|
||||
@@ -30,15 +30,15 @@ import type {DotSlashProvider, DotSlashHttpProvider, DotSlashArtifactInfo} from
|
||||
import type {IOctokit} from './utils/octokit-utils';
|
||||
|
||||
type GitHubReleaseAsset = {id: string, ...};
|
||||
type ReleaseAssetMap = $ReadOnlyMap<string, GitHubReleaseAsset>;
|
||||
type ReleaseAssetMap = ReadonlyMap<string, GitHubReleaseAsset>;
|
||||
|
||||
type ReleaseInfo = $ReadOnly<{
|
||||
type ReleaseInfo = Readonly<{
|
||||
releaseId: string,
|
||||
releaseTag: string,
|
||||
existingAssetsByName: ReleaseAssetMap,
|
||||
}>;
|
||||
|
||||
type ExecutionOptions = $ReadOnly<{
|
||||
type ExecutionOptions = Readonly<{
|
||||
force: boolean,
|
||||
dryRun: boolean,
|
||||
}>;
|
||||
@@ -191,7 +191,7 @@ async function fetchUpstreamAssetAndUploadToRelease(
|
||||
artifactInfo,
|
||||
dotslashFilename,
|
||||
} /*: {
|
||||
providers: $ReadOnlyArray<DotSlashProvider>,
|
||||
providers: ReadonlyArray<DotSlashProvider>,
|
||||
suggestedFilename: string,
|
||||
artifactInfo: DotSlashArtifactInfo,
|
||||
dotslashFilename: string,
|
||||
|
||||
@@ -40,7 +40,7 @@ type DotSlashPlatformSpec = {
|
||||
...
|
||||
};
|
||||
|
||||
export type DotSlashArtifactInfo = $ReadOnly<{
|
||||
export type DotSlashArtifactInfo = Readonly<{
|
||||
size: number,
|
||||
hash: 'blake3' | 'sha256',
|
||||
digest: string,
|
||||
@@ -54,13 +54,13 @@ type JSONCFormattingOptions = {
|
||||
};
|
||||
|
||||
type DotSlashProvidersTransformFn = (
|
||||
providers: $ReadOnlyArray<DotSlashProvider>,
|
||||
providers: ReadonlyArray<DotSlashProvider>,
|
||||
suggestedFilename: string,
|
||||
artifactInfo: DotSlashArtifactInfo,
|
||||
) => ?$ReadOnlyArray<DotSlashProvider> | Promise<?$ReadOnlyArray<DotSlashProvider>>;
|
||||
) => ?ReadonlyArray<DotSlashProvider> | Promise<?ReadonlyArray<DotSlashProvider>>;
|
||||
*/
|
||||
|
||||
const DEFAULT_FORMATTING_OPTIONS /*: $ReadOnly<JSONCFormattingOptions> */ = {
|
||||
const DEFAULT_FORMATTING_OPTIONS /*: Readonly<JSONCFormattingOptions> */ = {
|
||||
tabSize: 4,
|
||||
insertSpaces: true,
|
||||
eol: '\n',
|
||||
@@ -75,7 +75,7 @@ const DEFAULT_FORMATTING_OPTIONS /*: $ReadOnly<JSONCFormattingOptions> */ = {
|
||||
async function processDotSlashFileInPlace(
|
||||
filename /*: string */,
|
||||
transformProviders /*: DotSlashProvidersTransformFn */,
|
||||
formattingOptions /*: $ReadOnly<JSONCFormattingOptions> */ = DEFAULT_FORMATTING_OPTIONS,
|
||||
formattingOptions /*: Readonly<JSONCFormattingOptions> */ = DEFAULT_FORMATTING_OPTIONS,
|
||||
) /*: Promise<void> */ {
|
||||
// Validate the file using `dotslash` itself so we can be reasonably sure that it conforms
|
||||
// to the expected format.
|
||||
@@ -87,7 +87,7 @@ async function processDotSlashFileInPlace(
|
||||
const json = parse(originalContentsJson);
|
||||
let intermediateContentsJson = originalContentsJson;
|
||||
for (const [platform, platformSpec] of Object.entries(json.platforms) /*::
|
||||
as $ReadOnlyArray<[string, DotSlashPlatformSpec]>
|
||||
as ReadonlyArray<[string, DotSlashPlatformSpec]>
|
||||
*/) {
|
||||
const providers = platformSpec.providers;
|
||||
const suggestedFilename =
|
||||
@@ -144,7 +144,7 @@ function splitShebangFromContents(
|
||||
*/
|
||||
async function validateAndParseDotSlashFile(
|
||||
filename /*: string */,
|
||||
) /*: mixed */ {
|
||||
) /*: unknown */ {
|
||||
const {stdout} = await execFile(dotslash, ['--', 'parse', filename]);
|
||||
return JSON.parse(stdout);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ async function writeReleaseAssetUrlsToDotSlashFile(
|
||||
|
||||
async function updateAndVerifyProviders(
|
||||
{providers: providersArg, suggestedFilename, artifactInfo, releaseTag} /*:
|
||||
{providers: $ReadOnlyArray<DotSlashProvider>,
|
||||
{providers: ReadonlyArray<DotSlashProvider>,
|
||||
suggestedFilename: string,
|
||||
artifactInfo: DotSlashArtifactInfo,
|
||||
releaseTag: string,}
|
||||
@@ -151,8 +151,8 @@ function createReleaseAssetProvider(
|
||||
}
|
||||
|
||||
function diffProviderArrays(
|
||||
original /*: $ReadOnlyArray<DotSlashProvider> */,
|
||||
updated /*: $ReadOnlyArray<DotSlashProvider> */,
|
||||
original /*: ReadonlyArray<DotSlashProvider> */,
|
||||
updated /*: ReadonlyArray<DotSlashProvider> */,
|
||||
) {
|
||||
return jestDiff(original, updated, {
|
||||
aAnnotation: 'Original',
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
const {execSync} = require('child_process');
|
||||
const argv /*:$ReadOnly<{
|
||||
const argv /*:Readonly<{
|
||||
maxWorkers?: number,
|
||||
jestBinary?: string,
|
||||
flowBinary?: string,
|
||||
|
||||
@@ -27,7 +27,7 @@ export type PackageJson = {
|
||||
...
|
||||
};
|
||||
|
||||
type PackagesFilter = $ReadOnly<{
|
||||
type PackagesFilter = Readonly<{
|
||||
// Include the main react-native package
|
||||
includeReactNative: boolean,
|
||||
|
||||
@@ -135,7 +135,7 @@ async function parsePackageInfo(
|
||||
*/
|
||||
async function updatePackageJson(
|
||||
{path: packagePath, packageJson} /*: PackageInfo */,
|
||||
newPackageVersions /*: $ReadOnly<{[string]: string}> */,
|
||||
newPackageVersions /*: Readonly<{[string]: string}> */,
|
||||
) /*: Promise<void> */ {
|
||||
const packageName = packageJson.name;
|
||||
|
||||
|
||||
Reference in new issue
Block a user