@rnx-kit/cli 0.16.28 → 0.16.30

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 (61) hide show
  1. package/lib/align-deps.d.ts +1 -1
  2. package/lib/align-deps.js +8 -9
  3. package/lib/bundle/cliOptions.d.ts +2 -2
  4. package/lib/bundle/cliOptions.js +27 -27
  5. package/lib/bundle/defaultPlugins.js +1 -2
  6. package/lib/bundle/hermes.d.ts +2 -1
  7. package/lib/bundle/hermes.js +5 -12
  8. package/lib/bundle/kit-config.js +2 -3
  9. package/lib/bundle/metro.js +6 -10
  10. package/lib/bundle/overrides.js +2 -2
  11. package/lib/bundle.d.ts +3 -3
  12. package/lib/bundle.js +6 -6
  13. package/lib/clean.d.ts +2 -2
  14. package/lib/clean.js +44 -64
  15. package/lib/copy-assets.js +6 -6
  16. package/lib/helpers/externals.d.ts +4 -0
  17. package/lib/{serve/external.js → helpers/externals.js} +11 -10
  18. package/lib/helpers/filesystem.d.ts +3 -0
  19. package/lib/helpers/filesystem.js +31 -0
  20. package/lib/{metro-config.js → helpers/metro-config.js} +2 -3
  21. package/lib/{parsers.d.ts → helpers/parsers.d.ts} +1 -1
  22. package/lib/{parsers.js → helpers/parsers.js} +20 -19
  23. package/lib/index.d.ts +15 -16
  24. package/lib/index.js +1 -5
  25. package/lib/ram-bundle.d.ts +4 -4
  26. package/lib/ram-bundle.js +4 -4
  27. package/lib/serve/help.js +1 -2
  28. package/lib/serve/keyboard.js +1 -2
  29. package/lib/serve/kit-config.js +1 -2
  30. package/lib/serve/types.d.ts +0 -2
  31. package/lib/start.d.ts +1 -1
  32. package/lib/start.js +35 -35
  33. package/lib/test.d.ts +2 -1
  34. package/lib/test.js +4 -4
  35. package/lib/write-third-party-notices.js +15 -15
  36. package/package.json +6 -8
  37. package/lib/serve/external.d.ts +0 -7
  38. package/src/align-deps.ts +0 -83
  39. package/src/bundle/cliOptions.ts +0 -82
  40. package/src/bundle/defaultPlugins.ts +0 -16
  41. package/src/bundle/hermes.ts +0 -114
  42. package/src/bundle/kit-config.ts +0 -81
  43. package/src/bundle/metro.ts +0 -66
  44. package/src/bundle/overrides.ts +0 -51
  45. package/src/bundle/types.ts +0 -41
  46. package/src/bundle.ts +0 -69
  47. package/src/clean.ts +0 -223
  48. package/src/copy-assets.ts +0 -545
  49. package/src/index.ts +0 -34
  50. package/src/metro-config.ts +0 -208
  51. package/src/parsers.ts +0 -44
  52. package/src/ram-bundle.ts +0 -78
  53. package/src/serve/external.ts +0 -62
  54. package/src/serve/help.ts +0 -59
  55. package/src/serve/keyboard.ts +0 -76
  56. package/src/serve/kit-config.ts +0 -47
  57. package/src/serve/types.ts +0 -87
  58. package/src/start.ts +0 -316
  59. package/src/test.ts +0 -137
  60. package/src/write-third-party-notices.ts +0 -85
  61. /package/lib/{metro-config.d.ts → helpers/metro-config.d.ts} +0 -0
@@ -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
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireExternal = void 0;
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,15 +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
- exports.requireExternal = requireExternal;
30
- //# 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"));
28
+ function ensureDir(p, fs = nodefs) {
29
+ fs.mkdirSync(p, { recursive: true, mode: 0o755 });
30
+ }
31
+ //# sourceMappingURL=filesystem.js.map
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.customizeMetroConfig = void 0;
3
+ exports.customizeMetroConfig = customizeMetroConfig;
4
4
  const console_1 = require("@rnx-kit/console");
5
5
  const metro_plugin_cyclic_dependencies_detector_1 = require("@rnx-kit/metro-plugin-cyclic-dependencies-detector");
6
6
  const metro_plugin_duplicates_checker_1 = require("@rnx-kit/metro-plugin-duplicates-checker");
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);
@@ -159,5 +159,4 @@ function customizeMetroConfig(metroConfigReadonly, extraParams, print) {
159
159
  break;
160
160
  }
161
161
  }
162
- exports.customizeMetroConfig = customizeMetroConfig;
163
162
  //# sourceMappingURL=metro-config.js.map
