@module-federation/nextjs-mf 5.5.0 → 5.6.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 (139) hide show
  1. package/README.md +1 -27
  2. package/{lib/client → client}/CombinedPages.d.ts +27 -28
  3. package/client/CombinedPages.js +38 -0
  4. package/client/CombinedPages.js.map +1 -0
  5. package/{lib/client → client}/MFClient.d.ts +72 -73
  6. package/client/MFClient.js +159 -0
  7. package/client/MFClient.js.map +1 -0
  8. package/{lib/client → client}/RemoteContainer.d.ts +46 -58
  9. package/client/RemoteContainer.js +121 -0
  10. package/client/RemoteContainer.js.map +1 -0
  11. package/{lib/client → client}/RemotePages.d.ts +49 -49
  12. package/client/RemotePages.js +138 -0
  13. package/client/RemotePages.js.map +1 -0
  14. package/{lib/client → client}/UrlNode.d.ts +17 -18
  15. package/{lib/client → client}/UrlNode.js +157 -161
  16. package/client/UrlNode.js.map +1 -0
  17. package/{lib/client → client}/helpers.d.ts +16 -17
  18. package/{lib/client → client}/helpers.js +90 -104
  19. package/client/helpers.js.map +1 -0
  20. package/client/index.d.ts +2 -0
  21. package/client/index.js +6 -0
  22. package/client/index.js.map +1 -0
  23. package/{lib/client → client}/useMFClient.d.ts +24 -25
  24. package/client/useMFClient.js +55 -0
  25. package/client/useMFClient.js.map +1 -0
  26. package/{lib/client → client}/useMFRemote.d.ts +16 -17
  27. package/client/useMFRemote.js +50 -0
  28. package/client/useMFRemote.js.map +1 -0
  29. package/jest.config.d.ts +13 -0
  30. package/jest.config.js +18 -0
  31. package/jest.config.js.map +1 -0
  32. package/package.json +19 -42
  33. package/src/include-defaults.d.ts +0 -0
  34. package/{lib → src}/include-defaults.js +4 -3
  35. package/src/include-defaults.js.map +1 -0
  36. package/src/index.d.ts +3 -0
  37. package/src/index.js +9 -0
  38. package/src/index.js.map +1 -0
  39. package/src/internal.d.ts +12 -0
  40. package/src/internal.js +260 -0
  41. package/src/internal.js.map +1 -0
  42. package/src/loaders/fixImageLoader.d.ts +16 -0
  43. package/src/loaders/fixImageLoader.js +53 -0
  44. package/src/loaders/fixImageLoader.js.map +1 -0
  45. package/src/loaders/fixUrlLoader.d.ts +13 -0
  46. package/src/loaders/fixUrlLoader.js +25 -0
  47. package/src/loaders/fixUrlLoader.js.map +1 -0
  48. package/src/loaders/helpers.d.ts +10 -0
  49. package/src/loaders/helpers.js +46 -0
  50. package/src/loaders/helpers.js.map +1 -0
  51. package/src/loaders/nextPageMapLoader.d.ts +15 -0
  52. package/src/loaders/nextPageMapLoader.js +151 -0
  53. package/src/loaders/nextPageMapLoader.js.map +1 -0
  54. package/src/loaders/patchNextClientPageLoader.d.ts +7 -0
  55. package/src/loaders/patchNextClientPageLoader.js +43 -0
  56. package/src/loaders/patchNextClientPageLoader.js.map +1 -0
  57. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
  58. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
  59. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
  60. package/src/plugins/ChildFederationPlugin.d.ts +9 -0
  61. package/src/plugins/ChildFederationPlugin.js +281 -0
  62. package/src/plugins/ChildFederationPlugin.js.map +1 -0
  63. package/src/plugins/DevHmrFixInvalidPongPlugin.d.ts +11 -0
  64. package/src/plugins/DevHmrFixInvalidPongPlugin.js +55 -0
  65. package/src/plugins/DevHmrFixInvalidPongPlugin.js.map +1 -0
  66. package/src/plugins/ModuleFederationPlugin.d.ts +7 -0
  67. package/src/plugins/ModuleFederationPlugin.js +50 -0
  68. package/src/plugins/ModuleFederationPlugin.js.map +1 -0
  69. package/src/plugins/NextFederationPlugin.d.ts +9 -0
  70. package/src/plugins/NextFederationPlugin.js +111 -0
  71. package/src/plugins/NextFederationPlugin.js.map +1 -0
  72. package/src/plugins/RemoveRRRuntimePlugin.d.ts +5 -0
  73. package/src/plugins/RemoveRRRuntimePlugin.js +39 -0
  74. package/src/plugins/RemoveRRRuntimePlugin.js.map +1 -0
  75. package/utils/Template.d.ts +148 -0
  76. package/utils/Template.js +381 -0
  77. package/utils/Template.js.map +1 -0
  78. package/utils/build-utils.d.ts +3 -0
  79. package/utils/build-utils.js +175 -0
  80. package/utils/build-utils.js.map +1 -0
  81. package/utils/index.d.ts +1 -0
  82. package/utils/index.js +7 -0
  83. package/utils/index.js.map +1 -0
  84. package/.prettierignore +0 -2
  85. package/.prettierrc +0 -7
  86. package/LICENSE +0 -21
  87. package/lib/ModuleFederationPlugin.js +0 -84
  88. package/lib/NextFederationPlugin.js +0 -513
  89. package/lib/_virtual/Template.js +0 -7
  90. package/lib/_virtual/UrlNode.js +0 -9
  91. package/lib/_virtual/_commonjsHelpers.js +0 -44
  92. package/lib/_virtual/_fast-glob.js +0 -16
  93. package/lib/_virtual/_fs.js +0 -16
  94. package/lib/_virtual/_path.js +0 -16
  95. package/lib/_virtual/_tslib.js +0 -277
  96. package/lib/_virtual/_webpack-sources.js +0 -16
  97. package/lib/_virtual/fs.js +0 -4
  98. package/lib/_virtual/fs2.js +0 -7
  99. package/lib/_virtual/helpers.js +0 -7
  100. package/lib/_virtual/nextPageMapLoader.js +0 -7
  101. package/lib/_virtual/options.js +0 -7
  102. package/lib/_virtual/utils.js +0 -7
  103. package/lib/build-utils.js +0 -176
  104. package/lib/client/CombinedPages.d.ts.map +0 -1
  105. package/lib/client/CombinedPages.js +0 -60
  106. package/lib/client/MFClient.d.ts.map +0 -1
  107. package/lib/client/MFClient.js +0 -213
  108. package/lib/client/RemoteContainer.d.ts.map +0 -1
  109. package/lib/client/RemoteContainer.js +0 -162
  110. package/lib/client/RemotePages.d.ts.map +0 -1
  111. package/lib/client/RemotePages.js +0 -194
  112. package/lib/client/UrlNode.d.ts.map +0 -1
  113. package/lib/client/helpers.d.ts.map +0 -1
  114. package/lib/client/useMFClient.d.ts.map +0 -1
  115. package/lib/client/useMFClient.js +0 -79
  116. package/lib/client/useMFRemote.d.ts.map +0 -1
  117. package/lib/client/useMFRemote.js +0 -72
  118. package/lib/dependencies/webpack/lib/Template.js +0 -437
  119. package/lib/dependencies/webpack/lib/container/options.js +0 -102
  120. package/lib/dependencies/webpack/lib/sharing/utils.js +0 -104
  121. package/lib/dependencies/webpack/lib/util/fs.js +0 -359
  122. package/lib/index.js +0 -3
  123. package/lib/internal.js +0 -271
  124. package/lib/loaders/UrlNode.js +0 -219
  125. package/lib/loaders/fixImageLoader.js +0 -65
  126. package/lib/loaders/fixUrlLoader.js +0 -25
  127. package/lib/loaders/helpers.js +0 -60
  128. package/lib/loaders/nextPageMapLoader.js +0 -200
  129. package/lib/loaders/patchNextClientPageLoader.js +0 -53
  130. package/lib/plugins/DevHmrFixInvalidPongPlugin.js +0 -82
  131. package/lib/utils.js +0 -125
  132. package/node-plugin/README.md +0 -27
  133. package/node-plugin/package.json +0 -4
  134. package/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -89
  135. package/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -410
  136. package/node-plugin/streaming/NodeRuntime.js +0 -245
  137. package/node-plugin/streaming/index.js +0 -42
  138. package/node-plugin/streaming/loadScript.js +0 -51
  139. package/tsconfig.json +0 -33
