@react-native/community-cli-plugin 0.73.0 → 0.73.3

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 (42) hide show
  1. package/README.md +7 -3
  2. package/dist/commands/bundle/assetCatalogIOS.js.flow +9 -57
  3. package/dist/commands/bundle/assetPathUtils.js.flow +12 -66
  4. package/dist/commands/bundle/buildBundle.js +16 -7
  5. package/dist/commands/bundle/buildBundle.js.flow +39 -95
  6. package/dist/commands/bundle/filterPlatformAssetScales.js.flow +5 -33
  7. package/dist/commands/bundle/getAssetDestPathAndroid.js.flow +7 -14
  8. package/dist/commands/bundle/getAssetDestPathIOS.js.flow +7 -16
  9. package/dist/commands/bundle/index.js +124 -0
  10. package/dist/commands/bundle/index.js.flow +18 -0
  11. package/dist/commands/bundle/saveAssets.js +1 -1
  12. package/dist/commands/bundle/saveAssets.js.flow +6 -124
  13. package/dist/commands/{bundle/ramBundle.js → ram-bundle/index.js} +17 -19
  14. package/dist/commands/ram-bundle/index.js.flow +15 -0
  15. package/dist/commands/start/attachKeyHandlers.js +109 -0
  16. package/dist/commands/start/attachKeyHandlers.js.flow +22 -0
  17. package/dist/commands/start/index.js +3 -8
  18. package/dist/commands/start/index.js.flow +6 -85
  19. package/dist/commands/start/runServer.js +82 -32
  20. package/dist/commands/start/runServer.js.flow +9 -127
  21. package/dist/index.flow.js +2 -2
  22. package/dist/index.flow.js.flow +5 -5
  23. package/dist/index.js.flow +1 -9
  24. package/dist/utils/KeyPressHandler.js +91 -0
  25. package/dist/utils/KeyPressHandler.js.flow +22 -0
  26. package/dist/utils/isDevServerRunning.js +74 -0
  27. package/dist/utils/isDevServerRunning.js.flow +27 -0
  28. package/dist/utils/loadMetroConfig.js +6 -7
  29. package/dist/utils/loadMetroConfig.js.flow +10 -102
  30. package/dist/utils/metroPlatformResolver.js.flow +4 -18
  31. package/package.json +11 -9
  32. package/dist/commands/bundle/bundle.js +0 -44
  33. package/dist/commands/bundle/bundle.js.flow +0 -37
  34. package/dist/commands/bundle/bundleCommandLineArgs.js +0 -116
  35. package/dist/commands/bundle/bundleCommandLineArgs.js.flow +0 -129
  36. package/dist/commands/bundle/ramBundle.js.flow +0 -43
  37. package/dist/commands/start/startServerInNewWindow.js +0 -132
  38. package/dist/commands/start/startServerInNewWindow.js.flow +0 -125
  39. package/dist/commands/start/watchMode.js +0 -95
  40. package/dist/commands/start/watchMode.js.flow +0 -101
  41. package/launchPackager.bat +0 -7
  42. package/launchPackager.command +0 -10
package/README.md CHANGED
@@ -15,7 +15,7 @@ Start the React Native development server.
15
15
  #### Usage
16
16
 
17
17
  ```sh
18
- react-native start [options]
18
+ npx react-native start [options]
19
19
  ```
20
20
 
21
21
  #### Options
@@ -45,7 +45,7 @@ Build the bundle for the provided JavaScript entry file.
45
45
  #### Usage
46
46
 
47
47
  ```sh
48
- react-native bundle --entry-file <path> [options]
48
+ npx react-native bundle --entry-file <path> [options]
49
49
  ```
50
50
 
51
51
  #### Options
