@rnx-kit/cli 0.12.6 → 0.14.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +116 -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 +29 -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 +10 -40
  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 +3 -19
  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/index.d.ts +1 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +2 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib/metro-config.d.ts +3 -2
  44. package/lib/metro-config.d.ts.map +1 -1
  45. package/lib/metro-config.js +7 -5
  46. package/lib/metro-config.js.map +1 -1
  47. package/lib/parsers.d.ts +2 -0
  48. package/lib/parsers.d.ts.map +1 -1
  49. package/lib/parsers.js +16 -1
  50. package/lib/parsers.js.map +1 -1
  51. package/lib/serve/kit-config.d.ts +6 -5
  52. package/lib/serve/kit-config.d.ts.map +1 -1
  53. package/lib/serve/kit-config.js +16 -6
  54. package/lib/serve/kit-config.js.map +1 -1
  55. package/lib/start.d.ts +2 -2
  56. package/lib/start.d.ts.map +1 -1
  57. package/lib/start.js +4 -11
  58. package/lib/start.js.map +1 -1
  59. package/package.json +9 -7
  60. package/react-native.config.js +65 -59
  61. package/src/bundle/kit-config.ts +42 -60
  62. package/src/bundle/metro.ts +15 -56
  63. package/src/bundle/overrides.ts +24 -34
  64. package/src/bundle/types.ts +17 -23
  65. package/src/bundle.ts +18 -36
  66. package/src/bundler-plugin-defaults.ts +10 -0
  67. package/src/index.ts +1 -1
  68. package/src/metro-config.ts +12 -6
  69. package/src/parsers.ts +19 -0
  70. package/src/serve/kit-config.ts +23 -11
  71. package/src/start.ts +8 -15
  72. package/test/bundle/__mocks__/@rnx-kit/config.js +2 -3
  73. package/test/bundle/__mocks__/@rnx-kit/console.js +1 -0
  74. package/test/bundle/__mocks__/@rnx-kit/metro-service.js +1 -0
  75. package/test/bundle/kit-config.test.ts +102 -100
  76. package/test/bundle/metro.test.ts +58 -98
  77. package/test/bundle/overrides.test.ts +29 -25
  78. package/test/copy-assets/assembleAarBundle.test.ts +1 -0
  79. package/lib/types.d.ts +0 -5
  80. package/lib/types.d.ts.map +0 -1
  81. package/lib/types.js +0 -3
  82. package/lib/types.js.map +0 -1
  83. 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,40 @@ 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 Object.assign(Object.assign(Object.assign(Object.assign({}, (0, bundler_plugin_defaults_1.getDefaultBundlerPlugins)()), getDefaultBundleParameters(platform)), platformBundleConfig), { platform });
67
53
  });
68
54
  }
69
- exports.getKitBundleConfigs = getKitBundleConfigs;
55
+ exports.getCliPlatformBundleConfigs = getCliPlatformBundleConfigs;
70
56
  //# 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;QACjD,OAAO,eAAe,CAAC;KACxB;IACD,MAAM,IAAI,KAAK,CACb,yIAAyI,CAC1I,CAAC;AACJ,CAAC;AAbD,gDAaC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CACjC,EAA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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,mEACK,IAAA,kDAAwB,GAAE,GAC1B,0BAA0B,CAAC,QAAQ,CAAC,GACpC,oBAAoB,KACvB,QAAQ,IACR;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"}
@@ -12,59 +12,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.metroBundle = exports.createMetroBundleArgs = void 0;
15
+ exports.metroBundle = void 0;
16
16
  const console_1 = require("@rnx-kit/console");
17
17
  const metro_service_1 = require("@rnx-kit/metro-service");
18
18
  const fs_1 = require("@rnx-kit/tools-node/fs");
19
19
  const path_1 = __importDefault(require("path"));
20
20
  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
21
  /**
54
22
  * Run the Metro bundler.
55
23
  *
56
- * @param tsservice TypeScript service to use for type-checking (when enabled)
57
24
  * @param metroConfig Metro configuration
58
25
  * @param bundleConfig Bundle configuration
26
+ * @param dev Choose whether or not this will be a "developer" bundle. The alternative is a "production" bundle.
27
+ * When `true`, warnings are enabled, and the bundle is not minified by default.
28
+ * Further, optimizations like constant folding are disabled.
29
+ * When `false`, warnings are disabled and the bundle is minified by default.
30
+ * @param minify Optionally choose whether or not the bundle is minified. When not set, minification is controlled by the `dev` property.
59
31
  */
