FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

View File

@@ -0,0 +1,26 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<a36641315baa7d27d1b9ab17f41dbb35>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/FailedToResolveNameError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
declare class FailedToResolveNameError extends Error {
dirPaths: ReadonlyArray<string>;
extraPaths: ReadonlyArray<string>;
constructor(
dirPaths: ReadonlyArray<string>,
extraPaths: ReadonlyArray<string>,
);
}
export default FailedToResolveNameError;

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
class FailedToResolveNameError extends Error {
constructor(dirPaths, extraPaths) {
const displayDirPaths = dirPaths.concat(extraPaths);
const hint = displayDirPaths.length ? " or in these directories:" : "";
super(
`Module does not exist in the Haste module map${hint}\n` +
displayDirPaths.map((dirPath) => ` ${dirPath}`).join("\n") +
"\n",
);
this.dirPaths = dirPaths;
this.extraPaths = extraPaths;
}
}
exports.default = FailedToResolveNameError;

View File

@@ -0,0 +1,31 @@
/**
* 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 strict
* @format
* @oncall react_native
*/
export default class FailedToResolveNameError extends Error {
dirPaths: ReadonlyArray<string>;
extraPaths: ReadonlyArray<string>;
constructor(
dirPaths: ReadonlyArray<string>,
extraPaths: ReadonlyArray<string>,
) {
const displayDirPaths = dirPaths.concat(extraPaths);
const hint = displayDirPaths.length ? ' or in these directories:' : '';
super(
`Module does not exist in the Haste module map${hint}\n` +
displayDirPaths.map(dirPath => ` ${dirPath}`).join('\n') +
'\n',
);
this.dirPaths = dirPaths;
this.extraPaths = extraPaths;
}
}

View File

@@ -0,0 +1,24 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<1e0fa2d1bab2971504a4c271d453dc29>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/FailedToResolvePathError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {FileAndDirCandidates} from '../types';
declare class FailedToResolvePathError extends Error {
candidates: FileAndDirCandidates;
constructor(candidates: FileAndDirCandidates);
}
export default FailedToResolvePathError;

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _formatFileCandidates = _interopRequireDefault(
require("./formatFileCandidates"),
);
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
class FailedToResolvePathError extends Error {
constructor(candidates) {
super(
"The module could not be resolved because none of these files exist:\n\n" +
[candidates.file, candidates.dir]
.filter(Boolean)
.map(
(candidates) =>
` * ${(0, _formatFileCandidates.default)(candidates)}`,
)
.join("\n"),
);
this.candidates = candidates;
}
}
exports.default = FailedToResolvePathError;

View File

@@ -0,0 +1,29 @@
/**
* 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 strict-local
* @format
* @oncall react_native
*/
import type {FileAndDirCandidates} from '../types';
import formatFileCandidates from './formatFileCandidates';
export default class FailedToResolvePathError extends Error {
candidates: FileAndDirCandidates;
constructor(candidates: FileAndDirCandidates) {
super(
'The module could not be resolved because none of these files exist:\n\n' +
[candidates.file, candidates.dir]
.filter(Boolean)
.map(candidates => ` * ${formatFileCandidates(candidates)}`)
.join('\n'),
);
this.candidates = candidates;
}
}

View File

@@ -0,0 +1,21 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<a8e62e3e6931f81d3849ddc01e077eda>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/FailedToResolveUnsupportedError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
declare class FailedToResolveUnsupportedError extends Error {
constructor(message: string);
}
export default FailedToResolveUnsupportedError;

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
class FailedToResolveUnsupportedError extends Error {
constructor(message) {
super(message);
}
}
exports.default = FailedToResolveUnsupportedError;

View File

@@ -0,0 +1,16 @@
/**
* 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 strict
* @format
* @oncall react_native
*/
export default class FailedToResolveUnsupportedError extends Error {
constructor(message: string) {
super(message);
}
}

View File

