@module-federation/metro-plugin-rnef 0.0.0-chore-bump-node-22-20260710161714

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 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,87 @@
1
+ # @module-federation/metro-plugin-rnef
2
+
3
+ > **Deprecated:** RNEF has been renamed to [Rock](https://rockjs.dev). Please use [`@module-federation/metro-plugin-rock`](https://www.npmjs.com/package/@module-federation/metro-plugin-rock) instead. This package will continue to be published for backward compatibility but will not receive new features.
4
+
5
+ Module Federation for React Native Enterprise Framework (RNEF) using Metro bundler. This plugin integrates the `@module-federation/metro` package with RNEF, providing commands to bundle Module Federation host and remotes.
6
+
7
+ ## Installation
8
+
9
+ 1. First, ensure you have [RNEF](https://github.com/callstack/rnef) set up in your project.
10
+
11
+ 2. Install the plugin:
12
+
13
+ ```bash
14
+ npm install --save-dev @module-federation/metro-plugin-rnef
15
+ ```
16
+
17
+ 3. Add the plugin to your RNEF configuration (typically in `rnef.config.mjs`):
18
+
19
+ ```typescript
20
+ import { pluginMetro } from '@rnef/plugin-metro';
21
+ import moduleFederation from '@module-federation/metro-plugin-rnef';
22
+
23
+ /** @type {import('@rnef/config').Config} */
24
+ export default {
25
+ bundler: pluginMetro(),
26
+ plugins: [moduleFederation()],
27
+ };
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ### Bundle a Module Federation Host
33
+
34
+ ```bash
35
+ # Bundle for iOS
36
+ rnef bundle-mf-host --entry-file index.js --platform ios
37
+
38
+ # Bundle for Android
39
+ rnef bundle-mf-host --entry-file index.js --platform android
40
+ ```
41
+
42
+ ### Bundle a Module Federation Remote
43
+
44
+ ```bash
45
+ # Bundle for iOS
46
+ rnef bundle-mf-remote --platform ios
47
+
48
+ # Bundle for Android
49
+ rnef bundle-mf-remote --platform android
50
+ ```
51
+
52
+ ### Available Options
53
+
54
+ #### `bundle-mf-host`
55
+
56
+ - `--entry-file <path>`: Path to the root JavaScript entry file
57
+ - `--platform <string>`: Target platform (default: "ios") - Either "ios" or "android"
58
+ - `--transformer <string>`: Specify a custom transformer
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-output <string>`: File path where to store the resulting bundle
62
+ - `--bundle-encoding <string>`: Encoding the bundle should be written in (default: "utf8")
63
+ - `--resolver-option <string...>`: Custom resolver options (key=value format, URL-encoded, can be specified multiple times)
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
+ - `--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.
68
+ - `--assets-dest <string>`: Directory name where to store assets referenced in the bundle
69
+ - `--reset-cache`: Removes cached files (default: false)
70
+ - `--read-global-cache`: Try to fetch transformed JS code from the global cache, if configured (default: false)
71
+ - `--config <string>`: Path to the CLI configuration file
72
+
73
+ #### `bundle-mf-remote`
74
+
75
+ - `--platform <string>`: Target platform (default: "ios") - Either "ios" or "android"
76
+ - `--dev [boolean]`: If false, warnings are disabled and the bundle is minified (default: true)
77
+ - `--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.
78
+ - `--bundle-encoding <string>`: Encoding the bundle should be written in (default: "utf8")
79
+ - `--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.
80
+ - `--bundle-output <string>`: File path where to store the resulting bundle
81
+ - `--sourcemap-output <string>`: File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
82
+ - `--sourcemap-sources-root <string>`: Path to make sourcemap's sources entries relative to, ex. /root/dir
83
+ - `--sourcemap-use-absolute-path`: Report SourceMapURL using its full path (default: false)
84
+ - `--assets-dest <string>`: Directory name where to store assets referenced in the bundle
85
+ - `--asset-catalog-dest [string]`: Path where to create an iOS Asset Catalog for images
86
+ - `--reset-cache`: Removes cached files (default: false)
87
+ - `--config <string>`: Path to the CLI configuration file
package/dist/index.cjs ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ default: ()=>src,
32
+ pluginMetroModuleFederation: ()=>external_plugin_cjs_namespaceObject.pluginMetroModuleFederation
33
+ });
34
+ const external_plugin_cjs_namespaceObject = require("./plugin.cjs");
35
+ const src = external_plugin_cjs_namespaceObject.pluginMetroModuleFederation;
36
+ exports["default"] = __webpack_exports__["default"];
37
+ exports.pluginMetroModuleFederation = __webpack_exports__.pluginMetroModuleFederation;
38
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
39
+ "default",
40
+ "pluginMetroModuleFederation"
41
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
42
+ Object.defineProperty(exports, '__esModule', {
43
+ value: true
44
+ });
@@ -0,0 +1,3 @@
1
+ import { pluginMetroModuleFederation } from './plugin.js';
2
+ export { pluginMetroModuleFederation };
3
+ export default pluginMetroModuleFederation;
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { pluginMetroModuleFederation } from "./plugin.js";
2
+ const src = pluginMetroModuleFederation;
3
+ export default src;
4
+ export { pluginMetroModuleFederation };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, getters, values)=>{
14
+ var define = (defs, kind)=>{
15
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
+ enumerable: true,
17
+ [kind]: defs[key]
18
+ });
19
+ };
20
+ define(getters, "get");
21
+ define(values, "value");
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports1)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports1, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ var __webpack_exports__ = {};
38
+ __webpack_require__.r(__webpack_exports__);
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ pluginMetroModuleFederation: ()=>pluginMetroModuleFederation
41
+ });
42
+ const commands_namespaceObject = require("@module-federation/metro/commands");
43
+ var commands_default = /*#__PURE__*/ __webpack_require__.n(commands_namespaceObject);
44
+ const tools_namespaceObject = require("@rnef/tools");
45
+ const pluginMetroModuleFederation = (pluginConfig = {})=>(api)=>{
46
+ api.registerCommand({
47
+ name: 'bundle-mf-host',
48
+ description: 'Bundles a Module Federation host',
49
+ action: async (args)=>{
50
+ const commandConfig = {
51
+ root: api.getProjectRoot(),
52
+ platforms: api.getPlatforms(),
53
+ reactNativePath: api.getReactNativePath(),
54
+ ...pluginConfig
55
+ };
56
+ tools_namespaceObject.logger.info(`Bundling Module Federation host for platform ${tools_namespaceObject.color.cyan(args.platform)}`);
57
+ await commands_default().bundleFederatedHost([], commandConfig, args);
58
+ tools_namespaceObject.logger.info('Bundle artifacts available at ...');
59
+ (0, tools_namespaceObject.outro)('Success 🎉.');
60
+ },
61
+ options: [
62
+ ...commands_default().bundleFederatedHostOptions,
63
+ {
64
+ name: '--config-cmd [string]',
65
+ description: "[Internal] A hack for Xcode build script pointing to wrong bundle command that recognizes this flag. Do not use."
66
+ }
67
+ ]
68
+ });
69
+ api.registerCommand({
70
+ name: 'bundle-mf-remote',
71
+ description: 'Bundles a Module Federation remote, including its container entry and all exposed modules for consumption by host applications',
72
+ action: async (args)=>{
73
+ const commandConfig = {
74
+ root: api.getProjectRoot(),
75
+ platforms: api.getPlatforms(),
76
+ reactNativePath: api.getReactNativePath(),
77
+ ...pluginConfig
78
+ };
79
+ tools_namespaceObject.logger.info(`Bundling Module Federation remote for platform ${tools_namespaceObject.color.cyan(args.platform)}`);
80
+ await commands_default().bundleFederatedRemote([], commandConfig, args);
81
+ tools_namespaceObject.logger.info('Bundle artifacts available at ...');
82
+ (0, tools_namespaceObject.outro)('Success 🎉.');
83
+ },
84
+ options: commands_default().bundleFederatedRemoteOptions
85
+ });
86
+ return {
87
+ name: '@module-federation/metro-plugin-rnef',
88
+ description: 'RNEF plugin for Module Federation with Metro'
89
+ };
90
+ };
91
+ exports.pluginMetroModuleFederation = __webpack_exports__.pluginMetroModuleFederation;
92
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
93
+ "pluginMetroModuleFederation"
94
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
95
+ Object.defineProperty(exports, '__esModule', {
96
+ value: true
97
+ });
@@ -0,0 +1,6 @@
1
+ import type { PluginApi, PluginOutput } from '@rnef/config';
2
+ interface PluginConfig {
3
+ platforms?: Record<string, object>;
4
+ }
5
+ export declare const pluginMetroModuleFederation: (pluginConfig?: PluginConfig) => (api: PluginApi) => PluginOutput;
6
+ export {};
package/dist/plugin.js ADDED
@@ -0,0 +1,49 @@
1
+ import commands from "@module-federation/metro/commands";
2
+ import { color, logger, outro } from "@rnef/tools";
3
+ const pluginMetroModuleFederation = (pluginConfig = {})=>(api)=>{
4
+ api.registerCommand({
5
+ name: 'bundle-mf-host',
6
+ description: 'Bundles a Module Federation host',
7
+ action: async (args)=>{
8
+ const commandConfig = {
9
+ root: api.getProjectRoot(),
10
+ platforms: api.getPlatforms(),
11
+ reactNativePath: api.getReactNativePath(),
12
+ ...pluginConfig
13
+ };
14
+ logger.info(`Bundling Module Federation host for platform ${color.cyan(args.platform)}`);
15
+ await commands.bundleFederatedHost([], commandConfig, args);
16
+ logger.info('Bundle artifacts available at ...');
17
+ outro('Success 🎉.');
18
+ },
19
+ options: [
20
+ ...commands.bundleFederatedHostOptions,
21
+ {
22
+ name: '--config-cmd [string]',
23
+ description: "[Internal] A hack for Xcode build script pointing to wrong bundle command that recognizes this flag. Do not use."
24
+ }
25
+ ]
26
+ });
27
+ api.registerCommand({
28
+ name: 'bundle-mf-remote',
29
+ description: 'Bundles a Module Federation remote, including its container entry and all exposed modules for consumption by host applications',
30
+ action: async (args)=>{
31
+ const commandConfig = {
32
+ root: api.getProjectRoot(),
33
+ platforms: api.getPlatforms(),
34
+ reactNativePath: api.getReactNativePath(),
35
+ ...pluginConfig
36
+ };
37
+ logger.info(`Bundling Module Federation remote for platform ${color.cyan(args.platform)}`);
38
+ await commands.bundleFederatedRemote([], commandConfig, args);
39
+ logger.info('Bundle artifacts available at ...');
40
+ outro('Success 🎉.');
41
+ },
42
+ options: commands.bundleFederatedRemoteOptions
43
+ });
44
+ return {
45
+ name: '@module-federation/metro-plugin-rnef',
46
+ description: 'RNEF plugin for Module Federation with Metro'
47
+ };
48
+ };
49
+ export { pluginMetroModuleFederation };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@module-federation/metro-plugin-rnef",
3
+ "version": "0.0.0-chore-bump-node-22-20260710161714",
4
+ "description": "Metro Module Federation plugin for React Native Enterprise Framework (RNEF). Deprecated: use @module-federation/metro-plugin-rock instead.",
5
+ "keywords": [
6
+ "rnef",
7
+ "module-federation",
8
+ "metro",
9
+ "react-native"
10
+ ],
11
+ "type": "module",
12
+ "license": "MIT",
13
+ "contributors": [
14
+ "Jakub Romańczyk <j.romanczyk@gmail.com> (https://github.com/jbroma)",
15
+ "Kacper Wiszczuk <kacperwiszczuk@gmail.com> (https://github.com/esemesek)"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/module-federation/core.git",
24
+ "directory": "packages/metro-plugin-rnef"
25
+ },
26
+ "files": [
27
+ "dist/"
28
+ ],
29
+ "main": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ "types": "./dist/index.d.ts",
33
+ "require": "./dist/index.cjs",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "peerDependencies": {
37
+ "@rnef/tools": "^0.7.18",
38
+ "@module-federation/metro": "0.0.0-chore-bump-node-22-20260710161714"
39
+ },
40
+ "devDependencies": {
41
+ "@rnef/config": "^0.7.18",
42
+ "@rnef/tools": "^0.7.18",
43
+ "@rslib/core": "^0.23.2",
44
+ "@typescript-eslint/eslint-plugin": "8.54.0",
45
+ "@typescript-eslint/parser": "8.54.0",
46
+ "@types/node": "^20.0.0",
47
+ "typescript": "^6.0.3",
48
+ "@module-federation/metro": "0.0.0-chore-bump-node-22-20260710161714"
49
+ },
50
+ "scripts": {
51
+ "build": "rslib build",
52
+ "typecheck": "tsc --noEmit",
53
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.{js,ts}\""
54
+ }
55
+ }