@react-native/community-cli-plugin 0.88.0-nightly-20260722-eb4d3892a → 0.88.0-nightly-20260724-a8f68dac7

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.
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true,
5
5
  });
6
6
  exports.default = void 0;
7
+ exports.unstable_createBundleCommandParser = unstable_createBundleCommandParser;
7
8
  var _buildBundle = _interopRequireDefault(require("./buildBundle"));
9
+ var _commander = require("commander");
8
10
  var _nodePath = _interopRequireDefault(require("node:path"));
9
11
  function _interopRequireDefault(e) {
10
12
  return e && e.__esModule ? e : { default: e };
@@ -115,4 +117,36 @@ const bundleCommand = {
115
117
  },
116
118
  ],
117
119
  };
120
+ function addOptions(command, options) {
121
+ for (const option of options) {
122
+ const description = option.description ?? "";
123
+ const defaultValue =
124
+ typeof option.default === "function" ? undefined : option.default;
125
+ if (option.parse != null) {
126
+ command.option(option.name, description, option.parse, defaultValue);
127
+ } else if (
128
+ typeof defaultValue === "string" ||
129
+ typeof defaultValue === "boolean" ||
130
+ Array.isArray(defaultValue)
131
+ ) {
132
+ command.option(option.name, description, defaultValue);
133
+ } else {
134
+ command.option(option.name, description);
135
+ }
136
+ }
137
+ }
138
+ function unstable_createBundleCommandParser(additionalOptions = []) {
139
+ const parser = new _commander.Command()
140
+ .name(bundleCommand.name)
141
+ .description(bundleCommand.description ?? "")
142
+ .helpOption("--help", "Display help for command")
143
+ .allowUnknownOption();
144
+ addOptions(parser, bundleCommand.options ?? []);
145
+ const baseHelpInformation = parser.helpInformation();
146
+ addOptions(parser, additionalOptions);
147
+ return {
148
+ parser,
149
+ baseHelpInformation,
150
+ };
151
+ }
118
152
  var _default = (exports.default = bundleCommand);
@@ -8,10 +8,22 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type { Command } from "@react-native-community/cli-types";
11
+ import type { Command as CommunityCommand } from "@react-native-community/cli-types";
12
12
 
13
+ import { Command } from "commander";
13
14
  export type { BundleCommandArgs } from "./buildBundle";
14
15
 
15
- declare const bundleCommand: Command;
16
+ type CommandOption = Readonly<NonNullable<CommunityCommand["options"]>[number]>;
17
+
18
+ type BundleCommandParser = {
19
+ parser: Command,
20
+ baseHelpInformation: string,
21
+ };
22
+
23
+ declare const bundleCommand: CommunityCommand;
24
+
25
+ declare export function unstable_createBundleCommandParser(
26
+ additionalOptions?: ReadonlyArray<CommandOption>,
27
+ ): BundleCommandParser;
16
28
 
17
29
  declare export default typeof bundleCommand;
package/dist/index.js CHANGED
@@ -21,9 +21,42 @@ Object.defineProperty(exports, "unstable_buildBundleWithConfig", {
21
21
  return _buildBundle.unstable_buildBundleWithConfig;
22
22
  },
23
23
  });
24
- var _bundle = _interopRequireDefault(require("./commands/bundle"));
24
+ Object.defineProperty(exports, "unstable_createBundleCommandParser", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _bundle.unstable_createBundleCommandParser;
28
+ },
29
+ });
30
+ var _bundle = _interopRequireWildcard(require("./commands/bundle"));
25
31
  var _start = _interopRequireDefault(require("./commands/start"));
26
32
  var _buildBundle = require("./commands/bundle/buildBundle");
27
33
  function _interopRequireDefault(e) {
28
34
  return e && e.__esModule ? e : { default: e };
29
35
  }
