@module-federation/metro-plugin-rnc-cli 0.0.0-next-20250827124348
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/LICENSE +21 -0
- package/README.md +70 -0
- package/index.js +30 -0
- package/package.json +38 -0
- package/react-native.config.js +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Callstack and Zephyr Cloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @module-federation/metro-plugin-rnc-cli
|
|
2
|
+
|
|
3
|
+
Module Federation for React Native Community CLI using Metro bundler. This plugin integrates the `@module-federation/metro` package with `@react-native-community/cli`, providing commands to bundle Module Federation host and remotes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Install the plugin:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev @module-federation/metro-plugin-rnc-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Bundle a Module Federation Host
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Bundle for iOS
|
|
19
|
+
react-native bundle-mf-host --entry-file index.js --platform ios
|
|
20
|
+
|
|
21
|
+
# Bundle for Android
|
|
22
|
+
react-native bundle-mf-host --entry-file index.js --platform android
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Bundle a Module Federation Remote
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Bundle for iOS
|
|
29
|
+
react-native bundle-mf-remote --platform ios
|
|
30
|
+
|
|
31
|
+
# Bundle for Android
|
|
32
|
+
react-native bundle-mf-remote --platform android
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Available Options
|
|
36
|
+
|
|
37
|
+
#### `bundle-mf-host`
|
|
38
|
+
|
|
39
|
+
- `--entry-file <path>`: Path to the root JavaScript entry file
|
|
40
|
+
- `--platform <string>`: Target platform (default: "ios") - Either "ios" or "android"
|
|
41
|
+
- `--transformer <string>`: Specify a custom transformer
|
|
42
|
+
- `--dev [boolean]`: If false, warnings are disabled and the bundle is minified (default: true)
|
|
43
|
+
- `--minify [boolean]`: Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.
|
|
44
|
+
- `--bundle-output <string>`: File path where to store the resulting bundle
|
|
45
|
+
- `--bundle-encoding <string>`: Encoding the bundle should be written in (default: "utf8")
|
|
46
|
+
- `--resolver-option <string...>`: Custom resolver options (key=value format, URL-encoded, can be specified multiple times)
|
|
47
|
+
- `--sourcemap-output <string>`: File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
|
|
48
|
+
- `--sourcemap-sources-root <string>`: Path to make sourcemap's sources entries relative to, ex. /root/dir
|
|
49
|
+
- `--sourcemap-use-absolute-path`: Report SourceMapURL using its full path (default: false)
|
|
50
|
+
- `--max-workers <number>`: Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.
|
|
51
|
+
- `--assets-dest <string>`: Directory name where to store assets referenced in the bundle
|
|
52
|
+
- `--reset-cache`: Removes cached files (default: false)
|
|
53
|
+
- `--read-global-cache`: Try to fetch transformed JS code from the global cache, if configured (default: false)
|
|
54
|
+
- `--config <string>`: Path to the CLI configuration file
|
|
55
|
+
|
|
56
|
+
#### `bundle-mf-remote`
|
|
57
|
+
|
|
58
|
+
- `--platform <string>`: Target platform (default: "ios") - Either "ios" or "android"
|
|
59
|
+
- `--dev [boolean]`: If false, warnings are disabled and the bundle is minified (default: true)
|
|
60
|
+
- `--minify [boolean]`: Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.
|
|
61
|
+
- `--bundle-encoding <string>`: Encoding the bundle should be written in (default: "utf8")
|
|
62
|
+
- `--max-workers <number>`: Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.
|
|
63
|
+
- `--bundle-output <string>`: File path where to store the resulting bundle
|
|
64
|
+
- `--sourcemap-output <string>`: File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
|
|
65
|
+
- `--sourcemap-sources-root <string>`: Path to make sourcemap's sources entries relative to, ex. /root/dir
|
|
66
|
+
- `--sourcemap-use-absolute-path`: Report SourceMapURL using its full path (default: false)
|
|
67
|
+
- `--assets-dest <string>`: Directory name where to store assets referenced in the bundle
|
|
68
|
+
- `--asset-catalog-dest [string]`: Path where to create an iOS Asset Catalog for images
|
|
69
|
+
- `--reset-cache`: Removes cached files (default: false)
|
|
70
|
+
- `--config <string>`: Path to the CLI configuration file
|
package/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const { default: commands } = require('@module-federation/metro/commands');
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
bundleFederatedHost,
|
|
5
|
+
bundleFederatedHostOptions,
|
|
6
|
+
bundleFederatedRemote,
|
|
7
|
+
bundleFederatedRemoteOptions,
|
|
8
|
+
loadMetroConfig,
|
|
9
|
+
} = commands;
|
|
10
|
+
|
|
11
|
+
const bundleMFHostCommand = {
|
|
12
|
+
name: 'bundle-mf-host',
|
|
13
|
+
description: 'Bundles a Module Federation host',
|
|
14
|
+
func: bundleFederatedHost,
|
|
15
|
+
options: bundleFederatedHostOptions,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const bundleMFRemoteCommand = {
|
|
19
|
+
name: 'bundle-mf-remote',
|
|
20
|
+
description:
|
|
21
|
+
'Bundles a Module Federation remote, including its container entry and all exposed modules for consumption by host applications',
|
|
22
|
+
func: bundleFederatedRemote,
|
|
23
|
+
options: bundleFederatedRemoteOptions,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
bundleMFHostCommand,
|
|
28
|
+
bundleMFRemoteCommand,
|
|
29
|
+
loadMetroConfig,
|
|
30
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@module-federation/metro-plugin-rnc-cli",
|
|
3
|
+
"version": "0.0.0-next-20250827124348",
|
|
4
|
+
"description": "Metro Module Federation plugin for React Native Enterprise Framework (RNEF)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"rnc",
|
|
7
|
+
"cli",
|
|
8
|
+
"module-federation",
|
|
9
|
+
"metro",
|
|
10
|
+
"react-native"
|
|
11
|
+
],
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"contributors": [
|
|
15
|
+
"Jakub Romańczyk <j.romanczyk@gmail.com> (https://github.com/jbroma)",
|
|
16
|
+
"Kacper Wiszczuk <kacperwiszczuk@gmail.com> (https://github.com/esemesek)"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/module-federation/core",
|
|
25
|
+
"directory": "packages/metro-plugin-rnc-cli"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"react-native.config.js"
|
|
29
|
+
],
|
|
30
|
+
"main": "./index.js",
|
|
31
|
+
"exports": "./index.js",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@module-federation/metro": "0.0.0-next-20250827124348"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@module-federation/metro": "0.0.0-next-20250827124348"
|
|
37
|
+
}
|
|
38
|
+
}
|