@rnx-kit/cli 0.12.7 → 0.14.2

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 (89) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +90 -65
  3. package/coverage/clover.xml +92 -104
  4. package/coverage/coverage-final.json +7 -6
  5. package/coverage/lcov-report/index.html +29 -29
  6. package/coverage/lcov-report/src/bundle/index.html +29 -29
  7. package/coverage/lcov-report/src/bundle/kit-config.ts.html +63 -117
  8. package/coverage/lcov-report/src/bundle/metro.ts.html +40 -163
  9. package/coverage/lcov-report/src/bundle/overrides.ts.html +28 -58
  10. package/coverage/lcov-report/src/bundler-plugin-defaults.ts.html +115 -0
  11. package/coverage/lcov-report/src/copy-assets.ts.html +1 -1
  12. package/coverage/lcov-report/src/index.html +26 -11
  13. package/coverage/lcov-report/src/metro-config.ts.html +49 -31
  14. package/coverage/lcov-report/src/typescript/index.html +1 -1
  15. package/coverage/lcov-report/src/typescript/project-cache.ts.html +5 -5
  16. package/coverage/lcov.info +173 -193
  17. package/lib/bundle/kit-config.d.ts +9 -15
  18. package/lib/bundle/kit-config.d.ts.map +1 -1
  19. package/lib/bundle/kit-config.js +34 -43
  20. package/lib/bundle/kit-config.js.map +1 -1
  21. package/lib/bundle/metro.d.ts +7 -11
  22. package/lib/bundle/metro.d.ts.map +1 -1
  23. package/lib/bundle/metro.js +21 -59
  24. package/lib/bundle/metro.js.map +1 -1
  25. package/lib/bundle/overrides.d.ts +11 -9
  26. package/lib/bundle/overrides.d.ts.map +1 -1
  27. package/lib/bundle/overrides.js +10 -18
  28. package/lib/bundle/overrides.js.map +1 -1
  29. package/lib/bundle/types.d.ts +4 -17
  30. package/lib/bundle/types.d.ts.map +1 -1
  31. package/lib/bundle.d.ts +8 -7
  32. package/lib/bundle.d.ts.map +1 -1
  33. package/lib/bundle.js +8 -35
  34. package/lib/bundle.js.map +1 -1
  35. package/lib/bundler-plugin-defaults.d.ts +3 -0
  36. package/lib/bundler-plugin-defaults.d.ts.map +1 -0
  37. package/lib/bundler-plugin-defaults.js +13 -0
  38. package/lib/bundler-plugin-defaults.js.map +1 -0
  39. package/lib/clean.js +106 -117
  40. package/lib/clean.js.map +1 -1
  41. package/lib/copy-assets.js +194 -210
  42. package/lib/copy-assets.js.map +1 -1
  43. package/lib/dep-check.js +12 -7
  44. package/lib/dep-check.js.map +1 -1
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +2 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/metro-config.d.ts +3 -2
  50. package/lib/metro-config.d.ts.map +1 -1
  51. package/lib/metro-config.js +7 -5
  52. package/lib/metro-config.js.map +1 -1
  53. package/lib/parsers.d.ts +2 -0
  54. package/lib/parsers.d.ts.map +1 -1
  55. package/lib/parsers.js +16 -1
  56. package/lib/parsers.js.map +1 -1
  57. package/lib/serve/kit-config.d.ts +6 -5
  58. package/lib/serve/kit-config.d.ts.map +1 -1
  59. package/lib/serve/kit-config.js +21 -6
  60. package/lib/serve/kit-config.js.map +1 -1
  61. package/lib/start.d.ts +2 -2
  62. package/lib/start.d.ts.map +1 -1
  63. package/lib/start.js +146 -158
  64. package/lib/start.js.map +1 -1
  65. package/package.json +9 -6
  66. package/react-native.config.js +65 -59
  67. package/src/bundle/kit-config.ts +42 -60
  68. package/src/bundle/metro.ts +15 -56
  69. package/src/bundle/overrides.ts +24 -34
  70. package/src/bundle/types.ts +17 -23
  71. package/src/bundle.ts +18 -36
  72. package/src/bundler-plugin-defaults.ts +10 -0
  73. package/src/index.ts +1 -1
  74. package/src/metro-config.ts +12 -6
  75. package/src/parsers.ts +19 -0
  76. package/src/serve/kit-config.ts +23 -11
  77. package/src/start.ts +23 -29
  78. package/test/bundle/__mocks__/@rnx-kit/config.js +2 -3
  79. package/test/bundle/__mocks__/@rnx-kit/console.js +1 -0
  80. package/test/bundle/__mocks__/@rnx-kit/metro-service.js +1 -0
  81. package/test/bundle/kit-config.test.ts +102 -100
  82. package/test/bundle/metro.test.ts +58 -98
  83. package/test/bundle/overrides.test.ts +29 -25
  84. package/test/copy-assets/assembleAarBundle.test.ts +1 -0
  85. package/lib/types.d.ts +0 -5
  86. package/lib/types.d.ts.map +0 -1
  87. package/lib/types.js +0 -3
  88. package/lib/types.js.map +0 -1
  89. package/src/types.ts +0 -4
