@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":"hot-reload.js","sourceRoot":"","sources":["../../../src/utils/hot-reload.ts"],"names":[],"mappings":";;;;;;AA4UA,wCAWC;AAvVD,iDAAoD;AACpD,oDAA4B;AAC5B,iFAAyD;AACzD,gDAAwB;AAOxB,MAAM,UAAU,GAAG,GAAgB,EAAE;IACnC,YAAY;IACZ,OAAO,OAAO,uBAAuB,KAAK,WAAW;QACnD,CAAC,CAAE,uBAAuC;QAC1C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,SAAS,SAAS;IAChB,MAAM,kBAAkB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACnD,IAAI,CAAC;QACH,IAAI,MAAM,GAAU,EAAE,CAAC;QACvB,KAAK,CAAC,iBAAiB,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;YACzC,MAAM,uBAAuB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,GAAG,uBAAuB,CAAC;YACjC,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAC;QAEF,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,iBAAiB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,MAAM,IAAI,GAAG,UAAU,UAAkB;IACvC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QAC1B,gCAAgC;QAChC,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAA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,cAAc;IAC5B,YAAY;IACZ,MAAM,YAAY;IAChB,YAAY;IACZ,UAAU,CAAC,gBAAgB,IAAI,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,KAAK,CAAC;IACzE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,8DAA8D;IAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"hot-reload.js","names":["getAllKnownRemotes"],"sources":["../../../src/utils/hot-reload.ts"],"sourcesContent":["import { getAllKnownRemotes } from './flush-chunks';\nimport crypto from 'crypto';\nimport helpers from '@module-federation/runtime/helpers';\nimport path from 'path';\n\ndeclare global {\n var mfHashMap: Record<string, string> | undefined;\n var moduleGraphDirty: boolean;\n}\n\nconst getRequire = (): NodeRequire => {\n //@ts-ignore\n return typeof __non_webpack_require__ !== 'undefined'\n ? (__non_webpack_require__ as NodeRequire)\n : eval('require');\n};\n\nfunction callsites(): any[] {\n const _prepareStackTrace = Error.prepareStackTrace;\n try {\n let result: any[] = [];\n Error.prepareStackTrace = (_, callSites) => {\n const callSitesWithoutCurrent = callSites.slice(1);\n result = callSitesWithoutCurrent;\n return callSitesWithoutCurrent;\n };\n\n new Error().stack;\n return result;\n } finally {\n Error.prepareStackTrace = _prepareStackTrace;\n }\n}\n\nconst find = function (moduleName: string): string | undefined {\n if (moduleName[0] === '.') {\n // Use custom callsites function\n const stack = callsites();\n for (const frame of stack) {\n const filename = frame.getFileName();\n if (filename && filename !== module.filename) {\n moduleName = path.resolve(path.dirname(filename), moduleName);\n break;\n }\n }\n }\n try {\n return getRequire().resolve(moduleName);\n } catch (e) {\n return;\n }\n};\n\n/**\n * Removes a module from the cache. We need this to re-load our http_request !\n * see: https://stackoverflow.com/a/14801711/1148249\n */\nconst decache = async function (moduleName: string) {\n //@ts-ignore\n moduleName = find(moduleName);\n\n if (!moduleName) {\n return;\n }\n\n const currentChunk = getRequire().cache[__filename];\n\n // Run over the cache looking for the files\n // loaded by the specified module name\n searchCache(moduleName, function (mod: NodeModule) {\n delete getRequire().cache[mod.id];\n });\n try {\n // Remove cached paths to the module.\n // Thanks to @bentael for pointing this out.\n //@ts-ignore\n Object.keys((currentChunk.constructor as any)._pathCache).forEach(\n function (cacheKey) {\n if (cacheKey.indexOf(moduleName) > -1) {\n //@ts-ignore\n delete (currentChunk.constructor as any)._pathCache[cacheKey];\n }\n },\n );\n } catch (error) {\n //null\n }\n};\n\n/**\n * Runs over the cache to search for all the cached\n * files\n */\nconst searchCache = function (\n moduleName: string,\n callback: (mod: NodeModule) => void,\n) {\n // Resolve the module identified by the specified name\n let mod = getRequire().resolve(moduleName);\n const visited: Record<string, boolean> = {};\n\n // Check if the module has been resolved and found within\n // the cache no else so #ignore else https://git.io/vtgMI\n /* istanbul ignore else */\n //@ts-ignore\n if (mod && (mod = getRequire().cache[mod]) !== undefined) {\n // Recursively go over the results\n (function run(current: NodeModule) {\n visited[current.id] = true;\n // Go over each of the module's children and\n // run over it\n current.children.forEach(function (child: NodeModule) {\n // ignore .node files, decaching native modules throws a\n // \"module did not self-register\" error on second require\n if (path.extname(child.filename) !== '.node' && !visited[child.id]) {\n run(child);\n }\n });\n\n // Call the specified callback providing the\n // found module\n callback(current);\n //@ts-ignore\n })(mod);\n }\n};\n\nconst hashmap = globalThis.mfHashMap || ({} as Record<string, string>);\nglobalThis.moduleGraphDirty = false;\n\nconst requireCacheRegex =\n /(remote|server|hot-reload|react-loadable-manifest|runtime|styled-jsx)/;\n\nexport const performReload = async (\n shouldReload: boolean,\n): Promise<boolean> => {\n if (!shouldReload) {\n return false;\n }\n\n const req = getRequire();\n\n const gs = new Function('return globalThis')();\n const entries: Set<string> = gs.entryChunkCache || new Set();\n\n //@ts-ignore\n gs.__FEDERATION__.__INSTANCES__.map((i: any) => {\n //@ts-ignore\n i.moduleCache.forEach((mc: any) => {\n if (mc.remoteInfo && mc.remoteInfo.entryGlobalName) {\n delete gs[mc.remoteInfo.entryGlobalName];\n }\n });\n i.moduleCache.clear();\n if (gs[i.name]) {\n delete gs[i.name];\n }\n });\n //@ts-ignore\n __webpack_require__?.federation?.instance?.moduleCache?.clear();\n helpers.global.resetFederationGlobalInfo();\n globalThis.moduleGraphDirty = false;\n globalThis.mfHashMap = {};\n\n if (!entries) {\n Object.keys(req.cache).forEach((key) => {\n if (requireCacheRegex.test(key)) {\n decache(key); // Use decache here\n }\n });\n } else {\n for (const entry of entries) {\n decache(entry);\n //reload entries again\n await getRequire()(entry);\n }\n }\n\n return true;\n};\n\nexport const checkUnreachableRemote = (remoteScope: any): boolean => {\n for (const property in remoteScope.remotes) {\n if (!remoteScope[property]) {\n console.error(\n 'unreachable remote found',\n property,\n 'hot reloading to refetch',\n );\n return true;\n }\n }\n return false;\n};\n\nexport const checkMedusaConfigChange = (\n remoteScope: any,\n fetchModule: any,\n): boolean => {\n //@ts-ignore\n if (remoteScope._medusa) {\n //@ts-ignore\n for (const property in remoteScope._medusa) {\n fetchModule(property)\n .then((res: Response) => res.json())\n .then((medusaResponse: any): void | boolean => {\n if (\n medusaResponse.version !==\n //@ts-ignore\n remoteScope?._medusa[property].version\n ) {\n console.log(\n 'medusa config changed',\n property,\n 'hot reloading to refetch',\n );\n performReload(true);\n return true;\n }\n });\n }\n }\n return false;\n};\n\nexport const checkFakeRemote = (remoteScope: any): boolean => {\n for (const property in remoteScope._config) {\n let remote = remoteScope._config[property];\n\n const resolveRemote = async () => {\n remote = await remote();\n };\n\n if (typeof remote === 'function') {\n resolveRemote();\n }\n\n if (remote.fake) {\n console.log('fake remote found', property, 'hot reloading to refetch');\n return true;\n }\n }\n return false;\n};\n\nexport const createFetcher = (\n url: string,\n fetchModule: any,\n name: string,\n cb: (hash: string) => void,\n): Promise<void | boolean> => {\n return fetchModule(url)\n .then((re: Response) => {\n if (!re.ok) {\n throw new Error(\n `Error loading remote: status: ${\n re.status\n }, content-type: ${re.headers.get('content-type')}`,\n );\n }\n return re.text();\n })\n .then((contents: string): void | boolean => {\n const hash = crypto.createHash('md5').update(contents).digest('hex');\n cb(hash);\n })\n .catch((e: Error) => {\n console.error('Remote', name, url, 'Failed to load or is not online', e);\n });\n};\n\nexport const fetchRemote = (\n remoteScope: any,\n fetchModule: any,\n): Promise<boolean> => {\n const fetches: Promise<void | boolean>[] = [];\n let needReload = false;\n for (const property in remoteScope) {\n const name = property;\n const container = remoteScope[property];\n const url = container.entry;\n const fetcher = createFetcher(url, fetchModule, name, (hash) => {\n if (hashmap[name]) {\n if (hashmap[name] !== hash) {\n hashmap[name] = hash;\n needReload = true;\n console.log(name, 'hash is different - must hot reload server');\n }\n } else {\n hashmap[name] = hash;\n }\n });\n\n fetches.push(fetcher);\n }\n return Promise.all(fetches).then(() => {\n return needReload;\n });\n};\n//@ts-ignore\nexport const revalidate = async (\n fetchModule: any = getFetchModule() || (() => {}),\n force: boolean = false,\n): Promise<boolean> => {\n if (globalThis.moduleGraphDirty) {\n force = true;\n }\n const remotesFromAPI = getAllKnownRemotes();\n //@ts-ignore\n return new Promise((res) => {\n if (force) {\n if (Object.keys(hashmap).length !== 0) {\n res(true);\n return;\n }\n }\n if (checkMedusaConfigChange(remotesFromAPI, fetchModule)) {\n res(true);\n }\n\n if (checkFakeRemote(remotesFromAPI)) {\n res(true);\n }\n\n fetchRemote(remotesFromAPI, fetchModule).then((val) => {\n res(val);\n });\n }).then((shouldReload: unknown) => {\n return performReload(shouldReload as boolean);\n });\n};\n\nexport function getFetchModule(): any {\n //@ts-ignore\n const loadedModule =\n //@ts-ignore\n globalThis.webpackChunkLoad || global.webpackChunkLoad || global.fetch;\n if (loadedModule) {\n return loadedModule;\n }\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const nodeFetch = require('node-fetch');\n return nodeFetch.default || nodeFetch;\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,mBAAgC;AAEpC,QAAO,OAAO,4BA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rC,SAAO;GACP;;AAGJ,MAAa,aAAa,OACxB,cAAmB,gBAAgB,WAAW,KAC9C,QAAiB,UACI;AACrB,KAAI,WAAW,iBACb,SAAQ;CAEV,MAAM,iBAAiBA,mDAAoB;AAE3C,QAAO,IAAI,SAAS,QAAQ;AAC1B,MAAI,OACF;OAAI,OAAO,KAAK,QAAQ,CAAC,WAAW,GAAG;AACrC,QAAI,KAAK;AACT;;;AAGJ,MAAI,wBAAwB,gBAAgB,YAAY,CACtD,KAAI,KAAK;AAGX,MAAI,gBAAgB,eAAe,CACjC,KAAI,KAAK;AAGX,cAAY,gBAAgB,YAAY,CAAC,MAAM,QAAQ;AACrD,OAAI,IAAI;IACR;GACF,CAAC,MAAM,iBAA0B;AACjC,SAAO,cAAc,aAAwB;GAC7C;;AAGJ,SAAgB,iBAAsB;CAEpC,MAAM,eAEJ,WAAW,oBAAoB,OAAO,oBAAoB,OAAO;AACnE,KAAI,aACF,QAAO;CAGT,MAAM,YAAY,QAAQ,aAAa;AACvC,QAAO,UAAU,WAAW"}
@@ -0,0 +1,194 @@
1
+ import { __require } from "../../_virtual/_rolldown/runtime.mjs";
2
+ import { getAllKnownRemotes } from "./flush-chunks.mjs";
3
+ import path from "path";
4
+ import crypto from "crypto";
5
+ import helpers from "@module-federation/runtime/helpers";
6
+
7
+ //#region src/utils/hot-reload.ts
8
+ const getRequire = () => {
9
+ return typeof __non_webpack_require__ !== "undefined" ? __non_webpack_require__ : eval("require");
10
+ };
11
+ function callsites() {
12
+ const _prepareStackTrace = Error.prepareStackTrace;
13
+ try {
14
+ let result = [];
15
+ Error.prepareStackTrace = (_, callSites) => {
16
+ const callSitesWithoutCurrent = callSites.slice(1);
17
+ result = callSitesWithoutCurrent;
18
+ return callSitesWithoutCurrent;
19
+ };
20
+ (/* @__PURE__ */ new Error()).stack;
21
+ return result;
22
+ } finally {
23
+ Error.prepareStackTrace = _prepareStackTrace;
24
+ }
25
+ }
26
+ const find = function(moduleName) {
27
+ if (moduleName[0] === ".") {
28
+ const stack = callsites();
29
+ for (const frame of stack) {
30
+ const filename = frame.getFileName();
31
+ if (filename && filename !== module.filename) {
32
+ moduleName = path.resolve(path.dirname(filename), moduleName);
33
+ break;
34
+ }
35
+ }
36
+ }
37
+ try {
38
+ return getRequire().resolve(moduleName);
39
+ } catch (e) {
40
+ return;
41
+ }
42
+ };
43
+ /**
44
+ * Removes a module from the cache. We need this to re-load our http_request !
45
+ * see: https://stackoverflow.com/a/14801711/1148249
46
+ */
47
+ const decache = async function(moduleName) {
48
+ moduleName = find(moduleName);
49
+ if (!moduleName) return;
50
+ const currentChunk = getRequire().cache[__filename];
51
+ searchCache(moduleName, function(mod) {
52
+ delete getRequire().cache[mod.id];
53
+ });
54
+ try {
55
+ Object.keys(currentChunk.constructor._pathCache).forEach(function(cacheKey) {
56
+ if (cacheKey.indexOf(moduleName) > -1) delete currentChunk.constructor._pathCache[cacheKey];
57
+ });
58
+ } catch (error) {}
59
+ };
60
+ /**
61
+ * Runs over the cache to search for all the cached
62
+ * files
63
+ */
64
+ const searchCache = function(moduleName, callback) {
65
+ let mod = getRequire().resolve(moduleName);
66
+ const visited = {};
67
+ /* istanbul ignore else */
68
+ if (mod && (mod = getRequire().cache[mod]) !== void 0) (function run(current) {
69
+ visited[current.id] = true;
70
+ current.children.forEach(function(child) {
71
+ if (path.extname(child.filename) !== ".node" && !visited[child.id]) run(child);
72
+ });
73
+ callback(current);
74
+ })(mod);
75
+ };
76
+ const hashmap = globalThis.mfHashMap || {};
77
+ globalThis.moduleGraphDirty = false;
78
+ const requireCacheRegex = /(remote|server|hot-reload|react-loadable-manifest|runtime|styled-jsx)/;
79
+ const performReload = async (shouldReload) => {
80
+ if (!shouldReload) return false;
81
+ const req = getRequire();
82
+ const gs = new Function("return globalThis")();
83
+ const entries = gs.entryChunkCache || /* @__PURE__ */ new Set();
84
+ gs.__FEDERATION__.__INSTANCES__.map((i) => {
85
+ i.moduleCache.forEach((mc) => {
86
+ if (mc.remoteInfo && mc.remoteInfo.entryGlobalName) delete gs[mc.remoteInfo.entryGlobalName];
87
+ });
88
+ i.moduleCache.clear();
89
+ if (gs[i.name]) delete gs[i.name];
90
+ });
91
+ __webpack_require__?.federation?.instance?.moduleCache?.clear();
92
+ helpers.global.resetFederationGlobalInfo();
93
+ globalThis.moduleGraphDirty = false;
94
+ globalThis.mfHashMap = {};
95
+ if (!entries) Object.keys(req.cache).forEach((key) => {
96
+ if (requireCacheRegex.test(key)) decache(key);
97
+ });
98
+ else for (const entry of entries) {
99
+ decache(entry);
100
+ await getRequire()(entry);
101
+ }
102
+ return true;
103
+ };
104
+ const checkUnreachableRemote = (remoteScope) => {
105
+ for (const property in remoteScope.remotes) if (!remoteScope[property]) {
106
+ console.error("unreachable remote found", property, "hot reloading to refetch");
107
+ return true;
108
+ }
109
+ return false;
110
+ };
111
+ const checkMedusaConfigChange = (remoteScope, fetchModule) => {
112
+ if (remoteScope._medusa) for (const property in remoteScope._medusa) fetchModule(property).then((res) => res.json()).then((medusaResponse) => {
113
+ if (medusaResponse.version !== remoteScope?._medusa[property].version) {
114
+ console.log("medusa config changed", property, "hot reloading to refetch");
115
+ performReload(true);
116
+ return true;
117
+ }
118
+ });
119
+ return false;
120
+ };
121
+ const checkFakeRemote = (remoteScope) => {
122
+ for (const property in remoteScope._config) {
123
+ let remote = remoteScope._config[property];
124
+ const resolveRemote = async () => {
125
+ remote = await remote();
126
+ };
127
+ if (typeof remote === "function") resolveRemote();
128
+ if (remote.fake) {
129
+ console.log("fake remote found", property, "hot reloading to refetch");
130
+ return true;
131
+ }
132
+ }
133
+ return false;
134
+ };
135
+ const createFetcher = (url, fetchModule, name, cb) => {
136
+ return fetchModule(url).then((re) => {
137
+ if (!re.ok) throw new Error(`Error loading remote: status: ${re.status}, content-type: ${re.headers.get("content-type")}`);
138
+ return re.text();
139
+ }).then((contents) => {
140
+ cb(crypto.createHash("md5").update(contents).digest("hex"));
141
+ }).catch((e) => {
142
+ console.error("Remote", name, url, "Failed to load or is not online", e);
143
+ });
144
+ };
145
+ const fetchRemote = (remoteScope, fetchModule) => {
146
+ const fetches = [];
147
+ let needReload = false;
148
+ for (const property in remoteScope) {
149
+ const name = property;
150
+ const url = remoteScope[property].entry;
151
+ const fetcher = createFetcher(url, fetchModule, name, (hash) => {
152
+ if (hashmap[name]) {
153
+ if (hashmap[name] !== hash) {
154
+ hashmap[name] = hash;
155
+ needReload = true;
156
+ console.log(name, "hash is different - must hot reload server");
157
+ }
158
+ } else hashmap[name] = hash;
159
+ });
160
+ fetches.push(fetcher);
161
+ }
162
+ return Promise.all(fetches).then(() => {
163
+ return needReload;
164
+ });
165
+ };
166
+ const revalidate = async (fetchModule = getFetchModule() || (() => {}), force = false) => {
167
+ if (globalThis.moduleGraphDirty) force = true;
168
+ const remotesFromAPI = getAllKnownRemotes();
169
+ return new Promise((res) => {
170
+ if (force) {
171
+ if (Object.keys(hashmap).length !== 0) {
172
+ res(true);
173
+ return;
174
+ }
175
+ }
176
+ if (checkMedusaConfigChange(remotesFromAPI, fetchModule)) res(true);
177
+ if (checkFakeRemote(remotesFromAPI)) res(true);
178
+ fetchRemote(remotesFromAPI, fetchModule).then((val) => {
179
+ res(val);
180
+ });
181
+ }).then((shouldReload) => {
182
+ return performReload(shouldReload);
183
+ });
184
+ };
185
+ function getFetchModule() {
186
+ const loadedModule = globalThis.webpackChunkLoad || global.webpackChunkLoad || global.fetch;
187
+ if (loadedModule) return loadedModule;
188
+ const nodeFetch = __require("node-fetch");
189
+ return nodeFetch.default || nodeFetch;
190
+ }
191
+
192
+ //#endregion
193
+ export { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, getFetchModule, performReload, revalidate };
194
+ //# sourceMappingURL=hot-reload.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot-reload.mjs","names":[],"sources":["../../../src/utils/hot-reload.ts"],"sourcesContent":["import { getAllKnownRemotes } from './flush-chunks';\nimport crypto from 'crypto';\nimport helpers from '@module-federation/runtime/helpers';\nimport path from 'path';\n\ndeclare global {\n var mfHashMap: Record<string, string> | undefined;\n var moduleGraphDirty: boolean;\n}\n\nconst getRequire = (): NodeRequire => {\n //@ts-ignore\n return typeof __non_webpack_require__ !== 'undefined'\n ? (__non_webpack_require__ as NodeRequire)\n : eval('require');\n};\n\nfunction callsites(): any[] {\n const _prepareStackTrace = Error.prepareStackTrace;\n try {\n let result: any[] = [];\n Error.prepareStackTrace = (_, callSites) => {\n const callSitesWithoutCurrent = callSites.slice(1);\n result = callSitesWithoutCurrent;\n return callSitesWithoutCurrent;\n };\n\n new Error().stack;\n return result;\n } finally {\n Error.prepareStackTrace = _prepareStackTrace;\n }\n}\n\nconst find = function (moduleName: string): string | undefined {\n if (moduleName[0] === '.') {\n // Use custom callsites function\n const stack = callsites();\n for (const frame of stack) {\n const filename = frame.getFileName();\n if (filename && filename !== module.filename) {\n moduleName = path.resolve(path.dirname(filename), moduleName);\n break;\n }\n }\n }\n try {\n return getRequire().resolve(moduleName);\n } catch (e) {\n return;\n }\n};\n\n/**\n * Removes a module from the cache. We need this to re-load our http_request !\n * see: https://stackoverflow.com/a/14801711/1148249\n */\nconst decache = async function (moduleName: string) {\n //@ts-ignore\n moduleName = find(moduleName);\n\n if (!moduleName) {\n return;\n }\n\n const currentChunk = getRequire().cache[__filename];\n\n // Run over the cache looking for the files\n // loaded by the specified module name\n searchCache(moduleName, function (mod: NodeModule) {\n delete getRequire().cache[mod.id];\n });\n try {\n // Remove cached paths to the module.\n // Thanks to @bentael for pointing this out.\n //@ts-ignore\n Object.keys((currentChunk.constructor as any)._pathCache).forEach(\n function (cacheKey) {\n if (cacheKey.indexOf(moduleName) > -1) {\n //@ts-ignore\n delete (currentChunk.constructor as any)._pathCache[cacheKey];\n }\n },\n );\n } catch (error) {\n //null\n }\n};\n\n/**\n * Runs over the cache to search for all the cached\n * files\n */\nconst searchCache = function (\n moduleName: string,\n callback: (mod: NodeModule) => void,\n) {\n // Resolve the module identified by the specified name\n let mod = getRequire().resolve(moduleName);\n const visited: Record<string, boolean> = {};\n\n // Check if the module has been resolved and found within\n // the cache no else so #ignore else https://git.io/vtgMI\n /* istanbul ignore else */\n //@ts-ignore\n if (mod && (mod = getRequire().cache[mod]) !== undefined) {\n // Recursively go over the results\n (function run(current: NodeModule) {\n visited[current.id] = true;\n // Go over each of the module's children and\n // run over it\n current.children.forEach(function (child: NodeModule) {\n // ignore .node files, decaching native modules throws a\n // \"module did not self-register\" error on second require\n if (path.extname(child.filename) !== '.node' && !visited[child.id]) {\n run(child);\n }\n });\n\n // Call the specified callback providing the\n // found module\n callback(current);\n //@ts-ignore\n })(mod);\n }\n};\n\nconst hashmap = globalThis.mfHashMap || ({} as Record<string, string>);\nglobalThis.moduleGraphDirty = false;\n\nconst requireCacheRegex =\n /(remote|server|hot-reload|react-loadable-manifest|runtime|styled-jsx)/;\n\nexport const performReload = async (\n shouldReload: boolean,\n): Promise<boolean> => {\n if (!shouldReload) {\n return false;\n }\n\n const req = getRequire();\n\n const gs = new Function('return globalThis')();\n const entries: Set<string> = gs.entryChunkCache || new Set();\n\n //@ts-ignore\n gs.__FEDERATION__.__INSTANCES__.map((i: any) => {\n //@ts-ignore\n i.moduleCache.forEach((mc: any) => {\n if (mc.remoteInfo && mc.remoteInfo.entryGlobalName) {\n delete gs[mc.remoteInfo.entryGlobalName];\n }\n });\n i.moduleCache.clear();\n if (gs[i.name]) {\n delete gs[i.name];\n }\n });\n //@ts-ignore\n __webpack_require__?.federation?.instance?.moduleCache?.clear();\n helpers.global.resetFederationGlobalInfo();\n globalThis.moduleGraphDirty = false;\n globalThis.mfHashMap = {};\n\n if (!entries) {\n Object.keys(req.cache).forEach((key) => {\n if (requireCacheRegex.test(key)) {\n decache(key); // Use decache here\n }\n });\n } else {\n for (const entry of entries) {\n decache(entry);\n //reload entries again\n await getRequire()(entry);\n }\n }\n\n return true;\n};\n\nexport const checkUnreachableRemote = (remoteScope: any): boolean => {\n for (const property in remoteScope.remotes) {\n if (!remoteScope[property]) {\n console.error(\n 'unreachable remote found',\n property,\n 'hot reloading to refetch',\n );\n return true;\n }\n }\n return false;\n};\n\nexport const checkMedusaConfigChange = (\n remoteScope: any,\n fetchModule: any,\n): boolean => {\n //@ts-ignore\n if (remoteScope._medusa) {\n //@ts-ignore\n for (const property in remoteScope._medusa) {\n fetchModule(property)\n .then((res: Response) => res.json())\n .then((medusaResponse: any): void | boolean => {\n if (\n medusaResponse.version !==\n //@ts-ignore\n remoteScope?._medusa[property].version\n ) {\n console.log(\n 'medusa config changed',\n property,\n 'hot reloading to refetch',\n );\n performReload(true);\n return true;\n }\n });\n }\n }\n return false;\n};\n\nexport const checkFakeRemote = (remoteScope: any): boolean => {\n for (const property in remoteScope._config) {\n let remote = remoteScope._config[property];\n\n const resolveRemote = async () => {\n remote = await remote();\n };\n\n if (typeof remote === 'function') {\n resolveRemote();\n }\n\n if (remote.fake) {\n console.log('fake remote found', property, 'hot reloading to refetch');\n return true;\n }\n }\n return false;\n};\n\nexport const createFetcher = (\n url: string,\n fetchModule: any,\n name: string,\n cb: (hash: string) => void,\n): Promise<void | boolean> => {\n return fetchModule(url)\n .then((re: Response) => {\n if (!re.ok) {\n throw new Error(\n `Error loading remote: status: ${\n re.status\n }, content-type: ${re.headers.get('content-type')}`,\n );\n }\n return re.text();\n })\n .then((contents: string): void | boolean => {\n const hash = crypto.createHash('md5').update(contents).digest('hex');\n cb(hash);\n })\n .catch((e: Error) => {\n console.error('Remote', name, url, 'Failed to load or is not online', e);\n });\n};\n\nexport const fetchRemote = (\n remoteScope: any,\n fetchModule: any,\n): Promise<boolean> => {\n const fetches: Promise<void | boolean>[] = [];\n let needReload = false;\n for (const property in remoteScope) {\n const name = property;\n const container = remoteScope[property];\n const url = container.entry;\n const fetcher = createFetcher(url, fetchModule, name, (hash) => {\n if (hashmap[name]) {\n if (hashmap[name] !== hash) {\n hashmap[name] = hash;\n needReload = true;\n console.log(name, 'hash is different - must hot reload server');\n }\n } else {\n hashmap[name] = hash;\n }\n });\n\n fetches.push(fetcher);\n }\n return Promise.all(fetches).then(() => {\n return needReload;\n });\n};\n//@ts-ignore\nexport const revalidate = async (\n fetchModule: any = getFetchModule() || (() => {}),\n force: boolean = false,\n): Promise<boolean> => {\n if (globalThis.moduleGraphDirty) {\n force = true;\n }\n const remotesFromAPI = getAllKnownRemotes();\n //@ts-ignore\n return new Promise((res) => {\n if (force) {\n if (Object.keys(hashmap).length !== 0) {\n res(true);\n return;\n }\n }\n if (checkMedusaConfigChange(remotesFromAPI, fetchModule)) {\n res(true);\n }\n\n if (checkFakeRemote(remotesFromAPI)) {\n res(true);\n }\n\n fetchRemote(remotesFromAPI, fetchModule).then((val) => {\n res(val);\n });\n }).then((shouldReload: unknown) => {\n return performReload(shouldReload as boolean);\n });\n};\n\nexport function getFetchModule(): any {\n //@ts-ignore\n const loadedModule =\n //@ts-ignore\n globalThis.webpackChunkLoad || global.webpackChunkLoad || global.fetch;\n if (loadedModule) {\n return loadedModule;\n }\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const nodeFetch = require('node-fetch');\n return nodeFetch.default || nodeFetch;\n}\n"],"mappings":";;;;;;;AAUA,MAAM,mBAAgC;AAEpC,QAAO,OAAO,4BAA4B,cACrC,0BACD,KAAK,UAAU;;AAGrB,SAAS,YAAmB;CAC1B,MAAM,qBAAqB,MAAM;AACjC,KAAI;EACF,IAAI,SAAgB,EAAE;AACtB,QAAM,qBAAqB,GAAG,cAAc;GAC1C,MAAM,0BAA0B,UAAU,MAAM,EAAE;AAClD,YAAS;AACT,UAAO;;AAGT,uBAAI,OAAO,EAAC;AACZ,SAAO;WACC;AACR,QAAM,oBAAoB;;;AAI9B,MAAM,OAAO,SAAU,YAAwC;AAC7D,KAAI,WAAW,OAAO,KAAK;EAEzB,MAAM,QAAQ,WAAW;AACzB,OAAK,MAAM,SAAS,OAAO;GACzB,MAAM,WAAW,MAAM,aAAa;AACpC,OAAI,YAAY,aAAa,OAAO,UAAU;AAC5C,iBAAa,KAAK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C7C;;AAGJ,SAAgB,iBAAsB;CAEpC,MAAM,eAEJ,WAAW,oBAAoB,OAAO,oBAAoB,OAAO;AACnE,KAAI,aACF,QAAO;CAGT,MAAM,sBAAoB,aAAa;AACvC,QAAO,UAAU,WAAW"}
@@ -0,0 +1,3 @@
1
+ import { flushChunks, getAllKnownRemotes, usedChunks } from "./flush-chunks.mjs";
2
+ import { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, getFetchModule, performReload, revalidate } from "./hot-reload.mjs";
3
+ export { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, flushChunks, getAllKnownRemotes, getFetchModule, performReload, revalidate, usedChunks };
@@ -1,2 +1,3 @@
1
- export * from './hot-reload';
2
- export * from './flush-chunks';
1
+ import { flushChunks, getAllKnownRemotes, usedChunks } from "./flush-chunks.js";
2
+ import { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, getFetchModule, performReload, revalidate } from "./hot-reload.js";
3
+ export { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, flushChunks, getAllKnownRemotes, getFetchModule, performReload, revalidate, usedChunks };
@@ -1,19 +1,15 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./hot-reload"), exports);
18
- __exportStar(require("./flush-chunks"), exports);
19
- //# sourceMappingURL=index.js.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_src_utils_flush_chunks = require('./flush-chunks.js');
3
+ const require_src_utils_hot_reload = require('./hot-reload.js');
4
+
5
+ exports.checkFakeRemote = require_src_utils_hot_reload.checkFakeRemote;
6
+ exports.checkMedusaConfigChange = require_src_utils_hot_reload.checkMedusaConfigChange;
7
+ exports.checkUnreachableRemote = require_src_utils_hot_reload.checkUnreachableRemote;
8
+ exports.createFetcher = require_src_utils_hot_reload.createFetcher;
9
+ exports.fetchRemote = require_src_utils_hot_reload.fetchRemote;
10
+ exports.flushChunks = require_src_utils_flush_chunks.flushChunks;
11
+ exports.getAllKnownRemotes = require_src_utils_flush_chunks.getAllKnownRemotes;
12
+ exports.getFetchModule = require_src_utils_hot_reload.getFetchModule;
13
+ exports.performReload = require_src_utils_hot_reload.performReload;
14
+ exports.revalidate = require_src_utils_hot_reload.revalidate;
15
+ exports.usedChunks = require_src_utils_flush_chunks.usedChunks;
@@ -0,0 +1,4 @@
1
+ import { flushChunks, getAllKnownRemotes, usedChunks } from "./flush-chunks.mjs";
2
+ import { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, getFetchModule, performReload, revalidate } from "./hot-reload.mjs";
3
+
4
+ export { checkFakeRemote, checkMedusaConfigChange, checkUnreachableRemote, createFetcher, fetchRemote, flushChunks, getAllKnownRemotes, getFetchModule, performReload, revalidate, usedChunks };
package/package.json CHANGED
@@ -1,24 +1,69 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/node",
4
- "version": "2.7.32",
4
+ "version": "2.7.33",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/src/index.js",
7
+ "module": "./dist/src/index.mjs",
8
+ "types": "./dist/src/index.d.ts",
7
9
  "exports": {
8
10
  ".": {
9
- "import": "./dist/src/index.js",
10
- "require": "./dist/src/index.js"
11
+ "import": {
12
+ "types": "./dist/src/index.d.mts",
13
+ "default": "./dist/src/index.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/src/index.d.ts",
17
+ "default": "./dist/src/index.js"
18
+ }
11
19
  },
12
20
  "./package.json": "./package.json",
13
- "./runtimePlugin": "./dist/src/runtimePlugin.js",
14
- "./record-dynamic-remote-entry-hash-plugin": "./dist/src/recordDynamicRemoteEntryHashPlugin.js",
21
+ "./runtimePlugin": {
22
+ "import": {
23
+ "types": "./dist/src/runtimePlugin.d.mts",
24
+ "default": "./dist/src/runtimePlugin.mjs"
25
+ },
26
+ "require": {
27
+ "types": "./dist/src/runtimePlugin.d.ts",
28
+ "default": "./dist/src/runtimePlugin.js"
29
+ }
30
+ },
31
+ "./record-dynamic-remote-entry-hash-plugin": {
32
+ "import": {
33
+ "types": "./dist/src/recordDynamicRemoteEntryHashPlugin.d.mts",
34
+ "default": "./dist/src/recordDynamicRemoteEntryHashPlugin.mjs"
35
+ },
36
+ "require": {
37
+ "types": "./dist/src/recordDynamicRemoteEntryHashPlugin.d.ts",
38
+ "default": "./dist/src/recordDynamicRemoteEntryHashPlugin.js"
39
+ }
40
+ },
15
41
  "./utils": {
16
- "import": "./dist/src/utils/index.js",
17
- "require": "./dist/src/utils/index.js"
42
+ "import": {
43
+ "types": "./dist/src/utils/index.d.mts",
44
+ "default": "./dist/src/utils/index.mjs"
45
+ },
46
+ "require": {
47
+ "types": "./dist/src/utils/index.d.ts",
48
+ "default": "./dist/src/utils/index.js"
49
+ }
50
+ },
51
+ "./src/plugins/NodeFederationPlugin.js": {
52
+ "import": "./dist/src/plugins/NodeFederationPlugin.mjs",
53
+ "require": "./dist/src/plugins/NodeFederationPlugin.js"
18
54
  },
19
- "./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js",
20
- "./universe-entry-chunk-tracker-plugin": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js",
21
- "./src/*": "./dist/src/*"
55
+ "./universe-entry-chunk-tracker-plugin": {
56
+ "import": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs",
57
+ "require": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js"
58
+ },
59
+ "./src/*.js": {
60
+ "import": "./dist/src/*.mjs",
61
+ "require": "./dist/src/*.js"
62
+ },
63
+ "./src/*": {
64
+ "import": "./dist/src/*.mjs",
65
+ "require": "./dist/src/*.js"
66
+ }
22
67
  },
