@rnx-kit/cli 0.18.13 → 0.18.16

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.
@@ -1,6 +1,6 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
2
  import ora from "ora";
3
- import type { AndroidBuildParams } from "./types";
3
+ import type { AndroidBuildParams } from "./types.ts";
4
4
  export type BuildResult = string | number | null;
5
5
  export declare function buildAndroid(config: Config, buildParams: AndroidBuildParams, additionalArgs: string[], logger?: ora.Ora): Promise<BuildResult>;
6
6
  //# sourceMappingURL=android.d.ts.map
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildAndroid = buildAndroid;
7
7
  const cache_1 = require("@rnx-kit/tools-react-native/cache");
8
8
  const ora_1 = __importDefault(require("ora"));
9
- const watcher_1 = require("./watcher");
9
+ const watcher_ts_1 = require("./watcher.js");
10
10
  function buildAndroid(config, buildParams, additionalArgs, logger = (0, ora_1.default)()) {
11
11
  const { sourceDir } = config.project.android ?? {};
12
12
  if (!sourceDir) {
@@ -17,7 +17,7 @@ function buildAndroid(config, buildParams, additionalArgs, logger = (0, ora_1.de
17
17
  }
18
18
  return import("@rnx-kit/tools-android").then(({ assemble }) => {
19
19
  const gradle = assemble(sourceDir, buildParams, additionalArgs);
20
- return (0, watcher_1.watch)(gradle, logger, () => sourceDir);
20
+ return (0, watcher_ts_1.watch)(gradle, logger, () => sourceDir);
21
21
  });
22
22
  }
23
23
  //# sourceMappingURL=android.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Ora } from "ora";
2
- import type { AppleBuildParams } from "./types";
2
+ import type { AppleBuildParams } from "./types.ts";
3
3
  export type BuildArgs = {
4
4
  xcworkspace: string;
5
5
  args: string[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runBuild = runBuild;
4
- const watcher_1 = require("./watcher");
4
+ const watcher_ts_1 = require("./watcher.js");
5
5
  function runBuild(xcworkspace, buildParams, logger) {
6
6
  return import("@rnx-kit/tools-apple").then(({ checkPodsManifestLock, xcodebuild }) => {
7
7
  if (!checkPodsManifestLock(xcworkspace)) {
@@ -10,7 +10,7 @@ function runBuild(xcworkspace, buildParams, logger) {
10
10
  }
11
11
  const log = (message) => logger.info(message);
12
12
  const build = xcodebuild(xcworkspace, buildParams, log);
13
- return (0, watcher_1.watch)(build, logger, () => ({
13
+ return (0, watcher_ts_1.watch)(build, logger, () => ({
14
14
  xcworkspace,
15
15
  args: build.spawnargs,
16
16
  }));
@@ -1,6 +1,6 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
2
  import ora from "ora";
3
- import type { BuildResult } from "./apple";
4
- import type { AppleInputParams } from "./types";
3
+ import type { BuildResult } from "./apple.ts";
4
+ import type { AppleInputParams } from "./types.ts";
5
5
  export declare function buildIOS(config: Config, buildParams: AppleInputParams, logger?: ora.Ora): Promise<BuildResult>;
6
6
  //# sourceMappingURL=ios.d.ts.map
package/lib/build/ios.js CHANGED
@@ -40,9 +40,13 @@ exports.buildIOS = buildIOS;
40
40
  const cache_1 = require("@rnx-kit/tools-react-native/cache");
41
41
  const path = __importStar(require("node:path"));
42
42
  const ora_1 = __importDefault(require("ora"));
43
- const apple_1 = require("./apple");
43
+ const apple_ts_1 = require("./apple.js");
44
44
  function buildIOS(config, buildParams, logger = (0, ora_1.default)()) {
45
45
  const { platform } = buildParams;
46
+ if (process.platform !== "darwin") {
47
+ logger.fail(`${platform} builds can only be performed on macOS hosts`);
48
+ return Promise.resolve(1);
49
+ }
46
50
  const { sourceDir, xcodeProject } = config.project[platform] ?? {};
47
51
  if (!sourceDir || !xcodeProject) {
48
52
  (0, cache_1.invalidateState)();
@@ -61,6 +65,6 @@ function buildIOS(config, buildParams, logger = (0, ora_1.default)()) {
61
65
  const xcworkspace = projectDir
62
66
  ? path.resolve(sourceDir, projectDir, name)
63
67
  : path.resolve(sourceDir, name);
64
- return (0, apple_1.runBuild)(xcworkspace, buildParams, logger);
68
+ return (0, apple_ts_1.runBuild)(xcworkspace, buildParams, logger);
65
69
  }
66
70
  //# sourceMappingURL=ios.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
2
  import ora from "ora";
3
- import type { BuildResult } from "./apple";
4
- import type { AppleInputParams } from "./types";
3
+ import type { BuildResult } from "./apple.ts";
4
+ import type { AppleInputParams } from "./types.ts";
5
5
  export declare function buildMacOS(_config: Config, { workspace, ...buildParams }: AppleInputParams, logger?: ora.Ora): Promise<BuildResult>;
6
6
  //# sourceMappingURL=macos.d.ts.map
@@ -41,28 +41,33 @@ const cache_1 = require("@rnx-kit/tools-react-native/cache");
41
41
  const fs = __importStar(require("node:fs"));
42
42
  const path = __importStar(require("node:path"));
43
43
  const ora_1 = __importDefault(require("ora"));
44
- const apple_1 = require("./apple");
45
- function findXcodeWorkspaces(searchDir) {
46
- return fs.existsSync(searchDir)
44
+ const apple_ts_1 = require("./apple.js");
45
+ function findXcodeWorkspaces(searchDir, logger) {
46
+ const workspaces = fs.existsSync(searchDir)
47
47
  ? fs.readdirSync(searchDir).filter((file) => file.endsWith(".xcworkspace"))
48
48
  : [];
49
- }
50
- function buildMacOS(_config, { workspace, ...buildParams }, logger = (0, ora_1.default)()) {
51
- if (workspace) {
52
- return (0, apple_1.runBuild)(workspace, buildParams, logger);
53
- }
54
- const sourceDir = "macos";
55
- const workspaces = findXcodeWorkspaces(sourceDir);
56
49
  if (workspaces.length === 0) {
57
50
  (0, cache_1.invalidateState)();
58
51
  process.exitCode = 1;
59
52
  logger.fail("No Xcode workspaces were found; specify an Xcode workspace with `--workspace`");
60
- return Promise.resolve(1);
53
+ return undefined;
61
54
  }
62
55
  if (workspaces.length > 1) {
63
- logger.fail(`Multiple Xcode workspaces were found; picking the first one: ${workspaces.join(", ")}`);
64
- logger.fail("If this is wrong, specify another workspace with `--workspace`");
56
+ logger.info(`Multiple Xcode workspaces were found; picking the first one: ${workspaces.join(", ")}`);
57
+ logger.info("If this is wrong, specify another workspace with `--workspace`");
58
+ }
59
+ return path.join(searchDir, workspaces[0]);
60
+ }
61
+ function buildMacOS(_config, { workspace, ...buildParams }, logger = (0, ora_1.default)()) {
62
+ if (process.platform !== "darwin") {
63
+ logger.fail("macOS builds can only be performed on macOS hosts");
64
+ return Promise.resolve(1);
65
+ }
66
+ const sourceDir = "macos";
67
+ const xcworkspace = workspace || findXcodeWorkspaces(sourceDir, logger);
68
+ if (!xcworkspace) {
69
+ return Promise.resolve(1);
65
70
  }
66
- return (0, apple_1.runBuild)(path.join(sourceDir, workspaces[0]), buildParams, logger);
71
+ return (0, apple_ts_1.runBuild)(xcworkspace, buildParams, logger);
67
72
  }
68
73
  //# sourceMappingURL=macos.js.map
@@ -38,5 +38,15 @@ export type AppleInputParams = AppleBuildParams & {
38
38
  device?: string;
39
39
  workspace?: string;
40
40
  };
41
- export type InputParams = AndroidInputParams | AppleInputParams;
41
+ export type WindowsBuildParams = {
42
+ platform: "windows";
43
+ configuration?: BuildConfiguration;
44
+ architecture?: "arm64" | "x64";
45
+ launch?: boolean;
46
+ deploy?: boolean;
47
+ };
48
+ export type WindowsInputParams = WindowsBuildParams & {
49
+ solution?: string;
50
+ };
51
+ export type InputParams = AndroidInputParams | AppleInputParams | WindowsInputParams;
42
52
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Command, Config } from "@react-native-community/cli-types";
2
+ import ora from "ora";
3
+ import type { WindowsInputParams } from "./types.ts";
4
+ export type BuildArgs = {
5
+ solution: string;
6
+ args: string[];
7
+ };
8
+ export type BuildResult = BuildArgs | number | null;
9
+ export declare function runWindowsCommand(config: Config, params: WindowsInputParams, logger: ora.Ora, callback: (solution: string, run: Command["func"], options: Record<string, unknown>) => Promise<BuildResult>): Promise<BuildResult>;
10
+ export declare function buildWindows(config: Config, params: WindowsInputParams, additionalArgs: string[], logger?: ora.Ora): Promise<BuildResult>;
11
+ //# sourceMappingURL=windows.d.ts.map
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.runWindowsCommand = runWindowsCommand;
40
+ exports.buildWindows = buildWindows;
41
+ const cache_1 = require("@rnx-kit/tools-react-native/cache");
42
+ const fs = __importStar(require("node:fs"));
43
+ const os = __importStar(require("node:os"));
44
+ const path = __importStar(require("node:path"));
45
+ const ora_1 = __importDefault(require("ora"));
46
+ function findRunCommand(startDir) {
47
+ try {
48
+ const fromProjectRoot = { paths: [startDir] };
49
+ const rnwPath = require.resolve("react-native-windows/package.json", fromProjectRoot);
50
+ const fromRnwDir = { paths: [path.dirname(rnwPath)] };
51
+ const cliPath = require.resolve("@react-native-windows/cli", fromRnwDir);
52
+ const cli = require(cliPath);
53
+ return cli.commands.find((cmd) => cmd.name === "run-windows");
54
+ }
55
+ catch (_) {
56
+ // Handled by caller
57
+ }
58
+ return undefined;
59
+ }
60
+ function findSolution(searchDir, logger) {
61
+ const solutions = fs.existsSync(searchDir)
62
+ ? fs.readdirSync(searchDir).filter((file) => file.endsWith(".sln"))
63
+ : [];
64
+ if (solutions.length === 0) {
65
+ (0, cache_1.invalidateState)();
66
+ process.exitCode = 1;
67
+ logger.fail("No Visual Studio solutions were found; specify a Visual Studio solution with `--solution`");
68
+ return undefined;
69
+ }
70
+ if (solutions.length > 1) {
71
+ logger.info(`Multiple Visual Studio solutions were found; picking the first one: ${solutions.join(", ")}`);
72
+ logger.info("If this is wrong, specify another solution with `--solution`");
73
+ }
74
+ return path.join(searchDir, solutions[0]);
75
+ }
76
+ function toRunWindowsOptions(sln, { root }, { configuration, architecture, launch, deploy }) {
77
+ return {
78
+ release: configuration === "Release",
79
+ root,
80
+ arch: architecture ?? os.arch(),
81
+ packager: false,
82
+ bundle: false,
83
+ launch: Boolean(launch),
84
+ autolink: true,
85
+ build: true,
86
+ deploy: Boolean(deploy),
87
+ sln,
88
+ };
89
+ }
90
+ function runWindowsCommand(config, params, logger, callback) {
91
+ if (process.platform !== "win32") {
92
+ logger.fail("Windows builds can only be performed on Windows hosts");
93
+ return Promise.resolve(1);
94
+ }
95
+ const sourceDir = "windows";
96
+ const solution = params.solution || findSolution(sourceDir, logger);
97
+ if (!solution) {
98
+ return Promise.resolve(1);
99
+ }
100
+ const runCommand = findRunCommand(config.root);
101
+ if (!runCommand) {
102
+ logger.fail("Failed to find `@react-native-windows/cli`, make sure `react-native-windows` is installed.");
103
+ return Promise.resolve(1);
104
+ }
105
+ const options = toRunWindowsOptions(solution, config, params);
106
+ return callback(solution, runCommand.func, options);
107
+ }
108
+ function buildWindows(config, params, additionalArgs, logger = (0, ora_1.default)()) {
109
+ return runWindowsCommand(config, params, logger, (solution, run, options) => {
110
+ const build = run(additionalArgs, config, options);
111
+ return build
112
+ ? build.then(() => ({ solution, args: additionalArgs }))
113
+ : Promise.resolve(1);
114
+ });
115
+ }
116
+ //# sourceMappingURL=windows.js.map
package/lib/build.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import { RNX_FAST_PATH } from "./bin/constants";
3
- import { setCcacheDir } from "./build/ccache";
4
- import type { BuildConfiguration, DeviceType, InputParams } from "./build/types";
2
+ import { RNX_FAST_PATH } from "./bin/constants.ts";
3
+ import { setCcacheDir } from "./build/ccache.ts";
4
+ import type { BuildConfiguration, DeviceType, InputParams } from "./build/types.ts";
5
5
  declare function asConfiguration(configuration: string): BuildConfiguration;
6
6
  declare function asDestination(destination: string): DeviceType;
7
- export declare function rnxBuild(argv: string[], config: Config, buildParams: InputParams): Promise<import("./build/android").BuildResult> | Promise<import("./build/apple").BuildResult>;
7
+ export declare function rnxBuild(argv: string[], config: Config, buildParams: InputParams): Promise<import("./build/android.ts").BuildResult> | Promise<import("./build/apple.ts").BuildResult> | Promise<import("./build/windows.ts").BuildResult>;
8
8
  export declare const rnxBuildCommand: {
9
9
  [RNX_FAST_PATH]: boolean;
10
10
  name: string;
package/lib/build.js CHANGED
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rnxBuildCommand = void 0;
4
4
  exports.rnxBuild = rnxBuild;
5
5
  const commander_1 = require("commander");
6
- const constants_1 = require("./bin/constants");
7
- const android_1 = require("./build/android");
8
- const ccache_1 = require("./build/ccache");
9
- const ios_1 = require("./build/ios");
10
- const macos_1 = require("./build/macos");
6
+ const constants_ts_1 = require("./bin/constants.js");
7
+ const android_ts_1 = require("./build/android.js");
8
+ const ccache_ts_1 = require("./build/ccache.js");
9
+ const ios_ts_1 = require("./build/ios.js");
10
+ const macos_ts_1 = require("./build/macos.js");
11
+ const windows_ts_1 = require("./build/windows.js");
11
12
  function asConfiguration(configuration) {
12
13
  switch (configuration) {
13
14
  case "Debug":
@@ -33,26 +34,29 @@ function asSupportedPlatform(platform) {
33
34
  case "ios":
34
35
  case "macos":
35
36
  case "visionos":
37
+ case "windows":
36
38
  return platform;
37
39
  default:
38
- throw new commander_1.InvalidArgumentError("Supported platforms: 'android', 'ios', 'macos', 'visionos'.");
40
+ throw new commander_1.InvalidArgumentError("Supported platforms: 'android', 'ios', 'macos', 'visionos', 'windows'.");
39
41
  }
40
42
  }
41
43
  function rnxBuild(argv, config, buildParams) {
42
44
  switch (buildParams.platform) {
43
45
  case "android":
44
- return (0, android_1.buildAndroid)(config, buildParams, argv);
46
+ return (0, android_ts_1.buildAndroid)(config, buildParams, argv);
45
47
  case "ios":
46
48
  case "visionos":
47
- return (0, ios_1.buildIOS)(config, buildParams);
49
+ return (0, ios_ts_1.buildIOS)(config, buildParams);
48
50
  case "macos":
49
- return (0, macos_1.buildMacOS)(config, buildParams);
51
+ return (0, macos_ts_1.buildMacOS)(config, buildParams);
52
+ case "windows":
53
+ return (0, windows_ts_1.buildWindows)(config, buildParams, argv);
50
54
  }
51
55
  }
52
56
  exports.rnxBuildCommand = {
53
57
  // The build command requires the `project` field, which currently requires
54
58
  // loading the full config.
55
- [constants_1.RNX_FAST_PATH]: false,
59
+ [constants_ts_1.RNX_FAST_PATH]: false,
56
60
  name: "rnx-build",
57
61
  description: "Build your native app for testing in emulator/simulator or on device",
58
62
  func: rnxBuild,
@@ -62,6 +66,10 @@ exports.rnxBuildCommand = {
62
66
  description: "Target platform",
63
67
  parse: asSupportedPlatform,
64
68
  },
69
+ {
70
+ name: "--solution <string>",
71
+ description: "Path, relative to project root, of the Visual Studio solution to build (Windows only)",
72
+ },
65
73
  {
66
74
  name: "--workspace <string>",
67
75
  description: "Path, relative to project root, of the Xcode workspace to build (macOS only)",
@@ -85,12 +93,12 @@ exports.rnxBuildCommand = {
85
93
  {
86
94
  name: "--ccache-dir <string>",
87
95
  description: "Path to Ccache config",
88
- parse: ccache_1.setCcacheDir,
96
+ parse: ccache_ts_1.setCcacheDir,
89
97
  },
90
98
  {
91
99
  name: "--ccache-home <string>",
92
100
  description: "Path to Ccache installation",
93
- parse: ccache_1.setCcacheHome,
101
+ parse: ccache_ts_1.setCcacheHome,
94
102
  },
95
103
  ],
96
104
  };
@@ -117,9 +117,6 @@ function emitBytecode(cliConfig, input, sourcemap, options) {
117
117
  const options = { encoding: "utf-8" };
118
118
  const packagerSourcemap = JSON.parse(fs.readFileSync(sourcemap, options));
119
119
  const compilerSourcemap = JSON.parse(fs.readFileSync(outputMap, options));
120
- // `composeSourceMaps` was introduced in 0.56 — see
121
- // https://github.com/facebook/metro/commit/6017085bdad96ca5cec39d50038eb5622ce1097b
122
- // @ts-expect-error Property 'composeSourceMaps' does not exist
123
120
  const { composeSourceMaps } = (0, metro_1.requireModuleFromMetro)("metro-source-map");
124
121
  const composed = composeSourceMaps([packagerSourcemap, compilerSourcemap]);
125
122
  (0, tools_filesystem_1.writeJSONFile)(outputMap, composed, 0);
@@ -37,15 +37,12 @@ exports.requireExternal = requireExternal;
37
37
  const package_1 = require("@rnx-kit/tools-node/package");
38
38
  const context_1 = require("@rnx-kit/tools-react-native/context");
39
39
  const fs = __importStar(require("node:fs"));
40
- const path = __importStar(require("node:path"));
41
40
  function friendlyRequire(modules, startDir) {
42
41
  const target = modules.pop();
43
42
  if (!target) {
44
43
  throw new Error("At least one target module is required");
45
44
  }
46
- const resolvedStartDir = fs.lstatSync(startDir).isSymbolicLink()
47
- ? path.resolve(path.dirname(startDir), fs.readlinkSync(startDir))
48
- : startDir;
45
+ const resolvedStartDir = fs.realpathSync(startDir);
49
46
  try {
50
47
  const finalPackageDir = (0, package_1.resolveDependencyChain)(modules, resolvedStartDir);
51
48
  const targetModule = require.resolve(target, { paths: [finalPackageDir] });
@@ -140,7 +140,7 @@ function customizeMetroConfig(metroConfigReadonly, extraParams, print) {
140
140
  metroConfig.serializer.customSerializer = (0, metro_serializer_1.MetroSerializer)(metroPlugins);
141
141
  }
142
142
  else {
143
- // @ts-expect-error We don't want this set if unused
143
+ // We don't want this set if unused
144
144
  delete metroConfig.serializer.customSerializer;
145
145
  }
146
146
  const hooks = Object.values(serializerHooks);
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Command } from "@react-native-community/cli-types";
2
+ import { writeThirdPartyNoticesCommand } from "@rnx-kit/third-party-notices";
2
3
  import { rnxBuild, rnxBuildCommand } from "./build";
3
4
  import { rnxBundle, rnxBundleCommand } from "./bundle";
4
5
  import { rnxClean, rnxCleanCommand } from "./clean";
@@ -25,25 +26,6 @@ export declare const rnxAlignDepsCommand: {
25
26
  description: string;
26
27
  }[];
27
28
  };
28
- export declare const rnxWriteThirdPartyNotices: (_argv: string[], _config: import("@react-native-community/cli-types").Config, { additionalText, fullLicenseText, ignoreModules, ignoreScopes, json, outputFile, preambleText, rootPath, sourceMapFile, }: import("@rnx-kit/third-party-notices/lib/types").WriteThirdPartyNoticesOptions & {
29
- ignoreScopes?: string;
30
- ignoreModules?: string;
31
- preambleText?: string;
32
- additionalText?: string;
33
- }) => void;
34
- export declare const rnxWriteThirdPartyNoticesCommand: {
35
- name: string;
36
- description: string;
37
- func: (_argv: string[], _config: import("@react-native-community/cli-types").Config, { additionalText, fullLicenseText, ignoreModules, ignoreScopes, json, outputFile, preambleText, rootPath, sourceMapFile, }: import("@rnx-kit/third-party-notices/lib/types").WriteThirdPartyNoticesOptions & {
38
- ignoreScopes?: string;
39
- ignoreModules?: string;
40
- preambleText?: string;
41
- additionalText?: string;
42
- }) => void;
43
- readonly options: {
44
- name: string;
45
- description: "The root of the repo to start resolving modules from" | "The source map file to generate license contents for" | "Output license information as a JSON" | "The output file to write the license file to" | "npm scopes to ignore and not emit license information for" | "Modules (JS packages) to not emit license information for" | "A list of lines to prepend at the start of the generated license file" | "A list of lines to append at the end of the generated license file" | "Include full license text in the JSON output";
46
- default: string | false | undefined;
47
- }[];
48
- };
29
+ export declare const rnxWriteThirdPartyNotices: typeof writeThirdPartyNoticesCommand.func;
30
+ export declare const rnxWriteThirdPartyNoticesCommand: typeof writeThirdPartyNoticesCommand;
49
31
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import type { AndroidInputParams } from "../build/types";
2
+ import type { AndroidInputParams } from "../build/types.ts";
3
3
  export declare function runAndroid(config: Config, buildParams: AndroidInputParams, additionalArgs: string[]): Promise<void>;
4
4
  //# sourceMappingURL=android.d.ts.map
@@ -39,10 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.runAndroid = runAndroid;
40
40
  const path = __importStar(require("node:path"));
41
41
  const ora_1 = __importDefault(require("ora"));
42
- const android_1 = require("../build/android");
42
+ const android_ts_1 = require("../build/android.js");
43
43
  async function runAndroid(config, buildParams, additionalArgs) {
44
44
  const logger = (0, ora_1.default)();
45
- const projectDir = await (0, android_1.buildAndroid)(config, buildParams, additionalArgs, logger);
45
+ const projectDir = await (0, android_ts_1.buildAndroid)(config, buildParams, additionalArgs, logger);
46
46
  if (typeof projectDir !== "string") {
47
47
  return;
48
48
  }
package/lib/run/ios.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import type { InputParams } from "../build/types";
2
+ import type { InputParams } from "../build/types.ts";
3
3
  export declare function runIOS(config: Config, buildParams: InputParams): Promise<void>;
4
4
  //# sourceMappingURL=ios.d.ts.map
package/lib/run/ios.js CHANGED
@@ -39,14 +39,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.runIOS = runIOS;
40
40
  const path = __importStar(require("node:path"));
41
41
  const ora_1 = __importDefault(require("ora"));
42
- const ios_1 = require("../build/ios");
42
+ const ios_ts_1 = require("../build/ios.js");
43
43
  async function runIOS(config, buildParams) {
44
44
  const { platform } = buildParams;
45
45
  if (platform !== "ios" && platform !== "visionos") {
46
46
  throw new Error("Expected iOS/visionOS build configuration");
47
47
  }
48
48
  const logger = (0, ora_1.default)();
49
- const result = await (0, ios_1.buildIOS)(config, buildParams, logger);
49
+ const result = await (0, ios_ts_1.buildIOS)(config, buildParams, logger);
50
50
  if (!result || typeof result !== "object") {
51
51
  return;
52
52
  }
@@ -1,4 +1,4 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import type { AppleInputParams } from "../build/types";
2
+ import type { AppleInputParams } from "../build/types.ts";
3
3
  export declare function runMacOS(config: Config, buildParams: AppleInputParams): Promise<void>;
4
4
  //# sourceMappingURL=macos.d.ts.map
package/lib/run/macos.js CHANGED
@@ -39,10 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.runMacOS = runMacOS;
40
40
  const path = __importStar(require("node:path"));
41
41
  const ora_1 = __importDefault(require("ora"));
42
- const macos_1 = require("../build/macos");
42
+ const macos_ts_1 = require("../build/macos.js");
43
43
  async function runMacOS(config, buildParams) {
44
44
  const logger = (0, ora_1.default)();
45
- const result = await (0, macos_1.buildMacOS)(config, buildParams, logger);
45
+ const result = await (0, macos_ts_1.buildMacOS)(config, buildParams, logger);
46
46
  if (!result || typeof result !== "object") {
47
47
  return;
48
48
  }
@@ -0,0 +1,6 @@
1
+ import type { Config } from "@react-native-community/cli-types";
2
+ import ora from "ora";
3
+ import type { WindowsInputParams } from "../build/types.ts";
4
+ import type { BuildResult } from "../build/windows.ts";
5
+ export declare function runWindows(config: Config, params: WindowsInputParams, additionalArgs: string[], logger?: ora.Ora): Promise<BuildResult>;
6
+ //# sourceMappingURL=windows.d.ts.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runWindows = runWindows;
7
+ const ora_1 = __importDefault(require("ora"));
8
+ const windows_ts_1 = require("../build/windows.js");
9
+ function runWindows(config, params, additionalArgs, logger = (0, ora_1.default)()) {
10
+ const runParams = { ...params, launch: true, deploy: true };
11
+ return (0, windows_ts_1.buildWindows)(config, runParams, additionalArgs, logger);
12
+ }
13
+ //# sourceMappingURL=windows.js.map
package/lib/run.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import { RNX_FAST_PATH } from "./bin/constants";
3
- import type { InputParams } from "./build/types";
4
- export declare function rnxRun(argv: string[], config: Config, buildParams: InputParams): Promise<void>;
2
+ import { RNX_FAST_PATH } from "./bin/constants.ts";
3
+ import type { InputParams } from "./build/types.ts";
4
+ export declare function rnxRun(argv: string[], config: Config, buildParams: InputParams): Promise<import("./build/windows.ts").BuildResult> | Promise<void>;
5
5
  export declare const rnxRunCommand: {
6
6
  [RNX_FAST_PATH]: boolean;
7
7
  name: string;
@@ -16,16 +16,16 @@ export declare const rnxRunCommand: {
16
16
  name: string;
17
17
  description: string;
18
18
  default: string;
19
- parse: (configuration: string) => import("./build/types").BuildConfiguration;
19
+ parse: (configuration: string) => import("./build/types.ts").BuildConfiguration;
20
20
  } | {
21
21
  name: string;
22
22
  description: string;
23
23
  default: string;
24
- parse: (destination: string) => import("./build/types").DeviceType;
24
+ parse: (destination: string) => import("./build/types.ts").DeviceType;
25
25
  } | {
26
26
  name: string;
27
27
  description: string;
28
- parse: typeof import("./build/ccache").setCcacheDir;
28
+ parse: typeof import("./build/ccache.ts").setCcacheDir;
29
29
  default?: undefined;
30
30
  })[];
31
31
  };
package/lib/run.js CHANGED
@@ -2,31 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rnxRunCommand = void 0;
4
4
  exports.rnxRun = rnxRun;
5
- const constants_1 = require("./bin/constants");
6
- const build_1 = require("./build");
7
- const android_1 = require("./run/android");
8
- const ios_1 = require("./run/ios");
9
- const macos_1 = require("./run/macos");
5
+ const constants_ts_1 = require("./bin/constants.js");
6
+ const build_ts_1 = require("./build.js");
7
+ const android_ts_1 = require("./run/android.js");
8
+ const ios_ts_1 = require("./run/ios.js");
9
+ const macos_ts_1 = require("./run/macos.js");
10
+ const windows_ts_1 = require("./run/windows.js");
10
11
  function rnxRun(argv, config, buildParams) {
11
12
  switch (buildParams.platform) {
12
13
  case "android":
13
- return (0, android_1.runAndroid)(config, buildParams, argv);
14
+ return (0, android_ts_1.runAndroid)(config, buildParams, argv);
14
15
  case "ios":
15
16
  case "visionos":
16
- return (0, ios_1.runIOS)(config, buildParams);
17
+ return (0, ios_ts_1.runIOS)(config, buildParams);
17
18
  case "macos":
18
- return (0, macos_1.runMacOS)(config, buildParams);
19
+ return (0, macos_ts_1.runMacOS)(config, buildParams);
20
+ case "windows":
21
+ return (0, windows_ts_1.runWindows)(config, buildParams, argv);
19
22
  }
20
23
  }
21
24
  exports.rnxRunCommand = {
22
25
  // The run command may invoke the build command which currently requires
23
26
  // loading the full config.
24
- [constants_1.RNX_FAST_PATH]: false,
27
+ [constants_ts_1.RNX_FAST_PATH]: false,
25
28
  name: "rnx-run",
26
29
  description: "Build and run your native app for testing in emulator/simulator or on device",
27
30
  func: rnxRun,
28
31
  options: [
29
- ...build_1.rnxBuildCommand.options,
32
+ ...build_ts_1.rnxBuildCommand.options,
30
33
  {
31
34
  name: "-d, --device <string>",
32
35
  description: "The name of the device to launch the app in",
@@ -43,9 +43,7 @@ const path = __importStar(require("node:path"));
43
43
  const node_readline_1 = __importDefault(require("node:readline"));
44
44
  const qrcode_1 = __importDefault(require("qrcode"));
45
45
  function createOpenDebuggerKeyboardHandler({ devServerUrl, metroTerminal: { reporter }, reactNativePath, }) {
46
- const resolvedPath = fs.lstatSync(reactNativePath).isSymbolicLink()
47
- ? path.resolve(path.dirname(reactNativePath), fs.readlinkSync(reactNativePath))
48
- : reactNativePath;
46
+ const resolvedPath = fs.realpathSync(reactNativePath);
49
47
  try {
50
48
  // Available starting with 0.76
51
49
  const cliPlugin = require.resolve("@react-native/community-cli-plugin/package.json", { paths: [resolvedPath] });
@@ -71,7 +69,7 @@ function attachKeyHandlers(server, params) {
71
69
  openDebuggerKeyboardHandler.dismiss();
72
70
  process.stdin.pause();
73
71
  process.stdin.setRawMode(false);
74
- (0, console_1.info)("Exiting...");
72
+ (0, console_1.info)("Closing all connections...");
75
73
  const httpServer = server.httpServer ?? server;
76
74
  httpServer.close();
77
75
  httpServer.closeAllConnections?.(); // This method was added in Node v18.2.0
package/lib/start.js CHANGED
@@ -58,6 +58,11 @@ async function rnxStart(_argv, ctx, args) {
58
58
  logger.warn("Interactive mode is not supported in this environment");
59
59
  }
60
60
  }
61
+ // CVE-2025-11953: Ensure `host` is set to `localhost` by default, otherwise
62
+ // it will listen to external connections.
63
+ if (!args.host) {
64
+ args.host = "127.0.0.1";
65
+ }
61
66
  // load Metro configuration, applying overrides from the command line
62
67
  const metroConfig = await (0, metro_service_1.loadMetroConfig)(ctx, {
63
68
  ...args,
@@ -93,7 +98,7 @@ async function rnxStart(_argv, ctx, args) {
93
98
  }
94
99
  // create middleware -- a collection of plugins which handle incoming
95
100
  // http(s) requests, routing them to static pages or JS functions.
96
- const host = args.host?.length ? args.host : "localhost";
101
+ const host = args.host;
97
102
  const devServerUrl = `${scheme}://${host}:${port}`;
98
103
  const devServer = createDevServerMiddleware({ host, port, watchFolders });
99
104
  const coreDevMiddleware = (() => {
@@ -143,8 +148,15 @@ async function rnxStart(_argv, ctx, args) {
143
148
  update(event) {
144
149
  terminalReporter.update(event);
145
150
  reportEventDelegate?.(event);
146
- if (interactive && event.type === "dep_graph_loading") {
147
- help();
151
+ switch (event.type) {
152
+ case "dep_graph_loading":
153
+ if (interactive) {
154
+ help();
155
+ }
156
+ break;
157
+ case "server_listening":
158
+ logger.info(`Dev server is listening on ${scheme}://${event.address}:${event.port}`);
159
+ break;
148
160
  }
149
161
  },
150
162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/cli",
3
- "version": "0.18.13",
3
+ "version": "0.18.16",
4
4
  "description": "Command-line interface for working with kit packages in your repo",
5
5
  "homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/cli#readme",
6
6
  "license": "MIT",
@@ -40,14 +40,14 @@
40
40
  "test": "rnx-kit-scripts test"
41
41
  },
42
42
  "dependencies": {
43
- "@rnx-kit/align-deps": "^3.1.0",
43
+ "@rnx-kit/align-deps": "^3.3.3",
44
44
  "@rnx-kit/config": "^0.7.0",
45
45
  "@rnx-kit/console": "^2.0.0",
46
46
  "@rnx-kit/metro-plugin-cyclic-dependencies-detector": "^2.0.0",
47
47
  "@rnx-kit/metro-plugin-duplicates-checker": "^3.0.0",
48
48
  "@rnx-kit/metro-plugin-typescript": "^0.5.0",
49
49
  "@rnx-kit/metro-serializer": "^2.0.0",
50
- "@rnx-kit/metro-serializer-esbuild": "^0.2.1",
50
+ "@rnx-kit/metro-serializer-esbuild": "^0.2.7",
51
51
  "@rnx-kit/metro-service": "^4.0.2",
52
52
  "@rnx-kit/third-party-notices": "^2.0.0",
53
53
  "@rnx-kit/tools-android": "^0.2.1",
@@ -76,6 +76,7 @@
76
76
  "@babel/core": "^7.20.0",
77
77
  "@babel/preset-env": "^7.20.0",
78
78
  "@react-native-community/cli-types": "^20.0.0",
79
+ "@react-native-windows/cli": "^0.79.0",
79
80
  "@rnx-kit/eslint-config": "*",
80
81
  "@rnx-kit/jest-preset": "*",
81
82
  "@rnx-kit/scripts": "*",