@module-federation/sdk 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +9 -3
  2. package/dist/_virtual/_rolldown/runtime.cjs +19 -0
  3. package/dist/_virtual/_rolldown/runtime.js +18 -0
  4. package/dist/constant.cjs +70 -0
  5. package/dist/constant.cjs.map +1 -0
  6. package/dist/constant.d.ts +53 -0
  7. package/dist/constant.js +55 -0
  8. package/dist/constant.js.map +1 -0
  9. package/dist/createModuleFederationConfig.cjs +9 -0
  10. package/dist/createModuleFederationConfig.cjs.map +1 -0
  11. package/dist/createModuleFederationConfig.d.ts +6 -0
  12. package/dist/createModuleFederationConfig.js +8 -0
  13. package/dist/createModuleFederationConfig.js.map +1 -0
  14. package/dist/dom.cjs +180 -0
  15. package/dist/dom.cjs.map +1 -0
  16. package/dist/dom.d.ts +33 -0
  17. package/dist/dom.js +176 -0
  18. package/dist/dom.js.map +1 -0
  19. package/dist/env.cjs +34 -0
  20. package/dist/env.cjs.map +1 -0
  21. package/dist/env.d.ts +12 -0
  22. package/dist/env.js +30 -0
  23. package/dist/env.js.map +1 -0
  24. package/dist/generateSnapshotFromManifest.cjs +138 -0
  25. package/dist/generateSnapshotFromManifest.cjs.map +1 -0
  26. package/dist/generateSnapshotFromManifest.d.ts +20 -0
  27. package/dist/generateSnapshotFromManifest.js +134 -0
  28. package/dist/generateSnapshotFromManifest.js.map +1 -0
  29. package/dist/index.cjs +104 -0
  30. package/dist/index.d.ts +21 -1
  31. package/dist/index.js +17 -0
  32. package/dist/logger.cjs +129 -0
  33. package/dist/logger.cjs.map +1 -0
  34. package/dist/logger.d.ts +34 -0
  35. package/dist/logger.js +125 -0
  36. package/dist/logger.js.map +1 -0
  37. package/dist/node.cjs +122 -0
  38. package/dist/node.cjs.map +1 -0
  39. package/dist/node.d.ts +15 -0
  40. package/dist/node.js +120 -0
  41. package/dist/node.js.map +1 -0
  42. package/dist/normalize-webpack-path.cjs +28 -0
  43. package/dist/normalize-webpack-path.cjs.map +1 -0
  44. package/dist/normalize-webpack-path.d.ts +10 -1
  45. package/dist/normalize-webpack-path.js +26 -0
  46. package/dist/normalize-webpack-path.js.map +1 -0
  47. package/dist/normalizeOptions.cjs +19 -0
  48. package/dist/normalizeOptions.cjs.map +1 -0
  49. package/dist/normalizeOptions.d.ts +5 -0
  50. package/dist/normalizeOptions.js +18 -0
  51. package/dist/normalizeOptions.js.map +1 -0
  52. package/dist/types/common.d.ts +14 -0
  53. package/dist/types/hooks.d.ts +16 -0
  54. package/dist/types/index.d.ts +11 -0
  55. package/dist/types/manifest.d.ts +34 -0
  56. package/dist/types/plugins/ConsumeSharedPlugin.cjs +13 -0
  57. package/dist/types/plugins/ConsumeSharedPlugin.cjs.map +1 -0
  58. package/dist/types/plugins/ConsumeSharedPlugin.d.ts +109 -0
  59. package/dist/types/plugins/ConsumeSharedPlugin.js +8 -0
  60. package/dist/types/plugins/ConsumeSharedPlugin.js.map +1 -0
  61. package/dist/types/plugins/ContainerPlugin.cjs +13 -0
  62. package/dist/types/plugins/ContainerPlugin.cjs.map +1 -0
  63. package/dist/types/plugins/ContainerPlugin.d.ts +42 -0
  64. package/dist/types/plugins/ContainerPlugin.js +8 -0
  65. package/dist/types/plugins/ContainerPlugin.js.map +1 -0
  66. package/dist/types/plugins/ContainerReferencePlugin.cjs +13 -0
  67. package/dist/types/plugins/ContainerReferencePlugin.cjs.map +1 -0
  68. package/dist/types/plugins/ContainerReferencePlugin.d.ts +24 -0
  69. package/dist/types/plugins/ContainerReferencePlugin.js +8 -0
  70. package/dist/types/plugins/ContainerReferencePlugin.js.map +1 -0
  71. package/dist/types/plugins/ModuleFederationPlugin.cjs +13 -0
  72. package/dist/types/plugins/ModuleFederationPlugin.cjs.map +1 -0
  73. package/dist/types/plugins/ModuleFederationPlugin.d.ts +455 -0
  74. package/dist/types/plugins/ModuleFederationPlugin.js +8 -0
  75. package/dist/types/plugins/ModuleFederationPlugin.js.map +1 -0
  76. package/dist/types/plugins/ProvideSharedPlugin.cjs +13 -0
  77. package/dist/types/plugins/ProvideSharedPlugin.cjs.map +1 -0
  78. package/dist/types/plugins/ProvideSharedPlugin.d.ts +97 -0
  79. package/dist/types/plugins/ProvideSharedPlugin.js +8 -0
  80. package/dist/types/plugins/ProvideSharedPlugin.js.map +1 -0
  81. package/dist/types/plugins/SharePlugin.cjs +13 -0
  82. package/dist/types/plugins/SharePlugin.cjs.map +1 -0
  83. package/dist/types/plugins/SharePlugin.d.ts +26 -0
  84. package/dist/types/plugins/SharePlugin.js +8 -0
  85. package/dist/types/plugins/SharePlugin.js.map +1 -0
  86. package/dist/types/plugins/index.d.ts +6 -0
  87. package/dist/types/snapshot.d.ts +81 -0
  88. package/dist/types/stats.d.ts +101 -0
  89. package/dist/utils.cjs +127 -0
  90. package/dist/utils.cjs.map +1 -0
  91. package/dist/{src/utils.d.ts → utils.d.ts} +7 -3
  92. package/dist/utils.js +116 -0
  93. package/dist/utils.js.map +1 -0
  94. package/package.json +14 -7
  95. package/dist/index.cjs.cjs +0 -1032
  96. package/dist/index.cjs.cjs.map +0 -1
  97. package/dist/index.cjs.d.ts +0 -1
  98. package/dist/index.esm.js +0 -978
  99. package/dist/index.esm.js.map +0 -1
  100. package/dist/normalize-webpack-path.cjs.cjs +0 -42
  101. package/dist/normalize-webpack-path.cjs.cjs.map +0 -1
  102. package/dist/normalize-webpack-path.cjs.d.ts +0 -1
  103. package/dist/normalize-webpack-path.esm.js +0 -39
  104. package/dist/normalize-webpack-path.esm.js.map +0 -1
  105. package/dist/src/constant.d.ts +0 -49
  106. package/dist/src/createModuleFederationConfig.d.ts +0 -2
  107. package/dist/src/dom.d.ts +0 -29
  108. package/dist/src/env.d.ts +0 -8
  109. package/dist/src/generateSnapshotFromManifest.d.ts +0 -15
  110. package/dist/src/index.d.ts +0 -11
  111. package/dist/src/logger.d.ts +0 -32
  112. package/dist/src/node.d.ts +0 -11
  113. package/dist/src/normalize-webpack-path.d.ts +0 -5
  114. package/dist/src/normalizeOptions.d.ts +0 -1
  115. package/dist/src/types/common.d.ts +0 -10
  116. package/dist/src/types/hooks.d.ts +0 -12
  117. package/dist/src/types/index.d.ts +0 -6
  118. package/dist/src/types/manifest.d.ts +0 -29
  119. package/dist/src/types/plugins/ContainerPlugin.d.ts +0 -32
  120. package/dist/src/types/plugins/ContainerReferencePlugin.d.ts +0 -15
  121. package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +0 -425
  122. package/dist/src/types/plugins/SharePlugin.d.ts +0 -21
  123. package/dist/src/types/plugins/index.d.ts +0 -4
  124. package/dist/src/types/snapshot.d.ts +0 -77
  125. package/dist/src/types/stats.d.ts +0 -97
