@module-federation/utilities 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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/dist/cjs/Logger.js +63 -0
  4. package/dist/cjs/components/ErrorBoundary.js +98 -0
  5. package/dist/cjs/components/FederationBoundary.js +103 -0
  6. package/dist/cjs/index.js +172 -0
  7. package/dist/cjs/plugins/DelegateModulesPlugin.js +133 -0
  8. package/dist/cjs/types/index.js +31 -0
  9. package/dist/cjs/utils/common.js +175 -0
  10. package/dist/cjs/utils/getRuntimeRemotes.js +104 -0
  11. package/dist/cjs/utils/getRuntimeRemotes.test.js +98 -0
  12. package/dist/cjs/utils/importDelegateModule.test.js +99 -0
  13. package/dist/cjs/utils/importDelegatedModule.js +126 -0
  14. package/dist/cjs/utils/importRemote.js +176 -0
  15. package/dist/cjs/utils/isEmpty.js +60 -0
  16. package/dist/cjs/utils/pure.js +215 -0
  17. package/dist/cjs/utils/react.js +73 -0
  18. package/dist/esm/Logger.mjs +12 -0
  19. package/dist/esm/components/ErrorBoundary.mjs +31 -0
  20. package/dist/esm/components/FederationBoundary.mjs +35 -0
  21. package/dist/esm/index.mjs +24 -0
  22. package/dist/esm/plugins/DelegateModulesPlugin.mjs +81 -0
  23. package/dist/esm/rslib-runtime.mjs +37 -0
  24. package/dist/esm/types/index.mjs +4 -0
  25. package/dist/esm/utils/common.mjs +116 -0
  26. package/dist/esm/utils/getRuntimeRemotes.mjs +50 -0
  27. package/dist/esm/utils/getRuntimeRemotes.test.mjs +84 -0
  28. package/dist/esm/utils/importDelegateModule.test.mjs +72 -0
  29. package/dist/esm/utils/importDelegatedModule.mjs +72 -0
  30. package/dist/esm/utils/importRemote.mjs +105 -0
  31. package/dist/esm/utils/isEmpty.mjs +8 -0
  32. package/dist/esm/utils/pure.mjs +138 -0
  33. package/dist/esm/utils/react.mjs +4 -0
  34. package/dist/types/Logger.d.ts +7 -0
  35. package/dist/types/components/ErrorBoundary.d.ts +19 -0
  36. package/dist/types/components/FederationBoundary.d.ts +14 -0
  37. package/dist/types/index.d.ts +10 -0
  38. package/dist/types/plugins/DelegateModulesPlugin.d.ts +18 -0
  39. package/dist/types/types/index.d.ts +76 -0
  40. package/dist/types/utils/common.d.ts +31 -0
  41. package/dist/types/utils/getRuntimeRemotes.d.ts +2 -0
  42. package/dist/types/utils/importDelegatedModule.d.ts +2 -0
  43. package/dist/types/utils/importRemote.d.ts +31 -0
  44. package/dist/types/utils/isEmpty.d.ts +1 -0
  45. package/dist/types/utils/pure.d.ts +5 -0
  46. package/dist/types/utils/react.d.ts +1 -0
  47. package/package.json +68 -0
