Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@module-federation/sdk

Package Overview
Dependencies
Maintainers
4
Versions
1203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/sdk - npm Package Compare versions

Comparing version
0.0.0-feat-error-capture-20260313091847
to
0.0.0-feat-federationdiagnosticerror-20260511031552
+0
-8
dist/constant.cjs

@@ -31,9 +31,2 @@

const TEMP_DIR = ".federation";
const MFPrefetchCommon = {
identifier: "MFDataPrefetch",
globalKey: "__PREFETCH__",
library: "mf-data-prefetch",
exportsKey: "__PREFETCH_EXPORTS__",
fileName: "bootstrap.js"
};
let TreeShakingStatus = /* @__PURE__ */ function(TreeShakingStatus) {

@@ -62,3 +55,2 @@ /**

exports.MFModuleType = MFModuleType;
exports.MFPrefetchCommon = MFPrefetchCommon;
exports.MODULE_DEVTOOL_IDENTIFIER = MODULE_DEVTOOL_IDENTIFIER;

@@ -65,0 +57,0 @@ exports.ManifestFileName = ManifestFileName;

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"constant.cjs","names":[],"sources":["../src/constant.ts"],"sourcesContent":["export const FederationModuleManifest = 'federation-manifest.json';\nexport const MANIFEST_EXT = '.json';\n\nexport const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';\n\nexport const NameTransformSymbol = {\n AT: '@',\n HYPHEN: '-',\n SLASH: '/',\n} as const;\nexport const NameTransformMap = {\n [NameTransformSymbol.AT]: 'scope_',\n [NameTransformSymbol.HYPHEN]: '_',\n [NameTransformSymbol.SLASH]: '__',\n} as const;\n\nexport const EncodedNameTransformMap = {\n [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,\n [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,\n [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,\n};\n\nexport const SEPARATOR = ':';\n\nexport const ManifestFileName = 'mf-manifest.json';\nexport const StatsFileName = 'mf-stats.json';\n\nexport const MFModuleType = {\n NPM: 'npm',\n APP: 'app',\n};\n\nexport const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';\nexport const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';\nexport const TEMP_DIR = '.federation';\n\nexport const MFPrefetchCommon = {\n identifier: 'MFDataPrefetch',\n globalKey: '__PREFETCH__',\n library: 'mf-data-prefetch',\n exportsKey: '__PREFETCH_EXPORTS__',\n fileName: 'bootstrap.js',\n};\n\nexport const enum TreeShakingStatus {\n /**\n * Not handled by deploy server, needs to infer by the real runtime period.\n */\n UNKNOWN = 1,\n /**\n * It means the shared has been calculated , runtime should take this shared as first choice.\n */\n CALCULATED = 2,\n /**\n * It means the shared has been calculated, and marked as no used\n */\n NO_USE = 0,\n}\n"],"mappings":";;AAAA,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAE5B,MAAa,kBAAkB;AAE/B,MAAa,sBAAsB;CACjC,IAAI;CACJ,QAAQ;CACR,OAAO;CACR;AACD,MAAa,mBAAmB;EAC7B,oBAAoB,KAAK;EACzB,oBAAoB,SAAS;EAC7B,oBAAoB,QAAQ;CAC9B;AAED,MAAa,0BAA0B;EACpC,iBAAiB,oBAAoB,MAAM,oBAAoB;EAC/D,iBAAiB,oBAAoB,UAAU,oBAAoB;EACnE,iBAAiB,oBAAoB,SAAS,oBAAoB;CACpE;AAED,MAAa,YAAY;AAEzB,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAE7B,MAAa,eAAe;CAC1B,KAAK;CACL,KAAK;CACN;AAED,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,WAAW;AAExB,MAAa,mBAAmB;CAC9B,YAAY;CACZ,WAAW;CACX,SAAS;CACT,YAAY;CACZ,UAAU;CACX;AAED,IAAkB,gEAAX;;;;AAIL;;;;AAIA;;;;AAIA"}
{"version":3,"file":"constant.cjs","names":[],"sources":["../src/constant.ts"],"sourcesContent":["export const FederationModuleManifest = 'federation-manifest.json';\nexport const MANIFEST_EXT = '.json';\n\nexport const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';\n\nexport const NameTransformSymbol = {\n AT: '@',\n HYPHEN: '-',\n SLASH: '/',\n} as const;\nexport const NameTransformMap = {\n [NameTransformSymbol.AT]: 'scope_',\n [NameTransformSymbol.HYPHEN]: '_',\n [NameTransformSymbol.SLASH]: '__',\n} as const;\n\nexport const EncodedNameTransformMap = {\n [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,\n [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,\n [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,\n};\n\nexport const SEPARATOR = ':';\n\nexport const ManifestFileName = 'mf-manifest.json';\nexport const StatsFileName = 'mf-stats.json';\n\nexport const MFModuleType = {\n NPM: 'npm',\n APP: 'app',\n};\n\nexport const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';\nexport const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';\nexport const TEMP_DIR = '.federation';\n\nexport const enum TreeShakingStatus {\n /**\n * Not handled by deploy server, needs to infer by the real runtime period.\n */\n UNKNOWN = 1,\n /**\n * It means the shared has been calculated , runtime should take this shared as first choice.\n */\n CALCULATED = 2,\n /**\n * It means the shared has been calculated, and marked as no used\n */\n NO_USE = 0,\n}\n"],"mappings":";;AAAA,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAE5B,MAAa,kBAAkB;AAE/B,MAAa,sBAAsB;CACjC,IAAI;CACJ,QAAQ;CACR,OAAO;CACR;AACD,MAAa,mBAAmB;EAC7B,oBAAoB,KAAK;EACzB,oBAAoB,SAAS;EAC7B,oBAAoB,QAAQ;CAC9B;AAED,MAAa,0BAA0B;EACpC,iBAAiB,oBAAoB,MAAM,oBAAoB;EAC/D,iBAAiB,oBAAoB,UAAU,oBAAoB;EACnE,iBAAiB,oBAAoB,SAAS,oBAAoB;CACpE;AAED,MAAa,YAAY;AAEzB,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAE7B,MAAa,eAAe;CAC1B,KAAK;CACL,KAAK;CACN;AAED,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,WAAW;AAExB,IAAkB,gEAAX;;;;AAIL;;;;AAIA;;;;AAIA"}

@@ -30,9 +30,2 @@ //#region src/constant.d.ts