package/dist/node.js ADDED
@@ -0,0 +1,120 @@
1
+ //#region src/node.ts
2
+ const sdkImportCache = /* @__PURE__ */ new Map();
3
+ function importNodeModule(name) {
4
+ if (!name) throw new Error("import specifier is required");
5
+ if (sdkImportCache.has(name)) return sdkImportCache.get(name);
6
+ const promise = new Function("name", `return import(name)`)(name).then((res) => res).catch((error) => {
7
+ console.error(`Error importing module ${name}:`, error);
8
+ sdkImportCache.delete(name);
9
+ throw error;
10
+ });
11
+ sdkImportCache.set(name, promise);
12
+ return promise;
13
+ }
14
+ const loadNodeFetch = async () => {
15
+ const fetchModule = await importNodeModule("node-fetch");
16
+ return fetchModule.default || fetchModule;
17
+ };
18
+ const lazyLoaderHookFetch = async (input, init, loaderHook) => {
19
+ const hook = (url, init) => {
20
+ return loaderHook.lifecycle.fetch.emit(url, init);
21
+ };
22
+ const res = await hook(input, init || {});
23
+ if (!res || !(res instanceof Response)) return (typeof fetch === "undefined" ? await loadNodeFetch() : fetch)(input, init || {});
24
+ return res;
25
+ };
26
+ const createScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
27
+ if (loaderHook?.createScriptHook) {
28
+ const hookResult = loaderHook.createScriptHook(url);
29
+ if (hookResult && typeof hookResult === "object" && "url" in hookResult) url = hookResult.url;
30
+ }
31
+ let urlObj;
32
+ try {
33
+ urlObj = new URL(url);
34
+ } catch (e) {
35
+ console.error("Error constructing URL:", e);
36
+ cb(/* @__PURE__ */ new Error(`Invalid URL: ${e}`));
37
+ return;
38
+ }
39
+ const getFetch = async () => {
40
+ if (loaderHook?.fetch) return (input, init) => lazyLoaderHookFetch(input, init, loaderHook);
41
+ return typeof fetch === "undefined" ? loadNodeFetch() : fetch;
42
+ };
43
+ const handleScriptFetch = async (f, urlObj) => {
44
+ try {
45
+ const res = await f(urlObj.href);
46
+ const data = await res.text();
47
+ const [path, vm] = await Promise.all([importNodeModule("path"), importNodeModule("vm")]);
48
+ const scriptContext = {
49
+ exports: {},
50
+ module: { exports: {} }
51
+ };
52
+ const urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/");
53
+ const filename = path.basename(urlObj.pathname);
54
+ const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
55
+ filename,
56
+ importModuleDynamically: vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule
57
+ });
58
+ let requireFn;
59
+ requireFn = (await importNodeModule("node:module")).createRequire(urlObj.protocol === "file:" || urlObj.protocol === "node:" ? urlObj.href : path.join(process.cwd(), "__mf_require_base__.js"));
60
+ script.runInThisContext()(scriptContext.exports, scriptContext.module, requireFn, urlDirname, filename);
61
+ const exportedInterface = scriptContext.module.exports || scriptContext.exports;
62
+ if (attrs && exportedInterface && attrs["globalName"]) {
63
+ cb(void 0, exportedInterface[attrs["globalName"]] || exportedInterface);
64
+ return;
65
+ }
66
+ cb(void 0, exportedInterface);
67
+ } catch (e) {
68
+ cb(e instanceof Error ? e : /* @__PURE__ */ new Error(`Script execution error: ${e}`));
69
+ }
70
+ };
71
+ getFetch().then(async (f) => {
72
+ if (attrs?.["type"] === "esm" || attrs?.["type"] === "module") return loadModule(urlObj.href, {
73
+ fetch: f,
74
+ vm: await importNodeModule("vm")
75
+ }).then(async (module) => {
76
+ await module.evaluate();
77
+ cb(void 0, module.namespace);
78
+ }).catch((e) => {
79
+ cb(e instanceof Error ? e : /* @__PURE__ */ new Error(`Script execution error: ${e}`));
80
+ });
81
+ handleScriptFetch(f, urlObj);
82
+ }).catch((err) => {
83
+ cb(err);
84
+ });
85
+ } : (url, cb, attrs, loaderHook) => {
86
+ cb(/* @__PURE__ */ new Error("createScriptNode is disabled in non-Node.js environment"));
87
+ };
88
+ const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web" ? (url, info) => {
89
+ return new Promise((resolve, reject) => {
90
+ createScriptNode(url, (error, scriptContext) => {
91
+ if (error) reject(error);
92
+ else {
93
+ const remoteEntryKey = info?.attrs?.["globalName"] || `__FEDERATION_${info?.attrs?.["name"]}:custom__`;
94
+ resolve(globalThis[remoteEntryKey] = scriptContext);
95
+ }
96
+ }, info.attrs, info.loaderHook);
97
+ });
98
+ } : (url, info) => {
99
+ throw new Error("loadScriptNode is disabled in non-Node.js environment");
100
+ };
101
+ const esmModuleCache = /* @__PURE__ */ new Map();
102
+ async function loadModule(url, options) {
103
+ if (esmModuleCache.has(url)) return esmModuleCache.get(url);
104
+ const { fetch, vm } = options;
105
+ const code = await (await fetch(url)).text();
106
+ const module = new vm.SourceTextModule(code, { importModuleDynamically: async (specifier, script) => {
107
+ const resolvedUrl = new URL(specifier, url).href;
108
+ return loadModule(resolvedUrl, options);
109
+ } });
110
+ esmModuleCache.set(url, module);
111
+ await module.link(async (specifier) => {
112
+ const resolvedUrl = new URL(specifier, url).href;
113
+ return await loadModule(resolvedUrl, options);
114
+ });
115
+ return module;
116
+ }
117
+
118
+ //#endregion
119
+ export { createScriptNode, loadScriptNode };
120
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { CreateScriptHookNode, FetchHook } from './types';\n\n// Declare the ENV_TARGET constant that will be defined by DefinePlugin\ndeclare const ENV_TARGET: 'web' | 'node';\n\nconst sdkImportCache = new Map<string, Promise<any>>();\n\nfunction importNodeModule<T>(name: string): Promise<T> {\n if (!name) {\n throw new Error('import specifier is required');\n }\n\n // Check cache to prevent infinite recursion\n if (sdkImportCache.has(name)) {\n return sdkImportCache.get(name)!;\n }\n\n const importModule = new Function('name', `return import(name)`);\n const promise = importModule(name)\n .then((res: any) => res as T)\n .catch((error: any) => {\n console.error(`Error importing module ${name}:`, error);\n // Remove from cache on error so it can be retried\n sdkImportCache.delete(name);\n throw error;\n });\n\n // Cache the promise to prevent recursive calls\n sdkImportCache.set(name, promise);\n return promise;\n}\n\nconst loadNodeFetch = async (): Promise<typeof fetch> => {\n const fetchModule =\n await importNodeModule<typeof import('node-fetch')>('node-fetch');\n return (fetchModule.default || fetchModule) as unknown as typeof fetch;\n};\n\nconst lazyLoaderHookFetch = async (\n input: RequestInfo | URL,\n init?: RequestInit,\n loaderHook?: any,\n): Promise<Response> => {\n const hook = (url: RequestInfo | URL, init: RequestInit) => {\n return loaderHook.lifecycle.fetch.emit(url, init);\n };\n\n const res = await hook(input, init || {});\n if (!res || !(res instanceof Response)) {\n const fetchFunction =\n typeof fetch === 'undefined' ? await loadNodeFetch() : fetch;\n return fetchFunction(input, init || {});\n }\n\n return res;\n};\n\nexport const createScriptNode =\n typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'\n ? (\n url: string,\n cb: (error?: Error, scriptContext?: any) => void,\n attrs?: Record<string, any>,\n loaderHook?: {\n createScriptHook?: CreateScriptHookNode;\n fetch?: FetchHook;\n },\n ) => {\n if (loaderHook?.createScriptHook) {\n const hookResult = loaderHook.createScriptHook(url);\n if (\n hookResult &&\n typeof hookResult === 'object' &&\n 'url' in hookResult\n ) {\n url = hookResult.url;\n }\n }\n\n let urlObj: URL;\n try {\n urlObj = new URL(url);\n } catch (e) {\n console.error('Error constructing URL:', e);\n cb(new Error(`Invalid URL: ${e}`));\n return;\n }\n\n const getFetch = async (): Promise<typeof fetch> => {\n if (loaderHook?.fetch) {\n return (input: RequestInfo | URL, init?: RequestInit) =>\n lazyLoaderHookFetch(input, init, loaderHook);\n }\n\n return typeof fetch === 'undefined' ? loadNodeFetch() : fetch;\n };\n\n const handleScriptFetch = async (f: typeof fetch, urlObj: URL) => {\n try {\n const res = await f(urlObj.href);\n const data = await res.text();\n const [path, vm] = await Promise.all([\n importNodeModule<typeof import('path')>('path'),\n importNodeModule<typeof import('vm')>('vm'),\n ]);\n\n const scriptContext = { exports: {}, module: { exports: {} } };\n const urlDirname = urlObj.pathname\n .split('/')\n .slice(0, -1)\n .join('/');\n const filename = path.basename(urlObj.pathname);\n\n const script = new vm.Script(\n `(function(exports, module, require, __dirname, __filename) {${data}\\n})`,\n {\n filename,\n importModuleDynamically:\n //@ts-ignore\n vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ??\n importNodeModule,\n },\n );\n\n let requireFn: NodeRequire;\n if (process.env.IS_ESM_BUILD === 'true') {\n const nodeModule =\n await importNodeModule<typeof import('node:module')>(\n 'node:module',\n );\n requireFn = nodeModule.createRequire(\n urlObj.protocol === 'file:' || urlObj.protocol === 'node:'\n ? urlObj.href\n : path.join(process.cwd(), '__mf_require_base__.js'),\n );\n } else {\n requireFn = eval('require') as NodeRequire;\n }\n\n script.runInThisContext()(\n scriptContext.exports,\n scriptContext.module,\n requireFn,\n urlDirname,\n filename,\n );\n const exportedInterface: Record<string, any> =\n scriptContext.module.exports || scriptContext.exports;\n\n if (attrs && exportedInterface && attrs['globalName']) {\n const container =\n exportedInterface[attrs['globalName']] || exportedInterface;\n cb(\n undefined,\n container as keyof typeof scriptContext.module.exports,\n );\n return;\n }\n\n cb(\n undefined,\n exportedInterface as keyof typeof scriptContext.module.exports,\n );\n } catch (e) {\n cb(\n e instanceof Error\n ? e\n : new Error(`Script execution error: ${e}`),\n );\n }\n };\n\n getFetch()\n .then(async (f) => {\n if (attrs?.['type'] === 'esm' || attrs?.['type'] === 'module') {\n return loadModule(urlObj.href, {\n fetch: f,\n vm: await importNodeModule<typeof import('vm')>('vm'),\n })\n .then(async (module) => {\n await module.evaluate();\n cb(undefined, module.namespace);\n })\n .catch((e) => {\n cb(\n e instanceof Error\n ? e\n : new Error(`Script execution error: ${e}`),\n );\n });\n }\n handleScriptFetch(f, urlObj);\n })\n .catch((err) => {\n cb(err);\n });\n }\n : (\n url: string,\n cb: (error?: Error, scriptContext?: any) => void,\n attrs?: Record<string, any>,\n loaderHook?: {\n createScriptHook?: CreateScriptHookNode;\n fetch?: FetchHook;\n },\n ) => {\n cb(\n new Error('createScriptNode is disabled in non-Node.js environment'),\n );\n };\n\nexport const loadScriptNode =\n typeof ENV_TARGET === 'undefined' || ENV_TARGET !== 'web'\n ? (\n url: string,\n info: {\n attrs?: Record<string, any>;\n loaderHook?: {\n createScriptHook?: CreateScriptHookNode;\n };\n },\n ) => {\n return new Promise<void>((resolve, reject) => {\n createScriptNode(\n url,\n (error, scriptContext) => {\n if (error) {\n reject(error);\n } else {\n const remoteEntryKey =\n info?.attrs?.['globalName'] ||\n `__FEDERATION_${info?.attrs?.['name']}:custom__`;\n const entryExports = ((globalThis as any)[remoteEntryKey] =\n scriptContext);\n resolve(entryExports);\n }\n },\n info.attrs,\n info.loaderHook,\n );\n });\n }\n : (\n url: string,\n info: {\n attrs?: Record<string, any>;\n loaderHook?: {\n createScriptHook?: CreateScriptHookNode;\n };\n },\n ) => {\n throw new Error(\n 'loadScriptNode is disabled in non-Node.js environment',\n );\n };\n\nconst esmModuleCache = new Map<string, any>();\n\nasync function loadModule(\n url: string,\n options: {\n vm: any;\n fetch: any;\n },\n) {\n // Check cache to prevent infinite recursion in ESM loading\n if (esmModuleCache.has(url)) {\n return esmModuleCache.get(url)!;\n }\n\n const { fetch, vm } = options;\n const response = await fetch(url);\n const code = await response.text();\n\n const module: any = new vm.SourceTextModule(code, {\n // @ts-ignore\n importModuleDynamically: async (specifier, script) => {\n const resolvedUrl = new URL(specifier, url).href;\n return loadModule(resolvedUrl, options);\n },\n });\n\n // Cache the module before linking to prevent cycles\n esmModuleCache.set(url, module);\n\n await module.link(async (specifier: string) => {\n const resolvedUrl = new URL(specifier, url).href;\n const module = await loadModule(resolvedUrl, options);\n return module;\n });\n\n return module;\n}\n"],"mappings":"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"}
@@ -0,0 +1,28 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let node_path = require("node:path");
3
+
4
+ //#region src/normalize-webpack-path.ts
5
+ function getWebpackPath(compiler, options = { framework: "other" }) {
6
+ const resolveWithContext = new Function("id", "options", "return typeof require === \"undefined\" ? \"\" : require.resolve(id, options)");
7
+ try {
8
+ compiler.webpack();
9
+ return "";
10
+ } catch (err) {
11
+ const webpackPath = ((err.stack?.split("\n") || []).find((item) => item.includes("at webpack")) || "").replace(/[^\(\)]+/, "").slice(1, -1).split(":").slice(0, -2).join(":");
12
+ if (options?.framework === "nextjs") {
13
+ if (webpackPath.endsWith("webpack.js")) return webpackPath.replace("webpack.js", "index.js");
14
+ return "";
15
+ }
16
+ return resolveWithContext("webpack", { paths: [webpackPath] });
17
+ }
18
+ }
19
+ const normalizeWebpackPath = (fullPath) => {
20
+ if (fullPath === "webpack") return process.env["FEDERATION_WEBPACK_PATH"] || fullPath;
21
+ if (process.env["FEDERATION_WEBPACK_PATH"]) return (0, node_path.resolve)(process.env["FEDERATION_WEBPACK_PATH"], fullPath.replace("webpack", "../../"));
22
+ return fullPath;
23
+ };
24
+
25
+ //#endregion
26
+ exports.getWebpackPath = getWebpackPath;
27
+ exports.normalizeWebpackPath = normalizeWebpackPath;
28
+ //# sourceMappingURL=normalize-webpack-path.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-webpack-path.cjs","names":[],"sources":["../src/normalize-webpack-path.ts"],"sourcesContent":["import type webpack from 'webpack';\nimport { resolve } from 'node:path';\n\nexport function getWebpackPath(\n compiler: webpack.Compiler,\n options: { framework: 'nextjs' | 'other' } = { framework: 'other' },\n): string {\n const resolveWithContext = new Function(\n 'id',\n 'options',\n 'return typeof require === \"undefined\" ? \"\" : require.resolve(id, options)',\n ) as (id: string, options?: { paths?: string[] }) => string;\n\n try {\n // @ts-ignore just throw err\n compiler.webpack();\n return '';\n } catch (err) {\n const trace = (err as Error).stack?.split('\\n') || [];\n const webpackErrLocation =\n trace.find((item) => item.includes('at webpack')) || '';\n const webpackLocationWithDetail = webpackErrLocation\n .replace(/[^\\(\\)]+/, '')\n .slice(1, -1);\n const webpackPath = webpackLocationWithDetail\n .split(':')\n .slice(0, -2)\n .join(':');\n if (options?.framework === 'nextjs') {\n if (webpackPath.endsWith('webpack.js')) {\n return webpackPath.replace('webpack.js', 'index.js');\n }\n return '';\n }\n return resolveWithContext('webpack', { paths: [webpackPath] });\n }\n}\n\nexport const normalizeWebpackPath = (fullPath: string): string => {\n if (fullPath === 'webpack') {\n return process.env['FEDERATION_WEBPACK_PATH'] || fullPath;\n }\n\n if (process.env['FEDERATION_WEBPACK_PATH']) {\n return resolve(\n process.env['FEDERATION_WEBPACK_PATH'],\n fullPath.replace('webpack', '../../'),\n );\n }\n\n return fullPath;\n};\n"],"mappings":";;;;AAGA,SAAgB,eACd,UACA,UAA6C,EAAE,WAAW,SAAS,EAC3D;CACR,MAAM,qBAAqB,IAAI,SAC7B,MACA,WACA,gFACD;AAED,KAAI;AAEF,WAAS,SAAS;AAClB,SAAO;UACA,KAAK;EAOZ,MAAM,gBANS,IAAc,OAAO,MAAM,KAAK,IAAI,EAAE,EAE7C,MAAM,SAAS,KAAK,SAAS,aAAa,CAAC,IAAI,IAEpD,QAAQ,YAAY,GAAG,CACvB,MAAM,GAAG,GAAG,CAEZ,MAAM,IAAI,CACV,MAAM,GAAG,GAAG,CACZ,KAAK,IAAI;AACZ,MAAI,SAAS,cAAc,UAAU;AACnC,OAAI,YAAY,SAAS,aAAa,CACpC,QAAO,YAAY,QAAQ,cAAc,WAAW;AAEtD,UAAO;;AAET,SAAO,mBAAmB,WAAW,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;;;AAIlE,MAAa,wBAAwB,aAA6B;AAChE,KAAI,aAAa,UACf,QAAO,QAAQ,IAAI,8BAA8B;AAGnD,KAAI,QAAQ,IAAI,2BACd,+BACE,QAAQ,IAAI,4BACZ,SAAS,QAAQ,WAAW,SAAS,CACtC;AAGH,QAAO"}
@@ -1 +1,10 @@
1
- export * from "./src/normalize-webpack-path";
1
+ import webpack from "webpack";
2
+
3
+ //#region src/normalize-webpack-path.d.ts
4
+ declare function getWebpackPath(compiler: webpack.Compiler, options?: {
5
+ framework: 'nextjs' | 'other';
6
+ }): string;
7
+ declare const normalizeWebpackPath: (fullPath: string) => string;
8
+ //#endregion
9
+ export { getWebpackPath, normalizeWebpackPath };
10
+ //# sourceMappingURL=normalize-webpack-path.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { resolve } from "node:path";
2
+
3
+ //#region src/normalize-webpack-path.ts
4
+ function getWebpackPath(compiler, options = { framework: "other" }) {
5
+ const resolveWithContext = new Function("id", "options", "return typeof require === \"undefined\" ? \"\" : require.resolve(id, options)");
6
+ try {
7
+ compiler.webpack();
8
+ return "";
9
+ } catch (err) {
10
+ const webpackPath = ((err.stack?.split("\n") || []).find((item) => item.includes("at webpack")) || "").replace(/[^\(\)]+/, "").slice(1, -1).split(":").slice(0, -2).join(":");
11
+ if (options?.framework === "nextjs") {
12
+ if (webpackPath.endsWith("webpack.js")) return webpackPath.replace("webpack.js", "index.js");
13
+ return "";
14
+ }
15
+ return resolveWithContext("webpack", { paths: [webpackPath] });
16
+ }
17
+ }
18
+ const normalizeWebpackPath = (fullPath) => {
19
+ if (fullPath === "webpack") return process.env["FEDERATION_WEBPACK_PATH"] || fullPath;
20
+ if (process.env["FEDERATION_WEBPACK_PATH"]) return resolve(process.env["FEDERATION_WEBPACK_PATH"], fullPath.replace("webpack", "../../"));
21
+ return fullPath;
22
+ };
23
+
24
+ //#endregion
25
+ export { getWebpackPath, normalizeWebpackPath };
26
+ //# sourceMappingURL=normalize-webpack-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-webpack-path.js","names":[],"sources":["../src/normalize-webpack-path.ts"],"sourcesContent":["import type webpack from 'webpack';\nimport { resolve } from 'node:path';\n\nexport function getWebpackPath(\n compiler: webpack.Compiler,\n options: { framework: 'nextjs' | 'other' } = { framework: 'other' },\n): string {\n const resolveWithContext = new Function(\n 'id',\n 'options',\n 'return typeof require === \"undefined\" ? \"\" : require.resolve(id, options)',\n ) as (id: string, options?: { paths?: string[] }) => string;\n\n try {\n // @ts-ignore just throw err\n compiler.webpack();\n return '';\n } catch (err) {\n const trace = (err as Error).stack?.split('\\n') || [];\n const webpackErrLocation =\n trace.find((item) => item.includes('at webpack')) || '';\n const webpackLocationWithDetail = webpackErrLocation\n .replace(/[^\\(\\)]+/, '')\n .slice(1, -1);\n const webpackPath = webpackLocationWithDetail\n .split(':')\n .slice(0, -2)\n .join(':');\n if (options?.framework === 'nextjs') {\n if (webpackPath.endsWith('webpack.js')) {\n return webpackPath.replace('webpack.js', 'index.js');\n }\n return '';\n }\n return resolveWithContext('webpack', { paths: [webpackPath] });\n }\n}\n\nexport const normalizeWebpackPath = (fullPath: string): string => {\n if (fullPath === 'webpack') {\n return process.env['FEDERATION_WEBPACK_PATH'] || fullPath;\n }\n\n if (process.env['FEDERATION_WEBPACK_PATH']) {\n return resolve(\n process.env['FEDERATION_WEBPACK_PATH'],\n fullPath.replace('webpack', '../../'),\n );\n }\n\n return fullPath;\n};\n"],"mappings":";;;AAGA,SAAgB,eACd,UACA,UAA6C,EAAE,WAAW,SAAS,EAC3D;CACR,MAAM,qBAAqB,IAAI,SAC7B,MACA,WACA,gFACD;AAED,KAAI;AAEF,WAAS,SAAS;AAClB,SAAO;UACA,KAAK;EAOZ,MAAM,gBANS,IAAc,OAAO,MAAM,KAAK,IAAI,EAAE,EAE7C,MAAM,SAAS,KAAK,SAAS,aAAa,CAAC,IAAI,IAEpD,QAAQ,YAAY,GAAG,CACvB,MAAM,GAAG,GAAG,CAEZ,MAAM,IAAI,CACV,MAAM,GAAG,GAAG,CACZ,KAAK,IAAI;AACZ,MAAI,SAAS,cAAc,UAAU;AACnC,OAAI,YAAY,SAAS,aAAa,CACpC,QAAO,YAAY,QAAQ,cAAc,WAAW;AAEtD,UAAO;;AAET,SAAO,mBAAmB,WAAW,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;;;AAIlE,MAAa,wBAAwB,aAA6B;AAChE,KAAI,aAAa,UACf,QAAO,QAAQ,IAAI,8BAA8B;AAGnD,KAAI,QAAQ,IAAI,2BACd,QAAO,QACL,QAAQ,IAAI,4BACZ,SAAS,QAAQ,WAAW,SAAS,CACtC;AAGH,QAAO"}
@@ -0,0 +1,19 @@
1
+
2
+ //#region src/normalizeOptions.ts
3
+ function normalizeOptions(enableDefault, defaultOptions, key) {
4
+ return function(options) {
5
+ if (options === false) return false;
6
+ if (typeof options === "undefined") if (enableDefault) return defaultOptions;
7
+ else return false;
8
+ if (options === true) return defaultOptions;
9
+ if (options && typeof options === "object") return {
10
+ ...defaultOptions,
11
+ ...options
12
+ };
13
+ throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
14
+ };
15
+ }
16
+
17
+ //#endregion
18
+ exports.normalizeOptions = normalizeOptions;
19
+ //# sourceMappingURL=normalizeOptions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeOptions.cjs","names":[],"sources":["../src/normalizeOptions.ts"],"sourcesContent":["export function normalizeOptions<T>(\n enableDefault: boolean,\n defaultOptions: T,\n key: string,\n) {\n return function <U extends boolean | undefined | T>(options: U): T | false {\n if (options === false) {\n return false;\n }\n\n if (typeof options === 'undefined') {\n if (enableDefault) {\n return defaultOptions;\n } else {\n return false;\n }\n }\n\n if (options === true) {\n return defaultOptions;\n }\n\n if (options && typeof options === 'object') {\n return {\n ...(defaultOptions as T),\n ...options,\n };\n }\n\n throw new Error(\n `Unexpected type for \\`${key}\\`, expect boolean/undefined/object, got: ${typeof options}`,\n );\n };\n}\n"],"mappings":";;AAAA,SAAgB,iBACd,eACA,gBACA,KACA;AACA,QAAO,SAA6C,SAAuB;AACzE,MAAI,YAAY,MACd,QAAO;AAGT,MAAI,OAAO,YAAY,YACrB,KAAI,cACF,QAAO;MAEP,QAAO;AAIX,MAAI,YAAY,KACd,QAAO;AAGT,MAAI,WAAW,OAAO,YAAY,SAChC,QAAO;GACL,GAAI;GACJ,GAAG;GACJ;AAGH,QAAM,IAAI,MACR,yBAAyB,IAAI,4CAA4C,OAAO,UACjF"}
@@ -0,0 +1,5 @@
1
+ //#region src/normalizeOptions.d.ts
2
+ declare function normalizeOptions<T>(enableDefault: boolean, defaultOptions: T, key: string): <U extends boolean | undefined | T>(options: U) => T | false;
3
+ //#endregion
4
+ export { normalizeOptions };
5
+ //# sourceMappingURL=normalizeOptions.d.ts.map
@@ -0,0 +1,18 @@
1
+ //#region src/normalizeOptions.ts
2
+ function normalizeOptions(enableDefault, defaultOptions, key) {
3
+ return function(options) {
4
+ if (options === false) return false;
5
+ if (typeof options === "undefined") if (enableDefault) return defaultOptions;
6
+ else return false;
7
+ if (options === true) return defaultOptions;
8
+ if (options && typeof options === "object") return {
9
+ ...defaultOptions,
10
+ ...options
11
+ };
12
+ throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
13
+ };
14
+ }
15
+
16
+ //#endregion
17
+ export { normalizeOptions };
18
+ //# sourceMappingURL=normalizeOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeOptions.js","names":[],"sources":["../src/normalizeOptions.ts"],"sourcesContent":["export function normalizeOptions<T>(\n enableDefault: boolean,\n defaultOptions: T,\n key: string,\n) {\n return function <U extends boolean | undefined | T>(options: U): T | false {\n if (options === false) {\n return false;\n }\n\n if (typeof options === 'undefined') {\n if (enableDefault) {\n return defaultOptions;\n } else {\n return false;\n }\n }\n\n if (options === true) {\n return defaultOptions;\n }\n\n if (options && typeof options === 'object') {\n return {\n ...(defaultOptions as T),\n ...options,\n };\n }\n\n throw new Error(\n `Unexpected type for \\`${key}\\`, expect boolean/undefined/object, got: ${typeof options}`,\n );\n };\n}\n"],"mappings":";AAAA,SAAgB,iBACd,eACA,gBACA,KACA;AACA,QAAO,SAA6C,SAAuB;AACzE,MAAI,YAAY,MACd,QAAO;AAGT,MAAI,OAAO,YAAY,YACrB,KAAI,cACF,QAAO;MAEP,QAAO;AAIX,MAAI,YAAY,KACd,QAAO;AAGT,MAAI,WAAW,OAAO,YAAY,SAChC,QAAO;GACL,GAAI;GACJ,GAAG;GACJ;AAGH,QAAM,IAAI,MACR,yBAAyB,IAAI,4CAA4C,OAAO,UACjF"}
@@ -0,0 +1,14 @@
1
+ //#region src/types/common.d.ts
2
+ interface RemoteWithEntry {
3
+ name: string;
4
+ entry: string;
5
+ }
6
+ interface RemoteWithVersion {
7
+ name: string;
8
+ version: string;
9
+ }
10
+ type RemoteEntryInfo = RemoteWithEntry | RemoteWithVersion;
11
+ type Module = any;
12
+ //#endregion
13
+ export { Module, RemoteEntryInfo, RemoteWithEntry, RemoteWithVersion };
14
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1,16 @@
1
+ //#region src/types/hooks.d.ts
2
+ type CreateScriptHookReturnNode = {
3
+ url: string;
4
+ } | void;
5
+ type CreateScriptHookReturnDom = HTMLScriptElement | {
6
+ script?: HTMLScriptElement;
7
+ timeout?: number;
8
+ } | void;
9
+ type CreateScriptHookReturn = CreateScriptHookReturnNode | CreateScriptHookReturnDom;
10
+ type CreateScriptHookNode = (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturnNode;
11
+ type CreateScriptHookDom = (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturnDom;
12
+ type CreateScriptHook = (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturn;
13
+ type FetchHook = (args: [string, RequestInit]) => Promise<Response> | void | false;
14
+ //#endregion
15
+ export { CreateScriptHook, CreateScriptHookDom, CreateScriptHookNode, CreateScriptHookReturn, CreateScriptHookReturnDom, CreateScriptHookReturnNode, FetchHook };
16
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { Module, RemoteEntryInfo, RemoteWithEntry, RemoteWithVersion } from "./common.js";
2
+ import { BasicStatsMetaData, ManifestModuleInfos, MetaDataTypes, RemoteEntryType, ResourceInfo, Stats, StatsAssets, StatsBuildInfo, StatsExpose, StatsMetaData, StatsMetaDataWithGetPublicPath, StatsMetaDataWithPublicPath, StatsModuleInfo, StatsRemote, StatsRemoteVal, StatsRemoteWithEntry, StatsRemoteWithVersion, StatsShared } from "./stats.js";
3
+ import { Manifest, ManifestExpose, ManifestRemote, ManifestRemoteCommonInfo, ManifestShared } from "./manifest.js";
4
+ import { BasicProviderModuleInfo, ConsumerModuleInfo, ConsumerModuleInfoWithPublicPath, GlobalModuleInfo, ManifestProvider, ModuleInfo, ProviderModuleInfo, PureConsumerModuleInfo, PureEntryProvider } from "./snapshot.js";
5
+ import { ModuleFederationPlugin_d_exports } from "./plugins/ModuleFederationPlugin.js";
6
+ import { ContainerPlugin_d_exports } from "./plugins/ContainerPlugin.js";
7
+ import { ContainerReferencePlugin_d_exports } from "./plugins/ContainerReferencePlugin.js";
8
+ import { SharePlugin_d_exports } from "./plugins/SharePlugin.js";
9
+ import { ConsumeSharedPlugin_d_exports } from "./plugins/ConsumeSharedPlugin.js";
10
+ import { ProvideSharedPlugin_d_exports } from "./plugins/ProvideSharedPlugin.js";
11
+ import { CreateScriptHook, CreateScriptHookDom, CreateScriptHookNode, CreateScriptHookReturn, CreateScriptHookReturnDom, CreateScriptHookReturnNode, FetchHook } from "./hooks.js";
@@ -0,0 +1,34 @@
1
+ import { RemoteWithEntry, RemoteWithVersion } from "./common.js";
2
+ import { BasicStatsMetaData, RemoteEntryType, StatsAssets, StatsExpose, StatsMetaData } from "./stats.js";
3
+
4
+ //#region src/types/manifest.d.ts
5
+ interface ManifestShared {
6
+ id: string;
7
+ name: string;
8
+ version: string;
9
+ singleton: boolean;
10
+ requiredVersion: string;
11
+ hash: string;
12
+ assets: StatsAssets;
13
+ fallback?: string;
14
+ fallbackName?: string;
15
+ fallbackType?: RemoteEntryType;
16
+ }
17
+ interface ManifestRemoteCommonInfo {
18
+ federationContainerName: string;
19
+ moduleName: string;
20
+ alias: string;
21
+ }
22
+ type ManifestRemote<T = ManifestRemoteCommonInfo> = (Omit<RemoteWithEntry, 'name'> & T) | (Omit<RemoteWithVersion, 'name'> & T);
23
+ type ManifestExpose = Pick<StatsExpose, 'assets' | 'id' | 'name' | 'path'>;
24
+ interface Manifest<T = BasicStatsMetaData, K = ManifestRemoteCommonInfo> {
25
+ id: string;
26
+ name: string;
27
+ metaData: StatsMetaData<T>;
28
+ shared: ManifestShared[];
29
+ remotes: ManifestRemote<K>[];
30
+ exposes: ManifestExpose[];
31
+ }
32
+ //#endregion
33
+ export { Manifest, ManifestExpose, ManifestRemote, ManifestRemoteCommonInfo, ManifestShared };
34
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+
3
+ //#region src/types/plugins/ConsumeSharedPlugin.ts
4
+ var ConsumeSharedPlugin_exports = /* @__PURE__ */ require_runtime.__exportAll({});
5
+
6
+ //#endregion
7
+ Object.defineProperty(exports, 'ConsumeSharedPlugin_exports', {
8
+ enumerable: true,
9
+ get: function () {
10
+ return ConsumeSharedPlugin_exports;
11
+ }
12
+ });
13
+ //# sourceMappingURL=ConsumeSharedPlugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsumeSharedPlugin.cjs","names":[],"sources":["../../../src/types/plugins/ConsumeSharedPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\n/**\n * A module that should be consumed from share scope.\n */\nexport type ConsumesItem = string;\n\n/**\n * Advanced configuration for modules that should be consumed from share scope.\n */\nexport interface ConsumesConfig {\n /**\n * Include the fallback module directly instead behind an async request. This allows to use fallback module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Fallback module if no shared module is found in share scope. Defaults to the property name.\n */\n import?: false | ConsumesItem;\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 * 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 * Import request to match on\n */\n request?: string;\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 * Filter consumed modules based on the request path.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Filter consumed modules based on the request path (only include matches).\n */\n include?: IncludeExcludeOptions;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Tree shaking mode for the shared module.\n */\n treeShakingMode?: 'server-calc' | 'runtime-infer';\n}\n\n/**\n * Modules that should be consumed from 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 ConsumesObject {\n [k: string]: ConsumesConfig | ConsumesItem;\n}\n\n/**\n * Modules that should be consumed from share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject;\n\nexport interface IncludeExcludeOptions {\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Optional specific version string to check against the version range instead of reading package.json.\n */\n fallbackVersion?: string;\n}\n\nexport interface ConsumeSharedPluginOptions {\n consumes: Consumes;\n /**\n * Share scope name used for all consumed modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable reconstructed lookup for node_modules paths */\n allowNodeModulesSuffixMatch?: boolean;\n };\n}\n"],"mappings":""}
@@ -0,0 +1,109 @@
1
+ declare namespace ConsumeSharedPlugin_d_exports {
2
+ export { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, IncludeExcludeOptions };
3
+ }
4
+ /**
5
+ * A module that should be consumed from share scope.
6
+ */
7
+ type ConsumesItem = string;
8
+ /**
9
+ * Advanced configuration for modules that should be consumed from share scope.
10
+ */
11
+ interface ConsumesConfig {
12
+ /**
13
+ * Include the fallback module directly instead behind an async request. This allows to use fallback module in initial load too. All possible shared modules need to be eager too.
14
+ */
15
+ eager?: boolean;
16
+ /**
17
+ * Fallback module if no shared module is found in share scope. Defaults to the property name.
18
+ */
19
+ import?: false | ConsumesItem;
20
+ /**
21
+ * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.
22
+ */
23
+ packageName?: string;
24
+ /**
25
+ * Version requirement from module in share scope.
26
+ */
27
+ requiredVersion?: false | string;
28
+ /**
29
+ * Module is looked up under this key from the share scope.
30
+ */
31
+ shareKey?: string;
32
+ /**
33
+ * Share scope name.
34
+ */
35
+ shareScope?: string | string[];
36
+ /**
37
+ * Layer in which the shared module should be placed.
38
+ */
39
+ layer?: string;
40
+ /**
41
+ * Layer of the issuer.
42
+ */
43
+ issuerLayer?: string;
44
+ /**
45
+ * Import request to match on
46
+ */
47
+ request?: string;
48
+ /**
49
+ * Allow only a single version of the shared module in share scope (disabled by default).
50
+ */
51
+ singleton?: boolean;
52
+ /**
53
+ * 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).
54
+ */
55
+ strictVersion?: boolean;
56
+ /**
57
+ * Filter consumed modules based on the request path.
58
+ */
59
+ exclude?: IncludeExcludeOptions;
60
+ /**
61
+ * Filter consumed modules based on the request path (only include matches).
62
+ */
63
+ include?: IncludeExcludeOptions;
64
+ /**
65
+ * Enable reconstructed lookup for node_modules paths for this share item
66
+ */
67
+ allowNodeModulesSuffixMatch?: boolean;
68
+ /**
69
+ * Tree shaking mode for the shared module.
70
+ */
71
+ treeShakingMode?: 'server-calc' | 'runtime-infer';
72
+ }
73
+ /**
74
+ * Modules that should be consumed from 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.
75
+ */
76
+ interface ConsumesObject {
77
+ [k: string]: ConsumesConfig | ConsumesItem;
78
+ }
79
+ /**
80
+ * Modules that should be consumed from share scope. When provided, property names are used to match requested modules in this compilation.
81
+ */
82
+ type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject;
83
+ interface IncludeExcludeOptions {
84
+ request?: string | RegExp;
85
+ /**
86
+ * Semantic versioning range to match against the module's version.
87
+ */
88
+ version?: string;
89
+ /**
90
+ * Optional specific version string to check against the version range instead of reading package.json.
91
+ */
92
+ fallbackVersion?: string;
93
+ }
94
+ interface ConsumeSharedPluginOptions {
95
+ consumes: Consumes;
96
+ /**
97
+ * Share scope name used for all consumed modules (defaults to 'default').
98
+ */
99
+ shareScope?: string | string[];
100
+ /**
101
+ * Experimental features configuration
102
+ */
103
+ experiments?: {
104
+ /** Enable reconstructed lookup for node_modules paths */allowNodeModulesSuffixMatch?: boolean;
105
+ };
106
+ }
107
+ //#endregion
108
+ export { ConsumeSharedPlugin_d_exports, IncludeExcludeOptions };
109
+ //# sourceMappingURL=ConsumeSharedPlugin.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+
3
+ //#region src/types/plugins/ConsumeSharedPlugin.ts
4
+ var ConsumeSharedPlugin_exports = /* @__PURE__ */ __exportAll({});
5
+
6
+ //#endregion
7
+ export { ConsumeSharedPlugin_exports };
8
+ //# sourceMappingURL=ConsumeSharedPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsumeSharedPlugin.js","names":[],"sources":["../../../src/types/plugins/ConsumeSharedPlugin.ts"],"sourcesContent":["/*\n * This file was automatically generated.\n * DO NOT MODIFY BY HAND.\n * Run `pnpm generate:schema -w` to update.\n */\n\n/**\n * A module that should be consumed from share scope.\n */\nexport type ConsumesItem = string;\n\n/**\n * Advanced configuration for modules that should be consumed from share scope.\n */\nexport interface ConsumesConfig {\n /**\n * Include the fallback module directly instead behind an async request. This allows to use fallback module in initial load too. All possible shared modules need to be eager too.\n */\n eager?: boolean;\n /**\n * Fallback module if no shared module is found in share scope. Defaults to the property name.\n */\n import?: false | ConsumesItem;\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 * 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 * Import request to match on\n */\n request?: string;\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 * Filter consumed modules based on the request path.\n */\n exclude?: IncludeExcludeOptions;\n /**\n * Filter consumed modules based on the request path (only include matches).\n */\n include?: IncludeExcludeOptions;\n /**\n * Enable reconstructed lookup for node_modules paths for this share item\n */\n allowNodeModulesSuffixMatch?: boolean;\n /**\n * Tree shaking mode for the shared module.\n */\n treeShakingMode?: 'server-calc' | 'runtime-infer';\n}\n\n/**\n * Modules that should be consumed from 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 ConsumesObject {\n [k: string]: ConsumesConfig | ConsumesItem;\n}\n\n/**\n * Modules that should be consumed from share scope. When provided, property names are used to match requested modules in this compilation.\n */\nexport type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject;\n\nexport interface IncludeExcludeOptions {\n request?: string | RegExp;\n /**\n * Semantic versioning range to match against the module's version.\n */\n version?: string;\n /**\n * Optional specific version string to check against the version range instead of reading package.json.\n */\n fallbackVersion?: string;\n}\n\nexport interface ConsumeSharedPluginOptions {\n consumes: Consumes;\n /**\n * Share scope name used for all consumed modules (defaults to 'default').\n */\n shareScope?: string | string[];\n /**\n * Experimental features configuration\n */\n experiments?: {\n /** Enable reconstructed lookup for node_modules paths */\n allowNodeModulesSuffixMatch?: boolean;\n };\n}\n"],"mappings":""}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+
3
+ //#region src/types/plugins/ContainerPlugin.ts
4
+ var ContainerPlugin_exports = /* @__PURE__ */ require_runtime.__exportAll({});
5
+
6
+ //#endregion
7
+ Object.defineProperty(exports, 'ContainerPlugin_exports', {
8
+ enumerable: true,
9
+ get: function () {
10
+ return ContainerPlugin_exports;
11
+ }
12
+ });
13
+ //# sourceMappingURL=ContainerPlugin.cjs.map
@@ -0,0 +1 @@
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":""}
@@ -0,0 +1,42 @@
1
+ import { EntryRuntime, Exposes, LibraryOptions } from "./ModuleFederationPlugin.js";
2
+
3
+ //#region src/types/plugins/ContainerPlugin.d.ts
4
+ declare namespace ContainerPlugin_d_exports {
5
+ export { ContainerPluginOptions };
6
+ }
7
+ interface ContainerPluginOptions {
8
+ exposes: Exposes;
9
+ /**
10
+ * The filename for this container relative path inside the `output.path` directory.
11
+ */
12
+ filename?: string;
13
+ library?: LibraryOptions;
14
+ /**
15
+ * The name for this container.
16
+ */
17
+ name: string;
18
+ runtime?: EntryRuntime;
19
+ /**
20
+ * The name of the share scope which is shared with the host (defaults to 'default').
21
+ */
22
+ shareScope?: string | string[];
23
+ /**
24
+ * Experimental features configuration
25
+ */
26
+ experiments?: {
27
+ /** Enable async startup for the container */asyncStartup?: boolean; /** 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!) */
28
+ externalRuntime?: boolean; /** Enable providing external runtime */
29
+ provideExternalRuntime?: boolean;
30
+ };
31
+ /**
32
+ * Enable data prefetching for container modules.
33
+ */
34
+ dataPrefetch?: boolean;
35
+ /**
36
+ * Array of runtime plugins to be applied
37
+ */
38
+ runtimePlugins?: (string | unknown[])[];
39
+ }
40
+ //#endregion
41
+ export { ContainerPlugin_d_exports };
42
+ //# sourceMappingURL=ContainerPlugin.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
+
3
+ //#region src/types/plugins/ContainerPlugin.ts
4
+ var ContainerPlugin_exports = /* @__PURE__ */ __exportAll({});
5
+
6
+ //#endregion
7
+ export { ContainerPlugin_exports };
8
+ //# sourceMappingURL=ContainerPlugin.js.map
@@ -0,0 +1 @@
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":""}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+
3
+ //#region src/types/plugins/ContainerReferencePlugin.ts
4
+ var ContainerReferencePlugin_exports = /* @__PURE__ */ require_runtime.__exportAll({});
5
+
6
+ //#endregion
7
+ Object.defineProperty(exports, 'ContainerReferencePlugin_exports', {
8
+ enumerable: true,
9
+ get: function () {
10
+ return ContainerReferencePlugin_exports;
11
+ }
12
+ });
13
+ //# sourceMappingURL=ContainerReferencePlugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContainerReferencePlugin.cjs","names":[],"sources":["../../../src/types/plugins/ContainerReferencePlugin.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 { ExternalsType, Remotes } from './ModuleFederationPlugin';\n\nexport interface ContainerReferencePluginOptions {\n /**\n * Enable/disable asynchronous loading of runtime modules. When enabled, entry points will be wrapped in asynchronous chunks.\n */\n async?: boolean;\n /**\n * The external type of the remote containers.\n */\n remoteType: ExternalsType;\n remotes: Remotes;\n /**\n * The name of the share scope shared with all remotes (defaults to 'default').\n */\n shareScope?: string | string[];\n}\n"],"mappings":""}