Skip to content

Commit 2b18fb4

Browse files
authored
Merge branch 'main' into main
2 parents 1bc7ea6 + bf73ed3 commit 2b18fb4

File tree

58 files changed

+934
-416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+934
-416
lines changed

.flowconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ untyped-import
3939
untyped-type-import
4040

4141
[version]
42-
^0.168.0
42+
^0.171.0

docs/Configuration.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,20 @@ This option works similarly to how [$NODE_PATH](https://nodejs.org/api/modules.h
149149

150150
Type: `?CustomResolver`
151151

152-
An optional function used to resolve requests. Particularly useful for cases where aliases are used. For example:
152+
An optional function used to resolve requests. Particularly useful for cases where aliases or custom protocols are used. For example:
153153

154154
```javascript
155-
resolveRequest: (context, realModuleName, platform, moduleName) => {
156-
// Resolve file path logic...
157-
158-
return {
159-
filePath: "path/to/file",
160-
type: 'sourceFile',
161-
};
155+
resolveRequest: (context, moduleName, platform) => {
156+
if (moduleName.startsWith('my-custom-resolver:')) {
157+
// Resolve file path logic...
158+
// NOTE: Throw an error if there is no resolution.
159+
return {
160+
filePath: "path/to/file",
161+
type: 'sourceFile',
162+
};
163+
}
164+
// Optionally, chain to the standard Metro resolver.
165+
return context.resolveRequest(context, moduleName, platform);
162166
}
163167
```
164168

flow-typed/babel-traverse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

flow-typed/babel.js.flow

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

flow-typed/console.js.flow

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

flow-typed/debug.js.flow

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

flow-typed/graceful-fs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @flow
88
* @format
99
*/
10+
1011
'use strict';
1112

1213
declare module 'graceful-fs' {

flow-typed/npm/ci-info_v2.x.x.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict
8+
* @format
9+
*/
10+
11+
declare module 'ci-info' {
12+
declare module.exports: {
13+
isCI: boolean,
14+
name: string,
15+
isPR: boolean,
16+
};
17+
}

flow-typed/uglify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lerna": "2.4.0",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"npmClient": "yarn",
55
"useWorkspaces": true
66
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"eslint-plugin-prettier": "^4.0.0",
2626
"eslint-plugin-react": "^7.26.1",
2727
"eslint-plugin-relay": "^1.8.2",
28-
"flow-bin": "^0.168.0",
28+
"flow-bin": "^0.171.0",
2929
"glob": "^7.1.1",
3030
"istanbul-api": "3.0.0",
3131
"istanbul-lib-coverage": "3.0.0",

packages/buck-worker-tool/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "buck-worker-tool",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "Implementation of the Buck worker protocol for Node.js.",
55
"license": "MIT",
66
"main": "src/worker-tool.js",
@@ -12,7 +12,7 @@
1212
"temp": "^0.8.3"
1313
},
1414
"devDependencies": {
15-
"metro-memory-fs": "0.66.2",
15+
"metro-memory-fs": "0.67.0",
1616
"mkdirp": "^0.5.1"
1717
},
1818
"scripts": {

packages/metro-babel-register/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-babel-register",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 babel/register configuration for Metro.",
55
"main": "src/babel-register.js",
66
"repository": {

packages/metro-babel-transformer/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-babel-transformer",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Base Babel transformer for Metro.",
55
"main": "src/index.js",
66
"repository": {
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@babel/core": "^7.14.0",
2121
"hermes-parser": "0.5.0",
22-
"metro-source-map": "0.66.2",
22+
"metro-source-map": "0.67.0",
2323
"nullthrows": "^1.1.1"
2424
}
2525
}

packages/metro-cache-key/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-cache-key",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Cache key utility.",
55
"main": "src/index.js",
66
"repository": {
@@ -13,6 +13,6 @@
1313
},
1414
"license": "MIT",
1515
"devDependencies": {
16-
"metro-memory-fs": "0.66.2"
16+
"metro-memory-fs": "0.67.0"
1717
}
1818
}

packages/metro-cache/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-cache",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Cache layers for Metro.",
55
"main": "src/index.js",
66
"repository": {
@@ -12,12 +12,12 @@
1212
"cleanup-release": "test ! -e build && mv src build && mv src.real src"
1313
},
1414
"dependencies": {
15-
"metro-core": "0.66.2",
15+
"metro-core": "0.67.0",
1616
"mkdirp": "^0.5.1",
1717
"rimraf": "^2.5.4"
1818
},
1919
"devDependencies": {
20-
"metro-memory-fs": "0.66.2"
20+
"metro-memory-fs": "0.67.0"
2121
},
2222
"license": "MIT"
2323
}

