mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Upgrade pretty-format to v29 (#45732)
Summary: As described in [this issue](https://github.com/facebook/react-native/issues/45726), we had a problem where, at runtime, version v29 instead of v26 was used, so upgrading it is the fastest fix. ## Changelog: [GENERAL] [CHANGED] - Upgrade pretty-format to 29.7.0 <!-- For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: https://github.com/facebook/react-native/pull/45732 Test Plan: I use console log in the RN tester app  Reviewed By: blakef Differential Revision: D60533197 Pulled By: tdn120 fbshipit-source-id: b83dbfe463971abbf00cfebdcc9e5dd6975de0d8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8618eecde6
commit
7bc9244d0c
-49
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
type PrettyFormatPlugin =
|
||||
| {
|
||||
test: (value: mixed) => boolean,
|
||||
print: (value: mixed) => string,
|
||||
}
|
||||
| {
|
||||
test: (value: mixed) => boolean,
|
||||
serialize: (value: mixed) => string,
|
||||
};
|
||||
|
||||
declare module 'pretty-format' {
|
||||
declare module.exports: {
|
||||
(
|
||||
value: mixed,
|
||||
options?: ?{
|
||||
callToJSON?: ?boolean,
|
||||
escapeRegex?: ?boolean,
|
||||
escapeString?: ?boolean,
|
||||
highlight?: ?boolean,
|
||||
indent?: ?number,
|
||||
maxDepth?: ?number,
|
||||
min?: ?boolean,
|
||||
plugins?: ?Array<PrettyFormatPlugin>,
|
||||
printFunctionName?: ?boolean,
|
||||
theme?: ?{
|
||||
comment?: ?string,
|
||||
prop?: ?string,
|
||||
tag?: ?string,
|
||||
value: ?string,
|
||||
},
|
||||
},
|
||||
): string,
|
||||
|
||||
plugins: {
|
||||
AsymmetricMatcher: PrettyFormatPlugin,
|
||||
ConvertAnsi: PrettyFormatPlugin,
|
||||
DOMCollection: PrettyFormatPlugin,
|
||||
DOMElement: PrettyFormatPlugin,
|
||||
Immutable: PrettyFormatPlugin,
|
||||
ReactElement: PrettyFormatPlugin,
|
||||
ReactTestComponent: PrettyFormatPlugin,
|
||||
},
|
||||
};
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
declare type Print = (value: mixed) => string;
|
||||
declare type Indent = (value: string) => string;
|
||||
declare type PluginOptions = {
|
||||
edgeSpacing: string,
|
||||
min: boolean,
|
||||
spacing: string,
|
||||
};
|
||||
declare type Colors = {
|
||||
comment: {close: string; open: string},
|
||||
content: {close: string; open: string},
|
||||
prop: {close: string; open: string},
|
||||
tag: {close: string; open: string},
|
||||
value: {close: string; open: string},
|
||||
};
|
||||
declare type CompareKeys = ((a: string, b: string) => number) | null | void;
|
||||
|
||||
declare type PrettyFormatPlugin =
|
||||
| {
|
||||
print: (
|
||||
value: mixed,
|
||||
print?: ?Print,
|
||||
indent?: ?Indent,
|
||||
options?: ?PluginOptions,
|
||||
colors?: ?Colors,
|
||||
) => string,
|
||||
test: (value: mixed) => boolean,
|
||||
}
|
||||
| {
|
||||
serialize: (value: mixed) => string,
|
||||
test: (value: mixed) => boolean,
|
||||
};
|
||||
|
||||
declare module 'pretty-format' {
|
||||
declare export function format(
|
||||
value: mixed,
|
||||
options?: ?{
|
||||
callToJSON?: ?boolean,
|
||||
compareKeys?: CompareKeys,
|
||||
escapeRegex?: ?boolean,
|
||||
escapeString?: ?boolean,
|
||||
highlight?: ?boolean,
|
||||
indent?: ?number,
|
||||
maxDepth?: ?number,
|
||||
maxWidth?: ?number,
|
||||
min?: ?boolean,
|
||||
plugins?: ?Array<PrettyFormatPlugin>,
|
||||
printBasicPrototype?: ?boolean,
|
||||
printFunctionName?: ?boolean,
|
||||
theme?: ?{
|
||||
comment?: ?string,
|
||||
content?: ?string,
|
||||
prop?: ?string,
|
||||
tag?: ?string,
|
||||
value: ?string,
|
||||
},
|
||||
},
|
||||
): string;
|
||||
declare export const plugins: {
|
||||
AsymmetricMatcher: PrettyFormatPlugin,
|
||||
DOMCollection: PrettyFormatPlugin,
|
||||
DOMElement: PrettyFormatPlugin,
|
||||
Immutable: PrettyFormatPlugin,
|
||||
ReactElement: PrettyFormatPlugin,
|
||||
ReactTestComponent: PrettyFormatPlugin,
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -126,7 +126,7 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
data: data.map(item =>
|
||||
typeof item === 'string'
|
||||
? item
|
||||
: prettyFormat(item, {
|
||||
: prettyFormat.format(item, {
|
||||
escapeString: true,
|
||||
highlight: true,
|
||||
maxDepth: 3,
|
||||
|
||||
@@ -27,7 +27,7 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
|
||||
stack = error.stack;
|
||||
} else {
|
||||
try {
|
||||
message = require('pretty-format')(rejection);
|
||||
message = require('pretty-format').format(rejection);
|
||||
} catch {
|
||||
message =
|
||||
typeof rejection === 'string'
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
"metro-source-map": "^0.80.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"nullthrows": "^1.1.1",
|
||||
"pretty-format": "^26.5.2",
|
||||
"pretty-format": "^29.7.0",
|
||||
"promise": "^8.3.0",
|
||||
"react-devtools-core": "^5.3.1",
|
||||
"react-refresh": "^0.14.0",
|
||||
|
||||
@@ -7399,7 +7399,7 @@ pretty-format@^24.9.0:
|
||||
ansi-styles "^3.2.0"
|
||||
react-is "^16.8.4"
|
||||
|
||||
pretty-format@^26.5.2, pretty-format@^26.6.2:
|
||||
pretty-format@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93"
|
||||
integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==
|
||||
@@ -7427,6 +7427,15 @@ pretty-format@^29.6.3:
|
||||
ansi-styles "^5.0.0"
|
||||
react-is "^18.0.0"
|
||||
|
||||
pretty-format@^29.7.0:
|
||||
version "29.7.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
|
||||
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==
|
||||
dependencies:
|
||||
"@jest/schemas" "^29.6.3"
|
||||
ansi-styles "^5.0.0"
|
||||
react-is "^18.0.0"
|
||||
|
||||
prettyjson@^1.2.1:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/prettyjson/-/prettyjson-1.2.5.tgz#ef3cfffcc70505c032abc59785884b4027031835"
|
||||
|
||||
Reference in New Issue
Block a user