declare const TEMP_DIR = ".federation";
declare const MFPrefetchCommon: {
identifier: string;
globalKey: string;
library: string;
exportsKey: string;
fileName: string;
};
declare const enum TreeShakingStatus {

@@ -53,3 +46,3 @@ /**

//#endregion
export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus };
export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus };
//# sourceMappingURL=constant.d.ts.map

@@ -30,9 +30,2 @@ //#region src/constant.ts

const TEMP_DIR = ".federation";
const MFPrefetchCommon = {
identifier: "MFDataPrefetch",
globalKey: "__PREFETCH__",
library: "mf-data-prefetch",
exportsKey: "__PREFETCH_EXPORTS__",
fileName: "bootstrap.js"
};
let TreeShakingStatus = /* @__PURE__ */ function(TreeShakingStatus) {

@@ -55,3 +48,3 @@ /**

//#endregion
export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus };
export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus };
//# sourceMappingURL=constant.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"constant.js","names":[],"sources":["../src/constant.ts"],"sourcesContent":["export const FederationModuleManifest = 'federation-manifest.json';\nexport const MANIFEST_EXT = '.json';\n\nexport const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';\n\nexport const NameTransformSymbol = {\n AT: '@',\n HYPHEN: '-',\n SLASH: '/',\n} as const;\nexport const NameTransformMap = {\n [NameTransformSymbol.AT]: 'scope_',\n [NameTransformSymbol.HYPHEN]: '_',\n [NameTransformSymbol.SLASH]: '__',\n} as const;\n\nexport const EncodedNameTransformMap = {\n [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,\n [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,\n [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,\n};\n\nexport const SEPARATOR = ':';\n\nexport const ManifestFileName = 'mf-manifest.json';\nexport const StatsFileName = 'mf-stats.json';\n\nexport const MFModuleType = {\n NPM: 'npm',\n APP: 'app',\n};\n\nexport const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';\nexport const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';\nexport const TEMP_DIR = '.federation';\n\nexport const MFPrefetchCommon = {\n identifier: 'MFDataPrefetch',\n globalKey: '__PREFETCH__',\n library: 'mf-data-prefetch',\n exportsKey: '__PREFETCH_EXPORTS__',\n fileName: 'bootstrap.js',\n};\n\nexport const enum TreeShakingStatus {\n /**\n * Not handled by deploy server, needs to infer by the real runtime period.\n */\n UNKNOWN = 1,\n /**\n * It means the shared has been calculated , runtime should take this shared as first choice.\n */\n CALCULATED = 2,\n /**\n * It means the shared has been calculated, and marked as no used\n */\n NO_USE = 0,\n}\n"],"mappings":";AAAA,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAE5B,MAAa,kBAAkB;AAE/B,MAAa,sBAAsB;CACjC,IAAI;CACJ,QAAQ;CACR,OAAO;CACR;AACD,MAAa,mBAAmB;EAC7B,oBAAoB,KAAK;EACzB,oBAAoB,SAAS;EAC7B,oBAAoB,QAAQ;CAC9B;AAED,MAAa,0BAA0B;EACpC,iBAAiB,oBAAoB,MAAM,oBAAoB;EAC/D,iBAAiB,oBAAoB,UAAU,oBAAoB;EACnE,iBAAiB,oBAAoB,SAAS,oBAAoB;CACpE;AAED,MAAa,YAAY;AAEzB,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAE7B,MAAa,eAAe;CAC1B,KAAK;CACL,KAAK;CACN;AAED,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,WAAW;AAExB,MAAa,mBAAmB;CAC9B,YAAY;CACZ,WAAW;CACX,SAAS;CACT,YAAY;CACZ,UAAU;CACX;AAED,IAAkB,gEAAX;;;;AAIL;;;;AAIA;;;;AAIA"}
{"version":3,"file":"constant.js","names":[],"sources":["../src/constant.ts"],"sourcesContent":["export const FederationModuleManifest = 'federation-manifest.json';\nexport const MANIFEST_EXT = '.json';\n\nexport const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';\n\nexport const NameTransformSymbol = {\n AT: '@',\n HYPHEN: '-',\n SLASH: '/',\n} as const;\nexport const NameTransformMap = {\n [NameTransformSymbol.AT]: 'scope_',\n [NameTransformSymbol.HYPHEN]: '_',\n [NameTransformSymbol.SLASH]: '__',\n} as const;\n\nexport const EncodedNameTransformMap = {\n [NameTransformMap[NameTransformSymbol.AT]]: NameTransformSymbol.AT,\n [NameTransformMap[NameTransformSymbol.HYPHEN]]: NameTransformSymbol.HYPHEN,\n [NameTransformMap[NameTransformSymbol.SLASH]]: NameTransformSymbol.SLASH,\n};\n\nexport const SEPARATOR = ':';\n\nexport const ManifestFileName = 'mf-manifest.json';\nexport const StatsFileName = 'mf-stats.json';\n\nexport const MFModuleType = {\n NPM: 'npm',\n APP: 'app',\n};\n\nexport const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';\nexport const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';\nexport const TEMP_DIR = '.federation';\n\nexport const enum TreeShakingStatus {\n /**\n * Not handled by deploy server, needs to infer by the real runtime period.\n */\n UNKNOWN = 1,\n /**\n * It means the shared has been calculated , runtime should take this shared as first choice.\n */\n CALCULATED = 2,\n /**\n * It means the shared has been calculated, and marked as no used\n */\n NO_USE = 0,\n}\n"],"mappings":";AAAA,MAAa,2BAA2B;AACxC,MAAa,eAAe;AAE5B,MAAa,kBAAkB;AAE/B,MAAa,sBAAsB;CACjC,IAAI;CACJ,QAAQ;CACR,OAAO;CACR;AACD,MAAa,mBAAmB;EAC7B,oBAAoB,KAAK;EACzB,oBAAoB,SAAS;EAC7B,oBAAoB,QAAQ;CAC9B;AAED,MAAa,0BAA0B;EACpC,iBAAiB,oBAAoB,MAAM,oBAAoB;EAC/D,iBAAiB,oBAAoB,UAAU,oBAAoB;EACnE,iBAAiB,oBAAoB,SAAS,oBAAoB;CACpE;AAED,MAAa,YAAY;AAEzB,MAAa,mBAAmB;AAChC,MAAa,gBAAgB;AAE7B,MAAa,eAAe;CAC1B,KAAK;CACL,KAAK;CACN;AAED,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,WAAW;AAExB,IAAkB,gEAAX;;;;AAIL;;;;AAIA;;;;AAIA"}

@@ -66,3 +66,3 @@ const require_utils = require('./utils.cjs');

if (event?.type === "error") {
const networkError = /* @__PURE__ */ new Error(`ScriptNetworkError: Failed to load script "${info.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);
const networkError = /* @__PURE__ */ new Error(event?.isTimeout ? `ScriptNetworkError: Script "${info.url}" timed out.` : `ScriptNetworkError: Failed to load script "${info.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);
networkError.name = "ScriptNetworkError";

@@ -96,3 +96,6 @@ info?.onErrorCallback && info?.onErrorCallback(networkError);

timeoutId = setTimeout(() => {
onScriptComplete(null, /* @__PURE__ */ new Error(`Remote script "${info.url}" time-outed.`));
onScriptComplete(null, {
type: "error",
isTimeout: true
});
}, timeout);

@@ -99,0 +102,0 @@ return {

@@ -1,1 +0,1 @@

{"version":3,"file":"dom.cjs","names":["warn"],"sources":["../src/dom.ts"],"sourcesContent":["import type { CreateScriptHookDom, CreateScriptHookReturnDom } from './types';\nimport { warn } from './utils';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n callback: T,\n disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n try {\n const res = await callback();\n return res;\n } catch (e) {\n !disableWarn && warn(e);\n return;\n }\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n const REG_EXP = /^(https?:)?\\/\\//i;\n // Transform url1 and url2 into relative paths\n const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n // Check if the relative paths are identical\n return relativeUrl1 === relativeUrl2;\n}\n\nexport function createScript(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs?: Record<string, any>;\n needDeleteScript?: boolean;\n createScriptHook?: CreateScriptHookDom;\n}): { script: HTMLScriptElement; needAttach: boolean } {\n // Retrieve the existing script element by its src attribute\n let script: HTMLScriptElement | null = null;\n let needAttach = true;\n let timeout = 20000;\n let timeoutId: NodeJS.Timeout;\n const scripts = document.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const s = scripts[i];\n const scriptSrc = s.getAttribute('src');\n if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {\n script = s;\n needAttach = false;\n break;\n }\n }\n\n if (!script) {\n const attrs = info.attrs;\n script = document.createElement('script');\n script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';\n let createScriptRes: CreateScriptHookReturnDom = undefined;\n if (info.createScriptHook) {\n createScriptRes = info.createScriptHook(info.url, info.attrs);\n\n if (createScriptRes instanceof HTMLScriptElement) {\n script = createScriptRes;\n } else if (typeof createScriptRes === 'object') {\n if ('script' in createScriptRes && createScriptRes.script) {\n script = createScriptRes.script;\n }\n if ('timeout' in createScriptRes && createScriptRes.timeout) {\n timeout = createScriptRes.timeout;\n }\n }\n }\n if (!script.src) {\n script.src = info.url;\n }\n if (attrs && !createScriptRes) {\n Object.keys(attrs).forEach((name) => {\n if (script) {\n if (name === 'async' || name === 'defer') {\n script[name] = attrs[name];\n // Attributes that do not exist are considered overridden\n } else if (!script.getAttribute(name)) {\n script.setAttribute(name, attrs[name]);\n }\n }\n });\n }\n }\n\n // Capture JS runtime errors thrown by this script's IIFE during execution.\n // The browser still fires onload even when the script throws, so without this\n // listener the execution error would silently become an uncaught global exception.\n let executionError: Error | null = null;\n const executionErrorHandler =\n typeof window !== 'undefined'\n ? (evt: ErrorEvent) => {\n if (evt.filename && isStaticResourcesEqual(evt.filename, info.url)) {\n const err = new Error(\n `ScriptExecutionError: Script \"${info.url}\" loaded but threw a runtime error during execution: ${evt.message} (${evt.filename}:${evt.lineno}:${evt.colno})`,\n );\n err.name = 'ScriptExecutionError';\n executionError = err;\n }\n }\n : null;\n if (executionErrorHandler) {\n window.addEventListener('error', executionErrorHandler);\n }\n\n const onScriptComplete = async (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): Promise<void> => {\n clearTimeout(timeoutId);\n if (executionErrorHandler) {\n window.removeEventListener('error', executionErrorHandler);\n }\n const onScriptCompleteCallback = () => {\n if (event?.type === 'error') {\n const networkError = new Error(\n `ScriptNetworkError: Failed to load script \"${info.url}\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`,\n );\n networkError.name = 'ScriptNetworkError';\n info?.onErrorCallback && info?.onErrorCallback(networkError);\n } else if (executionError) {\n // Script fetched OK (onload fired) but IIFE threw during execution.\n info?.onErrorCallback && info?.onErrorCallback(executionError);\n } else {\n info?.cb && info?.cb();\n }\n };\n\n // Prevent memory leaks in IE.\n if (script) {\n script.onerror = null;\n script.onload = null;\n safeWrapper(() => {\n const { needDeleteScript = true } = info;\n if (needDeleteScript) {\n script?.parentNode && script.parentNode.removeChild(script);\n }\n });\n if (prev && typeof prev === 'function') {\n const result = (prev as any)(event);\n if (result instanceof Promise) {\n const res = await result;\n onScriptCompleteCallback();\n return res;\n }\n onScriptCompleteCallback();\n return result;\n }\n }\n onScriptCompleteCallback();\n };\n\n script.onerror = onScriptComplete.bind(null, script.onerror);\n script.onload = onScriptComplete.bind(null, script.onload);\n\n timeoutId = setTimeout(() => {\n onScriptComplete(\n null,\n new Error(`Remote script \"${info.url}\" time-outed.`),\n );\n }, timeout);\n\n return { script, needAttach };\n}\n\nexport function createLink(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs: Record<string, string>;\n needDeleteLink?: boolean;\n createLinkHook?: (\n url: string,\n attrs?: Record<string, any>,\n ) => HTMLLinkElement | void;\n}) {\n // <link rel=\"preload\" href=\"script.js\" as=\"script\">\n\n // Retrieve the existing script element by its src attribute\n let link: HTMLLinkElement | null = null;\n let needAttach = true;\n const links = document.getElementsByTagName('link');\n for (let i = 0; i < links.length; i++) {\n const l = links[i];\n const linkHref = l.getAttribute('href');\n const linkRel = l.getAttribute('rel');\n if (\n linkHref &&\n isStaticResourcesEqual(linkHref, info.url) &&\n linkRel === info.attrs['rel']\n ) {\n link = l;\n needAttach = false;\n break;\n }\n }\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', info.url);\n\n let createLinkRes: void | HTMLLinkElement = undefined;\n const attrs = info.attrs;\n\n if (info.createLinkHook) {\n createLinkRes = info.createLinkHook(info.url, attrs);\n if (createLinkRes instanceof HTMLLinkElement) {\n link = createLinkRes;\n }\n }\n\n if (attrs && !createLinkRes) {\n Object.keys(attrs).forEach((name) => {\n if (link && !link.getAttribute(name)) {\n link.setAttribute(name, attrs[name]);\n }\n });\n }\n }\n\n const onLinkComplete = (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): void => {\n const onLinkCompleteCallback = () => {\n if (event?.type === 'error') {\n info?.onErrorCallback && info?.onErrorCallback(event);\n } else {\n info?.cb && info?.cb();\n }\n };\n // Prevent memory leaks in IE.\n if (link) {\n link.onerror = null;\n link.onload = null;\n safeWrapper(() => {\n const { needDeleteLink = true } = info;\n if (needDeleteLink) {\n link?.parentNode && link.parentNode.removeChild(link);\n }\n });\n if (prev) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const res = (prev as any)(event);\n onLinkCompleteCallback();\n return res;\n }\n }\n onLinkCompleteCallback();\n };\n\n link.onerror = onLinkComplete.bind(null, link.onerror);\n link.onload = onLinkComplete.bind(null, link.onload);\n\n return { link, needAttach };\n}\n\nexport function loadScript(\n url: string,\n info: {\n attrs?: Record<string, any>;\n createScriptHook?: CreateScriptHookDom;\n },\n) {\n const { attrs = {}, createScriptHook } = info;\n return new Promise<void>((resolve, reject) => {\n const { script, needAttach } = createScript({\n url,\n cb: resolve,\n onErrorCallback: reject,\n attrs: {\n fetchpriority: 'high',\n ...attrs,\n },\n createScriptHook,\n needDeleteScript: true,\n });\n needAttach && document.head.appendChild(script);\n });\n}\n"],"mappings":";;;AAGA,eAAsB,YACpB,UACA,aACoC;AACpC,KAAI;AAEF,SADY,MAAM,UAAU;UAErB,GAAG;AACV,GAAC,eAAeA,mBAAK,EAAE;AAC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e,KAAK,MAAM,KAAK,OAAO;AAEpD,QAAO;EAAE;EAAM;EAAY;;AAG7B,SAAgB,WACd,KACA,MAIA;CACA,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB;AACzC,QAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,MAAM,EAAE,QAAQ,eAAe,aAAa;GAC1C;GACA,IAAI;GACJ,iBAAiB;GACjB,OAAO;IACL,eAAe;IACf,GAAG;IACJ;GACD;GACA,kBAAkB;GACnB,CAAC;AACF,gBAAc,SAAS,KAAK,YAAY,OAAO;GAC/C"}
{"version":3,"file":"dom.cjs","names":["warn"],"sources":["../src/dom.ts"],"sourcesContent":["import type { CreateScriptHookDom, CreateScriptHookReturnDom } from './types';\nimport { warn } from './utils';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n callback: T,\n disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n try {\n const res = await callback();\n return res;\n } catch (e) {\n !disableWarn && warn(e);\n return;\n }\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n const REG_EXP = /^(https?:)?\\/\\//i;\n // Transform url1 and url2 into relative paths\n const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n // Check if the relative paths are identical\n return relativeUrl1 === relativeUrl2;\n}\n\nexport function createScript(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs?: Record<string, any>;\n needDeleteScript?: boolean;\n createScriptHook?: CreateScriptHookDom;\n}): { script: HTMLScriptElement; needAttach: boolean } {\n // Retrieve the existing script element by its src attribute\n let script: HTMLScriptElement | null = null;\n let needAttach = true;\n let timeout = 20000;\n let timeoutId: NodeJS.Timeout;\n const scripts = document.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const s = scripts[i];\n const scriptSrc = s.getAttribute('src');\n if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {\n script = s;\n needAttach = false;\n break;\n }\n }\n\n if (!script) {\n const attrs = info.attrs;\n script = document.createElement('script');\n script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';\n let createScriptRes: CreateScriptHookReturnDom = undefined;\n if (info.createScriptHook) {\n createScriptRes = info.createScriptHook(info.url, info.attrs);\n\n if (createScriptRes instanceof HTMLScriptElement) {\n script = createScriptRes;\n } else if (typeof createScriptRes === 'object') {\n if ('script' in createScriptRes && createScriptRes.script) {\n script = createScriptRes.script;\n }\n if ('timeout' in createScriptRes && createScriptRes.timeout) {\n timeout = createScriptRes.timeout;\n }\n }\n }\n if (!script.src) {\n script.src = info.url;\n }\n if (attrs && !createScriptRes) {\n Object.keys(attrs).forEach((name) => {\n if (script) {\n if (name === 'async' || name === 'defer') {\n script[name] = attrs[name];\n // Attributes that do not exist are considered overridden\n } else if (!script.getAttribute(name)) {\n script.setAttribute(name, attrs[name]);\n }\n }\n });\n }\n }\n\n // Capture JS runtime errors thrown by this script's IIFE during execution.\n // The browser still fires onload even when the script throws, so without this\n // listener the execution error would silently become an uncaught global exception.\n let executionError: Error | null = null;\n const executionErrorHandler =\n typeof window !== 'undefined'\n ? (evt: ErrorEvent) => {\n if (evt.filename && isStaticResourcesEqual(evt.filename, info.url)) {\n const err = new Error(\n `ScriptExecutionError: Script \"${info.url}\" loaded but threw a runtime error during execution: ${evt.message} (${evt.filename}:${evt.lineno}:${evt.colno})`,\n );\n err.name = 'ScriptExecutionError';\n executionError = err;\n }\n }\n : null;\n if (executionErrorHandler) {\n window.addEventListener('error', executionErrorHandler);\n }\n\n const onScriptComplete = async (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): Promise<void> => {\n clearTimeout(timeoutId);\n if (executionErrorHandler) {\n window.removeEventListener('error', executionErrorHandler);\n }\n const onScriptCompleteCallback = () => {\n if (event?.type === 'error') {\n const networkError = new Error(\n event?.isTimeout\n ? `ScriptNetworkError: Script \"${info.url}\" timed out.`\n : `ScriptNetworkError: Failed to load script \"${info.url}\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`,\n );\n networkError.name = 'ScriptNetworkError';\n info?.onErrorCallback && info?.onErrorCallback(networkError);\n } else if (executionError) {\n // Script fetched OK (onload fired) but IIFE threw during execution.\n info?.onErrorCallback && info?.onErrorCallback(executionError);\n } else {\n info?.cb && info?.cb();\n }\n };\n\n // Prevent memory leaks in IE.\n if (script) {\n script.onerror = null;\n script.onload = null;\n safeWrapper(() => {\n const { needDeleteScript = true } = info;\n if (needDeleteScript) {\n script?.parentNode && script.parentNode.removeChild(script);\n }\n });\n if (prev && typeof prev === 'function') {\n const result = (prev as any)(event);\n if (result instanceof Promise) {\n const res = await result;\n onScriptCompleteCallback();\n return res;\n }\n onScriptCompleteCallback();\n return result;\n }\n }\n onScriptCompleteCallback();\n };\n\n script.onerror = onScriptComplete.bind(null, script.onerror);\n script.onload = onScriptComplete.bind(null, script.onload);\n\n timeoutId = setTimeout(() => {\n onScriptComplete(null, { type: 'error', isTimeout: true });\n }, timeout);\n\n return { script, needAttach };\n}\n\nexport function createLink(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs: Record<string, string>;\n needDeleteLink?: boolean;\n createLinkHook?: (\n url: string,\n attrs?: Record<string, any>,\n ) => HTMLLinkElement | void;\n}) {\n // <link rel=\"preload\" href=\"script.js\" as=\"script\">\n\n // Retrieve the existing script element by its src attribute\n let link: HTMLLinkElement | null = null;\n let needAttach = true;\n const links = document.getElementsByTagName('link');\n for (let i = 0; i < links.length; i++) {\n const l = links[i];\n const linkHref = l.getAttribute('href');\n const linkRel = l.getAttribute('rel');\n if (\n linkHref &&\n isStaticResourcesEqual(linkHref, info.url) &&\n linkRel === info.attrs['rel']\n ) {\n link = l;\n needAttach = false;\n break;\n }\n }\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', info.url);\n\n let createLinkRes: void | HTMLLinkElement = undefined;\n const attrs = info.attrs;\n\n if (info.createLinkHook) {\n createLinkRes = info.createLinkHook(info.url, attrs);\n if (createLinkRes instanceof HTMLLinkElement) {\n link = createLinkRes;\n }\n }\n\n if (attrs && !createLinkRes) {\n Object.keys(attrs).forEach((name) => {\n if (link && !link.getAttribute(name)) {\n link.setAttribute(name, attrs[name]);\n }\n });\n }\n }\n\n const onLinkComplete = (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): void => {\n const onLinkCompleteCallback = () => {\n if (event?.type === 'error') {\n info?.onErrorCallback && info?.onErrorCallback(event);\n } else {\n info?.cb && info?.cb();\n }\n };\n // Prevent memory leaks in IE.\n if (link) {\n link.onerror = null;\n link.onload = null;\n safeWrapper(() => {\n const { needDeleteLink = true } = info;\n if (needDeleteLink) {\n link?.parentNode && link.parentNode.removeChild(link);\n }\n });\n if (prev) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const res = (prev as any)(event);\n onLinkCompleteCallback();\n return res;\n }\n }\n onLinkCompleteCallback();\n };\n\n link.onerror = onLinkComplete.bind(null, link.onerror);\n link.onload = onLinkComplete.bind(null, link.onload);\n\n return { link, needAttach };\n}\n\nexport function loadScript(\n url: string,\n info: {\n attrs?: Record<string, any>;\n createScriptHook?: CreateScriptHookDom;\n },\n) {\n const { attrs = {}, createScriptHook } = info;\n return new Promise<void>((resolve, reject) => {\n const { script, needAttach } = createScript({\n url,\n cb: resolve,\n onErrorCallback: reject,\n attrs: {\n fetchpriority: 'high',\n ...attrs,\n },\n createScriptHook,\n needDeleteScript: true,\n });\n needAttach && document.head.appendChild(script);\n });\n}\n"],"mappings":";;;AAGA,eAAsB,YACpB,UACA,aACoC;AACpC,KAAI;AAEF,SADY,MAAM,UAAU;UAErB,GAAG;AACV,GAAC,eAAeA,mBAA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AAK,MAAM,KAAK,QAAQ;AACtD,MAAK,SAAS,eAAe,KAAK,MAAM,KAAK,OAAO;AAEpD,QAAO;EAAE;EAAM;EAAY;;AAG7B,SAAgB,WACd,KACA,MAIA;CACA,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB;AACzC,QAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,MAAM,EAAE,QAAQ,eAAe,aAAa;GAC1C;GACA,IAAI;GACJ,iBAAiB;GACjB,OAAO;IACL,eAAe;IACf,GAAG;IACJ;GACD;GACA,kBAAkB;GACnB,CAAC;AACF,gBAAc,SAAS,KAAK,YAAY,OAAO;GAC/C"}

@@ -66,3 +66,3 @@ import { warn } from "./utils.js";

if (event?.type === "error") {
const networkError = /* @__PURE__ */ new Error(`ScriptNetworkError: Failed to load script "${info.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);
const networkError = /* @__PURE__ */ new Error(event?.isTimeout ? `ScriptNetworkError: Script "${info.url}" timed out.` : `ScriptNetworkError: Failed to load script "${info.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);
networkError.name = "ScriptNetworkError";

@@ -96,3 +96,6 @@ info?.onErrorCallback && info?.onErrorCallback(networkError);

timeoutId = setTimeout(() => {
onScriptComplete(null, /* @__PURE__ */ new Error(`Remote script "${info.url}" time-outed.`));
onScriptComplete(null, {
type: "error",
isTimeout: true
});
}, timeout);

@@ -99,0 +102,0 @@ return {

@@ -1,1 +0,1 @@

{"version":3,"file":"dom.js","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import type { CreateScriptHookDom, CreateScriptHookReturnDom } from './types';\nimport { warn } from './utils';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n callback: T,\n disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n try {\n const res = await callback();\n return res;\n } catch (e) {\n !disableWarn && warn(e);\n return;\n }\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n const REG_EXP = /^(https?:)?\\/\\//i;\n // Transform url1 and url2 into relative paths\n const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n // Check if the relative paths are identical\n return relativeUrl1 === relativeUrl2;\n}\n\nexport function createScript(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs?: Record<string, any>;\n needDeleteScript?: boolean;\n createScriptHook?: CreateScriptHookDom;\n}): { script: HTMLScriptElement; needAttach: boolean } {\n // Retrieve the existing script element by its src attribute\n let script: HTMLScriptElement | null = null;\n let needAttach = true;\n let timeout = 20000;\n let timeoutId: NodeJS.Timeout;\n const scripts = document.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const s = scripts[i];\n const scriptSrc = s.getAttribute('src');\n if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {\n script = s;\n needAttach = false;\n break;\n }\n }\n\n if (!script) {\n const attrs = info.attrs;\n script = document.createElement('script');\n script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';\n let createScriptRes: CreateScriptHookReturnDom = undefined;\n if (info.createScriptHook) {\n createScriptRes = info.createScriptHook(info.url, info.attrs);\n\n if (createScriptRes instanceof HTMLScriptElement) {\n script = createScriptRes;\n } else if (typeof createScriptRes === 'object') {\n if ('script' in createScriptRes && createScriptRes.script) {\n script = createScriptRes.script;\n }\n if ('timeout' in createScriptRes && createScriptRes.timeout) {\n timeout = createScriptRes.timeout;\n }\n }\n }\n if (!script.src) {\n script.src = info.url;\n }\n if (attrs && !createScriptRes) {\n Object.keys(attrs).forEach((name) => {\n if (script) {\n if (name === 'async' || name === 'defer') {\n script[name] = attrs[name];\n // Attributes that do not exist are considered overridden\n } else if (!script.getAttribute(name)) {\n script.setAttribute(name, attrs[name]);\n }\n }\n });\n }\n }\n\n // Capture JS runtime errors thrown by this script's IIFE during execution.\n // The browser still fires onload even when the script throws, so without this\n // listener the execution error would silently become an uncaught global exception.\n let executionError: Error | null = null;\n const executionErrorHandler =\n typeof window !== 'undefined'\n ? (evt: ErrorEvent) => {\n if (evt.filename && isStaticResourcesEqual(evt.filename, info.url)) {\n const err = new Error(\n `ScriptExecutionError: Script \"${info.url}\" loaded but threw a runtime error during execution: ${evt.message} (${evt.filename}:${evt.lineno}:${evt.colno})`,\n );\n err.name = 'ScriptExecutionError';\n executionError = err;\n }\n }\n : null;\n if (executionErrorHandler) {\n window.addEventListener('error', executionErrorHandler);\n }\n\n const onScriptComplete = async (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): Promise<void> => {\n clearTimeout(timeoutId);\n if (executionErrorHandler) {\n window.removeEventListener('error', executionErrorHandler);\n }\n const onScriptCompleteCallback = () => {\n if (event?.type === 'error') {\n const networkError = new Error(\n `ScriptNetworkError: Failed to load script \"${info.url}\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`,\n );\n networkError.name = 'ScriptNetworkError';\n info?.onErrorCallback && info?.onErrorCallback(networkError);\n } else if (executionError) {\n // Script fetched OK (onload fired) but IIFE threw during execution.\n info?.onErrorCallback && info?.onErrorCallback(executionError);\n } else {\n info?.cb && info?.cb();\n }\n };\n\n // Prevent memory leaks in IE.\n if (script) {\n script.onerror = null;\n script.onload = null;\n safeWrapper(() => {\n const { needDeleteScript = true } = info;\n if (needDeleteScript) {\n script?.parentNode && script.parentNode.removeChild(script);\n }\n });\n if (prev && typeof prev === 'function') {\n const result = (prev as any)(event);\n if (result instanceof Promise) {\n const res = await result;\n onScriptCompleteCallback();\n return res;\n }\n onScriptCompleteCallback();\n return result;\n }\n }\n onScriptCompleteCallback();\n };\n\n script.onerror = onScriptComplete.bind(null, script.onerror);\n script.onload = onScriptComplete.bind(null, script.onload);\n\n timeoutId = setTimeout(() => {\n onScriptComplete(\n null,\n new Error(`Remote script \"${info.url}\" time-outed.`),\n );\n }, timeout);\n\n return { script, needAttach };\n}\n\nexport function createLink(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs: Record<string, string>;\n needDeleteLink?: boolean;\n createLinkHook?: (\n url: string,\n attrs?: Record<string, any>,\n ) => HTMLLinkElement | void;\n}) {\n // <link rel=\"preload\" href=\"script.js\" as=\"script\">\n\n // Retrieve the existing script element by its src attribute\n let link: HTMLLinkElement | null = null;\n let needAttach = true;\n const links = document.getElementsByTagName('link');\n for (let i = 0; i < links.length; i++) {\n const l = links[i];\n const linkHref = l.getAttribute('href');\n const linkRel = l.getAttribute('rel');\n if (\n linkHref &&\n isStaticResourcesEqual(linkHref, info.url) &&\n linkRel === info.attrs['rel']\n ) {\n link = l;\n needAttach = false;\n break;\n }\n }\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', info.url);\n\n let createLinkRes: void | HTMLLinkElement = undefined;\n const attrs = info.attrs;\n\n if (info.createLinkHook) {\n createLinkRes = info.createLinkHook(info.url, attrs);\n if (createLinkRes instanceof HTMLLinkElement) {\n link = createLinkRes;\n }\n }\n\n if (attrs && !createLinkRes) {\n Object.keys(attrs).forEach((name) => {\n if (link && !link.getAttribute(name)) {\n link.setAttribute(name, attrs[name]);\n }\n });\n }\n }\n\n const onLinkComplete = (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): void => {\n const onLinkCompleteCallback = () => {\n if (event?.type === 'error') {\n info?.onErrorCallback && info?.onErrorCallback(event);\n } else {\n info?.cb && info?.cb();\n }\n };\n // Prevent memory leaks in IE.\n if (link) {\n link.onerror = null;\n link.onload = null;\n safeWrapper(() => {\n const { needDeleteLink = true } = info;\n if (needDeleteLink) {\n link?.parentNode && link.parentNode.removeChild(link);\n }\n });\n if (prev) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const res = (prev as any)(event);\n onLinkCompleteCallback();\n return res;\n }\n }\n onLinkCompleteCallback();\n };\n\n link.onerror = onLinkComplete.bind(null, link.onerror);\n link.onload = onLinkComplete.bind(null, link.onload);\n\n return { link, needAttach };\n}\n\nexport function loadScript(\n url: string,\n info: {\n attrs?: Record<string, any>;\n createScriptHook?: CreateScriptHookDom;\n },\n) {\n const { attrs = {}, createScriptHook } = info;\n return new Promise<void>((resolve, reject) => {\n const { script, needAttach } = createScript({\n url,\n cb: resolve,\n onErrorCallback: reject,\n attrs: {\n fetchpriority: 'high',\n ...attrs,\n },\n createScriptHook,\n needDeleteScript: true,\n });\n needAttach && document.head.appendChild(script);\n });\n}\n"],"mappings":";;;AAGA,eAAsB,YACpB,UACA,aACoC;AACpC,KAAI;AAEF,SADY,MAAM,UAAU;UAErB,GAAG;AACV,GAAC,eAAe,KAAK,EAAE;AACvB;;;AAIJ,SAAgB,uBAAuB,MAAc,MAAuB;CAC1E,MAAM,UAAU;AAKhB,QAHqB,KAAK,QAAQ,SAAS,GAAG,CAAC,QAAQ,OAAO,GAAG,KAC5C,KAAK,QAAQ,SAAS,GAAG,CAAC,QAAQ,OAAO,GAAG;;AAKnE,SAAgB,aAAa,MAO0B;CAErD,IAAI,SAAmC;CACvC,IAAI,aAAa;CACjB,IAAI,UAAU;CACd,IAAI;CACJ,MAAM,UAAU,SAAS,qBAAqB,SAAS;AAEvD,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,IAAI,QAAQ;EAClB,MAAM,YAAY,EAAE,aAAa,MAAM;AACvC,MAAI,aAAa,uBAAuB,WAAW,KAAK,IAAI,EAAE;AAC5D,YAAS;AACT,gBAAa;AACb;;;AAIJ,KAAI,CAAC,QAAQ;EACX,MAAM,QAAQ,KAAK;AACnB,WAAS,SAAS,cAAc,SAAS;AACzC,SAAO,OAAO,QAAQ,YAAY,WAAW,WAAW;EACxD,IAAI,kBAA6C;AACjD,MAAI,KAAK,kBAAkB;AACzB,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CAAC,KAAK,aAAa,KAAK,CAClC,MAAK,aAAa,MAAM,MAAM,MAAM;IAEtC;;CAIN,MAAM,kBACJ,MAEA,UACS;EACT,MAAM,+BAA+B;AACnC,OAAI,OAAO,SAAS,QAClB,OAAM,mBAAmB,MAAM,gBAAgB,MAAM;OAErD,OAAM,MAAM,MAAM,IAAI;;AAI1B,MAAI,MAAM;AACR,QAAK,UAAU;AACf,QAAK,SAAS;AACd,qBAAkB;IAChB,MAAM,EAAE,iBAAiB,SAAS;AAClC,QAAI,eACF,OAAM,cAAc,KAAK,WAAW,YAAY,KAAK;KAEvD;AACF,OAAI,MAAM;IAER,MAAM,MAAO,KAAa,MAAM;AAChC,4BAAwB;AACxB,WAAO;;;AAGX,0BAAwB;;AAG1B,MAAK,UAAU,eAAe,KAAK,MAAM,KAAK,QAAQ;AACtD,MAAK,SAAS,eAAe,KAAK,MAAM,KAAK,OAAO;AAEpD,QAAO;EAAE;EAAM;EAAY;;AAG7B,SAAgB,WACd,KACA,MAIA;CACA,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB;AACzC,QAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,MAAM,EAAE,QAAQ,eAAe,aAAa;GAC1C;GACA,IAAI;GACJ,iBAAiB;GACjB,OAAO;IACL,eAAe;IACf,GAAG;IACJ;GACD;GACA,kBAAkB;GACnB,CAAC;AACF,gBAAc,SAAS,KAAK,YAAY,OAAO;GAC/C"}
{"version":3,"file":"dom.js","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import type { CreateScriptHookDom, CreateScriptHookReturnDom } from './types';\nimport { warn } from './utils';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function safeWrapper<T extends (...args: Array<any>) => any>(\n callback: T,\n disableWarn?: boolean,\n): Promise<ReturnType<T> | undefined> {\n try {\n const res = await callback();\n return res;\n } catch (e) {\n !disableWarn && warn(e);\n return;\n }\n}\n\nexport function isStaticResourcesEqual(url1: string, url2: string): boolean {\n const REG_EXP = /^(https?:)?\\/\\//i;\n // Transform url1 and url2 into relative paths\n const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\\/$/, '');\n const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\\/$/, '');\n // Check if the relative paths are identical\n return relativeUrl1 === relativeUrl2;\n}\n\nexport function createScript(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs?: Record<string, any>;\n needDeleteScript?: boolean;\n createScriptHook?: CreateScriptHookDom;\n}): { script: HTMLScriptElement; needAttach: boolean } {\n // Retrieve the existing script element by its src attribute\n let script: HTMLScriptElement | null = null;\n let needAttach = true;\n let timeout = 20000;\n let timeoutId: NodeJS.Timeout;\n const scripts = document.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const s = scripts[i];\n const scriptSrc = s.getAttribute('src');\n if (scriptSrc && isStaticResourcesEqual(scriptSrc, info.url)) {\n script = s;\n needAttach = false;\n break;\n }\n }\n\n if (!script) {\n const attrs = info.attrs;\n script = document.createElement('script');\n script.type = attrs?.['type'] === 'module' ? 'module' : 'text/javascript';\n let createScriptRes: CreateScriptHookReturnDom = undefined;\n if (info.createScriptHook) {\n createScriptRes = info.createScriptHook(info.url, info.attrs);\n\n if (createScriptRes instanceof HTMLScriptElement) {\n script = createScriptRes;\n } else if (typeof createScriptRes === 'object') {\n if ('script' in createScriptRes && createScriptRes.script) {\n script = createScriptRes.script;\n }\n if ('timeout' in createScriptRes && createScriptRes.timeout) {\n timeout = createScriptRes.timeout;\n }\n }\n }\n if (!script.src) {\n script.src = info.url;\n }\n if (attrs && !createScriptRes) {\n Object.keys(attrs).forEach((name) => {\n if (script) {\n if (name === 'async' || name === 'defer') {\n script[name] = attrs[name];\n // Attributes that do not exist are considered overridden\n } else if (!script.getAttribute(name)) {\n script.setAttribute(name, attrs[name]);\n }\n }\n });\n }\n }\n\n // Capture JS runtime errors thrown by this script's IIFE during execution.\n // The browser still fires onload even when the script throws, so without this\n // listener the execution error would silently become an uncaught global exception.\n let executionError: Error | null = null;\n const executionErrorHandler =\n typeof window !== 'undefined'\n ? (evt: ErrorEvent) => {\n if (evt.filename && isStaticResourcesEqual(evt.filename, info.url)) {\n const err = new Error(\n `ScriptExecutionError: Script \"${info.url}\" loaded but threw a runtime error during execution: ${evt.message} (${evt.filename}:${evt.lineno}:${evt.colno})`,\n );\n err.name = 'ScriptExecutionError';\n executionError = err;\n }\n }\n : null;\n if (executionErrorHandler) {\n window.addEventListener('error', executionErrorHandler);\n }\n\n const onScriptComplete = async (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): Promise<void> => {\n clearTimeout(timeoutId);\n if (executionErrorHandler) {\n window.removeEventListener('error', executionErrorHandler);\n }\n const onScriptCompleteCallback = () => {\n if (event?.type === 'error') {\n const networkError = new Error(\n event?.isTimeout\n ? `ScriptNetworkError: Script \"${info.url}\" timed out.`\n : `ScriptNetworkError: Failed to load script \"${info.url}\" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`,\n );\n networkError.name = 'ScriptNetworkError';\n info?.onErrorCallback && info?.onErrorCallback(networkError);\n } else if (executionError) {\n // Script fetched OK (onload fired) but IIFE threw during execution.\n info?.onErrorCallback && info?.onErrorCallback(executionError);\n } else {\n info?.cb && info?.cb();\n }\n };\n\n // Prevent memory leaks in IE.\n if (script) {\n script.onerror = null;\n script.onload = null;\n safeWrapper(() => {\n const { needDeleteScript = true } = info;\n if (needDeleteScript) {\n script?.parentNode && script.parentNode.removeChild(script);\n }\n });\n if (prev && typeof prev === 'function') {\n const result = (prev as any)(event);\n if (result instanceof Promise) {\n const res = await result;\n onScriptCompleteCallback();\n return res;\n }\n onScriptCompleteCallback();\n return result;\n }\n }\n onScriptCompleteCallback();\n };\n\n script.onerror = onScriptComplete.bind(null, script.onerror);\n script.onload = onScriptComplete.bind(null, script.onload);\n\n timeoutId = setTimeout(() => {\n onScriptComplete(null, { type: 'error', isTimeout: true });\n }, timeout);\n\n return { script, needAttach };\n}\n\nexport function createLink(info: {\n url: string;\n cb?: (value: void | PromiseLike<void>) => void;\n onErrorCallback?: (error: Error) => void;\n attrs: Record<string, string>;\n needDeleteLink?: boolean;\n createLinkHook?: (\n url: string,\n attrs?: Record<string, any>,\n ) => HTMLLinkElement | void;\n}) {\n // <link rel=\"preload\" href=\"script.js\" as=\"script\">\n\n // Retrieve the existing script element by its src attribute\n let link: HTMLLinkElement | null = null;\n let needAttach = true;\n const links = document.getElementsByTagName('link');\n for (let i = 0; i < links.length; i++) {\n const l = links[i];\n const linkHref = l.getAttribute('href');\n const linkRel = l.getAttribute('rel');\n if (\n linkHref &&\n isStaticResourcesEqual(linkHref, info.url) &&\n linkRel === info.attrs['rel']\n ) {\n link = l;\n needAttach = false;\n break;\n }\n }\n\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', info.url);\n\n let createLinkRes: void | HTMLLinkElement = undefined;\n const attrs = info.attrs;\n\n if (info.createLinkHook) {\n createLinkRes = info.createLinkHook(info.url, attrs);\n if (createLinkRes instanceof HTMLLinkElement) {\n link = createLinkRes;\n }\n }\n\n if (attrs && !createLinkRes) {\n Object.keys(attrs).forEach((name) => {\n if (link && !link.getAttribute(name)) {\n link.setAttribute(name, attrs[name]);\n }\n });\n }\n }\n\n const onLinkComplete = (\n prev: OnErrorEventHandler | GlobalEventHandlers['onload'] | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n event: any,\n ): void => {\n const onLinkCompleteCallback = () => {\n if (event?.type === 'error') {\n info?.onErrorCallback && info?.onErrorCallback(event);\n } else {\n info?.cb && info?.cb();\n }\n };\n // Prevent memory leaks in IE.\n if (link) {\n link.onerror = null;\n link.onload = null;\n safeWrapper(() => {\n const { needDeleteLink = true } = info;\n if (needDeleteLink) {\n link?.parentNode && link.parentNode.removeChild(link);\n }\n });\n if (prev) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const res = (prev as any)(event);\n onLinkCompleteCallback();\n return res;\n }\n }\n onLinkCompleteCallback();\n };\n\n link.onerror = onLinkComplete.bind(null, link.onerror);\n link.onload = onLinkComplete.bind(null, link.onload);\n\n return { link, needAttach };\n}\n\nexport function loadScript(\n url: string,\n info: {\n attrs?: Record<string, any>;\n createScriptHook?: CreateScriptHookDom;\n },\n) {\n const { attrs = {}, createScriptHook } = info;\n return new Promise<void>((resolve, reject) => {\n const { script, needAttach } = createScript({\n url,\n cb: resolve,\n onErrorCallback: reject,\n attrs: {\n fetchpriority: 'high',\n ...attrs,\n },\n createScriptHook,\n needDeleteScript: true,\n });\n needAttach && document.head.appendChild(script);\n });\n}\n"],"mappings":";;;AAGA,eAAsB,YACpB,UACA,aACoC;AACpC,KAAI;AAEF,SADY,MAAM,UAAU;UAErB,GAAG;AACV,GAAC,eAAe,KAAK,EAAE;AACvB;;;AAIJ,SAAgB,uBAAuB,MAAc,MAAuB;CAC1E,MAAM,UAAU;AAKhB,QAHqB,KAAK,QAAQ,SAAS,GAAG,CAAC,QAAQ,OAAO,GAAG,KAC5C,KAAK,QAAQ,SAAS,GAAG,CAAC,QAAQ,OAAO,GAAG;;AAKnE,SAAgB,aAAa,MAO0B;CAErD,IAAI,SAAmC;CACvC,IAAI,aAAa;CACjB,IAAI,UAAU;CACd,IAAI;CACJ,MAAM,UAAU,SAAS,qBAAqB,SAAS;AAEvD,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,IAAI,QAAQ;EAClB,MAAM,YAAY,EAAE,aAAa,MAAM;AACvC,MAAI,aAAa,uBAAuB,WAAW,KAAK,IAAI,EAAE;AAC5D,YAAS;AACT,gBAAa;AACb;;;AAIJ,KAAI,CAAC,QAAQ;EACX,MAAM,QAAQ,KAAK;AACnB,WAAS,SAAS,cAAc,SAAS;AACzC,SAAO,OAAO,QAAQ,YAAY,WAAW,WAAW;EACxD,IAAI,kBAA6C;AACjD,MAAI,KAAK,kBAAkB;AACz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CAAC,SAAS,SAAS;AACnC,OAAI,QAAQ,CAAC,KAAK,aAAa,KAAK,CAClC,MAAK,aAAa,MAAM,MAAM,MAAM;IAEtC;;CAIN,MAAM,kBACJ,MAEA,UACS;EACT,MAAM,+BAA+B;AACnC,OAAI,OAAO,SAAS,QAClB,OAAM,mBAAmB,MAAM,gBAAgB,MAAM;OAErD,OAAM,MAAM,MAAM,IAAI;;AAI1B,MAAI,MAAM;AACR,QAAK,UAAU;AACf,QAAK,SAAS;AACd,qBAAkB;IAChB,MAAM,EAAE,iBAAiB,SAAS;AAClC,QAAI,eACF,OAAM,cAAc,KAAK,WAAW,YAAY,KAAK;KAEvD;AACF,OAAI,MAAM;IAER,MAAM,MAAO,KAAa,MAAM;AAChC,4BAAwB;AACxB,WAAO;;;AAGX,0BAAwB;;AAG1B,MAAK,UAAU,eAAe,KAAK,MAAM,KAAK,QAAQ;AACtD,MAAK,SAAS,eAAe,KAAK,MAAM,KAAK,OAAO;AAEpD,QAAO;EAAE;EAAM;EAAY;;AAG7B,SAAgB,WACd,KACA,MAIA;CACA,MAAM,EAAE,QAAQ,EAAE,EAAE,qBAAqB;AACzC,QAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,MAAM,EAAE,QAAQ,eAAe,aAAa;GAC1C;GACA,IAAI;GACJ,iBAAiB;GACjB,OAAO;IACL,eAAe;IACf,GAAG;IACJ;GACD;GACA,kBAAkB;GACnB,CAAC;AACF,gBAAc,SAAS,KAAK,YAAY,OAAO;GAC/C"}

@@ -74,17 +74,2 @@ const require_constant = require('./constant.cjs');

};
if (manifest.metaData?.prefetchInterface) {
const prefetchInterface = manifest.metaData.prefetchInterface;
basicRemoteSnapshot = {
...basicRemoteSnapshot,
prefetchInterface
};
}
if (manifest.metaData?.prefetchEntry) {
const { path, name, type } = manifest.metaData.prefetchEntry;
basicRemoteSnapshot = {
...basicRemoteSnapshot,
prefetchEntry: simpleJoinRemoteEntry(path, name),
prefetchEntryType: type
};
}
if ("publicPath" in manifest.metaData) {

@@ -91,0 +76,0 @@ remoteSnapshot = {

@@ -1,1 +0,1 @@

{"version":3,"file":"generateSnapshotFromManifest.cjs","names":["MANIFEST_EXT","StatsFileName","ManifestFileName"],"sources":["../src/generateSnapshotFromManifest.ts"],"sourcesContent":["import {\n Manifest,\n ProviderModuleInfo,\n ModuleInfo,\n BasicProviderModuleInfo,\n ConsumerModuleInfo,\n ManifestProvider,\n moduleFederationPlugin,\n} from './types';\nimport { MANIFEST_EXT, ManifestFileName, StatsFileName } from './constant';\n\ninterface IOptions {\n remotes?: Record<string, string>;\n overrides?: Record<string, string>;\n version?: string;\n}\n\nexport const simpleJoinRemoteEntry = (rPath: string, rName: string): string => {\n if (!rPath) {\n return rName;\n }\n const transformPath = (str: string) => {\n if (str === '.') {\n return '';\n }\n if (str.startsWith('./')) {\n return str.replace('./', '');\n }\n if (str.startsWith('/')) {\n const strWithoutSlash = str.slice(1);\n if (strWithoutSlash.endsWith('/')) {\n return strWithoutSlash.slice(0, -1);\n }\n return strWithoutSlash;\n }\n return str;\n };\n\n const transformedPath = transformPath(rPath);\n\n if (!transformedPath) {\n return rName;\n }\n\n if (transformedPath.endsWith('/')) {\n return `${transformedPath}${rName}`;\n }\n\n return `${transformedPath}/${rName}`;\n};\n\nexport function inferAutoPublicPath(url: string): string {\n return url\n .replace(/#.*$/, '')\n .replace(/\\?.*$/, '')\n .replace(/\\/[^\\/]+$/, '/');\n}\n\n// Priority: overrides > remotes\n// eslint-disable-next-line max-lines-per-function\nexport function generateSnapshotFromManifest(\n manifest: Manifest,\n options: IOptions = {},\n): ProviderModuleInfo {\n const { remotes = {}, overrides = {}, version } = options;\n let remoteSnapshot: ProviderModuleInfo;\n\n const getPublicPath = (): string => {\n if ('publicPath' in manifest.metaData) {\n if (\n (manifest.metaData.publicPath === 'auto' ||\n manifest.metaData.publicPath === '') &&\n version\n ) {\n // use same implementation as publicPath auto runtime module implements\n return inferAutoPublicPath(version);\n }\n return manifest.metaData.publicPath;\n } else {\n return manifest.metaData.getPublicPath;\n }\n };\n\n const overridesKeys = Object.keys(overrides);\n\n let remotesInfo: ConsumerModuleInfo['remotesInfo'] = {};\n\n // If remotes are not provided, only the remotes in the manifest will be read\n if (!Object.keys(remotes).length) {\n remotesInfo =\n manifest.remotes?.reduce(\n (res, next) => {\n let matchedVersion: string;\n const name = next.federationContainerName;\n // overrides have higher priority\n if (overridesKeys.includes(name)) {\n matchedVersion = overrides[name];\n } else {\n if ('version' in next) {\n matchedVersion = next.version;\n } else {\n matchedVersion = next.entry;\n }\n }\n res[name] = {\n matchedVersion,\n };\n return res;\n },\n {} as ConsumerModuleInfo['remotesInfo'],\n ) || {};\n }\n\n // If remotes (deploy scenario) are specified, they need to be traversed again\n Object.keys(remotes).forEach(\n (key) =>\n (remotesInfo[key] = {\n // overrides will override dependencies\n matchedVersion: overridesKeys.includes(key)\n ? overrides[key]\n : remotes[key],\n }),\n );\n\n const {\n remoteEntry: {\n path: remoteEntryPath,\n name: remoteEntryName,\n type: remoteEntryType,\n },\n types: remoteTypes = { path: '', name: '', zip: '', api: '' },\n buildInfo: { buildVersion },\n globalName,\n ssrRemoteEntry,\n } = manifest.metaData;\n const { exposes } = manifest;\n\n let basicRemoteSnapshot: BasicProviderModuleInfo = {\n version: version ? version : '',\n buildVersion,\n globalName,\n remoteEntry: simpleJoinRemoteEntry(remoteEntryPath, remoteEntryName),\n remoteEntryType,\n remoteTypes: simpleJoinRemoteEntry(remoteTypes.path, remoteTypes.name),\n remoteTypesZip: remoteTypes.zip || '',\n remoteTypesAPI: remoteTypes.api || '',\n remotesInfo,\n shared: manifest?.shared.map((item) => ({\n assets: item.assets,\n sharedName: item.name,\n version: item.version,\n // @ts-ignore\n usedExports: item.referenceExports || [],\n })),\n modules: exposes?.map((expose) => ({\n moduleName: expose.name,\n modulePath: expose.path,\n assets: expose.assets,\n })),\n };\n\n if (manifest.metaData?.prefetchInterface) {\n const prefetchInterface = manifest.metaData.prefetchInterface;\n\n basicRemoteSnapshot = {\n ...basicRemoteSnapshot,\n prefetchInterface,\n };\n }\n\n if (manifest.metaData?.prefetchEntry) {\n const { path, name, type } = manifest.metaData.prefetchEntry;\n\n basicRemoteSnapshot = {\n ...basicRemoteSnapshot,\n prefetchEntry: simpleJoinRemoteEntry(path, name),\n prefetchEntryType: type,\n };\n }\n\n if ('publicPath' in manifest.metaData) {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n publicPath: getPublicPath(),\n };\n if (typeof manifest.metaData.ssrPublicPath === 'string') {\n remoteSnapshot.ssrPublicPath = manifest.metaData.ssrPublicPath;\n }\n } else {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n getPublicPath: getPublicPath(),\n };\n }\n\n if (ssrRemoteEntry) {\n const fullSSRRemoteEntry = simpleJoinRemoteEntry(\n ssrRemoteEntry.path,\n ssrRemoteEntry.name,\n );\n remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;\n remoteSnapshot.ssrRemoteEntryType =\n ssrRemoteEntry.type || 'commonjs-module';\n }\n\n return remoteSnapshot;\n}\n\nexport function isManifestProvider(\n moduleInfo: ModuleInfo | ManifestProvider,\n): moduleInfo is ManifestProvider {\n if (\n 'remoteEntry' in moduleInfo &&\n moduleInfo.remoteEntry.includes(MANIFEST_EXT)\n ) {\n return true;\n } else {\n return false;\n }\n}\n\nexport function getManifestFileName(\n manifestOptions?: moduleFederationPlugin.ModuleFederationPluginOptions['manifest'],\n): {\n statsFileName: string;\n manifestFileName: string;\n} {\n if (!manifestOptions) {\n return {\n statsFileName: StatsFileName,\n manifestFileName: ManifestFileName,\n };\n }\n\n let filePath =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';\n let fileName =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';\n\n const JSON_EXT = '.json';\n const addExt = (name: string): string => {\n if (name.endsWith(JSON_EXT)) {\n return name;\n }\n return `${name}${JSON_EXT}`;\n };\n const insertSuffix = (name: string, suffix: string): string => {\n return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);\n };\n const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;\n const statsFileName = fileName\n ? insertSuffix(manifestFileName, '-stats')\n : StatsFileName;\n\n return {\n statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),\n manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),\n };\n}\n"],"mappings":";;;AAiBA,MAAa,yBAAyB,OAAe,UAA0B;AAC7E,KAAI,CAAC,MACH,QAAO;CAET,MAAM,iBAAiB,QAAgB;AACrC,MAAI,QAAQ,IACV,QAAO;AAET,MAAI,IAAI,WAAW,KAAK,CACtB,QAAO,IAAI,QAAQ,MAAM,GAAG;AAE9B,MAAI,IAAI,WAAW,IAAI,EAAE;GACvB,MAAM,kBAAkB,IAAI,MAAM,EAAE;AACpC,OAAI,gBAAgB,SAAS,IAAI,CAC/B,QAAO,gBAAgB,MAAM,GAAG,GAAG;AAErC,UAAO;;AAET,SAAO;;CAGT,MAAM,kBAAkB,cAAc,MAAM;AAE5C,KAAI,CAAC,gBACH,QAAO;AAGT,KAAI,gBAAgB,SAAS,IAAI,CAC/B,QAAO,GAAG,kBAAkB;AAG9B,QAAO,GAAG,gBAAgB,GAAG;;AAG/B,SAAgB,oBAAoB,KAAqB;AACvD,QAAO,IACJ,QAAQ,QAAQ,GAAG,CACnB,QAAQ,SAAS,GAAG,CACpB,QAAQ,aAAa,IAAI;;AAK9B,SAAgB,6BACd,UACA,UAAoB,EAAE,EACF;CACpB,MAAM,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,EAAE,YAAY;CAClD,IAAI;CAEJ,MAAM,sBAA8B;AAClC,MAAI,gBAAgB,SAAS,UAAU;AACrC,QACG,SAAS,SAAS,eAAe,UAChC,SAAS,SAAS,eAAe,OACnC,QAGA,QAAO,oBAAoB,QAAQ;AAErC,UAAO,SAAS,SAAS;QAEzB,QAAO,SAAS,SAAS;;CAI7B,MAAM,gBAAgB,OAAO,KAAK,UAAU;CAE5C,IAAI,cAAiD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SAAS;AAE/C,wBAAsB;GACpB,GAAG;GACH,eAAe,sBAAsB,MAAM,KAAK;GAChD,mBAAmB;GACpB;;AAGH,KAAI,gBAAgB,SAAS,UAAU;AACrC,mBAAiB;GACf,GAAG;GACH,YAAY,eAAe;GAC5B;AACD,MAAI,OAAO,SAAS,SAAS,kBAAkB,SAC7C,gBAAe,gBAAgB,SAAS,SAAS;OAGnD,kBAAiB;EACf,GAAG;EACH,eAAe,eAAe;EAC/B;AAGH,KAAI,gBAAgB;EAClB,MAAM,qBAAqB,sBACzB,eAAe,MACf,eAAe,KAChB;AACD,iBAAe,iBAAiB;AAChC,iBAAe,qBACb,eAAe,QAAQ;;AAG3B,QAAO;;AAGT,SAAgB,mBACd,YACgC;AAChC,KACE,iBAAiB,cACjB,WAAW,YAAY,SAASA,8BAAa,CAE7C,QAAO;KAEP,QAAO;;AAIX,SAAgB,oBACd,iBAIA;AACA,KAAI,CAAC,gBACH,QAAO;EACL,eAAeC;EACf,kBAAkBC;EACnB;CAGH,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAC1E,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAE1E,MAAM,WAAW;CACjB,MAAM,UAAU,SAAyB;AACvC,MAAI,KAAK,SAAS,SAAS,CACzB,QAAO;AAET,SAAO,GAAG,OAAO;;CAEnB,MAAM,gBAAgB,MAAc,WAA2B;AAC7D,SAAO,KAAK,QAAQ,UAAU,GAAG,SAAS,WAAW;;CAEvD,MAAM,mBAAmB,WAAW,OAAO,SAAS,GAAGA;AAKvD,QAAO;EACL,eAAe,sBAAsB,UALjB,WAClB,aAAa,kBAAkB,SAAS,GACxCD,+BAG2D;EAC7D,kBAAkB,sBAAsB,UAAU,iBAAiB;EACpE"}
{"version":3,"file":"generateSnapshotFromManifest.cjs","names":["MANIFEST_EXT","StatsFileName","ManifestFileName"],"sources":["../src/generateSnapshotFromManifest.ts"],"sourcesContent":["import {\n Manifest,\n ProviderModuleInfo,\n ModuleInfo,\n BasicProviderModuleInfo,\n ConsumerModuleInfo,\n ManifestProvider,\n moduleFederationPlugin,\n} from './types';\nimport { MANIFEST_EXT, ManifestFileName, StatsFileName } from './constant';\n\ninterface IOptions {\n remotes?: Record<string, string>;\n overrides?: Record<string, string>;\n version?: string;\n}\n\nexport const simpleJoinRemoteEntry = (rPath: string, rName: string): string => {\n if (!rPath) {\n return rName;\n }\n const transformPath = (str: string) => {\n if (str === '.') {\n return '';\n }\n if (str.startsWith('./')) {\n return str.replace('./', '');\n }\n if (str.startsWith('/')) {\n const strWithoutSlash = str.slice(1);\n if (strWithoutSlash.endsWith('/')) {\n return strWithoutSlash.slice(0, -1);\n }\n return strWithoutSlash;\n }\n return str;\n };\n\n const transformedPath = transformPath(rPath);\n\n if (!transformedPath) {\n return rName;\n }\n\n if (transformedPath.endsWith('/')) {\n return `${transformedPath}${rName}`;\n }\n\n return `${transformedPath}/${rName}`;\n};\n\nexport function inferAutoPublicPath(url: string): string {\n return url\n .replace(/#.*$/, '')\n .replace(/\\?.*$/, '')\n .replace(/\\/[^\\/]+$/, '/');\n}\n\n// Priority: overrides > remotes\n// eslint-disable-next-line max-lines-per-function\nexport function generateSnapshotFromManifest(\n manifest: Manifest,\n options: IOptions = {},\n): ProviderModuleInfo {\n const { remotes = {}, overrides = {}, version } = options;\n let remoteSnapshot: ProviderModuleInfo;\n\n const getPublicPath = (): string => {\n if ('publicPath' in manifest.metaData) {\n if (\n (manifest.metaData.publicPath === 'auto' ||\n manifest.metaData.publicPath === '') &&\n version\n ) {\n // use same implementation as publicPath auto runtime module implements\n return inferAutoPublicPath(version);\n }\n return manifest.metaData.publicPath;\n } else {\n return manifest.metaData.getPublicPath;\n }\n };\n\n const overridesKeys = Object.keys(overrides);\n\n let remotesInfo: ConsumerModuleInfo['remotesInfo'] = {};\n\n // If remotes are not provided, only the remotes in the manifest will be read\n if (!Object.keys(remotes).length) {\n remotesInfo =\n manifest.remotes?.reduce(\n (res, next) => {\n let matchedVersion: string;\n const name = next.federationContainerName;\n // overrides have higher priority\n if (overridesKeys.includes(name)) {\n matchedVersion = overrides[name];\n } else {\n if ('version' in next) {\n matchedVersion = next.version;\n } else {\n matchedVersion = next.entry;\n }\n }\n res[name] = {\n matchedVersion,\n };\n return res;\n },\n {} as ConsumerModuleInfo['remotesInfo'],\n ) || {};\n }\n\n // If remotes (deploy scenario) are specified, they need to be traversed again\n Object.keys(remotes).forEach(\n (key) =>\n (remotesInfo[key] = {\n // overrides will override dependencies\n matchedVersion: overridesKeys.includes(key)\n ? overrides[key]\n : remotes[key],\n }),\n );\n\n const {\n remoteEntry: {\n path: remoteEntryPath,\n name: remoteEntryName,\n type: remoteEntryType,\n },\n types: remoteTypes = { path: '', name: '', zip: '', api: '' },\n buildInfo: { buildVersion },\n globalName,\n ssrRemoteEntry,\n } = manifest.metaData;\n const { exposes } = manifest;\n\n let basicRemoteSnapshot: BasicProviderModuleInfo = {\n version: version ? version : '',\n buildVersion,\n globalName,\n remoteEntry: simpleJoinRemoteEntry(remoteEntryPath, remoteEntryName),\n remoteEntryType,\n remoteTypes: simpleJoinRemoteEntry(remoteTypes.path, remoteTypes.name),\n remoteTypesZip: remoteTypes.zip || '',\n remoteTypesAPI: remoteTypes.api || '',\n remotesInfo,\n shared: manifest?.shared.map((item) => ({\n assets: item.assets,\n sharedName: item.name,\n version: item.version,\n // @ts-ignore\n usedExports: item.referenceExports || [],\n })),\n modules: exposes?.map((expose) => ({\n moduleName: expose.name,\n modulePath: expose.path,\n assets: expose.assets,\n })),\n };\n\n if ('publicPath' in manifest.metaData) {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n publicPath: getPublicPath(),\n };\n if (typeof manifest.metaData.ssrPublicPath === 'string') {\n remoteSnapshot.ssrPublicPath = manifest.metaData.ssrPublicPath;\n }\n } else {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n getPublicPath: getPublicPath(),\n };\n }\n\n if (ssrRemoteEntry) {\n const fullSSRRemoteEntry = simpleJoinRemoteEntry(\n ssrRemoteEntry.path,\n ssrRemoteEntry.name,\n );\n remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;\n remoteSnapshot.ssrRemoteEntryType =\n ssrRemoteEntry.type || 'commonjs-module';\n }\n\n return remoteSnapshot;\n}\n\nexport function isManifestProvider(\n moduleInfo: ModuleInfo | ManifestProvider,\n): moduleInfo is ManifestProvider {\n if (\n 'remoteEntry' in moduleInfo &&\n moduleInfo.remoteEntry.includes(MANIFEST_EXT)\n ) {\n return true;\n } else {\n return false;\n }\n}\n\nexport function getManifestFileName(\n manifestOptions?: moduleFederationPlugin.ModuleFederationPluginOptions['manifest'],\n): {\n statsFileName: string;\n manifestFileName: string;\n} {\n if (!manifestOptions) {\n return {\n statsFileName: StatsFileName,\n manifestFileName: ManifestFileName,\n };\n }\n\n let filePath =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';\n let fileName =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';\n\n const JSON_EXT = '.json';\n const addExt = (name: string): string => {\n if (name.endsWith(JSON_EXT)) {\n return name;\n }\n return `${name}${JSON_EXT}`;\n };\n const insertSuffix = (name: string, suffix: string): string => {\n return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);\n };\n const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;\n const statsFileName = fileName\n ? insertSuffix(manifestFileName, '-stats')\n : StatsFileName;\n\n return {\n statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),\n manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),\n };\n}\n"],"mappings":";;;AAiBA,MAAa,yBAAyB,OAAe,UAA0B;AAC7E,KAAI,CAAC,MACH,QAAO;CAET,MAAM,iBAAiB,QAAgB;AACrC,MAAI,QAAQ,IACV,QAAO;AAET,MAAI,IAAI,WAAW,KAAK,CACtB,QAAO,IAAI,QAAQ,MAAM,GAAG;AAE9B,MAAI,IAAI,WAAW,IAAI,EAAE;GACvB,MA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,gBAAgB,YAAY;CAE1E,MAAM,WAAW;CACjB,MAAM,UAAU,SAAyB;AACvC,MAAI,KAAK,SAAS,SAAS,CACzB,QAAO;AAET,SAAO,GAAG,OAAO;;CAEnB,MAAM,gBAAgB,MAAc,WAA2B;AAC7D,SAAO,KAAK,QAAQ,UAAU,GAAG,SAAS,WAAW;;CAEvD,MAAM,mBAAmB,WAAW,OAAO,SAAS,GAAGA;AAKvD,QAAO;EACL,eAAe,sBAAsB,UALjB,WAClB,aAAa,kBAAkB,SAAS,GACxCD,+BAG2D;EAC7D,kBAAkB,sBAAsB,UAAU,iBAAiB;EACpE"}

@@ -74,17 +74,2 @@ import { MANIFEST_EXT, ManifestFileName, StatsFileName } from "./constant.js";

};
if (manifest.metaData?.prefetchInterface) {
const prefetchInterface = manifest.metaData.prefetchInterface;
basicRemoteSnapshot = {
...basicRemoteSnapshot,
prefetchInterface
};
}
if (manifest.metaData?.prefetchEntry) {
const { path, name, type } = manifest.metaData.prefetchEntry;
basicRemoteSnapshot = {
...basicRemoteSnapshot,
prefetchEntry: simpleJoinRemoteEntry(path, name),
prefetchEntryType: type
};
}
if ("publicPath" in manifest.metaData) {

@@ -91,0 +76,0 @@ remoteSnapshot = {

@@ -1,1 +0,1 @@

{"version":3,"file":"generateSnapshotFromManifest.js","names":[],"sources":["../src/generateSnapshotFromManifest.ts"],"sourcesContent":["import {\n Manifest,\n ProviderModuleInfo,\n ModuleInfo,\n BasicProviderModuleInfo,\n ConsumerModuleInfo,\n ManifestProvider,\n moduleFederationPlugin,\n} from './types';\nimport { MANIFEST_EXT, ManifestFileName, StatsFileName } from './constant';\n\ninterface IOptions {\n remotes?: Record<string, string>;\n overrides?: Record<string, string>;\n version?: string;\n}\n\nexport const simpleJoinRemoteEntry = (rPath: string, rName: string): string => {\n if (!rPath) {\n return rName;\n }\n const transformPath = (str: string) => {\n if (str === '.') {\n return '';\n }\n if (str.startsWith('./')) {\n return str.replace('./', '');\n }\n if (str.startsWith('/')) {\n const strWithoutSlash = str.slice(1);\n if (strWithoutSlash.endsWith('/')) {\n return strWithoutSlash.slice(0, -1);\n }\n return strWithoutSlash;\n }\n return str;\n };\n\n const transformedPath = transformPath(rPath);\n\n if (!transformedPath) {\n return rName;\n }\n\n if (transformedPath.endsWith('/')) {\n return `${transformedPath}${rName}`;\n }\n\n return `${transformedPath}/${rName}`;\n};\n\nexport function inferAutoPublicPath(url: string): string {\n return url\n .replace(/#.*$/, '')\n .replace(/\\?.*$/, '')\n .replace(/\\/[^\\/]+$/, '/');\n}\n\n// Priority: overrides > remotes\n// eslint-disable-next-line max-lines-per-function\nexport function generateSnapshotFromManifest(\n manifest: Manifest,\n options: IOptions = {},\n): ProviderModuleInfo {\n const { remotes = {}, overrides = {}, version } = options;\n let remoteSnapshot: ProviderModuleInfo;\n\n const getPublicPath = (): string => {\n if ('publicPath' in manifest.metaData) {\n if (\n (manifest.metaData.publicPath === 'auto' ||\n manifest.metaData.publicPath === '') &&\n version\n ) {\n // use same implementation as publicPath auto runtime module implements\n return inferAutoPublicPath(version);\n }\n return manifest.metaData.publicPath;\n } else {\n return manifest.metaData.getPublicPath;\n }\n };\n\n const overridesKeys = Object.keys(overrides);\n\n let remotesInfo: ConsumerModuleInfo['remotesInfo'] = {};\n\n // If remotes are not provided, only the remotes in the manifest will be read\n if (!Object.keys(remotes).length) {\n remotesInfo =\n manifest.remotes?.reduce(\n (res, next) => {\n let matchedVersion: string;\n const name = next.federationContainerName;\n // overrides have higher priority\n if (overridesKeys.includes(name)) {\n matchedVersion = overrides[name];\n } else {\n if ('version' in next) {\n matchedVersion = next.version;\n } else {\n matchedVersion = next.entry;\n }\n }\n res[name] = {\n matchedVersion,\n };\n return res;\n },\n {} as ConsumerModuleInfo['remotesInfo'],\n ) || {};\n }\n\n // If remotes (deploy scenario) are specified, they need to be traversed again\n Object.keys(remotes).forEach(\n (key) =>\n (remotesInfo[key] = {\n // overrides will override dependencies\n matchedVersion: overridesKeys.includes(key)\n ? overrides[key]\n : remotes[key],\n }),\n );\n\n const {\n remoteEntry: {\n path: remoteEntryPath,\n name: remoteEntryName,\n type: remoteEntryType,\n },\n types: remoteTypes = { path: '', name: '', zip: '', api: '' },\n buildInfo: { buildVersion },\n globalName,\n ssrRemoteEntry,\n } = manifest.metaData;\n const { exposes } = manifest;\n\n let basicRemoteSnapshot: BasicProviderModuleInfo = {\n version: version ? version : '',\n buildVersion,\n globalName,\n remoteEntry: simpleJoinRemoteEntry(remoteEntryPath, remoteEntryName),\n remoteEntryType,\n remoteTypes: simpleJoinRemoteEntry(remoteTypes.path, remoteTypes.name),\n remoteTypesZip: remoteTypes.zip || '',\n remoteTypesAPI: remoteTypes.api || '',\n remotesInfo,\n shared: manifest?.shared.map((item) => ({\n assets: item.assets,\n sharedName: item.name,\n version: item.version,\n // @ts-ignore\n usedExports: item.referenceExports || [],\n })),\n modules: exposes?.map((expose) => ({\n moduleName: expose.name,\n modulePath: expose.path,\n assets: expose.assets,\n })),\n };\n\n if (manifest.metaData?.prefetchInterface) {\n const prefetchInterface = manifest.metaData.prefetchInterface;\n\n basicRemoteSnapshot = {\n ...basicRemoteSnapshot,\n prefetchInterface,\n };\n }\n\n if (manifest.metaData?.prefetchEntry) {\n const { path, name, type } = manifest.metaData.prefetchEntry;\n\n basicRemoteSnapshot = {\n ...basicRemoteSnapshot,\n prefetchEntry: simpleJoinRemoteEntry(path, name),\n prefetchEntryType: type,\n };\n }\n\n if ('publicPath' in manifest.metaData) {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n publicPath: getPublicPath(),\n };\n if (typeof manifest.metaData.ssrPublicPath === 'string') {\n remoteSnapshot.ssrPublicPath = manifest.metaData.ssrPublicPath;\n }\n } else {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n getPublicPath: getPublicPath(),\n };\n }\n\n if (ssrRemoteEntry) {\n const fullSSRRemoteEntry = simpleJoinRemoteEntry(\n ssrRemoteEntry.path,\n ssrRemoteEntry.name,\n );\n remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;\n remoteSnapshot.ssrRemoteEntryType =\n ssrRemoteEntry.type || 'commonjs-module';\n }\n\n return remoteSnapshot;\n}\n\nexport function isManifestProvider(\n moduleInfo: ModuleInfo | ManifestProvider,\n): moduleInfo is ManifestProvider {\n if (\n 'remoteEntry' in moduleInfo &&\n moduleInfo.remoteEntry.includes(MANIFEST_EXT)\n ) {\n return true;\n } else {\n return false;\n }\n}\n\nexport function getManifestFileName(\n manifestOptions?: moduleFederationPlugin.ModuleFederationPluginOptions['manifest'],\n): {\n statsFileName: string;\n manifestFileName: string;\n} {\n if (!manifestOptions) {\n return {\n statsFileName: StatsFileName,\n manifestFileName: ManifestFileName,\n };\n }\n\n let filePath =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';\n let fileName =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';\n\n const JSON_EXT = '.json';\n const addExt = (name: string): string => {\n if (name.endsWith(JSON_EXT)) {\n return name;\n }\n return `${name}${JSON_EXT}`;\n };\n const insertSuffix = (name: string, suffix: string): string => {\n return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);\n };\n const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;\n const statsFileName = fileName\n ? insertSuffix(manifestFileName, '-stats')\n : StatsFileName;\n\n return {\n statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),\n manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),\n };\n}\n"],"mappings":";;;AAiBA,MAAa,yBAAyB,OAAe,UAA0B;AAC7E,KAAI,CAAC,MACH,QAAO;CAET,MAAM,iBAAiB,QAAgB;AACrC,MAAI,QAAQ,IACV,QAAO;AAET,MAAI,IAAI,WAAW,KAAK,CACtB,QAAO,IAAI,QAAQ,MAAM,GAAG;AAE9B,MAAI,IAAI,WAAW,IAAI,EAAE;GACvB,MAAM,kBAAkB,IAAI,MAAM,EAAE;AACpC,OAAI,gBAAgB,SAAS,IAAI,CAC/B,QAAO,gBAAgB,MAAM,G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iBAIA;AACA,KAAI,CAAC,gBACH,QAAO;EACL,eAAe;EACf,kBAAkB;EACnB;CAGH,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAC1E,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAE1E,MAAM,WAAW;CACjB,MAAM,UAAU,SAAyB;AACvC,MAAI,KAAK,SAAS,SAAS,CACzB,QAAO;AAET,SAAO,GAAG,OAAO;;CAEnB,MAAM,gBAAgB,MAAc,WAA2B;AAC7D,SAAO,KAAK,QAAQ,UAAU,GAAG,SAAS,WAAW;;CAEvD,MAAM,mBAAmB,WAAW,OAAO,SAAS,GAAG;AAKvD,QAAO;EACL,eAAe,sBAAsB,UALjB,WAClB,aAAa,kBAAkB,SAAS,GACxC,cAG2D;EAC7D,kBAAkB,sBAAsB,UAAU,iBAAiB;EACpE"}
{"version":3,"file":"generateSnapshotFromManifest.js","names":[],"sources":["../src/generateSnapshotFromManifest.ts"],"sourcesContent":["import {\n Manifest,\n ProviderModuleInfo,\n ModuleInfo,\n BasicProviderModuleInfo,\n ConsumerModuleInfo,\n ManifestProvider,\n moduleFederationPlugin,\n} from './types';\nimport { MANIFEST_EXT, ManifestFileName, StatsFileName } from './constant';\n\ninterface IOptions {\n remotes?: Record<string, string>;\n overrides?: Record<string, string>;\n version?: string;\n}\n\nexport const simpleJoinRemoteEntry = (rPath: string, rName: string): string => {\n if (!rPath) {\n return rName;\n }\n const transformPath = (str: string) => {\n if (str === '.') {\n return '';\n }\n if (str.startsWith('./')) {\n return str.replace('./', '');\n }\n if (str.startsWith('/')) {\n const strWithoutSlash = str.slice(1);\n if (strWithoutSlash.endsWith('/')) {\n return strWithoutSlash.slice(0, -1);\n }\n return strWithoutSlash;\n }\n return str;\n };\n\n const transformedPath = transformPath(rPath);\n\n if (!transformedPath) {\n return rName;\n }\n\n if (transformedPath.endsWith('/')) {\n return `${transformedPath}${rName}`;\n }\n\n return `${transformedPath}/${rName}`;\n};\n\nexport function inferAutoPublicPath(url: string): string {\n return url\n .replace(/#.*$/, '')\n .replace(/\\?.*$/, '')\n .replace(/\\/[^\\/]+$/, '/');\n}\n\n// Priority: overrides > remotes\n// eslint-disable-next-line max-lines-per-function\nexport function generateSnapshotFromManifest(\n manifest: Manifest,\n options: IOptions = {},\n): ProviderModuleInfo {\n const { remotes = {}, overrides = {}, version } = options;\n let remoteSnapshot: ProviderModuleInfo;\n\n const getPublicPath = (): string => {\n if ('publicPath' in manifest.metaData) {\n if (\n (manifest.metaData.publicPath === 'auto' ||\n manifest.metaData.publicPath === '') &&\n version\n ) {\n // use same implementation as publicPath auto runtime module implements\n return inferAutoPublicPath(version);\n }\n return manifest.metaData.publicPath;\n } else {\n return manifest.metaData.getPublicPath;\n }\n };\n\n const overridesKeys = Object.keys(overrides);\n\n let remotesInfo: ConsumerModuleInfo['remotesInfo'] = {};\n\n // If remotes are not provided, only the remotes in the manifest will be read\n if (!Object.keys(remotes).length) {\n remotesInfo =\n manifest.remotes?.reduce(\n (res, next) => {\n let matchedVersion: string;\n const name = next.federationContainerName;\n // overrides have higher priority\n if (overridesKeys.includes(name)) {\n matchedVersion = overrides[name];\n } else {\n if ('version' in next) {\n matchedVersion = next.version;\n } else {\n matchedVersion = next.entry;\n }\n }\n res[name] = {\n matchedVersion,\n };\n return res;\n },\n {} as ConsumerModuleInfo['remotesInfo'],\n ) || {};\n }\n\n // If remotes (deploy scenario) are specified, they need to be traversed again\n Object.keys(remotes).forEach(\n (key) =>\n (remotesInfo[key] = {\n // overrides will override dependencies\n matchedVersion: overridesKeys.includes(key)\n ? overrides[key]\n : remotes[key],\n }),\n );\n\n const {\n remoteEntry: {\n path: remoteEntryPath,\n name: remoteEntryName,\n type: remoteEntryType,\n },\n types: remoteTypes = { path: '', name: '', zip: '', api: '' },\n buildInfo: { buildVersion },\n globalName,\n ssrRemoteEntry,\n } = manifest.metaData;\n const { exposes } = manifest;\n\n let basicRemoteSnapshot: BasicProviderModuleInfo = {\n version: version ? version : '',\n buildVersion,\n globalName,\n remoteEntry: simpleJoinRemoteEntry(remoteEntryPath, remoteEntryName),\n remoteEntryType,\n remoteTypes: simpleJoinRemoteEntry(remoteTypes.path, remoteTypes.name),\n remoteTypesZip: remoteTypes.zip || '',\n remoteTypesAPI: remoteTypes.api || '',\n remotesInfo,\n shared: manifest?.shared.map((item) => ({\n assets: item.assets,\n sharedName: item.name,\n version: item.version,\n // @ts-ignore\n usedExports: item.referenceExports || [],\n })),\n modules: exposes?.map((expose) => ({\n moduleName: expose.name,\n modulePath: expose.path,\n assets: expose.assets,\n })),\n };\n\n if ('publicPath' in manifest.metaData) {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n publicPath: getPublicPath(),\n };\n if (typeof manifest.metaData.ssrPublicPath === 'string') {\n remoteSnapshot.ssrPublicPath = manifest.metaData.ssrPublicPath;\n }\n } else {\n remoteSnapshot = {\n ...basicRemoteSnapshot,\n getPublicPath: getPublicPath(),\n };\n }\n\n if (ssrRemoteEntry) {\n const fullSSRRemoteEntry = simpleJoinRemoteEntry(\n ssrRemoteEntry.path,\n ssrRemoteEntry.name,\n );\n remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;\n remoteSnapshot.ssrRemoteEntryType =\n ssrRemoteEntry.type || 'commonjs-module';\n }\n\n return remoteSnapshot;\n}\n\nexport function isManifestProvider(\n moduleInfo: ModuleInfo | ManifestProvider,\n): moduleInfo is ManifestProvider {\n if (\n 'remoteEntry' in moduleInfo &&\n moduleInfo.remoteEntry.includes(MANIFEST_EXT)\n ) {\n return true;\n } else {\n return false;\n }\n}\n\nexport function getManifestFileName(\n manifestOptions?: moduleFederationPlugin.ModuleFederationPluginOptions['manifest'],\n): {\n statsFileName: string;\n manifestFileName: string;\n} {\n if (!manifestOptions) {\n return {\n statsFileName: StatsFileName,\n manifestFileName: ManifestFileName,\n };\n }\n\n let filePath =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';\n let fileName =\n typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';\n\n const JSON_EXT = '.json';\n const addExt = (name: string): string => {\n if (name.endsWith(JSON_EXT)) {\n return name;\n }\n return `${name}${JSON_EXT}`;\n };\n const insertSuffix = (name: string, suffix: string): string => {\n return name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);\n };\n const manifestFileName = fileName ? addExt(fileName) : ManifestFileName;\n const statsFileName = fileName\n ? insertSuffix(manifestFileName, '-stats')\n : StatsFileName;\n\n return {\n statsFileName: simpleJoinRemoteEntry(filePath, statsFileName),\n manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName),\n };\n}\n"],"mappings":";;;AAiBA,MAAa,yBAAyB,OAAe,UAA0B;AAC7E,KAAI,CAAC,MACH,QAAO;CAET,MAAM,iBAAiB,QAAgB;AACrC,MAAI,QAAQ,IACV,QAAO;AAET,MAAI,IAAI,WAAW,KAAK,CACtB,QAAO,IAAI,QAAQ,MAAM,GAAG;AAE9B,MAAI,IAAI,WAAW,IAAI,EAAE;GACvB,MAAM,kBAAkB,IAAI,MAAM,EAAE;AACpC,OAAI,gBAAgB,SAAS,IAAI,CAC/B,QAAO,gBAAgB,MAAM,GAAG,GAAG;AAErC,UAAO;;AAET,SAAO;;CAGT,MAAM,kBAAkB,cAAc,MAAM;AAE5C,KAAI,CAAC,gBACH,QAAO;AAGT,KAAI,gBAAgB,SAAS,IAAI,CAC/B,QAAO,GAAG,kBAAkB;AAG9B,QAAO,GAAG,gBAAgB,GAAG;;AAG/B,SAAgB,oBAAoB,KAAqB;AACvD,QAAO,IACJ,QAAQ,QAAQ,GAAG,CACnB,QAAQ,SAAS,GAAG,CACpB,QAAQ,aAAa,IAAI;;AAK9B,SAAgB,6BACd,UACA,UAAoB,EAAE,EACF;CACpB,MAAM,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,EAAE,YAAY;CAClD,IAAI;CAEJ,MAAM,sBAA8B;AAClC,MAAI,gBAAgB,SAAS,UAAU;AACrC,QACG,SAAS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EACJ;AAED,KAAI,gBAAgB,SAAS,UAAU;AACrC,mBAAiB;GACf,GAAG;GACH,YAAY,eAAe;GAC5B;AACD,MAAI,OAAO,SAAS,SAAS,kBAAkB,SAC7C,gBAAe,gBAAgB,SAAS,SAAS;OAGnD,kBAAiB;EACf,GAAG;EACH,eAAe,eAAe;EAC/B;AAGH,KAAI,gBAAgB;EAClB,MAAM,qBAAqB,sBACzB,eAAe,MACf,eAAe,KAChB;AACD,iBAAe,iBAAiB;AAChC,iBAAe,qBACb,eAAe,QAAQ;;AAG3B,QAAO;;AAGT,SAAgB,mBACd,YACgC;AAChC,KACE,iBAAiB,cACjB,WAAW,YAAY,SAAS,aAAa,CAE7C,QAAO;KAEP,QAAO;;AAIX,SAAgB,oBACd,iBAIA;AACA,KAAI,CAAC,gBACH,QAAO;EACL,eAAe;EACf,kBAAkB;EACnB;CAGH,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAC1E,IAAI,WACF,OAAO,oBAAoB,YAAY,KAAK,gBAAgB,YAAY;CAE1E,MAAM,WAAW;CACjB,MAAM,UAAU,SAAyB;AACvC,MAAI,KAAK,SAAS,SAAS,CACzB,QAAO;AAET,SAAO,GAAG,OAAO;;CAEnB,MAAM,gBAAgB,MAAc,WAA2B;AAC7D,SAAO,KAAK,QAAQ,UAAU,GAAG,SAAS,WAAW;;CAEvD,MAAM,mBAAmB,WAAW,OAAO,SAAS,GAAG;AAKvD,QAAO;EACL,eAAe,sBAAsB,UALjB,WAClB,aAAa,kBAAkB,SAAS,GACxC,cAG2D;EAC7D,kBAAkB,sBAAsB,UAAU,iBAAiB;EACpE"}

@@ -24,3 +24,2 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

exports.MFModuleType = require_constant.MFModuleType;
exports.MFPrefetchCommon = require_constant.MFPrefetchCommon;
exports.MODULE_DEVTOOL_IDENTIFIER = require_constant.MODULE_DEVTOOL_IDENTIFIER;

@@ -27,0 +26,0 @@ exports.ManifestFileName = require_constant.ManifestFileName;

@@ -1,2 +0,2 @@

import { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus } from "./constant.js";
import { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus } from "./constant.js";
import { Module, RemoteEntryInfo, RemoteWithEntry, RemoteWithVersion } from "./types/common.js";

@@ -21,2 +21,2 @@ import { BasicStatsMetaData, ManifestModuleInfos, MetaDataTypes, RemoteEntryType, ResourceInfo, Stats, StatsAssets, StatsBuildInfo, StatsExpose, StatsMetaData, StatsMetaDataWithGetPublicPath, StatsMetaDataWithPublicPath, StatsModuleInfo, StatsRemote, StatsRemoteVal, StatsRemoteWithEntry, StatsRemoteWithVersion, StatsShared } from "./types/stats.js";

import { createModuleFederationConfig } from "./createModuleFederationConfig.js";
export { BROWSER_LOG_KEY, BasicProviderModuleInfo, BasicStatsMetaData, ConsumerModuleInfo, ConsumerModuleInfoWithPublicPath, CreateScriptHook, CreateScriptHookDom, CreateScriptHookNode, CreateScriptHookReturn, CreateScriptHookReturnDom, CreateScriptHookReturnNode, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, FetchHook, GlobalModuleInfo, type InfrastructureLogger, type Logger, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, Manifest, ManifestExpose, ManifestFileName, ManifestModuleInfos, ManifestProvider, ManifestRemote, ManifestRemoteCommonInfo, ManifestShared, MetaDataTypes, Module, ModuleInfo, NameTransformMap, NameTransformSymbol, ProviderModuleInfo, PureConsumerModuleInfo, PureEntryProvider, RemoteEntryInfo, RemoteEntryType, RemoteWithEntry, RemoteWithVersion, ResourceInfo, SEPARATOR, Stats, StatsAssets, StatsBuildInfo, StatsExpose, StatsFileName, StatsMetaData, StatsMetaDataWithGetPublicPath, StatsMetaDataWithPublicPath, StatsModuleInfo, StatsRemote, StatsRemoteVal, StatsRemoteWithEntry, StatsRemoteWithVersion, StatsShared, TEMP_DIR, TreeShakingStatus, assert, bindLoggerToCompiler, composeKeyWithSeparator, ConsumeSharedPlugin_d_exports as consumeSharedPlugin, ContainerPlugin_d_exports as containerPlugin, ContainerReferencePlugin_d_exports as containerReferencePlugin, createInfrastructureLogger, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getManifestFileName, getProcessEnv, getResourceUrl, inferAutoPublicPath, infrastructureLogger, isBrowserEnv, isBrowserEnvValue, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin_d_exports as moduleFederationPlugin, normalizeOptions, parseEntry, ProvideSharedPlugin_d_exports as provideSharedPlugin, safeToString, safeWrapper, SharePlugin_d_exports as sharePlugin, simpleJoinRemoteEntry, warn };
export { BROWSER_LOG_KEY, BasicProviderModuleInfo, BasicStatsMetaData, ConsumerModuleInfo, ConsumerModuleInfoWithPublicPath, CreateScriptHook, CreateScriptHookDom, CreateScriptHookNode, CreateScriptHookReturn, CreateScriptHookReturnDom, CreateScriptHookReturnNode, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, FetchHook, GlobalModuleInfo, type InfrastructureLogger, type Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, Manifest, ManifestExpose, ManifestFileName, ManifestModuleInfos, ManifestProvider, ManifestRemote, ManifestRemoteCommonInfo, ManifestShared, MetaDataTypes, Module, ModuleInfo, NameTransformMap, NameTransformSymbol, ProviderModuleInfo, PureConsumerModuleInfo, PureEntryProvider, RemoteEntryInfo, RemoteEntryType, RemoteWithEntry, RemoteWithVersion, ResourceInfo, SEPARATOR, Stats, StatsAssets, StatsBuildInfo, StatsExpose, StatsFileName, StatsMetaData, StatsMetaDataWithGetPublicPath, StatsMetaDataWithPublicPath, StatsModuleInfo, StatsRemote, StatsRemoteVal, StatsRemoteWithEntry, StatsRemoteWithVersion, StatsShared, TEMP_DIR, TreeShakingStatus, assert, bindLoggerToCompiler, composeKeyWithSeparator, ConsumeSharedPlugin_d_exports as consumeSharedPlugin, ContainerPlugin_d_exports as containerPlugin, ContainerReferencePlugin_d_exports as containerReferencePlugin, createInfrastructureLogger, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getManifestFileName, getProcessEnv, getResourceUrl, inferAutoPublicPath, infrastructureLogger, isBrowserEnv, isBrowserEnvValue, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin_d_exports as moduleFederationPlugin, normalizeOptions, parseEntry, ProvideSharedPlugin_d_exports as provideSharedPlugin, safeToString, safeWrapper, SharePlugin_d_exports as sharePlugin, simpleJoinRemoteEntry, warn };

@@ -1,2 +0,2 @@

import { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus } from "./constant.js";
import { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus } from "./constant.js";
import { ContainerPlugin_exports } from "./types/plugins/ContainerPlugin.js";

@@ -17,2 +17,2 @@ import { ContainerReferencePlugin_exports } from "./types/plugins/ContainerReferencePlugin.js";

export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus, assert, bindLoggerToCompiler, composeKeyWithSeparator, ConsumeSharedPlugin_exports as consumeSharedPlugin, ContainerPlugin_exports as containerPlugin, ContainerReferencePlugin_exports as containerReferencePlugin, createInfrastructureLogger, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getManifestFileName, getProcessEnv, getResourceUrl, inferAutoPublicPath, infrastructureLogger, isBrowserEnv, isBrowserEnvValue, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin_exports as moduleFederationPlugin, normalizeOptions, parseEntry, ProvideSharedPlugin_exports as provideSharedPlugin, safeToString, safeWrapper, SharePlugin_exports as sharePlugin, simpleJoinRemoteEntry, warn };
export { BROWSER_LOG_KEY, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, TreeShakingStatus, assert, bindLoggerToCompiler, composeKeyWithSeparator, ConsumeSharedPlugin_exports as consumeSharedPlugin, ContainerPlugin_exports as containerPlugin, ContainerReferencePlugin_exports as containerReferencePlugin, createInfrastructureLogger, createLink, createLogger, createModuleFederationConfig, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getManifestFileName, getProcessEnv, getResourceUrl, inferAutoPublicPath, infrastructureLogger, isBrowserEnv, isBrowserEnvValue, isDebugMode, isManifestProvider, isReactNativeEnv, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin_exports as moduleFederationPlugin, normalizeOptions, parseEntry, ProvideSharedPlugin_exports as provideSharedPlugin, safeToString, safeWrapper, SharePlugin_exports as sharePlugin, simpleJoinRemoteEntry, warn };

@@ -1,1 +0,1 @@

{"version":3,"file":"ContainerPlugin.cjs","names":[],"sources":["../../../src/types/plugins/ContainerPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type {\n Exposes,\n EntryRuntime,\n LibraryOptions,\n} from './ModuleFederationPlugin';\n\nexport interface ContainerPluginOptions {\n exposes: Exposes;\n /**\n * The filename for this container relative path inside the `output.path` directory.\n */\n filename?: string;\n library?: LibraryOptions;\n /**\n * The name for this container.\n */\n name: string;\n runtime?: EntryRuntime;\n /**\n * The name of the share scope which is shared with the host (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable async startup for the container */\n asyncStartup?: boolean;\n /** After setting true, the external MF runtime will be used and the runtime provided by the consumer will be used. (Please make sure your consumer has provideExternalRuntime: true set, otherwise it will not run properly!) */\n externalRuntime?: boolean;\n /** Enable providing external runtime */\n provideExternalRuntime?: boolean;\n };\n /**\n * Enable data prefetching for container modules.\n */\n dataPrefetch?: boolean;\n /**\n * Array of runtime plugins to be applied\n */\n runtimePlugins?: (string | unknown[])[];\n}\n"],"mappings":""}
{"version":3,"file":"ContainerPlugin.cjs","names":[],"sources":["../../../src/types/plugins/ContainerPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type {\n Exposes,\n EntryRuntime,\n LibraryOptions,\n} from './ModuleFederationPlugin';\n\nexport interface ContainerPluginOptions {\n exposes: Exposes;\n /**\n * The filename for this container relative path inside the `output.path` directory.\n */\n filename?: string;\n library?: LibraryOptions;\n /**\n * The name for this container.\n */\n name: string;\n runtime?: EntryRuntime;\n /**\n * The name of the share scope which is shared with the host (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable async startup for the container */\n asyncStartup?: boolean;\n /** After setting true, the external MF runtime will be used and the runtime provided by the consumer will be used. (Please make sure your consumer has provideExternalRuntime: true set, otherwise it will not run properly!) */\n externalRuntime?: boolean;\n /** Enable providing external runtime */\n provideExternalRuntime?: boolean;\n };\n /**\n * Array of runtime plugins to be applied\n */\n runtimePlugins?: (string | unknown[])[];\n}\n"],"mappings":""}

@@ -32,6 +32,2 @@ import { EntryRuntime, Exposes, LibraryOptions } from "./ModuleFederationPlugin.js";

/**
* Enable data prefetching for container modules.
*/
dataPrefetch?: boolean;
/**
* Array of runtime plugins to be applied

@@ -38,0 +34,0 @@ */

@@ -1,1 +0,1 @@

{"version":3,"file":"ContainerPlugin.js","names":[],"sources":["../../../src/types/plugins/ContainerPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type {\n Exposes,\n EntryRuntime,\n LibraryOptions,\n} from './ModuleFederationPlugin';\n\nexport interface ContainerPluginOptions {\n exposes: Exposes;\n /**\n * The filename for this container relative path inside the `output.path` directory.\n */\n filename?: string;\n library?: LibraryOptions;\n /**\n * The name for this container.\n */\n name: string;\n runtime?: EntryRuntime;\n /**\n * The name of the share scope which is shared with the host (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable async startup for the container */\n asyncStartup?: boolean;\n /** After setting true, the external MF runtime will be used and the runtime provided by the consumer will be used. (Please make sure your consumer has provideExternalRuntime: true set, otherwise it will not run properly!) */\n externalRuntime?: boolean;\n /** Enable providing external runtime */\n provideExternalRuntime?: boolean;\n };\n /**\n * Enable data prefetching for container modules.\n */\n dataPrefetch?: boolean;\n /**\n * Array of runtime plugins to be applied\n */\n runtimePlugins?: (string | unknown[])[];\n}\n"],"mappings":""}
{"version":3,"file":"ContainerPlugin.js","names":[],"sources":["../../../src/types/plugins/ContainerPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\nimport type {\n Exposes,\n EntryRuntime,\n LibraryOptions,\n} from './ModuleFederationPlugin';\n\nexport interface ContainerPluginOptions {\n exposes: Exposes;\n /**\n * The filename for this container relative path inside the `output.path` directory.\n */\n filename?: string;\n library?: LibraryOptions;\n /**\n * The name for this container.\n */\n name: string;\n runtime?: EntryRuntime;\n /**\n * The name of the share scope which is shared with the host (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable async startup for the container */\n asyncStartup?: boolean;\n /** After setting true, the external MF runtime will be used and the runtime provided by the consumer will be used. (Please make sure your consumer has provideExternalRuntime: true set, otherwise it will not run properly!) */\n externalRuntime?: boolean;\n /** Enable providing external runtime */\n provideExternalRuntime?: boolean;\n };\n /**\n * Array of runtime plugins to be applied\n */\n runtimePlugins?: (string | unknown[])[];\n}\n"],"mappings":""}

@@ -1,1 +0,1 @@

{"version":3,"file":"ModuleFederationPlugin.cjs","names":[],"sources":["../../../src/types/plugins/ModuleFederationPlugin.ts"],"sourcesContent":["import type { Stats } from '../stats';\nimport type webpack from 'webpack';\n\n// <-- BEGIN SCHEMA-GENERATED TYPES -->\n/**\n * Module that should be exposed by this container.\n */\nexport type ExposesItem = string;\n\n/**\n * Modules that should be exposed by this container.\n */\nexport type ExposesItems = ExposesItem[];\n\n/**\n * Modules that should be exposed by this container. Property names are used as public paths.\n */\nexport interface ExposesObject {\n [k: string]: ExposesConfig | ExposesItem | ExposesItems;\n}\n\n/**\n * Advanced configuration for modules that should be exposed by this container.\n */\nexport interface ExposesConfig {\n /**\n * Request to a module that should be exposed by this container.\n */\n import: ExposesItem | ExposesItems;\n /**\n * Custom chunk name for the exposed module.\n */\n name?: string;\n}\n\n/**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\nexport type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;\n\n/**\n * Add a container for define/require functions in the AMD module.\n */\nexport type AmdContainer = string;\n\n/**\n * Add a comment in the UMD wrapper.\n */\nexport type AuxiliaryComment = string | LibraryCustomUmdCommentObject;\n\n/**\n * Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.\n */\nexport interface LibraryCustomUmdCommentObject {\n /**\n * Set comment for `amd` section in UMD.\n */\n amd?: string;\n /**\n * Set comment for `commonjs` (exports) section in UMD.\n */\n commonjs?: string;\n /**\n * Set comment for `commonjs2` (module.exports) section in UMD.\n */\n commonjs2?: string;\n /**\n * Set comment for `root` (global variable) section in UMD.\n */\n root?: string;\n}\n\n/**\n * Description object for all UMD variants of the library name.\n */\nexport interface LibraryCustomUmdObject {\n /**\n * Name of the exposed AMD library in the UMD.\n */\n amd?: string;\n /**\n * Name of the exposed commonjs export in the UMD.\n */\n commonjs?: string;\n /**\n * Name of the property exposed globally by a UMD library.\n */\n root?: string[] | string;\n}\n\n/**\n * Specify which export should be exposed as library.\n */\nexport type LibraryExport = string[] | string;\n\n/**\n * The name of the library (some types allow unnamed libraries too).\n */\nexport type LibraryName = string[] | string | LibraryCustomUmdObject;\n\n/**\n * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).\n */\nexport type LibraryType =\n | 'var'\n | 'module'\n | 'assign'\n | 'assign-properties'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | string;\n\n/**\n * Options for library.\n */\nexport interface LibraryOptions {\n amdContainer?: AmdContainer;\n auxiliaryComment?: AuxiliaryComment;\n export?: LibraryExport;\n name?: LibraryName;\n type: LibraryType;\n umdNamedDefine?: UmdNamedDefine;\n}\n\n/**\n * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.\n */\nexport type UmdNamedDefine = boolean;\n\n/**\n * Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).\n */\nexport type ExternalsType =\n | 'var'\n | 'module'\n | 'assign'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | 'promise'\n | 'import'\n | 'module-import'\n | 'script'\n | 'node-commonjs';\n\n/**\n * Container location from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItem = string;\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItems = RemotesItem[];\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.\n */\nexport interface RemotesObject {\n [k: string]: RemotesConfig | RemotesItem | RemotesItems;\n}\n\n/**\n * Advanced configuration for container locations from which modules should be resolved and loaded at runtime.\n */\nexport interface RemotesConfig {\n /**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\n external: RemotesItem | RemotesItems;\n /**\n * The name of the share scope shared with this remote.\n */\n shareScope?: string | string[];\n}\n\n/**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\nexport type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;\n\n/**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\nexport type EntryRuntime = false | string;\n\n/**\n * A module that should be shared in the share scope.\n */\nexport type SharedItem = string;\n\n/**\n * Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.\n */\nexport interface SharedObject {\n [k: string]: SharedConfig | SharedItem;\n}\n\n/**\n * Advanced configuration for modules that should be shared in the share scope.\n */\nexport interface SharedConfig {\n /**\n * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Options for excluding specific versions or request paths of the shared module. When specified, matching modules will not be shared. Cannot be used with 'include'.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Options for including only specific versions or request paths of the shared module. When specified, only matching modules will be shared. Cannot be used with 'exclude'.\n */\n include?: IncludeExcludeOptions;\n /**\n * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.\n */\n import?: false | SharedItem;\n /**\n * Import request to match on\n */\n request?: string;\n /**\n * Layer in which the shared module should be placed.\n */\n layer?: string;\n /**\n * Layer of the issuer.\n */\n issuerLayer?: string;\n /**\n * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.\n */\n packageName?: string;\n /**\n * Version requirement from module in share scope.\n */\n requiredVersion?: false | string;\n /**\n * Module is looked up under this key from the share scope.\n */\n shareKey?: string;\n /**\n * Share scope name.\n */\n shareScope?: string | string[];\n /**\n * [Deprecated]: load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: 'version-first' | 'loaded-first';\n /**\n * Allow only a single version of the shared module in share scope (disabled by default).\n */\n singleton?: boolean;\n /**\n * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).\n */\n strictVersion?: boolean;\n /**\n * Version of the provided module. Will replace lower matching versions, but not higher.\n */\n version?: false | string;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Enable tree-shaking for the shared module or configure it.\n */\n treeShaking?: boolean | TreeShakingConfig;\n}\n\n/**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Shared = (SharedItem | SharedObject)[] | SharedObject;\n\nexport interface IncludeExcludeOptions {\n /**\n * A string (which can be a regex pattern) or a RegExp object to match the request path.\n */\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Semantic versioning range to match against the fallback module's version for exclusion/inclusion context where applicable.\n */\n fallbackVersion?: string;\n}\n\n/**\n * Tree-shake configuration for shared module.\n */\nexport interface TreeShakingConfig {\n /**\n * List of export names used from the shared module.\n */\n usedExports?: string[];\n /**\n * Tree-shake analysis mode.\n */\n mode?: 'server-calc' | 'runtime-infer';\n /**\n * Filename for generated treeShaking metadata.\n */\n filename?: string;\n}\n\n// <-- END SCHEMA-GENERATED TYPES -->\n\nexport interface AdditionalDataOptions {\n stats: Stats;\n compiler: webpack.Compiler;\n compilation: webpack.Compilation;\n bundler: 'webpack' | 'rspack';\n}\nexport interface PluginManifestOptions {\n filePath?: string;\n disableAssetsAnalyze?: boolean;\n fileName?: string;\n additionalData?: (\n options: AdditionalDataOptions,\n ) => Promise<void | Stats> | Stats | void;\n}\n\nexport interface PluginDevOptions {\n disableLiveReload?: boolean;\n disableHotTypesReload?: boolean;\n disableDynamicRemoteTypeHints?: boolean;\n}\n\ninterface RemoteTypeUrl {\n alias?: string;\n api: string;\n zip: string;\n}\n\nexport interface RemoteTypeUrls {\n [remoteName: string]: RemoteTypeUrl;\n}\n\nexport interface DtsHostOptions {\n typesFolder?: string;\n abortOnError?: boolean;\n remoteTypesFolder?: string;\n deleteTypesFolder?: boolean;\n maxRetries?: number;\n consumeAPITypes?: boolean;\n runtimePkgs?: string[];\n remoteTypeUrls?: (() => Promise<RemoteTypeUrls>) | RemoteTypeUrls;\n timeout?: number;\n /** The family of IP, used for network requests */\n family?: 4 | 6;\n typesOnBuild?: boolean;\n}\n\nexport interface DtsRemoteOptions {\n tsConfigPath?: string;\n typesFolder?: string;\n compiledTypesFolder?: string;\n /** Custom base output directory for generated types. When set, types will be emitted to this directory instead of the default compiler output directory. */\n outputDir?: string;\n deleteTypesFolder?: boolean;\n additionalFilesToCompile?: string[];\n compileInChildProcess?: boolean;\n compilerInstance?: 'tsc' | 'vue-tsc' | 'tspc' | string;\n generateAPITypes?: boolean;\n extractThirdParty?:\n | boolean\n | {\n exclude?: Array<string | RegExp>;\n };\n extractRemoteTypes?: boolean;\n abortOnError?: boolean;\n deleteTsConfig?: boolean;\n}\n\nexport interface PluginDtsOptions {\n generateTypes?: boolean | DtsRemoteOptions;\n consumeTypes?: boolean | DtsHostOptions;\n tsConfigPath?: string;\n extraOptions?: Record<string, any>;\n implementation?: string;\n cwd?: string;\n displayErrorInTerminal?: boolean;\n}\n\nexport type AsyncBoundaryOptions = {\n eager?: RegExp | ((module: any) => boolean);\n excludeChunk?: (chunk: any) => boolean;\n};\n\nexport interface ModuleFederationPluginOptions {\n /**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\n exposes?: Exposes;\n /**\n * The filename of the container as relative path inside the `output.path` directory.\n */\n filename?: string;\n /**\n * Options for library.\n */\n library?: LibraryOptions;\n /**\n * The name of the container.\n */\n name?: string;\n /**\n * The external type of the remote containers.\n */\n remoteType?: ExternalsType;\n /**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\n remotes?: Remotes;\n /**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\n runtime?: EntryRuntime;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: SharedStrategy;\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared?: Shared;\n /**\n * Runtime plugin file paths or package name. Supports tuple [path, params].\n */\n runtimePlugins?: (string | [string, Record<string, unknown>])[];\n /**\n * Custom public path function\n */\n getPublicPath?: string;\n /**\n * Bundler runtime path\n */\n implementation?: string;\n\n manifest?: boolean | PluginManifestOptions;\n dev?: boolean | PluginDevOptions;\n dts?: boolean | PluginDtsOptions;\n virtualRuntimeEntry?: boolean;\n experiments?: {\n externalRuntime?: boolean;\n provideExternalRuntime?: boolean;\n asyncStartup?: boolean;\n /**\n * Options related to build optimizations.\n */\n optimization?: {\n /**\n * Enable optimization to skip snapshot plugin\n */\n disableSnapshot?: boolean;\n /**\n * Target environment for the build\n */\n target?: 'web' | 'node';\n };\n };\n bridge?: {\n /**\n * Enables bridge router functionality for React applications.\n * When enabled, automatically handles routing context and basename injection\n * for micro-frontend applications using react-router-dom.\n *\n * @default false\n */\n enableBridgeRouter?: boolean;\n /**\n * @deprecated Use `enableBridgeRouter: false` instead.\n *\n * Disables the default alias setting in the bridge.\n * When true, users must manually handle basename through root component props.\n *\n * Migration:\n * - `disableAlias: true` → `enableBridgeRouter: false`\n * - `disableAlias: false` → `enableBridgeRouter: true`\n *\n * @default false\n */\n disableAlias?: boolean;\n };\n /**\n * Configuration for async boundary plugin\n */\n async?: boolean | AsyncBoundaryOptions;\n\n /**\n * The directory to output the tree shaking shared fallback resources.\n */\n treeShakingDir?: string;\n\n /**\n * Whether to inject shared used exports into bundler runtime.\n */\n injectTreeShakingUsedExports?: boolean;\n treeShakingSharedExcludePlugins?: string[];\n treeShakingSharedPlugins?: string[];\n}\n\nexport type SharedStrategy = 'version-first' | 'loaded-first';\n"],"mappings":""}
{"version":3,"file":"ModuleFederationPlugin.cjs","names":[],"sources":["../../../src/types/plugins/ModuleFederationPlugin.ts"],"sourcesContent":["import type { Stats } from '../stats';\nimport type webpack from 'webpack';\n\n// <-- BEGIN SCHEMA-GENERATED TYPES -->\n/**\n * Module that should be exposed by this container.\n */\nexport type ExposesItem = string;\n\n/**\n * Modules that should be exposed by this container.\n */\nexport type ExposesItems = ExposesItem[];\n\n/**\n * Modules that should be exposed by this container. Property names are used as public paths.\n */\nexport interface ExposesObject {\n [k: string]: ExposesConfig | ExposesItem | ExposesItems;\n}\n\n/**\n * Advanced configuration for modules that should be exposed by this container.\n */\nexport interface ExposesConfig {\n /**\n * Request to a module that should be exposed by this container.\n */\n import: ExposesItem | ExposesItems;\n /**\n * Custom chunk name for the exposed module.\n */\n name?: string;\n}\n\n/**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\nexport type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;\n\n/**\n * Add a container for define/require functions in the AMD module.\n */\nexport type AmdContainer = string;\n\n/**\n * Add a comment in the UMD wrapper.\n */\nexport type AuxiliaryComment = string | LibraryCustomUmdCommentObject;\n\n/**\n * Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.\n */\nexport interface LibraryCustomUmdCommentObject {\n /**\n * Set comment for `amd` section in UMD.\n */\n amd?: string;\n /**\n * Set comment for `commonjs` (exports) section in UMD.\n */\n commonjs?: string;\n /**\n * Set comment for `commonjs2` (module.exports) section in UMD.\n */\n commonjs2?: string;\n /**\n * Set comment for `root` (global variable) section in UMD.\n */\n root?: string;\n}\n\n/**\n * Description object for all UMD variants of the library name.\n */\nexport interface LibraryCustomUmdObject {\n /**\n * Name of the exposed AMD library in the UMD.\n */\n amd?: string;\n /**\n * Name of the exposed commonjs export in the UMD.\n */\n commonjs?: string;\n /**\n * Name of the property exposed globally by a UMD library.\n */\n root?: string[] | string;\n}\n\n/**\n * Specify which export should be exposed as library.\n */\nexport type LibraryExport = string[] | string;\n\n/**\n * The name of the library (some types allow unnamed libraries too).\n */\nexport type LibraryName = string[] | string | LibraryCustomUmdObject;\n\n/**\n * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).\n */\nexport type LibraryType =\n | 'var'\n | 'module'\n | 'assign'\n | 'assign-properties'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | string;\n\n/**\n * Options for library.\n */\nexport interface LibraryOptions {\n amdContainer?: AmdContainer;\n auxiliaryComment?: AuxiliaryComment;\n export?: LibraryExport;\n name?: LibraryName;\n type: LibraryType;\n umdNamedDefine?: UmdNamedDefine;\n}\n\n/**\n * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.\n */\nexport type UmdNamedDefine = boolean;\n\n/**\n * Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).\n */\nexport type ExternalsType =\n | 'var'\n | 'module'\n | 'assign'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | 'promise'\n | 'import'\n | 'module-import'\n | 'script'\n | 'node-commonjs';\n\n/**\n * Container location from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItem = string;\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItems = RemotesItem[];\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.\n */\nexport interface RemotesObject {\n [k: string]: RemotesConfig | RemotesItem | RemotesItems;\n}\n\n/**\n * Advanced configuration for container locations from which modules should be resolved and loaded at runtime.\n */\nexport interface RemotesConfig {\n /**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\n external: RemotesItem | RemotesItems;\n /**\n * The name of the share scope shared with this remote.\n */\n shareScope?: string | string[];\n}\n\n/**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\nexport type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;\n\n/**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\nexport type EntryRuntime = false | string;\n\n/**\n * A module that should be shared in the share scope.\n */\nexport type SharedItem = string;\n\n/**\n * Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.\n */\nexport interface SharedObject {\n [k: string]: SharedConfig | SharedItem;\n}\n\n/**\n * Advanced configuration for modules that should be shared in the share scope.\n */\nexport interface SharedConfig {\n /**\n * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Options for excluding specific versions or request paths of the shared module. When specified, matching modules will not be shared. Cannot be used with 'include'.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Options for including only specific versions or request paths of the shared module. When specified, only matching modules will be shared. Cannot be used with 'exclude'.\n */\n include?: IncludeExcludeOptions;\n /**\n * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.\n */\n import?: false | SharedItem;\n /**\n * Import request to match on\n */\n request?: string;\n /**\n * Layer in which the shared module should be placed.\n */\n layer?: string;\n /**\n * Layer of the issuer.\n */\n issuerLayer?: string;\n /**\n * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.\n */\n packageName?: string;\n /**\n * Version requirement from module in share scope.\n */\n requiredVersion?: false | string;\n /**\n * Module is looked up under this key from the share scope.\n */\n shareKey?: string;\n /**\n * Share scope name.\n */\n shareScope?: string | string[];\n /**\n * [Deprecated]: load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: 'version-first' | 'loaded-first';\n /**\n * Allow only a single version of the shared module in share scope (disabled by default).\n */\n singleton?: boolean;\n /**\n * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).\n */\n strictVersion?: boolean;\n /**\n * Version of the provided module. Will replace lower matching versions, but not higher.\n */\n version?: false | string;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Enable tree-shaking for the shared module or configure it.\n */\n treeShaking?: boolean | TreeShakingConfig;\n}\n\n/**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Shared = (SharedItem | SharedObject)[] | SharedObject;\n\nexport interface IncludeExcludeOptions {\n /**\n * A string (which can be a regex pattern) or a RegExp object to match the request path.\n */\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Semantic versioning range to match against the fallback module's version for exclusion/inclusion context where applicable.\n */\n fallbackVersion?: string;\n}\n\n/**\n * Tree-shake configuration for shared module.\n */\nexport interface TreeShakingConfig {\n /**\n * List of export names used from the shared module.\n */\n usedExports?: string[];\n /**\n * Tree-shake analysis mode.\n */\n mode?: 'server-calc' | 'runtime-infer';\n /**\n * Filename for generated treeShaking metadata.\n */\n filename?: string;\n}\n\n// <-- END SCHEMA-GENERATED TYPES -->\n\nexport interface AdditionalDataOptions {\n stats: Stats;\n compiler: webpack.Compiler;\n compilation: webpack.Compilation;\n bundler: 'webpack' | 'rspack';\n}\nexport interface PluginManifestOptions {\n filePath?: string;\n disableAssetsAnalyze?: boolean;\n fileName?: string;\n additionalData?: (\n options: AdditionalDataOptions,\n ) => Promise<void | Stats> | Stats | void;\n}\n\nexport interface PluginDevOptions {\n disableLiveReload?: boolean;\n disableHotTypesReload?: boolean;\n disableDynamicRemoteTypeHints?: boolean;\n}\n\ninterface RemoteTypeUrl {\n alias?: string;\n api: string;\n zip: string;\n}\n\nexport interface RemoteTypeUrls {\n [remoteName: string]: RemoteTypeUrl;\n}\n\nexport interface DtsGenerateTypesHookOptions {\n zipTypesPath: string;\n apiTypesPath: string;\n zipName: string;\n apiFileName: string;\n}\n\nexport interface DtsHostOptions {\n typesFolder?: string;\n abortOnError?: boolean;\n remoteTypesFolder?: string;\n deleteTypesFolder?: boolean;\n maxRetries?: number;\n consumeAPITypes?: boolean;\n runtimePkgs?: string[];\n remoteTypeUrls?: (() => Promise<RemoteTypeUrls>) | RemoteTypeUrls;\n timeout?: number;\n /** The family of IP, used for network requests */\n family?: 4 | 6;\n typesOnBuild?: boolean;\n}\n\nexport interface DtsRemoteOptions {\n tsConfigPath?: string;\n typesFolder?: string;\n compiledTypesFolder?: string;\n /** Custom base output directory for generated types. When set, types will be emitted to this directory instead of the default compiler output directory. */\n outputDir?: string;\n deleteTypesFolder?: boolean;\n additionalFilesToCompile?: string[];\n compileInChildProcess?: boolean;\n compilerInstance?: 'tsc' | 'vue-tsc' | 'tspc' | string;\n generateAPITypes?: boolean;\n extractThirdParty?:\n | boolean\n | {\n exclude?: Array<string | RegExp>;\n };\n extractRemoteTypes?: boolean;\n abortOnError?: boolean;\n deleteTsConfig?: boolean;\n afterGenerate?: (\n options: DtsGenerateTypesHookOptions,\n ) => Promise<void> | void;\n}\n\nexport interface PluginDtsOptions {\n generateTypes?: boolean | DtsRemoteOptions;\n consumeTypes?: boolean | DtsHostOptions;\n tsConfigPath?: string;\n extraOptions?: Record<string, any>;\n implementation?: string;\n cwd?: string;\n displayErrorInTerminal?: boolean;\n}\n\nexport type AsyncBoundaryOptions = {\n eager?: RegExp | ((module: any) => boolean);\n excludeChunk?: (chunk: any) => boolean;\n};\n\nexport interface ModuleFederationPluginOptions {\n /**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\n exposes?: Exposes;\n /**\n * The filename of the container as relative path inside the `output.path` directory.\n */\n filename?: string;\n /**\n * Options for library.\n */\n library?: LibraryOptions;\n /**\n * The name of the container.\n */\n name?: string;\n /**\n * The external type of the remote containers.\n */\n remoteType?: ExternalsType;\n /**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\n remotes?: Remotes;\n /**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\n runtime?: EntryRuntime;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: SharedStrategy;\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared?: Shared;\n /**\n * Runtime plugin file paths or package name. Supports tuple [path, params].\n */\n runtimePlugins?: (string | [string, Record<string, unknown>])[];\n /**\n * Custom public path function\n */\n getPublicPath?: string;\n /**\n * Bundler runtime path\n */\n implementation?: string;\n\n manifest?: boolean | PluginManifestOptions;\n dev?: boolean | PluginDevOptions;\n dts?: boolean | PluginDtsOptions;\n virtualRuntimeEntry?: boolean;\n experiments?: {\n externalRuntime?: boolean;\n provideExternalRuntime?: boolean;\n asyncStartup?: boolean;\n /**\n * Options related to build optimizations.\n */\n optimization?: {\n /**\n * Enable optimization to skip snapshot plugin\n */\n disableSnapshot?: boolean;\n /**\n * Target environment for the build\n */\n target?: 'web' | 'node';\n };\n };\n bridge?: {\n /**\n * Enables bridge router functionality for React applications.\n * When enabled, automatically handles routing context and basename injection\n * for micro-frontend applications using react-router-dom.\n *\n * @default false\n */\n enableBridgeRouter?: boolean;\n /**\n * @deprecated Use `enableBridgeRouter: false` instead.\n *\n * Disables the default alias setting in the bridge.\n * When true, users must manually handle basename through root component props.\n *\n * Migration:\n * - `disableAlias: true` → `enableBridgeRouter: false`\n * - `disableAlias: false` → `enableBridgeRouter: true`\n *\n * @default false\n */\n disableAlias?: boolean;\n };\n /**\n * Configuration for async boundary plugin\n */\n async?: boolean | AsyncBoundaryOptions;\n\n /**\n * The directory to output the tree shaking shared fallback resources.\n */\n treeShakingDir?: string;\n\n /**\n * Whether to inject shared used exports into bundler runtime.\n */\n injectTreeShakingUsedExports?: boolean;\n treeShakingSharedExcludePlugins?: string[];\n treeShakingSharedPlugins?: string[];\n}\n\nexport type SharedStrategy = 'version-first' | 'loaded-first';\n"],"mappings":""}

@@ -6,3 +6,3 @@ import { Stats } from "../stats.js";

declare namespace ModuleFederationPlugin_d_exports {
export { AdditionalDataOptions, AmdContainer, AsyncBoundaryOptions, AuxiliaryComment, DtsHostOptions, DtsRemoteOptions, EntryRuntime, Exposes, ExposesConfig, ExposesItem, ExposesItems, ExposesObject, ExternalsType, IncludeExcludeOptions, LibraryCustomUmdCommentObject, LibraryCustomUmdObject, LibraryExport, LibraryName, LibraryOptions, LibraryType, ModuleFederationPluginOptions, PluginDevOptions, PluginDtsOptions, PluginManifestOptions, RemoteTypeUrls, Remotes, RemotesConfig, RemotesItem, RemotesItems, RemotesObject, Shared, SharedConfig, SharedItem, SharedObject, SharedStrategy, TreeShakingConfig, UmdNamedDefine };
export { AdditionalDataOptions, AmdContainer, AsyncBoundaryOptions, AuxiliaryComment, DtsGenerateTypesHookOptions, DtsHostOptions, DtsRemoteOptions, EntryRuntime, Exposes, ExposesConfig, ExposesItem, ExposesItems, ExposesObject, ExternalsType, IncludeExcludeOptions, LibraryCustomUmdCommentObject, LibraryCustomUmdObject, LibraryExport, LibraryName, LibraryOptions, LibraryType, ModuleFederationPluginOptions, PluginDevOptions, PluginDtsOptions, PluginManifestOptions, RemoteTypeUrls, Remotes, RemotesConfig, RemotesItem, RemotesItems, RemotesObject, Shared, SharedConfig, SharedItem, SharedObject, SharedStrategy, TreeShakingConfig, UmdNamedDefine };
}

@@ -295,2 +295,8 @@ /**

}
interface DtsGenerateTypesHookOptions {
zipTypesPath: string;
apiTypesPath: string;
zipName: string;
apiFileName: string;
}
interface DtsHostOptions {

@@ -327,2 +333,3 @@ typesFolder?: string;

deleteTsConfig?: boolean;
afterGenerate?: (options: DtsGenerateTypesHookOptions) => Promise<void> | void;
}

@@ -329,0 +336,0 @@ interface PluginDtsOptions {

@@ -1,1 +0,1 @@

{"version":3,"file":"ModuleFederationPlugin.js","names":[],"sources":["../../../src/types/plugins/ModuleFederationPlugin.ts"],"sourcesContent":["import type { Stats } from '../stats';\nimport type webpack from 'webpack';\n\n// <-- BEGIN SCHEMA-GENERATED TYPES -->\n/**\n * Module that should be exposed by this container.\n */\nexport type ExposesItem = string;\n\n/**\n * Modules that should be exposed by this container.\n */\nexport type ExposesItems = ExposesItem[];\n\n/**\n * Modules that should be exposed by this container. Property names are used as public paths.\n */\nexport interface ExposesObject {\n [k: string]: ExposesConfig | ExposesItem | ExposesItems;\n}\n\n/**\n * Advanced configuration for modules that should be exposed by this container.\n */\nexport interface ExposesConfig {\n /**\n * Request to a module that should be exposed by this container.\n */\n import: ExposesItem | ExposesItems;\n /**\n * Custom chunk name for the exposed module.\n */\n name?: string;\n}\n\n/**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\nexport type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;\n\n/**\n * Add a container for define/require functions in the AMD module.\n */\nexport type AmdContainer = string;\n\n/**\n * Add a comment in the UMD wrapper.\n */\nexport type AuxiliaryComment = string | LibraryCustomUmdCommentObject;\n\n/**\n * Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.\n */\nexport interface LibraryCustomUmdCommentObject {\n /**\n * Set comment for `amd` section in UMD.\n */\n amd?: string;\n /**\n * Set comment for `commonjs` (exports) section in UMD.\n */\n commonjs?: string;\n /**\n * Set comment for `commonjs2` (module.exports) section in UMD.\n */\n commonjs2?: string;\n /**\n * Set comment for `root` (global variable) section in UMD.\n */\n root?: string;\n}\n\n/**\n * Description object for all UMD variants of the library name.\n */\nexport interface LibraryCustomUmdObject {\n /**\n * Name of the exposed AMD library in the UMD.\n */\n amd?: string;\n /**\n * Name of the exposed commonjs export in the UMD.\n */\n commonjs?: string;\n /**\n * Name of the property exposed globally by a UMD library.\n */\n root?: string[] | string;\n}\n\n/**\n * Specify which export should be exposed as library.\n */\nexport type LibraryExport = string[] | string;\n\n/**\n * The name of the library (some types allow unnamed libraries too).\n */\nexport type LibraryName = string[] | string | LibraryCustomUmdObject;\n\n/**\n * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).\n */\nexport type LibraryType =\n | 'var'\n | 'module'\n | 'assign'\n | 'assign-properties'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | string;\n\n/**\n * Options for library.\n */\nexport interface LibraryOptions {\n amdContainer?: AmdContainer;\n auxiliaryComment?: AuxiliaryComment;\n export?: LibraryExport;\n name?: LibraryName;\n type: LibraryType;\n umdNamedDefine?: UmdNamedDefine;\n}\n\n/**\n * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.\n */\nexport type UmdNamedDefine = boolean;\n\n/**\n * Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).\n */\nexport type ExternalsType =\n | 'var'\n | 'module'\n | 'assign'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | 'promise'\n | 'import'\n | 'module-import'\n | 'script'\n | 'node-commonjs';\n\n/**\n * Container location from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItem = string;\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItems = RemotesItem[];\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.\n */\nexport interface RemotesObject {\n [k: string]: RemotesConfig | RemotesItem | RemotesItems;\n}\n\n/**\n * Advanced configuration for container locations from which modules should be resolved and loaded at runtime.\n */\nexport interface RemotesConfig {\n /**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\n external: RemotesItem | RemotesItems;\n /**\n * The name of the share scope shared with this remote.\n */\n shareScope?: string | string[];\n}\n\n/**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\nexport type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;\n\n/**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\nexport type EntryRuntime = false | string;\n\n/**\n * A module that should be shared in the share scope.\n */\nexport type SharedItem = string;\n\n/**\n * Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.\n */\nexport interface SharedObject {\n [k: string]: SharedConfig | SharedItem;\n}\n\n/**\n * Advanced configuration for modules that should be shared in the share scope.\n */\nexport interface SharedConfig {\n /**\n * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Options for excluding specific versions or request paths of the shared module. When specified, matching modules will not be shared. Cannot be used with 'include'.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Options for including only specific versions or request paths of the shared module. When specified, only matching modules will be shared. Cannot be used with 'exclude'.\n */\n include?: IncludeExcludeOptions;\n /**\n * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.\n */\n import?: false | SharedItem;\n /**\n * Import request to match on\n */\n request?: string;\n /**\n * Layer in which the shared module should be placed.\n */\n layer?: string;\n /**\n * Layer of the issuer.\n */\n issuerLayer?: string;\n /**\n * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.\n */\n packageName?: string;\n /**\n * Version requirement from module in share scope.\n */\n requiredVersion?: false | string;\n /**\n * Module is looked up under this key from the share scope.\n */\n shareKey?: string;\n /**\n * Share scope name.\n */\n shareScope?: string | string[];\n /**\n * [Deprecated]: load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: 'version-first' | 'loaded-first';\n /**\n * Allow only a single version of the shared module in share scope (disabled by default).\n */\n singleton?: boolean;\n /**\n * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).\n */\n strictVersion?: boolean;\n /**\n * Version of the provided module. Will replace lower matching versions, but not higher.\n */\n version?: false | string;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Enable tree-shaking for the shared module or configure it.\n */\n treeShaking?: boolean | TreeShakingConfig;\n}\n\n/**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Shared = (SharedItem | SharedObject)[] | SharedObject;\n\nexport interface IncludeExcludeOptions {\n /**\n * A string (which can be a regex pattern) or a RegExp object to match the request path.\n */\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Semantic versioning range to match against the fallback module's version for exclusion/inclusion context where applicable.\n */\n fallbackVersion?: string;\n}\n\n/**\n * Tree-shake configuration for shared module.\n */\nexport interface TreeShakingConfig {\n /**\n * List of export names used from the shared module.\n */\n usedExports?: string[];\n /**\n * Tree-shake analysis mode.\n */\n mode?: 'server-calc' | 'runtime-infer';\n /**\n * Filename for generated treeShaking metadata.\n */\n filename?: string;\n}\n\n// <-- END SCHEMA-GENERATED TYPES -->\n\nexport interface AdditionalDataOptions {\n stats: Stats;\n compiler: webpack.Compiler;\n compilation: webpack.Compilation;\n bundler: 'webpack' | 'rspack';\n}\nexport interface PluginManifestOptions {\n filePath?: string;\n disableAssetsAnalyze?: boolean;\n fileName?: string;\n additionalData?: (\n options: AdditionalDataOptions,\n ) => Promise<void | Stats> | Stats | void;\n}\n\nexport interface PluginDevOptions {\n disableLiveReload?: boolean;\n disableHotTypesReload?: boolean;\n disableDynamicRemoteTypeHints?: boolean;\n}\n\ninterface RemoteTypeUrl {\n alias?: string;\n api: string;\n zip: string;\n}\n\nexport interface RemoteTypeUrls {\n [remoteName: string]: RemoteTypeUrl;\n}\n\nexport interface DtsHostOptions {\n typesFolder?: string;\n abortOnError?: boolean;\n remoteTypesFolder?: string;\n deleteTypesFolder?: boolean;\n maxRetries?: number;\n consumeAPITypes?: boolean;\n runtimePkgs?: string[];\n remoteTypeUrls?: (() => Promise<RemoteTypeUrls>) | RemoteTypeUrls;\n timeout?: number;\n /** The family of IP, used for network requests */\n family?: 4 | 6;\n typesOnBuild?: boolean;\n}\n\nexport interface DtsRemoteOptions {\n tsConfigPath?: string;\n typesFolder?: string;\n compiledTypesFolder?: string;\n /** Custom base output directory for generated types. When set, types will be emitted to this directory instead of the default compiler output directory. */\n outputDir?: string;\n deleteTypesFolder?: boolean;\n additionalFilesToCompile?: string[];\n compileInChildProcess?: boolean;\n compilerInstance?: 'tsc' | 'vue-tsc' | 'tspc' | string;\n generateAPITypes?: boolean;\n extractThirdParty?:\n | boolean\n | {\n exclude?: Array<string | RegExp>;\n };\n extractRemoteTypes?: boolean;\n abortOnError?: boolean;\n deleteTsConfig?: boolean;\n}\n\nexport interface PluginDtsOptions {\n generateTypes?: boolean | DtsRemoteOptions;\n consumeTypes?: boolean | DtsHostOptions;\n tsConfigPath?: string;\n extraOptions?: Record<string, any>;\n implementation?: string;\n cwd?: string;\n displayErrorInTerminal?: boolean;\n}\n\nexport type AsyncBoundaryOptions = {\n eager?: RegExp | ((module: any) => boolean);\n excludeChunk?: (chunk: any) => boolean;\n};\n\nexport interface ModuleFederationPluginOptions {\n /**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\n exposes?: Exposes;\n /**\n * The filename of the container as relative path inside the `output.path` directory.\n */\n filename?: string;\n /**\n * Options for library.\n */\n library?: LibraryOptions;\n /**\n * The name of the container.\n */\n name?: string;\n /**\n * The external type of the remote containers.\n */\n remoteType?: ExternalsType;\n /**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\n remotes?: Remotes;\n /**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\n runtime?: EntryRuntime;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: SharedStrategy;\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared?: Shared;\n /**\n * Runtime plugin file paths or package name. Supports tuple [path, params].\n */\n runtimePlugins?: (string | [string, Record<string, unknown>])[];\n /**\n * Custom public path function\n */\n getPublicPath?: string;\n /**\n * Bundler runtime path\n */\n implementation?: string;\n\n manifest?: boolean | PluginManifestOptions;\n dev?: boolean | PluginDevOptions;\n dts?: boolean | PluginDtsOptions;\n virtualRuntimeEntry?: boolean;\n experiments?: {\n externalRuntime?: boolean;\n provideExternalRuntime?: boolean;\n asyncStartup?: boolean;\n /**\n * Options related to build optimizations.\n */\n optimization?: {\n /**\n * Enable optimization to skip snapshot plugin\n */\n disableSnapshot?: boolean;\n /**\n * Target environment for the build\n */\n target?: 'web' | 'node';\n };\n };\n bridge?: {\n /**\n * Enables bridge router functionality for React applications.\n * When enabled, automatically handles routing context and basename injection\n * for micro-frontend applications using react-router-dom.\n *\n * @default false\n */\n enableBridgeRouter?: boolean;\n /**\n * @deprecated Use `enableBridgeRouter: false` instead.\n *\n * Disables the default alias setting in the bridge.\n * When true, users must manually handle basename through root component props.\n *\n * Migration:\n * - `disableAlias: true` → `enableBridgeRouter: false`\n * - `disableAlias: false` → `enableBridgeRouter: true`\n *\n * @default false\n */\n disableAlias?: boolean;\n };\n /**\n * Configuration for async boundary plugin\n */\n async?: boolean | AsyncBoundaryOptions;\n\n /**\n * The directory to output the tree shaking shared fallback resources.\n */\n treeShakingDir?: string;\n\n /**\n * Whether to inject shared used exports into bundler runtime.\n */\n injectTreeShakingUsedExports?: boolean;\n treeShakingSharedExcludePlugins?: string[];\n treeShakingSharedPlugins?: string[];\n}\n\nexport type SharedStrategy = 'version-first' | 'loaded-first';\n"],"mappings":""}
{"version":3,"file":"ModuleFederationPlugin.js","names":[],"sources":["../../../src/types/plugins/ModuleFederationPlugin.ts"],"sourcesContent":["import type { Stats } from '../stats';\nimport type webpack from 'webpack';\n\n// <-- BEGIN SCHEMA-GENERATED TYPES -->\n/**\n * Module that should be exposed by this container.\n */\nexport type ExposesItem = string;\n\n/**\n * Modules that should be exposed by this container.\n */\nexport type ExposesItems = ExposesItem[];\n\n/**\n * Modules that should be exposed by this container. Property names are used as public paths.\n */\nexport interface ExposesObject {\n [k: string]: ExposesConfig | ExposesItem | ExposesItems;\n}\n\n/**\n * Advanced configuration for modules that should be exposed by this container.\n */\nexport interface ExposesConfig {\n /**\n * Request to a module that should be exposed by this container.\n */\n import: ExposesItem | ExposesItems;\n /**\n * Custom chunk name for the exposed module.\n */\n name?: string;\n}\n\n/**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\nexport type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;\n\n/**\n * Add a container for define/require functions in the AMD module.\n */\nexport type AmdContainer = string;\n\n/**\n * Add a comment in the UMD wrapper.\n */\nexport type AuxiliaryComment = string | LibraryCustomUmdCommentObject;\n\n/**\n * Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.\n */\nexport interface LibraryCustomUmdCommentObject {\n /**\n * Set comment for `amd` section in UMD.\n */\n amd?: string;\n /**\n * Set comment for `commonjs` (exports) section in UMD.\n */\n commonjs?: string;\n /**\n * Set comment for `commonjs2` (module.exports) section in UMD.\n */\n commonjs2?: string;\n /**\n * Set comment for `root` (global variable) section in UMD.\n */\n root?: string;\n}\n\n/**\n * Description object for all UMD variants of the library name.\n */\nexport interface LibraryCustomUmdObject {\n /**\n * Name of the exposed AMD library in the UMD.\n */\n amd?: string;\n /**\n * Name of the exposed commonjs export in the UMD.\n */\n commonjs?: string;\n /**\n * Name of the property exposed globally by a UMD library.\n */\n root?: string[] | string;\n}\n\n/**\n * Specify which export should be exposed as library.\n */\nexport type LibraryExport = string[] | string;\n\n/**\n * The name of the library (some types allow unnamed libraries too).\n */\nexport type LibraryName = string[] | string | LibraryCustomUmdObject;\n\n/**\n * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).\n */\nexport type LibraryType =\n | 'var'\n | 'module'\n | 'assign'\n | 'assign-properties'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | string;\n\n/**\n * Options for library.\n */\nexport interface LibraryOptions {\n amdContainer?: AmdContainer;\n auxiliaryComment?: AuxiliaryComment;\n export?: LibraryExport;\n name?: LibraryName;\n type: LibraryType;\n umdNamedDefine?: UmdNamedDefine;\n}\n\n/**\n * If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.\n */\nexport type UmdNamedDefine = boolean;\n\n/**\n * Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).\n */\nexport type ExternalsType =\n | 'var'\n | 'module'\n | 'assign'\n | 'this'\n | 'window'\n | 'self'\n | 'global'\n | 'commonjs'\n | 'commonjs2'\n | 'commonjs-module'\n | 'commonjs-static'\n | 'amd'\n | 'amd-require'\n | 'umd'\n | 'umd2'\n | 'jsonp'\n | 'system'\n | 'promise'\n | 'import'\n | 'module-import'\n | 'script'\n | 'node-commonjs';\n\n/**\n * Container location from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItem = string;\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\nexport type RemotesItems = RemotesItem[];\n\n/**\n * Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.\n */\nexport interface RemotesObject {\n [k: string]: RemotesConfig | RemotesItem | RemotesItems;\n}\n\n/**\n * Advanced configuration for container locations from which modules should be resolved and loaded at runtime.\n */\nexport interface RemotesConfig {\n /**\n * Container locations from which modules should be resolved and loaded at runtime.\n */\n external: RemotesItem | RemotesItems;\n /**\n * The name of the share scope shared with this remote.\n */\n shareScope?: string | string[];\n}\n\n/**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\nexport type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;\n\n/**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\nexport type EntryRuntime = false | string;\n\n/**\n * A module that should be shared in the share scope.\n */\nexport type SharedItem = string;\n\n/**\n * Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.\n */\nexport interface SharedObject {\n [k: string]: SharedConfig | SharedItem;\n}\n\n/**\n * Advanced configuration for modules that should be shared in the share scope.\n */\nexport interface SharedConfig {\n /**\n * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Options for excluding specific versions or request paths of the shared module. When specified, matching modules will not be shared. Cannot be used with 'include'.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Options for including only specific versions or request paths of the shared module. When specified, only matching modules will be shared. Cannot be used with 'exclude'.\n */\n include?: IncludeExcludeOptions;\n /**\n * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.\n */\n import?: false | SharedItem;\n /**\n * Import request to match on\n */\n request?: string;\n /**\n * Layer in which the shared module should be placed.\n */\n layer?: string;\n /**\n * Layer of the issuer.\n */\n issuerLayer?: string;\n /**\n * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.\n */\n packageName?: string;\n /**\n * Version requirement from module in share scope.\n */\n requiredVersion?: false | string;\n /**\n * Module is looked up under this key from the share scope.\n */\n shareKey?: string;\n /**\n * Share scope name.\n */\n shareScope?: string | string[];\n /**\n * [Deprecated]: load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: 'version-first' | 'loaded-first';\n /**\n * Allow only a single version of the shared module in share scope (disabled by default).\n */\n singleton?: boolean;\n /**\n * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).\n */\n strictVersion?: boolean;\n /**\n * Version of the provided module. Will replace lower matching versions, but not higher.\n */\n version?: false | string;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Enable tree-shaking for the shared module or configure it.\n */\n treeShaking?: boolean | TreeShakingConfig;\n}\n\n/**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Shared = (SharedItem | SharedObject)[] | SharedObject;\n\nexport interface IncludeExcludeOptions {\n /**\n * A string (which can be a regex pattern) or a RegExp object to match the request path.\n */\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Semantic versioning range to match against the fallback module's version for exclusion/inclusion context where applicable.\n */\n fallbackVersion?: string;\n}\n\n/**\n * Tree-shake configuration for shared module.\n */\nexport interface TreeShakingConfig {\n /**\n * List of export names used from the shared module.\n */\n usedExports?: string[];\n /**\n * Tree-shake analysis mode.\n */\n mode?: 'server-calc' | 'runtime-infer';\n /**\n * Filename for generated treeShaking metadata.\n */\n filename?: string;\n}\n\n// <-- END SCHEMA-GENERATED TYPES -->\n\nexport interface AdditionalDataOptions {\n stats: Stats;\n compiler: webpack.Compiler;\n compilation: webpack.Compilation;\n bundler: 'webpack' | 'rspack';\n}\nexport interface PluginManifestOptions {\n filePath?: string;\n disableAssetsAnalyze?: boolean;\n fileName?: string;\n additionalData?: (\n options: AdditionalDataOptions,\n ) => Promise<void | Stats> | Stats | void;\n}\n\nexport interface PluginDevOptions {\n disableLiveReload?: boolean;\n disableHotTypesReload?: boolean;\n disableDynamicRemoteTypeHints?: boolean;\n}\n\ninterface RemoteTypeUrl {\n alias?: string;\n api: string;\n zip: string;\n}\n\nexport interface RemoteTypeUrls {\n [remoteName: string]: RemoteTypeUrl;\n}\n\nexport interface DtsGenerateTypesHookOptions {\n zipTypesPath: string;\n apiTypesPath: string;\n zipName: string;\n apiFileName: string;\n}\n\nexport interface DtsHostOptions {\n typesFolder?: string;\n abortOnError?: boolean;\n remoteTypesFolder?: string;\n deleteTypesFolder?: boolean;\n maxRetries?: number;\n consumeAPITypes?: boolean;\n runtimePkgs?: string[];\n remoteTypeUrls?: (() => Promise<RemoteTypeUrls>) | RemoteTypeUrls;\n timeout?: number;\n /** The family of IP, used for network requests */\n family?: 4 | 6;\n typesOnBuild?: boolean;\n}\n\nexport interface DtsRemoteOptions {\n tsConfigPath?: string;\n typesFolder?: string;\n compiledTypesFolder?: string;\n /** Custom base output directory for generated types. When set, types will be emitted to this directory instead of the default compiler output directory. */\n outputDir?: string;\n deleteTypesFolder?: boolean;\n additionalFilesToCompile?: string[];\n compileInChildProcess?: boolean;\n compilerInstance?: 'tsc' | 'vue-tsc' | 'tspc' | string;\n generateAPITypes?: boolean;\n extractThirdParty?:\n | boolean\n | {\n exclude?: Array<string | RegExp>;\n };\n extractRemoteTypes?: boolean;\n abortOnError?: boolean;\n deleteTsConfig?: boolean;\n afterGenerate?: (\n options: DtsGenerateTypesHookOptions,\n ) => Promise<void> | void;\n}\n\nexport interface PluginDtsOptions {\n generateTypes?: boolean | DtsRemoteOptions;\n consumeTypes?: boolean | DtsHostOptions;\n tsConfigPath?: string;\n extraOptions?: Record<string, any>;\n implementation?: string;\n cwd?: string;\n displayErrorInTerminal?: boolean;\n}\n\nexport type AsyncBoundaryOptions = {\n eager?: RegExp | ((module: any) => boolean);\n excludeChunk?: (chunk: any) => boolean;\n};\n\nexport interface ModuleFederationPluginOptions {\n /**\n * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.\n */\n exposes?: Exposes;\n /**\n * The filename of the container as relative path inside the `output.path` directory.\n */\n filename?: string;\n /**\n * Options for library.\n */\n library?: LibraryOptions;\n /**\n * The name of the container.\n */\n name?: string;\n /**\n * The external type of the remote containers.\n */\n remoteType?: ExternalsType;\n /**\n * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.\n */\n remotes?: Remotes;\n /**\n * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.\n */\n runtime?: EntryRuntime;\n /**\n * Share scope name used for all shared modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * load shared strategy(defaults to 'version-first').\n */\n shareStrategy?: SharedStrategy;\n /**\n * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.\n */\n shared?: Shared;\n /**\n * Runtime plugin file paths or package name. Supports tuple [path, params].\n */\n runtimePlugins?: (string | [string, Record<string, unknown>])[];\n /**\n * Custom public path function\n */\n getPublicPath?: string;\n /**\n * Bundler runtime path\n */\n implementation?: string;\n\n manifest?: boolean | PluginManifestOptions;\n dev?: boolean | PluginDevOptions;\n dts?: boolean | PluginDtsOptions;\n virtualRuntimeEntry?: boolean;\n experiments?: {\n externalRuntime?: boolean;\n provideExternalRuntime?: boolean;\n asyncStartup?: boolean;\n /**\n * Options related to build optimizations.\n */\n optimization?: {\n /**\n * Enable optimization to skip snapshot plugin\n */\n disableSnapshot?: boolean;\n /**\n * Target environment for the build\n */\n target?: 'web' | 'node';\n };\n };\n bridge?: {\n /**\n * Enables bridge router functionality for React applications.\n * When enabled, automatically handles routing context and basename injection\n * for micro-frontend applications using react-router-dom.\n *\n * @default false\n */\n enableBridgeRouter?: boolean;\n /**\n * @deprecated Use `enableBridgeRouter: false` instead.\n *\n * Disables the default alias setting in the bridge.\n * When true, users must manually handle basename through root component props.\n *\n * Migration:\n * - `disableAlias: true` → `enableBridgeRouter: false`\n * - `disableAlias: false` → `enableBridgeRouter: true`\n *\n * @default false\n */\n disableAlias?: boolean;\n };\n /**\n * Configuration for async boundary plugin\n */\n async?: boolean | AsyncBoundaryOptions;\n\n /**\n * The directory to output the tree shaking shared fallback resources.\n */\n treeShakingDir?: string;\n\n /**\n * Whether to inject shared used exports into bundler runtime.\n */\n injectTreeShakingUsedExports?: boolean;\n treeShakingSharedExcludePlugins?: string[];\n treeShakingSharedPlugins?: string[];\n}\n\nexport type SharedStrategy = 'version-first' | 'loaded-first';\n"],"mappings":""}

@@ -43,5 +43,2 @@ import { TreeShakingStatus } from "../constant.js";

}>;
prefetchInterface?: boolean;
prefetchEntry?: string;
prefetchEntryType?: RemoteEntryType;
}

@@ -48,0 +45,0 @@ interface BasicProviderModuleInfoWithPublicPath extends BasicProviderModuleInfo {

@@ -13,2 +13,3 @@ import { RemoteWithEntry, RemoteWithVersion } from "./common.js";

buildName: string;
hash?: string;
target?: string[];

@@ -30,4 +31,2 @@ plugins?: string[];

ssrRemoteEntry?: ResourceInfo;
prefetchInterface?: boolean;
prefetchEntry?: ResourceInfo;
types?: MetaDataTypes;

@@ -92,2 +91,3 @@ type: string;

assets: StatsAssets;
hash?: string;
}

@@ -94,0 +94,0 @@ interface Stats<T = BasicStatsMetaData, K = StatsRemoteVal> {

{
"name": "@module-federation/sdk",
"version": "0.0.0-feat-error-capture-20260313091847",
"version": "0.0.0-feat-federationdiagnosticerror-20260511031552",
"type": "module",

@@ -64,2 +64,14 @@ "license": "MIT",

},
"devDependencies": {
"@jest/globals": "29.7.0",
"webpack": "^5.0.0"
},
"peerDependencies": {
"node-fetch": "^2.7.0 || ^3.3.2"
},
"peerDependenciesMeta": {
"node-fetch": {
"optional": true
}
},
"scripts": {

@@ -66,0 +78,0 @@ "build": "tsdown --config tsdown.config.ts",