@react-native/community-cli-plugin 0.73.0 → 0.73.2

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 (42) hide show
  1. package/README.md +7 -3
  2. package/dist/commands/bundle/assetCatalogIOS.js.flow +9 -57
  3. package/dist/commands/bundle/assetPathUtils.js.flow +12 -66
  4. package/dist/commands/bundle/buildBundle.js +16 -7
  5. package/dist/commands/bundle/buildBundle.js.flow +39 -95
  6. package/dist/commands/bundle/filterPlatformAssetScales.js.flow +5 -33
  7. package/dist/commands/bundle/getAssetDestPathAndroid.js.flow +7 -14
  8. package/dist/commands/bundle/getAssetDestPathIOS.js.flow +7 -16
  9. package/dist/commands/bundle/index.js +124 -0
  10. package/dist/commands/bundle/index.js.flow +18 -0
  11. package/dist/commands/bundle/saveAssets.js +1 -1
  12. package/dist/commands/bundle/saveAssets.js.flow +6 -124
  13. package/dist/commands/{bundle/ramBundle.js → ram-bundle/index.js} +17 -19
  14. package/dist/commands/ram-bundle/index.js.flow +15 -0
  15. package/dist/commands/start/attachKeyHandlers.js +109 -0
  16. package/dist/commands/start/attachKeyHandlers.js.flow +22 -0
  17. package/dist/commands/start/index.js +3 -8
  18. package/dist/commands/start/index.js.flow +6 -85
  19. package/dist/commands/start/runServer.js +82 -32
  20. package/dist/commands/start/runServer.js.flow +9 -127
  21. package/dist/index.flow.js +2 -2
  22. package/dist/index.flow.js.flow +5 -5
  23. package/dist/index.js.flow +1 -9
  24. package/dist/utils/KeyPressHandler.js +91 -0
  25. package/dist/utils/KeyPressHandler.js.flow +22 -0
  26. package/dist/utils/isDevServerRunning.js +74 -0
  27. package/dist/utils/isDevServerRunning.js.flow +27 -0
  28. package/dist/utils/loadMetroConfig.js +6 -7
  29. package/dist/utils/loadMetroConfig.js.flow +10 -102
  30. package/dist/utils/metroPlatformResolver.js.flow +4 -18
  31. package/package.json +11 -9
  32. package/dist/commands/bundle/bundle.js +0 -44
  33. package/dist/commands/bundle/bundle.js.flow +0 -37
  34. package/dist/commands/bundle/bundleCommandLineArgs.js +0 -116
  35. package/dist/commands/bundle/bundleCommandLineArgs.js.flow +0 -129
  36. package/dist/commands/bundle/ramBundle.js.flow +0 -43
  37. package/dist/commands/start/startServerInNewWindow.js +0 -132
  38. package/dist/commands/start/startServerInNewWindow.js.flow +0 -125
  39. package/dist/commands/start/watchMode.js +0 -95
  40. package/dist/commands/start/watchMode.js.flow +0 -101
  41. package/launchPackager.bat +0 -7
  42. package/launchPackager.command +0 -10