@@ -1,42 +0,0 @@
1
- import CommonJsChunkLoadingPlugin from './CommonJsChunkLoadingPlugin';
2
-
3
- class NodeSoftwareStreamRuntime {
4
- constructor(options, context) {
5
- this.options = options || {};
6
- this.context = context || {};
7
- }
8
-
9
- apply(compiler) {
10
- if (compiler.options.target) {
11
- console.warn(
12
- `target should be set to false while using NodeSoftwareStreamRuntime plugin, actual target: ${compiler.options.target}`
13
- );
14
- }
15
-
16
- // When used with Next.js, context is needed to use Next.js webpack
17
- const { webpack } = compiler;
18
-
19
- // This will enable CommonJsChunkFormatPlugin
20
- compiler.options.output.chunkFormat = 'commonjs';
21
- // This will force async chunk loading
22
- compiler.options.output.chunkLoading = 'async-node';
23
- // Disable default config
24
- compiler.options.output.enabledChunkLoadingTypes = false;
25
-
26
- new ((webpack && webpack.node && webpack.node.NodeEnvironmentPlugin) ||
27
- require('webpack/lib/node/NodeEnvironmentPlugin'))({
28
- infrastructureLogging: compiler.options.infrastructureLogging,
29
- }).apply(compiler);
30
- new ((webpack && webpack.node && webpack.node.NodeTargetPlugin) ||
31
- require('webpack/lib/node/NodeTargetPlugin'))().apply(compiler);
32
- new CommonJsChunkLoadingPlugin({
33
- asyncChunkLoading: true,
34
- name: this.options.name,
35
- remotes: this.options.remotes,
36
- baseURI: compiler.options.output.publicPath,
37
- promiseBaseURI: this.options.promiseBaseURI,
38
- }).apply(compiler);
39
- }
40
- }
41
-
42
- export default NodeSoftwareStreamRuntime;
@@ -1,51 +0,0 @@
1
- /**
2
- * loadScript(baseURI, fileName, cb)
3
- * loadScript(scriptUrl, cb)
4
- */
5
-
6
- module.exports = `
7
- function loadScript(url,cb,chunkID) {
8
- var url;
9
- var cb = arguments[arguments.length - 1];
10
- if (typeof cb !== "function") {
11
- throw new Error("last argument should be a function");
12
- }
13
- if (arguments.length === 2) {
14
- url = arguments[0];
15
- } else if (arguments.length === 3) {
16
- url = new URL(arguments[1], arguments[0]).toString();
17
- } else {
18
- throw new Error("invalid number of arguments");
19
- }
20
- if(global.webpackChunkLoad){
21
- global.webpackChunkLoad(url).then(function(resp){
22
- return resp.text();
23
- }).then(function(rawData){
24
- cb(null, rawData);
25
- }).catch(function(err){
26
- console.error('Federated Chunk load failed', error);
27
- return cb(error)
28
- });
29
- } else {
30
- //TODO https support
31
- let request = (url.startsWith('https') ? require('https') : require('http')).get(url, function (resp) {
32
- if (resp.statusCode === 200) {
33
- let rawData = '';
34
- resp.setEncoding('utf8');
35
- resp.on('data', chunk => {
36
- rawData += chunk;
37
- });
38
- resp.on('end', () => {
39
- cb(null, rawData);
40
- });
41
- } else {
42
- cb(resp);
43
- }
44
- });
45
- request.on('error', error => {
46
- console.error('Federated Chunk load failed', error);
47
- return cb(error)
48
- });
49
- }
50
- }
51
- `;
package/tsconfig.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "declaration": true,
5
- "declarationMap": true,
6
- "module": "ES2020",
7
- "esModuleInterop": true,
8
- "moduleResolution": "node",
9
- "sourceMap": true,
10
- "downlevelIteration": true,
11
- "resolveJsonModule": true,
12
- "strict": false,
13
- "allowJs": true,
14
- "strictBindCallApply": true,
15
- "strictNullChecks": true,
16
- "strictPropertyInitialization": false,
17
- "suppressImplicitAnyIndexErrors": true,
18
- "importHelpers": false,
19
- "noImplicitAny": true,
20
- "noImplicitReturns": true,
21
- "noImplicitThis": true,
22
- "noFallthroughCasesInSwitch": true,
23
- "noUnusedParameters": false,
24
- "noUnusedLocals": false,
25
- "noEmitOnError": false,
26
- "forceConsistentCasingInFileNames": true,
27
- "skipLibCheck": true,
28
- "lib": ["dom", "ESNext"],
29
- "jsx": "react",
30
- },
31
- "exclude": ["node_modules"],
32
- "include": ["src/client/**/*"]
33
- }