@@ -1,13 +1,5 @@
1
- import type { BundleDefinitionWithRequiredParameters } from "@rnx-kit/config";
2
1
  import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
3
- import type { KitBundleConfig } from "./types";
4
- /**
5
- * Get a bundle definition from the kit configuration.
6
- *
7
- * @param id Optional bundle definition id. Only needed when the kit config has more than one definition.
8
- * @returns Bundle definition matching the id (if given), or the first bundle definition found. `undefined` if bundling is disabled or not supported for the kit.
9
- */
10
- export declare function getKitBundleDefinition(id?: string): BundleDefinitionWithRequiredParameters | undefined;
2
+ import type { CliPlatformBundleConfig } from "./types";
11
3
  /**
12
4
  * Get the list of target platforms for bundling.
13
5
  *
@@ -17,13 +9,15 @@ export declare function getKitBundleDefinition(id?: string): BundleDefinitionWit
17
9
  */
18
10
  export declare function getTargetPlatforms(overridePlatform?: AllPlatforms, targetPlatforms?: AllPlatforms[]): AllPlatforms[];
19
11
  /**
20
- * Get bundle configuration and target platform(s) from kit config. Create
21
- * one config per platform, applying any platform-specific customizations in
22
- * the kit config.
12
+ * Get the bundle configuration and target platform(s) from the rnx-kit
13
+ * configuration. Use them to create an array of platform-specific
14
+ * bundle configurations.
15
+ *
16
+ * If an id is given, search for the matching bundle definition. Otherwise, use the first bundle definition.
23
17
  *
24
- * @param id Optional bundle definition id. Only needed when the kit config has more than one definition.
18
+ * @param id Optional identity of the target bundle definition to return
25
19
  * @param overridePlatform Override platform, typically from the command-line. When given, this overrides the list of target platforms.
26
- * @returns Arrary of kit bundle configurations, one per target platform, or `undefined` if bundling is disabled
20
+ * @returns Arrary of platform-specific bundle configurations
27
21
  */
28
- export declare function getKitBundleConfigs(id?: string, overridePlatform?: AllPlatforms): KitBundleConfig[] | undefined;
22
+ export declare function getCliPlatformBundleConfigs(id?: string, overridePlatform?: AllPlatforms): CliPlatformBundleConfig[];
29
23
  //# sourceMappingURL=kit-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kit-config.d.ts","sourceRoot":"","sources":["../../src/bundle/kit-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,iBAAiB,CAAC;AAO9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,CAAC,EAAE,MAAM,GACV,sCAAsC,GAAG,SAAS,CA0BpD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,CAAC,EAAE,YAAY,EAC/B,eAAe,CAAC,EAAE,YAAY,EAAE,GAC/B,YAAY,EAAE,CAUhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,CAAC,EAAE,MAAM,EACX,gBAAgB,CAAC,EAAE,YAAY,GAC9B,eAAe,EAAE,GAAG,SAAS,CAiB/B"}
