@react-native/metro-config 0.73.0 → 0.73.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -0
  2. package/index.js +21 -10
  3. package/package.json +17 -7
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @react-native/metro-config
2
+
3
+ [![Version][version-badge]][package]
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ yarn add --dev @react-native/js-polyfills metro-config @react-native/metro-babel-transformer metro-runtime @react-native/metro-config
9
+ ```
10
+
11
+ *Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like*
12
+
13
+ [version-badge]: https://img.shields.io/npm/v/@react-native/metro-config?style=flat-square
14
+ [package]: https://www.npmjs.com/package/@react-native/metro-config
15
+
16
+ ## Testing
17
+
18
+ To run the tests in this package, run the following commands from the React Native root folder:
19
+
20
+ 1. `yarn` to install the dependencies. You just need to run this once
21
+ 2. `yarn jest packages/metro-config`.
package/index.js CHANGED
@@ -14,20 +14,24 @@ const {getDefaultConfig: getBaseConfig, mergeConfig} = require('metro-config');
14
14
 
15
15
  const INTERNAL_CALLSITES_REGEX = new RegExp(
16
16
  [
17
- '/Libraries/Renderer/implementations/.+\\.js$',
18
17
  '/Libraries/BatchedBridge/MessageQueue\\.js$',
19
- '/Libraries/YellowBox/.+\\.js$',
18
+ '/Libraries/Core/.+\\.js$',
20
19
  '/Libraries/LogBox/.+\\.js$',
21
- '/Libraries/Core/Timers/.+\\.js$',
22
- '/Libraries/WebSocket/.+\\.js$',
20
+ '/Libraries/Network/.+\\.js$',
21
+ '/Libraries/Pressability/.+\\.js$',
22
+ '/Libraries/Renderer/implementations/.+\\.js$',
23
+ '/Libraries/Utilities/.+\\.js$',
23
24
  '/Libraries/vendor/.+\\.js$',
24
- '/node_modules/react-devtools-core/.+\\.js$',
25
- '/node_modules/react-refresh/.+\\.js$',
26
- '/node_modules/scheduler/.+\\.js$',
25
+ '/Libraries/WebSocket/.+\\.js$',
26
+ '/Libraries/YellowBox/.+\\.js$',
27
+ '/metro-runtime/.+\\.js$',
28
+ '/node_modules/@babel/runtime/.+\\.js$',
27
29
  '/node_modules/event-target-shim/.+\\.js$',
28
30
  '/node_modules/invariant/.+\\.js$',
31
+ '/node_modules/react-devtools-core/.+\\.js$',
29
32
  '/node_modules/react-native/index.js$',
30
- '/metro-runtime/.+\\.js$',
33
+ '/node_modules/react-refresh/.+\\.js$',
34
+ '/node_modules/scheduler/.+\\.js$',
31
35
  '^\\[native code\\]$',
32
36
  ].join('|'),
33
37
  );
@@ -42,9 +46,13 @@ function getDefaultConfig(
42
46
  resolver: {
43
47
  resolverMainFields: ['react-native', 'browser', 'main'],
44
48
  platforms: ['android', 'ios'],
45
- unstable_conditionNames: ['require', 'react-native'],
49
+ unstable_conditionNames: ['require', 'import', 'react-native'],
46
50
  },
47
51
  serializer: {
52
+ // Note: This option is overridden in cli-plugin-metro (getOverrideConfig)
53
+ getModulesRunBeforeMainModule: () => [
54
+ require.resolve('react-native/Libraries/Core/InitializeCore'),
55
+ ],
48
56
  getPolyfills: () => require('@react-native/js-polyfills')(),
49
57
  },
50
58
  server: {
@@ -65,7 +73,7 @@ function getDefaultConfig(
65
73
  'metro-runtime/src/modules/asyncRequire',
66
74
  ),
67
75
  babelTransformerPath: require.resolve(
68
- 'metro-react-native-babel-transformer',
76
+ '@react-native/metro-babel-transformer',
69
77
  ),
70
78
  getTransformOptions: async () => ({
71
79
  transform: {
@@ -77,6 +85,9 @@ function getDefaultConfig(
77
85
  watchFolders: [],
78
86
  };
79
87
 
88
+ // Set global hook so that the CLI can detect when this config has been loaded
89
+ global.__REACT_NATIVE_METRO_CONFIG_LOADED = true;
90
+
80
91
  return mergeConfig(
81
92
  getBaseConfig.getDefaultValues(projectRoot),
82
93
  config,
package/package.json CHANGED
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "name": "@react-native/metro-config",
3
- "version": "0.73.0",
3
+ "version": "0.73.1",
4
4
  "description": "Metro configuration for React Native.",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
- "url": "git@github.com:facebook/react-native.git",
8
+ "url": "https://github.com/facebook/react-native.git",
8
9
  "directory": "packages/metro-config"
9
10
  },
10
- "license": "MIT",
11
+ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/metro-config#readme",
12
+ "keywords": [
13
+ "metro",
14
+ "config",
15
+ "react-native"
16
+ ],
17
+ "bugs": "https://github.com/facebook/react-native/issues",
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
11
21
  "exports": "./index.js",
12
22
  "dependencies": {
13
- "@react-native/js-polyfills": "^0.73.0",
14
- "metro-config": "0.76.0",
15
- "metro-react-native-babel-transformer": "0.76.0",
16
- "metro-runtime": "0.76.0"
23
+ "@react-native/metro-babel-transformer": "^0.73.12",
24
+ "@react-native/js-polyfills": "^0.73.1",
25
+ "metro-config": "0.79.1",
26
+ "metro-runtime": "0.79.1"
17
27
  }
18
28
  }