@@ -4,31 +4,13 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {Config} from '@react-native-community/cli-types';
13
- import type {Reporter} from 'metro/src/lib/reporting';
14
- import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
15
- import typeof TerminalReporter from 'metro/src/lib/TerminalReporter';
16
- import type Server from 'metro/src/Server';
17
- import type {Middleware} from 'metro-config';
18
-
19
- import Metro from 'metro';
20
- import {Terminal} from 'metro-core';
21
- import path from 'path';
22
- import {
23
- createDevServerMiddleware,
24
- indexPageMiddleware,
25
- } from '@react-native-community/cli-server-api';
26
-
27
- import loadMetroConfig from '../../utils/loadMetroConfig';
28
- import {version} from '@react-native-community/cli-tools';
29
- import enableWatchMode from './watchMode';
30
-
31
- export type Args = {
12
+ import type { Config } from "@react-native-community/cli-types";
13
+ export type StartCommandArgs = {
32
14
  assetPlugins?: string[],
33
15
  cert?: string,
34
16
  customLogReporterPath?: string,
@@ -47,110 +29,10 @@ export type Args = {
47
29
  interactive: boolean,
48
30
  };
49
31
 
50
- async function runServer(_argv: Array<string>, ctx: Config, args: Args) {
51
- let reportEvent: (event: any) => void;
52
- const terminal = new Terminal(process.stdout);
53
- const ReporterImpl = getReporterImpl(args.customLogReporterPath);
54
- const terminalReporter = new ReporterImpl(terminal);
55
- const reporter: Reporter = {
56
- update(event: TerminalReportableEvent) {
57
- terminalReporter.update(event);
58
- if (reportEvent) {
59
- reportEvent(event);
60
- }
61
- },
62
- };
63
-
64
- const metroConfig = await loadMetroConfig(ctx, {
65
- config: args.config,
66
- maxWorkers: args.maxWorkers,
67
- port: args.port,
68
- resetCache: args.resetCache,
69
- watchFolders: args.watchFolders,
70
- projectRoot: args.projectRoot,
71
- sourceExts: args.sourceExts,
72
- reporter,
73
- });
74
-
75
- if (args.assetPlugins) {
76
- // $FlowIgnore[cannot-write] Assigning to readonly property
77
- metroConfig.transformer.assetPlugins = args.assetPlugins.map(plugin =>
78
- require.resolve(plugin),
79
- );
80
- }
81
-
82
- const {
83
- middleware,
84
- websocketEndpoints,
85
- messageSocketEndpoint,
86
- eventsSocketEndpoint,
87
- } = createDevServerMiddleware({
88
- host: args.host,
89
- port: metroConfig.server.port,
90
- watchFolders: metroConfig.watchFolders,
91
- });
92
- middleware.use(indexPageMiddleware);
93
-
94
- const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;
95
- // $FlowIgnore[cannot-write] Assigning to readonly property
96
- metroConfig.server.enhanceMiddleware = (
97
- metroMiddleware: Middleware,
98
- server: Server,
99
- ) => {
100
- if (customEnhanceMiddleware) {
101
- metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);
102
- }
103
- return middleware.use(metroMiddleware);
104
- };
105
-
106
- const serverInstance = await Metro.runServer(metroConfig, {
107
- host: args.host,
108
- secure: args.https,
109
- secureCert: args.cert,
110
- secureKey: args.key,
111
- // $FlowFixMe[incompatible-call] Incompatibly defined WebSocketServer type
112
- websocketEndpoints,
113
- });
114
-
115
- reportEvent = eventsSocketEndpoint.reportEvent;
116
-
117
- if (args.interactive) {
118
- enableWatchMode(messageSocketEndpoint, ctx);
119
- }
120
-
121
- // In Node 8, the default keep-alive for an HTTP connection is 5 seconds. In
122
- // early versions of Node 8, this was implemented in a buggy way which caused
123
- // some HTTP responses (like those containing large JS bundles) to be
124
- // terminated early.
125
- //
126
- // As a workaround, arbitrarily increase the keep-alive from 5 to 30 seconds,
127
- // which should be enough to send even the largest of JS bundles.
128
- //
129
- // For more info: https://github.com/nodejs/node/issues/13391
130
- //
131
- serverInstance.keepAliveTimeout = 30000;
132
-
133
- await version.logIfUpdateAvailable(ctx.root);
134
- }
135
-
136
- function getReporterImpl(customLogReporterPath?: string): TerminalReporter {
137
- if (customLogReporterPath == null) {
138
- return require('metro/src/lib/TerminalReporter');
139
- }
140
- try {
141
- // First we let require resolve it, so we can require packages in node_modules
142
- // as expected. eg: require('my-package/reporter');
143
- // $FlowIgnore[unsupported-syntax]
144
- return require(customLogReporterPath);
145
- } catch (e) {
146
- if (e.code !== 'MODULE_NOT_FOUND') {
147
- throw e;
148
- }
149
- // If that doesn't work, then we next try relative to the cwd, eg:
150
- // require('./reporter');
151
- // $FlowIgnore[unsupported-syntax]
152
- return require(path.resolve(customLogReporterPath));
153
- }
154
- }
32
+ declare function runServer(
33
+ _argv: Array<string>,
34
+ ctx: Config,
35
+ args: StartCommandArgs
36
+ ): void;
155
37
 
156
- export default runServer;
38
+ declare export default runServer;
@@ -27,8 +27,8 @@ Object.defineProperty(exports, "unstable_buildBundleWithConfig", {
27
27
  return _buildBundle.unstable_buildBundleWithConfig;
28
28
  },
29
29
  });
