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 14911b7 commit b60faa9
Show file tree
Hide file tree
Showing 26 changed files with 78 additions and 77 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@typescript-eslint/parser": "^6.7.4",
"acorn": "^8.7.1",
"babel-jest": "^29.6.3",
"babel-plugin-syntax-hermes-parser": "0.19.2",
"babel-plugin-syntax-hermes-parser": "0.20.0",
"chalk": "^4.0.0",
"debug": "^2.2.0",
"eslint": "^8.23.1",
Expand All @@ -27,7 +27,7 @@
"eslint-plugin-relay": "^1.8.3",
"flow-bin": "^0.229.2",
"glob": "^7.1.1",
"hermes-eslint": "0.19.2",
"hermes-eslint": "0.20.0",
"invariant": "^2.2.4",
"istanbul-api": "3.0.0",
"istanbul-lib-coverage": "3.0.0",
Expand All @@ -38,7 +38,7 @@
"metro-babel-register": "*",
"micromatch": "^4.0.4",
"prettier": "2.8.8",
"prettier-plugin-hermes-parser": "0.19.2",
"prettier-plugin-hermes-parser": "0.20.0",
"progress": "^2.0.0",
"typescript": "5.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-babel-register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@babel/preset-typescript": "^7.18.0",
"@babel/register": "^7.0.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"babel-plugin-syntax-hermes-parser": "0.19.2",
"babel-plugin-syntax-hermes-parser": "0.20.0",
"babel-plugin-transform-flow-enums": "^0.0.2",
"escape-string-regexp": "^1.0.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-babel-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.20.0",
"hermes-parser": "0.19.2",
"hermes-parser": "0.20.0",
"nullthrows": "^1.1.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-cache/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

// <reference types="node" />

import Cache from './Cache';
import stableHash from './stableHash';
import AutoCleanFileStore from './stores/AutoCleanFileStore';
import FileStore from './stores/FileStore';
import HttpGetStore from './stores/HttpGetStore';
import HttpStore from './stores/HttpStore';
import Cache from './Cache';
import stableHash from './stableHash';

