@rnx-kit/cli 0.16.30 → 0.17.1
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.
- package/README.md +172 -98
- package/bin/rnx-cli.cjs +2 -0
- package/lib/bin/context.d.ts +25 -0
- package/lib/bin/context.js +98 -0
- package/lib/bin/externalCommands.d.ts +3 -0
- package/lib/bin/externalCommands.js +34 -0
- package/lib/bin/rnx-cli.d.ts +2 -0
- package/lib/bin/rnx-cli.js +55 -0
- package/lib/bundle/hermes.js +5 -5
- package/lib/bundle/metro.js +1 -1
- package/lib/clean.d.ts +1 -1
- package/lib/clean.js +11 -11
- package/lib/copy-assets.d.ts +5 -3
- package/lib/copy-assets.js +31 -28
- package/lib/helpers/filesystem.js +1 -1
- package/lib/helpers/parsers.js +1 -1
- package/lib/index.d.ts +2 -187
- package/lib/serve/keyboard.js +3 -6
- package/lib/serve/types.d.ts +2 -2
- package/lib/start.js +1 -1
- package/lib/test.js +6 -4
- package/package.json +21 -18
package/README.md
CHANGED
|
@@ -5,26 +5,33 @@
|
|
|
5
5
|
|
|
6
6
|
Command-line interface for working with packages in your repo.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
> [!NOTE]
|
|
9
|
+
>
|
|
10
|
+
> All commands below are also a plugin to `@react-native-community/cli`, meaning
|
|
11
|
+
> they will work with both `react-native` and `rnc-cli` commands. Just make sure
|
|
12
|
+
> to prefix the command with `rnx-` e.g., `rnx-cli start` becomes
|
|
13
|
+
> `react-native rnx-start`. The prefix is to avoid name clashes.
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
process uses optional
|
|
12
|
-
[configuration](https://github.com/microsoft/rnx-kit/tree/main/packages/config)
|
|
13
|
-
parameters and command-line overrides.
|
|
15
|
+
## `rnx-cli bundle`
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
work on upstreaming it to `@react-native-community/cli`, along with supporting
|
|
18
|
-
libraries for package configuration and Metro plugins.
|
|
17
|
+
Bundle a package using [Metro][]. The bundling process uses optional
|
|
18
|
+
[configuration][] parameters and command-line overrides.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
> [!NOTE]
|
|
21
|
+
>
|
|
22
|
+
> This command is meant to be a drop-in replacement for `react-native bundle`.
|
|
23
|
+
> If `rnx-bundle` ever becomes widely accepted, we will work on upstreaming it
|
|
24
|
+
> to `@react-native-community/cli`, along with supporting libraries for package
|
|
25
|
+
> configuration and Metro plugins.
|
|
26
|
+
|
|
27
|
+
### Example Usages
|
|
21
28
|
|
|
22
29
|
```sh
|
|
23
|
-
yarn
|
|
30
|
+
yarn rnx-cli bundle
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
```sh
|
|
27
|
-
yarn
|
|
34
|
+
yarn rnx-cli bundle \
|
|
28
35
|
--entry-file src/index.ts \
|
|
29
36
|
--bundle-output main.jsbundle \
|
|
30
37
|
--platform ios \
|
|
@@ -48,7 +55,7 @@ yarn react-native rnx-bundle \
|
|
|
48
55
|
],
|
|
49
56
|
"@rnx-kit/metro-plugin-typescript"
|
|
50
57
|
],
|
|
51
|
-
"targets": ["
|
|
58
|
+
"targets": ["android", "ios", "macos", "windows"],
|
|
52
59
|
"platforms": {
|
|
53
60
|
"android": {
|
|
54
61
|
"assetsDest": "dist/res"
|
|
@@ -86,44 +93,94 @@ dependencies.
|
|
|
86
93
|
|
|
87
94
|
### Command-Line Overrides
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
| --
|
|
94
|
-
| --
|
|
95
|
-
| --
|
|
96
|
-
| --
|
|
97
|
-
| --
|
|
98
|
-
| --
|
|
99
|
-
| --
|
|
100
|
-
| --
|
|
101
|
-
| --
|
|
102
|
-
| --
|
|
103
|
-
| --
|
|
104
|
-
| --
|
|
105
|
-
| -
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
`react-native
|
|
116
|
-
|
|
117
|
-
|
|
96
|
+
<!-- @rnx-kit/cli/bundle start -->
|
|
97
|
+
|
|
98
|
+
| Option | Description |
|
|
99
|
+
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
100
|
+
| --id <id> | Target bundle definition; only needed when the rnx-kit configuration has multiple bundle definitions |
|
|
101
|
+
| --entry-file <path> | Path to the root JavaScript or TypeScript file, either absolute or relative to the package |
|
|
102
|
+
| --platform <ios|android|windows|win32|macos> | Target platform; when unspecified, all platforms in the rnx-kit configuration are bundled |
|
|
103
|
+
| --dev [boolean] | If false, warnings are disabled and the bundle is minified |
|
|
104
|
+
| --minify [boolean] | Controls whether or not the bundle is minified (useful for test builds) |
|
|
105
|
+
| --bundle-output <string> | Path to the output bundle file, either absolute or relative to the package |
|
|
106
|
+
| --bundle-encoding <utf8|utf16le|ascii> | Character encoding to use when writing the bundle file |
|
|
107
|
+
| --max-workers <number> | Specifies the maximum number of parallel worker threads to use for transforming files; defaults to the number of cores available on your machine |
|
|
108
|
+
| --sourcemap-output <string> | Path where the bundle source map is written, either absolute or relative to the package |
|
|
109
|
+
| --sourcemap-sources-root <string> | Path to use when relativizing file entries in the bundle source map |
|
|
110
|
+
| --sourcemap-use-absolute-path | Report SourceMapURL using its full path |
|
|
111
|
+
| --assets-dest <path> | Path where bundle assets like images are written, either absolute or relative to the package; if unspecified, assets are ignored |
|
|
112
|
+
| --unstable-transform-profile <string> | [Experimental] Transform JS for a specific JS engine; currently supported: hermes, hermes-canary, default |
|
|
113
|
+
| --reset-cache | Reset the Metro cache |
|
|
114
|
+
| --config <string> | Path to the Metro configuration file |
|
|
115
|
+
| --tree-shake [boolean] | Enable tree shaking to remove unused code and reduce the bundle size |
|
|
116
|
+
|
|
117
|
+
<!-- @rnx-kit/cli/bundle end -->
|
|
118
|
+
|
|
119
|
+
## `rnx-cli config`
|
|
120
|
+
|
|
121
|
+
Routes to
|
|
122
|
+
[`react-native config`](https://github.com/react-native-community/cli/blob/main/packages/cli-config#readme).
|
|
123
|
+
|
|
124
|
+
## `rnx-cli doctor`
|
|
125
|
+
|
|
126
|
+
Routes to
|
|
127
|
+
[`react-native doctor`](https://github.com/react-native-community/cli/blob/main/packages/cli-doctor#readme).
|
|
128
|
+
|
|
129
|
+
## `rnx-cli info`
|
|
130
|
+
|
|
131
|
+
Routes to
|
|
132
|
+
[`react-native info`](https://github.com/react-native-community/cli/blob/main/packages/cli-doctor#info).
|
|
133
|
+
|
|
134
|
+
## `rnx-cli build-android`
|
|
135
|
+
|
|
136
|
+
Routes to
|
|
137
|
+
[`react-native build-android`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android#build-android).
|
|
138
|
+
|
|
139
|
+
## `rnx-cli build-ios`
|
|
140
|
+
|
|
141
|
+
Routes to
|
|
142
|
+
[`react-native build-ios`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios#build-ios).
|
|
143
|
+
|
|
144
|
+
## `rnx-cli log-android`
|
|
145
|
+
|
|
146
|
+
Routes to
|
|
147
|
+
[`react-native log-android`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android#log-android).
|
|
148
|
+
|
|
149
|
+
## `rnx-cli log-ios`
|
|
150
|
+
|
|
151
|
+
Routes to
|
|
152
|
+
[`react-native log-ios`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios#log-ios).
|
|
153
|
+
|
|
154
|
+
## `rnx-cli run-android`
|
|
155
|
+
|
|
156
|
+
Routes to
|
|
157
|
+
[`react-native run-android`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android#run-android).
|
|
158
|
+
|
|
159
|
+
## `rnx-cli run-ios`
|
|
160
|
+
|
|
161
|
+
Routes to
|
|
162
|
+
[`react-native run-ios`](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios#run-ios).
|
|
163
|
+
|
|
164
|
+
## `rnx-cli start`
|
|
165
|
+
|
|
166
|
+
Start a bundle server for a package using [Metro][]. The bundle server uses
|
|
167
|
+
optional [configuration][] parameters and command-line overrides.
|
|
168
|
+
|
|
169
|
+
> [!NOTE]
|
|
170
|
+
>
|
|
171
|
+
> This command is meant to be a drop-in replacement for `react-native start`. If
|
|
172
|
+
> `rnx-start` ever becomes widely accepted, we will work on upstreaming it to
|
|
173
|
+
> `@react-native-community/cli`, along with supporting libraries for package
|
|
174
|
+
> configuration and Metro plugins.
|
|
118
175
|
|
|
119
176
|
### Example Commands
|
|
120
177
|
|
|
121
178
|
```sh
|
|
122
|
-
yarn
|
|
179
|
+
yarn rnx-cli start
|
|
123
180
|
```
|
|
124
181
|
|
|
125
182
|
```sh
|
|
126
|
-
yarn
|
|
183
|
+
yarn rnx-cli start --host 127.0.0.1 --port 8812
|
|
127
184
|
```
|
|
128
185
|
|
|
129
186
|
### Example Configuration
|
|
@@ -156,74 +213,91 @@ from the bundle configuration (or its [defaults](#bundle-defaults)).
|
|
|
156
213
|
|
|
157
214
|
### Command-Line Overrides
|
|
158
215
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
| --
|
|
164
|
-
| --
|
|
165
|
-
| --
|
|
166
|
-
| --
|
|
167
|
-
| --
|
|
168
|
-
| --
|
|
169
|
-
| --
|
|
170
|
-
| --
|
|
171
|
-
| --
|
|
172
|
-
| --
|
|
173
|
-
| --
|
|
174
|
-
| --
|
|
175
|
-
| --
|
|
176
|
-
|
|
177
|
-
|
|
216
|
+
<!-- @rnx-kit/cli/start start -->
|
|
217
|
+
|
|
218
|
+
| Option | Description |
|
|
219
|
+
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
220
|
+
| --port <number> | Host port to use when listening for incoming server requests |
|
|
221
|
+
| --host <string> | Host name or address to bind when listening for incoming server requests; when not specified, requests from all addresses are accepted |
|
|
222
|
+
| --project-root <path> | Path to the root of your react-native project; the bundle server uses this path to resolve all web requests |
|
|
223
|
+
| --watch-folders <paths> | Additional folders which will be added to the watched files list, comma-separated; by default, Metro watches all project files |
|
|
224
|
+
| --asset-plugins <list> | Additional asset plugins to be used by Metro's Babel transformer; comma-separated list containing plugin module names or absolute paths to plugin packages |
|
|
225
|
+
| --source-exts <list> | Additional source file extensions to include when generating bundles; comma-separated list, excluding the leading dot |
|
|
226
|
+
| --max-workers <number> | Specifies the maximum number of parallel worker threads to use for transforming files; defaults to the number of cores available on your machine |
|
|
227
|
+
| --reset-cache | Reset the Metro cache |
|
|
228
|
+
| --custom-log-reporter-path <string> | Path to a JavaScript file which exports a Metro 'TerminalReporter' function; replaces the default reporter that writes all messages to the Metro console |
|
|
229
|
+
| --https | Use a secure (https) web server; when not specified, an insecure (http) web server is used |
|
|
230
|
+
| --key <path> | Path to a custom SSL private key file to use for secure (https) communication |
|
|
231
|
+
| --cert <path> | Path to a custom SSL certificate file to use for secure (https) communication |
|
|
232
|
+
| --config <string> | Path to the Metro configuration file |
|
|
233
|
+
| --no-interactive | Disables interactive mode |
|
|
234
|
+
| --id <string> | Specify which bundle configuration to use if server configuration is missing |
|
|
235
|
+
|
|
236
|
+
<!-- @rnx-kit/cli/start end -->
|
|
237
|
+
|
|
238
|
+
## `rnx-cli align-deps`
|
|
178
239
|
|
|
179
240
|
Manage dependencies within a repository and across many repositories.
|
|
180
241
|
|
|
242
|
+
```sh
|
|
243
|
+
yarn rnx-cli align-deps [options] [/path/to/package.json]
|
|
181
244
|
```
|
|
182
|
-
|
|
245
|
+
|
|
246
|
+
Refer to [@rnx-kit/align-deps][] for details.
|
|
247
|
+
|
|
248
|
+
## `rnx-cli clean`
|
|
249
|
+
|
|
250
|
+
Cleans your project by removing React Native related caches and modules.
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
yarn rnx-cli clean [options]
|
|
183
254
|
```
|
|
184
255
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
256
|
+
<!-- @rnx-kit/cli/clean start -->
|
|
257
|
+
|
|
258
|
+
| Option | Description |
|
|
259
|
+
| ----------------------------------------------------------- | -------------------------------------------------------- |
|
|
260
|
+
| --include <android,cocoapods,metro,npm,watchman,yarn> | Comma-separated flag of caches to clear e.g., `npm,yarn` |
|
|
261
|
+
| --project-root <path> | Root path to your React Native project |
|
|
262
|
+
| --verify-cache | Whether to verify the integrity of the cache |
|
|
188
263
|
|
|
189
|
-
|
|
264
|
+
<!-- @rnx-kit/cli/clean end -->
|
|
190
265
|
|
|
191
|
-
|
|
192
|
-
from your package's dependencies.
|
|
266
|
+
## `rnx-cli write-third-party-notices`
|
|
193
267
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
268
|
+
Generate a third-party notice, an aggregation of all the LICENSE files from your
|
|
269
|
+
package's dependencies.
|
|
270
|
+
|
|
271
|
+
> [!NOTE]
|
|
272
|
+
>
|
|
273
|
+
> A third-party notice is a **legal document**. You are solely responsble for
|
|
274
|
+
> its content, even if you use this command to assist you in generating it. You
|
|
275
|
+
> should consult with an attorney to ensure your notice meets all legal
|
|
197
276
|
> requirements.
|
|
198
277
|
|
|
278
|
+
```sh
|
|
279
|
+
yarn rnx-cli write-third-party-notices [options]
|
|
199
280
|
```
|
|
200
|
-
$ yarn react-native rnx-write-third-party-notices [options]
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
| Option | Description |
|
|
204
|
-
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
|
-
| --root-path [path] | The root of the repo. This is the starting point for finding each module in the source map dependency graph. |
|
|
206
|
-
| --source-map-file [file] | The source map file associated with the package's entry file. This source map eventually leads to all package dependencies and their licenses. |
|
|
207
|
-
| --json | Format the 3rd-party notice file as JSON instead of text. |
|
|
208
|
-
| --output-file [file] | The path to use when writing the 3rd-party notice file. |
|
|
209
|
-
| --ignore-scopes [string] | Comma-separated list of `npm` scopes to ignore when traversing the source map dependency graph. |
|
|
210
|
-
| --ignore-modules [string] | Comma-separated list of modules to ignore when traversing the source map dependency graph. |
|
|
211
|
-
| --preamble-text [string] | A string to prepend to the start of the 3rd-party notice. |
|
|
212
|
-
| --additional-text [path] | A string to append to the end of the 3rd-party notice. |
|
|
213
281
|
|
|
214
|
-
|
|
282
|
+
<!-- @rnx-kit/cli/write-third-party-notices start -->
|
|
215
283
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
284
|
+
| Option | Description |
|
|
285
|
+
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
286
|
+
| --root-path <path> | The root of the repo — the starting point for finding each module in the source map dependency graph |
|
|
287
|
+
| --source-map-file <file> | The source map file associated with the package's entry file — this source map eventually leads to all package dependencies and their licenses |
|
|
288
|
+
| --json | Format the 3rd-party notice file as JSON instead of text |
|
|
289
|
+
| --output-file <file> | The path to use when writing the 3rd-party notice file |
|
|
290
|
+
| --ignore-scopes <string> | Comma-separated list of npm scopes to ignore when traversing the source map dependency graph |
|
|
291
|
+
| --ignore-modules <string> | Comma-separated list of modules to ignore when traversing the source map dependency graph |
|
|
292
|
+
| --preamble-text <string> | A string to prepend to the start of the 3rd-party notice |
|
|
293
|
+
| --additional-text <string> | A string to append to the end of the 3rd-party notice |
|
|
219
294
|
|
|
220
|
-
|
|
295
|
+
<!-- @rnx-kit/cli/write-third-party-notices end -->
|
|
221
296
|
|
|
222
|
-
|
|
223
|
-
$ yarn react-native rnx-clean [options]
|
|
224
|
-
```
|
|
297
|
+
<!-- References -->
|
|
225
298
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
299
|
+
[@rnx-kit/align-deps]:
|
|
300
|
+
https://github.com/microsoft/rnx-kit/tree/main/packages/align-deps#readme
|
|
301
|
+
[Metro]: https://facebook.github.io/metro
|
|
302
|
+
[configuration]:
|
|
303
|
+
https://github.com/microsoft/rnx-kit/tree/main/packages/config#readme
|
package/bin/rnx-cli.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Command as BaseCommand, Config as BaseConfig } from "@react-native-community/cli-types";
|
|
2
|
+
type Command = BaseCommand<false> | BaseCommand<true>;
|
|
3
|
+
type Config = BaseConfig & {
|
|
4
|
+
__rnxFastPath?: true;
|
|
5
|
+
commands: Command[];
|
|
6
|
+
};
|
|
7
|
+
export declare function getCoreCommands(): {
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
detached?: false | undefined;
|
|
11
|
+
examples?: Array<{
|
|
12
|
+
desc: string;
|
|
13
|
+
cmd: string;
|
|
14
|
+
}>;
|
|
15
|
+
pkg?: {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
19
|
+
func: import("@react-native-community/cli-types").CommandFunction<Object>;
|
|
20
|
+
options?: import("@react-native-community/cli-types").CommandOption<(ctx: BaseConfig) => import("@react-native-community/cli-types").OptionValue>[] | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
export declare function uniquify(commands: Command[]): Command[];
|
|
23
|
+
export declare function loadContext(userCommand: string, root?: string): Config;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCoreCommands = getCoreCommands;
|
|
4
|
+
exports.uniquify = uniquify;
|
|
5
|
+
exports.loadContext = loadContext;
|
|
6
|
+
const package_1 = require("@rnx-kit/tools-node/package");
|
|
7
|
+
const cache_1 = require("@rnx-kit/tools-react-native/cache");
|
|
8
|
+
const context_1 = require("@rnx-kit/tools-react-native/context");
|
|
9
|
+
const index_1 = require("../index");
|
|
10
|
+
const RNX_PREFIX = "rnx-";
|
|
11
|
+
function findReactNativePath(root, resolveSymlinks = false) {
|
|
12
|
+
const dir = (0, package_1.findPackageDependencyDir)("react-native", {
|
|
13
|
+
startDir: root,
|
|
14
|
+
resolveSymlinks,
|
|
15
|
+
});
|
|
16
|
+
if (!dir) {
|
|
17
|
+
throw new Error("Unable to resolve module 'react-native'");
|
|
18
|
+
}
|
|
19
|
+
return dir;
|
|
20
|
+
}
|
|
21
|
+
function getCoreCommands() {
|
|
22
|
+
const start = RNX_PREFIX.length;
|
|
23
|
+
return index_1.reactNativeConfig.commands.map((command) => ({
|
|
24
|
+
...command,
|
|
25
|
+
name: command.name.substring(start),
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function uniquify(commands) {
|
|
29
|
+
const uniqueCommands = {};
|
|
30
|
+
for (const command of commands) {
|
|
31
|
+
const { name } = command;
|
|
32
|
+
if (name.startsWith(RNX_PREFIX)) {
|
|
33
|
+
command.name = name.substring(RNX_PREFIX.length);
|
|
34
|
+
uniqueCommands[command.name] = command;
|
|
35
|
+
}
|
|
36
|
+
else if (!uniqueCommands[name]) {
|
|
37
|
+
uniqueCommands[name] = command;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return Object.values(uniqueCommands);
|
|
41
|
+
}
|
|
42
|
+
function loadContext(userCommand, root = process.cwd()) {
|
|
43
|
+
// The fast path avoids traversing project dependencies because we know what
|
|
44
|
+
// information our commands depend on.
|
|
45
|
+
const coreCommands = getCoreCommands();
|
|
46
|
+
const useFastPath = coreCommands.some(({ name }) => name === userCommand);
|
|
47
|
+
if (useFastPath) {
|
|
48
|
+
let reactNativePath;
|
|
49
|
+
let reactNativeVersion;
|
|
50
|
+
return {
|
|
51
|
+
__rnxFastPath: true,
|
|
52
|
+
root,
|
|
53
|
+
get reactNativePath() {
|
|
54
|
+
if (!reactNativePath) {
|
|
55
|
+
reactNativePath = findReactNativePath(root);
|
|
56
|
+
}
|
|
57
|
+
return reactNativePath;
|
|
58
|
+
},
|
|
59
|
+
get reactNativeVersion() {
|
|
60
|
+
if (!reactNativeVersion) {
|
|
61
|
+
const reactNativePath = findReactNativePath(root);
|
|
62
|
+
const { version } = (0, package_1.readPackage)(reactNativePath);
|
|
63
|
+
reactNativeVersion = version;
|
|
64
|
+
}
|
|
65
|
+
return reactNativeVersion;
|
|
66
|
+
},
|
|
67
|
+
get dependencies() {
|
|
68
|
+
throw new Error("Unexpected access to `dependencies`");
|
|
69
|
+
},
|
|
70
|
+
commands: coreCommands,
|
|
71
|
+
get healthChecks() {
|
|
72
|
+
throw new Error("Unexpected access to `healthChecks`");
|
|
73
|
+
},
|
|
74
|
+
get platforms() {
|
|
75
|
+
throw new Error("Unexpected access to `platforms`");
|
|
76
|
+
},
|
|
77
|
+
get project() {
|
|
78
|
+
throw new Error("Unexpected access to `project`");
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const rncli = (0, context_1.resolveCommunityCLI)(root);
|
|
83
|
+
const { loadConfig } = require(rncli);
|
|
84
|
+
const config = loadConfig.length === 1
|
|
85
|
+
? loadConfig({ projectRoot: root })
|
|
86
|
+
: loadConfig(root);
|
|
87
|
+
// We will always load from disk because functions cannot be serialized.
|
|
88
|
+
// However, we should refresh the cache if needed.
|
|
89
|
+
const state = (0, cache_1.getCurrentState)(root);
|
|
90
|
+
if (state !== (0, cache_1.getSavedState)(root)) {
|
|
91
|
+
(0, cache_1.saveConfigToCache)(root, state, config);
|
|
92
|
+
}
|
|
93
|
+
// Before returning the config, remove the `rnx-` prefix from our commands,
|
|
94
|
+
// and ensure commands are unique.
|
|
95
|
+
config.commands = uniquify(config.commands);
|
|
96
|
+
return config;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findExternalCommands = findExternalCommands;
|
|
4
|
+
const context_1 = require("@rnx-kit/tools-react-native/context");
|
|
5
|
+
function tryImport(module, fromDir) {
|
|
6
|
+
try {
|
|
7
|
+
const p = require.resolve(module, { paths: [fromDir] });
|
|
8
|
+
return require(p);
|
|
9
|
+
}
|
|
10
|
+
catch (_) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function findExternalCommands(config) {
|
|
15
|
+
if ("__rnxFastPath" in config) {
|
|
16
|
+
// Fast path means we don't need to do anything here
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const externalCommands = [
|
|
20
|
+
{
|
|
21
|
+
name: "config",
|
|
22
|
+
description: "Prints the configuration for the project and its dependencies in JSON format; used by autolinking",
|
|
23
|
+
func: () => console.log(JSON.stringify(config, undefined, 2)),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
const rncli = (0, context_1.resolveCommunityCLI)(config.root);
|
|
27
|
+
const cliDoctor = tryImport("@react-native-community/cli-doctor", rncli);
|
|
28
|
+
if (cliDoctor === null || cliDoctor === void 0 ? void 0 : cliDoctor.commands) {
|
|
29
|
+
const commands = Object.values(cliDoctor.commands);
|
|
30
|
+
externalCommands.push(...commands);
|
|
31
|
+
}
|
|
32
|
+
return externalCommands;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=externalCommands.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
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.main = main;
|
|
27
|
+
const commander_1 = require("commander");
|
|
28
|
+
const path = __importStar(require("node:path"));
|
|
29
|
+
const context_1 = require("./context");
|
|
30
|
+
const externalCommands_1 = require("./externalCommands");
|
|
31
|
+
function main() {
|
|
32
|
+
const [, , userCommand] = process.argv;
|
|
33
|
+
const context = (0, context_1.loadContext)(userCommand);
|
|
34
|
+
const allCommands = context.commands.concat((0, externalCommands_1.findExternalCommands)(context));
|
|
35
|
+
const program = new commander_1.Command(path.basename(__filename, ".js"));
|
|
36
|
+
for (const { name, description, detached, options = [], func, } of allCommands) {
|
|
37
|
+
const command = program.command(name).description(description !== null && description !== void 0 ? description : name);
|
|
38
|
+
if (detached) {
|
|
39
|
+
command.action((args, command) => func(command.args, args, context));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
command.action((args, command) => func(command.args, context, args));
|
|
43
|
+
}
|
|
44
|
+
for (const { name, description, parse, default: def } of options) {
|
|
45
|
+
if (parse) {
|
|
46
|
+
command.option(name, description !== null && description !== void 0 ? description : name, (input) => parse(input), def);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
command.option(name, description, def === null || def === void 0 ? void 0 : def.toString());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
program.parse();
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=rnx-cli.js.map
|
package/lib/bundle/hermes.js
CHANGED
|
@@ -27,10 +27,10 @@ exports.emitBytecode = emitBytecode;
|
|
|
27
27
|
const console_1 = require("@rnx-kit/console");
|
|
28
28
|
const package_1 = require("@rnx-kit/tools-node/package");
|
|
29
29
|
const metro_1 = require("@rnx-kit/tools-react-native/metro");
|
|
30
|
-
const
|
|
31
|
-
const fs = __importStar(require("fs"));
|
|
32
|
-
const os = __importStar(require("os"));
|
|
33
|
-
const path = __importStar(require("path"));
|
|
30
|
+
const node_child_process_1 = require("node:child_process");
|
|
31
|
+
const fs = __importStar(require("node:fs"));
|
|
32
|
+
const os = __importStar(require("node:os"));
|
|
33
|
+
const path = __importStar(require("node:path"));
|
|
34
34
|
function hermesBinaryInDir(hermesc) {
|
|
35
35
|
switch (os.platform()) {
|
|
36
36
|
case "darwin":
|
|
@@ -97,7 +97,7 @@ function emitBytecode(cliConfig, input, sourcemap, options) {
|
|
|
97
97
|
}
|
|
98
98
|
args.push(input);
|
|
99
99
|
(0, console_1.info)("Emitting bytecode to:", output);
|
|
100
|
-
const result = (0,
|
|
100
|
+
const result = (0, node_child_process_1.spawnSync)(cmd, args, { stdio: "inherit" });
|
|
101
101
|
if (result.status !== 0) {
|
|
102
102
|
throw result.error;
|
|
103
103
|
}
|
package/lib/bundle/metro.js
CHANGED
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.metroBundle = metroBundle;
|
|
27
27
|
const console_1 = require("@rnx-kit/console");
|
|
28
28
|
const metro_service_1 = require("@rnx-kit/metro-service");
|
|
29
|
-
const path = __importStar(require("path"));
|
|
29
|
+
const path = __importStar(require("node:path"));
|
|
30
30
|
const filesystem_1 = require("../helpers/filesystem");
|
|
31
31
|
const metro_config_1 = require("../helpers/metro-config");
|
|
32
32
|
/**
|
package/lib/clean.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { asResolvedPath } from "./helpers/parsers";
|
|
|
3
3
|
type Args = {
|
|
4
4
|
include?: string;
|
|
5
5
|
projectRoot?: string;
|
|
6
|
-
|
|
6
|
+
verifyCache?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function rnxClean(_argv: string[], { root }: CLIConfig, cliOptions: Args): Promise<void>;
|
|
9
9
|
export declare const rnxCleanCommand: {
|