30
- var _bundle = _interopRequireDefault(require("./commands/bundle/bundle"));
31
- var _ramBundle = _interopRequireDefault(require("./commands/bundle/ramBundle"));
30
+ var _bundle = _interopRequireDefault(require("./commands/bundle"));
31
+ var _ramBundle = _interopRequireDefault(require("./commands/ram-bundle"));
32
32
  var _start = _interopRequireDefault(require("./commands/start"));
33
33
  var _buildBundle = require("./commands/bundle/buildBundle");
34
34
  function _interopRequireDefault(obj) {
@@ -4,13 +4,13 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- export {default as bundleCommand} from './commands/bundle/bundle';
13
- export {default as ramBundleCommand} from './commands/bundle/ramBundle';
14
- export {default as startCommand} from './commands/start';
12
+ export { default as bundleCommand } from "./commands/bundle";
13
+ export { default as ramBundleCommand } from "./commands/ram-bundle";
14
+ export { default as startCommand } from "./commands/start";
15
15
 
16
- export {unstable_buildBundleWithConfig} from './commands/bundle/buildBundle';
16
+ export { unstable_buildBundleWithConfig } from "./commands/bundle/buildBundle";
@@ -9,12 +9,4 @@
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- /*::
13
- export type * from './index.flow';
14
- */
15
-
16
- if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) {
17
- require('../../../scripts/build/babel-register').registerForMonorepo();
18
- }
19
-
20
- module.exports = require('./index.flow');
12
+ declare module.exports: $FlowFixMe;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.KeyPressHandler = void 0;
7
+ var _cliTools = require("@react-native-community/cli-tools");
8
+ /**
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ *
15
+ * @format
16
+ * @oncall react_native
17
+ */
18
+
19
+ const CTRL_C = "\u0003";
20
+
21
+ /** An abstract key stroke interceptor. */
22
+ class KeyPressHandler {
23
+ _isInterceptingKeyStrokes = false;
24
+ _isHandlingKeyPress = false;
25
+ constructor(onPress) {
26
+ this._onPress = onPress;
27
+ }
28
+
29
+ /** Start observing interaction pause listeners. */
30
+ createInteractionListener() {
31
+ // Support observing prompts.
32
+ let wasIntercepting = false;
33
+ const listener = ({ pause }) => {
34
+ if (pause) {
35
+ // Track if we were already intercepting key strokes before pausing, so we can
36
+ // resume after pausing.
37
+ wasIntercepting = this._isInterceptingKeyStrokes;
38
+ this.stopInterceptingKeyStrokes();
39
+ } else if (wasIntercepting) {
40
+ // Only start if we were previously intercepting.
41
+ this.startInterceptingKeyStrokes();
42
+ }
43
+ };
44
+ return listener;
45
+ }
46
+ _handleKeypress = async (key) => {
47
+ // Prevent sending another event until the previous event has finished.
48
+ if (this._isHandlingKeyPress && key !== CTRL_C) {
49
+ return;
50
+ }
51
+ this._isHandlingKeyPress = true;
52
+ try {
53
+ _cliTools.logger.debug(`Key pressed: ${key}`);
54
+ await this._onPress(key);
55
+ } catch (error) {
56
+ return new _cliTools.CLIError(
57
+ "There was an error with the key press handler."
58
+ );
59
+ } finally {
60
+ this._isHandlingKeyPress = false;
61
+ }
62
+ };
63
+
64
+ /** Start intercepting all key strokes and passing them to the input `onPress` method. */
65
+ startInterceptingKeyStrokes() {
66
+ if (this._isInterceptingKeyStrokes) {
67
+ return;
68
+ }
69
+ this._isInterceptingKeyStrokes = true;
70
+ const { stdin } = process;
71
+ // $FlowFixMe[prop-missing]
72
+ stdin.setRawMode(true);
73
+ stdin.resume();
74
+ stdin.setEncoding("utf8");
75
+ stdin.on("data", this._handleKeypress);
76
+ }
77
+
78
+ /** Stop intercepting all key strokes. */
79
+ stopInterceptingKeyStrokes() {
80
+ if (!this._isInterceptingKeyStrokes) {
81
+ return;
82
+ }
83
+ this._isInterceptingKeyStrokes = false;
84
+ const { stdin } = process;
85
+ stdin.removeListener("data", this._handleKeypress);
86
+ // $FlowFixMe[prop-missing]
87
+ stdin.setRawMode(false);
88
+ stdin.resume();
89
+ }
90
+ }
91
+ exports.KeyPressHandler = KeyPressHandler;
@@ -0,0 +1,22 @@
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-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ /** An abstract key stroke interceptor. */
13
+ declare export class KeyPressHandler {
14
+ _isInterceptingKeyStrokes: $FlowFixMe;
15
+ _isHandlingKeyPress: $FlowFixMe;
16
+ _onPress: (key: string) => Promise<void>;
17
+ constructor(onPress: (key: string) => Promise<void>): void;
18
+ createInteractionListener(): ({ pause: boolean, ... }) => void;
19
+ _handleKeypress: $FlowFixMe;
20
+ startInterceptingKeyStrokes(): void;
21
+ stopInterceptingKeyStrokes(): void;
22
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = isDevServerRunning;
7
+ var _net = _interopRequireDefault(require("net"));
8
+ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
9
+ function _interopRequireDefault(obj) {
10
+ return obj && obj.__esModule ? obj : { default: obj };
11
+ }
12
+ /**
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ *
19
+ * @format
20
+ * @oncall react_native
21
+ */
22
+
23
+ /**
24
+ * Determine whether we can run the dev server.
25
+ *
26
+ * Return values:
27
+ * - `not_running`: The port is unoccupied.
28
+ * - `matched_server_running`: The port is occupied by another instance of this
29
+ * dev server (matching the passed `projectRoot`).
30
+ * - `port_taken`: The port is occupied by another process.
31
+ * - `unknown`: An error was encountered; attempt server creation anyway.
32
+ */
33
+ async function isDevServerRunning(scheme, host, port, projectRoot) {
34
+ try {
35
+ if (!(await isPortOccupied(host, port))) {
36
+ return "not_running";
37
+ }
38
+ const statusResponse = await (0, _nodeFetch.default)(
39
+ `${scheme}://${host}:${port}/status`
40
+ );
41
+ const body = await statusResponse.text();
42
+ return body === "packager-status:running" &&
43
+ statusResponse.headers.get("X-React-Native-Project-Root") === projectRoot
44
+ ? "matched_server_running"
45
+ : "port_taken";
46
+ } catch (e) {
47
+ return "unknown";
48
+ }
49
+ }
50
+ async function isPortOccupied(host, port) {
51
+ let result = false;
52
+ const server = _net.default.createServer();
53
+ return new Promise((resolve, reject) => {
54
+ server.once("error", (e) => {
55
+ server.close();
56
+ if (e.code === "EADDRINUSE") {
57
+ result = true;
58
+ } else {
59
+ reject(e);
60
+ }
61
+ });
62
+ server.once("listening", () => {
63
+ result = false;
64
+ server.close();
65
+ });
66
+ server.once("close", () => {
67
+ resolve(result);
68
+ });
69
+ server.listen({
70
+ host,
71
+ port,
72
+ });
73
+ });
74
+ }
@@ -0,0 +1,27 @@
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-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ /**
13
+ * Determine whether we can run the dev server.
14
+ *
15
+ * Return values:
16
+ * - `not_running`: The port is unoccupied.
17
+ * - `matched_server_running`: The port is occupied by another instance of this
18
+ * dev server (matching the passed `projectRoot`).
19
+ * - `port_taken`: The port is occupied by another process.
20
+ * - `unknown`: An error was encountered; attempt server creation anyway.
21
+ */
22
+ declare export default function isDevServerRunning(
23
+ scheme: string,
24
+ host: string,
25
+ port: number,
26
+ projectRoot: string
27
+ ): Promise<"not_running" | "matched_server_running" | "port_taken" | "unknown">;
@@ -65,6 +65,7 @@ function getOverrideConfig(ctx) {
65
65
  },
66
66
  };
