-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port changes from main into Stable to make the CI green (#36665)
Co-authored-by: Riccardo Cipolleschi <cipolleschi@fb.com> Co-authored-by: Alex Hunt <alexeh@meta.com> resolved: #36502
- Loading branch information
1 parent
6e04b2a
commit 9ffe82e
Showing
12 changed files
with
199 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* 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 | ||
* @noformat | ||
*/ | ||
|
||
/*:: import type {ConfigT} from 'metro-config'; */ | ||
|
||
const {getDefaultConfig: getBaseConfig, mergeConfig} = require('metro-config'); | ||
|
||
const INTERNAL_CALLSITES_REGEX = new RegExp( | ||
[ | ||
'/Libraries/Renderer/implementations/.+\\.js$', | ||
'/Libraries/BatchedBridge/MessageQueue\\.js$', | ||
'/Libraries/YellowBox/.+\\.js$', | ||
'/Libraries/LogBox/.+\\.js$', | ||
'/Libraries/Core/Timers/.+\\.js$', | ||
'/Libraries/WebSocket/.+\\.js$', | ||
'/Libraries/vendor/.+\\.js$', | ||
'/node_modules/react-devtools-core/.+\\.js$', | ||
'/node_modules/react-refresh/.+\\.js$', | ||
'/node_modules/scheduler/.+\\.js$', | ||
'/node_modules/event-target-shim/.+\\.js$', | ||
'/node_modules/invariant/.+\\.js$', | ||
'/node_modules/react-native/index.js$', | ||
'/metro-runtime/.+\\.js$', | ||
'^\\[native code\\]$', | ||
].join('|'), | ||
); | ||
|
||
/** | ||
* Get the base Metro configuration for a React Native project. | ||
*/ | ||
function getDefaultConfig( | ||
projectRoot /*: string */ | ||
) /*: ConfigT */ { | ||
const config = { | ||
resolver: { | ||
resolverMainFields: ['react-native', 'browser', 'main'], | ||
platforms: ['android', 'ios'], | ||
unstable_conditionNames: ['import', 'require', 'react-native'], | ||
}, | ||
serializer: { | ||
getPolyfills: () => require('@react-native/js-polyfills')(), | ||
}, | ||
server: { | ||
port: Number(process.env.RCT_METRO_PORT) || 8081, | ||
}, | ||
symbolicator: { | ||
customizeFrame: (frame /*: $ReadOnly<{file: ?string, ...}>*/) => { | ||
const collapse = Boolean( | ||
frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file), | ||
); | ||
return {collapse}; | ||
}, | ||
}, | ||
transformer: { | ||
allowOptionalDependencies: true, | ||
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', | ||
asyncRequireModulePath: require.resolve( | ||
'metro-runtime/src/modules/asyncRequire', | ||
), | ||
babelTransformerPath: require.resolve( | ||
'metro-react-native-babel-transformer', | ||
), | ||
getTransformOptions: async () => ({ | ||
transform: { | ||
experimentalImportSupport: false, | ||
inlineRequires: true, | ||
}, | ||
}), | ||
}, | ||
watchFolders: [], | ||
}; | ||
|
||
return mergeConfig( | ||
getBaseConfig.getDefaultValues(projectRoot), | ||
config, | ||
); | ||
} | ||
|
||
module.exports = {getDefaultConfig}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@react-native/metro-config", | ||
"version": "0.72.0", | ||
"description": "Metro configuration for React Native.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:facebook/react-native.git", | ||
"directory": "packages/metro-config" | ||
}, | ||
"license": "MIT", | ||
"exports": "./index.js", | ||
"dependencies": { | ||
"@react-native/js-polyfills": "^0.72.1", | ||
"metro-config": "0.76.0", | ||
"metro-react-native-babel-transformer": "0.76.0", | ||
"metro-runtime": "0.76.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.