1
+ {"version":3,"file":"kit-config.d.ts","sourceRoot":"","sources":["../../src/bundle/kit-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGvD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,CAAC,EAAE,YAAY,EAC/B,eAAe,CAAC,EAAE,YAAY,EAAE,GAC/B,YAAY,EAAE,CAUhB;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,CAAC,EAAE,MAAM,EACX,gBAAgB,CAAC,EAAE,YAAY,GAC9B,uBAAuB,EAAE,CAwB3B"}
@@ -1,35 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getKitBundleConfigs = exports.getTargetPlatforms = exports.getKitBundleDefinition = void 0;
3
+ exports.getCliPlatformBundleConfigs = exports.getTargetPlatforms = void 0;
7
4
  const config_1 = require("@rnx-kit/config");
8
- const console_1 = require("@rnx-kit/console");
9
- const chalk_1 = __importDefault(require("chalk"));
10
- /**
11
- * Get a bundle definition from the kit configuration.
12
- *
13
- * @param id Optional bundle definition id. Only needed when the kit config has more than one definition.
14
- * @returns Bundle definition matching the id (if given), or the first bundle definition found. `undefined` if bundling is disabled or not supported for the kit.
15
- */
16
- function getKitBundleDefinition(id) {
17
- const kitConfig = (0, config_1.getKitConfig)();
18
- if (!kitConfig) {
19
- throw new Error("No kit configuration found for this react-native experience");
20
- }
21
- if (kitConfig.bundle === null || kitConfig.bundle === undefined) {
22
- (0, console_1.warn)(chalk_1.default.yellow("No bundle configuration found for this react-native experience -- skipping bundling"));
23
- return undefined;
24
- }
25
- else if (!kitConfig.bundle) {
26
- (0, console_1.warn)(chalk_1.default.yellow("Bundling is disabled for this react-native experience -- skipping"));
27
- return undefined;
28
- }
29
- // get the bundle definition
30
- return (0, config_1.getBundleDefinition)(kitConfig.bundle, id);
31
- }
32
- exports.getKitBundleDefinition = getKitBundleDefinition;
5
+ const bundler_plugin_defaults_1 = require("../bundler-plugin-defaults");
33
6
  /**
34
7
  * Get the list of target platforms for bundling.
35
8
  *
@@ -44,27 +17,45 @@ function getTargetPlatforms(overridePlatform, targetPlatforms) {
44
17
  if (targetPlatforms && targetPlatforms.length > 0) {
45
18
  return targetPlatforms;
46
19
  }
47
- throw new Error("No target platforms given. Update the kit configuration to include a target platform, or provide a target platform on the command-line.");
20
+ throw new Error("No target platforms given. Update the rnx-kit configuration to include a target platform, or provide a target platform on the command-line.");
48
21
  }
49
22
  exports.getTargetPlatforms = getTargetPlatforms;
23
+ function getDefaultBundleParameters(platform) {
24
+ const extension = platform === "ios" || platform === "macos" ? "jsbundle" : "bundle";
25
+ return {
26
+ entryFile: "index.js",
27
+ bundleOutput: `index.${platform}.${extension}`,
28
+ sourcemapUseAbsolutePath: false,
29
+ };
30
+ }
50
31
  /**
51
- * Get bundle configuration and target platform(s) from kit config. Create
52
- * one config per platform, applying any platform-specific customizations in
53
- * the kit config.
32
+ * Get the bundle configuration and target platform(s) from the rnx-kit
33
+ * configuration. Use them to create an array of platform-specific
34
+ * bundle configurations.
54
35
  *
55
- * @param id Optional bundle definition id. Only needed when the kit config has more than one definition.
36
+ * If an id is given, search for the matching bundle definition. Otherwise, use the first bundle definition.
37
+ *
38
+ * @param id Optional identity of the target bundle definition to return
56
39
  * @param overridePlatform Override platform, typically from the command-line. When given, this overrides the list of target platforms.
57
- * @returns Arrary of kit bundle configurations, one per target platform, or `undefined` if bundling is disabled
40
+ * @returns Arrary of platform-specific bundle configurations
58
41
  */
59
- function getKitBundleConfigs(id, overridePlatform) {
60
- const bundleDefinition = getKitBundleDefinition(id);
61
- if (!bundleDefinition) {
62
- return undefined;
63
- }
64
- const platforms = getTargetPlatforms(overridePlatform, bundleDefinition.targets);
42
+ function getCliPlatformBundleConfigs(id, overridePlatform) {
43
+ const kitConfig = (0, config_1.getKitConfig)();
44
+ const maybeBundleConfig = kitConfig
45
+ ? (0, config_1.getBundleConfig)(kitConfig, id)
46
+ : undefined;
47
+ const bundleConfig = maybeBundleConfig !== null && maybeBundleConfig !== void 0 ? maybeBundleConfig : {};
48
+ const platforms = getTargetPlatforms(overridePlatform, bundleConfig.targets);
65
49
  return platforms.map((platform) => {
66
- return Object.assign(Object.assign({}, (0, config_1.getBundlePlatformDefinition)(bundleDefinition, platform)), { platform });
50
+ const platformBundleConfig = (0, config_1.getPlatformBundleConfig)(bundleConfig, platform);
51
+ // apply defaults to fill in any required props that are missing
52
+ return {
53
+ ...(0, bundler_plugin_defaults_1.getDefaultBundlerPlugins)(),
54
+ ...getDefaultBundleParameters(platform),
55
+ ...platformBundleConfig,
56
+ platform,
57
+ };
67
58
  });
68
59
  }
69
- exports.getKitBundleConfigs = getKitBundleConfigs;
60
+ exports.getCliPlatformBundleConfigs = getCliPlatformBundleConfigs;
70
61
  //# sourceMappingURL=kit-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kit-config.js","sourceRoot":"","sources":["../../src/bundle/kit-config.ts"],"names":[],"mappings":";;;;;;AACA,4CAIyB;AACzB,8CAAwC;AAExC,kDAA0B;AAG1B;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,EAAW;IAEX,MAAM,SAAS,GAAG,IAAA,qBAAY,GAAE,CAAC;IACjC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;KACH;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC/D,IAAA,cAAI,EACF,eAAK,CAAC,MAAM,CACV,qFAAqF,CACtF,CACF,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;SAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;QAC5B,IAAA,cAAI,EACF,eAAK,CAAC,MAAM,CACV,mEAAmE,CACpE,CACF,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED,4BAA4B;IAC5B,OAAO,IAAA,4BAAmB,EAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AA5BD,wDA4BC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,gBAA+B,EAC/B,eAAgC;IAEhC,IAAI,gBAAgB,EAAE;QACpB,OAAO,CAAC,gBAAgB,CAAC,CAAC;KAC3B;IACD,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE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BAAwB,EAAE,KAAK;KAChC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,2BAA2B,CACzC,EAAW,EACX,gBAA+B;IAE/B,MAAM,SAAS,GAAG,IAAA,qBAAY,GAAE,CAAC;IACjC,MAAM,iBAAiB,GAAG,SAAS;QACjC,CAAC,CAAC,IAAA,wBAAe,EAAC,SAAS,EAAE,EAAE,CAAC;QAChC,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,YAAY,GAAG,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,EAAE,CAAC;IAE7C,MAAM,SAAS,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAE7E,OAAO,SAAS,CAAC,GAAG,CAA0B,CAAC,QAAQ,EAAE,EAAE;QACzD,MAAM,oBAAoB,GAAG,IAAA,gCAAuB,EAClD,YAAY,EACZ,QAAQ,CACT,CAAC;QAEF,gEAAgE;QAEhE,OAAO;YACL,GAAG,IAAA,kDAAwB,GAAE;YAC7B,GAAG,0BAA0B,CAAC,QAAQ,CAAC;YACvC,GAAG,oBAAoB;YACvB,QAAQ;SACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA3BD,kEA2BC"}
@@ -1,19 +1,15 @@
1
- import { BundleArgs as MetroBundleArgs } from "@rnx-kit/metro-service";
2
1
  import type { ConfigT } from "metro-config";
3
- import type { BundleConfig } from "./types";
4
- /**
5
- * Create Metro bundler arguments from a bundle configuration.
6
- *
7
- * @param bundleConfig Bundle configuration
8
- * @returns Metro bundle arguments
9
- */
10
- export declare function createMetroBundleArgs({ entryPath: entryFile, distPath, assetsPath: assetsDest, bundlePrefix, bundleEncoding, sourceMapPath: sourcemapOutput, sourceMapSourceRootPath: sourcemapSourcesRoot, platform, dev, minify, }: BundleConfig): MetroBundleArgs;
2
+ import type { CliPlatformBundleConfig } from "./types";
11
3
  /**
12
4
  * Run the Metro bundler.
13
5
  *
14
- * @param tsservice TypeScript service to use for type-checking (when enabled)
15
6
  * @param metroConfig Metro configuration
16
7
  * @param bundleConfig Bundle configuration
8
+ * @param dev Choose whether or not this will be a "developer" bundle. The alternative is a "production" bundle.
9
+ * When `true`, warnings are enabled, and the bundle is not minified by default.
10
+ * Further, optimizations like constant folding are disabled.
11
+ * When `false`, warnings are disabled and the bundle is minified by default.
12
+ * @param minify Optionally choose whether or not the bundle is minified. When not set, minification is controlled by the `dev` property.
17
13
  */
18
- export declare function metroBundle(metroConfig: ConfigT, bundleConfig: BundleConfig): Promise<void>;
14
+ export declare function metroBundle(metroConfig: ConfigT, bundleConfig: CliPlatformBundleConfig, dev: boolean, minify?: boolean): Promise<void>;
19
15
  //# sourceMappingURL=metro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metro.d.ts","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EACR,UAAU,EAAE,UAAU,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EAAE,eAAe,EAC9B,uBAAuB,EAAE,oBAAoB,EAC7C,QAAQ,EACR,GAAG,EACH,MAAM,GACP,EAAE,YAAY,GAAG,eAAe,CA4BhC;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
1
+ {"version":3,"file":"metro.d.ts","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,uBAAuB,EACrC,GAAG,EAAE,OAAO,EACZ,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAyBf"}
@@ -1,78 +1,40 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.metroBundle = exports.createMetroBundleArgs = void 0;
6
+ exports.metroBundle = void 0;
16
7
  const console_1 = require("@rnx-kit/console");
17
8
  const metro_service_1 = require("@rnx-kit/metro-service");
18
9
  const fs_1 = require("@rnx-kit/tools-node/fs");
19
10
  const path_1 = __importDefault(require("path"));
20
11
  const metro_config_1 = require("../metro-config");
21
- /**
22
- * Create Metro bundler arguments from a bundle configuration.
23
- *
24
- * @param bundleConfig Bundle configuration
25
- * @returns Metro bundle arguments
26
- */
27
- function createMetroBundleArgs({ entryPath: entryFile, distPath, assetsPath: assetsDest, bundlePrefix, bundleEncoding, sourceMapPath: sourcemapOutput, sourceMapSourceRootPath: sourcemapSourcesRoot, platform, dev, minify, }) {
28
- // assemble the full path to the bundle file
29
- const bundleExtension = platform === "ios" || platform === "macos" ? "jsbundle" : "bundle";
30
- const bundleFile = `${bundlePrefix}.${platform}.${bundleExtension}`;
31
- const bundlePath = path_1.default.join(distPath, bundleFile);
32
- // always create a source-map in dev mode
33
- if (dev) {
34
- sourcemapOutput = sourcemapOutput !== null && sourcemapOutput !== void 0 ? sourcemapOutput : bundleFile + ".map";
35
- }
36
- // use an absolute path for the source map file
37
- if (sourcemapOutput) {
38
- sourcemapOutput = path_1.default.join(distPath, sourcemapOutput);
39
- }
40
- return {
41
- assetsDest,
42
- entryFile,
43
- minify,
44
- platform,
45
- dev,
46
- bundleOutput: bundlePath,
47
- bundleEncoding,
48
- sourcemapOutput,
49
- sourcemapSourcesRoot,
50
- };
51
- }
52
- exports.createMetroBundleArgs = createMetroBundleArgs;
53
12
  /**
54
13
  * Run the Metro bundler.
55
14
  *
56
- * @param tsservice TypeScript service to use for type-checking (when enabled)
57
15
  * @param metroConfig Metro configuration
58
16
  * @param bundleConfig Bundle configuration
17
+ * @param dev Choose whether or not this will be a "developer" bundle. The alternative is a "production" bundle.
18
+ * When `true`, warnings are enabled, and the bundle is not minified by default.
19
+ * Further, optimizations like constant folding are disabled.
20
+ * When `false`, warnings are disabled and the bundle is minified by default.
21
+ * @param minify Optionally choose whether or not the bundle is minified. When not set, minification is controlled by the `dev` property.
59
22
  */
60
- function metroBundle(metroConfig, bundleConfig) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- (0, console_1.info)(`Bundling ${bundleConfig.platform}...`);
63
- const typescriptValidationOptions = {
64
- throwOnError: true,
65
- };
66
- (0, metro_config_1.customizeMetroConfig)(metroConfig, bundleConfig.detectCyclicDependencies, bundleConfig.detectDuplicateDependencies, bundleConfig.typescriptValidation ? typescriptValidationOptions : false, bundleConfig.treeShake);
67
- const metroBundleArgs = createMetroBundleArgs(bundleConfig);
68
- // ensure all output directories exist
69
- (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.bundleOutput));
70
- metroBundleArgs.sourcemapOutput &&
71
- (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.sourcemapOutput));
72
- metroBundleArgs.assetsDest && (0, fs_1.createDirectory)(metroBundleArgs.assetsDest);
73
- // create the bundle
74
- yield (0, metro_service_1.bundle)(metroBundleArgs, metroConfig);
75
- });
23
+ async function metroBundle(metroConfig, bundleConfig, dev, minify) {
24
+ (0, console_1.info)(`Bundling ${bundleConfig.platform}...`);
25
+ (0, metro_config_1.customizeMetroConfig)(metroConfig, bundleConfig.detectCyclicDependencies, bundleConfig.detectDuplicateDependencies, bundleConfig.typescriptValidation, bundleConfig.treeShake);
26
+ const metroBundleArgs = {
27
+ ...bundleConfig,
28
+ dev,
29
+ minify,
30
+ };
31
+ // ensure all output directories exist
32
+ (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.bundleOutput));
33
+ metroBundleArgs.sourcemapOutput &&
34
+ (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.sourcemapOutput));
35
+ metroBundleArgs.assetsDest && (0, fs_1.createDirectory)(metroBundleArgs.assetsDest);
36
+ // create the bundle
37
+ await (0, metro_service_1.bundle)(metroBundleArgs, metroConfig);
76
38
  }