60
- function metroBundle(metroConfig, bundleConfig) {
32
+ function metroBundle(metroConfig, bundleConfig, dev, minify) {
61
33
  return __awaiter(this, void 0, void 0, function* () {
62
34
  (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);
35
+ (0, metro_config_1.customizeMetroConfig)(metroConfig, bundleConfig.detectCyclicDependencies, bundleConfig.detectDuplicateDependencies, bundleConfig.typescriptValidation, bundleConfig.treeShake);
36
+ const metroBundleArgs = Object.assign(Object.assign({}, bundleConfig), { dev,
37
+ minify });
68
38
  // ensure all output directories exist
69
39
  (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.bundleOutput));
70
40
  metroBundleArgs.sourcemapOutput &&
@@ -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,EAC9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B;QACpB,MAAM,IAAA,sBAAM,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;CAAA;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,E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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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CAAC;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,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
@@ -11,32 +11,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.rnxBundle = void 0;
13
13
  const metro_service_1 = require("@rnx-kit/metro-service");
14
- const properties_1 = require("@rnx-kit/tools-language/properties");
15
14
  const kit_config_1 = require("./bundle/kit-config");
16
15
  const metro_1 = require("./bundle/metro");
17
16
  const overrides_1 = require("./bundle/overrides");
18
17
  function rnxBundle(_argv, cliConfig, cliOptions) {
19
18
  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
19
  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
- });
20
+ const bundleConfigs = (0, kit_config_1.getCliPlatformBundleConfigs)(cliOptions.id, cliOptions.platform);
21
+ (0, overrides_1.applyBundleConfigOverrides)(cliOptions, bundleConfigs);
38
22
  for (const bundleConfig of bundleConfigs) {
39
- yield (0, metro_1.metroBundle)(metroConfig, bundleConfig);
23
+ yield (0, metro_1.metroBundle)(metroConfig, bundleConfig, cliOptions.dev, cliOptions.minify);
40
24
  }
41
25
  return Promise.resolve();
42
26
  });
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,EACpB,UAA4B;;QAE5B,oFAAoF;QACpF,IAAI,UAAU,CAAC,qBAAqB,KAAK,SAAS,EAAE;YAClD,OAAO,CAAC,IAAI,CACV,4GAA4G,CAC7G,CAAC;YACF,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE;gBACtC,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,qBAAqB,CAAC;aACzD;YACD,OAAO,UAAU,CAAC,qBAAqB,CAAC;SACzC;QAED,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAe,EAAC,SAAS,EAAE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C;IAC3B,CAAC;CAAA;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"}
package/lib/index.d.ts CHANGED
@@ -4,6 +4,6 @@ export { rnxDepCheck, rnxDepCheckCommand } from "./dep-check";
4
4
  export { rnxStart } from "./start";
5
5
  export { rnxTest, rnxTestCommand } from "./test";
6
6
  export { rnxWriteThirdPartyNotices } from "./write-third-party-notices";
7
- export { parseBoolean } from "./parsers";
7
+ export { parseBoolean, parseTransformProfile } from "./parsers";
8
8
  export { rnxClean } from "./clean";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rnxClean = exports.parseBoolean = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStart = exports.rnxDepCheckCommand = exports.rnxDepCheck = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxBundle = void 0;
3
+ exports.rnxClean = exports.parseTransformProfile = exports.parseBoolean = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStart = exports.rnxDepCheckCommand = exports.rnxDepCheck = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxBundle = void 0;
4
4
  var bundle_1 = require("./bundle");
5
5
  Object.defineProperty(exports, "rnxBundle", { enumerable: true, get: function () { return bundle_1.rnxBundle; } });
6
6
  var copy_assets_1 = require("./copy-assets");
@@ -18,6 +18,7 @@ var write_third_party_notices_1 = require("./write-third-party-notices");
18
18
  Object.defineProperty(exports, "rnxWriteThirdPartyNotices", { enumerable: true, get: function () { return write_third_party_notices_1.rnxWriteThirdPartyNotices; } });
19
19
  var parsers_1 = require("./parsers");
20
20
  Object.defineProperty(exports, "parseBoolean", { enumerable: true, get: function () { return parsers_1.parseBoolean; } });
21
+ Object.defineProperty(exports, "parseTransformProfile", { enumerable: true, get: function () { return parsers_1.parseTransformProfile; } });
21
22
  var clean_1 = require("./clean");