@@ -75,7 +75,7 @@ Build the [RAM bundle](https://reactnative.dev/docs/ram-bundles-inline-requires)
75
75
  #### Usage
76
76
 
77
77
  ```sh
78
- react-native ram-bundle --entry-file <path> [options]
78
+ npx react-native ram-bundle --entry-file <path> [options]
79
79
  ```
80
80
 
81
81
  #### Options
@@ -85,3 +85,7 @@ Accepts all options supported by [`bundle`](#bundle) and the following:
85
85
  | Option | Description |
86
86
  | - | - |
87
87
  | `--indexed-ram-bundle` | Force the "Indexed RAM" bundle file format, even when building for Android. |
88
+
89
+ ## Contributing
90
+
91
+ Changes to this package can be made locally and tested against the `rn-tester` app, per the [Contributing guide](https://reactnative.dev/contributing/overview#contributing-code). During development, this package is automatically run from source with no build step.
@@ -4,74 +4,26 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {AssetData} from 'metro/src/Assets';
12
+ import type { AssetData } from "metro/src/Assets";
13
13
 
14
- import path from 'path';
15
- import fs from 'fs';
16
- import assetPathUtils from './assetPathUtils';
17
-
18
- export function cleanAssetCatalog(catalogDir: string): void {
19
- const files = fs
20
- .readdirSync(catalogDir)
21
- .filter(file => file.endsWith('.imageset'));
22
- for (const file of files) {
23
- fs.rmSync(path.join(catalogDir, file));
24
- }
25
- }
14
+ declare export function cleanAssetCatalog(catalogDir: string): void;
26
15
 
27
16
  type ImageSet = {
28
17
  basePath: string,
29
- files: {name: string, src: string, scale: number}[],
18
+ files: { name: string, src: string, scale: number }[],
30
19
  };
31
20
 
32
- export function getImageSet(
21
+ declare export function getImageSet(
33
22
  catalogDir: string,
34
23
  asset: AssetData,
35
- scales: $ReadOnlyArray<number>,
36
- ): ImageSet {
37
- const fileName = assetPathUtils.getResourceIdentifier(asset);
38
- return {
39
- basePath: path.join(catalogDir, `${fileName}.imageset`),
40
- files: scales.map((scale, idx) => {
41
- const suffix = scale === 1 ? '' : `@${scale}x`;
42
- return {
43
- name: `${fileName + suffix}.${asset.type}`,
44
- scale,
45
- src: asset.files[idx],
46
- };
47
- }),
48
- };
49
- }
50
-
51
- export function isCatalogAsset(asset: AssetData): boolean {
52
- return asset.type === 'png' || asset.type === 'jpg' || asset.type === 'jpeg';
53
- }
54
-
55
- export function writeImageSet(imageSet: ImageSet): void {
56
- fs.mkdirSync(imageSet.basePath, {recursive: true});
24
+ scales: $ReadOnlyArray<number>
25
+ ): ImageSet;
57
26
 
58
- for (const file of imageSet.files) {
59
- const dest = path.join(imageSet.basePath, file.name);
60
- fs.copyFileSync(file.src, dest);
61
- }
27
+ declare export function isCatalogAsset(asset: AssetData): boolean;
62
28
 
63
- fs.writeFileSync(
64
- path.join(imageSet.basePath, 'Contents.json'),
65
- JSON.stringify({
66
- images: imageSet.files.map(file => ({
67
- filename: file.name,
68
- idiom: 'universal',
69
- scale: `${file.scale}x`,
70
- })),
71
- info: {
72
- author: 'xcode',
73
- version: 1,
74
- },
75
- }),
76
- );
77
- }
29
+ declare export function writeImageSet(imageSet: ImageSet): void;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
@@ -20,74 +20,20 @@ export type PackagerAsset = $ReadOnly<{
20
20
  * FIXME: using number to represent discrete scale numbers is fragile in essence because of
21
21
  * floating point numbers imprecision.
22
22
  */
23
- function getAndroidAssetSuffix(scale: number): string {
24
- switch (scale) {
25
- case 0.75:
26
- return 'ldpi';
27
- case 1:
28
- return 'mdpi';
29
- case 1.5:
30
- return 'hdpi';
31
- case 2:
32
- return 'xhdpi';
33
- case 3:
34
- return 'xxhdpi';
35
- case 4:
36
- return 'xxxhdpi';
37
- default:
38
- return '';
39
- }
40
- }
23
+ declare function getAndroidAssetSuffix(scale: number): string;
41
24
 
42
- // See https://developer.android.com/guide/topics/resources/drawable-resource.html
43
- const drawableFileTypes = new Set<string>([
44
- 'gif',
45
- 'jpeg',
46
- 'jpg',
47
- 'png',
48
- 'webp',
49
- 'xml',
50
- ]);
51
-
52
- function getAndroidResourceFolderName(
25
+ declare function getAndroidResourceFolderName(
53
26
  asset: PackagerAsset,
54
- scale: number,
55
- ): string {
56
- if (!drawableFileTypes.has(asset.type)) {
57
- return 'raw';
58
- }
59
- const suffix = getAndroidAssetSuffix(scale);
60
- if (!suffix) {
61
- throw new Error(
62
- `Don't know which android drawable suffix to use for asset: ${JSON.stringify(
63
- asset,
64
- )}`,
65
- );
66
- }
67
- const androidFolder = `drawable-${suffix}`;
68
- return androidFolder;
69
- }
27
+ scale: number
28
+ ): string;
70
29
 
71
- function getResourceIdentifier(asset: PackagerAsset): string {
72
- const folderPath = getBasePath(asset);
73
- return `${folderPath}/${asset.name}`
74
- .toLowerCase()
75
- .replace(/\//g, '_') // Encode folder structure in file name
76
- .replace(/([^a-z0-9_])/g, '') // Remove illegal chars
77
- .replace(/^assets_/, ''); // Remove "assets_" prefix
78
- }
30
+ declare function getResourceIdentifier(asset: PackagerAsset): string;
79
31
 
80
- function getBasePath(asset: PackagerAsset): string {
81
- let basePath = asset.httpServerLocation;
82
- if (basePath[0] === '/') {
83
- basePath = basePath.substr(1);
84
- }
85
- return basePath;
86
- }
32
+ declare function getBasePath(asset: PackagerAsset): string;
87
33
 
88
- export default {
89
- getAndroidAssetSuffix,
90
- getAndroidResourceFolderName,
91
- getResourceIdentifier,
92
- getBasePath,
34
+ declare export default {
35
+ getAndroidAssetSuffix: getAndroidAssetSuffix,
36
+ getAndroidResourceFolderName: getAndroidResourceFolderName,
37
+ getResourceIdentifier: getResourceIdentifier,
38
+ getBasePath: getBasePath,
93
39
  };
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.unstable_buildBundleWithConfig = exports.default = void 0;
7
7
  var _Server = _interopRequireDefault(require("metro/src/Server"));
8
+ var _bundle = _interopRequireDefault(require("metro/src/shared/output/bundle"));
9
+ var _RamBundle = _interopRequireDefault(
10
+ require("metro/src/shared/output/RamBundle")
11
+ );
8
12
  var _path = _interopRequireDefault(require("path"));
9
13
  var _chalk = _interopRequireDefault(require("chalk"));
10
14
  var _saveAssets = _interopRequireDefault(require("./saveAssets"));
@@ -26,16 +30,19 @@ function _interopRequireDefault(obj) {
26
30
  * @oncall react_native
27
31
  */
28
32
 
29
- const outputBundle = require("metro/src/shared/output/bundle");
30
- async function buildBundle(args, ctx, output = outputBundle) {
33
+ async function buildBundle(_argv, ctx, args, bundleImpl = _bundle.default) {
31
34
  const config = await (0, _loadMetroConfig.default)(ctx, {
32
35
  maxWorkers: args.maxWorkers,
33
36
  resetCache: args.resetCache,
34
37
  config: args.config,
35
38
  });
36
- return buildBundleWithConfig(args, config, output);
39
+ return buildBundleWithConfig(args, config, bundleImpl);
37
40
  }
38
- async function buildBundleWithConfig(args, config, output = outputBundle) {
41
+ async function buildBundleWithConfig(
42
+ args,
43
+ config,
44
+ bundleImpl = _bundle.default
45
+ ) {
39
46
  if (config.resolver.platforms.indexOf(args.platform) === -1) {
40
47
  _cliTools.logger.error(
41
48
  `Invalid platform ${
@@ -56,7 +63,7 @@ async function buildBundleWithConfig(args, config, output = outputBundle) {
56
63
  // have other choice than defining it as an env variable here.
57
64
  process.env.NODE_ENV = args.dev ? "development" : "production";
58
65
  let sourceMapUrl = args.sourcemapOutput;
59
- if (sourceMapUrl && !args.sourcemapUseAbsolutePath) {
66
+ if (sourceMapUrl != null && !args.sourcemapUseAbsolutePath) {
60
67
  sourceMapUrl = _path.default.basename(sourceMapUrl);
61
68
  }
62
69
 
@@ -71,11 +78,13 @@ async function buildBundleWithConfig(args, config, output = outputBundle) {
71
78
  };
72
79
  const server = new _Server.default(config);
73
80
  try {
74
- const bundle = await output.build(server, requestOpts);
81
+ const bundle = await bundleImpl.build(server, requestOpts);
75
82
 
76
83
  // $FlowIgnore[class-object-subtyping]
77
84
  // $FlowIgnore[incompatible-call]
78
- await output.save(bundle, args, _cliTools.logger.info);
85
+ // $FlowIgnore[prop-missing]
86
+ // $FlowIgnore[incompatible-exact]
87
+ await bundleImpl.save(bundle, args, _cliTools.logger.info);
79
88
 
80
89
  // Save the assets of the bundle
81
90
  const outputAssets = await server.getAssets({
@@ -4,106 +4,50 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {Config} from '@react-native-community/cli-types';
13
- import type {RequestOptions} from 'metro/src/shared/types.flow';
14
- import type {ConfigT} from 'metro-config';
15
- import type {CommandLineArgs} from './bundleCommandLineArgs';
16
-
17
- import Server from 'metro/src/Server';
18
- const outputBundle = require('metro/src/shared/output/bundle');
19
- import path from 'path';
20
- import chalk from 'chalk';
21
- import saveAssets from './saveAssets';
22
- import {default as loadMetroConfig} from '../../utils/loadMetroConfig';
23
- import {logger} from '@react-native-community/cli-tools';
24
-
25
- async function buildBundle(
26
- args: CommandLineArgs,
12
+ import type { Config } from "@react-native-community/cli-types";
13
+ import type { ConfigT } from "metro-config";
14
+
15
+ import metroBundle from "metro/src/shared/output/bundle";
16
+ import metroRamBundle from "metro/src/shared/output/RamBundle";
17
+ export type BundleCommandArgs = {
18
+ assetsDest?: string,
19
+ assetCatalogDest?: string,
20
+ entryFile: string,
21
+ resetCache: boolean,
22
+ resetGlobalCache: boolean,
23
+ transformer?: string,
24
+ minify?: boolean,
25
+ config?: string,
26
+ platform: string,
27
+ dev: boolean,
28
+ bundleOutput: string,
29
+ bundleEncoding?: "utf8" | "utf16le" | "ascii",
30
+ maxWorkers?: number,
31
+ sourcemapOutput?: string,
32
+ sourcemapSourcesRoot?: string,
33
+ sourcemapUseAbsolutePath: boolean,
34
+ verbose: boolean,
35
+ unstableTransformProfile: string,
36
+ indexedRamBundle?: boolean,
37
+ };
38
+
39
+ declare function buildBundle(
40
+ _argv: Array<string>,
27
41
  ctx: Config,
28
- output: typeof outputBundle = outputBundle,
29
- ): Promise<void> {
30
- const config = await loadMetroConfig(ctx, {
31
- maxWorkers: args.maxWorkers,
32
- resetCache: args.resetCache,
33
- config: args.config,
34
- });
35
-
36
- return buildBundleWithConfig(args, config, output);
37
- }
42
+ args: BundleCommandArgs,
43
+ bundleImpl: typeof metroBundle | typeof metroRamBundle
44
+ ): Promise<void>;
38
45
 
39
- async function buildBundleWithConfig(
40
- args: CommandLineArgs,
46
+ declare function buildBundleWithConfig(
47
+ args: BundleCommandArgs,
41
48
  config: ConfigT,
42
- output: typeof outputBundle = outputBundle,
43
- ): Promise<void> {
44
- if (config.resolver.platforms.indexOf(args.platform) === -1) {
45
- logger.error(
46
- `Invalid platform ${
47
- args.platform ? `"${chalk.bold(args.platform)}" ` : ''
48
- }selected.`,
49
- );
50
-
51
- logger.info(
52
- `Available platforms are: ${config.resolver.platforms
53
- .map(x => `"${chalk.bold(x)}"`)
54
- .join(
55
- ', ',
56
- )}. If you are trying to bundle for an out-of-tree platform, it may not be installed.`,
57
- );
58
-
59
- throw new Error('Bundling failed');
60
- }
61
-
62
- // This is used by a bazillion of npm modules we don't control so we don't
63
- // have other choice than defining it as an env variable here.
64
- process.env.NODE_ENV = args.dev ? 'development' : 'production';
65
-
66
- let sourceMapUrl = args.sourcemapOutput;
67
- if (sourceMapUrl && !args.sourcemapUseAbsolutePath) {
68
- sourceMapUrl = path.basename(sourceMapUrl);
69
- }
70
-
71
- // $FlowIgnore[prop-missing]
72
- const requestOpts: RequestOptions & {...} = {
73
- entryFile: args.entryFile,
74
- sourceMapUrl,
75
- dev: args.dev,
76
- minify: args.minify !== undefined ? args.minify : !args.dev,
77
- platform: args.platform,
78
- unstable_transformProfile: args.unstableTransformProfile,
79
- };
80
- const server = new Server(config);
81
-
82
- try {
83
- const bundle = await output.build(server, requestOpts);
84
-
85
- // $FlowIgnore[class-object-subtyping]
86
- // $FlowIgnore[incompatible-call]
87
- await output.save(bundle, args, logger.info);
88
-
89
- // Save the assets of the bundle
90
- const outputAssets = await server.getAssets({
91
- ...Server.DEFAULT_BUNDLE_OPTIONS,
92
- ...requestOpts,
93
- bundleType: 'todo',
94
- });
95
-
96
- // When we're done saving bundle output and the assets, we're done.
97
- return await saveAssets(
98
- outputAssets,
99
- args.platform,
100
- args.assetsDest,
101
- args.assetCatalogDest,
102
- );
103
- } finally {
104
- server.end();
105
- }
106
- }
49
+ bundleImpl: typeof metroBundle | typeof metroRamBundle
50
+ ): Promise<void>;
107
51
 
108
52
  /**
109
53
  * UNSTABLE: This function is likely to be relocated and its API changed in
@@ -115,6 +59,6 @@ async function buildBundleWithConfig(
115
59
  * re-used for several bundling calls if multiple platforms are being
116
60
  * bundled.
117
61
  */
118
- export const unstable_buildBundleWithConfig = buildBundleWithConfig;
62
+ declare export const unstable_buildBundleWithConfig: buildBundleWithConfig;
119
63
 
120
- export default buildBundle;
64
+ declare export default buildBundle;
@@ -4,42 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- const ALLOWED_SCALES: {[key: string]: number[]} = {
13
- ios: [1, 2, 3],
14
- };
15
-
16
- function filterPlatformAssetScales(
12
+ declare function filterPlatformAssetScales(
17
13
  platform: string,
18
- scales: $ReadOnlyArray<number>,
19
- ): $ReadOnlyArray<number> {
20
- const whitelist: number[] = ALLOWED_SCALES[platform];
21
- if (!whitelist) {
22
- return scales;
23
- }
24
- const result = scales.filter(scale => whitelist.indexOf(scale) > -1);
25
- if (result.length === 0 && scales.length > 0) {
26
- // No matching scale found, but there are some available. Ideally we don't
27
- // want to be in this situation and should throw, but for now as a fallback
28
- // let's just use the closest larger image
29
- const maxScale = whitelist[whitelist.length - 1];
30
- for (const scale of scales) {
31
- if (scale > maxScale) {
32
- result.push(scale);
33
- break;
34
- }
35
- }
36
-
37
- // There is no larger scales available, use the largest we have
38
- if (result.length === 0) {
39
- result.push(scales[scales.length - 1]);
40
- }
41
- }
42
- return result;
43
- }
14
+ scales: $ReadOnlyArray<number>
15
+ ): $ReadOnlyArray<number>;
44
16
 
45
- export default filterPlatformAssetScales;
17
+ declare export default filterPlatformAssetScales;
@@ -4,23 +4,16 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {PackagerAsset} from './assetPathUtils';
12
+ import type { PackagerAsset } from "./assetPathUtils";
13
13
 
14
- import path from 'path';
15
- import assetPathUtils from './assetPathUtils';
14
+ declare function getAssetDestPathAndroid(
15
+ asset: PackagerAsset,
16
+ scale: number
17
+ ): string;
16
18
 
17
- function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string {
18
- const androidFolder = assetPathUtils.getAndroidResourceFolderName(
19
- asset,
20
- scale,
21
- );
22
- const fileName = assetPathUtils.getResourceIdentifier(asset);
23
- return path.join(androidFolder, `${fileName}.${asset.type}`);
24
- }
25
-
26
- export default getAssetDestPathAndroid;
19
+ declare export default getAssetDestPathAndroid;
@@ -4,25 +4,16 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
- import type {PackagerAsset} from './assetPathUtils';
12
+ import type { PackagerAsset } from "./assetPathUtils";
13
13
 
14
- import path from 'path';
14
+ declare function getAssetDestPathIOS(
15
+ asset: PackagerAsset,
16
+ scale: number
17
+ ): string;
15
18
 
16
- function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string {
17
- const suffix = scale === 1 ? '' : `@${scale}x`;
18
- const fileName = `${asset.name + suffix}.${asset.type}`;
19
- return path.join(
20
- // Assets can have relative paths outside of the project root.
21
- // Replace `../` with `_` to make sure they don't end up outside of
22
- // the expected assets directory.
23
- asset.httpServerLocation.substr(1).replace(/\.\.\//g, '_'),
24
- fileName,
25
- );
26
- }
27
-
28
- export default getAssetDestPathIOS;
19
+ declare export default getAssetDestPathIOS;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = void 0;
7
+ var _path = _interopRequireDefault(require("path"));
8
+ var _buildBundle = _interopRequireDefault(require("./buildBundle"));
9
+ function _interopRequireDefault(obj) {
10
+ return obj && obj.__esModule ? obj : { default: obj };
11
+ }
12
+ /**
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ *
19
+ * @format
20
+ * @oncall react_native
21
+ */
22
+
23
+ const bundleCommand = {
24
+ name: "bundle",
25
+ description: "Build the bundle for the provided JavaScript entry file.",
26
+ func: _buildBundle.default,
27
+ options: [
28
+ {
29
+ name: "--entry-file <path>",
30
+ description:
31
+ "Path to the root JS file, either absolute or relative to JS root",
32
+ },
33
+ {
34
+ name: "--platform <string>",
35
+ description: 'Either "ios" or "android"',
36
+ default: "ios",
37
+ },
38
+ {
39
+ name: "--transformer <string>",
40
+ description: "Specify a custom transformer to be used",
41
+ },
42
+ {
43
+ name: "--dev [boolean]",
44
+ description: "If false, warnings are disabled and the bundle is minified",
45
+ parse: (val) => val !== "false",
46
+ default: true,
47
+ },
48
+ {
49
+ name: "--minify [boolean]",
50
+ description:
51
+ "Allows overriding whether bundle is minified. This defaults to " +
52
+ "false if dev is true, and true if dev is false. Disabling minification " +
53
+ "can be useful for speeding up production builds for testing purposes.",
54
+ parse: (val) => val !== "false",
55
+ },
56
+ {
57
+ name: "--bundle-output <string>",
58
+ description:
59
+ "File name where to store the resulting bundle, ex. /tmp/groups.bundle",
60
+ },
61
+ {
62
+ name: "--bundle-encoding <string>",
63
+ description:
64
+ "Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).",
65
+ default: "utf8",
66
+ },
67
+ {
68
+ name: "--max-workers <number>",
69
+ description:
70
+ "Specifies the maximum number of workers the worker-pool " +
71
+ "will spawn for transforming files. This defaults to the number of the " +
72
+ "cores available on your machine.",
73
+ parse: (workers) => Number(workers),
74
+ },
75
+ {
76
+ name: "--sourcemap-output <string>",
77
+ description:
78
+ "File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map",
79
+ },
80
+ {
81
+ name: "--sourcemap-sources-root <string>",
82
+ description:
83
+ "Path to make sourcemap's sources entries relative to, ex. /root/dir",
84
+ },
85
+ {
86
+ name: "--sourcemap-use-absolute-path",
87
+ description: "Report SourceMapURL using its full path",
88
+ default: false,
89
+ },
90
+ {
91
+ name: "--assets-dest <string>",
92
+ description:
93
+ "Directory name where to store assets referenced in the bundle",
94
+ },
95
+ {
96
+ name: "--unstable-transform-profile <string>",
97
+ description:
98
+ "Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default",
99
+ default: "default",
100
+ },
101
+ {
102
+ name: "--asset-catalog-dest [string]",
103
+ description: "Path where to create an iOS Asset Catalog for images",
104
+ },
105
+ {
106
+ name: "--reset-cache",
107
+ description: "Removes cached files",
108
+ default: false,
109
+ },
110
+ {
111
+ name: "--read-global-cache",
112
+ description:
113
+ "Try to fetch transformed JS code from the global cache, if configured.",
114
+ default: false,
115
+ },
116
+ {
117
+ name: "--config <string>",
118
+ description: "Path to the CLI configuration file",
119
+ parse: (val) => _path.default.resolve(val),
120
+ },
121
+ ],
122
+ };
123
+ var _default = bundleCommand;
124
+ exports.default = _default;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type { Command } from "@react-native-community/cli-types";
13
+
14
+ export type { BundleCommandArgs } from "./buildBundle";
15
+
16
+ declare const bundleCommand: Command;
17
+
18
+ declare export default bundleCommand;