23
68
  "typesVersions": {
24
69
  "*": {
@@ -32,7 +77,7 @@
32
77
  "./dist/src/utils/index.d.ts"
33
78
  ],
34
79
  "record-dynamic-remote-entry-hash-plugin": [
35
- "./dist/src/record-dynamic-remote-entry-hash-plugin.d.ts"
80
+ "./dist/src/recordDynamicRemoteEntryHashPlugin.d.ts"
36
81
  ],
37
82
  "universe-entry-chunk-tracker-plugin": [
38
83
  "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts"
@@ -54,7 +99,6 @@
54
99
  "node-module-federation",
55
100
  "ssr"
56
101
  ],
57
- "types": "src/index.d.ts",
58
102
  "description": "Module Federation helper for Node",
59
103
  "repository": {
60
104
  "type": "git",
@@ -67,9 +111,9 @@
67
111
  "btoa": "1.2.1",
68
112
  "encoding": "^0.1.13",
69
113
  "node-fetch": "2.7.0",
70
- "@module-federation/enhanced": "2.0.1",
71
- "@module-federation/runtime": "2.0.1",
72
- "@module-federation/sdk": "2.0.1"
114
+ "@module-federation/sdk": "2.1.0",
115
+ "@module-federation/enhanced": "2.1.0",
116
+ "@module-federation/runtime": "2.1.0"
73
117
  },
74
118
  "peerDependencies": {
75
119
  "webpack": "^5.40.0"
@@ -1,11 +0,0 @@
1
- export let displayName: string;
2
- export let preset: string;
3
- export let globals: {};
4
- export let testEnvironment: string;
5
- export let transform: {
6
- '^.+\\.[tj]s$': (string | {
7
- tsconfig: string;
8
- })[];
9
- };
10
- export let moduleFileExtensions: string[];
11
- export let coverageDirectory: string;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- module.exports = {
4
- displayName: 'node',
5
- preset: '../../jest.preset.js',
6
- globals: {},
7
- testEnvironment: 'node',
8
- transform: {
9
- '^.+\\.[tj]s$': [
10
- 'ts-jest',
11
- {
12
- tsconfig: '<rootDir>/tsconfig.spec.json',
13
- },
14
- ],
15
- },
16
- moduleFileExtensions: ['ts', 'js', 'html'],
17
- coverageDirectory: '../../coverage/packages/node',
18
- };
19
- //# sourceMappingURL=jest.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.js"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,MAAM,CAAC,OAAO,GAAG;IACf,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,EAAE;IACX,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE;QACT,cAAc,EAAE;YACd,SAAS;YACT;gBACE,QAAQ,EAAE,8BAA8B;aACzC;SACF;KACF;IACD,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;IAC1C,iBAAiB,EAAE,8BAA8B;CAClD,CAAC"}
package/dist/package.json DELETED
@@ -1,82 +0,0 @@
1
- {
2
- "public": true,
3
- "name": "@module-federation/node",
4
- "version": "2.7.32",
5
- "type": "commonjs",
6
- "main": "./dist/src/index.js",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/src/index.js",
10
- "require": "./dist/src/index.js"
11
- },
12
- "./package.json": "./package.json",
13
- "./runtimePlugin": "./dist/src/runtimePlugin.js",
14
- "./record-dynamic-remote-entry-hash-plugin": "./dist/src/recordDynamicRemoteEntryHashPlugin.js",
15
- "./utils": {
16
- "import": "./dist/src/utils/index.js",
17
- "require": "./dist/src/utils/index.js"
18
- },
19
- "./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js",
20
- "./universe-entry-chunk-tracker-plugin": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js",
21
- "./src/*": "./dist/src/*"
22
- },
23
- "typesVersions": {
24
- "*": {
25
- ".": [
26
- "./dist/src/index.d.ts"
27
- ],
28
- "runtimePlugin": [
29
- "./dist/src/runtimePlugin.d.ts"
30
- ],
31
- "utils": [
32
- "./dist/src/utils/index.d.ts"
33
- ],
34
- "record-dynamic-remote-entry-hash-plugin": [
35
- "./dist/src/record-dynamic-remote-entry-hash-plugin.d.ts"
36
- ],
37
- "universe-entry-chunk-tracker-plugin": [
38
- "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts"
39
- ]
40
- }
41
- },
42
- "files": [
43
- "dist/",
44
- "README.md"
45
- ],
46
- "publishConfig": {
47
- "access": "public"
48
- },
49
- "tags": [
50
- "module-federation",
51
- "node",
52
- "webpack",
53
- "node-federation",
54
- "node-module-federation",
55
- "ssr"
56
- ],
57
- "types": "src/index.d.ts",
58
- "description": "Module Federation helper for Node",
59
- "repository": {
60
- "type": "git",
61
- "url": "git+https://github.com/module-federation/core.git",
62
- "directory": "packages/node"
63
- },
64
- "author": "Zack Jackson <zackary.l.jackson@gmail.com>",
65
- "license": "MIT",
66
- "dependencies": {
67
- "btoa": "1.2.1",
68
- "encoding": "^0.1.13",
69
- "node-fetch": "2.7.0",
70
- "@module-federation/enhanced": "workspace:*",
71
- "@module-federation/sdk": "workspace:*",
72
- "@module-federation/runtime": "workspace:*"
73
- },
74
- "peerDependencies": {
75
- "webpack": "^5.40.0"
76
- },
77
- "peerDependenciesMeta": {
78
- "webpack": {
79
- "optional": true
80
- }
81
- }
82
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,yEAAmF;AAA1E,+IAAA,OAAO,OAAyB;AACzC,uEAAiF;AAAxE,6IAAA,OAAO,OAAwB;AACxC,iFAA2F;AAAlF,uJAAA,OAAO,OAA6B;AAC7C,YAAY;AACZ,2EAAqF;AAA5E,iJAAA,OAAO,OAA0B;AAC1C,yFAA4F;AAAnF,wJAAA,OAAO,OAA0B;AAC1C,6EAAuF;AAA9E,mJAAA,OAAO,OAA2B;AAC3C,6FAAuG;AAA9F,mKAAA,OAAO,OAAmC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,iDAA+B"}