36
+ function _interopRequireWildcard(e, t) {
37
+ if ("function" == typeof WeakMap)
38
+ var r = new WeakMap(),
39
+ n = new WeakMap();
40
+ return (_interopRequireWildcard = function (e, t) {
41
+ if (!t && e && e.__esModule) return e;
42
+ var o,
43
+ i,
44
+ f = { __proto__: null, default: e };
45
+ if (null === e || ("object" != typeof e && "function" != typeof e))
46
+ return f;
47
+ if ((o = t ? n : r)) {
48
+ if (o.has(e)) return o.get(e);
49
+ o.set(e, f);
50
+ }
51
+ for (const t in e)
52
+ "default" !== t &&
53
+ {}.hasOwnProperty.call(e, t) &&
54
+ ((i =
55
+ (o = Object.defineProperty) &&
56
+ Object.getOwnPropertyDescriptor(e, t)) &&
57
+ (i.get || i.set)
58
+ ? o(f, t, i)
59
+ : (f[t] = e[t]));
60
+ return f;
61
+ })(e, t);
62
+ }
@@ -8,7 +8,10 @@
8
8
  * @format
9
9
  */
10
10
 
11
- export { default as bundleCommand } from "./commands/bundle";
11
+ export {
12
+ default as bundleCommand,
13
+ unstable_createBundleCommandParser,
14
+ } from "./commands/bundle";
12
15
  export { default as startCommand } from "./commands/start";
13
16
 
14
17
  export { unstable_buildBundleWithConfig } from "./commands/bundle/buildBundle";
@@ -54,7 +54,6 @@ async function loadMetroConfig(ctx, options = {}) {
54
54
  );
55
55
  }
56
56
  const defaultConfig = RNMetroConfig.getDefaultConfig(ctx.root);
57
- global.__REACT_NATIVE_METRO_CONFIG_LOADED = false;
58
57
  if (typeof RNMetroConfig.setFrameworkDefaults !== "function") {
59
58
  throw new Error(
60
59
  "`@react-native/metro-config` does not have the expected API. Ensure it matches your React Native version.",
@@ -69,20 +68,6 @@ async function loadMetroConfig(ctx, options = {}) {
69
68
  throw new _errors.CLIError(`No Metro config found in ${cwd}`);
70
69
  }
71
70
  debug(`Reading Metro config from ${projectConfig.filepath}`);
72
- if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
73
- for (const line of `
74
- =================================================================================================
75
- From React Native 0.73, your project's Metro config should extend '@react-native/metro-config'
76
- or it will fail to build. Please copy the template at:
77
- https://github.com/react-native-community/template/blob/main/template/metro.config.js
78
- This warning will be removed in future (https://github.com/facebook/metro/issues/1018).
79
- =================================================================================================
80
- `
81
- .trim()
82
- .split("\n")) {
83
- console.warn(line);
84
- }
85
- }
86
71
  return (0, _metro.loadConfig)({
87
72
  cwd,
88
73
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/community-cli-plugin",
3
- "version": "0.88.0-nightly-20260722-eb4d3892a",
3
+ "version": "0.88.0-nightly-20260724-a8f68dac7",
4
4
  "description": "Core CLI commands for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -25,8 +25,9 @@
25
25
  "prepack": "node ../../scripts/build/prepack.js"
26
26
  },
27
27
  "dependencies": {
28
- "@react-native/asset-utils": "0.88.0-nightly-20260722-eb4d3892a",
29
- "@react-native/dev-middleware": "0.88.0-nightly-20260722-eb4d3892a",
28
+ "@react-native/asset-utils": "0.88.0-nightly-20260724-a8f68dac7",
29
+ "@react-native/dev-middleware": "0.88.0-nightly-20260724-a8f68dac7",
30
+ "commander": "^12.0.0",
30
31
  "debug": "^4.4.0",
31
32
  "invariant": "^2.2.4",
32
33
  "metro": "^0.87.0",
@@ -37,7 +38,7 @@
37
38
  },
38
39
  "peerDependencies": {
39
40
  "@react-native-community/cli": "*",
40
- "@react-native/metro-config": "0.88.0-nightly-20260722-eb4d3892a"
41
+ "@react-native/metro-config": "0.88.0-nightly-20260724-a8f68dac7"
41
42
  },
42
43
  "peerDependenciesMeta": {
43
44
  "@react-native-community/cli": {