22
23
  Object.defineProperty(exports, "rnxClean", { enumerable: true, get: function () { return clean_1.rnxClean; } });
23
24
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAA5B,mGAAA,SAAS,OAAA;AAClB,6CAAwE;AAA/D,gHAAA,iBAAiB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAChD,yCAA8D;AAArD,wGAAA,WAAW,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AACxC,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,+BAAiD;AAAxC,+FAAA,OAAO,OAAA;AAAE,sGAAA,cAAc,OAAA;AAChC,yEAAwE;AAA/D,sIAAA,yBAAyB,OAAA;AAClC,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAA5B,mGAAA,SAAS,OAAA;AAClB,6CAAwE;AAA/D,gHAAA,iBAAiB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAChD,yCAA8D;AAArD,wGAAA,WAAW,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AACxC,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,+BAAiD;AAAxC,+FAAA,OAAO,OAAA;AAAE,sGAAA,cAAc,OAAA;AAChC,yEAAwE;AAA/D,sIAAA,yBAAyB,OAAA;AAClC,qCAAgE;AAAvD,uGAAA,YAAY,OAAA;AAAE,gHAAA,qBAAqB,OAAA;AAC5C,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA"}
@@ -1,6 +1,6 @@
1
+ import type { TypeScriptValidationOptions } from "@rnx-kit/config";
1
2
  import { PluginOptions as CyclicDetectorOptions } from "@rnx-kit/metro-plugin-cyclic-dependencies-detector";
2
3
  import { Options as DuplicateDetectorOptions } from "@rnx-kit/metro-plugin-duplicates-checker";
3
- import type { TypeScriptValidationOptions } from "./types";
4
4
  import type { InputConfigT } from "metro-config";
5
5
  /**
6
6
  * Customize the Metro configuration.
@@ -10,6 +10,7 @@ import type { InputConfigT } from "metro-config";
10
10
  * @param detectDuplicateDependencies When true, duplicate dependency checking is enabled with a default set of options. Otherwise, the object allows for fine-grained control over the detection process.
11
11
  * @param typescriptValidation When true, TypeScript type-checking is enabled with a default set of options. Otherwise, the object allows for fine-grained control over the type-checking process.
12
12
  * @param treeShake When true, tree shaking is enabled.
13
+ * @param print Optional function to use when printing status messages to the Metro console
13
14
  */
14
- export declare function customizeMetroConfig(metroConfigReadonly: InputConfigT, detectCyclicDependencies: boolean | CyclicDetectorOptions, detectDuplicateDependencies: boolean | DuplicateDetectorOptions, typescriptValidation: boolean | TypeScriptValidationOptions, treeShake: boolean): void;
15
+ export declare function customizeMetroConfig(metroConfigReadonly: InputConfigT, detectCyclicDependencies: boolean | CyclicDetectorOptions, detectDuplicateDependencies: boolean | DuplicateDetectorOptions, typescriptValidation: boolean | TypeScriptValidationOptions, treeShake: boolean, print?: (message: string) => void): void;
15
16
  //# sourceMappingURL=metro-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metro-config.d.ts","sourceRoot":"","sources":["../src/metro-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,IAAI,qBAAqB,EACvC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAEL,OAAO,IAAI,wBAAwB,EACpC,MAAM,0CAA0C,CAAC;AAUlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AA0FpE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,YAAY,EACjC,wBAAwB,EAAE,OAAO,GAAG,qBAAqB,EACzD,2BAA2B,EAAE,OAAO,GAAG,wBAAwB,EAC/D,oBAAoB,EAAE,OAAO,GAAG,2BAA2B,EAC3D,SAAS,EAAE,OAAO,GACjB,IAAI,CA6CN"}
1
+ {"version":3,"file":"metro-config.d.ts","sourceRoot":"","sources":["../src/metro-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAEL,aAAa,IAAI,qBAAqB,EACvC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAEL,OAAO,IAAI,wBAAwB,EACpC,MAAM,0CAA0C,CAAC;AAYlD,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AA8FpE;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,YAAY,EACjC,wBAAwB,EAAE,OAAO,GAAG,qBAAqB,EACzD,2BAA2B,EAAE,OAAO,GAAG,wBAAwB,EAC/D,oBAAoB,EAAE,OAAO,GAAG,2BAA2B,EAC3D,SAAS,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAChC,IAAI,CA6CN"}