@rnx-kit/cli 0.16.29 → 0.17.0

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 (64) hide show
  1. package/README.md +172 -98
  2. package/bin/rnx-cli.cjs +2 -0
  3. package/lib/align-deps.js +5 -5
  4. package/lib/bin/context.d.ts +25 -0
  5. package/lib/bin/context.js +98 -0
  6. package/lib/bin/externalCommands.d.ts +3 -0
  7. package/lib/bin/externalCommands.js +34 -0
  8. package/lib/bin/rnx-cli.d.ts +2 -0
  9. package/lib/bin/rnx-cli.js +55 -0
  10. package/lib/bundle/cliOptions.d.ts +2 -2
  11. package/lib/bundle/cliOptions.js +27 -27
  12. package/lib/bundle/hermes.d.ts +2 -1
  13. package/lib/bundle/hermes.js +9 -15
  14. package/lib/bundle/metro.js +6 -9
  15. package/lib/bundle.d.ts +3 -3
  16. package/lib/bundle.js +4 -4
  17. package/lib/clean.d.ts +3 -3
  18. package/lib/clean.js +47 -67
  19. package/lib/copy-assets.d.ts +5 -3
  20. package/lib/copy-assets.js +31 -28
  21. package/lib/helpers/externals.d.ts +4 -0
  22. package/lib/{serve/external.js → helpers/externals.js} +10 -8
  23. package/lib/helpers/filesystem.d.ts +3 -0
  24. package/lib/helpers/filesystem.js +31 -0
  25. package/lib/{metro-config.js → helpers/metro-config.js} +1 -1
  26. package/lib/{parsers.d.ts → helpers/parsers.d.ts} +1 -1
  27. package/lib/{parsers.js → helpers/parsers.js} +17 -15
  28. package/lib/index.d.ts +2 -188
  29. package/lib/index.js +1 -5
  30. package/lib/ram-bundle.d.ts +4 -4
  31. package/lib/ram-bundle.js +2 -2
  32. package/lib/serve/keyboard.js +3 -6
  33. package/lib/serve/types.d.ts +2 -2
  34. package/lib/start.d.ts +1 -1
  35. package/lib/start.js +34 -34
  36. package/lib/test.d.ts +2 -1
  37. package/lib/test.js +7 -5
  38. package/lib/write-third-party-notices.js +13 -13
  39. package/package.json +24 -23
  40. package/lib/serve/external.d.ts +0 -7
  41. package/src/align-deps.ts +0 -82
  42. package/src/bundle/cliOptions.ts +0 -82
  43. package/src/bundle/defaultPlugins.ts +0 -16
  44. package/src/bundle/hermes.ts +0 -114
  45. package/src/bundle/kit-config.ts +0 -81
  46. package/src/bundle/metro.ts +0 -66
  47. package/src/bundle/overrides.ts +0 -51
  48. package/src/bundle/types.ts +0 -41
  49. package/src/bundle.ts +0 -69
  50. package/src/clean.ts +0 -223
  51. package/src/copy-assets.ts +0 -545
  52. package/src/index.ts +0 -34
  53. package/src/metro-config.ts +0 -208
  54. package/src/parsers.ts +0 -44
  55. package/src/ram-bundle.ts +0 -78
  56. package/src/serve/external.ts +0 -62
  57. package/src/serve/help.ts +0 -59
  58. package/src/serve/keyboard.ts +0 -76
  59. package/src/serve/kit-config.ts +0 -47
  60. package/src/serve/types.ts +0 -87
  61. package/src/start.ts +0 -316
  62. package/src/test.ts +0 -137
  63. package/src/write-third-party-notices.ts +0 -85
  64. /package/lib/{metro-config.d.ts → helpers/metro-config.d.ts} +0 -0
@@ -35,9 +35,11 @@ const package_1 = require("@rnx-kit/tools-node/package");
35
35
  const path_1 = require("@rnx-kit/tools-node/path");
36
36
  const tools_react_native_1 = require("@rnx-kit/tools-react-native");
37
37
  const child_process_1 = require("child_process");
