Skip to content

Commit

Permalink
Update hermes-parser and related packages in fbsource to 0.20.0
Browse files Browse the repository at this point in the history
Summary:
Bump hermes-parser and related packages to [0.20.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: alexmckenley

Differential Revision: D54368487

fbshipit-source-id: a5a05f1e499ff5d8bda4649433bd285f7215d3da
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Feb 29, 2024
1 parent 67b9628 commit 2053364
Show file tree
Hide file tree
Showing 25 changed files with 121 additions and 125 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-redundant-undefined": "^0.4.0",
"eslint-plugin-relay": "^1.8.3",
"flow-api-translator": "0.19.2",
"flow-api-translator": "0.20.0",
"flow-bin": "^0.229.2",
"glob": "^7.1.1",
"hermes-eslint": "0.19.2",
"hermes-transform": "0.19.2",
"hermes-eslint": "0.20.0",
"hermes-transform": "0.20.0",
"inquirer": "^7.1.0",
"jest": "^29.6.3",
"jest-junit": "^10.0.0",
Expand All @@ -104,7 +104,7 @@
"node-fetch": "^2.2.0",
"nullthrows": "^1.1.1",
"prettier": "2.8.8",
"prettier-plugin-hermes-parser": "0.19.2",
"prettier-plugin-hermes-parser": "0.20.0",
"react": "18.2.0",
"react-test-renderer": "18.2.0",
"rimraf": "^3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/hermes-inspector-msggen/src/Property.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ class RefProperty extends Property {
return this.cyclical
? `{nullptr, deleter<${fullCppType}>}`
: this.optional
? ''
: '{}';
? ''
: '{}';
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-babel-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@babel/core": "^7.20.0",
"@react-native/babel-preset": "0.74.0",
"hermes-parser": "0.19.2",
"hermes-parser": "0.20.0",
"nullthrows": "^1.1.1"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@babel/parser": "^7.20.0",
"glob": "^7.1.1",
"hermes-parser": "0.19.2",
"hermes-parser": "0.20.0",
"invariant": "^2.2.4",
"jscodeshift": "^0.14.0",
"mkdirp": "^0.5.1",
Expand All @@ -49,7 +49,7 @@
"@babel/plugin-transform-flow-strip-types": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"chalk": "^4.0.0",
"hermes-estree": "0.19.2",
"hermes-estree": "0.20.0",
"micromatch": "^4.0.4",
"prettier": "2.8.8",
"rimraf": "^3.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,8 @@ function InternalTextInput(props: Props): React.Node {
typeof props.value === 'string'
? props.value
: typeof props.defaultValue === 'string'
? props.defaultValue
: '';
? props.defaultValue
: '';

// This is necessary in case native updates the text and JS decides
// that the update should be ignored and we should stick with the value
Expand Down Expand Up @@ -1736,12 +1736,12 @@ const ExportedForwardRef: React.AbstractComponent<
textContentType != null
? textContentType
: Platform.OS === 'ios' &&
autoComplete &&
autoComplete in autoCompleteWebToTextContentTypeMap
? // $FlowFixMe[invalid-computed-prop]
// $FlowFixMe[prop-missing]
autoCompleteWebToTextContentTypeMap[autoComplete]
: textContentType
autoComplete &&
autoComplete in autoCompleteWebToTextContentTypeMap
? // $FlowFixMe[invalid-computed-prop]
// $FlowFixMe[prop-missing]
autoCompleteWebToTextContentTypeMap[autoComplete]
: textContentType
}
{...restProps}
forwardedRef={forwardedRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const extractSingleTouch = (nativeEvent: {
return !hasTouches && hasChangedTouches
? changedTouches[0]
: hasTouches
? touches[0]
: nativeEvent;
? touches[0]
: nativeEvent;
};

/**
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native/Libraries/Core/Devtools/parseErrorStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ function parseErrorStack(errorStack?: string): Array<StackFrame> {
const parsedStack = Array.isArray(errorStack)
? errorStack
: global.HermesInternal
? convertHermesStack(parseHermesStack(errorStack))
: stacktraceParser.parse(errorStack).map((frame): StackFrame => ({
...frame,
column: frame.column != null ? frame.column - 1 : null,
}));
? convertHermesStack(parseHermesStack(errorStack))
: stacktraceParser.parse(errorStack).map((frame): StackFrame => ({
...frame,
column: frame.column != null ? frame.column - 1 : null,
}));

return parsedStack;
}
Expand Down
32 changes: 16 additions & 16 deletions packages/react-native/Libraries/Core/Devtools/parseHermesStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,25 @@ function parseLine(line: string): ?HermesStackEntry {
asFrame[2] === 'native'
? {type: 'NATIVE'}
: asFrame[3] === 'address at '
? isInternalBytecodeSourceUrl(asFrame[4])
? {
type: 'INTERNAL_BYTECODE',
sourceUrl: asFrame[4],
line1Based: Number.parseInt(asFrame[5], 10),
virtualOffset0Based: Number.parseInt(asFrame[6], 10),
}
? isInternalBytecodeSourceUrl(asFrame[4])
? {
type: 'INTERNAL_BYTECODE',
sourceUrl: asFrame[4],
line1Based: Number.parseInt(asFrame[5], 10),
virtualOffset0Based: Number.parseInt(asFrame[6], 10),
}
: {
type: 'BYTECODE',
sourceUrl: asFrame[4],
line1Based: Number.parseInt(asFrame[5], 10),
virtualOffset0Based: Number.parseInt(asFrame[6], 10),
}
: {
type: 'BYTECODE',
type: 'SOURCE',
sourceUrl: asFrame[4],
line1Based: Number.parseInt(asFrame[5], 10),
virtualOffset0Based: Number.parseInt(asFrame[6], 10),
}
: {
type: 'SOURCE',
sourceUrl: asFrame[4],
line1Based: Number.parseInt(asFrame[5], 10),
column1Based: Number.parseInt(asFrame[6], 10),
},
column1Based: Number.parseInt(asFrame[6], 10),
},
};
}
const asSkipped = line.match(RE_SKIPPED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ const TouchHistoryMath = {
ofCurrent && isXAxis
? oneTouchData.currentPageX
: ofCurrent && !isXAxis
? oneTouchData.currentPageY
: !ofCurrent && isXAxis
? oneTouchData.previousPageX
: oneTouchData.previousPageY;
? oneTouchData.currentPageY
: !ofCurrent && isXAxis
? oneTouchData.previousPageX
: oneTouchData.previousPageY;
count = 1;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function getNativeComponentAttributes(uiViewClassName: string): any {
? true
: {process}
: process == null
? {diff}
: {diff, process};
? {diff}
: {diff, process};
}

// Unfortunately, the current setup declares style properties as top-level
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,5 +918,5 @@ export type ____FlattenStyleProp_Internal<
> = TStyleProp extends null | void | false | ''
? empty
: TStyleProp extends $ReadOnlyArray<infer V>
? ____FlattenStyleProp_Internal<V>
: TStyleProp;
? ____FlattenStyleProp_Internal<V>
: TStyleProp;
8 changes: 4 additions & 4 deletions packages/react-native/Libraries/Utilities/Platform.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const Platform: PlatformType = {
? // $FlowFixMe[incompatible-return]
spec.android
: 'native' in spec
? // $FlowFixMe[incompatible-return]
spec.native
: // $FlowFixMe[incompatible-return]
spec.default,
? // $FlowFixMe[incompatible-return]
spec.native
: // $FlowFixMe[incompatible-return]
spec.default,
};

module.exports = Platform;
Original file line number Diff line number Diff line change
Expand Up @@ -7750,8 +7750,8 @@ export type ____FlattenStyleProp_Internal<
> = TStyleProp extends null | void | false | \\"\\"
? empty
: TStyleProp extends $ReadOnlyArray<infer V>
? ____FlattenStyleProp_Internal<V>
: TStyleProp;
? ____FlattenStyleProp_Internal<V>
: TStyleProp;
"
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
const node = getShadowNode(this);

if (node != null) {
const scrollPosition = nullthrows(getFabricUIManager()).getScrollPosition(
node,
);
const scrollPosition =
nullthrows(getFabricUIManager()).getScrollPosition(node);
if (scrollPosition != null) {
return scrollPosition[0];
}
Expand All @@ -166,9 +165,8 @@ export default class ReadOnlyElement extends ReadOnlyNode {
const node = getShadowNode(this);

if (node != null) {
const scrollPosition = nullthrows(getFabricUIManager()).getScrollPosition(
node,
);
const scrollPosition =
nullthrows(getFabricUIManager()).getScrollPosition(node);
if (scrollPosition != null) {
return scrollPosition[1];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ export default class ReadOnlyNode {
return null;
}

const parentInstanceHandle = nullthrows(getFabricUIManager()).getParentNode(
shadowNode,
);
const parentInstanceHandle =
nullthrows(getFabricUIManager()).getParentNode(shadowNode);

if (parentInstanceHandle == null) {
return null;
Expand Down Expand Up @@ -323,9 +322,8 @@ export function getChildNodes(
return [];
}

const childNodeInstanceHandles = nullthrows(
getFabricUIManager(),
).getChildNodes(shadowNode);
const childNodeInstanceHandles =
nullthrows(getFabricUIManager()).getChildNodes(shadowNode);
return childNodeInstanceHandles
.map(instanceHandle =>
getPublicInstanceFromInternalInstanceHandle(instanceHandle),
Expand Down
4 changes: 2 additions & 2 deletions packages/rn-tester/js/RNTesterAppShared.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ const RNTesterApp = ({
activeModuleTitle != null
? activeModuleTitle
: screen === Screens.COMPONENTS
? 'Components'
: 'APIs';
? 'Components'
: 'APIs';

const activeExampleList =
screen === Screens.COMPONENTS ? examplesList.components : examplesList.apis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ class NestedCheckBox extends React.Component<
checkbox2 && this.state.checkbox3
? true
: checkbox2 || this.state.checkbox3
? 'mixed'
: false,
? 'mixed'
: false,
});
};

Expand All @@ -659,8 +659,8 @@ class NestedCheckBox extends React.Component<
this.state.checkbox2 && checkbox3
? true
: this.state.checkbox2 || checkbox3
? 'mixed'
: false,
? 'mixed'
: false,
});
};

Expand All @@ -680,8 +680,8 @@ class NestedCheckBox extends React.Component<
this.state.checkbox1 === 'mixed'
? mixedCheckboxImageSource
: this.state.checkbox1
? checkImageSource
: uncheckImageSource
? checkImageSource
: uncheckImageSource
}
/>
<Text>Meat</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function PerfExampleWrapper(props: {
{loadExample === SHOW_BAD_EXAMPLE
? badExampleContents
: loadExample === SHOW_GOOD_EXAMPLE
? goodExampleContents
: null}
? goodExampleContents
: null}
</View>
</View>
</RNTesterPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ function VariantColorsExample() {
Platform.OS === 'ios'
? DynamicColorIOS({light: 'red', dark: 'blue'})
: Platform.OS === 'android'
? PlatformColor('?attr/colorAccent')
: 'red',
? PlatformColor('?attr/colorAccent')
: 'red',
}}
/>
</View>
Expand Down
4 changes: 2 additions & 2 deletions packages/rn-tester/js/examples/Pressable/PressableExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ function PressableNativeMethods() {
{status == null
? 'Missing Ref!'
: status === true
? 'Native Methods Exist'
: 'Native Methods Missing!'}
? 'Native Methods Exist'
: 'Native Methods Missing!'}
</Text>
</View>
</>
Expand Down
4 changes: 2 additions & 2 deletions packages/rn-tester/js/examples/Touchable/TouchableExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ function TouchableNativeMethodChecker<
{status == null
? 'Missing Ref!'
: status === true
? 'Native Methods Exist'
: 'Native Methods Missing!'}
? 'Native Methods Exist'
: 'Native Methods Missing!'}
</Text>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ export default class CellRenderer<ItemT> extends React.Component<
? [styles.rowReverse, inversionStyle]
: [styles.columnReverse, inversionStyle]
: horizontal
? [styles.row, inversionStyle]
: inversionStyle;
? [styles.row, inversionStyle]
: inversionStyle;
const result = !CellRendererComponent ? (
<View
style={cellStyle}
Expand Down
4 changes: 2 additions & 2 deletions scripts/npm-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ function getNpmInfo(buildType /*: BuildType */) /*: NpmInfo */ {
prerelease != null
? 'next'
: isLatest === true
? 'latest'
: releaseBranchTag;
? 'latest'
: releaseBranchTag;

return {
version,
Expand Down
4 changes: 2 additions & 2 deletions scripts/releases-ci/prepare-package-for-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async function main() {
const buildType = isDryRun
? 'dry-run'
: isReleaseBranch(branch)
? 'release'
: 'nightly';
? 'release'
: 'nightly';

failIfTagExists(releaseVersion, buildType);

Expand Down
Loading

0 comments on commit 2053364

Please sign in to comment.