@@ -0,0 +1,32 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<109d7323b70ba3a4582f5868df075ffc>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/InvalidPackageConfigurationError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
/**
* Raised when a package contains an invalid `package.json` configuration.
*/
declare class InvalidPackageConfigurationError extends Error {
/**
* The description of the error cause.
*/
reason: string;
/**
* Absolute path of the package being resolved.
*/
packagePath: string;
constructor(opts: Readonly<{reason: string; packagePath: string}>);
}
export default InvalidPackageConfigurationError;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
class InvalidPackageConfigurationError extends Error {
constructor(opts) {
super(
`The package ${opts.packagePath} contains an invalid package.json ` +
"configuration. Consider raising this issue with the package " +
"maintainer(s).\nReason: " +
opts.reason,
);
Object.assign(this, opts);
}
}
exports.default = InvalidPackageConfigurationError;

View File

@@ -0,0 +1,41 @@
/**
* 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 strict
* @format
* @oncall react_native
*/
/**
* Raised when a package contains an invalid `package.json` configuration.
*/
export default class InvalidPackageConfigurationError extends Error {
/**
* The description of the error cause.
*/
reason: string;
/**
* Absolute path of the package being resolved.
*/
packagePath: string;
constructor(
opts: Readonly<{
reason: string,
packagePath: string,
}>,
) {
super(
`The package ${opts.packagePath} contains an invalid package.json ` +
'configuration. Consider raising this issue with the package ' +
'maintainer(s).\nReason: ' +
opts.reason,
);
// $FlowFixMe[unsafe-object-assign]
Object.assign(this, opts);
}
}

View File

@@ -0,0 +1,49 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<47b272bf4a763f5c68eed66346ee74e9>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/InvalidPackageError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {FileCandidates} from '../types';
declare class InvalidPackageError extends Error {
/**
* The file candidates we tried to find to resolve the `main` field of the
* package. Ex. `/js/foo/beep(.js|.json)?` if `main` is specifying `./beep`
* as the entry point.
*/
fileCandidates: FileCandidates;
/**
* The 'index' file candidates we tried to find to resolve the `main` field of
* the package. Ex. `/js/foo/beep/index(.js|.json)?` if `main` is specifying
* `./beep` as the entry point.
*/
indexCandidates: FileCandidates;
/**
* The full path to the main module that was attempted.
*/
mainModulePath: string;
/**
* Full path the package we were trying to resolve.
* Ex. `/js/foo/package.json`.
*/
packageJsonPath: string;
constructor(opts: {
readonly fileCandidates: FileCandidates;
readonly indexCandidates: FileCandidates;
readonly mainModulePath: string;
readonly packageJsonPath: string;
});
}
export default InvalidPackageError;

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _formatFileCandidates = _interopRequireDefault(
require("./formatFileCandidates"),
);
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
class InvalidPackageError extends Error {
constructor(opts) {
super(
`The package \`${opts.packageJsonPath}\` is invalid because it ` +
"specifies a `main` module field that could not be resolved (" +
`\`${opts.mainModulePath}\`. None of these files exist:\n\n` +
` * ${(0, _formatFileCandidates.default)(opts.fileCandidates)}\n` +
` * ${(0, _formatFileCandidates.default)(opts.indexCandidates)}`,
);
Object.assign(this, opts);
}
}
exports.default = InvalidPackageError;

View File

@@ -0,0 +1,55 @@
/**
* 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 strict-local
* @format
* @oncall react_native
*/
import type {FileCandidates} from '../types';
import formatFileCandidates from './formatFileCandidates';
export default class InvalidPackageError extends Error {
/**
* The file candidates we tried to find to resolve the `main` field of the
* package. Ex. `/js/foo/beep(.js|.json)?` if `main` is specifying `./beep`
* as the entry point.
*/
fileCandidates: FileCandidates;
/**
* The 'index' file candidates we tried to find to resolve the `main` field of
* the package. Ex. `/js/foo/beep/index(.js|.json)?` if `main` is specifying
* `./beep` as the entry point.
*/
indexCandidates: FileCandidates;
/**
* The full path to the main module that was attempted.
*/
mainModulePath: string;
/**
* Full path the package we were trying to resolve.
* Ex. `/js/foo/package.json`.
*/
packageJsonPath: string;
constructor(opts: {
+fileCandidates: FileCandidates,
+indexCandidates: FileCandidates,
+mainModulePath: string,
+packageJsonPath: string,
}) {
super(
`The package \`${opts.packageJsonPath}\` is invalid because it ` +
'specifies a `main` module field that could not be resolved (' +
`\`${opts.mainModulePath}\`. None of these files exist:\n\n` +
` * ${formatFileCandidates(opts.fileCandidates)}\n` +
` * ${formatFileCandidates(opts.indexCandidates)}`,
);
// $FlowFixMe[unsafe-object-assign]
Object.assign(this, opts);
}
}