export type {Options as FileOptions} from './stores/FileStore';
export type {Options as HttpOptions} from './stores/HttpStore';
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-file-map/src/Watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export class Watcher extends EventEmitter {
const WatcherImpl = useWatchman
? WatchmanWatcher
: FSEventsWatcher.isSupported()
? FSEventsWatcher
: NodeWatcher;
? FSEventsWatcher
: NodeWatcher;

let watcher = 'node';
if (WatcherImpl === WatchmanWatcher) {
Expand Down
5 changes: 2 additions & 3 deletions packages/metro-file-map/src/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,8 @@ describe('FileMap', () => {

describe('duplicate modules', () => {
beforeEach(async () => {
mockFs[
path.join('/', 'project', 'fruits', 'another', 'Strawberry.js')
] = `
mockFs[path.join('/', 'project', 'fruits', 'another', 'Strawberry.js')] =
`
const Blackberry = require("Blackberry");
`;

Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/types/flow-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @oncall react_native
*/

import type {PerfLoggerFactory, RootPerfLogger, PerfLogger} from 'metro-config';
import type {PerfLogger, PerfLoggerFactory, RootPerfLogger} from 'metro-config';
import type {AbortSignal} from 'node-abort-controller';

export type {PerfLoggerFactory, PerfLogger};
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-memory-fs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1501,8 +1501,8 @@ class Stats {
node.type === 'file'
? node.content.length
: node.type === 'symbolicLink'
? node.target.length
: 0;
? node.target.length
: 0;
this.blocks = Math.ceil(this.size / 512);
this.atimeMs = 1;
this.mtimeMs = 1;
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-transform-worker/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
*/

import type {DynamicRequiresBehavior} from 'metro';
import type {TransformResultDependency} from 'metro/src/DeltaBundler';
import type {AllowOptionalDependencies} from 'metro/src/DeltaBundler/types';
import type {
CustomTransformOptions,
TransformProfile,
Expand All @@ -20,6 +18,8 @@ import type {
FBSourceFunctionMap,
MetroSourceMapSegmentTuple,
} from 'metro-source-map';
import type {TransformResultDependency} from 'metro/src/DeltaBundler';
import type {AllowOptionalDependencies} from 'metro/src/DeltaBundler/types';

export type MinifierConfig = Readonly<Record<string, unknown>>;

Expand Down
2 changes: 1 addition & 1 deletion packages/metro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"denodeify": "^1.2.1",
"error-stack-parser": "^2.0.6",
"graceful-fs": "^4.2.4",
"hermes-parser": "0.19.2",
"hermes-parser": "0.20.0",
"image-size": "^1.0.2",
"invariant": "^2.2.4",
"jest-worker": "^29.6.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/metro/src/lib/TerminalReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ class TerminalReporter {
phase === 'done'
? chalk.green
: phase === 'failed'
? chalk.red
: chalk.yellow;
? chalk.red
: chalk.yellow;
const progress =
phase === 'in_progress'
? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +
Expand Down
4 changes: 2 additions & 2 deletions packages/metro/src/lib/logToConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ module.exports = (
level === 'error'
? chalk.inverse.red
: level === 'warn'
? chalk.inverse.yellow
: chalk.inverse.white;
? chalk.inverse.yellow
: chalk.inverse.white;

if (level === 'group') {
groupStack.push(level);
Expand Down
2 changes: 1 addition & 1 deletion packages/metro/src/shared/output/RamBundle/as-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function saveAsAssets(
ModuleTransportLike,
>(),
});
if (sourcemapSourcesRoot !== undefined) {
if (sourcemapSourcesRoot != null) {
relativizeSourceMapInline(sourceMap, sourcemapSourcesRoot);
}
const wroteSourceMap = writeSourceMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function saveAsIndexedFile(
moduleGroups,
fixWrapperOffset: true,
});
if (sourcemapSourcesRoot !== undefined) {
if (sourcemapSourcesRoot != null) {
relativizeSourceMapInline(sourceMap, sourcemapSourcesRoot);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/metro/src/shared/output/bundle.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function saveBundleAndMap(

if (sourcemapOutput) {
let {map} = bundle;
if (sourcemapSourcesRoot !== undefined) {
if (sourcemapSourcesRoot != null) {
log('start relativating source map');
map = relativateSerializedMap(map, sourcemapSourcesRoot);
log('finished relativating');
Expand Down
8 changes: 4 additions & 4 deletions packages/metro/src/shared/output/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const constantFor = (encoding: 'ascii' | 'utf16le' | 'utf8') =>
/^ascii$/i.test(encoding)
? 1
: isUTF8(encoding)
? 2
: /^(?:utf-?16(?:le)?|ucs-?2)$/.test(encoding)
? 3
: 0;
? 2
: /^(?:utf-?16(?:le)?|ucs-?2)$/.test(encoding)
? 3
: 0;

module.exports = function (
code: Buffer | string,
Expand Down
2 changes: 1 addition & 1 deletion packages/metro/types/Bundler.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import type {TransformResultWithSource} from './DeltaBundler';
import type {TransformOptions} from './DeltaBundler/Worker';
import type DependencyGraph from './node-haste/DependencyGraph';
import type {ConfigT} from 'metro-config';
import type {EventEmitter} from 'events';
import type {ConfigT} from 'metro-config';

export interface BundlerOptions {
readonly hasReducedPerformance?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/metro/types/DeltaBundler/Worker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* @oncall react_native
*/

import type {TransformResult} from './types';
import type {
JsTransformerConfig,
JsTransformOptions,
} from 'metro-transform-worker';
import type {TransformResult} from './types';

type LogEntry = unknown;

Expand Down
4 changes: 2 additions & 2 deletions packages/metro/types/DeltaBundler/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* @oncall react_native
*/

import type {JsTransformOptions} from 'metro-transform-worker';
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
import type {RequireContext} from '../lib/contextModule';
import type CountingSet from '../lib/CountingSet';
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
import type {Graph} from './Graph';
import type {JsTransformOptions} from 'metro-transform-worker';

export interface MixedOutput {
readonly data: {code: string};
Expand Down
7 changes: 4 additions & 3 deletions packages/metro/types/IncrementalBundler.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
* @oncall react_native
*/

import type Bundler from './Bundler';
import type {
Options as DeltaBundlerOptions,
ReadOnlyDependencies,
TransformInputOptions,
} from './DeltaBundler/types';
import {ResolverInputOptions} from './shared/types';
import type {ConfigT} from 'metro-config';
import type {GraphId} from './lib/getGraphId';
import type {ConfigT} from 'metro-config';

import DeltaBundler, {DeltaResult, Graph, Module} from './DeltaBundler';
import type Bundler from './Bundler';
import {ResolverInputOptions} from './shared/types';

export type RevisionId = string;

Expand Down
3 changes: 2 additions & 1 deletion packages/metro/types/Server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import type {AssetData} from './Asset';
import type {RamBundleInfo} from './DeltaBundler/Serializers/getRamBundleInfo';
import IncrementalBundler, {RevisionId} from './IncrementalBundler';
import type {GraphId} from './lib/getGraphId';
import type MultipartResponse from './Server/MultipartResponse';
import type {
Expand All @@ -26,6 +25,8 @@ import type {
import type {ConfigT, RootPerfLogger} from 'metro-config';
import type {CustomResolverOptions} from 'metro-resolver';

import IncrementalBundler, {RevisionId} from './IncrementalBundler';

export interface SegmentLoadData {
[index: number]: [number[], number | null];
}
Expand Down
9 changes: 5 additions & 4 deletions packages/metro/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ export * from './ModuleGraph/worker/collectDependencies';
export * from './Server';
export * from './lib/reporting';

import type {ReadOnlyGraph} from './DeltaBundler/types';
import type {ServerOptions, default as MetroServer} from './Server';
import type {OutputOptions, RequestOptions} from './shared/types';
import type {HandleFunction} from 'connect';
import type {EventEmitter} from 'events';
import type {IncomingMessage, Server as HttpServer} from 'http';
import type {Server as HttpsServer} from 'https';
import type {CustomTransformOptions} from 'metro-babel-transformer';
import type {
ConfigT,
InputConfigT,
MetroConfig,
Middleware,
} from 'metro-config';
import type {CustomTransformOptions} from 'metro-babel-transformer';
import type {ReadOnlyGraph} from './DeltaBundler/types';
import type {Duplex} from 'stream';

import Yargs = require('yargs');
import type {default as MetroServer, ServerOptions} from './Server';
import type {OutputOptions, RequestOptions} from './shared/types';

export {loadConfig, mergeConfig, resolveConfig} from 'metro-config';
export {Terminal} from 'metro-core';
Expand Down
6 changes: 3 additions & 3 deletions packages/metro/types/node-haste/DependencyGraph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* @oncall react_native
*/

import {EventEmitter} from 'events';
import {ConfigT} from 'metro-config';
import {ResolverInputOptions} from '../shared/types';
import {
BundlerResolution,
TransformResultDependency,
} from '../DeltaBundler/types';
import {ResolverInputOptions} from '../shared/types';
import {EventEmitter} from 'events';
import {ConfigT} from 'metro-config';

export default class DependencyGraph extends EventEmitter {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/metro/types/shared/output/bundle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @oncall react_native
*/

import {OutputOptions, RequestOptions} from '../../shared/types';
import Server from '../../Server';
import {OutputOptions, RequestOptions} from '../../shared/types';

export function build(
packagerClient: Server,
Expand Down
9 changes: 4 additions & 5 deletions packages/metro/types/shared/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
* @oncall react_native
*/

import type {
Options as DeltaBundlerOptions,
TransformInputOptions,
} from '../DeltaBundler/types';
import type {TransformProfile} from 'metro-babel-transformer';
import type {CustomResolverOptions} from 'metro-resolver';

import type {
MetroSourceMapSegmentTuple,
MixedSourceMap,
Expand All @@ -19,10 +22,6 @@ import type {
CustomTransformOptions,
MinifierOptions,
} from 'metro-transform-worker';
import type {
Options as DeltaBundlerOptions,
TransformInputOptions,
} from '../DeltaBundler/types';

export type BundleType =
| 'bundle'
Expand Down
Loading

0 comments on commit b60faa9

Please sign in to comment.