77
39
  exports.metroBundle = metroBundle;
78
40
  //# sourceMappingURL=metro.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metro.js","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAAwC;AACxC,0DAA+E;AAC/E,+CAAyD;AAEzD,gDAAwB;AACxB,kDAAuD;AAIvD;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EACR,UAAU,EAAE,UAAU,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EAAE,eAAe,EAC9B,uBAAuB,EAAE,oBAAoB,EAC7C,QAAQ,EACR,GAAG,EACH,MAAM,GACO;IACb,6CAA6C;IAC7C,MAAM,eAAe,GACnB,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,OAA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,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;QACjE,eAAe,CAAC,UAAU,IAAI,IAAA,oBAAe,EAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAE1E,oBAAoB;QACpB,MAAM,IAAA,sBAAM,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;CAAA;AA3BD,kCA2BC"}
1
+ {"version":3,"file":"metro.js","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwC;AACxC,0DAA+E;AAC/E,+CAAyD;AAEzD,gDAAwB;AACxB,kDAAuD;AAGvD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAoB,EACpB,YAAqC,EACrC,GAAY,EACZ,MAAgB;IAEhB,IAAA,cAAI,EAAC,YAAY,YAAY,CAAC,QAAQ,KAAK,CAAC,CAAC;IAE7C,IAAA,mCAAoB,EAClB,WAAW,EACX,YAAY,CAAC,wBAAwB,EACrC,YAAY,CAAC,2BAA2B,EACxC,YAAY,CAAC,oBAAoB,EACjC,YAAY,CAAC,SAAS,CACvB,CAAC;IAEF,MAAM,eAAe,GAAoB;QACvC,GAAG,YAAY;QACf,GAAG;QACH,MAAM;KACP,CAAC;IAEF,sCAAsC;IACtC,IAAA,oBAAe,EAAC,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;IAC5D,eAAe,CAAC,eAAe;QAC7B,IAAA,oBAAe,EAAC,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;IACjE,eAAe,CAAC,UAAU,IAAI,IAAA,oBAAe,EAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAE1E,oBAAoB;IACpB,MAAM,IAAA,sBAAM,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC;AA9BD,kCA8BC"}
@@ -1,20 +1,22 @@
1
+ import type { TransformProfile } from "metro-babel-transformer";
1
2
  import type { BundleArgs } from "@rnx-kit/metro-service";
