@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.
- package/README.md +1 -27
- package/{lib/client → client}/CombinedPages.d.ts +27 -28
- package/client/CombinedPages.js +38 -0
- package/client/CombinedPages.js.map +1 -0
- package/{lib/client → client}/MFClient.d.ts +72 -73
- package/client/MFClient.js +159 -0
- package/client/MFClient.js.map +1 -0
- package/{lib/client → client}/RemoteContainer.d.ts +46 -58
- package/client/RemoteContainer.js +121 -0
- package/client/RemoteContainer.js.map +1 -0
- package/{lib/client → client}/RemotePages.d.ts +49 -49
- package/client/RemotePages.js +138 -0
- package/client/RemotePages.js.map +1 -0
- package/{lib/client → client}/UrlNode.d.ts +17 -18
- package/{lib/client → client}/UrlNode.js +157 -161
- package/client/UrlNode.js.map +1 -0
- package/{lib/client → client}/helpers.d.ts +16 -17
- package/{lib/client → client}/helpers.js +90 -104
- package/client/helpers.js.map +1 -0
- package/client/index.d.ts +2 -0
- package/client/index.js +6 -0
- package/client/index.js.map +1 -0
- package/{lib/client → client}/useMFClient.d.ts +24 -25
- package/client/useMFClient.js +55 -0
- package/client/useMFClient.js.map +1 -0
- package/{lib/client → client}/useMFRemote.d.ts +16 -17
- package/client/useMFRemote.js +50 -0
- package/client/useMFRemote.js.map +1 -0
- package/jest.config.d.ts +13 -0
- package/jest.config.js +18 -0
- package/jest.config.js.map +1 -0
- package/package.json +19 -42
- package/src/include-defaults.d.ts +0 -0
- package/{lib → src}/include-defaults.js +4 -3
- package/src/include-defaults.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +9 -0
- package/src/index.js.map +1 -0
- package/src/internal.d.ts +12 -0
- package/src/internal.js +260 -0
- package/src/internal.js.map +1 -0
- package/src/loaders/fixImageLoader.d.ts +16 -0
- package/src/loaders/fixImageLoader.js +53 -0
- package/src/loaders/fixImageLoader.js.map +1 -0
- package/src/loaders/fixUrlLoader.d.ts +13 -0
- package/src/loaders/fixUrlLoader.js +25 -0
- package/src/loaders/fixUrlLoader.js.map +1 -0
- package/src/loaders/helpers.d.ts +10 -0
- package/src/loaders/helpers.js +46 -0
- package/src/loaders/helpers.js.map +1 -0
- package/src/loaders/nextPageMapLoader.d.ts +15 -0
- package/src/loaders/nextPageMapLoader.js +151 -0
- package/src/loaders/nextPageMapLoader.js.map +1 -0
- package/src/loaders/patchNextClientPageLoader.d.ts +7 -0
- package/src/loaders/patchNextClientPageLoader.js +43 -0
- package/src/loaders/patchNextClientPageLoader.js.map +1 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
- package/src/plugins/ChildFederationPlugin.d.ts +9 -0
- package/src/plugins/ChildFederationPlugin.js +281 -0
- package/src/plugins/ChildFederationPlugin.js.map +1 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.d.ts +11 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.js +55 -0
- package/src/plugins/DevHmrFixInvalidPongPlugin.js.map +1 -0
- package/src/plugins/ModuleFederationPlugin.d.ts +7 -0
- package/src/plugins/ModuleFederationPlugin.js +50 -0
- package/src/plugins/ModuleFederationPlugin.js.map +1 -0
- package/src/plugins/NextFederationPlugin.d.ts +9 -0
- package/src/plugins/NextFederationPlugin.js +111 -0
- package/src/plugins/NextFederationPlugin.js.map +1 -0
- package/src/plugins/RemoveRRRuntimePlugin.d.ts +5 -0
- package/src/plugins/RemoveRRRuntimePlugin.js +39 -0
- package/src/plugins/RemoveRRRuntimePlugin.js.map +1 -0
- package/utils/Template.d.ts +148 -0
- package/utils/Template.js +381 -0
- package/utils/Template.js.map +1 -0
- package/utils/build-utils.d.ts +3 -0
- package/utils/build-utils.js +175 -0
- package/utils/build-utils.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +7 -0
- package/utils/index.js.map +1 -0
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/LICENSE +0 -21
- package/lib/ModuleFederationPlugin.js +0 -84
- package/lib/NextFederationPlugin.js +0 -513
- package/lib/_virtual/Template.js +0 -7
- package/lib/_virtual/UrlNode.js +0 -9
- package/lib/_virtual/_commonjsHelpers.js +0 -44
- package/lib/_virtual/_fast-glob.js +0 -16
- package/lib/_virtual/_fs.js +0 -16
- package/lib/_virtual/_path.js +0 -16
- package/lib/_virtual/_tslib.js +0 -277
- package/lib/_virtual/_webpack-sources.js +0 -16
- package/lib/_virtual/fs.js +0 -4
- package/lib/_virtual/fs2.js +0 -7
- package/lib/_virtual/helpers.js +0 -7
- package/lib/_virtual/nextPageMapLoader.js +0 -7
- package/lib/_virtual/options.js +0 -7
- package/lib/_virtual/utils.js +0 -7
- package/lib/build-utils.js +0 -176
- package/lib/client/CombinedPages.d.ts.map +0 -1
- package/lib/client/CombinedPages.js +0 -60
- package/lib/client/MFClient.d.ts.map +0 -1
- package/lib/client/MFClient.js +0 -213
- package/lib/client/RemoteContainer.d.ts.map +0 -1
- package/lib/client/RemoteContainer.js +0 -162
- package/lib/client/RemotePages.d.ts.map +0 -1
- package/lib/client/RemotePages.js +0 -194
- package/lib/client/UrlNode.d.ts.map +0 -1
- package/lib/client/helpers.d.ts.map +0 -1
- package/lib/client/useMFClient.d.ts.map +0 -1
- package/lib/client/useMFClient.js +0 -79
- package/lib/client/useMFRemote.d.ts.map +0 -1
- package/lib/client/useMFRemote.js +0 -72
- package/lib/dependencies/webpack/lib/Template.js +0 -437
- package/lib/dependencies/webpack/lib/container/options.js +0 -102
- package/lib/dependencies/webpack/lib/sharing/utils.js +0 -104
- package/lib/dependencies/webpack/lib/util/fs.js +0 -359
- package/lib/index.js +0 -3
- package/lib/internal.js +0 -271
- package/lib/loaders/UrlNode.js +0 -219
- package/lib/loaders/fixImageLoader.js +0 -65
- package/lib/loaders/fixUrlLoader.js +0 -25
- package/lib/loaders/helpers.js +0 -60
- package/lib/loaders/nextPageMapLoader.js +0 -200
- package/lib/loaders/patchNextClientPageLoader.js +0 -53
- package/lib/plugins/DevHmrFixInvalidPongPlugin.js +0 -82
- package/lib/utils.js +0 -125
- package/node-plugin/README.md +0 -27
- package/node-plugin/package.json +0 -4
- package/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -89
- package/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -410
- package/node-plugin/streaming/NodeRuntime.js +0 -245
- package/node-plugin/streaming/index.js +0 -42
- package/node-plugin/streaming/loadScript.js +0 -51
- 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
|
-
}
|