@module-federation/nextjs-mf 7.0.8 → 8.0.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +545 -411
  2. package/README.md +29 -15
  3. package/client/MFClient.js +1 -2
  4. package/client/MFClient.js.map +1 -1
  5. package/client/RemoteContainer.js +2 -1
  6. package/client/RemoteContainer.js.map +1 -1
  7. package/client/RemotePages.js +2 -1
  8. package/client/RemotePages.js.map +1 -1
  9. package/client/UrlNode.js +2 -10
  10. package/client/UrlNode.js.map +1 -1
  11. package/node.d.ts +1 -1
  12. package/node.js.map +1 -1
  13. package/package.json +7 -5
  14. package/src/default-delegate.js +64 -9
  15. package/src/default-delegate.js.map +1 -1
  16. package/src/federation-noop.js +13 -1
  17. package/src/federation-noop.js.map +1 -1
  18. package/src/index.d.ts +1 -1
  19. package/src/internal.d.ts +18 -12
  20. package/src/internal.js +83 -71
  21. package/src/internal.js.map +1 -1
  22. package/src/loaders/delegateLoader.d.ts +5 -2
  23. package/src/loaders/delegateLoader.js +19 -9
  24. package/src/loaders/delegateLoader.js.map +1 -1
  25. package/src/loaders/fixImageLoader.d.ts +12 -11
  26. package/src/loaders/fixImageLoader.js +17 -13
  27. package/src/loaders/fixImageLoader.js.map +1 -1
  28. package/src/loaders/fixUrlLoader.d.ts +7 -7
  29. package/src/loaders/fixUrlLoader.js +11 -11
  30. package/src/loaders/fixUrlLoader.js.map +1 -1
  31. package/src/loaders/helpers.d.ts +10 -3
  32. package/src/loaders/helpers.js +22 -13
  33. package/src/loaders/helpers.js.map +1 -1
  34. package/src/loaders/inject-hoist.d.ts +11 -0
  35. package/src/loaders/inject-hoist.js +7 -0
  36. package/src/loaders/inject-hoist.js.map +1 -1
  37. package/src/loaders/nextPageMapLoader.d.ts +12 -3
  38. package/src/loaders/nextPageMapLoader.js +45 -29
  39. package/src/loaders/nextPageMapLoader.js.map +1 -1
  40. package/src/loaders/patchDefaultSharedLoader.d.ts +9 -0
  41. package/src/loaders/patchDefaultSharedLoader.js +11 -0
  42. package/src/loaders/patchDefaultSharedLoader.js.map +1 -1
  43. package/src/loaders/patchNextClientPageLoader.d.ts +4 -2
  44. package/src/loaders/patchNextClientPageLoader.js +36 -18
  45. package/src/loaders/patchNextClientPageLoader.js.map +1 -1
  46. package/src/plugins/CopyFederationPlugin.d.ts +13 -0
  47. package/src/plugins/CopyFederationPlugin.js +40 -19
  48. package/src/plugins/CopyFederationPlugin.js.map +1 -1
  49. package/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +2 -3
  50. package/src/plugins/NextFederationPlugin/apply-client-plugins.js +9 -6
  51. package/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -1
  52. package/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +17 -10
  53. package/src/plugins/NextFederationPlugin/apply-server-plugins.js +35 -27
  54. package/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -1
  55. package/src/plugins/NextFederationPlugin/index.d.ts +18 -6
  56. package/src/plugins/NextFederationPlugin/index.js +108 -75
  57. package/src/plugins/NextFederationPlugin/index.js.map +1 -1
  58. package/src/plugins/NextFederationPlugin/next-fragments.d.ts +23 -17
  59. package/src/plugins/NextFederationPlugin/next-fragments.js +26 -18
  60. package/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -1
  61. package/src/plugins/NextFederationPlugin/regex-equal.d.ts +8 -8
  62. package/src/plugins/NextFederationPlugin/regex-equal.js +7 -7
  63. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +7 -0
  64. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +20 -9
  65. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +1 -1
  66. package/src/plugins/NextFederationPlugin/set-options.d.ts +6 -6
  67. package/src/plugins/NextFederationPlugin/set-options.js +10 -6
  68. package/src/plugins/NextFederationPlugin/set-options.js.map +1 -1
  69. package/src/plugins/NextFederationPlugin/validate-options.d.ts +13 -14
  70. package/src/plugins/NextFederationPlugin/validate-options.js +15 -15
  71. package/src/plugins/NextFederationPlugin/validate-options.js.map +1 -1
  72. package/src/plugins/container/EmbeddedContainerPlugin.d.ts +40 -0
  73. package/src/plugins/container/EmbeddedContainerPlugin.js +73 -0
  74. package/src/plugins/container/EmbeddedContainerPlugin.js.map +1 -0
  75. package/src/plugins/container/InvertedContainerPlugin.d.ts +21 -14
  76. package/src/plugins/container/InvertedContainerPlugin.js +21 -148
  77. package/src/plugins/container/InvertedContainerPlugin.js.map +1 -1
  78. package/src/plugins/container/InvertedContainerRuntimeModule.d.ts +3 -33
  79. package/src/plugins/container/InvertedContainerRuntimeModule.js +64 -518
  80. package/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -1
  81. package/src/plugins/container/ModuleFederationPlugin.d.ts +17 -0
  82. package/src/plugins/container/ModuleFederationPlugin.js +97 -0
  83. package/src/plugins/container/ModuleFederationPlugin.js.map +1 -0
  84. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +28 -6
  85. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +34 -57
  86. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +1 -1
  87. package/src/plugins/container/types.d.ts +1 -1
  88. package/src/types.d.ts +3 -0
  89. package/utilities.js.map +1 -1
  90. package/utils/Template.d.ts +1 -1
  91. package/utils/Template.js +23 -15
  92. package/utils/Template.js.map +1 -1
  93. package/utils/build-utils.d.ts +9 -0
  94. package/utils/build-utils.js +9 -0
  95. package/utils/build-utils.js.map +1 -1
  96. package/utils/flushedChunks.d.ts +15 -0
  97. package/utils/flushedChunks.js +8 -0
  98. package/utils/flushedChunks.js.map +1 -1
  99. package/utils/index.d.ts +27 -3
  100. package/utils/index.js +45 -1
  101. package/utils/index.js.map +1 -1
  102. package/src/plugins/JsonpChunkLoading.d.ts +0 -7
  103. package/src/plugins/JsonpChunkLoading.js +0 -43
  104. package/src/plugins/JsonpChunkLoading.js.map +0 -1
  105. package/src/plugins/container/custom-jsonp.d.ts +0 -2
  106. package/src/plugins/container/custom-jsonp.js +0 -90
  107. package/src/plugins/container/custom-jsonp.js.map +0 -1
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applyPathFixes = exports.applyRemoteDelegates = exports.retrieveDefaultShared = exports.getModuleFederationPluginConstructor = void 0;
4
4
  const internal_1 = require("../../internal");