2
- import type { KitBundleConfig } from "./types";
3
- export declare type KitBundleConfigOverrides = {
4
- entryPath?: string;
5
- distPath?: string;
6
- assetsPath?: string;
7
- bundlePrefix?: string;
3
+ import type { CliPlatformBundleConfig } from "./types";
4
+ export declare type BundleConfigOverrides = {
5
+ entryFile?: string;
6
+ bundleOutput?: string;
8
7
  bundleEncoding?: BundleArgs["bundleEncoding"];
9
8
  sourcemapOutput?: string;
10
9
  sourcemapSourcesRoot?: string;
10
+ sourcemapUseAbsolutePath?: boolean;
11
+ assetsDest?: string;
11
12
  treeShake?: boolean;
13
+ unstableTransformProfile?: TransformProfile;
12
14
  };
13
15
  /**
14
- * Apply overrides, if any, to each kit bundle config. Overrides are applied in-place.
16
+ * Apply overrides, if any, to each rnx-kit bundle configuration. Overrides are applied in-place.
15
17
  *
16
18
  * @param overrides Optional overrides to apply
17
- * @param configs Array of kit bundle configurations to override. This is modified if any overrides are applied.
19
+ * @param configs Array of platform-specific bundle configurations. This is modified if any overrides are applied.
18
20
  */
19
- export declare function applyKitBundleConfigOverrides(overrides: KitBundleConfigOverrides, configs: KitBundleConfig[]): void;
21
+ export declare function applyBundleConfigOverrides(overrides: BundleConfigOverrides, configs: CliPlatformBundleConfig[]): void;
20
22
  //# sourceMappingURL=overrides.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/bundle/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,oBAAY,wBAAwB,GAAG;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,wBAAwB,EACnC,OAAO,EAAE,eAAe,EAAE,GACzB,IAAI,CA6BN"}
1
+ {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/bundle/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,oBAAY,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wBAAwB,CAAC,EAAE,gBAAgB,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,qBAAqB,EAChC,OAAO,EAAE,uBAAuB,EAAE,GACjC,IAAI,CAiBN"}
@@ -1,32 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyKitBundleConfigOverrides = void 0;
3
+ exports.applyBundleConfigOverrides = void 0;
4
4
  const properties_1 = require("@rnx-kit/tools-language/properties");
5
5
  /**
6
- * Apply overrides, if any, to each kit bundle config. Overrides are applied in-place.
6
+ * Apply overrides, if any, to each rnx-kit bundle configuration. Overrides are applied in-place.
7
7
  *
8
8
  * @param overrides Optional overrides to apply
9
- * @param configs Array of kit bundle configurations to override. This is modified if any overrides are applied.
9
+ * @param configs Array of platform-specific bundle configurations. This is modified if any overrides are applied.
10
10
  */
11
- function applyKitBundleConfigOverrides(overrides, configs) {
11
+ function applyBundleConfigOverrides(overrides, configs) {
12
12
  const overridesToApply = (0, properties_1.pickValues)(overrides, [
13
- "entryPath",
14
- "distPath",
15
- "assetsPath",
16
- "bundlePrefix",
17
- "bundleEncoding",
18
- "sourcemapOutput",
19
- "sourcemapSourcesRoot",
20
- "treeShake",
21
- ], [
22
- "entryPath",
23
- "distPath",
24
- "assetsPath",
25
- "bundlePrefix",
13
+ "entryFile",
14
+ "bundleOutput",
26
15
  "bundleEncoding",
27
16
  "sourcemapOutput",
28
17
  "sourcemapSourcesRoot",
18
+ "sourcemapUseAbsolutePath",
19
+ "assetsDest",
29
20
  "treeShake",
21
+ "unstableTransformProfile",
30
22
  ]);
31
23
  if (overridesToApply) {
32
24
  for (const config of configs) {
@@ -34,5 +26,5 @@ function applyKitBundleConfigOverrides(overrides, configs) {
34
26
  }
35
27
  }
36
28
  }
37
- exports.applyKitBundleConfigOverrides = applyKitBundleConfigOverrides;
29
+ exports.applyBundleConfigOverrides = applyBundleConfigOverrides;
38
30
  //# sourceMappingURL=overrides.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/bundle/overrides.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAchE;;;;;GAKG;AACH,SAAgB,6BAA6B,CAC3C,SAAmC,EACnC,OAA0B;IAE1B,MAAM,gBAAgB,GAAG,IAAA,uBAAU,EACjC,SAAS,EACT;QACE,WAAW;QACX,UAAU;QACV,YAAY;QACZ,cAAc;QACd,gBAAgB;QAChB,iBAAiB;QACjB,sBAAsB;QACtB,WAAW;KACZ,EACD;QACE,WAAW;QACX,UAAU;QACV,YAAY;QACZ,cAAc;QACd,gBAAgB;QAChB,iBAAiB;QACjB,sBAAsB;QACtB,WAAW;KACZ,CACF,CAAC;IACF,IAAI,gBAAgB,EAAE;QACpB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;SACzC;KACF;AACH,CAAC;AAhCD,sEAgCC"}
1
+ {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/bundle/overrides.ts"],"names":[],"mappings":";;;AAEA,mEAAgE;AAehE;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,SAAgC,EAChC,OAAkC;IAElC,MAAM,gBAAgB,GAAG,IAAA,uBAAU,EAAC,SAAS,EAAE;QAC7C,WAAW;QACX,cAAc;QACd,gBAAgB;QAChB,iBAAiB;QACjB,sBAAsB;QACtB,0BAA0B;QAC1B,YAAY;QACZ,WAAW;QACX,0BAA0B;KAC3B,CAAC,CAAC;IACH,IAAI,gBAAgB,EAAE;QACpB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;SACzC;KACF;AACH,CAAC;AApBD,gEAoBC"}
@@ -1,24 +1,11 @@
1
- import type { BundleParameters, BundleRequiredParameters } from "@rnx-kit/config";
1
+ import type { TransformProfile } from "metro-babel-transformer";
2
+ import type { BundleParameters } from "@rnx-kit/config";
2
3
  import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
3
- export declare type KitBundleConfig = BundleParameters & BundleRequiredParameters & {
4
+ export declare type CliPlatformBundleConfig = BundleParameters & Required<Pick<BundleParameters, "entryFile" | "bundleOutput" | "sourcemapUseAbsolutePath" | "detectCyclicDependencies" | "detectDuplicateDependencies" | "typescriptValidation" | "treeShake">> & {
5
+ unstableTransformProfile?: TransformProfile;
4
6
  /**
5
7
  * Target platform for the bundle
6
8
  */
7
9
  platform: AllPlatforms;
8
10
  };
9
- export declare type BundleConfig = KitBundleConfig & {
10
- /**
11
- * Choose whether or not this will be a "developer" bundle. The alternative is a "production" bundle.
12
- *
13
- * When `true`, warnings are enabled, and the bundle is not minified by default.
14
- * Further, optimizations like constant folding are disabled.
15
- *
16
- * When `false`, warnings are disabled and the bundle is minified by default.
17
- */
18
- dev: boolean;
19
- /**
20
- * Optionally choose whether or not the bundle is minified. When not set, minification is controlled by the `dev` property.
21
- */
22
- minify?: boolean;
23
- };
24
11
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundle/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,oBAAY,eAAe,GAAG,gBAAgB,GAC5C,wBAAwB,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEJ,oBAAY,YAAY,GAAG,eAAe,GAAG;IAC3C;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundle/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,oBAAY,uBAAuB,GAAG,gBAAgB,GACpD,QAAQ,CACN,IAAI,CACF,gBAAgB,EACd,WAAW,GACX,cAAc,GACd,0BAA0B,GAC1B,0BAA0B,GAC1B,6BAA6B,GAC7B,sBAAsB,GACtB,WAAW,CACd,CACF,GAAG;IACF,wBAAwB,CAAC,EAAE,gBAAgB,CAAC;IAE5C;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC"}
package/lib/bundle.d.ts CHANGED
@@ -1,21 +1,22 @@
1
+ import type { TransformProfile } from "metro-babel-transformer";
1
2
  import type { Config as CLIConfig } from "@react-native-community/cli-types";
2
3
  import { BundleArgs } from "@rnx-kit/metro-service";
3
4
  import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
4
5
  export declare type CLIBundleOptions = {
5
6
  id?: string;
7
+ entryFile?: string;
6
8
  platform?: AllPlatforms;
7
- entryPath?: string;
8
- distPath?: string;
9
- assetsPath?: string;
10
- bundlePrefix?: string;
11
- bundleEncoding?: BundleArgs["bundleEncoding"];
12
9
  dev: boolean;
13
10
  minify?: boolean;
14
- experimentalTreeShake?: boolean;
15
- treeShake?: boolean;
11
+ bundleOutput?: string;
12
+ bundleEncoding?: BundleArgs["bundleEncoding"];
16
13
  maxWorkers?: number;
17
14
  sourcemapOutput?: string;
18
15
  sourcemapSourcesRoot?: string;
16
+ sourcemapUseAbsolutePath?: boolean;
17
+ assetsDest?: string;
18
+ treeShake?: boolean;
19
+ unstableTransformProfile?: TransformProfile;
19
20
  resetCache?: boolean;
20
21
  config?: string;
21
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAMzE,oBAAY,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,C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gB,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wBAAwB,CAAC,EAAE,gBAAgB,CAAC;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAsB,SAAS,CAC7B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,gBAAgB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAoBf"}
package/lib/bundle.js CHANGED
@@ -1,45 +1,18 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.rnxBundle = void 0;
13
4
  const metro_service_1 = require("@rnx-kit/metro-service");
14
- const properties_1 = require("@rnx-kit/tools-language/properties");
15
5
  const kit_config_1 = require("./bundle/kit-config");
16
6
  const metro_1 = require("./bundle/metro");
17
7
  const overrides_1 = require("./bundle/overrides");
18
- function rnxBundle(_argv, cliConfig, cliOptions) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- // experimentalTreeShake is deprecated. Only use it when treeShake is not specified.
21
- if (cliOptions.experimentalTreeShake !== undefined) {
22
- console.warn("Warning: The command-line parameter '--experimental-tree-shake' is deprecated. Use `--tree-shake` instead.");
23
- if (cliOptions.treeShake === undefined) {
24
- cliOptions.treeShake = cliOptions.experimentalTreeShake;
25
- }
26
- delete cliOptions.experimentalTreeShake;
27
- }
28
- const metroConfig = yield (0, metro_service_1.loadMetroConfig)(cliConfig, cliOptions);
29
- const kitBundleConfigs = (0, kit_config_1.getKitBundleConfigs)(cliOptions.id, cliOptions.platform);
30
- if (!kitBundleConfigs) {
31
- return Promise.resolve();
32
- }
33
- (0, overrides_1.applyKitBundleConfigOverrides)(cliOptions, kitBundleConfigs);
34
- const bundleConfigs = (0, properties_1.extendObjectArray)(kitBundleConfigs, {
35
- dev: cliOptions.dev,
36
- minify: cliOptions.minify,
37
- });
38
- for (const bundleConfig of bundleConfigs) {
39
- yield (0, metro_1.metroBundle)(metroConfig, bundleConfig);
40
- }
41
- return Promise.resolve();
42
- });
8
+ async function rnxBundle(_argv, cliConfig, cliOptions) {
9
+ const metroConfig = await (0, metro_service_1.loadMetroConfig)(cliConfig, cliOptions);
10
+ const bundleConfigs = (0, kit_config_1.getCliPlatformBundleConfigs)(cliOptions.id, cliOptions.platform);
11
+ (0, overrides_1.applyBundleConfigOverrides)(cliOptions, bundleConfigs);
12
+ for (const bundleConfig of bundleConfigs) {
13
+ await (0, metro_1.metroBundle)(metroConfig, bundleConfig, cliOptions.dev, cliOptions.minify);
14
+ }
15
+ return Promise.resolve();
43
16
  }
44
17
  exports.rnxBundle = rnxBundle;
45
18
  //# sourceMappingURL=bundle.js.map
package/lib/bundle.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0DAAqE;AACrE,mEAAuE;AAEvE,oDAA0D;AAC1D,0CAA6C;AAC7C,kDAAmE;AAsBnE,SAAsB,SAAS,CAC7B,KAAoB,EACpB,SAAoB,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aAAa,GAAG,IAAA,wCAA2B,EAC/C,UAAU,CAAC,EAAE,EACb,UAAU,CAAC,QAAQ,CACpB,CAAC;IAEF,IAAA,sCAA0B,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAEtD,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,MAAM,IAAA,mBAAW,EACf,WAAW,EACX,YAAY,EACZ,UAAU,CAAC,GAAG,EACd,UAAU,CAAC,MAAM,CAClB,CAAC;KACH;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC;AAxBD,8BAwBC"}
@@ -0,0 +1,3 @@
1
+ import type { BundlerPlugins } from "@rnx-kit/config";
2
+ export declare function getDefaultBundlerPlugins(): Required<BundlerPlugins>;
3
+ //# sourceMappingURL=bundler-plugin-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler-plugin-defaults.d.ts","sourceRoot":"","sources":["../src/bundler-plugin-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,wBAAgB,wBAAwB,IAAI,QAAQ,CAAC,cAAc,CAAC,CAOnE"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultBundlerPlugins = void 0;
4
+ function getDefaultBundlerPlugins() {
5
+ return {
6
+ detectCyclicDependencies: true,
7
+ detectDuplicateDependencies: true,
8
+ typescriptValidation: true,
9
+ treeShake: false,
10
+ };
11
+ }
12
+ exports.getDefaultBundlerPlugins = getDefaultBundlerPlugins;
13
+ //# sourceMappingURL=bundler-plugin-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler-plugin-defaults.js","sourceRoot":"","sources":["../src/bundler-plugin-defaults.ts"],"names":[],"mappings":";;;AAEA,SAAgB,wBAAwB;IACtC,OAAO;QACL,wBAAwB,EAAE,IAAI;QAC9B,2BAA2B,EAAE,IAAI;QACjC,oBAAoB,EAAE,IAAI;QAC1B,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC;AAPD,4DAOC"}