@@ -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
@@ -23,7 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.parseTransformProfile = exports.asStringArray = exports.asResolvedPath = exports.asNumber = exports.asBoolean = void 0;
26
+ exports.asBoolean = asBoolean;
27
+ exports.asNumber = asNumber;
28
+ exports.asResolvedPath = asResolvedPath;
29
+ exports.asStringArray = asStringArray;
30
+ exports.asTransformProfile = asTransformProfile;
27
31
  const path = __importStar(require("path"));
28
32
  function asBoolean(value) {
29
33
  switch (value) {
@@ -32,35 +36,32 @@ function asBoolean(value) {
32
36
  case "true":
33
37
  return true;
34
38
  default:
35
- throw new Error("Invalid boolean value '" + value + "' — must be true or false");
39
+ throw new Error(`Expected 'true' or 'false; got '${value}'`);
36
40
  }
37
41
  }
38
- exports.asBoolean = asBoolean;
39
42
  function asNumber(value) {
40
43
  return Number(value);
41
44
  }
42
- exports.asNumber = asNumber;
43
45
  function asResolvedPath(value) {
44
46
  return path.resolve(value);
45
47
  }
46
- exports.asResolvedPath = asResolvedPath;
47
48
  function asStringArray(value) {
48
49
  return value.split(",");
49
50
  }
50
- exports.asStringArray = asStringArray;
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
- exports.parseTransformProfile = parseTransformProfile;
66
67
  //# sourceMappingURL=parsers.js.map
package/lib/index.d.ts CHANGED
@@ -25,11 +25,11 @@ export declare const reactNativeConfig: {
25
25
  name: string;
26
26
  description: string;
27
27
  default: boolean;
28
- parse: typeof import("./parsers").asBoolean;
28
+ parse: typeof import("./helpers/parsers").asBoolean;
29
29
  } | {
30
30
  name: string;
31
31
  description: string;
32
- parse: typeof import("./parsers").asBoolean;
32
+ parse: typeof import("./helpers/parsers").asBoolean;
33
33
  default?: undefined;
34
34
  } | {
35
35
  name: string;
@@ -39,12 +39,12 @@ export declare const reactNativeConfig: {
39
39
  } | {
40
40
  name: string;
41
41
  description: string;
42
- parse: typeof import("./parsers").asNumber;
42
+ parse: typeof import("./helpers/parsers").asNumber;
43
43
  default?: undefined;
44
44
  } | {
45
45
  name: string;
46
46
  description: string;
47
- parse: typeof import("./parsers").parseTransformProfile;
47
+ parse: typeof import("./helpers/parsers").asTransformProfile;
48
48
  default?: undefined;
49
49
  })[];
50
50
  } | {
@@ -60,7 +60,7 @@ export declare const reactNativeConfig: {
60
60
  name: string;
61
61
  description: string;
62
62
  default: string;
63
- parse: typeof import("./parsers").asResolvedPath;
63
+ parse: typeof import("./helpers/parsers").asResolvedPath;
64
64
  } | {
65
65
  name: string;
66
66
  description: string;
@@ -105,11 +105,11 @@ export declare const reactNativeConfig: {
105
105
  name: string;
106
106
  description: string;
107
107
  default: boolean;
108
- parse: typeof import("./parsers").asBoolean;
108
+ parse: typeof import("./helpers/parsers").asBoolean;
109
109
  } | {
110
110
  name: string;
111
111
  description: string;
112
- parse: typeof import("./parsers").asBoolean;
112
+ parse: typeof import("./helpers/parsers").asBoolean;
113
113
  default?: undefined;
114
114
  } | {
115
115
  name: string;
@@ -119,12 +119,12 @@ export declare const reactNativeConfig: {
119
119
  } | {
120
120
  name: string;
121
121
  description: string;
122
- parse: typeof import("./parsers").asNumber;
122
+ parse: typeof import("./helpers/parsers").asNumber;
123
123
  default?: undefined;
124
124
  } | {
125
125
  name: string;
126
126
  description: string;
127
- parse: typeof import("./parsers").parseTransformProfile;
127
+ parse: typeof import("./helpers/parsers").asTransformProfile;
128
128
  default?: undefined;
129
129
  })[];
130
130
  } | {
@@ -134,7 +134,7 @@ export declare const reactNativeConfig: {
134
134
  options: ({
135
135
  name: string;
136
136
  description: string;
137
- parse: typeof import("./parsers").asNumber;
137
+ parse: typeof import("./helpers/parsers").asNumber;
138
138
  default: number;
139
139
  } | {
140
140
  name: string;
@@ -144,7 +144,7 @@ export declare const reactNativeConfig: {
144
144
  } | {
145
145
  name: string;
146
146
  description: string;
147
- parse: typeof import("./parsers").asResolvedPath;
147
+ parse: typeof import("./helpers/parsers").asResolvedPath;
148
148
  default?: undefined;
149
149
  } | {
150
150
  name: string;
@@ -154,7 +154,7 @@ export declare const reactNativeConfig: {
154
154
  } | {
155
155
  name: string;
156
156
  description: string;
157
- parse: typeof import("./parsers").asNumber;
157
+ parse: typeof import("./helpers/parsers").asNumber;
158
158
  default?: undefined;
159
159
  } | {
160
160
  name: string;
@@ -168,9 +168,9 @@ export declare const reactNativeConfig: {
168
168
  func: typeof import("./test").rnxTest;
169
169
  options: {
170
170
  name: string;
171
- description?: string | undefined;
172
- parse?: ((val: string) => unknown) | undefined;
173
- default?: string | number | boolean | ((config: import("@react-native-community/cli-types").Config) => string | number | boolean) | undefined;
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
174
  }[];
175
175
  } | {
176
176
  name: string;
@@ -191,7 +191,6 @@ export { rnxAlignDeps, rnxAlignDepsCommand } from "./align-deps";
191
191
  export { rnxBundle, rnxBundleCommand } from "./bundle";
192
192
  export { rnxClean, rnxCleanCommand } from "./clean";
193
193
  export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
194
- export { asBoolean, asNumber, parseTransformProfile } from "./parsers";
195
194
  export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
196
195
  export { rnxStart, rnxStartCommand } from "./start";
197
196
  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
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rnxRamBundleCommand = exports.rnxRamBundle = void 0;
3
+ exports.rnxRamBundleCommand = void 0;
4
+ exports.rnxRamBundle = rnxRamBundle;
4
5
  const console_1 = require("@rnx-kit/console");
5
6
  const metro_service_1 = require("@rnx-kit/metro-service");
6
7
  const cliOptions_1 = require("./bundle/cliOptions");
@@ -31,16 +32,15 @@ async function rnxRamBundle(_argv, cliConfig, cliOptions) {
31
32
  await (0, metro_1.metroBundle)(metroConfig, bundleConfig, cliOptions.dev, cliOptions.minify, metro_service_1.ramBundle);
32
33
  }
33
34
  }
34
- exports.rnxRamBundle = rnxRamBundle;
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
  };
package/lib/serve/help.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeHelp = void 0;
3
+ exports.makeHelp = makeHelp;
4
4
  const console_1 = require("@rnx-kit/console");
5
5
  function makeHelp(terminal, { hasDebugger }) {
6
6
  const openDebugger = hasDebugger
@@ -42,5 +42,4 @@ function makeHelp(terminal, { hasDebugger }) {
42
42
  const help = lines.join("\n");
43
43
  return () => terminal.log(help);
44
44
  }
45
- exports.makeHelp = makeHelp;
46
45
  //# sourceMappingURL=help.js.map
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.attachKeyHandlers = void 0;
6
+ exports.attachKeyHandlers = attachKeyHandlers;
7
7
  const console_1 = require("@rnx-kit/console");
8
8
  const node_fetch_1 = __importDefault(require("node-fetch"));
9
9
  const qrcode_1 = __importDefault(require("qrcode"));
@@ -60,5 +60,4 @@ function attachKeyHandlers({ devServerUrl, help, messageSocketEndpoint, terminal
60
60
  });
61
61
  readline_1.default.emitKeypressEvents(process.stdin);
62
62
  }
63
- exports.attachKeyHandlers = attachKeyHandlers;
64
63
  //# sourceMappingURL=keyboard.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getKitServerConfig = void 0;
3
+ exports.getKitServerConfig = getKitServerConfig;
4
4
  const config_1 = require("@rnx-kit/config");
5
5
  const properties_1 = require("@rnx-kit/tools-language/properties");
6
6
  const defaultPlugins_1 = require("../bundle/defaultPlugins");
@@ -31,5 +31,4 @@ function getKitServerConfig(overrides) {
31
31
  ...(0, properties_1.pickValues)(overrides, ["projectRoot", "assetPlugins", "sourceExts"]),
32
32
  };
33
33
  }
34
- exports.getKitServerConfig = getKitServerConfig;
35
34
  //# sourceMappingURL=kit-config.js.map
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type * as logger from "@rnx-kit/console";
4
2
  import type { Server as Middleware } from "connect";
5
3
  import type { Server as HttpServer } from "http";
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: {
package/lib/start.js CHANGED
@@ -23,13 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.rnxStartCommand = exports.rnxStart = void 0;
26
+ exports.rnxStartCommand = void 0;
27
+ exports.rnxStart = rnxStart;
27
28
  const logger = __importStar(require("@rnx-kit/console"));
28
29
  const metro_service_1 = require("@rnx-kit/metro-service");
29
30
  const path = __importStar(require("path"));
30
- const metro_config_1 = require("./metro-config");
31
- const parsers_1 = require("./parsers");
32
- const external_1 = require("./serve/external");
31
+ const externals_1 = require("./helpers/externals");
32
+ const metro_config_1 = require("./helpers/metro-config");
33
+ const parsers_1 = require("./helpers/parsers");
33
34
  const help_1 = require("./serve/help");
34
35
  const keyboard_1 = require("./serve/keyboard");
35
36
  const kit_config_1 = require("./serve/kit-config");
@@ -39,7 +40,7 @@ function hasAttachToServerFunction(devServer) {
39
40
  async function rnxStart(_argv, ctx, args) {
40
41
  var _a;
41
42
  const serverConfig = (0, kit_config_1.getKitServerConfig)(args);
42
- const { createDevServerMiddleware, indexPageMiddleware } = (0, external_1.requireExternal)("@react-native-community/cli-server-api");
43
+ const { createDevServerMiddleware, indexPageMiddleware } = (0, externals_1.requireExternal)("@react-native-community/cli-server-api", ctx.root, ctx.reactNativePath);
43
44
  // interactive mode requires raw access to stdin
44
45
  let interactive = args.interactive;
45
46
  if (interactive) {
@@ -89,7 +90,7 @@ async function rnxStart(_argv, ctx, args) {
89
90
  const coreDevMiddleware = (() => {
90
91
  try {
91
92
  // https://github.com/facebook/react-native/blob/7888338295476f4d4f00733309e54b8d22318e1e/packages/community-cli-plugin/src/commands/start/runServer.js#L115
92
- const { createDevMiddleware } = (0, external_1.requireExternal)("@react-native/dev-middleware");
93
+ const { createDevMiddleware } = (0, externals_1.requireExternal)("@react-native/dev-middleware", ctx.root, ctx.reactNativePath);
93
94
  return createDevMiddleware({
94
95
  projectRoot,
95
96
  serverBaseUrl: devServerUrl,
@@ -185,80 +186,79 @@ async function rnxStart(_argv, ctx, args) {
185
186
  (0, keyboard_1.attachKeyHandlers)({ devServerUrl, help, messageSocketEndpoint, terminal });
186
187
  }
187
188
  }
188
- exports.rnxStart = rnxStart;
189
189
  exports.rnxStartCommand = {
190
190
  name: "rnx-start",
191
191
  func: rnxStart,
192
- description: "Start a bundle-server to host your react-native experience during development",
192
+ description: "Start a React Native development server",
193
193
  options: [
194
194
  {
195
- name: "--port [number]",
196
- description: "Host port to use when listening for incoming server requests.",
195
+ name: "--port <number>",
196
+ description: "Host port to use when listening for incoming server requests",
197
197
  parse: parsers_1.asNumber,
198
198
  default: 8081,
199
199
  },
200
200
  {
201
- name: "--host [string]",
202
- description: "Host name or address to bind when listening for incoming server requests. When not given, requests from all addresses are accepted.",
201
+ name: "--host <string>",
202
+ description: "Host name or address to bind when listening for incoming server requests; when not specified, requests from all addresses are accepted",
203
203
  default: "",
204
204
  },
205
205
  {
206
- name: "--projectRoot [path]",
207
- description: "Path to the root of your react-native project. The bundle server uses this root path to resolve all web requests.",
206
+ name: "--project-root <path>",
207
+ description: "Path to the root of your react-native project; the bundle server uses this path to resolve all web requests",
208
208
  parse: parsers_1.asResolvedPath,
209
209
  },
210
210
  {
211
- name: "--watchFolders [paths]",
212
- description: "Additional folders which will be added to the file-watch list. Comma-separated. By default, Metro watches all project files.",
211
+ name: "--watch-folders <paths>",
212
+ description: "Additional folders which will be added to the watched files list, comma-separated; by default, Metro watches all project files",
213
213
  parse: (val) => (0, parsers_1.asStringArray)(val).map(parsers_1.asResolvedPath),
214
214
  },
215
215
  {
216
- name: "--assetPlugins [list]",
217
- description: "Additional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin module names or absolute paths to plugin packages.",
216
+ name: "--asset-plugins <list>",
217
+ description: "Additional asset plugins to be used by Metro's Babel transformer; comma-separated list containing plugin module names or absolute paths to plugin packages",
218
218
  parse: parsers_1.asStringArray,
219
219
  },
220
220
  {
221
- name: "--sourceExts [list]",
222
- description: "Additional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.",
221
+ name: "--source-exts <list>",
222
+ description: "Additional source file extensions to include when generating bundles; comma-separated list, excluding the leading dot",
223
223
  parse: parsers_1.asStringArray,
224
224
  },
225
225
  {
226
- name: "--max-workers [number]",
227
- description: "Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
226
+ name: "--max-workers <number>",
227
+ description: "Specifies the maximum number of parallel worker threads to use for transforming files; defaults to the number of cores available on your machine",
228
228
  parse: parsers_1.asNumber,
229
229
  },
230
230
  {
231
231
  name: "--reset-cache",
232
- description: "Reset the Metro cache.",
232
+ description: "Reset the Metro cache",
233
233
  },
234
234
  {
235
- name: "--custom-log-reporter-path [string]",
236
- description: "Path to a JavaScript file which exports a Metro 'TerminalReporter' function. This replaces the default reporter, which writes all messages to the Metro console.",
235
+ name: "--custom-log-reporter-path <string>",
236
+ description: "Path to a JavaScript file which exports a Metro 'TerminalReporter' function; replaces the default reporter that writes all messages to the Metro console",
237
237
  },
238
238
  {
239
239
  name: "--https",
240
- description: "Use a secure (https) web server. When not specified, an insecure (http) web server is used.",
240
+ description: "Use a secure (https) web server; when not specified, an insecure (http) web server is used",
241
241
  },
242
242
  {
243
- name: "--key [path]",
244
- description: "Path to a custom SSL private key file to use for secure (https) communication.",
243
+ name: "--key <path>",
244
+ description: "Path to a custom SSL private key file to use for secure (https) communication",
245
245
  },
246
246
  {
247
- name: "--cert [path]",
248
- description: "Path to a custom SSL certificate file to use for secure (https) communication.",
247
+ name: "--cert <path>",
248
+ description: "Path to a custom SSL certificate file to use for secure (https) communication",
249
249
  },
250
250
  {
251
- name: "--config [string]",
252
- description: "Path to the Metro configuration file.",
251
+ name: "--config <string>",
252
+ description: "Path to the Metro configuration file",
253
253
  parse: parsers_1.asResolvedPath,
254
254
  },
255
255
  {
256
256
  name: "--no-interactive",
257
- description: "Disables interactive mode.",
257
+ description: "Disables interactive mode",
258
258
  },
259
259
  {
260
- name: "--id [string]",
261
- description: "Specify which bundle configuration to use if server configuration is missing.",
260
+ name: "--id <string>",
261
+ description: "Specify which bundle configuration to use if server configuration is missing",
262
262
  },
263
263
  ],
264
264
  };
package/lib/test.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Config as CLIConfig } from "@react-native-community/cli-types";
2
+ import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
2
3
  type Args = {
3
- platform: "android" | "ios" | "macos" | "windows" | "win32";
4
+ platform: AllPlatforms;
4
5
  };
5
6
  type Options = {
6
7
  name: string;
package/lib/test.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rnxTestCommand = exports.jestOptions = exports.rnxTest = void 0;
3
+ exports.rnxTestCommand = void 0;
4
+ exports.rnxTest = rnxTest;
5
+ exports.jestOptions = jestOptions;
4
6
  const console_1 = require("@rnx-kit/console");
5
7
  const package_1 = require("@rnx-kit/tools-node/package");
6
8
  const platform_1 = require("@rnx-kit/tools-react-native/platform");
@@ -33,7 +35,6 @@ function rnxTest(_argv, { root }, { platform }) {
33
35
  process.env["RN_TARGET_PLATFORM"] = platform;
34
36
  runJest(argv);
35
37
  }
36
- exports.rnxTest = rnxTest;
37
38
  function jestOptions() {
38
39
  const options = (() => {
39
40
  const jestCliPath = (() => {
@@ -94,14 +95,13 @@ function jestOptions() {
94
95
  };
95
96
  });
96
97
  }
97
- exports.jestOptions = jestOptions;
98
98
  exports.rnxTestCommand = {
99
99
  name: COMMAND_NAME,
100
100
  description: "Test runner for React Native apps",
101
101
  func: rnxTest,
102
102
  options: [
103
103
  {
104
- name: "--platform [android|ios|macos|windows|win32]",
104
+ name: "--platform <android|ios|macos|windows|win32>",
105
105
  description: "Platform to target",
106
106
  parse: platform_1.parsePlatform,
107
107
  },