38
- const fs = __importStar(require("fs-extra"));
38
+ const fs = __importStar(require("fs"));
39
+ const nodefs = __importStar(require("fs"));
39
40
  const os = __importStar(require("os"));
40
41
  const path = __importStar(require("path"));
42
+ const filesystem_1 = require("./helpers/filesystem");
41
43
  const defaultAndroidConfig = {
42
44
  androidPluginVersion: "7.2.2",
43
45
  compileSdkVersion: 33,
@@ -47,6 +49,12 @@ const defaultAndroidConfig = {
47
49
  },
48
50
  kotlinVersion: "1.7.22",
49
51
  };
52
+ function cloneFile(src, dest) {
53
+ return fs.promises.copyFile(src, dest, fs.constants.COPYFILE_FICLONE);
54
+ }
55
+ function cp_r(source, destination, fs = nodefs) {
56
+ return fs.promises.cp(source, destination, { recursive: true });
57
+ }
50
58
  function ensureOption(options, opt, flag = opt) {
51
59
  if (options[opt] == null) {
52
60
  (0, console_1.error)(`Missing required option: --${flag}`);
@@ -145,7 +153,7 @@ async function assembleAarBundle(context, packageName, { aar }) {
145
153
  ...customEnv,
146
154
  };
147
155
  const outputDir = path.join(context.options.assetsDest, "aar");
148
- fs.ensureDirSync(outputDir);
156
+ (0, filesystem_1.ensureDir)(outputDir);
149
157
  const dest = path.join(outputDir, `${targetName}-${version}.aar`);
150
158
  const targets = [`:${targetName}:assembleRelease`];
151
159
  const targetsToCopy = [[output, dest]];
@@ -169,17 +177,13 @@ async function assembleAarBundle(context, packageName, { aar }) {
169
177
  run(gradlew, targets, { cwd: androidProject, stdio: "inherit", env });
170
178
  }
171
179
  else {
172
- const reactNativePath = (0, package_1.findPackageDependencyDir)("react-native");
173
- if (!reactNativePath) {
174
- throw new Error("Could not find 'react-native'");
175
- }
176
180
  const buildDir = path.join(process.cwd(), "node_modules", ".rnx-gradle-build", targetName);
177
181
  const compileSdkVersion = (_a = android === null || android === void 0 ? void 0 : android.compileSdkVersion) !== null && _a !== void 0 ? _a : defaultAndroidConfig.compileSdkVersion;
178
182
  const minSdkVersion = (_c = (_b = android === null || android === void 0 ? void 0 : android.defaultConfig) === null || _b === void 0 ? void 0 : _b.minSdkVersion) !== null && _c !== void 0 ? _c : defaultAndroidConfig.defaultConfig.minSdkVersion;
179
183
  const targetSdkVersion = (_e = (_d = android === null || android === void 0 ? void 0 : android.defaultConfig) === null || _d === void 0 ? void 0 : _d.targetSdkVersion) !== null && _e !== void 0 ? _e : defaultAndroidConfig.defaultConfig.targetSdkVersion;
180
184
  const androidPluginVersion = (_f = android === null || android === void 0 ? void 0 : android.androidPluginVersion) !== null && _f !== void 0 ? _f : defaultAndroidConfig.androidPluginVersion;
181
185
  const kotlinVersion = (_g = android === null || android === void 0 ? void 0 : android.kotlinVersion) !== null && _g !== void 0 ? _g : defaultAndroidConfig.kotlinVersion;
182
- const buildRelativeReactNativePath = path.relative(buildDir, reactNativePath);
186
+ const buildRelativeReactNativePath = path.relative(buildDir, context.reactNativePath);
183
187
  const buildGradle = [
184
188
  "buildscript {",
185
189
  " ext {",
@@ -219,31 +223,31 @@ async function assembleAarBundle(context, packageName, { aar }) {
219
223
  `project(":${targetName}").projectDir = file(${JSON.stringify(androidProject)})`,
220
224
  "",
221
225
  ].join("\n");
222
- fs.ensureDirSync(buildDir);
226
+ (0, filesystem_1.ensureDir)(buildDir);
223
227
  fs.writeFileSync(path.join(buildDir, "build.gradle"), buildGradle);
224
228
  fs.writeFileSync(path.join(buildDir, "gradle.properties"), gradleProperties);
225
229
  fs.writeFileSync(path.join(buildDir, "settings.gradle"), settingsGradle);
226
230
  // Run only one Gradle task at a time
227
231
  run(gradlew, targets, { cwd: buildDir, stdio: "inherit", env });
228
232
  }
229
- await Promise.all(targetsToCopy.map(([src, dest]) => fs.copy(src, dest)));
233
+ await Promise.all(targetsToCopy.map(([src, dest]) => cloneFile(src, dest)));
230
234
  }
231
- function copyFiles(files, destination) {
235
+ function copyFiles(files, destination, fs = nodefs) {
232
236
  if (!Array.isArray(files) || files.length === 0) {
233
237
  return [];
234
238
  }
235
- fs.ensureDirSync(destination);
239
+ (0, filesystem_1.ensureDir)(destination, fs);
236
240
  return files.map((file) => {
237
- return fs.copy(file, `${destination}/${path.basename(file)}`);
241
+ return cp_r(file, `${destination}/${path.basename(file)}`, fs);
238
242
  });
239
243
  }
240
- async function copyAssets({ options: { assetsDest, xcassetsDest } }, packageName, { assets, strings, xcassets }) {
244
+ async function copyAssets({ options: { assetsDest, xcassetsDest } }, packageName, { assets, strings, xcassets }, fs = nodefs) {
241
245
  const tasks = [
242
- ...copyFiles(assets, `${assetsDest}/assets/${packageName}`),
243
- ...copyFiles(strings, `${assetsDest}/strings/${packageName}`),
246
+ ...copyFiles(assets, `${assetsDest}/assets/${packageName}`, fs),
247
+ ...copyFiles(strings, `${assetsDest}/strings/${packageName}`, fs),
244
248
  ];
245
249
  if (typeof xcassetsDest === "string") {
246
- tasks.push(...copyFiles(xcassets, xcassetsDest));
250
+ tasks.push(...copyFiles(xcassets, xcassetsDest, fs));
247
251
  }
248
252
  await Promise.all(tasks);
249
253
  }
@@ -336,10 +340,9 @@ async function gatherConfigs({ projectRoot, manifest, }) {
336
340
  *
337
341
  * @param options Options dictate what gets copied where
338
342
  */
339
- async function copyProjectAssets(options) {
340
- const projectRoot = (0, package_1.findPackageDir)() || process.cwd();
343
+ async function copyProjectAssets(options, { root: projectRoot, reactNativePath }) {
341
344
  const manifest = (0, package_1.readPackage)(projectRoot);
342
- const context = { projectRoot, manifest, options };
345
+ const context = { projectRoot, manifest, options, reactNativePath };
343
346
  const assetConfigs = await gatherConfigs(context);
344
347
  if (!assetConfigs) {
345
348
  return;
@@ -372,7 +375,7 @@ async function copyProjectAssets(options) {
372
375
  if (output &&
373
376
  (!fs.existsSync(destination) || fs.statSync(destination).isDirectory())) {
374
377
  (0, console_1.info)(`Copying Android Archive of "${dependencyName}"`);
375
- copyTasks.push(fs.copy(output, destination));
378
+ copyTasks.push(cloneFile(output, destination));
376
379
  }
377
380
  }
378
381
  await Promise.all(copyTasks);
@@ -380,30 +383,30 @@ async function copyProjectAssets(options) {
380
383
  }
381
384
  exports.rnxCopyAssetsCommand = {
382
385
  name: "rnx-copy-assets",
383
- description: "Copies additional assets not picked by bundlers into desired directory.",
384
- func: (_argv, _config, options) => {
386
+ description: "Copies additional assets not picked by bundlers into desired directory",
387
+ func: (_argv, config, options) => {
385
388
  ensureOption(options, "platform");
386
389
  ensureOption(options, "assetsDest", "assets-dest");
387
- return copyProjectAssets(options);
390
+ return copyProjectAssets(options, config);
388
391
  },
389
392
  options: [
390
393
  {
391
394
  name: "--platform <string>",
392
- description: "platform to target",
395
+ description: "Platform to target",
393
396
  parse: tools_react_native_1.parsePlatform,
394
397
  },
395
398
  {
396
399
  name: "--assets-dest <string>",
397
- description: "path of the directory to copy assets into",
400
+ description: "Path of the directory to copy assets into",
398
401
  },
399
402
  {
400
- name: "--bundle-aar <boolean>",
401
- description: "whether to bundle AARs of dependencies",
403
+ name: "--bundle-aar [boolean]",
404
+ description: "Whether to bundle AARs of dependencies",
402
405
  default: false,
403
406
  },
404
407
  {
405
408
  name: "--xcassets-dest <string>",
406
- description: "path of the directory to copy Xcode asset catalogs into. Asset catalogs will only be copied if a destination path is specified.",
409
+ description: "Path of the directory to copy Xcode asset catalogs into; asset catalogs will only be copied if a destination path is specified",
407
410
  },
408
411
  ],
409
412
  };
@@ -0,0 +1,4 @@
1
+ import type { CliServerApi, CoreDevMiddleware } from "../serve/types";
2
+ export declare function requireExternal(module: "@react-native-community/cli-server-api", projectRoot: string, reactNativePath: string): CliServerApi;
3
+ export declare function requireExternal(module: "@react-native/dev-middleware", projectRoot: string, reactNativePath: string): CoreDevMiddleware;
4
+ //# sourceMappingURL=externals.d.ts.map
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireExternal = requireExternal;
4
4
  const package_1 = require("@rnx-kit/tools-node/package");
5
- function friendlyRequire(...modules) {
5
+ const context_1 = require("@rnx-kit/tools-react-native/context");
6
+ function friendlyRequire(modules, startDir) {
6
7
  try {
7
- const modulePath = (0, package_1.resolveDependencyChain)(modules);
8
+ const modulePath = (0, package_1.resolveDependencyChain)(modules, startDir);
8
9
  return require(modulePath);
9
10
  }
10
11
  catch (_) {
@@ -16,14 +17,15 @@ function friendlyRequire(...modules) {
16
17
  "file a bug at https://github.com/microsoft/rnx-kit/issues.");
17
18
  }
18
19
  }
19
- function requireExternal(module) {
20
+ function requireExternal(module, projectRoot, reactNativePath) {
20
21
  switch (module) {
21
- case "@react-native-community/cli-clean":
22
- return friendlyRequire("react-native", "@react-native-community/cli", "@react-native-community/cli-clean");
23
22
  case "@react-native-community/cli-server-api":
24
- return friendlyRequire("react-native", "@react-native-community/cli", "@react-native-community/cli-server-api");
23
+ return friendlyRequire([
24
+ "@react-native-community/cli",
25
+ "@react-native-community/cli-server-api",
26
+ ], (0, context_1.resolveCommunityCLI)(projectRoot, reactNativePath));
25
27
  case "@react-native/dev-middleware":
26
- return friendlyRequire("react-native", "@react-native/community-cli-plugin", "@react-native/dev-middleware");
28
+ return friendlyRequire(["@react-native/community-cli-plugin", "@react-native/dev-middleware"], reactNativePath);
27
29
  }
28
30
  }
29
- //# sourceMappingURL=external.js.map
31
+ //# sourceMappingURL=externals.js.map
@@ -0,0 +1,3 @@
1
+ import * as nodefs from "fs";
2
+ export declare function ensureDir(p: string, fs?: typeof nodefs): void;
3
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -0,0 +1,31 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ensureDir = ensureDir;
27
+ const nodefs = __importStar(require("fs")); // Cannot use `node:fs` because of Jest mocks
28
+ function ensureDir(p, fs = nodefs) {
29
+ fs.mkdirSync(p, { recursive: true, mode: 0o755 });
30
+ }
31
+ //# sourceMappingURL=filesystem.js.map
@@ -7,7 +7,7 @@ const metro_plugin_duplicates_checker_1 = require("@rnx-kit/metro-plugin-duplica
7
7
  const metro_plugin_typescript_1 = require("@rnx-kit/metro-plugin-typescript");
8
8
  const metro_serializer_1 = require("@rnx-kit/metro-serializer");
9
9
  const metro_serializer_esbuild_1 = require("@rnx-kit/metro-serializer-esbuild");
10
- const defaultPlugins_1 = require("./bundle/defaultPlugins");
10
+ const defaultPlugins_1 = require("../bundle/defaultPlugins");
11
11
  function resolvePlugin(name) {
12
12
  try {
13
13
  return require.resolve(name);
@@ -3,5 +3,5 @@ export declare function asBoolean(value: string): boolean;
3
3
  export declare function asNumber(value: string): number;
4
4
  export declare function asResolvedPath(value: string): string;
5
5
  export declare function asStringArray(value: string): string[];
6
- export declare function parseTransformProfile(val: string): TransformProfile;
6
+ export declare function asTransformProfile(val: string): TransformProfile;
7
7
  //# sourceMappingURL=parsers.d.ts.map
@@ -27,8 +27,8 @@ exports.asBoolean = asBoolean;
27
27
  exports.asNumber = asNumber;
28
28
  exports.asResolvedPath = asResolvedPath;
29
29
  exports.asStringArray = asStringArray;
30
- exports.parseTransformProfile = parseTransformProfile;
31
- const path = __importStar(require("path"));
30
+ exports.asTransformProfile = asTransformProfile;
31
+ const path = __importStar(require("node:path"));
32
32
  function asBoolean(value) {
33
33
  switch (value) {
34
34
  case "false":
@@ -36,7 +36,7 @@ function asBoolean(value) {
36
36
  case "true":
37
37
  return true;
38
38
  default:
39
- throw new Error("Invalid boolean value '" + value + "' — must be true or false");
39
+ throw new Error(`Expected 'true' or 'false; got '${value}'`);
40
40
  }
41
41
  }
42
42
  function asNumber(value) {
@@ -48,18 +48,20 @@ function asResolvedPath(value) {
48
48
  function asStringArray(value) {
49
49
  return value.split(",");
50
50
  }
51
- function parseTransformProfile(val) {
52
- const allowedProfiles = [
53
- "hermes-stable",
54
- "hermes-canary",
55
- "default",
56
- ];
57
- if (val in allowedProfiles) {
58
- return val;
51
+ function asTransformProfile(val) {
52
+ switch (val) {
53
+ case "hermes-stable":
54
+ case "hermes-canary":
55
+ case "default":
56
+ return val;
57
+ default: {
58
+ const profiles = [
59
+ "hermes-stable",
60
+ "hermes-canary",
61
+ "default",
62
+ ];
63
+ throw new Error(`Expected '${profiles.join("', '")}'; got ${val}`);
64
+ }
59
65
  }
60
- throw new Error("Invalid transform profile '" +
61
- val +
62
- "' -- must be one of " +
63
- allowedProfiles.join(", "));
64
66
  }
65
67
  //# sourceMappingURL=parsers.js.map
package/lib/index.d.ts CHANGED
@@ -1,197 +1,11 @@
1
+ import type { Command } from "@react-native-community/cli-types";
1
2
  export declare const reactNativeConfig: {
2
- commands: ({
3
- name: string;
4
- description: string;
5
- func: typeof import("./align-deps").rnxAlignDeps;
6
- options: {
7
- name: string;
8
- description: string;
9
- }[];
10
- } | {
11
- name: string;
12
- description: string;
13
- func: typeof import("./bundle").rnxBundle;
14
- options: ({
15
- name: string;
16
- description: string;
17
- parse?: undefined;
18
- default?: undefined;
19
- } | {
20
- name: string;
21
- description: string;
22
- parse: typeof import("@rnx-kit/tools-react-native").parsePlatform;
23
- default?: undefined;
24
- } | {
25
- name: string;
26
- description: string;
27
- default: boolean;
28
- parse: typeof import("./parsers").asBoolean;
29
- } | {
30
- name: string;
31
- description: string;
32
- parse: typeof import("./parsers").asBoolean;
33
- default?: undefined;
34
- } | {
35
- name: string;
36
- description: string;
37
- default: string;
38
- parse?: undefined;
39
- } | {
40
- name: string;
41
- description: string;
42
- parse: typeof import("./parsers").asNumber;
43
- default?: undefined;
44
- } | {
45
- name: string;
46
- description: string;
47
- parse: typeof import("./parsers").parseTransformProfile;
48
- default?: undefined;
49
- })[];
50
- } | {
51
- name: string;
52
- func: typeof import("./clean").rnxClean;
53
- description: string;
54
- options: ({
55
- name: string;
56
- description: string;
57
- default: string;
58
- parse?: undefined;
59
- } | {
60
- name: string;
61
- description: string;
62
- default: string;
63
- parse: typeof import("./parsers").asResolvedPath;
64
- } | {
65
- name: string;
66
- description: string;
67
- default: boolean;
68
- parse?: undefined;
69
- })[];
70
- } | {
71
- name: string;
72
- description: string;
73
- func: (_argv: string[], _config: import("@react-native-community/cli-types").Config, options: import("./copy-assets").Options) => Promise<void>;
74
- options: ({
75
- name: string;
76
- description: string;
77
- parse: typeof import("@rnx-kit/tools-react-native").parsePlatform;
78
- default?: undefined;
79
- } | {
80
- name: string;
81
- description: string;
82
- parse?: undefined;
83
- default?: undefined;
84
- } | {
85
- name: string;
86
- description: string;
87
- default: boolean;
88
- parse?: undefined;
89
- })[];
90
- } | {
91
- name: string;
92
- description: string;
93
- func: typeof import("./ram-bundle").rnxRamBundle;
94
- options: ({
95
- name: string;
96
- description: string;
97
- parse?: undefined;
98
- default?: undefined;
99
- } | {
100
- name: string;
101
- description: string;
102
- parse: typeof import("@rnx-kit/tools-react-native").parsePlatform;
103
- default?: undefined;
104
- } | {
105
- name: string;
106
- description: string;
107
- default: boolean;
108
- parse: typeof import("./parsers").asBoolean;
109
- } | {
110
- name: string;
111
- description: string;
112
- parse: typeof import("./parsers").asBoolean;
113
- default?: undefined;
114
- } | {
115
- name: string;
116
- description: string;
117
- default: string;
118
- parse?: undefined;
119
- } | {
120
- name: string;
121
- description: string;
122
- parse: typeof import("./parsers").asNumber;
123
- default?: undefined;
124
- } | {
125
- name: string;
126
- description: string;
127
- parse: typeof import("./parsers").parseTransformProfile;
128
- default?: undefined;
129
- })[];
130
- } | {
131
- name: string;
132
- func: typeof import("./start").rnxStart;
133
- description: string;
134
- options: ({
135
- name: string;
136
- description: string;
137
- parse: typeof import("./parsers").asNumber;
138
- default: number;
139
- } | {
140
- name: string;
141
- description: string;
142
- default: string;
143
- parse?: undefined;
144
- } | {
145
- name: string;
146
- description: string;
147
- parse: typeof import("./parsers").asResolvedPath;
148
- default?: undefined;
149
- } | {
150
- name: string;
151
- description: string;
152
- parse: (val: string) => string[];
153
- default?: undefined;
154
- } | {
155
- name: string;
156
- description: string;
157
- parse: typeof import("./parsers").asNumber;
158
- default?: undefined;
159
- } | {
160
- name: string;
161
- description: string;
162
- parse?: undefined;
163
- default?: undefined;
164
- })[];
165
- } | {
166
- name: string;
167
- description: string;
168
- func: typeof import("./test").rnxTest;
169
- options: {
170
- name: string;
171
- description?: string;
172
- parse?: (val: string) => unknown;
173
- default?: string | boolean | number | ((config: import("@react-native-community/cli-types").Config) => string | boolean | number);
174
- }[];
175
- } | {
176
- name: string;
177
- description: string;
178
- func: typeof import("./write-third-party-notices").rnxWriteThirdPartyNotices;
179
- options: ({
180
- name: string;
181
- description: string;
182
- default?: undefined;
183
- } | {
184
- name: string;
185
- description: string;
186
- default: boolean;
187
- })[];
188
- })[];
3
+ commands: Command<false>[];
189
4
  };
190
5
  export { rnxAlignDeps, rnxAlignDepsCommand } from "./align-deps";
191
6
  export { rnxBundle, rnxBundleCommand } from "./bundle";
192
7
  export { rnxClean, rnxCleanCommand } from "./clean";
193
8
  export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
194
- export { asBoolean, asNumber, parseTransformProfile } from "./parsers";
195
9
  export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
196
10
  export { rnxStart, rnxStartCommand } from "./start";
197
11
  export { rnxTest, rnxTestCommand } from "./test";
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStartCommand = exports.rnxStart = exports.rnxRamBundleCommand = exports.rnxRamBundle = exports.parseTransformProfile = exports.asNumber = exports.asBoolean = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxCleanCommand = exports.rnxClean = exports.rnxBundleCommand = exports.rnxBundle = exports.rnxAlignDepsCommand = exports.rnxAlignDeps = exports.reactNativeConfig = void 0;
3
+ exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStartCommand = exports.rnxStart = exports.rnxRamBundleCommand = exports.rnxRamBundle = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxCleanCommand = exports.rnxClean = exports.rnxBundleCommand = exports.rnxBundle = exports.rnxAlignDepsCommand = exports.rnxAlignDeps = exports.reactNativeConfig = void 0;
4
4
  const align_deps_1 = require("./align-deps");
5
5
  const bundle_1 = require("./bundle");
6
6
  const clean_1 = require("./clean");
@@ -33,10 +33,6 @@ Object.defineProperty(exports, "rnxCleanCommand", { enumerable: true, get: funct
33
33
  var copy_assets_2 = require("./copy-assets");
34
34
  Object.defineProperty(exports, "copyProjectAssets", { enumerable: true, get: function () { return copy_assets_2.copyProjectAssets; } });
35
35
  Object.defineProperty(exports, "rnxCopyAssetsCommand", { enumerable: true, get: function () { return copy_assets_2.rnxCopyAssetsCommand; } });
36
- var parsers_1 = require("./parsers");
37
- Object.defineProperty(exports, "asBoolean", { enumerable: true, get: function () { return parsers_1.asBoolean; } });
38
- Object.defineProperty(exports, "asNumber", { enumerable: true, get: function () { return parsers_1.asNumber; } });
39
- Object.defineProperty(exports, "parseTransformProfile", { enumerable: true, get: function () { return parsers_1.parseTransformProfile; } });
40
36
  var ram_bundle_2 = require("./ram-bundle");
41
37
  Object.defineProperty(exports, "rnxRamBundle", { enumerable: true, get: function () { return ram_bundle_2.rnxRamBundle; } });
42
38
  Object.defineProperty(exports, "rnxRamBundleCommand", { enumerable: true, get: function () { return ram_bundle_2.rnxRamBundleCommand; } });
@@ -22,11 +22,11 @@ export declare const rnxRamBundleCommand: {
22
22
  name: string;
23
23
  description: string;
24
24
  default: boolean;
25
- parse: typeof import("./parsers").asBoolean;
25
+ parse: typeof import("./helpers/parsers").asBoolean;
26
26
  } | {
27
27
  name: string;
28
28
  description: string;
29
- parse: typeof import("./parsers").asBoolean;
29
+ parse: typeof import("./helpers/parsers").asBoolean;
30
30
  default?: undefined;
31
31
  } | {
32
32
  name: string;
@@ -36,12 +36,12 @@ export declare const rnxRamBundleCommand: {
36
36
  } | {
37
37
  name: string;
38
38
  description: string;
39
- parse: typeof import("./parsers").asNumber;
39
+ parse: typeof import("./helpers/parsers").asNumber;
40
40
  default?: undefined;
41
41
  } | {
42
42
  name: string;
43
43
  description: string;
44
- parse: typeof import("./parsers").parseTransformProfile;
44
+ parse: typeof import("./helpers/parsers").asTransformProfile;
45
45
  default?: undefined;
46
46
  })[];
47
47
  };
package/lib/ram-bundle.js CHANGED
@@ -34,13 +34,13 @@ async function rnxRamBundle(_argv, cliConfig, cliOptions) {
34
34
  }
35
35
  exports.rnxRamBundleCommand = {
36
36
  name: "rnx-ram-bundle",
37
- description: "Bundle your rnx-kit package in the RAM bundle format for offline use. See https://aka.ms/rnx-kit.",
37
+ description: "[Deprecated] Bundle your JavaScript in the RAM bundle format for offline use",
38
38
  func: rnxRamBundle,
39
39
  options: [
40
40
  ...cliOptions_1.commonBundleCommandOptions,
41
41
  {
42
42
  name: "--indexed-ram-bundle",
43
- description: 'Force the "Indexed RAM" bundle file format, even when targeting Android.',
43
+ description: 'Force the "Indexed RAM" bundle file format, even when targeting Android',
44
44
  },
45
45
  ],
46
46
  };
@@ -5,9 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.attachKeyHandlers = attachKeyHandlers;
7
7
  const console_1 = require("@rnx-kit/console");
8
- const node_fetch_1 = __importDefault(require("node-fetch"));
8
+ const node_readline_1 = __importDefault(require("node:readline"));
9
9
  const qrcode_1 = __importDefault(require("qrcode"));
10
- const readline_1 = __importDefault(require("readline"));
11
10
  function attachKeyHandlers({ devServerUrl, help, messageSocketEndpoint, terminal, }) {
12
11
  process.stdin.setRawMode(true);
13
12
  process.stdin.on("keypress", (_key, data) => {
@@ -34,9 +33,7 @@ function attachKeyHandlers({ devServerUrl, help, messageSocketEndpoint, terminal
34
33
  break;
35
34
  case "j": {
36
35
  (0, console_1.info)("Opening debugger...");
37
- // TODO: Remove `node-fetch` when we drop support for Node 16
38
- const ftch = "fetch" in globalThis ? fetch : node_fetch_1.default;
39
- ftch(devServerUrl + "/open-debugger", { method: "POST" });
36
+ fetch(devServerUrl + "/open-debugger", { method: "POST" });
40
37
  break;
41
38
  }
42
39
  case "q": {
@@ -58,6 +55,6 @@ function attachKeyHandlers({ devServerUrl, help, messageSocketEndpoint, terminal
58
55
  }
59
56
  }
60
57
  });
61
- readline_1.default.emitKeypressEvents(process.stdin);
58
+ node_readline_1.default.emitKeypressEvents(process.stdin);
62
59
  }
63
60
  //# sourceMappingURL=keyboard.js.map
@@ -1,8 +1,8 @@
1
1
  import type * as logger from "@rnx-kit/console";
2
2
  import type { Server as Middleware } from "connect";
3
- import type { Server as HttpServer } from "http";
4
- import type { Server as HttpsServer } from "https";
5
3
  import type { RunServerOptions } from "metro";
4
+ import type { Server as HttpServer } from "node:http";
5
+ import type { Server as HttpsServer } from "node:https";
6
6
  type MiddlewareOptions = {
7
7
  host?: string;
8
8
  watchFolders: readonly string[];
package/lib/start.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Config } from "@react-native-community/cli-types";
2
- import { asNumber, asResolvedPath } from "./parsers";
2
+ import { asNumber, asResolvedPath } from "./helpers/parsers";
3
3
  import type { StartCommandArgs } from "./serve/types";
4
4
  export declare function rnxStart(_argv: string[], ctx: Config, args: StartCommandArgs): Promise<void>;
5
5
  export declare const rnxStartCommand: {