@module-federation/nextjs-mf 6.5.1 → 6.5.2-beta.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/CHANGELOG.md +272 -0
- package/README.md +3 -2
- package/package.json +5 -6
- package/src/default-delegate.d.ts +2 -0
- package/src/default-delegate.js +17 -0
- package/src/default-delegate.js.map +1 -0
- package/src/delegate-hoist-container.js +2 -0
- package/src/delegate-hoist-container.js.map +1 -0
- package/src/federation-noop.d.ts +1 -0
- package/src/federation-noop.js +3 -0
- package/src/federation-noop.js.map +1 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +6 -5
- package/src/index.js.map +1 -1
- package/src/internal-delegate-hoist.js +1 -0
- package/src/internal-delegate-hoist.js.map +1 -1
- package/src/internal.d.ts +38 -9
- package/src/internal.js +164 -251
- package/src/internal.js.map +1 -1
- package/src/loaders/delegateLoader.js +2 -4
- package/src/loaders/delegateLoader.js.map +1 -1
- package/src/loaders/inject-hoist.d.ts +3 -0
- package/src/loaders/inject-hoist.js +8 -0
- package/src/loaders/inject-hoist.js.map +1 -0
- package/src/loaders/nextPageMapLoader.js +0 -2
- package/src/loaders/nextPageMapLoader.js.map +1 -1
- package/src/loaders/patchDefaultSharedLoader.d.ts +0 -5
- package/src/loaders/patchDefaultSharedLoader.js +20 -16
- package/src/loaders/patchDefaultSharedLoader.js.map +1 -1
- package/src/plugins/CopyFederationPlugin.d.ts +7 -0
- package/src/plugins/CopyFederationPlugin.js +48 -0
- package/src/plugins/CopyFederationPlugin.js.map +1 -0
- package/src/plugins/JsonpChunkLoading.d.ts +7 -0
- package/src/plugins/JsonpChunkLoading.js +41 -0
- package/src/plugins/JsonpChunkLoading.js.map +1 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +24 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.js +78 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +53 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.js +159 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -0
- package/src/plugins/NextFederationPlugin/index.d.ts +18 -0
- package/src/plugins/NextFederationPlugin/index.js +136 -0
- package/src/plugins/NextFederationPlugin/index.js.map +1 -0
- package/src/plugins/NextFederationPlugin/next-fragments.d.ts +33 -0
- package/src/plugins/NextFederationPlugin/next-fragments.js +79 -0
- package/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -0
- package/src/plugins/NextFederationPlugin/regex-equal.d.ts +14 -0
- package/src/plugins/NextFederationPlugin/regex-equal.js +25 -0
- package/src/plugins/NextFederationPlugin/regex-equal.js.map +1 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +1 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +20 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +1 -0
- package/src/plugins/NextFederationPlugin/set-options.d.ts +20 -0
- package/src/plugins/NextFederationPlugin/set-options.js +33 -0
- package/src/plugins/NextFederationPlugin/set-options.js.map +1 -0
- package/src/plugins/NextFederationPlugin/validate-options.d.ts +26 -0
- package/src/plugins/NextFederationPlugin/validate-options.js +46 -0
- package/src/plugins/NextFederationPlugin/validate-options.js.map +1 -0
- package/src/plugins/container/InvertedContainerPlugin.d.ts +30 -0
- package/src/plugins/container/InvertedContainerPlugin.js +167 -0
- package/src/plugins/container/InvertedContainerPlugin.js.map +1 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.d.ts +45 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.js +521 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +17 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +91 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +1 -0
- package/src/plugins/container/custom-jsonp.d.ts +2 -0
- package/src/plugins/container/custom-jsonp.js +122 -0
- package/src/plugins/container/custom-jsonp.js.map +1 -0
- package/src/plugins/container/types.d.ts +2 -0
- package/src/plugins/container/types.js +3 -0
- package/src/plugins/container/types.js.map +1 -0
- package/utils/Template.d.ts +1 -1
- package/utils/Template.js +1 -1
- package/utils/Template.js.map +1 -1
- package/utils/build-utils.d.ts +0 -8
- package/utils/build-utils.js +1 -228
- package/utils/build-utils.js.map +1 -1
- package/utils/flushedChunks.d.ts +7 -0
- package/utils/flushedChunks.js +37 -0
- package/utils/flushedChunks.js.map +1 -0
- package/utils/index.d.ts +4 -12
- package/utils/index.js +7 -35
- package/utils/index.js.map +1 -1
- package/src/include-defaults.js +0 -16
- package/src/include-defaults.js.map +0 -1
- package/src/loaders/async-boundary-loader.d.ts +0 -2
- package/src/loaders/async-boundary-loader.js +0 -69
- package/src/loaders/async-boundary-loader.js.map +0 -1
- package/src/plugins/ChildFederationPlugin.d.ts +0 -11
- package/src/plugins/ChildFederationPlugin.js +0 -299
- package/src/plugins/ChildFederationPlugin.js.map +0 -1
- package/src/plugins/ModuleFederationPlugin.d.ts +0 -7
- package/src/plugins/ModuleFederationPlugin.js +0 -50
- package/src/plugins/ModuleFederationPlugin.js.map +0 -1
- package/src/plugins/NextFederationPlugin.d.ts +0 -9
- package/src/plugins/NextFederationPlugin.js +0 -234
- package/src/plugins/NextFederationPlugin.js.map +0 -1
- package/src/plugins/RemoveRRRuntimePlugin.d.ts +0 -5
- package/src/plugins/RemoveRRRuntimePlugin.js +0 -40
- package/src/plugins/RemoveRRRuntimePlugin.js.map +0 -1
- /package/src/{include-defaults.d.ts → delegate-hoist-container.d.ts} +0 -0
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* Requires `include-defaults.js` with required shared libs
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
3
|
function patchDefaultSharedLoader(content) {
|
|
11
|
-
if (content.includes('
|
|
4
|
+
if (content.includes('placeholderModuleEnsure')) {
|
|
12
5
|
// If already patched, return
|
|
13
6
|
return content;
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
const patch = `
|
|
9
|
+
(globalThis || self).placeholderModuleEnsure = () => {
|
|
10
|
+
throw new Error('should not exec');
|
|
11
|
+
import('react');
|
|
12
|
+
import('react-dom');
|
|
13
|
+
import('next/link');
|
|
14
|
+
import('next/router');
|
|
15
|
+
import('next/head');
|
|
16
|
+
import('next/script');
|
|
17
|
+
import('next/dynamic');
|
|
18
|
+
import('styled-jsx');
|
|
19
|
+
import('styled-jsx/style');
|
|
20
|
+
if (process.env['NODE_ENV'] === 'development') {
|
|
21
|
+
import('react/jsx-dev-runtime');
|
|
22
|
+
} else {
|
|
23
|
+
import('react/jsx-runtime');
|
|
24
|
+
}
|
|
25
|
+
};`;
|
|
26
|
+
return ['', patch, content].join('\n');
|
|
23
27
|
}
|
|
24
28
|
exports.default = patchDefaultSharedLoader;
|
|
25
29
|
//# sourceMappingURL=patchDefaultSharedLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patchDefaultSharedLoader.js","sourceRoot":"","sources":["../../../../../packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patchDefaultSharedLoader.js","sourceRoot":"","sources":["../../../../../packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts"],"names":[],"mappings":";;AAIA,SAAwB,wBAAwB,CAE9C,OAAe;IAEf,IAAI,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE;QAC/C,6BAA6B;QAC7B,OAAO,OAAO,CAAC;KAChB;IAED,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;GAiBb,CAAC;IACF,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AA5BD,2CA4BC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
class CopyBuildOutputPlugin {
|
|
7
|
+
constructor(isServer) {
|
|
8
|
+
this.isServer = isServer;
|
|
9
|
+
}
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
const copyFiles = (source, destination) => {
|
|
12
|
+
const files = fs_1.default.readdirSync(source);
|
|
13
|
+
files.forEach((file) => {
|
|
14
|
+
const sourcePath = path_1.default.join(source, file);
|
|
15
|
+
const destinationPath = path_1.default.join(destination, file);
|
|
16
|
+
if (fs_1.default.lstatSync(sourcePath).isDirectory()) {
|
|
17
|
+
if (!fs_1.default.existsSync(destinationPath)) {
|
|
18
|
+
fs_1.default.mkdirSync(destinationPath);
|
|
19
|
+
}
|
|
20
|
+
copyFiles(sourcePath, destinationPath);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
fs_1.default.copyFileSync(sourcePath, destinationPath);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
compiler.hooks.afterEmit.tapAsync('CopyBuildOutputPlugin', (compilation, callback) => {
|
|
28
|
+
const { outputPath } = compiler;
|
|
29
|
+
const outputString = outputPath.split('server')[0];
|
|
30
|
+
const isProd = compiler.options.mode === 'production';
|
|
31
|
+
if (!isProd && !this.isServer) {
|
|
32
|
+
return callback();
|
|
33
|
+
}
|
|
34
|
+
const serverLoc = path_1.default.join(outputString, this.isServer && isProd ? '/ssr' : '/static/ssr');
|
|
35
|
+
const servingLoc = path_1.default.join(outputPath, 'ssr');
|
|
36
|
+
if (!fs_1.default.existsSync(serverLoc)) {
|
|
37
|
+
fs_1.default.mkdirSync(serverLoc, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
const sourcePath = this.isServer ? outputPath : servingLoc;
|
|
40
|
+
if (fs_1.default.existsSync(sourcePath)) {
|
|
41
|
+
copyFiles(sourcePath, serverLoc);
|
|
42
|
+
}
|
|
43
|
+
callback();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = CopyBuildOutputPlugin;
|
|
48
|
+
//# sourceMappingURL=CopyFederationPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyFederationPlugin.js","sourceRoot":"","sources":["../../../../../packages/nextjs-mf/src/plugins/CopyFederationPlugin.ts"],"names":[],"mappings":";;;AAAA,oDAAoB;AACpB,wDAAwB;AAGxB,MAAM,qBAAqB;IAGzB,YAAY,QAAiB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAQ,EAAE;YAC9D,MAAM,KAAK,GAAG,YAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAErC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrB,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC3C,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAErD,IAAI,YAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,EAAE;oBAC1C,IAAI,CAAC,YAAE,CAAC,UAAU,CA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EAAE,SAAS,CAAC,CAAC;aAClC;YACD,QAAQ,EAAE,CAAC;QACb,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
5
|
+
const Template_1 = tslib_1.__importDefault(require("../../utils/Template"));
|
|
6
|
+
const custom_jsonp_1 = tslib_1.__importDefault(require("./container/custom-jsonp"));
|
|
7
|
+
function getCustomJsonpCode(chunkLoadingGlobal, RuntimeGlobals) {
|
|
8
|
+
const code = [
|
|
9
|
+
'var chunkQueue = [];',
|
|
10
|
+
'var chunkTracker = [];',
|
|
11
|
+
`var chunkLoadingGlobal = self[${JSON.stringify(chunkLoadingGlobal)}] || [];`,
|
|
12
|
+
'var asyncQueue = [];',
|
|
13
|
+
custom_jsonp_1.default,
|
|
14
|
+
];
|
|
15
|
+
return Template_1.default.asString(code);
|
|
16
|
+
}
|
|
17
|
+
class CustomWebpackPlugin {
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.options = options || {};
|
|
20
|
+
}
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
compiler.hooks.compilation.tap('CustomWebpackPlugin', (compilation) => {
|
|
23
|
+
compilation.hooks.runtimeModule.tap('CustomWebpackPlugin', (runtimeModule, chunk) => {
|
|
24
|
+
if (this.options.server && chunk.name === 'webpack-runtime') {
|
|
25
|
+
// if server runtime module
|
|
26
|
+
}
|
|
27
|
+
if (runtimeModule.constructor.name ===
|
|
28
|
+
'JsonpChunkLoadingRuntimeModule' &&
|
|
29
|
+
chunk.name === 'webpack') {
|
|
30
|
+
const originalSource = runtimeModule.getGeneratedCode();
|
|
31
|
+
const modifiedSource = new webpack_sources_1.ConcatSource(originalSource, '\n', getCustomJsonpCode(
|
|
32
|
+
//@ts-ignore
|
|
33
|
+
compilation.outputOptions.chunkLoadingGlobal, compiler.webpack.RuntimeGlobals));
|
|
34
|
+
runtimeModule.getGeneratedCode = () => modifiedSource.source();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = CustomWebpackPlugin;
|
|
41
|
+
//# sourceMappingURL=JsonpChunkLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonpChunkLoading.js","sourceRoot":"","sources":["../../../../../packages/nextjs-mf/src/plugins/JsonpChunkLoading.ts"],"names":[],"mappings":";;;AAQA,qDAA+C;AAG/C,4EAA4C;AAC5C,oFAAgD;AAEhD,SAAS,kBAAkB,CACzB,kBAA0B,EAC1B,cAAmB;IAEnB,MAAM,IAAI,GAAG;QACX,sBAAsB;QACtB,wBAAwB;QACxB,iCAAiC,IAAI,CAAC,SAAS,CAC7C,kBAAkB,CACnB,UAAU;QACX,sBAAsB;QACtB,sBAAQ;KACT,CAAC;IACF,OAAO,kBAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,mBAAmB;IAGvB,YAAY,OAAa;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAC5B,qBAAqB,EACrB,CAAC,WAAwB,EAAE,EAAE;YAC3B,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CACjC,qBAAqB,EACrB,CAAC,aAA4B,EAAE,KAAU,EAAE,EAAE;gBAC3C,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE;oBAC3D,2BAA2B;iBAC5B;gBAED,IACE,aAAa,CAAC,WAAW,CAAC,IAAI;oBAC5B,gCAAgC;oBAClC,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB;oBACA,MAAM,cAAc,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;oBACxD,MAAM,cAAc,GAAG,IAAI,8BAAY,CACrC,cAAc,EACd,IAAI,EACJ,kBAAkB;oBAChB,YAAY;oBACZ,WAAW,CAAC,aAAa,CAAC,kBAAkB,EAC5C,QAAQ,CAAC,OAAO,CAAC,cAAc,CAChC,CACF,CAAC;oBACF,aAAa,CAAC,gBAAgB,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;iBAChE;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
import { ModuleFederationPluginOptions, NextFederationPluginExtraOptions } from '@module-federation/utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Applies client-specific plugins.
|
|
5
|
+
*
|
|
6
|
+
* @param compiler - The Webpack compiler instance.
|
|
7
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
8
|
+
* @param extraOptions - The NextFederationPluginExtraOptions instance.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This function applies plugins to the Webpack compiler instance that are specific to the client build of
|
|
12
|
+
* a Next.js application with Module Federation enabled. These plugins include the following:
|
|
13
|
+
*
|
|
14
|
+
* - AddModulesPlugin: Adds modules to the webpack container runtime that can be streamed to other runtimes.
|
|
15
|
+
* - EntryPlugin: Creates an entry point for the application that delegates module loading to the container runtime.
|
|
16
|
+
* - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.
|
|
17
|
+
* - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its
|
|
18
|
+
* own remote interface at startup.
|
|
19
|
+
*
|
|
20
|
+
* If automatic page stitching is enabled, a loader is added to process the `next/dist/client/page-loader.js`
|
|
21
|
+
* file. If a custom library is specified in the options, an error is thrown. The options.library property is
|
|
22
|
+
* also set to `{ type: 'window', name: options.name }`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyClientPlugins(compiler: Compiler, options: ModuleFederationPluginOptions, extraOptions: NextFederationPluginExtraOptions): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyClientPlugins = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const DelegateModulesPlugin_1 = tslib_1.__importDefault(require("@module-federation/utilities/src/plugins/DelegateModulesPlugin"));
|
|
6
|
+
const node_1 = require("@module-federation/node");
|
|
7
|
+
const InvertedContainerPlugin_1 = tslib_1.__importDefault(require("../container/InvertedContainerPlugin"));
|
|
8
|
+
const JsonpChunkLoading_1 = tslib_1.__importDefault(require("../JsonpChunkLoading"));
|
|
9
|
+
/**
|
|
10
|
+
* Applies client-specific plugins.
|
|
11
|
+
*
|
|
12
|
+
* @param compiler - The Webpack compiler instance.
|
|
13
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
14
|
+
* @param extraOptions - The NextFederationPluginExtraOptions instance.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This function applies plugins to the Webpack compiler instance that are specific to the client build of
|
|
18
|
+
* a Next.js application with Module Federation enabled. These plugins include the following:
|
|
19
|
+
*
|
|
20
|
+
* - AddModulesPlugin: Adds modules to the webpack container runtime that can be streamed to other runtimes.
|
|
21
|
+
* - EntryPlugin: Creates an entry point for the application that delegates module loading to the container runtime.
|
|
22
|
+
* - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.
|
|
23
|
+
* - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its
|
|
24
|
+
* own remote interface at startup.
|
|
25
|
+
*
|
|
26
|
+
* If automatic page stitching is enabled, a loader is added to process the `next/dist/client/page-loader.js`
|
|
27
|
+
* file. If a custom library is specified in the options, an error is thrown. The options.library property is
|
|
28
|
+
* also set to `{ type: 'window', name: options.name }`.
|
|
29
|
+
*/
|
|
30
|
+
function applyClientPlugins(compiler, options, extraOptions) {
|
|
31
|
+
const { webpack } = compiler;
|
|
32
|
+
const { remotes, name } = options;
|
|
33
|
+
//@ts-ignore
|
|
34
|
+
compiler.options.output.publicPath = 'auto';
|
|
35
|
+
// Build will hang without this. Likely something in my plugin
|
|
36
|
+
compiler.options.optimization.chunkIds = 'named';
|
|
37
|
+
compiler.options.optimization.splitChunks = undefined;
|
|
38
|
+
// Add a new plugin to hoist modules into remote runtime
|
|
39
|
+
new JsonpChunkLoading_1.default().apply(compiler);
|
|
40
|
+
new DelegateModulesPlugin_1.default({
|
|
41
|
+
container: name,
|
|
42
|
+
runtime: 'webpack',
|
|
43
|
+
remotes,
|
|
44
|
+
}).apply(compiler);
|
|
45
|
+
// If automatic page stitching is enabled, add a new rule to the compiler's module rules
|
|
46
|
+
if (extraOptions.automaticPageStitching) {
|
|
47
|
+
console.warn('[nextjs-mf]', 'automatic page stitching is disabled in v7');
|
|
48
|
+
// compiler.options.module.rules.push({
|
|
49
|
+
// test: /next[\\/]dist[\\/]client[\\/]page-loader\.js$/,
|
|
50
|
+
// loader: path.resolve(
|
|
51
|
+
// __dirname,
|
|
52
|
+
// '../../loaders/patchNextClientPageLoader'
|
|
53
|
+
// ),
|
|
54
|
+
// });
|
|
55
|
+
}
|
|
56
|
+
// If a custom library is set, log an error message
|
|
57
|
+
if (options.library) {
|
|
58
|
+
console.error('[nextjs-mf] you cannot set custom library');
|
|
59
|
+
}
|
|
60
|
+
// Set the library option to be a window object with the name of the module federation plugin
|
|
61
|
+
options.library = {
|
|
62
|
+
type: 'window',
|
|
63
|
+
name,
|
|
64
|
+
};
|
|
65
|
+
// Add a new chunk correlation plugin to the compiler
|
|
66
|
+
new node_1.ChunkCorrelationPlugin({
|
|
67
|
+
filename: 'static/chunks/federated-stats.json',
|
|
68
|
+
}).apply(compiler);
|
|
69
|
+
// Add a new commonjs chunk loading plugin to the compiler
|
|
70
|
+
new InvertedContainerPlugin_1.default({
|
|
71
|
+
runtime: 'webpack',
|
|
72
|
+
container: options.name,
|
|
73
|
+
remotes: options.remotes,
|
|
74
|
+
debug: false,
|
|
75
|
+
}).apply(compiler);
|
|
76
|
+
}
|
|
77
|
+
exports.applyClientPlugins = applyClientPlugins;
|
|
78
|
+
//# sourceMappingURL=apply-client-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-client-plugins.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-client-plugins.ts"],"names":[],"mappings":";;;;AAKA,mIAAmG;AAEnG,kDAAiE;AACjE,2GAA2E;AAC3E,qFAAqD;AACrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,kBAAkB,CAChC,QAAkB,EAClB,OAAsC,EACtC,YAA8C;IAE9C,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAClC,YAAY;IACZ,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,GAAG,OAAO,CAAC;IACjD,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,GAAG,SAAS,CAAC;IAEtD,wDAAwD;IACxD,IAAI,2BAAiB,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,+BAAqB,CAAC;QACxB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,SAAS;QAClB,OAAO;KACR,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEnB,wFAAwF;IACxF,IAAI,YAAY,CAAC,sBAAsB,EAAE;QACvC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,4CAA4C,CAAC,CAAC;QAC1E,yCAAyC;QACzC,6DAA6D;QAC7D,4BAA4B;QAC5B,mBAAmB;QACnB,kDAAkD;QAClD,SAAS;QACT,QAAQ;KACT;IAED,mDAAmD;IACnD,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC5D;IAED,6FAA6F;IAC7F,OAAO,CAAC,OAAO,GAAG;QAChB,IAAI,EAAE,QAAQ;QACd,IAAI;KACL,CAAC;IAEF,qDAAqD;IACrD,IAAI,6BAAsB,CAAC;QACzB,QAAQ,EAAE,oCAAoC;KAC/C,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEnB,0DAA0D;IAC1D,IAAI,iCAAuB,CAAC;QAC1B,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,OAAO,CAAC,IAAI;QACvB,OAAO,EAAE,OAAO,CAAC,OAAiC;QAClD,KAAK,EAAE,KAAK;KACb,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACrB,CAAC;AAxDD,gDAwDC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
import { ModuleFederationPluginOptions } from '@module-federation/utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Applies server-specific plugins.
|
|
5
|
+
*
|
|
6
|
+
* @param compiler - The Webpack compiler instance.
|
|
7
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyServerPlugins(compiler: Compiler, options: ModuleFederationPluginOptions): void;
|
|
11
|
+
/**
|
|
12
|
+
* Configures server-specific library and filename options.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This function configures the library and filename options for server builds. The library option is
|
|
18
|
+
* set to the commonjs-module format for chunks and the container, which allows them to be streamed over
|
|
19
|
+
* to hosts with the NodeFederationPlugin. The filename option is set to the basename of the current
|
|
20
|
+
* filename.
|
|
21
|
+
*/
|
|
22
|
+
export declare function configureServerLibraryAndFilename(options: ModuleFederationPluginOptions): void;
|
|
23
|
+
/**
|
|
24
|
+
* Patches Next.js' default externals function to make sure shared modules are bundled and not treated as external.
|
|
25
|
+
*
|
|
26
|
+
* @param compiler - The Webpack compiler instance.
|
|
27
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* In server builds, all node modules are treated as external, which prevents them from being shared
|
|
31
|
+
* via module federation. To work around this limitation, we mark shared modules as internalizable
|
|
32
|
+
* modules that webpack puts into chunks that can be streamed to other runtimes as needed.
|
|
33
|
+
*
|
|
34
|
+
* This function replaces Next.js' default externals function with a new asynchronous function that
|
|
35
|
+
* checks whether a module should be treated as external. If the module should not be treated as
|
|
36
|
+
* external, the function returns without calling the original externals function. Otherwise, the
|
|
37
|
+
* function calls the original externals function and retrieves the result. If the result is null,
|
|
38
|
+
* the function returns without further processing. If the module is from Next.js or React, the
|
|
39
|
+
* function returns the original result. Otherwise, the function returns null.
|
|
40
|
+
*/
|
|
41
|
+
export declare function handleServerExternals(compiler: Compiler, options: ModuleFederationPluginOptions): void;
|
|
42
|
+
/**
|
|
43
|
+
* Configures server-specific compiler options.
|
|
44
|
+
*
|
|
45
|
+
* @param compiler - The Webpack compiler instance.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* This function configures the compiler options for server builds. It turns off the compiler target on node
|
|
49
|
+
* builds because it adds its own chunk loading runtime module with NodeFederationPlugin and StreamingTargetPlugin.
|
|
50
|
+
* It also disables split chunks to prevent conflicts from occurring in the graph.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export declare function configureServerCompilerOptions(compiler: Compiler): void;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureServerCompilerOptions = exports.handleServerExternals = exports.configureServerLibraryAndFilename = exports.applyServerPlugins = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const DelegateModulesPlugin_1 = tslib_1.__importDefault(require("@module-federation/utilities/src/plugins/DelegateModulesPlugin"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const InvertedContainerPlugin_1 = tslib_1.__importDefault(require("../container/InvertedContainerPlugin"));
|
|
8
|
+
const JsonpChunkLoading_1 = tslib_1.__importDefault(require("../JsonpChunkLoading"));
|
|
9
|
+
/**
|
|
10
|
+
* Applies server-specific plugins.
|
|
11
|
+
*
|
|
12
|
+
* @param compiler - The Webpack compiler instance.
|
|
13
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
function applyServerPlugins(compiler, options) {
|
|
17
|
+
// Import the StreamingTargetPlugin from @module-federation/node
|
|
18
|
+
const { StreamingTargetPlugin } = require('@module-federation/node');
|
|
19
|
+
new JsonpChunkLoading_1.default({ server: true }).apply(compiler);
|
|
20
|
+
new DelegateModulesPlugin_1.default({
|
|
21
|
+
runtime: 'webpack-runtime',
|
|
22
|
+
remotes: options.remotes,
|
|
23
|
+
container: options.name,
|
|
24
|
+
}).apply(compiler);
|
|
25
|
+
// Add the StreamingTargetPlugin with the ModuleFederationPlugin from the webpack container
|
|
26
|
+
new StreamingTargetPlugin(options, {
|
|
27
|
+
ModuleFederationPlugin: compiler.webpack.container.ModuleFederationPlugin,
|
|
28
|
+
}).apply(compiler);
|
|
29
|
+
// Add a new commonjs chunk loading plugin to the compiler
|
|
30
|
+
new InvertedContainerPlugin_1.default({
|
|
31
|
+
runtime: 'webpack-runtime',
|
|
32
|
+
container: options.name,
|
|
33
|
+
remotes: options.remotes,
|
|
34
|
+
debug: false,
|
|
35
|
+
}).apply(compiler);
|
|
36
|
+
}
|
|
37
|
+
exports.applyServerPlugins = applyServerPlugins;
|
|
38
|
+
/**
|
|
39
|
+
* Configures server-specific library and filename options.
|
|
40
|
+
*
|
|
41
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This function configures the library and filename options for server builds. The library option is
|
|
45
|
+
* set to the commonjs-module format for chunks and the container, which allows them to be streamed over
|
|
46
|
+
* to hosts with the NodeFederationPlugin. The filename option is set to the basename of the current
|
|
47
|
+
* filename.
|
|
48
|
+
*/
|
|
49
|
+
function configureServerLibraryAndFilename(options) {
|
|
50
|
+
// Configure the library option with type "commonjs-module" and the name from the options
|
|
51
|
+
options.library = {
|
|
52
|
+
type: 'commonjs-module',
|
|
53
|
+
name: options.name,
|
|
54
|
+
};
|
|
55
|
+
// Set the filename option to the basename of the current filename
|
|
56
|
+
options.filename = path_1.default.basename(options.filename);
|
|
57
|
+
}
|
|
58
|
+
exports.configureServerLibraryAndFilename = configureServerLibraryAndFilename;
|
|
59
|
+
/**
|
|
60
|
+
* Patches Next.js' default externals function to make sure shared modules are bundled and not treated as external.
|
|
61
|
+
*
|
|
62
|
+
* @param compiler - The Webpack compiler instance.
|
|
63
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* In server builds, all node modules are treated as external, which prevents them from being shared
|
|
67
|
+
* via module federation. To work around this limitation, we mark shared modules as internalizable
|
|
68
|
+
* modules that webpack puts into chunks that can be streamed to other runtimes as needed.
|
|
69
|
+
*
|
|
70
|
+
* This function replaces Next.js' default externals function with a new asynchronous function that
|
|
71
|
+
* checks whether a module should be treated as external. If the module should not be treated as
|
|
72
|
+
* external, the function returns without calling the original externals function. Otherwise, the
|
|
73
|
+
* function calls the original externals function and retrieves the result. If the result is null,
|
|
74
|
+
* the function returns without further processing. If the module is from Next.js or React, the
|
|
75
|
+
* function returns the original result. Otherwise, the function returns null.
|
|
76
|
+
*/
|
|
77
|
+
function handleServerExternals(compiler, options) {
|
|
78
|
+
// Check if the compiler has an `externals` array
|
|
79
|
+
if (Array.isArray(compiler.options.externals) &&
|
|
80
|
+
compiler.options.externals[0]) {
|
|
81
|
+
// Retrieve the original externals function
|
|
82
|
+
const originalExternals = compiler.options.externals[0];
|
|
83
|
+
// Replace the original externals function with a new asynchronous function
|
|
84
|
+
compiler.options.externals[0] = async function (ctx, callback) {
|
|
85
|
+
// Check if the module should not be treated as external
|
|
86
|
+
if (ctx.request &&
|
|
87
|
+
(ctx.request.includes('@module-federation/utilities') ||
|
|
88
|
+
ctx.request.includes('internal-delegate-hoist') ||
|
|
89
|
+
Object.keys(options.shared || {}).some((key) => {
|
|
90
|
+
return (
|
|
91
|
+
//@ts-ignore
|
|
92
|
+
options.shared?.[key]?.import !== false &&
|
|
93
|
+
ctx?.request?.includes(key));
|
|
94
|
+
}) ||
|
|
95
|
+
ctx.request.includes('@module-federation/dashboard-plugin'))) {
|
|
96
|
+
// If the module should not be treated as external, return without calling the original externals function
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// seems to cause build issues at lululemon
|
|
100
|
+
// nobody else seems to run into this issue
|
|
101
|
+
// #JobSecurity
|
|
102
|
+
if (ctx.request && ctx.request.includes('react/jsx-runtime')) {
|
|
103
|
+
return 'commonjs ' + ctx.request;
|
|
104
|
+
}
|
|
105
|
+
// Call the original externals function and retrieve the result
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
const fromNext = await originalExternals(ctx, callback);
|
|
108
|
+
// If the result is null, return without further processing
|
|
109
|
+
if (!fromNext) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// If the module is from Next.js or React, return the original result
|
|
113
|
+
const req = fromNext.split(' ')[1];
|
|
114
|
+
if (req.startsWith('next') ||
|
|
115
|
+
// make sure we dont screw up package names that start with react
|
|
116
|
+
// like react-carousel or react-spring
|
|
117
|
+
req.startsWith('react/') ||
|
|
118
|
+
req.startsWith('react-dom/') ||
|
|
119
|
+
req === 'react' ||
|
|
120
|
+
req === 'react-dom') {
|
|
121
|
+
return fromNext;
|
|
122
|
+
}
|
|
123
|
+
// Otherwise, return (null) to treat the module as internalizable
|
|
124
|
+
return;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.handleServerExternals = handleServerExternals;
|
|
129
|
+
/**
|
|
130
|
+
* Configures server-specific compiler options.
|
|
131
|
+
*
|
|
132
|
+
* @param compiler - The Webpack compiler instance.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* This function configures the compiler options for server builds. It turns off the compiler target on node
|
|
136
|
+
* builds because it adds its own chunk loading runtime module with NodeFederationPlugin and StreamingTargetPlugin.
|
|
137
|
+
* It also disables split chunks to prevent conflicts from occurring in the graph.
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
function configureServerCompilerOptions(compiler) {
|
|
141
|
+
// Turn off the compiler target on node builds because we add our own chunk loading runtime module
|
|
142
|
+
// with NodeFederationPlugin and StreamingTargetPlugin
|
|
143
|
+
compiler.options.target = false;
|
|
144
|
+
compiler.options.node = {
|
|
145
|
+
...compiler.options.node,
|
|
146
|
+
global: false,
|
|
147
|
+
};
|
|
148
|
+
// Build will hang without this. Likely something in my plugin
|
|
149
|
+
compiler.options.optimization.chunkIds = 'named';
|
|
150
|
+
// no custom chunk rules
|
|
151
|
+
compiler.options.optimization.splitChunks = undefined;
|
|
152
|
+
// solves strange issues where next doesnt create a runtime chunk
|
|
153
|
+
// might be related to if an api route exists or not
|
|
154
|
+
compiler.options.optimization.runtimeChunk = {
|
|
155
|
+
name: 'webpack-runtime',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
exports.configureServerCompilerOptions = configureServerCompilerOptions;
|
|
159
|
+
//# sourceMappingURL=apply-server-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-server-plugins.js","sourceRoot":"","sources":["../../../../../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luginOptions, NextFederationPluginExtraOptions, NextFederationPluginOptions } from '@module-federation/utilities';
|
|
2
|
+
import type { Compiler } from 'webpack';
|
|
3
|
+
/**
|
|
4
|
+
* NextFederationPlugin is a webpack plugin that handles Next.js application
|
|
5
|
+
* federation using Module Federation.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NextFederationPlugin {
|
|
8
|
+
_options: ModuleFederationPluginOptions;
|
|
9
|
+
_extraOptions: NextFederationPluginExtraOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Constructs the NextFederationPlugin with the provided options.
|
|
12
|
+
*
|
|
13
|
+
* @param options The options to configure the plugin.
|
|
14
|
+
*/
|
|
15
|
+
constructor(options: NextFederationPluginOptions);
|
|
16
|
+
apply(compiler: Compiler): void;
|
|
17
|
+
}
|
|
18
|
+
export default NextFederationPlugin;
|