5
5
  const helpers_1 = require("../../loaders/helpers");
6
+ const { ModuleFederationPlugin } = require('@module-federation/enhanced');
6
7
  /**
7
8
  * Gets the appropriate ModuleFederationPlugin based on the environment.
8
9
  * @param {boolean} isServer - A flag to indicate if the environment is server-side or not.
@@ -14,15 +15,13 @@ function getModuleFederationPluginConstructor(isServer, compiler) {
14
15
  return require('@module-federation/node')
15
16
  .NodeFederationPlugin;
16
17
  }
17
- return compiler.webpack.container
18
- .ModuleFederationPlugin;
18
+ return ModuleFederationPlugin;
19
19
  }
20
20
  exports.getModuleFederationPluginConstructor = getModuleFederationPluginConstructor;
21
21
  /**
22
-
23
- Set up default shared values based on the environment.
24
- @param isServer - Boolean indicating if the code is running on the server.
25
- @returns The default share scope based on the environment.
22
+ * Set up default shared values based on the environment.
23
+ * @param {boolean} isServer - Boolean indicating if the code is running on the server.
24
+ * @returns {SharedObject} The default share scope based on the environment.
26
25
  */
27
26
  const retrieveDefaultShared = (isServer) => {
28
27
  // If the code is running on the server, treat some Next.js internals as import false to make them external
@@ -35,17 +34,15 @@ const retrieveDefaultShared = (isServer) => {
35
34
  };
36
35
  exports.retrieveDefaultShared = retrieveDefaultShared;
37
36
  /**
38
-
39
- Apply remote delegates.
40
-
41
- This function adds the remote delegates feature by configuring and injecting the appropriate loader that will look
42
- for internal delegate hoist or delegate hoist container and load it using a custom delegateLoader.
43
- Once loaded, it will then look for the available delegates that will be used to configure the remote
44
- that the hoisted module will be dependent upon.
45
-
46
- @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
47
-
48
- @param {Compiler} compiler - The Webpack compiler instance.
37
+ * Apply remote delegates.
38
+ *
39
+ * This function adds the remote delegates feature by configuring and injecting the appropriate loader that will look
40
+ * for internal delegate hoist or delegate hoist container and load it using a custom delegateLoader.
41
+ * Once loaded, it will then look for the available delegates that will be used to configure the remote
42
+ * that the hoisted module will be dependent upon.
43
+ *
44
+ * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
45
+ * @param {Compiler} compiler - The Webpack compiler instance.
49
46
  */
50
47
  function applyRemoteDelegates(options, compiler) {
51
48
  if (options.remotes) {
@@ -75,18 +72,29 @@ function applyRemoteDelegates(options, compiler) {
75
72
  }
76
73
  }
77
74
  exports.applyRemoteDelegates = applyRemoteDelegates;
78
- // @ts-ignore
75
+ /**
76
+ * Apply path fixes.
77
+ *
78
+ * This function applies fixes to the path for certain loaders. It checks if the fix is enabled in the options
79
+ * and if the loader is present in the rule. If both conditions are met, it injects the fix loader.
80
+ *
81
+ * @param {Compiler} compiler - The Webpack compiler instance.
82
+ * @param {any} options - The ModuleFederationPluginOptions instance.
83
+ */
79
84
  const applyPathFixes = (compiler, options) => {
80
85
  //@ts-ignore
81
86
  compiler.options.module.rules.forEach((rule) => {
82
87
  // next-image-loader fix which adds remote's hostname to the assets url
88
+ //@ts-ignore
83
89
  if (options.enableImageLoaderFix && (0, helpers_1.hasLoader)(rule, 'next-image-loader')) {
84
90
  // childCompiler.options.module.parser.javascript?.url = 'relative';
91
+ //@ts-ignore
85
92
  (0, helpers_1.injectRuleLoader)(rule, {
86
93
  loader: require.resolve('../../loaders/fixImageLoader'),
87
94
  });
88
95
  }
89
96
  // url-loader fix for which adds remote's hostname to the assets url
97
+ //@ts-ignore
90
98
  if (options.enableUrlLoaderFix && (0, helpers_1.hasLoader)(rule, 'url-loader')) {
91
99
  (0, helpers_1.injectRuleLoader)({
92
100
  loader: require.resolve('../../loaders/fixUrlLoader'),
@@ -1 +1 @@
1
- {"version":3,"file":"next-fragments.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/next-fragments.ts"],"names":[],"mappings":";;;AAOA,6CAIwB;AACxB,mDAAoE;AAMpE;;;;;GAKG;AACH,SAAgB,oCAAoC,CAClD,QAAiB,EACjB,QAAkB;IAElB,IAAI,QAAQ,EAAE;QACZ,OAAO,OAAO,CAAC,yBAAyB,CAAC;aACtC,oBAA2D,CAAC;KAChE;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS;SAC9B,sBAAwE,CAAC;AAC9E,CAAC;AAVD,oFAUC;AAED;;;;;GAKG;AACI,MAAM,qBAAqB,GAAG,CAAC,QAAiB,EAAgB,EAAE;IACvE,2GAA2G;IAC3G,kGAAkG;IAClG,IAAI,QAAQ,EAAE;QACZ,OAAO,8BAAmB,CAAC;KAC5B;IACD,gFAAgF;IAChF,OAAO,sCAA2B,CAAC;AACrC,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAgB,oBAAoB,CAClC,OAAsC,EACtC,QAAkB;IAElB,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,8BAA8B;QAC9B,MAAM,SAAS,GAAG,IAAA,uBAAY,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACjC,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,MAAM,CAAC;YACd,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC;SAClE,CAAC,CAAC;QACH,sEAAsE;QACtE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACjC,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,yBAAyB,EAAE,0BAA0B,CAAC;YAC7D,OAAO,EAAE;gBACP,QAAQ,CAAC,OAAO;gBAChB,yBAAyB;gBACzB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,cAAc;aACf;YACD,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC;YACvD,OAAO,EAAE;gBACP,SAAS;aACV;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AA7BD,oDA6BC;AAED,aAAa;AACN,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;IAClD,YAAY;IACZ,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,uEAAuE;QACvE,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE;YACxE,oEAAoE;YACpE,IAAA,0BAAgB,EAAC,IAAI,EAAE;gBACrB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC;aACxD,CAAC,CAAC;SACJ;QAED,oEAAoE;QACpE,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,YAAY,CAAC,EAAE;YAC/D,IAAA,0BAAgB,EAAC;gBACf,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC;aACtD,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB"}
1
+ {"version":3,"file":"next-fragments.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/next-fragments.ts"],"names":[],"mappings":";;;AAOA,6CAIwB;AACxB,mDAAoE;AACpE,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAM1E;;;;;GAKG;AACH,SAAgB,oCAAoC,CAClD,QAAiB,EACjB,QAAkB;IAElB,IAAI,QAAQ,EAAE;QACZ,OAAO,OAAO,CAAC,yBAAyB,CAAC;aACtC,oBAA2D,CAAC;KAChE;IACD,OAAO,sBAAwE,CAAC;AAClF,CAAC;AATD,oFASC;AAED;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,QAAiB,EAAgB,EAAE;IACvE,2GAA2G;IAC3G,kGAAkG;IAClG,IAAI,QAAQ,EAAE;QACZ,OAAO,8BAAmB,CAAC;KAC5B;IACD,gFAAgF;IAChF,OAAO,sCAA2B,CAAC;AACrC,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,oBAAoB,CAClC,OAAsC,EACtC,QAAkB;IAElB,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,8BAA8B;QAC9B,MAAM,SAAS,GAAG,IAAA,uBAAY,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACjC,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,MAAM,CAAC;YACd,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC;SAClE,CAAC,CAAC;QACH,sEAAsE;QACtE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACjC,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,yBAAyB,EAAE,0BAA0B,CAAC;YAC7D,OAAO,EAAE;gBACP,QAAQ,CAAC,OAAO;gBAChB,yBAAyB;gBACzB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,cAAc;aACf;YACD,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC;YACvD,OAAO,EAAE;gBACP,SAAS;aACV;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AA7BD,oDA6BC;AAED;;;;;;;;GAQG;AACI,MAAM,cAAc,GAAG,CAC5B,QAAkB,EAClB,OAAY,EACZ,EAAE;IAGF,YAAY;IACZ,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,uEAAuE;QACvE,YAAY;QACZ,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE;YACxE,oEAAoE;YACpE,YAAY;YACZ,IAAA,0BAAgB,EAAC,IAAI,EAAE;gBACrB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC;aACxD,CAAC,CAAC;SACJ;QAED,oEAAoE;QACpE,YAAY;QACZ,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAA,mBAAS,EAAC,IAAI,EAAE,YAAY,CAAC,EAAE;YAC/D,IAAA,0BAAgB,EAAC;gBACf,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC;aACtD,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA1BW,QAAA,cAAc,kBA0BzB"}
@@ -1,14 +1,14 @@
1
- import { RuleSetConditionAbsolute } from "webpack";
1
+ import { RuleSetConditionAbsolute } from 'webpack';
2
2
  /**
3
- * Compares two regular expressions to see if they are equal.
3
+ * Compares two regular expressions or other types of conditions to see if they are equal.
4
4
  *
5
- * @param x - The first regular expression to compare.
6
- * @param y - The second regular expression to compare.
7
- * @returns True if the regular expressions are equal, false otherwise.
5
+ * @param x - The first condition to compare. It can be a string, a RegExp, a function that takes a string and returns a boolean, an array of RuleSetConditionAbsolute, or undefined.
6
+ * @param y - The second condition to compare. It is always a RegExp.
7
+ * @returns True if the conditions are equal, false otherwise.
8
8
  *
9
9
  * @remarks
10
- * This function compares two regular expressions to see if they are equal in terms of their source,
11
- * global, ignoreCase, and multiline properties. It is used to check if two regular expressions match
12
- * the same pattern.
10
+ * This function compares two conditions to see if they are equal in terms of their source,
11
+ * global, ignoreCase, and multiline properties. It is used to check if two conditions match
12
+ * the same pattern. If the first condition is not a RegExp, the function will always return false.
13
13
  */
14
14
  export declare const regexEqual: (x: string | RegExp | RuleSetConditionAbsolute[] | ((value: string) => boolean) | undefined, y: RegExp) => boolean;
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.regexEqual = void 0;
4
4
  /**
5
- * Compares two regular expressions to see if they are equal.
5
+ * Compares two regular expressions or other types of conditions to see if they are equal.
6
6
  *
7
- * @param x - The first regular expression to compare.
8
- * @param y - The second regular expression to compare.
9
- * @returns True if the regular expressions are equal, false otherwise.
7
+ * @param x - The first condition to compare. It can be a string, a RegExp, a function that takes a string and returns a boolean, an array of RuleSetConditionAbsolute, or undefined.
8
+ * @param y - The second condition to compare. It is always a RegExp.
9
+ * @returns True if the conditions are equal, false otherwise.
10
10
  *
11
11
  * @remarks
12
- * This function compares two regular expressions to see if they are equal in terms of their source,
13
- * global, ignoreCase, and multiline properties. It is used to check if two regular expressions match
14
- * the same pattern.
12
+ * This function compares two conditions to see if they are equal in terms of their source,
13
+ * global, ignoreCase, and multiline properties. It is used to check if two conditions match
14
+ * the same pattern. If the first condition is not a RegExp, the function will always return false.
15
15
  */
16
16
  const regexEqual = (x, y) => {
17
17
  return (x instanceof RegExp &&
@@ -1 +1,8 @@
1
+ /**
2
+ * Function to remove unnecessary shared keys from the default share scope.
3
+ * It iterates over each key in the shared object and checks against the default share scope.
4
+ * If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
5
+ *
6
+ * @param {Record<string, unknown>} shared - The shared object to be checked.
7
+ */
1
8
  export declare function removeUnnecessarySharedKeys(shared: Record<string, unknown>): void;
@@ -1,20 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeUnnecessarySharedKeys = void 0;
4
- // Utility function to remove unnecessary shared keys from the default share scope
4
+ /**
5
+ * Utility function to remove unnecessary shared keys from the default share scope.
6
+ * It checks each key in the shared object against the default share scope.
7
+ * If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
8
+ *
9
+ * @param {Record<string, unknown>} shared - The shared object to be checked.
10
+ */
5
11
  const internal_1 = require("../../internal");
12
+ /**
13
+ * Function to remove unnecessary shared keys from the default share scope.
14
+ * It iterates over each key in the shared object and checks against the default share scope.
15
+ * If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
16
+ *
17
+ * @param {Record<string, unknown>} shared - The shared object to be checked.
18
+ */
6
19
  function removeUnnecessarySharedKeys(shared) {
7
- const warnings = Object.keys(shared).reduce((acc, key) => {
20
+ Object.keys(shared).forEach((key) => {
21
+ /**
22
+ * If the key is found in the default share scope, log a warning and remove the key from the shared object.
23
+ */
8
24
  if (internal_1.DEFAULT_SHARE_SCOPE[key]) {
9
- acc.push(`[nextjs-mf] You are sharing ${key} from the default share scope. This is not necessary and can be removed.`);
10
- // Use a type assertion to inform TypeScript that 'key' can be used as an index for the 'shared' object
25
+ console.warn(`%c[nextjs-mf] You are sharing ${key} from the default share scope. This is not necessary and can be removed.`, 'color: red');
11
26
  delete shared[key];
12
27
  }
13
- return acc;
14
- }, []);
15
- if (warnings.length > 0) {
16
- console.warn('%c' + warnings.join('\n'), 'color: red');
17
- }
28
+ });
18
29
  }
19
30
  exports.removeUnnecessarySharedKeys = removeUnnecessarySharedKeys;
20
31
  //# sourceMappingURL=remove-unnecessary-shared-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-unnecessary-shared-keys.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.ts"],"names":[],"mappings":";;;AAAA,kFAAkF;AAClF,6CAAqD;AAErD,SAAgB,2BAA2B,CACzC,MAA+B;IAE/B,MAAM,QAAQ,GAAa,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CACnD,CAAC,GAAa,EAAE,GAAW,EAAE,EAAE;QAC7B,IAAI,8BAAmB,CAAC,GAAG,CAAC,EAAE;YAC5B,GAAG,CAAC,IAAI,CACN,+BAA+B,GAAG,0EAA0E,CAC7G,CAAC;YACF,uGAAuG;YACvG,OAAQ,MAAqC,CAAC,GAAG,CAAC,CAAC;SACpD;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;KACxD;AACH,CAAC;AApBD,kEAoBC"}
1
+ {"version":3,"file":"remove-unnecessary-shared-keys.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAAqD;AAErD;;;;;;GAMG;AACH,SAAgB,2BAA2B,CACzC,MAA+B;IAE/B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;QAC1C;;WAEG;QACH,IAAI,8BAAmB,CAAC,GAAG,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,CACV,iCAAiC,GAAG,0EAA0E,EAC9G,YAAY,CACb,CAAC;YACF,OAAQ,MAAqC,CAAC,GAAG,CAAC,CAAC;SACpD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,kEAeC"}
@@ -1,18 +1,18 @@
1
1
  import { ModuleFederationPluginOptions, NextFederationPluginExtraOptions, NextFederationPluginOptions } from '@module-federation/utilities';
2
2
  /**
3
- * Utility function to set the main and extra options.
3
+ * This function sets the main and extra options for NextFederationPlugin. It splits the options object into
4
+ * the main options and extra options, and sets default values for any options that are not defined.
4
5
  *
5
- * @param options - The NextFederationPluginOptions instance.
6
- * @returns An object containing the main options and extra options.
6
+ * @param {NextFederationPluginOptions} options - The options for NextFederationPlugin.
7
+ * @returns {Object} An object containing the main options and extra options.
7
8
  *
8
9
  * @remarks
9
- * This function sets the main and extra options for NextFederationPlugin. It splits the options object into
10
- * the main options and extra options, and sets default values for any options that are not defined. The default
11
- * extra options are:
10
+ * The default extra options are:
12
11
  * - automaticPageStitching: false
13
12
  * - enableImageLoaderFix: false
14
13
  * - enableUrlLoaderFix: false
15
14
  * - skipSharingNextInternals: false
15
+ * - debug: false
16
16
  */
17
17
  export declare function setOptions(options: NextFederationPluginOptions): {
18
18
  mainOptions: ModuleFederationPluginOptions;
@@ -2,22 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setOptions = void 0;
4
4
  /**
5
- * Utility function to set the main and extra options.
5
+ * This function sets the main and extra options for NextFederationPlugin. It splits the options object into
6
+ * the main options and extra options, and sets default values for any options that are not defined.
6
7
  *
7
- * @param options - The NextFederationPluginOptions instance.
8
- * @returns An object containing the main options and extra options.
8
+ * @param {NextFederationPluginOptions} options - The options for NextFederationPlugin.
9
+ * @returns {Object} An object containing the main options and extra options.
9
10
  *
10
11
  * @remarks
11
- * This function sets the main and extra options for NextFederationPlugin. It splits the options object into
12
- * the main options and extra options, and sets default values for any options that are not defined. The default
13
- * extra options are:
12
+ * The default extra options are:
14
13
  * - automaticPageStitching: false
15
14
  * - enableImageLoaderFix: false
16
15
  * - enableUrlLoaderFix: false
17
16
  * - skipSharingNextInternals: false
17
+ * - debug: false
18
18
  */
19
19
  function setOptions(options) {
20
20
  const { extraOptions, ...mainOpts } = options;
21
+ /**
22
+ * Default extra options for NextFederationPlugin.
23
+ * @type {NextFederationPluginExtraOptions}
24
+ */
21
25
  const defaultExtraOptions = {
22
26
  automaticPageStitching: false,
23
27
  enableImageLoaderFix: false,
@@ -1 +1 @@
1
- {"version":3,"file":"set-options.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/set-options.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAC,OAAoC;IAI7D,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,mBAAmB,GAAqC;QAC5D,sBAAsB,EAAE,KAAK;QAC7B,oBAAoB,EAAE,KAAK;QAC3B,kBAAkB,EAAE,KAAK;QACzB,wBAAwB,EAAE,KAAK;QAC/B,KAAK,EAAE,KAAK;KACb,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,YAAY,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,YAAY,EAAE;KAC1D,CAAC;AACJ,CAAC;AAlBD,gCAkBC"}
1
+ {"version":3,"file":"set-options.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/set-options.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAC,OAAoC;IAI7D,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE9C;;;OAGG;IACH,MAAM,mBAAmB,GAAqC;QAC5D,sBAAsB,EAAE,KAAK;QAC7B,oBAAoB,EAAE,KAAK;QAC3B,kBAAkB,EAAE,KAAK;QACzB,wBAAwB,EAAE,KAAK;QAC/B,KAAK,EAAE,KAAK;KACb,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,YAAY,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,YAAY,EAAE;KAC1D,CAAC;AACJ,CAAC;AAtBD,gCAsBC"}
@@ -1,26 +1,25 @@
1
- import { Compiler } from "webpack";
2
- import { ModuleFederationPluginOptions } from "@module-federation/utilities";
1
+ import Compiler from 'webpack/lib/Compiler';
2
+ import { ModuleFederationPluginOptions } from '@module-federation/utilities';
3
3
  /**
4
- * Utility function to validate compiler options.
4
+ * Validates the compiler options.
5
5
  *
6
- * @param compiler - The Webpack compiler instance.
7
- * @returns True if the compiler options are valid, false otherwise.
6
+ * @param {Compiler} compiler - The Webpack compiler instance.
7
+ * @returns {boolean} - Returns true if the compiler options are valid, false otherwise.
8
8
  *
9
+ * @throws Will throw an error if the name option is not defined in the options.
9
10
  * @remarks
10
- * This function validates the options passed to the Webpack compiler. It throws an error if the name
11
- * option is not defined in the options. It also checks if the name option is set to either "server" or
11
+ * This function validates the options passed to the Webpack compiler. It checks if the name option is set to either "server" or
12
12
  * "client", as Module Federation is only applied to the main server and client builds in Next.js.
13
13
  */
14
14
  export declare function validateCompilerOptions(compiler: Compiler): boolean;
15
15
  /**
16
- * Utility function to validate NextFederationPlugin options.
16
+ * Validates the NextFederationPlugin options.
17
17
  *
18
- * @param options - The ModuleFederationPluginOptions instance.
18
+ * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
19
19
  *
20
+ * @throws Will throw an error if the filename option is not defined in the options or if the name option is not specified.
20
21
  * @remarks
21
- * This function validates the options passed to NextFederationPlugin. It throws an error if the filename
22
- * option is not defined in the options.
23
- *
24
- * A requirement for using Module Federation is that a name must be specified.
22
+ * This function validates the options passed to NextFederationPlugin. It ensures that the filename and name options are defined,
23
+ * as they are required for using Module Federation.
25
24
  */
26
- export declare function validatePluginOptions(options: ModuleFederationPluginOptions): void;
25
+ export declare function validatePluginOptions(options: ModuleFederationPluginOptions): boolean | void;
@@ -2,45 +2,45 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validatePluginOptions = exports.validateCompilerOptions = void 0;
4
4
  /**
5
- * Utility function to validate compiler options.
5
+ * Validates the compiler options.
6
6
  *
7
- * @param compiler - The Webpack compiler instance.
8
- * @returns True if the compiler options are valid, false otherwise.
7
+ * @param {Compiler} compiler - The Webpack compiler instance.
8
+ * @returns {boolean} - Returns true if the compiler options are valid, false otherwise.
9
9
  *
10
+ * @throws Will throw an error if the name option is not defined in the options.
10
11
  * @remarks
11
- * This function validates the options passed to the Webpack compiler. It throws an error if the name
12
- * option is not defined in the options. It also checks if the name option is set to either "server" or
12
+ * This function validates the options passed to the Webpack compiler. It checks if the name option is set to either "server" or
13
13
  * "client", as Module Federation is only applied to the main server and client builds in Next.js.
14
14
  */
15
15
  function validateCompilerOptions(compiler) {
16
16
  // Throw an error if the name option is not defined in the options
17
17
  if (!compiler.options.name) {
18
- throw new Error("name is not defined in Compiler options");
18
+ throw new Error('name is not defined in Compiler options');
19
19
  }
20
20
  // Only apply Module Federation to the main server and client builds in Next.js
21
- return ["server", "client"].includes(compiler.options.name);
21
+ return ['server', 'client'].includes(compiler.options.name);
22
22
  }
23
23
  exports.validateCompilerOptions = validateCompilerOptions;
24
24
  /**
25
- * Utility function to validate NextFederationPlugin options.
25
+ * Validates the NextFederationPlugin options.
26
26
  *
27
- * @param options - The ModuleFederationPluginOptions instance.
27
+ * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
28
28
  *
29
+ * @throws Will throw an error if the filename option is not defined in the options or if the name option is not specified.
29
30
  * @remarks
30
- * This function validates the options passed to NextFederationPlugin. It throws an error if the filename
31
- * option is not defined in the options.
32
- *
33
- * A requirement for using Module Federation is that a name must be specified.
31
+ * This function validates the options passed to NextFederationPlugin. It ensures that the filename and name options are defined,
32
+ * as they are required for using Module Federation.
34
33
  */
35
34
  function validatePluginOptions(options) {
36
35
  // Throw an error if the filename option is not defined in the options
37
36
  if (!options.filename) {
38
- throw new Error("filename is not defined in NextFederation options");
37
+ throw new Error('filename is not defined in NextFederation options');
39
38
  }
40
39
  // A requirement for using Module Federation is that a name must be specified
41
40
  if (!options.name) {
42
- throw new Error("Module federation \"name\" option must be specified");
41
+ throw new Error('Module federation "name" option must be specified');
43
42
  }
43
+ return true;
44
44
  }
45
45
  exports.validatePluginOptions = validatePluginOptions;
46
46
  //# sourceMappingURL=validate-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/validate-options.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,QAAkB;IACxD,kEAAkE;IAClE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AARD,0DAQC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,qBAAqB,CACnC,OAAsC;IAEtC,sEAAsE;IACtE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IAED,6EAA6E;IAC7E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACxE;AACH,CAAC;AAZD,sDAYC"}
1
+ {"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/validate-options.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,QAAkB;IACxD,kEAAkE;IAClE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AARD,0DAQC;AAED;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,OAAsC;IAEtC,sEAAsE;IACtE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IAED,6EAA6E;IAC7E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,sDAaC"}
@@ -0,0 +1,40 @@
1
+ import type Compiler from 'webpack/lib/Compiler';
2
+ /**
3
+ * @typedef {Object} EmbeddedContainerOptions
4
+ * @property {string} runtime - The runtime of the plugin
5
+ * @property {string} [container] - The container of the plugin
6
+ * @property {string} chunkToEmbed - The chunk to embed in the plugin
7
+ */
8
+ export interface EmbeddedContainerOptions {
9
+ runtime: string;
10
+ container?: string;
11
+ chunkToEmbed: string;
12
+ }
13
+ /**
14
+ * EmbeddedContainerPlugin class for Webpack.
15
+ * @class
16
+ */
17
+ declare class EmbeddedContainerPlugin {
18
+ private options;
19
+ /**
20
+ * Constructor for the EmbeddedContainerPlugin.
21
+ * @param {EmbeddedContainerOptions} options - The options for the plugin
22
+ */
23
+ constructor(options: EmbeddedContainerOptions);
24
+ /**
25
+ * Process the given chunks.
26
+ * @param {Iterable<Chunk>} chunks - The chunks to process
27
+ * @param {Compilation} compilation - The compilation of the plugin
28
+ * @returns {void}
29
+ * @private
30
+ */
31
+ private processChunks;
32
+ /**
33
+ * Apply the plugin to the given compiler.
34
+ * @param {Compiler} compiler - The compiler to apply the plugin to
35
+ * @returns {void}
36
+ * @public
37
+ */
38
+ apply(compiler: Compiler): void;
39
+ }
40
+ export default EmbeddedContainerPlugin;
@@ -0,0 +1,73 @@
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
+ const InvertedContainerRuntimeModule_1 = __importDefault(require("./InvertedContainerRuntimeModule"));
7
+ /**
8
+ * EmbeddedContainerPlugin class for Webpack.
9
+ * @class
10
+ */
11
+ class EmbeddedContainerPlugin {
12
+ /**
13
+ * Constructor for the EmbeddedContainerPlugin.
14
+ * @param {EmbeddedContainerOptions} options - The options for the plugin
15
+ */
16
+ constructor(options) {
17
+ this.options = options;
18
+ }
19
+ /**
20
+ * Process the given chunks.
21
+ * @param {Iterable<Chunk>} chunks - The chunks to process
22
+ * @param {Compilation} compilation - The compilation of the plugin
23
+ * @returns {void}
24
+ * @private
25
+ */
26
+ processChunks(chunks, compilation) {
27
+ const relevantChunks = new Map();
28
+ for (const chunk of chunks) {
29
+ if (chunk.name &&
30
+ [
31
+ this.options.runtime,
32
+ this.options.container,
33
+ this.options.chunkToEmbed,
34
+ ].includes(chunk.name)) {
35
+ relevantChunks.set(chunk.name, chunk);
36
+ }
37
+ }
38
+ const runtimeChunk = relevantChunks.get(this.options.runtime);
39
+ const partialContainerChunk = relevantChunks.get(this.options.chunkToEmbed);
40
+ if (partialContainerChunk && runtimeChunk) {
41
+ const chunkGraph = compilation.chunkGraph;
42
+ for (const module of chunkGraph.getChunkModulesIterable(partialContainerChunk)) {
43
+ chunkGraph.connectChunkAndModule(runtimeChunk, module);
44
+ chunkGraph.disconnectChunkAndModule(partialContainerChunk, module);
45
+ }
46
+ }
47
+ }
48
+ /**
49
+ * Apply the plugin to the given compiler.
50
+ * @param {Compiler} compiler - The compiler to apply the plugin to
51
+ * @returns {void}
52
+ * @public
53
+ */
54
+ apply(compiler) {
55
+ compiler.hooks.thisCompilation.tap('EmbeddedContainerPlugin', (compilation) => {
56
+ // Hook into the optimizeChunks phase
57
+ compilation.hooks.optimizeChunks.tap('EmbeddedContainerPlugin', (chunks) => this.processChunks(chunks, compilation));
58
+ // Add the runtime module
59
+ compilation.hooks.additionalTreeRuntimeRequirements.tap('EmbeddedContainerPlugin', (chunk, set) => {
60
+ const runtimeModuleOptions = {
61
+ runtime: this.options.runtime,
62
+ remotes: {},
63
+ name: this.options.container,
64
+ debug: false,
65
+ container: this.options.container,
66
+ };
67
+ compilation.addRuntimeModule(chunk, new InvertedContainerRuntimeModule_1.default(runtimeModuleOptions));
68
+ });
69
+ });
70
+ }
71
+ }
72
+ exports.default = EmbeddedContainerPlugin;
73
+ //# sourceMappingURL=EmbeddedContainerPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddedContainerPlugin.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/container/EmbeddedContainerPlugin.ts"],"names":[],"mappings":";;;;;AAGA,sGAA8E;AAc9E;;;GAGG;AACH,MAAM,uBAAuB;IAG3B;;;OAGG;IACH,YAAY,OAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CACnB,MAAuB,EACvB,WAAwB;QAExB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IACE,KAAK,CAAC,IAAI;gBACV;oBACE,IAAI,CAAC,OAAO,CAAC,OAAO;oBACpB,IAAI,CAAC,OAAO,CAAC,SAAS;oBACtB,IAAI,CAAC,OAAO,CAAC,YAAY;iBAC1B,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EACtB;gBACA,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACvC;SACF;QAED,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAE5E,IAAI,qBAAqB,IAAI,YAAY,EAAE;YACzC,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;YAC1C,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,uBAAuB,CACrD,qBAAqB,CACtB,EAAE;gBACD,UAAU,CAAC,qBAAqB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;gBACvD,UAAU,CAAC,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;aACpE;SACF;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,QAAkB;QAC7B,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,yBAAyB,EACzB,CAAC,WAAwB,EAAE,EAAE;YAC3B,qCAAqC;YACrC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAClC,yBAAyB,EACzB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CACpD,CAAC;YAEF,yBAAyB;YACzB,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,GAAG,CACrD,yBAAyB,EACzB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACb,MAAM,oBAAoB,GAAG;oBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;oBAC7B,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;oBAC5B,KAAK,EAAE,KAAK;oBACZ,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;iBAClC,CAAC;gBAEF,WAAW,CAAC,gBAAgB,CAC1B,KAAK,EACL,IAAI,wCAA8B,CAAC,oBAAoB,CAAC,CACzD,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAC"}
@@ -1,7 +1,25 @@
1
- import type { Compiler, Module } from 'webpack';
2
- import { Compilation } from 'webpack';
1
+ import type Compiler from 'webpack/lib/Compiler';
2
+ import { ModuleFederationPluginOptions } from './types';
3
+ /**
4
+ * This interface includes additional fields specific to the plugin's behavior.
5
+ * @interface InvertedContainerOptions
6
+ * @extends {ModuleFederationPluginOptions}
7
+ * @property {string} [container] - The container name.
8
+ * @property {Record<string, string>} remotes - A map of remote modules to their URLs.
9
+ * @property {string} runtime - The name of the current module.
10
+ * @property {boolean} [debug] - A flag to enable debug logging.
11
+ * @property {string} chunkToEmbed - The chunk to embed.
12
+ */
13
+ interface InvertedContainerOptions extends ModuleFederationPluginOptions {
14
+ container?: string;
15
+ remotes: Record<string, string>;
16
+ runtime: string;
17
+ debug?: boolean;
18
+ chunkToEmbed: string;
19
+ }
3
20
  /**
4
21
  * InvertedContainerPlugin is a Webpack plugin that handles loading of chunks in a federated module.
22
+ * @class
5
23
  */
6
24
  declare class InvertedContainerPlugin {
7
25
  private options;
@@ -9,18 +27,7 @@ declare class InvertedContainerPlugin {
9
27
  * Constructor for the InvertedContainerPlugin.
10
28
  * @param {InvertedContainerOptions} options - Plugin configuration options.
11
29
  */
12
- constructor(options: {
13
- container: string | undefined;
14
- runtime: string;
15
- remotes: Record<string, string>;
16
- debug: boolean | undefined;
17
- });
18
- /**
19
- * Resolves the container module for the given compilation.
20
- * @param {Compilation} compilation - Webpack compilation instance.
21
- * @returns {Module | undefined} - The container module or undefined if not found.
22
- */
23
- resolveContainerModule(compilation: Compilation): Module | undefined;
30
+ constructor(options: InvertedContainerOptions);
24
31
  /**
25
32
  * Apply method for the Webpack plugin, handling the plugin logic and hooks.
26
33
  * @param {Compiler} compiler - Webpack compiler instance.