@module-federation/node 2.7.32 → 2.7.33

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 (122) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +31 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  3. package/dist/plugins/ChunkCorrelationPlugin.js +308 -0
  4. package/dist/plugins/ChunkCorrelationPlugin.js.map +1 -0
  5. package/dist/plugins/ChunkCorrelationPlugin.mjs +305 -0
  6. package/dist/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  7. package/dist/src/filesystem/stratagies.d.mts +21 -0
  8. package/dist/src/filesystem/stratagies.d.ts +10 -7
  9. package/dist/src/filesystem/stratagies.js +97 -116
  10. package/dist/src/filesystem/stratagies.js.map +1 -1
  11. package/dist/src/filesystem/stratagies.mjs +103 -0
  12. package/dist/src/filesystem/stratagies.mjs.map +1 -0
  13. package/dist/src/index.d.mts +8 -0
  14. package/dist/src/index.d.ts +8 -7
  15. package/dist/src/index.js +16 -22
  16. package/dist/src/index.mjs +9 -0
  17. package/dist/src/plugins/AutomaticPublicPathPlugin.d.mts +12 -0
  18. package/dist/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -7
  19. package/dist/src/plugins/AutomaticPublicPathPlugin.js +26 -35
  20. package/dist/src/plugins/AutomaticPublicPathPlugin.js.map +1 -1
  21. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs +28 -0
  22. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs.map +1 -0
  23. package/dist/src/plugins/ChunkCorrelationPlugin.d.mts +5 -0
  24. package/dist/src/plugins/ChunkCorrelationPlugin.d.ts +4 -61
  25. package/dist/src/plugins/ChunkCorrelationPlugin.js +8 -440
  26. package/dist/src/plugins/ChunkCorrelationPlugin.js.map +1 -1
  27. package/dist/src/plugins/ChunkCorrelationPlugin.mjs +8 -0
  28. package/dist/src/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  29. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.mts +21 -0
  30. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.ts +16 -13
  31. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js +68 -118
  32. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -1
  33. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs +70 -0
  34. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs.map +1 -0
  35. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.mts +46 -0
  36. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +39 -34
  37. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +110 -126
  38. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -1
  39. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs +111 -0
  40. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs.map +1 -0
  41. package/dist/src/plugins/EntryChunkTrackerPlugin.d.mts +17 -0
  42. package/dist/src/plugins/EntryChunkTrackerPlugin.d.ts +14 -10
  43. package/dist/src/plugins/EntryChunkTrackerPlugin.js +30 -32
  44. package/dist/src/plugins/EntryChunkTrackerPlugin.js.map +1 -1
  45. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs +38 -0
  46. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs.map +1 -0
  47. package/dist/src/plugins/NodeFederationPlugin.d.mts +54 -0
  48. package/dist/src/plugins/NodeFederationPlugin.d.ts +33 -26
  49. package/dist/src/plugins/NodeFederationPlugin.js +69 -84
  50. package/dist/src/plugins/NodeFederationPlugin.js.map +1 -1
  51. package/dist/src/plugins/NodeFederationPlugin.mjs +70 -0
  52. package/dist/src/plugins/NodeFederationPlugin.mjs.map +1 -0
  53. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.mts +15 -0
  54. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.ts +12 -8
  55. package/dist/src/plugins/RemotePublicPathRuntimeModule.js +34 -35
  56. package/dist/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -1
  57. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs +132 -0
  58. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs.map +1 -0
  59. package/dist/src/plugins/StreamingTargetPlugin.d.mts +32 -0
  60. package/dist/src/plugins/StreamingTargetPlugin.d.ts +19 -16
  61. package/dist/src/plugins/StreamingTargetPlugin.js +43 -56
  62. package/dist/src/plugins/StreamingTargetPlugin.js.map +1 -1
  63. package/dist/src/plugins/StreamingTargetPlugin.mjs +46 -0
  64. package/dist/src/plugins/StreamingTargetPlugin.mjs.map +1 -0
  65. package/dist/src/plugins/UniversalFederationPlugin.d.mts +49 -0
  66. package/dist/src/plugins/UniversalFederationPlugin.d.ts +26 -23
  67. package/dist/src/plugins/UniversalFederationPlugin.js +58 -81
  68. package/dist/src/plugins/UniversalFederationPlugin.js.map +1 -1
  69. package/dist/src/plugins/UniversalFederationPlugin.mjs +61 -0
  70. package/dist/src/plugins/UniversalFederationPlugin.mjs.map +1 -0
  71. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.mts +9 -0
  72. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts +6 -3
  73. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js +17 -17
  74. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js.map +1 -1
  75. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs +25 -0
  76. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs.map +1 -0
  77. package/dist/src/plugins/webpackChunkUtilities.d.mts +55 -0
  78. package/dist/src/plugins/webpackChunkUtilities.d.ts +14 -9
  79. package/dist/src/plugins/webpackChunkUtilities.js +195 -257
  80. package/dist/src/plugins/webpackChunkUtilities.js.map +1 -1
  81. package/dist/src/plugins/webpackChunkUtilities.mjs +234 -0
  82. package/dist/src/plugins/webpackChunkUtilities.mjs.map +1 -0
  83. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.mts +7 -0
  84. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.ts +5 -2
  85. package/dist/src/recordDynamicRemoteEntryHashPlugin.js +24 -61
  86. package/dist/src/recordDynamicRemoteEntryHashPlugin.js.map +1 -1
  87. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs +26 -0
  88. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs.map +1 -0
  89. package/dist/src/runtimePlugin.d.mts +27 -0
  90. package/dist/src/runtimePlugin.d.ts +24 -19
  91. package/dist/src/runtimePlugin.js +157 -252
  92. package/dist/src/runtimePlugin.js.map +1 -1
  93. package/dist/src/runtimePlugin.mjs +169 -0
  94. package/dist/src/runtimePlugin.mjs.map +1 -0
  95. package/dist/src/types/index.d.mts +8 -0
  96. package/dist/src/types/index.d.ts +8 -3
  97. package/dist/src/types/index.js +1 -3
  98. package/dist/src/types/index.mjs +1 -0
  99. package/dist/src/utils/flush-chunks.d.mts +15 -0
  100. package/dist/src/utils/flush-chunks.d.ts +7 -3
  101. package/dist/src/utils/flush-chunks.js +87 -161
  102. package/dist/src/utils/flush-chunks.js.map +1 -1
  103. package/dist/src/utils/flush-chunks.mjs +99 -0
  104. package/dist/src/utils/flush-chunks.mjs.map +1 -0
  105. package/dist/src/utils/hot-reload.d.mts +16 -0
  106. package/dist/src/utils/hot-reload.d.ts +14 -10
  107. package/dist/src/utils/hot-reload.js +177 -264
  108. package/dist/src/utils/hot-reload.js.map +1 -1
  109. package/dist/src/utils/hot-reload.mjs +194 -0
  110. package/dist/src/utils/hot-reload.mjs.map +1 -0
  111. package/dist/src/utils/index.d.mts +3 -0
  112. package/dist/src/utils/index.d.ts +3 -2
  113. package/dist/src/utils/index.js +15 -19
  114. package/dist/src/utils/index.mjs +4 -0
  115. package/package.json +59 -15
  116. package/dist/jest.config.d.ts +0 -11
  117. package/dist/jest.config.js +0 -19
  118. package/dist/jest.config.js.map +0 -1
  119. package/dist/package.json +0 -82
  120. package/dist/src/index.js.map +0 -1
  121. package/dist/src/types/index.js.map +0 -1
  122. package/dist/src/utils/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"stratagies.js","sourceRoot":"","sources":["../../../src/filesystem/stratagies.ts"],"names":[],"mappings":";;AACA,wEAqCC;AAGD,4CAsCC;AAmBD,wCAkEC;AApKD,aAAa;AACN,KAAK,UAAU,8BAA8B,CAClD,OAAe,EACf,aAAqB,EACrB,OAAgB,EAChB,QAA0B;IAE1B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,SAAS,EACT,aAAa,GAAG,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAC/C,CAAC;IACF,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAU,EAAE,OAAe,EAAE,EAAE;YAC7D,IAAI,GAAG,EAAE,CAAC;gBACR,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACpB,OAAO;YACT,CAAC;YACD,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC;gBACH,EAAE,CAAC,gBAAgB,CACjB,sDAAsD;oBACpD,OAAO;oBACP,MAAM,EACR,QAAQ,CACT,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;gBACpD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,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M,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,IAAI,CAAC;gBACH,EAAE,CAAC,gBAAgB,CACjB,uDAAuD,IAAI,MAAM,EACjE,SAAS,CACV,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACtB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAChD,CAAC"}
