@react-native/community-cli-plugin 0.74.0-nightly-20240121-a58ec074b → 0.74.0-nightly-20240122-4e92f87df

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,6 +59,7 @@ npx react-native bundle --entry-file <path> [options]
59
59
  | `--minify [boolean]` | Allows overriding whether bundle is minified. Defaults to `false` if `--dev` is set. Disabling minification can be useful for speeding up production builds for testing purposes. |
60
60
  | `--bundle-output <string>` | Specify the path to store the resulting bundle. |
61
61
  | `--bundle-encoding <string>` | Specify the encoding for writing the bundle (<https://nodejs.org/api/buffer.html#buffer_buffer>). |
62
+ | `--resolver-option <string...>` | Custom resolver options of the form key=value. URL-encoded. May be specified multiple times. |
62
63
  | `--sourcemap-output <string>` | Specify the path to store the source map file for the resulting bundle. |
63
64
  | `--sourcemap-sources-root <string>` | Set the root path for source map entries. |
64
65
  | `--sourcemap-use-absolute-path` | Report `SourceMapURL` using its full path. |
@@ -7,6 +7,9 @@ exports.unstable_buildBundleWithConfig = exports.default = void 0;
7
7
  var _loadMetroConfig = _interopRequireDefault(
8
8
  require("../../utils/loadMetroConfig")
9
9
  );
10
+ var _parseKeyValueParamArray = _interopRequireDefault(
11
+ require("../../utils/parseKeyValueParamArray")
12
+ );
10
13
  var _saveAssets = _interopRequireDefault(require("./saveAssets"));
11
14
  var _cliTools = require("@react-native-community/cli-tools");
12
15
  var _chalk = _interopRequireDefault(require("chalk"));
@@ -43,6 +46,9 @@ async function buildBundleWithConfig(
43
46
  config,
44
47
  bundleImpl = _bundle.default
45
48
  ) {
49
+ const customResolverOptions = (0, _parseKeyValueParamArray.default)(
50
+ args.resolverOption ?? []
51
+ );
46
52
  if (config.resolver.platforms.indexOf(args.platform) === -1) {
47
53
  _cliTools.logger.error(
48
54
  `Invalid platform ${
@@ -75,7 +81,7 @@ async function buildBundleWithConfig(
75
81
  minify: args.minify !== undefined ? args.minify : !args.dev,
76
82
  platform: args.platform,
77
83
  unstable_transformProfile: args.unstableTransformProfile,
78
- customResolverOptions: args.customResolverOptions,
84
+ customResolverOptions,
79
85
  };
80
86
  const server = new _Server.default(config);
81
87
  try {
@@ -33,7 +33,7 @@ export type BundleCommandArgs = {
33
33
  verbose: boolean,
34
34
  unstableTransformProfile: string,
35
35
  indexedRamBundle?: boolean,
36
- customResolverOptions?: Record<string, string>,
36
+ resolverOption?: Array<string>,
37
37
  };
38
38
 
39
39
  declare function buildBundle(
@@ -119,16 +119,10 @@ const bundleCommand = {
119
119
  parse: (val) => _path.default.resolve(val),
120
120
  },
121
121
  {
122
- name: "--custom-resolver-options <string>",
123
- description: "Custom resolver options, format: key=value,key2=value2.",
124
- parse: (val) => {
125
- return Object.fromEntries(
126
- val.split(",").map((option) => {
127
- const [key, value] = option.split("=");
128
- return [key, value];
129
- })
130
- );
131
- },
122
+ name: "--resolver-option <string...>",
123
+ description:
124
+ "Custom resolver options of the form key=value. URL-encoded. May be specified multiple times.",
125
+ parse: (val, previous = []) => previous.concat([val]),
132
126
  },
133
127
  ],
134
128
  };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = parseKeyValueParamArray;
7
+ var _querystring = _interopRequireDefault(require("querystring"));
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : { default: obj };
10
+ }
11
+ /**
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ *
18
+ * @format
19
+ * @oncall react_native
20
+ */
21
+
22
+ function parseKeyValueParamArray(keyValueArray) {
23
+ const result = {};
24
+ for (const item of keyValueArray) {
25
+ if (item.indexOf("=") === -1) {
26
+ throw new Error('Expected parameter to include "=" but found: ' + item);
27
+ }
28
+ if (item.indexOf("&") !== -1) {
29
+ throw new Error('Parameter cannot include "&" but found: ' + item);
30
+ }
31
+ Object.assign(result, _querystring.default.parse(item));
32
+ }
33
+ return result;
34
+ }
@@ -0,0 +1,14 @@
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
+ declare export default function parseKeyValueParamArray(
13
+ keyValueArray: $ReadOnlyArray<string>
14
+ ): Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/community-cli-plugin",
3
- "version": "0.74.0-nightly-20240121-a58ec074b",
3
+ "version": "0.74.0-nightly-20240122-4e92f87df",
4
4
  "description": "Core CLI commands for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -22,16 +22,17 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@react-native/dev-middleware": "0.74.0-nightly-20240121-a58ec074b",
26
25
  "@react-native-community/cli-server-api": "13.0.0",
27
26
  "@react-native-community/cli-tools": "13.0.0",
28
- "@react-native/metro-babel-transformer": "0.74.0-nightly-20240121-a58ec074b",
27
+ "@react-native/dev-middleware": "0.74.0-nightly-20240122-4e92f87df",
28
+ "@react-native/metro-babel-transformer": "0.74.0-nightly-20240122-4e92f87df",
29
29
  "chalk": "^4.0.0",
30
30
  "execa": "^5.1.1",
31
31
  "metro": "^0.80.3",
32
32
  "metro-config": "^0.80.3",
33
33
  "metro-core": "^0.80.3",
34
34
  "node-fetch": "^2.2.0",
35
+ "querystring": "^0.2.1",
35
36
  "readline": "^1.3.0"
36
37
  },
37
38
  "devDependencies": {