67
67
  }
68
+
68
69
  /**
69
70
  * Load Metro config.
70
71
  *
@@ -73,15 +74,13 @@ function getOverrideConfig(ctx) {
73
74
  */
74
75
  async function loadMetroConfig(ctx, options = {}) {
75
76
  const overrideConfig = getOverrideConfig(ctx);
76
- if (options.reporter) {
77
- overrideConfig.reporter = options.reporter;
78
- }
77
+ const cwd = ctx.root;
79
78
  const projectConfig = await (0, _metroConfig.resolveConfig)(
80
- undefined,
81
- ctx.root
79
+ options.config,
80
+ cwd
82
81
  );
83
82
  if (projectConfig.isEmpty) {
84
- throw new _cliTools.CLIError(`No metro config found in ${ctx.root}`);
83
+ throw new _cliTools.CLIError(`No Metro config found in ${cwd}`);
85
84
  }
86
85
  _cliTools.logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
87
86
  if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
@@ -100,7 +99,7 @@ This warning will be removed in future (https://github.com/facebook/metro/issues
100
99
  }
101
100
  return (0, _metroConfig.mergeConfig)(
102
101
  await (0, _metroConfig.loadConfig)({
103
- cwd: ctx.root,
102
+ cwd,
104
103
  ...options,
105
104
  }),
106
105
  overrideConfig
@@ -4,122 +4,30 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {Config} from '@react-native-community/cli-types';
13
- import type {ConfigT, InputConfigT} from 'metro-config';
12
+ import type { Config } from "@react-native-community/cli-types";
13
+ import type { ConfigT, YargArguments } from "metro-config";
14
14
 
15
- import path from 'path';
16
- import {loadConfig, mergeConfig, resolveConfig} from 'metro-config';
17
- import {CLIError, logger} from '@react-native-community/cli-tools';
18
- import {reactNativePlatformResolver} from './metroPlatformResolver';
19
-
20
- export type {Config};
15
+ export type { Config };
21
16
 
22
17
  export type ConfigLoadingContext = $ReadOnly<{
23
- root: Config['root'],
24
- reactNativePath: Config['reactNativePath'],
25
- platforms: Config['platforms'],
18
+ root: Config["root"],
19
+ reactNativePath: Config["reactNativePath"],
20
+ platforms: Config["platforms"],
26
21
  ...
27
22
  }>;
28
23
 
29
- /**
30
- * Get the config options to override based on RN CLI inputs.
31
- */
32
- function getOverrideConfig(ctx: ConfigLoadingContext): InputConfigT {
33
- const outOfTreePlatforms = Object.keys(ctx.platforms).filter(
34
- platform => ctx.platforms[platform].npmPackageName,
35
- );
36
- const resolver: Partial<{...ConfigT['resolver']}> = {
37
- platforms: [...Object.keys(ctx.platforms), 'native'],
38
- };
39
-
40
- if (outOfTreePlatforms.length) {
41
- resolver.resolveRequest = reactNativePlatformResolver(
42
- outOfTreePlatforms.reduce<{[platform: string]: string}>(
43
- (result, platform) => {
44
- result[platform] = ctx.platforms[platform].npmPackageName;
45
- return result;
46
- },
47
- {},
48
- ),
49
- );
50
- }
51
-
52
- return {
53
- resolver,
54
- serializer: {
55
- // We can include multiple copies of InitializeCore here because metro will
56
- // only add ones that are already part of the bundle
57
- getModulesRunBeforeMainModule: () => [
58
- require.resolve(
59
- path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'),
60
- {paths: [ctx.root]},
61
- ),
62
- ...outOfTreePlatforms.map(platform =>
63
- require.resolve(
64
- `${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`,
65
- ),
66
- ),
67
- ],
68
- },
69
- };
70
- }
71
-
72
- export type ConfigOptionsT = $ReadOnly<{
73
- maxWorkers?: number,
74
- port?: number,
75
- projectRoot?: string,
76
- resetCache?: boolean,
77
- watchFolders?: string[],
78
- sourceExts?: string[],
79
- reporter?: any,
80
- config?: string,
81
- }>;
82
-
83
24
  /**
84
25
  * Load Metro config.
85
26
  *
86
27
  * Allows the CLI to override select values in `metro.config.js` based on
87
28
  * dynamic user options in `ctx`.
88
29
  */
89
- export default async function loadMetroConfig(
30
+ declare export default function loadMetroConfig(
90
31
  ctx: ConfigLoadingContext,
91
- options: ConfigOptionsT = {},
92
- ): Promise<ConfigT> {
93
- const overrideConfig = getOverrideConfig(ctx);
94
- if (options.reporter) {
95
- overrideConfig.reporter = options.reporter;
96
- }
97
-
98
- const projectConfig = await resolveConfig(undefined, ctx.root);
99
-
100
- if (projectConfig.isEmpty) {
101
- throw new CLIError(`No metro config found in ${ctx.root}`);
102
- }
103
-
104
- logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
105
-
106
- if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
107
- const warning = `
108
- =================================================================================================
109
- From React Native 0.73, your project's Metro config should extend '@react-native/metro-config'
110
- or it will fail to build. Please copy the template at:
111
- https://github.com/facebook/react-native/blob/main/packages/react-native/template/metro.config.js
112
- This warning will be removed in future (https://github.com/facebook/metro/issues/1018).
113
- =================================================================================================
114
- `;
115
-
116
- for (const line of warning.trim().split('\n')) {
117
- logger.warn(line);
118
- }
119
- }
120
-
121
- return mergeConfig(
122
- await loadConfig({cwd: ctx.root, ...options}),
123
- overrideConfig,
124
- );
125
- }
32
+ options: YargArguments
33
+ ): Promise<ConfigT>;
@@ -4,12 +4,12 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {CustomResolver} from 'metro-resolver';
12
+ import type { CustomResolver } from "metro-resolver";
13
13
 
14
14
  /**
15
15
  * This is an implementation of a metro resolveRequest option which will remap react-native imports
@@ -25,20 +25,6 @@ import type {CustomResolver} from 'metro-resolver';
25
25
  * macos: 'react-native-macos'
26
26
  * }
27
27
  */
28
- export function reactNativePlatformResolver(platformImplementations: {
28
+ declare export function reactNativePlatformResolver(platformImplementations: {
29
29
  [platform: string]: string,
30
- }): CustomResolver {
31
- return (context, moduleName, platform) => {
32
- let modifiedModuleName = moduleName;
33
- if (platform != null && platformImplementations[platform]) {
34
- if (moduleName === 'react-native') {
35
- modifiedModuleName = platformImplementations[platform];
36
- } else if (moduleName.startsWith('react-native/')) {
37
- modifiedModuleName = `${
38
- platformImplementations[platform]
39
- }/${modifiedModuleName.slice('react-native/'.length)}`;
40
- }
41
- }
42
- return context.resolveRequest(context, modifiedModuleName, platform);
43
- };
44
- }
30
+ }): CustomResolver;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/community-cli-plugin",
3
- "version": "0.73.0",
3
+ "version": "0.73.2",
4
4
  "description": "Core CLI commands for React Native",
5
5
  "keywords": ["react-native", "tools"],
6
6
  "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/buid-scripts#readme",
@@ -12,18 +12,20 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "exports": { ".": "./dist/index.js", "./package.json": "./package.json" },
15
- "files": ["dist", "launchPackager.bat", "launchPackager.command"],
15
+ "files": ["dist"],
16
16
  "dependencies": {
17
- "@react-native-community/cli-server-api": "12.0.0-alpha.7",
18
- "@react-native-community/cli-tools": "12.0.0-alpha.7",
19
- "@react-native/metro-babel-transformer": "^0.73.11",
17
+ "@react-native/dev-middleware": "^0.73.2",
18
+ "@react-native-community/cli-server-api": "12.0.0-alpha.15",
19
+ "@react-native-community/cli-tools": "12.0.0-alpha.15",
20
+ "@react-native/metro-babel-transformer": "^0.73.12",
20
21
  "chalk": "^4.0.0",
21
22
  "execa": "^5.1.1",
22
- "metro": "0.77.0",
23
- "metro-config": "0.77.0",
24
- "metro-core": "0.77.0",
25
- "metro-resolver": "0.77.0",
23
+ "metro": "0.79.1",
24
+ "metro-config": "0.79.1",
25
+ "metro-core": "0.79.1",
26
+ "node-fetch": "^2.2.0",
26
27
  "readline": "^1.3.0"
27
28
  },
29
+ "devDependencies": { "metro-resolver": "0.79.1" },
28
30
  "engines": { "node": ">=18" }
29
31
  }