1
+ {"version":3,"file":"stratagies.js","names":[],"sources":["../../../src/filesystem/stratagies.ts"],"sourcesContent":["//@ts-nocheck\nexport async function fileSystemRunInContextStrategy(\n chunkId: string,\n rootOutputDir: string,\n remotes: Remotes,\n callback: CallbackFunction,\n) {\n const fs = require('fs');\n const path = require('path');\n const vm = require('vm');\n const filename = path.join(\n __dirname,\n rootOutputDir + __webpack_require__.u(chunkId),\n );\n if (fs.existsSync(filename)) {\n fs.readFile(filename, 'utf-8', (err: Error, content: string) => {\n if (err) {\n callback(err, null);\n return;\n }\n const chunk = {};\n try {\n vm.runInThisContext(\n '(function(exports, require, __dirname, __filename) {' +\n content +\n '\\n})',\n filename,\n )(chunk, require, path.dirname(filename), filename);\n callback(null, chunk);\n } catch (e) {\n console.log(\"'runInThisContext threw'\", e);\n callback(e as Error, null);\n }\n });\n } else {\n const err = new Error(`File ${filename} does not exist`);\n callback(err, null);\n }\n}\n\n// HttpEvalStrategy\nexport async function httpEvalStrategy(\n chunkName: string,\n remoteName: string,\n remotes: Remotes,\n callback: CallbackFunction,\n) {\n let url;\n try {\n url = new URL(chunkName, __webpack_require__.p);\n } catch (e) {\n console.error(\n 'module-federation: failed to construct absolute chunk path of',\n remoteName,\n 'for',\n chunkName,\n // e,\n );\n url = new URL(remotes[remoteName]);\n const getBasenameFromUrl = (url) => {\n const urlParts = url.split('/');\n return urlParts[urlParts.length - 1];\n };\n const fileToReplace = getBasenameFromUrl(url.pathname);\n url.pathname = url.pathname.replace(fileToReplace, chunkName);\n }\n\n const data = await fetch(url).then((res) => res.text());\n const chunk = {};\n try {\n const urlDirname = url.pathname.split('/').slice(0, -1).join('/');\n\n eval(\n '(function(exports, require, __dirname, __filename) {' + data + '\\n})',\n )(chunk, require, urlDirname, chunkName);\n callback(null, chunk);\n } catch (e: any) {\n callback(e, null);\n }\n}\n// Define the type for the remote servers object\ninterface Remotes {\n [key: string]: {\n entry: string;\n };\n}\n\n// Define the type for the callback function\ntype CallbackFunction = (error: Error | null, chunk?: any) => void;\n\n/**\n * HttpVmStrategy\n * This function is used to execute a chunk of code in a VM using HTTP or HTTPS based on the protocol.\n * @param {string} chunkName - The name of the chunk to be executed.\n * @param {string} remoteName - The name of the remote server.\n * @param {Remotes} remotes - An object containing the remote servers.\n * @param {CallbackFunction} callback - A callback function to be executed after the chunk is executed.\n */\nexport async function httpVmStrategy(\n chunkName: string,\n remoteName: string,\n remotes: Remotes,\n callback: CallbackFunction,\n): Promise<void> {\n const http = require('http') as typeof import('http');\n const https = require('https') as typeof import('https');\n const vm = require('vm') as typeof import('vm');\n const path = require('path') as typeof import('path');\n let url: URL;\n const globalThisVal = new Function('return globalThis')();\n\n try {\n url = new URL(chunkName, __webpack_require__.p);\n } catch (e) {\n console.error(\n 'module-federation: failed to construct absolute chunk path of',\n remoteName,\n 'for',\n chunkName,\n // e,\n );\n // search all instances to see if any have the remote\n const container = globalThisVal['__FEDERATION__']['__INSTANCES__'].find(\n (instance: any) => {\n if (!instance) return;\n if (!instance.moduleCache.has(remoteName)) return;\n const container = instance.moduleCache.get(remoteName);\n if (!container.remoteInfo) return;\n return container.remoteInfo.entry;\n },\n );\n\n if (!container) {\n throw new Error('Container not found');\n }\n\n url = new URL(container.moduleCache.get(remoteName).remoteInfo.entry);\n const fileToReplace = path.basename(url.pathname);\n url.pathname = url.pathname.replace(fileToReplace, chunkName);\n }\n const protocol = url.protocol === 'https:' ? https : http;\n const req = protocol.get(url.href, (res: import('http').IncomingMessage) => {\n let data = '';\n res.on('data', (chunk: Buffer) => {\n data += chunk.toString();\n });\n res.on('end', () => {\n const chunk = {};\n const urlDirname = url.pathname.split('/').slice(0, -1).join('/');\n try {\n vm.runInThisContext(\n `(function(exports, require, __dirname, __filename) {${data}\\n})`,\n chunkName,\n )(chunk, require, urlDirname, chunkName);\n callback(null, chunk);\n } catch (err) {\n callback(err, null);\n }\n });\n res.on('error', (err) => {\n callback(err, null);\n });\n });\n req.on('error', (err) => callback(err, null));\n}\n"],"mappings":";;;AACA,eAAsB,+BACpB,SACA,eACA,SACA,UACA;CACA,MAAM,KAAK,QAAQ,KAAK;CACxB,MAAM,OAAO,QAAQ,OAAO;CAC5B,MAAM,KAAK,QAAQ,KAAK;CACxB,MAAM,WAAW,KAAK,KACpB,WACA,gBAAgB,oBAAoB,EAAE,QAAQ,CAC/C;AACD,KAAI,GAAG,WAAW,SAAS,CACzB,IAAG,SAAS,UAAU,UAAU,KAAY,YAAoB;AAC9D,MAAI,KAAK;AACP,YAAS,KAAK,KAAK;AACnB;;EAEF,MAAM,QAAQ,EAAE;AAChB,MAAI;AACF,MAAG,iBACD,yDACE,UACA,QACF,SACD,CAAC,OAAO,SAAS,KAAK,QAAQ,SAAS,EAAE,SAAS;AACnD,YAAS,MAAM,MA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aAAkB;AACjB,OAAI,CAAC,SAAU;AACf,OAAI,CAAC,SAAS,YAAY,IAAI,WAAW,CAAE;GAC3C,MAAM,YAAY,SAAS,YAAY,IAAI,WAAW;AACtD,OAAI,CAAC,UAAU,WAAY;AAC3B,UAAO,UAAU,WAAW;IAE/B;AAED,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,sBAAsB;AAGxC,QAAM,IAAI,IAAI,UAAU,YAAY,IAAI,WAAW,CAAC,WAAW,MAAM;EACrE,MAAM,gBAAgB,KAAK,SAAS,IAAI,SAAS;AACjD,MAAI,WAAW,IAAI,SAAS,QAAQ,eAAe,UAAU;;AAyB/D,EAvBiB,IAAI,aAAa,WAAW,QAAQ,MAChC,IAAI,IAAI,OAAO,QAAwC;EAC1E,IAAI,OAAO;AACX,MAAI,GAAG,SAAS,UAAkB;AAChC,WAAQ,MAAM,UAAU;IACxB;AACF,MAAI,GAAG,aAAa;GAClB,MAAM,QAAQ,EAAE;GAChB,MAAM,aAAa,IAAI,SAAS,MAAM,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI;AACjE,OAAI;AACF,OAAG,iBACD,uDAAuD,KAAK,OAC5D,UACD,CAAC,OAAO,SAAS,YAAY,UAAU;AACxC,aAAS,MAAM,MAAM;YACd,KAAK;AACZ,aAAS,KAAK,KAAK;;IAErB;AACF,MAAI,GAAG,UAAU,QAAQ;AACvB,YAAS,KAAK,KAAK;IACnB;GACF,CACE,GAAG,UAAU,QAAQ,SAAS,KAAK,KAAK,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { __require } from "../../_virtual/_rolldown/runtime.mjs";
2
+
3
+ //#region src/filesystem/stratagies.ts
4
+ async function fileSystemRunInContextStrategy(chunkId, rootOutputDir, remotes, callback) {
5
+ const fs = __require("fs");
6
+ const path = __require("path");
7
+ const vm = __require("vm");
8
+ const filename = path.join(__dirname, rootOutputDir + __webpack_require__.u(chunkId));
9
+ if (fs.existsSync(filename)) fs.readFile(filename, "utf-8", (err, content) => {
10
+ if (err) {
11
+ callback(err, null);
12
+ return;
13
+ }
14
+ const chunk = {};
15
+ try {
16
+ vm.runInThisContext("(function(exports, require, __dirname, __filename) {" + content + "\n})", filename)(chunk, __require, path.dirname(filename), filename);
17
+ callback(null, chunk);
18
+ } catch (e) {
19
+ console.log("'runInThisContext threw'", e);
20
+ callback(e, null);
21
+ }
22
+ });
23
+ else callback(/* @__PURE__ */ new Error(`File ${filename} does not exist`), null);
24
+ }
25
+ async function httpEvalStrategy(chunkName, remoteName, remotes, callback) {
26
+ let url;
27
+ try {
28
+ url = new URL(chunkName, __webpack_require__.p);
29
+ } catch (e) {
30
+ console.error("module-federation: failed to construct absolute chunk path of", remoteName, "for", chunkName);
31
+ url = new URL(remotes[remoteName]);
32
+ const getBasenameFromUrl = (url) => {
33
+ const urlParts = url.split("/");
34
+ return urlParts[urlParts.length - 1];
35
+ };
36
+ const fileToReplace = getBasenameFromUrl(url.pathname);
37
+ url.pathname = url.pathname.replace(fileToReplace, chunkName);
38
+ }
39
+ const data = await fetch(url).then((res) => res.text());
40
+ const chunk = {};
41
+ try {
42
+ const urlDirname = url.pathname.split("/").slice(0, -1).join("/");
43
+ eval("(function(exports, require, __dirname, __filename) {" + data + "\n})")(chunk, __require, urlDirname, chunkName);
44
+ callback(null, chunk);
45
+ } catch (e) {
46
+ callback(e, null);
47
+ }
48
+ }
49
+ /**
50
+ * HttpVmStrategy
51
+ * This function is used to execute a chunk of code in a VM using HTTP or HTTPS based on the protocol.
52
+ * @param {string} chunkName - The name of the chunk to be executed.
53
+ * @param {string} remoteName - The name of the remote server.
54
+ * @param {Remotes} remotes - An object containing the remote servers.
55
+ * @param {CallbackFunction} callback - A callback function to be executed after the chunk is executed.
56
+ */
57
+ async function httpVmStrategy(chunkName, remoteName, remotes, callback) {
58
+ const http = __require("http");
59
+ const https = __require("https");
60
+ const vm = __require("vm");
61
+ const path = __require("path");
62
+ let url;
63
+ const globalThisVal = new Function("return globalThis")();
64
+ try {
65
+ url = new URL(chunkName, __webpack_require__.p);
66
+ } catch (e) {
67
+ console.error("module-federation: failed to construct absolute chunk path of", remoteName, "for", chunkName);
68
+ const container = globalThisVal["__FEDERATION__"]["__INSTANCES__"].find((instance) => {
69
+ if (!instance) return;
70
+ if (!instance.moduleCache.has(remoteName)) return;
71
+ const container = instance.moduleCache.get(remoteName);
72
+ if (!container.remoteInfo) return;
73
+ return container.remoteInfo.entry;
74
+ });
75
+ if (!container) throw new Error("Container not found");
76
+ url = new URL(container.moduleCache.get(remoteName).remoteInfo.entry);
77
+ const fileToReplace = path.basename(url.pathname);
78
+ url.pathname = url.pathname.replace(fileToReplace, chunkName);
79
+ }
80
+ (url.protocol === "https:" ? https : http).get(url.href, (res) => {
81
+ let data = "";
82
+ res.on("data", (chunk) => {
83
+ data += chunk.toString();
84
+ });
85
+ res.on("end", () => {
86
+ const chunk = {};
87
+ const urlDirname = url.pathname.split("/").slice(0, -1).join("/");
88
+ try {
89
+ vm.runInThisContext(`(function(exports, require, __dirname, __filename) {${data}\n})`, chunkName)(chunk, __require, urlDirname, chunkName);
90
+ callback(null, chunk);
91
+ } catch (err) {
92
+ callback(err, null);
93
+ }
94
+ });
95
+ res.on("error", (err) => {
96
+ callback(err, null);
97
+ });
98
+ }).on("error", (err) => callback(err, null));
99
+ }
100
+
101
+ //#endregion
102
+ export { fileSystemRunInContextStrategy, httpEvalStrategy, httpVmStrategy };
103
+ //# sourceMappingURL=stratagies.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stratagies.mjs","names":[],"sources":["../../../src/filesystem/stratagies.ts"],"sourcesContent":["//@ts-nocheck\nexport async function fileSystemRunInContextStrategy(\n chunkId: string,\n rootOutputDir: string,\n remotes: Remotes,\n callback: CallbackFunction,\n) {\n const fs = require('fs');\n const path = require('path');\n const vm = require('vm');\n const filename = path.join(\n __dirname,\n rootOutputDir + __webpack_require__.u(chunkId),\n );\n if (fs.existsSync(filename)) {\n fs.readFile(filename, 'utf-8', (err: Error, content: string) => {\n if (err) {\n callback(err, null);\n return;\n }\n const chunk = {};\n try {\n vm.runInThisContext(\n '(function(exports, require, __dirname, __filename) {' +\n content +\n '\\n})',\n filename,\n )(chunk, require, path.dirname(filename), filename);\n callback(null, chunk);\n } catch (e) {\n console.log(\"'runInThisContext threw'\", e);\n callback(e as Error, null);\n }\n });\n } else {\n const err = new Error(`File ${filename} does not exist`);\n callback(err, null);\n }\n}\n\n// HttpEvalStrategy\nexport async function httpEvalStrategy(\n chunkName: string,\n remoteName: string,\n remotes: Remotes,\n callback: CallbackFunction,\n) {\n let url;\n try {\n url = new URL(chunkName, __webpack_require__.p);\n } catch (e) {\n console.error(\n 'module-federation: failed to construct absolute chunk path of',\n remoteName,\n 'for',\n chunkName,\n // e,\n );\n url = new URL(remotes[remoteName]);\n const getBasenameFromUrl = (url) => {\n const urlParts = url.split('/');\n return urlParts[urlParts.length - 1];\n };\n const fileToReplace = getBasenameFromUrl(url.pathname);\n url.pathname = url.pathname.replace(fileToReplace, chunkName);\n }\n\n const data = await fetch(url).then((res) => res.text());\n const chunk = {};\n try {\n const urlDirname = url.pathname.split('/').slice(0, -1).join('/');\n\n eval(\n '(function(exports, require, __dirname, __filename) {' + data + '\\n})',\n )(chunk, require, urlDirname, chunkName);\n callback(null, chunk);\n } catch (e: any) {\n callback(e, null);\n }\n}\n// Define the type for the remote servers object\ninterface Remotes {\n [key: string]: {\n entry: string;\n };\n}\n\n// Define the type for the callback function\ntype CallbackFunction = (error: Error | null, chunk?: any) => void;\n\n/**\n * HttpVmStrategy\n * This function is used to execute a chunk of code in a VM using HTTP or HTTPS based on the protocol.\n * @param {string} chunkName - The name of the chunk to be executed.\n * @param {string} remoteName - The name of the remote server.\n * @param {Remotes} remotes - An object containing the remote servers.\n * @param {CallbackFunction} callback - A callback function to be executed after the chunk is executed.\n */\nexport async function httpVmStrategy(\n chunkName: string,\n remoteName: string,\n remotes: Remotes,\n callback: CallbackFunction,\n): Promise<void> {\n const http = require('http') as typeof import('http');\n const https = require('https') as typeof import('https');\n const vm = require('vm') as typeof import('vm');\n const path = require('path') as typeof import('path');\n let url: URL;\n const globalThisVal = new Function('return globalThis')();\n\n try {\n url = new URL(chunkName, __webpack_require__.p);\n } catch (e) {\n console.error(\n 'module-federation: failed to construct absolute chunk path of',\n remoteName,\n 'for',\n chunkName,\n // e,\n );\n // search all instances to see if any have the remote\n const container = globalThisVal['__FEDERATION__']['__INSTANCES__'].find(\n (instance: any) => {\n if (!instance) return;\n if (!instance.moduleCache.has(remoteName)) return;\n const container = instance.moduleCache.get(remoteName);\n if (!container.remoteInfo) return;\n return container.remoteInfo.entry;\n },\n );\n\n if (!container) {\n throw new Error('Container not found');\n }\n\n url = new URL(container.moduleCache.get(remoteName).remoteInfo.entry);\n const fileToReplace = path.basename(url.pathname);\n url.pathname = url.pathname.replace(fileToReplace, chunkName);\n }\n const protocol = url.protocol === 'https:' ? https : http;\n const req = protocol.get(url.href, (res: import('http').IncomingMessage) => {\n let data = '';\n res.on('data', (chunk: Buffer) => {\n data += chunk.toString();\n });\n res.on('end', () => {\n const chunk = {};\n const urlDirname = url.pathname.split('/').slice(0, -1).join('/');\n try {\n vm.runInThisContext(\n `(function(exports, require, __dirname, __filename) {${data}\\n})`,\n chunkName,\n )(chunk, require, urlDirname, chunkName);\n callback(null, chunk);\n } catch (err) {\n callback(err, null);\n }\n });\n res.on('error', (err) => {\n callback(err, null);\n });\n });\n req.on('error', (err) => callback(err, null));\n}\n"],"mappings":";;;AACA,eAAsB,+BACpB,SACA,eACA,SACA,UACA;CACA,MAAM,eAAa,KAAK;CACxB,MAAM,iBAAe,OAAO;CAC5B,MAAM,eAAa,KAAK;CACxB,MAAM,WAAW,KAAK,KACpB,WACA,gBAAgB,oBAAoB,EAAE,QAAQ,CAC/C;AACD,KAAI,GAAG,WAAW,SAAS,CACzB,IAAG,SAAS,UAAU,UAAU,KAAY,YAAoB;AAC9D,MAAI,KAAK;AACP,YAAS,KAAK,KAAK;AACnB;;EAEF,MA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B,EAAE;UACxC,GAAG;AACV,UAAQ,MACN,iEACA,YACA,OACA,UAED;EAED,MAAM,YAAY,cAAc,kBAAkB,iBAAiB,MAChE,aAAkB;AACjB,OAAI,CAAC,SAAU;AACf,OAAI,CAAC,SAAS,YAAY,IAAI,WAAW,CAAE;GAC3C,MAAM,YAAY,SAAS,YAAY,IAAI,WAAW;AACtD,OAAI,CAAC,UAAU,WAAY;AAC3B,UAAO,UAAU,WAAW;IAE/B;AAED,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,sBAAsB;AAGxC,QAAM,IAAI,IAAI,UAAU,YAAY,IAAI,WAAW,CAAC,WAAW,MAAM;EACrE,MAAM,gBAAgB,KAAK,SAAS,IAAI,SAAS;AACjD,MAAI,WAAW,IAAI,SAAS,QAAQ,eAAe,UAAU;;AAyB/D,EAvBiB,IAAI,aAAa,WAAW,QAAQ,MAChC,IAAI,IAAI,OAAO,QAAwC;EAC1E,IAAI,OAAO;AACX,MAAI,GAAG,SAAS,UAAkB;AAChC,WAAQ,MAAM,UAAU;IACxB;AACF,MAAI,GAAG,aAAa;GAClB,MAAM,QAAQ,EAAE;GAChB,MAAM,aAAa,IAAI,SAAS,MAAM,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI;AACjE,OAAI;AACF,OAAG,iBACD,uDAAuD,KAAK,OAC5D,UACD,CAAC,kBAAgB,YAAY,UAAU;AACxC,aAAS,MAAM,MAAM;YACd,KAAK;AACZ,aAAS,KAAK,KAAK;;IAErB;AACF,MAAI,GAAG,UAAU,QAAQ;AACvB,YAAS,KAAK,KAAK;IACnB;GACF,CACE,GAAG,UAAU,QAAQ,SAAS,KAAK,KAAK,CAAC"}
@@ -0,0 +1,8 @@
1
+ import StreamingTargetPlugin from "./plugins/StreamingTargetPlugin.mjs";
2
+ import NodeFederationPlugin from "./plugins/NodeFederationPlugin.mjs";
3
+ import UniversalFederationPlugin from "./plugins/UniversalFederationPlugin.mjs";
4
+ import ChunkCorrelationPlugin from "./plugins/ChunkCorrelationPlugin.mjs";
5
+ import AutoPublicPathRuntimeModule from "./plugins/RemotePublicPathRuntimeModule.mjs";
6
+ import EntryChunkTrackerPlugin from "./plugins/EntryChunkTrackerPlugin.mjs";
7
+ import UniverseEntryChunkTrackerPlugin from "./plugins/UniverseEntryChunkTrackerPlugin.mjs";
8
+ export { ChunkCorrelationPlugin, EntryChunkTrackerPlugin, NodeFederationPlugin, AutoPublicPathRuntimeModule as RemotePublicPathPlugin, StreamingTargetPlugin, UniversalFederationPlugin, UniverseEntryChunkTrackerPlugin };
@@ -1,7 +1,8 @@
1
- export { default as StreamingTargetPlugin } from './plugins/StreamingTargetPlugin';
2
- export { default as NodeFederationPlugin } from './plugins/NodeFederationPlugin';
3
- export { default as UniversalFederationPlugin } from './plugins/UniversalFederationPlugin';
4
- export { default as ChunkCorrelationPlugin } from './plugins/ChunkCorrelationPlugin';
5
- export { default as RemotePublicPathPlugin } from './plugins/RemotePublicPathRuntimeModule';
6
- export { default as EntryChunkTrackerPlugin } from './plugins/EntryChunkTrackerPlugin';
7
- export { default as UniverseEntryChunkTrackerPlugin } from './plugins/UniverseEntryChunkTrackerPlugin';
1
+ import StreamingTargetPlugin from "./plugins/StreamingTargetPlugin.js";
2
+ import NodeFederationPlugin from "./plugins/NodeFederationPlugin.js";
3
+ import UniversalFederationPlugin from "./plugins/UniversalFederationPlugin.js";
4
+ import ChunkCorrelationPlugin from "./plugins/ChunkCorrelationPlugin.js";
5
+ import AutoPublicPathRuntimeModule from "./plugins/RemotePublicPathRuntimeModule.js";
6
+ import EntryChunkTrackerPlugin from "./plugins/EntryChunkTrackerPlugin.js";
7
+ import UniverseEntryChunkTrackerPlugin from "./plugins/UniverseEntryChunkTrackerPlugin.js";
8
+ export { ChunkCorrelationPlugin, EntryChunkTrackerPlugin, NodeFederationPlugin, AutoPublicPathRuntimeModule as RemotePublicPathPlugin, StreamingTargetPlugin, UniversalFederationPlugin, UniverseEntryChunkTrackerPlugin };
package/dist/src/index.js CHANGED
@@ -1,22 +1,16 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UniverseEntryChunkTrackerPlugin = exports.EntryChunkTrackerPlugin = exports.RemotePublicPathPlugin = exports.ChunkCorrelationPlugin = exports.UniversalFederationPlugin = exports.NodeFederationPlugin = exports.StreamingTargetPlugin = void 0;
7
- var StreamingTargetPlugin_1 = require("./plugins/StreamingTargetPlugin");
8
- Object.defineProperty(exports, "StreamingTargetPlugin", { enumerable: true, get: function () { return __importDefault(StreamingTargetPlugin_1).default; } });
9
- var NodeFederationPlugin_1 = require("./plugins/NodeFederationPlugin");
10
- Object.defineProperty(exports, "NodeFederationPlugin", { enumerable: true, get: function () { return __importDefault(NodeFederationPlugin_1).default; } });
11
- var UniversalFederationPlugin_1 = require("./plugins/UniversalFederationPlugin");
12
- Object.defineProperty(exports, "UniversalFederationPlugin", { enumerable: true, get: function () { return __importDefault(UniversalFederationPlugin_1).default; } });
13
- //@ts-ignore
14
- var ChunkCorrelationPlugin_1 = require("./plugins/ChunkCorrelationPlugin");
15
- Object.defineProperty(exports, "ChunkCorrelationPlugin", { enumerable: true, get: function () { return __importDefault(ChunkCorrelationPlugin_1).default; } });
16
- var RemotePublicPathRuntimeModule_1 = require("./plugins/RemotePublicPathRuntimeModule");
17
- Object.defineProperty(exports, "RemotePublicPathPlugin", { enumerable: true, get: function () { return __importDefault(RemotePublicPathRuntimeModule_1).default; } });
18
- var EntryChunkTrackerPlugin_1 = require("./plugins/EntryChunkTrackerPlugin");
19
- Object.defineProperty(exports, "EntryChunkTrackerPlugin", { enumerable: true, get: function () { return __importDefault(EntryChunkTrackerPlugin_1).default; } });
20
- var UniverseEntryChunkTrackerPlugin_1 = require("./plugins/UniverseEntryChunkTrackerPlugin");
21
- Object.defineProperty(exports, "UniverseEntryChunkTrackerPlugin", { enumerable: true, get: function () { return __importDefault(UniverseEntryChunkTrackerPlugin_1).default; } });
22
- //# sourceMappingURL=index.js.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_src_plugins_RemotePublicPathRuntimeModule = require('./plugins/RemotePublicPathRuntimeModule.js');
3
+ const require_src_plugins_StreamingTargetPlugin = require('./plugins/StreamingTargetPlugin.js');
4
+ const require_src_plugins_EntryChunkTrackerPlugin = require('./plugins/EntryChunkTrackerPlugin.js');
5
+ const require_src_plugins_NodeFederationPlugin = require('./plugins/NodeFederationPlugin.js');
6
+ const require_src_plugins_UniversalFederationPlugin = require('./plugins/UniversalFederationPlugin.js');
7
+ const require_src_plugins_ChunkCorrelationPlugin = require('./plugins/ChunkCorrelationPlugin.js');
8
+ const require_src_plugins_UniverseEntryChunkTrackerPlugin = require('./plugins/UniverseEntryChunkTrackerPlugin.js');
9
+
10
+ exports.ChunkCorrelationPlugin = require_src_plugins_ChunkCorrelationPlugin.default;
11
+ exports.EntryChunkTrackerPlugin = require_src_plugins_EntryChunkTrackerPlugin.default;
12
+ exports.NodeFederationPlugin = require_src_plugins_NodeFederationPlugin.default;
13
+ exports.RemotePublicPathPlugin = require_src_plugins_RemotePublicPathRuntimeModule.default;
14
+ exports.StreamingTargetPlugin = require_src_plugins_StreamingTargetPlugin.default;
15
+ exports.UniversalFederationPlugin = require_src_plugins_UniversalFederationPlugin.default;
16
+ exports.UniverseEntryChunkTrackerPlugin = require_src_plugins_UniverseEntryChunkTrackerPlugin.default;
@@ -0,0 +1,9 @@
1
+ import AutoPublicPathRuntimeModule from "./plugins/RemotePublicPathRuntimeModule.mjs";
2
+ import StreamingTargetPlugin from "./plugins/StreamingTargetPlugin.mjs";
3
+ import EntryChunkTrackerPlugin from "./plugins/EntryChunkTrackerPlugin.mjs";
4
+ import NodeFederationPlugin from "./plugins/NodeFederationPlugin.mjs";
5
+ import UniversalFederationPlugin from "./plugins/UniversalFederationPlugin.mjs";
6
+ import ChunkCorrelationPlugin from "./plugins/ChunkCorrelationPlugin.mjs";
7
+ import UniverseEntryChunkTrackerPlugin from "./plugins/UniverseEntryChunkTrackerPlugin.mjs";
8
+
9
+ export { ChunkCorrelationPlugin, EntryChunkTrackerPlugin, NodeFederationPlugin, AutoPublicPathRuntimeModule as RemotePublicPathPlugin, StreamingTargetPlugin, UniversalFederationPlugin, UniverseEntryChunkTrackerPlugin };
@@ -0,0 +1,12 @@
1
+ import { Compiler } from "webpack";
2
+
3
+ //#region src/plugins/AutomaticPublicPathPlugin.d.ts
4
+ interface PluginOptions {}
5
+ declare class RemotePublicPathPlugin {
6
+ private options?;
7
+ constructor(options?: PluginOptions);
8
+ apply(compiler: Compiler): void;
9
+ }
10
+ //#endregion
11
+ export { RemotePublicPathPlugin as default };
12
+ //# sourceMappingURL=AutomaticPublicPathPlugin.d.mts.map
@@ -1,9 +1,11 @@
1
- import type { Compiler } from 'webpack';
2
- interface PluginOptions {
3
- }
1
+ import { Compiler } from "webpack";
2
+
3
+ //#region src/plugins/AutomaticPublicPathPlugin.d.ts
4
+ interface PluginOptions {}
4
5
  declare class RemotePublicPathPlugin {
5
- private options?;
6
- constructor(options?: PluginOptions);
7
- apply(compiler: Compiler): void;
6
+ private options?;
7
+ constructor(options?: PluginOptions);
8
+ apply(compiler: Compiler): void;
8
9
  }
9
- export default RemotePublicPathPlugin;
10
+ export = RemotePublicPathPlugin;
11
+ //# sourceMappingURL=AutomaticPublicPathPlugin.d.ts.map
@@ -1,38 +1,29 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_src_plugins_RemotePublicPathRuntimeModule = require('./RemotePublicPathRuntimeModule.js');
3
+
4
+ //#region src/plugins/AutomaticPublicPathPlugin.ts
5
+ var RemotePublicPathPlugin = class {
6
+ constructor(options) {
7
+ this.options = options;
8
+ }
9
+ apply(compiler) {
10
+ const { RuntimeGlobals } = compiler.webpack;
11
+ compiler.hooks.thisCompilation.tap("RemotePublicPathPlugin", (compilation) => {
12
+ compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.publicPath).tap("RuntimePlugin", (chunk, set) => {
13
+ const { outputOptions } = compilation;
14
+ const { publicPath: globalPublicPath, scriptType } = outputOptions;
15
+ const entryOptions = chunk.getEntryOptions();
16
+ const publicPath = entryOptions && entryOptions.publicPath !== void 0 ? entryOptions.publicPath : globalPublicPath;
17
+ const module = new require_src_plugins_RemotePublicPathRuntimeModule.default(this.options);
18
+ if (publicPath === "auto" && scriptType !== "module") set.add(RuntimeGlobals.global);
19
+ else if (typeof publicPath !== "string" || /\[(full)?hash\]/.test(publicPath)) module.fullHash = true;
20
+ compilation.addRuntimeModule(chunk, module);
21
+ return true;
22
+ });
23
+ });
24
+ }
4
25
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const RemotePublicPathRuntimeModule_1 = __importDefault(require("./RemotePublicPathRuntimeModule"));
7
- class RemotePublicPathPlugin {
8
- constructor(options) {
9
- this.options = options;
10
- }
11
- apply(compiler) {
12
- const { RuntimeGlobals } = compiler.webpack;
13
- compiler.hooks.thisCompilation.tap('RemotePublicPathPlugin', (compilation) => {
14
- compilation.hooks.runtimeRequirementInTree
15
- .for(RuntimeGlobals.publicPath)
16
- .tap('RuntimePlugin', (chunk, set) => {
17
- const { outputOptions } = compilation;
18
- const { publicPath: globalPublicPath, scriptType } = outputOptions;
19
- const entryOptions = chunk.getEntryOptions();
20
- const publicPath = entryOptions && entryOptions.publicPath !== undefined
21
- ? entryOptions.publicPath
22
- : globalPublicPath;
23
- const module = new RemotePublicPathRuntimeModule_1.default(this.options);
24
- if (publicPath === 'auto' && scriptType !== 'module') {
25
- set.add(RuntimeGlobals.global);
26
- }
27
- else if (typeof publicPath !== 'string' ||
28
- /\[(full)?hash\]/.test(publicPath)) {
29
- module.fullHash = true;
30
- }
31
- compilation.addRuntimeModule(chunk, module);
32
- return true;
33
- });
34
- });
35
- }
36
- }
26
+
27
+ //#endregion
37
28
  exports.default = RemotePublicPathPlugin;
38
29
  //# sourceMappingURL=AutomaticPublicPathPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutomaticPublicPathPlugin.js","sourceRoot":"","sources":["../../../src/plugins/AutomaticPublicPathPlugin.ts"],"names":[],"mappings":";;;;;AAEA,oGAA4E;AAI5E,MAAM,sBAAsB;IAG1B,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC5C,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,wBAAwB,EACxB,CAAC,WAAW,EAAE,EAAE;YACd,WAAW,CAAC,KAAK,CAAC,wBAAwB;iBACvC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC;iBAC9B,GAAG,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACnC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC;gBACtC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;gBACnE,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC;gBAC7C,MAAM,UAAU,GACd,YAAY,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS;oBACnD,CAAC,CAAC,YAAY,CAAC,UAAU;oBACzB,CAAC,CAAC,gBAAgB,CAAC;gBAEvB,MAAM,MAAM,GAAG,IAAI,uCAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC/D,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;oBACrD,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBACjC,CAAC;qBAAM,IACL,OAAO,UAAU,KAAK,QAAQ;oBAC9B,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAClC,CAAC;oBACD,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACzB,CAAC;gBAED,WAAW,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"AutomaticPublicPathPlugin.js","names":["RemotePublicPathRuntimeModule"],"sources":["../../../src/plugins/AutomaticPublicPathPlugin.ts"],"sourcesContent":["import type { Compiler } from 'webpack';\n\nimport RemotePublicPathRuntimeModule from './RemotePublicPathRuntimeModule';\n\ninterface PluginOptions {}\n\nclass RemotePublicPathPlugin {\n private options?: PluginOptions;\n\n constructor(options?: PluginOptions) {\n this.options = options;\n }\n\n apply(compiler: Compiler) {\n const { RuntimeGlobals } = compiler.webpack;\n compiler.hooks.thisCompilation.tap(\n 'RemotePublicPathPlugin',\n (compilation) => {\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.publicPath)\n .tap('RuntimePlugin', (chunk, set) => {\n const { outputOptions } = compilation;\n const { publicPath: globalPublicPath, scriptType } = outputOptions;\n const entryOptions = chunk.getEntryOptions();\n const publicPath =\n entryOptions && entryOptions.publicPath !== undefined\n ? entryOptions.publicPath\n : globalPublicPath;\n\n const module = new RemotePublicPathRuntimeModule(this.options);\n if (publicPath === 'auto' && scriptType !== 'module') {\n set.add(RuntimeGlobals.global);\n } else if (\n typeof publicPath !== 'string' ||\n /\\[(full)?hash\\]/.test(publicPath)\n ) {\n module.fullHash = true;\n }\n\n compilation.addRuntimeModule(chunk, module);\n return true;\n });\n },\n );\n }\n}\n\nexport default RemotePublicPathPlugin;\n"],"mappings":";;;;AAMA,IAAM,yBAAN,MAA6B;CAG3B,YAAY,SAAyB;AACnC,OAAK,UAAU;;CAGjB,MAAM,UAAoB;EACxB,MAAM,EAAE,mBAAmB,SAAS;AACpC,WAAS,MAAM,gBAAgB,IAC7B,2BACC,gBAAgB;AACf,eAAY,MAAM,yBACf,IAAI,eAAe,WAAW,CAC9B,IAAI,kBAAkB,OAAO,QAAQ;IACpC,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,YAAY,kBAAkB,eAAe;IACrD,MAAM,eAAe,MAAM,iBAAiB;IAC5C,MAAM,aACJ,gBAAgB,aAAa,eAAe,SACxC,aAAa,aACb;IAEN,MAAM,SAAS,IAAIA,0DAA8B,KAAK,QAAQ;AAC9D,QAAI,eAAe,UAAU,eAAe,SAC1C,KAAI,IAAI,eAAe,OAAO;aAE9B,OAAO,eAAe,YACtB,kBAAkB,KAAK,WAAW,CAElC,QAAO,WAAW;AAGpB,gBAAY,iBAAiB,OAAO,OAAO;AAC3C,WAAO;KACP;IAEP"}
@@ -0,0 +1,28 @@
1
+ import AutoPublicPathRuntimeModule from "./RemotePublicPathRuntimeModule.mjs";
2
+
3
+ //#region src/plugins/AutomaticPublicPathPlugin.ts
4
+ var RemotePublicPathPlugin = class {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ apply(compiler) {
9
+ const { RuntimeGlobals } = compiler.webpack;
10
+ compiler.hooks.thisCompilation.tap("RemotePublicPathPlugin", (compilation) => {
11
+ compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.publicPath).tap("RuntimePlugin", (chunk, set) => {
12
+ const { outputOptions } = compilation;
13
+ const { publicPath: globalPublicPath, scriptType } = outputOptions;
14
+ const entryOptions = chunk.getEntryOptions();
15
+ const publicPath = entryOptions && entryOptions.publicPath !== void 0 ? entryOptions.publicPath : globalPublicPath;
16
+ const module = new AutoPublicPathRuntimeModule(this.options);
17
+ if (publicPath === "auto" && scriptType !== "module") set.add(RuntimeGlobals.global);
18
+ else if (typeof publicPath !== "string" || /\[(full)?hash\]/.test(publicPath)) module.fullHash = true;
19
+ compilation.addRuntimeModule(chunk, module);
20
+ return true;
21
+ });
22
+ });
23
+ }
24
+ };
25
+
26
+ //#endregion
27
+ export { RemotePublicPathPlugin as default };
28
+ //# sourceMappingURL=AutomaticPublicPathPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutomaticPublicPathPlugin.mjs","names":["RemotePublicPathRuntimeModule"],"sources":["../../../src/plugins/AutomaticPublicPathPlugin.ts"],"sourcesContent":["import type { Compiler } from 'webpack';\n\nimport RemotePublicPathRuntimeModule from './RemotePublicPathRuntimeModule';\n\ninterface PluginOptions {}\n\nclass RemotePublicPathPlugin {\n private options?: PluginOptions;\n\n constructor(options?: PluginOptions) {\n this.options = options;\n }\n\n apply(compiler: Compiler) {\n const { RuntimeGlobals } = compiler.webpack;\n compiler.hooks.thisCompilation.tap(\n 'RemotePublicPathPlugin',\n (compilation) => {\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.publicPath)\n .tap('RuntimePlugin', (chunk, set) => {\n const { outputOptions } = compilation;\n const { publicPath: globalPublicPath, scriptType } = outputOptions;\n const entryOptions = chunk.getEntryOptions();\n const publicPath =\n entryOptions && entryOptions.publicPath !== undefined\n ? entryOptions.publicPath\n : globalPublicPath;\n\n const module = new RemotePublicPathRuntimeModule(this.options);\n if (publicPath === 'auto' && scriptType !== 'module') {\n set.add(RuntimeGlobals.global);\n } else if (\n typeof publicPath !== 'string' ||\n /\\[(full)?hash\\]/.test(publicPath)\n ) {\n module.fullHash = true;\n }\n\n compilation.addRuntimeModule(chunk, module);\n return true;\n });\n },\n );\n }\n}\n\nexport default RemotePublicPathPlugin;\n"],"mappings":";;;AAMA,IAAM,yBAAN,MAA6B;CAG3B,YAAY,SAAyB;AACnC,OAAK,UAAU;;CAGjB,MAAM,UAAoB;EACxB,MAAM,EAAE,mBAAmB,SAAS;AACpC,WAAS,MAAM,gBAAgB,IAC7B,2BACC,gBAAgB;AACf,eAAY,MAAM,yBACf,IAAI,eAAe,WAAW,CAC9B,IAAI,kBAAkB,OAAO,QAAQ;IACpC,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,YAAY,kBAAkB,eAAe;IACrD,MAAM,eAAe,MAAM,iBAAiB;IAC5C,MAAM,aACJ,gBAAgB,aAAa,eAAe,SACxC,aAAa,aACb;IAEN,MAAM,SAAS,IAAIA,4BAA8B,KAAK,QAAQ;AAC9D,QAAI,eAAe,UAAU,eAAe,SAC1C,KAAI,IAAI,eAAe,OAAO;aAE9B,OAAO,eAAe,YACtB,kBAAkB,KAAK,WAAW,CAElC,QAAO,WAAW;AAGpB,gBAAY,iBAAiB,OAAO,OAAO;AAC3C,WAAO;KACP;IAEP"}
@@ -0,0 +1,5 @@
1
+ //#region src/plugins/ChunkCorrelationPlugin.d.ts
2
+ declare const ChunkCorrelationPlugin: any;
3
+ //#endregion
4
+ export { ChunkCorrelationPlugin as default };
5
+ //# sourceMappingURL=ChunkCorrelationPlugin.d.mts.map
@@ -1,61 +1,4 @@
1
- export = FederationStatsPlugin;
2
- /**
3
- * @typedef {object} FederationStatsPluginOptions
4
- * @property {string | string[]} filename The filename or an array of filenames in the `output.path` directory to write stats to.
5
- */
6
- /**
7
- * Writes relevant federation stats to a file for further consumption.
8
- */
9
- declare class FederationStatsPlugin {
10
- /**
11
- *
12
- * @param {FederationStatsPluginOptions} options
13
- */
14
- constructor(options: FederationStatsPluginOptions);
15
- _options: FederationStatsPluginOptions;
16
- /**
17
- *
18
- * @param {import("webpack").Compiler} compiler
19
- */
20
- apply(compiler: import("webpack").Compiler): void;
21
- }
22
- declare namespace FederationStatsPlugin {
23
- export { WebpackStats, WebpackStatsChunk, WebpackStatsModule, SharedDependency, SharedModule, Exposed, FederatedContainer, FederatedStats, FederationStatsPluginOptions };
24
- }
25
- type WebpackStats = any;
26
- type WebpackStatsChunk = any;
27
- type WebpackStatsModule = any;
28
- type SharedDependency = {
29
- shareScope: string;
30
- shareKey: string;
31
- requiredVersion: string;
32
- strictVersion: boolean;
33
- singleton: boolean;
34
- eager: boolean;
35
- };
36
- type SharedModule = {
37
- chunks: string[];
38
- provides: SharedDependency[];
39
- };
40
- type Exposed = {
41
- chunks: string[];
42
- sharedModules: SharedModule[];
43
- };
44
- type FederatedContainer = {
45
- remote: string;
46
- entry: string;
47
- sharedModules: SharedModule[];
48
- exposes: {
49
- [key: string]: Exposed;
50
- };
51
- };
52
- type FederatedStats = {
53
- sharedModules: SharedModule[];
54
- federatedModules: FederatedContainer[];
55
- };
56
- type FederationStatsPluginOptions = {
57
- /**
58
- * The filename or an array of filenames in the `output.path` directory to write stats to.
59
- */
60
- filename: string | string[];
61
- };
1
+ //#region src/plugins/ChunkCorrelationPlugin.d.ts
2
+ declare const ChunkCorrelationPlugin: any;
3
+ export = ChunkCorrelationPlugin;
4
+ //# sourceMappingURL=ChunkCorrelationPlugin.d.ts.map