packages/metro-cache/src/stableHash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const canonicalize = require('metro-core/src/canonicalize');
1616
function stableHash(value: mixed): Buffer {
1717
return (
1818
crypto
19-
.createHash('md4')
19+
.createHash('md5')
2020
/* $FlowFixMe(>=0.95.0 site=react_native_fb) This comment suppresses an
2121
* error found when Flow v0.95 was deployed. To see the error, delete this
2222
* comment and run Flow. */

packages/metro-config/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-config",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Config parser for Metro.",
55
"main": "src/index.js",
66
"repository": {
@@ -15,10 +15,10 @@
1515
"dependencies": {
1616
"cosmiconfig": "^5.0.5",
1717
"jest-validate": "^26.5.2",
18-
"metro": "0.66.2",
19-
"metro-cache": "0.66.2",
20-
"metro-core": "0.66.2",
21-
"metro-runtime": "0.66.2"
18+
"metro": "0.67.0",
19+
"metro-cache": "0.67.0",
20+
"metro-core": "0.67.0",
21+
"metro-runtime": "0.67.0"
2222
},
2323
"devDependencies": {
2424
"pretty-format": "^26.5.2",

packages/metro-core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-core",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Metro's core package.",
55
"main": "src/index.js",
66
"repository": {
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"jest-haste-map": "^27.3.1",
1616
"lodash.throttle": "^4.1.1",
17-
"metro-resolver": "0.66.2"
17+
"metro-resolver": "0.67.0"
1818
},
1919
"license": "MIT"
2020
}

packages/metro-hermes-compiler/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-hermes-compiler",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Hermes bytecode compiler for Metro.",
55
"main": "src/index.js",
66
"repository": {

packages/metro-inspector-proxy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-inspector-proxy",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Inspector proxy for React Native and dev tools integration.",
55
"main": "src/index.js",
66
"bin": "src/cli.js",

packages/metro-memory-fs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-memory-fs",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 A memory-based implementation of `fs` useful for testing.",
55
"main": "src/index.js",
66
"repository": {

packages/metro-minify-terser/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metro-minify-terser",
3-
"version": "0.66.2",
3+
"version": "0.67.0",
44
"description": "🚇 Minifier for Metro based on Terser.",
55
"main": "src/index.js",
66
"repository": {
@@ -13,6 +13,6 @@
1313
},
1414
"license": "MIT",
1515
"dependencies": {
16-
"terser": "^4.6.3"
16+
"terser": "^5.10.0"
1717
}
1818
}

packages/metro-minify-terser/src/__tests__/minify-test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const minify = require('..');
1717

1818
jest.mock('terser', () => ({
1919
minify: jest.fn(code => {
20-
return {
20+
return Promise.resolve({
2121
code: code.replace(/(^|\W)\s+/g, '$1'),
2222
map: {},
23-
};
23+
});
2424
}),
2525
}));
2626
const {objectContaining} = expect;
@@ -57,12 +57,12 @@ describe('Minification:', () => {
5757
/* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an
5858
* error found when Flow v0.99 was deployed. To see the error, delete this
5959
* comment and run Flow. */
60-
terser.minify.mockReturnValue({code: '', map: '{}'});
60+
terser.minify.mockResolvedValue({code: '', map: '{}'});
6161
map = getFakeMap();
6262
});
6363

64-
it('passes file name, code, and source map to `terser`', () => {
65-
minify({
64+
it('passes file name, code, and source map to `terser`', async () => {
65+
await minify({
6666
...baseOptions,
6767
code,
6868
map,
@@ -80,21 +80,21 @@ describe('Minification:', () => {
8080
);
8181
});
8282

83-
it('returns the code provided by terser', () => {
83+
it('returns the code provided by terser', async () => {
8484
/* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an
8585
* error found when Flow v0.99 was deployed. To see the error, delete this
8686
* comment and run Flow. */
87-
terser.minify.mockReturnValue({code, map: '{}'});
88-
const result = minify(baseOptions);
87+
terser.minify.mockResolvedValue({code, map: '{}'});
88+
const result = await minify(baseOptions);
8989
expect(result.code).toBe(code);
9090
});
9191

92-
it('parses the source map object provided by terser and sets the sources property', () => {
92+
it('parses the source map object provided by terser and sets the sources property', async () => {
9393
/* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an
9494
* error found when Flow v0.99 was deployed. To see the error, delete this
9595
* comment and run Flow. */
96-
terser.minify.mockReturnValue({map: JSON.stringify(map), code: ''});
97-
const result = minify({...baseOptions, filename});
96+
terser.minify.mockResolvedValue({map: JSON.stringify(map), code: ''});
97+
const result = await minify({...baseOptions, filename});
9898
expect(result.map).toEqual({...map, sources: [filename]});
9999
});
100100
});

0 commit comments

Comments
 (0)