@@ -0,0 +1,105 @@
1
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
2
+
3
+ /**
4
+ * Constant for remote entry file
5
+ * @constant {string}
6
+ */ const REMOTE_ENTRY_FILE = 'remoteEntry.js';
7
+ /**
8
+ * Function to load remote
9
+ * @function
10
+ * @param {ImportRemoteOptions['url']} url - The url of the remote module
11
+ * @param {ImportRemoteOptions['scope']} scope - The scope of the remote module
12
+ * @param {ImportRemoteOptions['bustRemoteEntryCache']} bustRemoteEntryCache - Flag to bust the remote entry cache
13
+ * @returns {Promise<void>} A promise that resolves when the remote is loaded
14
+ */ const loadRemote = (url, scope, bustRemoteEntryCache)=>new Promise((resolve, reject)=>{
15
+ const timestamp = bustRemoteEntryCache ? `?t=${new Date().getTime()}` : '';
16
+ const webpackRequire = __webpack_require__;
17
+ webpackRequire.l(`${url}${timestamp}`, (event)=>{
18
+ if (event?.type === 'load') {
19
+ // Script loaded successfully:
20
+ return resolve();
21
+ }
22
+ const realSrc = event?.target?.src;
23
+ const error = new Error();
24
+ error.message = 'Loading script failed.\n(missing: ' + realSrc + ')';
25
+ error.name = 'ScriptExternalLoadError';
26
+ reject(error);
27
+ }, scope);
28
+ });
29
+ const loadEsmRemote = async (url, scope)=>{
30
+ const module = await import(/* webpackIgnore: true */ url);
31
+ if (!module) {
32
+ throw new Error(`Unable to load requested remote from ${url} with scope ${scope}`);
33
+ }
34
+ window[scope] = {
35
+ ...module,
36
+ __initializing: false,
37
+ __initialized: false
38
+ };
39
+ };
40
+ /**
41
+ * Function to initialize sharing
42
+ * @async
43
+ * @function
44
+ */ const initSharing = async ()=>{
45
+ const webpackShareScopes = __webpack_require__.S;
46
+ if (!webpackShareScopes?.default) {
47
+ await __webpack_require__.I('default');
48
+ }
49
+ };
50
+ /**
51
+ * Function to initialize container
52
+ * @async
53
+ * @function
54
+ * @param {WebpackRemoteContainer} containerScope - The container scope
55
+ */ const initContainer = async (containerScope)=>{
56
+ try {
57
+ const webpackShareScopes = __webpack_require__.S;
58
+ if (!containerScope.__initialized && !containerScope.__initializing) {
59
+ containerScope.__initializing = true;
60
+ await containerScope.init(webpackShareScopes.default);
61
+ containerScope.__initialized = true;
62
+ delete containerScope.__initializing;
63
+ }
64
+ } catch (error) {
65
+ console.error(error);
66
+ }
67
+ };
68
+ /**
69
+ * Function to import remote
70
+ * @async
71
+ * @function
72
+ * @param {ImportRemoteOptions} options - The options for importing the remote
73
+ * @returns {Promise<T>} A promise that resolves with the imported module
74
+ */ const importRemote = async ({ url, scope, module, remoteEntryFileName = REMOTE_ENTRY_FILE, bustRemoteEntryCache = true, esm = false })=>{
75
+ const remoteScope = scope;
76
+ if (!window[remoteScope]) {
77
+ let remoteUrl = '';
78
+ if (typeof url === 'string') {
79
+ remoteUrl = url;
80
+ } else {
81
+ remoteUrl = await url();
82
+ }
83
+ const remoteUrlWithEntryFile = `${remoteUrl}/${remoteEntryFileName}`;
84
+ const asyncContainer = !esm ? loadRemote(remoteUrlWithEntryFile, scope, bustRemoteEntryCache) : loadEsmRemote(remoteUrlWithEntryFile, scope);
85
+ // Load the remote and initialize the share scope if it's empty
86
+ await Promise.all([
87
+ asyncContainer,
88
+ initSharing()
89
+ ]);
90
+ if (!window[remoteScope]) {
91
+ throw new Error(`Remote loaded successfully but ${scope} could not be found! Verify that the name is correct in the Webpack configuration!`);
92
+ }
93
+ // Initialize the container to get shared modules and get the module factory:
94
+ const [, moduleFactory] = await Promise.all([
95
+ initContainer(window[remoteScope]),
96
+ window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`)
97
+ ]);
98
+ return moduleFactory();
99
+ } else {
100
+ const moduleFactory = await window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`);
101
+ return moduleFactory();
102
+ }
103
+ };
104
+
105
+ export { importRemote };
@@ -0,0 +1,8 @@
1
+ const isObjectEmpty = (obj)=>{
2
+ for(const x in obj){
3
+ return false;
4
+ }
5
+ return true;
6
+ };
7
+
8
+ export { isObjectEmpty };
@@ -0,0 +1,138 @@
1
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
2
+
3
+ const pure = typeof process !== 'undefined' ? process.env['REMOTES'] || {} : {};
4
+ const remoteVars = pure;
5
+ const extractUrlAndGlobal = (urlAndGlobal)=>{
6
+ const index = urlAndGlobal.indexOf('@');
7
+ if (index <= 0 || index === urlAndGlobal.length - 1) {
8
+ throw new Error(`Invalid request "${urlAndGlobal}"`);
9
+ }
10
+ return [
11
+ urlAndGlobal.substring(index + 1),
12
+ urlAndGlobal.substring(0, index)
13
+ ];
14
+ };
15
+ const loadScript = (keyOrRuntimeRemoteItem)=>{
16
+ const runtimeRemotes = getRuntimeRemotes();
17
+ // 1) Load remote container if needed
18
+ let asyncContainer;
19
+ const reference = typeof keyOrRuntimeRemoteItem === 'string' ? runtimeRemotes[keyOrRuntimeRemoteItem] : keyOrRuntimeRemoteItem;
20
+ if (reference.asyncContainer) {
21
+ asyncContainer = typeof reference.asyncContainer.then === 'function' ? reference.asyncContainer : reference.asyncContainer();
22
+ } else {
23
+ // This casting is just to satisfy typescript,
24
+ // In reality remoteGlobal will always be a string;
25
+ const remoteGlobal = reference.global;
26
+ // Check if theres an override for container key if not use remote global
27
+ const containerKey = reference.uniqueKey ? reference.uniqueKey : remoteGlobal;
28
+ const __webpack_error__ = new Error();
29
+ // @ts-ignore
30
+ const globalScope = // @ts-ignore
31
+ typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
32
+ if (typeof window === 'undefined') {
33
+ //@ts-ignore
34
+ globalScope['_config'][containerKey] = reference.url;
35
+ } else {
36
+ // to match promise template system, can be removed once promise template is gone
37
+ //@ts-ignore
38
+ if (!globalScope['remoteLoading']) {
39
+ //@ts-ignore
40
+ globalScope['remoteLoading'] = {};
41
+ }
42
+ //@ts-ignore
43
+ if (globalScope['remoteLoading'][containerKey]) {
44
+ //@ts-ignore
45
+ return globalScope['remoteLoading'][containerKey];
46
+ }
47
+ }
48
+ // @ts-ignore
49
+ asyncContainer = new Promise(function(resolve, reject) {
50
+ function resolveRemoteGlobal() {
51
+ //@ts-ignore
52
+ const asyncContainer = globalScope[remoteGlobal];
53
+ return resolve(asyncContainer);
54
+ }
55
+ //@ts-ignore
56
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
57
+ return resolveRemoteGlobal();
58
+ }
59
+ __webpack_require__.l(reference.url, function(event) {
60
+ //@ts-ignore
61
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
62
+ return resolveRemoteGlobal();
63
+ }
64
+ const errorType = event && (event.type === 'load' ? 'missing' : event.type);
65
+ const realSrc = event && event.target && event.target.src;
66
+ __webpack_error__.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ' or global var ' + remoteGlobal + ')';
67
+ __webpack_error__.name = 'ScriptExternalLoadError';
68
+ __webpack_error__.type = errorType;
69
+ __webpack_error__.request = realSrc;
70
+ reject(__webpack_error__);
71
+ }, containerKey);
72
+ }).catch(function(err) {
73
+ console.error('container is offline, returning fake remote');
74
+ console.error(err);
75
+ return {
76
+ fake: true,
77
+ // @ts-ignore
78
+ get: (arg)=>{
79
+ console.warn('faking', arg, 'module on, its offline');
80
+ return Promise.resolve(()=>{
81
+ return {
82
+ __esModule: true,
83
+ default: ()=>{
84
+ return null;
85
+ }
86
+ };
87
+ });
88
+ },
89
+ //eslint-disable-next-line
90
+ init: ()=>{}
91
+ };
92
+ });
93
+ if (typeof window !== 'undefined') {
94
+ //@ts-ignore
95
+ globalScope['remoteLoading'][containerKey] = asyncContainer;
96
+ }
97
+ }
98
+ return asyncContainer;
99
+ };
100
+ const getRuntimeRemotes = ()=>{
101
+ return Object.entries(remoteVars).reduce((acc, [key, value])=>{
102
+ if (typeof value === 'object' && typeof value.then === 'function') {
103
+ acc[key] = {
104
+ asyncContainer: value
105
+ };
106
+ } else if (typeof value === 'function') {
107
+ acc[key] = {
108
+ asyncContainer: Promise.resolve(value())
109
+ };
110
+ } else if (typeof value === 'string') {
111
+ if (value.startsWith('internal ')) {
112
+ const [request, query] = value.replace('internal ', '').split('?');
113
+ if (query) {
114
+ const remoteSyntax = new URLSearchParams(query).get('remote');
115
+ if (remoteSyntax) {
116
+ const [url, global] = extractUrlAndGlobal(remoteSyntax);
117
+ acc[key] = {
118
+ global,
119
+ url
120
+ };
121
+ }
122
+ }
123
+ } else {
124
+ const [url, global] = extractUrlAndGlobal(value);
125
+ acc[key] = {
126
+ global,
127
+ url
128
+ };
129
+ }
130
+ } else {
131
+ console.warn('remotes process', process.env['REMOTES']);
132
+ throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
133
+ }
134
+ return acc;
135
+ }, {});
136
+ };
137
+
138
+ export { extractUrlAndGlobal, getRuntimeRemotes, loadScript, remoteVars };
@@ -0,0 +1,4 @@
1
+
2
+
3
+
4
+ export { default as FederationBoundary } from "../components/FederationBoundary.mjs";
@@ -0,0 +1,7 @@
1
+ import { Compilation } from 'webpack';
2
+ export type LoggerInstance = Compilation['logger'] | Console;
3
+ export declare class Logger {
4
+ private static loggerInstance;
5
+ static getLogger(): LoggerInstance;
6
+ static setLogger(logger: Compilation['logger']): LoggerInstance;
7
+ }
@@ -0,0 +1,19 @@
1
+ import React, { type ErrorInfo } from 'react';
2
+ export interface ErrorBoundaryProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export interface ErrorBoundaryState {
6
+ hasError: boolean;
7
+ }
8
+ /**
9
+ * Generic error boundary component.
10
+ */
11
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
12
+ constructor(props: ErrorBoundaryProps);
13
+ static getDerivedStateFromError(): {
14
+ hasError: boolean;
15
+ };
16
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
17
+ render(): React.ReactNode;
18
+ }
19
+ export default ErrorBoundary;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ComponentClass, ComponentType, PropsWithChildren } from 'react';
3
+ export interface FederationBoundaryProps {
4
+ dynamicImporter: () => Promise<ComponentType<any>>;
5
+ fallback?: () => Promise<ComponentType<any>>;
6
+ customBoundary?: ComponentClass<PropsWithChildren<any>>;
7
+ [props: string]: any;
8
+ }
9
+ /**
10
+ * Wrapper around dynamic import.
11
+ * Adds error boundaries and fallback options.
12
+ */
13
+ declare const FederationBoundary: React.FC<FederationBoundaryProps>;
14
+ export default FederationBoundary;
@@ -0,0 +1,10 @@
1
+ export * from './types';
2
+ export type { ImportRemoteOptions } from './utils/importRemote';
3
+ export type { LoggerInstance } from './Logger';
4
+ export { createRuntimeVariables, getContainer, injectScript, getModule, } from './utils/common';
5
+ export { isObjectEmpty } from './utils/isEmpty';
6
+ export { importRemote } from './utils/importRemote';
7
+ export { Logger } from './Logger';
8
+ export { getRuntimeRemotes } from './utils/getRuntimeRemotes';
9
+ export { importDelegatedModule } from './utils/importDelegatedModule';
10
+ export { extractUrlAndGlobal, loadScript } from './utils/pure';
@@ -0,0 +1,18 @@
1
+ import type { Compiler, Compilation, Chunk, NormalModule } from 'webpack';
2
+ declare class DelegateModulesPlugin {
3
+ options: {
4
+ debug: boolean;
5
+ [key: string]: any;
6
+ };
7
+ _delegateModules: Map<string, NormalModule>;
8
+ constructor(options: {
9
+ debug?: boolean;
10
+ [key: string]: any;
11
+ });
12
+ getChunkByName(chunks: Iterable<Chunk>, name: string): Chunk | undefined;
13
+ private addDelegatesToChunks;
14
+ private addModuleAndDependenciesToChunk;
15
+ removeDelegatesNonRuntimeChunks(compilation: Compilation, chunks: Iterable<Chunk>): void;
16
+ apply(compiler: Compiler): void;
17
+ }
18
+ export default DelegateModulesPlugin;
@@ -0,0 +1,76 @@
1
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
2
+ import type { WebpackOptionsNormalized } from 'webpack';
3
+ export type ModuleFederationPluginOptions = moduleFederationPlugin.ModuleFederationPluginOptions;
4
+ export type WebpackRequire = {
5
+ l: (url: string | undefined, cb: (event: any) => void, id: string | number) => Record<string, unknown>;
6
+ };
7
+ export type WebpackShareScopes = Record<string, Record<string, {
8
+ loaded?: 1;
9
+ get: () => Promise<unknown>;
10
+ from: string;
11
+ eager: boolean;
12
+ }>> & {
13
+ default?: string;
14
+ };
15
+ export type GlobalScopeType = {
16
+ [K: string]: any;
17
+ _config?: Record<string | number, any>;
18
+ _medusa?: Record<string, any> | undefined;
19
+ remoteLoading?: Record<string, Promise<AsyncContainer>>;
20
+ };
21
+ export declare const __webpack_init_sharing__: (parameter: string) => Promise<void>;
22
+ export interface NextFederationPluginExtraOptions {
23
+ enableImageLoaderFix?: boolean;
24
+ enableUrlLoaderFix?: boolean;
25
+ exposePages?: boolean;
26
+ skipSharingNextInternals?: boolean;
27
+ automaticPageStitching?: boolean;
28
+ debug?: boolean;
29
+ }
30
+ export interface NextFederationPluginOptions extends ModuleFederationPluginOptions {
31
+ extraOptions: NextFederationPluginExtraOptions;
32
+ }
33
+ export type Shared = ModuleFederationPluginOptions['shared'];
34
+ export type Remotes = ModuleFederationPluginOptions['remotes'];
35
+ export type SharedObject = Extract<Shared, ModuleFederationPluginOptions>;
36
+ export type SharedConfig = Extract<SharedObject[keyof SharedObject], {
37
+ eager?: boolean;
38
+ }>;
39
+ export type ExternalsType = Required<ModuleFederationPluginOptions['remoteType']>;
40
+ type ModulePath = string;
41
+ export type WebpackRemoteContainer = {
42
+ __initialized?: boolean;
43
+ get(modulePath: ModulePath): () => any;
44
+ init: (obj?: typeof __webpack_share_scopes__) => void;
45
+ };
46
+ export type AsyncContainer = Promise<WebpackRemoteContainer>;
47
+ export type RemoteData = {
48
+ global: string;
49
+ url: string;
50
+ uniqueKey?: string;
51
+ };
52
+ export type RuntimeRemote = Partial<RemoteData> & {
53
+ asyncContainer?: AsyncContainer;
54
+ global?: string;
55
+ url?: string;
56
+ };
57
+ export type RuntimeRemotesMap = Record<string, RuntimeRemote>;
58
+ type Module = WebpackOptionsNormalized['module'];
59
+ type Rules = Module['rules'];
60
+ export type RuleSetRuleUnion = Rules[0];
61
+ type RuleSetRule = Extract<RuleSetRuleUnion, {
62
+ loader?: string;
63
+ }>;
64
+ export type Loader = Extract<RuleSetRule['use'], {
65
+ loader?: string;
66
+ }>;
67
+ export type EventTypes = 'loadStart' | 'loadComplete' | 'loadError';
68
+ type NextRoute = string;
69
+ export type PageMap = Record<NextRoute, ModulePath>;
70
+ export type GetModuleOptions = {
71
+ modulePath: string;
72
+ exportName?: string;
73
+ remoteContainer: string | RemoteData;
74
+ };
75
+ export type RemoteVars = Record<string, Promise<WebpackRemoteContainer> | string | (() => Promise<WebpackRemoteContainer>)>;
76
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { GetModuleOptions, RemoteData, Remotes, RuntimeRemote, WebpackRemoteContainer } from '../types';
2
+ /**
3
+ * Return initialized remote container by remote's key or its runtime remote item data.
4
+ *
5
+ * `runtimeRemoteItem` might be
6
+ * { global, url } - values obtained from webpack remotes option `global@url`
7
+ * or
8
+ * { asyncContainer } - async container is a promise that resolves to the remote container
9
+ */
10
+ export declare const injectScript: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => Promise<WebpackRemoteContainer>;
11
+ /**
12
+ * Creates runtime variables from the provided remotes.
13
+ * If the value of a remote starts with 'promise ' or 'external ', it is transformed into a function that returns the promise call.
14
+ * Otherwise, the value is stringified.
15
+ * @param {Remotes} remotes - The remotes to create runtime variables from.
16
+ * @returns {Record<string, string>} - The created runtime variables.
17
+ */
18
+ export declare const createRuntimeVariables: (remotes: Remotes) => Record<string, string>;
19
+ /**
20
+ * Returns initialized webpack RemoteContainer.
21
+ * If its' script does not loaded - then load & init it firstly.
22
+ */
23
+ export declare const getContainer: (remoteContainer: string | RemoteData) => Promise<WebpackRemoteContainer | undefined>;
24
+ /**
25
+ * Return remote module from container.
26
+ * If you provide `exportName` it automatically return exact property value from module.
27
+ *
28
+ * @example
29
+ * remote.getModule('./pages/index', 'default')
30
+ */
31
+ export declare const getModule: ({ remoteContainer, modulePath, exportName, }: GetModuleOptions) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ import { RuntimeRemotesMap } from '../types';
2
+ export declare const getRuntimeRemotes: () => RuntimeRemotesMap;
@@ -0,0 +1,2 @@
1
+ import { RuntimeRemote } from '../types';
2
+ export declare const importDelegatedModule: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => Promise<any>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Type definition for RemoteUrl
3
+ * @typedef {string | function} RemoteUrl
4
+ */
5
+ type RemoteUrl = string | (() => Promise<string>);
6
+ /**
7
+ * Interface for ImportRemoteOptions
8
+ * @interface
9
+ * @property {RemoteUrl} url - The url of the remote module
10
+ * @property {string} scope - The scope of the remote module
11
+ * @property {string} module - The module to import
12
+ * @property {string} [remoteEntryFileName] - The filename of the remote entry
13
+ * @property {boolean} [bustRemoteEntryCache] - Flag to bust the remote entry cache
14
+ */
15
+ export interface ImportRemoteOptions {
16
+ url: RemoteUrl;
17
+ scope: string;
18
+ module: string;
19
+ remoteEntryFileName?: string;
20
+ bustRemoteEntryCache?: boolean;
21
+ esm?: boolean;
22
+ }
23
+ /**
24
+ * Function to import remote
25
+ * @async
26
+ * @function
27
+ * @param {ImportRemoteOptions} options - The options for importing the remote
28
+ * @returns {Promise<T>} A promise that resolves with the imported module
29
+ */
30
+ export declare const importRemote: <T>({ url, scope, module, remoteEntryFileName, bustRemoteEntryCache, esm, }: ImportRemoteOptions) => Promise<T>;
31
+ export {};
@@ -0,0 +1 @@
1
+ export declare const isObjectEmpty: <T extends object>(obj: T) => boolean;
@@ -0,0 +1,5 @@
1
+ import { RemoteVars, RuntimeRemote, RuntimeRemotesMap } from '../types';
2
+ export declare const remoteVars: RemoteVars;
3
+ export declare const extractUrlAndGlobal: (urlAndGlobal: string) => [string, string];
4
+ export declare const loadScript: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => any;
5
+ export declare const getRuntimeRemotes: () => RuntimeRemotesMap;
@@ -0,0 +1 @@
1
+ export { default as FederationBoundary } from '../components/FederationBoundary';
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@module-federation/utilities",
3
+ "version": "0.0.0-chore-bump-node-22-20260710161714",
4
+ "main": "./dist/cjs/index.js",
5
+ "module": "./dist/esm/index.mjs",
6
+ "types": "./dist/types/index.d.ts",
7
+ "license": "MIT",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist/",
13
+ "README.md"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/module-federation/core.git",
18
+ "directory": "packages/utilities"
19
+ },
20
+ "devDependencies": {
21
+ "@types/react": "^18.3.11",
22
+ "react": "18.3.1",
23
+ "rsbuild-plugin-publint": "^0.2.1"
24
+ },
25
+ "dependencies": {
26
+ "@module-federation/sdk": "0.0.0-chore-bump-node-22-20260710161714"
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^16 || ^17 || ^18",
30
+ "react-dom": "^16 || ^17 || ^18",
31
+ "webpack": "^5.40.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "react": {
35
+ "optional": true
36
+ },
37
+ "react-dom": {
38
+ "optional": true
39
+ },
40
+ "next": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/types/index.d.ts",
47
+ "import": "./dist/esm/index.mjs",
48
+ "require": "./dist/cjs/index.js"
49
+ },
50
+ "./package.json": "./package.json"
51
+ },
52
+ "typesVersions": {
53
+ "*": {
54
+ ".": [
55
+ "./dist/types/index.d.ts"
56
+ ],
57
+ "type": [
58
+ "./dist/type.d.ts"
59
+ ]
60
+ }
61
+ },
62
+ "scripts": {
63
+ "build": "rslib build",
64
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\"",
65
+ "test": "pnpm exec jest --config jest.config.ts --passWithNoTests",
66
+ "pre-release": "pnpm run test && pnpm run build"
67
+ }
68
+ }