View File

@@ -0,0 +1,34 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<5d012a93c58cbef8b5b315d70cb4fd5a>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/PackageImportNotResolvedError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
/**
* Raised when package imports do not define or permit a target subpath in the
* package for the given import specifier.
*/
declare class PackageImportNotResolvedError extends Error {
/**
* Either the import specifier read, or the absolute path of the module being
* resolved (used when import specifier is externally remapped).
*/
readonly importSpecifier: string;
/**
* The description of the error cause.
*/
readonly reason: string;
constructor(opts: Readonly<{importSpecifier: string; reason: string}>);
}
export default PackageImportNotResolvedError;

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
class PackageImportNotResolvedError extends Error {
constructor(opts) {
super(
`The path for ${opts.importSpecifier} could not be resolved.\nReason: ` +
opts.reason,
);
this.importSpecifier = opts.importSpecifier;
this.reason = opts.reason;
}
}
exports.default = PackageImportNotResolvedError;

View File

@@ -0,0 +1,41 @@
/**
* 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 strict
* @format
* @oncall react_native
*/
/**
* Raised when package imports do not define or permit a target subpath in the
* package for the given import specifier.
*/
export default class PackageImportNotResolvedError extends Error {
/**
* Either the import specifier read, or the absolute path of the module being
* resolved (used when import specifier is externally remapped).
*/
+importSpecifier: string;
/**
* The description of the error cause.
*/
+reason: string;
constructor(
opts: Readonly<{
importSpecifier: string,
reason: string,
}>,
) {
super(
`The path for ${opts.importSpecifier} could not be resolved.\nReason: ` +
opts.reason,
);
this.importSpecifier = opts.importSpecifier;
this.reason = opts.reason;
}
}

View File

@@ -0,0 +1,23 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<f9f99f4d6c93fb36455e75fa72336e11>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/PackagePathNotExportedError.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
/**
* Raised when package exports do not define or permit a target subpath in the
* package for the given module.
*/
declare class PackagePathNotExportedError extends Error {}
export default PackagePathNotExportedError;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
class PackagePathNotExportedError extends Error {}
exports.default = PackagePathNotExportedError;

View File

@@ -0,0 +1,16 @@
/**
* 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 strict
* @format
* @oncall react_native
*/
/**
* Raised when package exports do not define or permit a target subpath in the
* package for the given module.
*/
export default class PackagePathNotExportedError extends Error {}

View File

@@ -0,0 +1,21 @@
/**
* 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.
*
* @noformat
* @oncall react_native
* @generated SignedSource<<648dc80101f337456690a8a403891952>>
*
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
* Original file: packages/metro-resolver/src/errors/formatFileCandidates.js
* To regenerate, run:
* js1 build metro-ts-defs (internal) OR
* yarn run build-ts-defs (OSS)
*/
import type {FileCandidates} from '../types';
declare function formatFileCandidates(candidates: FileCandidates): string;
export default formatFileCandidates;

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = formatFileCandidates;
function formatFileCandidates(candidates) {
if (candidates.type === "asset") {
return candidates.name;
}
let formatted = candidates.filePathPrefix;
if (candidates.candidateExts.length) {
formatted += "(" + candidates.candidateExts.filter(Boolean).join("|") + ")";
}
return formatted;
}

View File

@@ -0,0 +1,25 @@
/**
* 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 strict-local
* @format
* @oncall react_native
*/
import type {FileCandidates} from '../types';
export default function formatFileCandidates(
candidates: FileCandidates,
): string {
if (candidates.type === 'asset') {
return candidates.name;
}
let formatted = candidates.filePathPrefix;
if (candidates.candidateExts.length) {
formatted += '(' + candidates.candidateExts.filter(Boolean).join('|') + ')';
}
return formatted;
}