@module-federation/nextjs-mf 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/client/UrlNode.js +92 -0
- package/dist/client/UrlNode.js.map +1 -0
- package/dist/client/UrlNode.mjs +91 -0
- package/dist/client/UrlNode.mjs.map +1 -0
- package/dist/src/federation-noop.d.mts +1 -0
- package/dist/src/federation-noop.d.ts +1 -0
- package/dist/src/federation-noop.js +17 -0
- package/dist/src/federation-noop.js.map +1 -0
- package/dist/src/federation-noop.mjs +23 -0
- package/dist/src/federation-noop.mjs.map +1 -0
- package/dist/src/index.d.mts +2 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.mjs +8 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/internal.js +152 -0
- package/dist/src/internal.js.map +1 -0
- package/dist/src/internal.mjs +152 -0
- package/dist/src/internal.mjs.map +1 -0
- package/dist/src/loaders/fixImageLoader.d.mts +27 -0
- package/dist/src/loaders/fixImageLoader.d.ts +27 -0
- package/dist/src/loaders/fixImageLoader.js +104 -0
- package/dist/src/loaders/fixImageLoader.js.map +1 -0
- package/dist/src/loaders/fixImageLoader.mjs +101 -0
- package/dist/src/loaders/fixImageLoader.mjs.map +1 -0
- package/dist/src/loaders/fixUrlLoader.d.mts +16 -0
- package/dist/src/loaders/fixUrlLoader.d.ts +16 -0
- package/dist/src/loaders/fixUrlLoader.js +22 -0
- package/dist/src/loaders/fixUrlLoader.js.map +1 -0
- package/dist/src/loaders/fixUrlLoader.mjs +19 -0
- package/dist/src/loaders/fixUrlLoader.mjs.map +1 -0
- package/dist/src/loaders/helpers.js +82 -0
- package/dist/src/loaders/helpers.js.map +1 -0
- package/dist/src/loaders/helpers.mjs +79 -0
- package/dist/src/loaders/helpers.mjs.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.d.mts +29 -0
- package/dist/src/loaders/nextPageMapLoader.d.ts +29 -0
- package/dist/src/loaders/nextPageMapLoader.js +148 -0
- package/dist/src/loaders/nextPageMapLoader.js.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.mjs +143 -0
- package/dist/src/loaders/nextPageMapLoader.mjs.map +1 -0
- package/dist/src/logger.js +9 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/logger.mjs +8 -0
- package/dist/src/logger.mjs.map +1 -0
- package/dist/src/plugins/CopyFederationPlugin.js +67 -0
- package/dist/src/plugins/CopyFederationPlugin.js.map +1 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs +65 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +41 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs +40 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +117 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs +111 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.mts +31 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.ts +31 -0
- package/dist/src/plugins/NextFederationPlugin/index.js +156 -0
- package/dist/src/plugins/NextFederationPlugin/index.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs +153 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.mts +18 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.ts +18 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js +65 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs +63 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.js +20 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs +19 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.js +37 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs +35 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.js +26 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.js.map +1 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs +27 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/container/runtimePlugin.d.mts +7 -0
- package/dist/src/plugins/container/runtimePlugin.d.ts +6 -0
- package/dist/src/plugins/container/runtimePlugin.js +168 -0
- package/dist/src/plugins/container/runtimePlugin.js.map +1 -0
- package/dist/src/plugins/container/runtimePlugin.mjs +167 -0
- package/dist/src/plugins/container/runtimePlugin.mjs.map +1 -0
- package/dist/utils/flushedChunks.d.mts +29 -0
- package/dist/utils/flushedChunks.d.ts +29 -0
- package/dist/utils/flushedChunks.js +37 -0
- package/dist/utils/flushedChunks.js.map +1 -0
- package/dist/utils/flushedChunks.mjs +35 -0
- package/dist/utils/flushedChunks.mjs.map +1 -0
- package/dist/utils/index.d.mts +14 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +22 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import logger from "../logger.mjs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { promises } from "fs";
|
|
4
|
+
import { bindLoggerToCompiler } from "@module-federation/sdk";
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/CopyFederationPlugin.ts
|
|
7
|
+
/**
|
|
8
|
+
* Plugin to copy build output files.
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
var CopyBuildOutputPlugin = class {
|
|
12
|
+
/**
|
|
13
|
+
* @param {boolean} isServer - Indicates if the current environment is server.
|
|
14
|
+
* @constructor
|
|
15
|
+
*/
|
|
16
|
+
constructor(isServer) {
|
|
17
|
+
this.isServer = isServer;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Applies the plugin to the compiler.
|
|
21
|
+
* @param {Compiler} compiler - The webpack compiler object.
|
|
22
|
+
* @method
|
|
23
|
+
*/
|
|
24
|
+
apply(compiler) {
|
|
25
|
+
bindLoggerToCompiler(logger, compiler, "CopyBuildOutputPlugin");
|
|
26
|
+
/**
|
|
27
|
+
* Copies files from source to destination.
|
|
28
|
+
* @param {string} source - The source directory.
|
|
29
|
+
* @param {string} destination - The destination directory.
|
|
30
|
+
* @async
|
|
31
|
+
* @function
|
|
32
|
+
*/
|
|
33
|
+
const copyFiles = async (source, destination) => {
|
|
34
|
+
const files = await promises.readdir(source);
|
|
35
|
+
await Promise.all(files.map(async (file) => {
|
|
36
|
+
const sourcePath = path.join(source, file);
|
|
37
|
+
const destinationPath = path.join(destination, file);
|
|
38
|
+
if ((await promises.lstat(sourcePath)).isDirectory()) {
|
|
39
|
+
await promises.mkdir(destinationPath, { recursive: true });
|
|
40
|
+
await copyFiles(sourcePath, destinationPath);
|
|
41
|
+
} else await promises.copyFile(sourcePath, destinationPath);
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
compiler.hooks.afterEmit.tapPromise("CopyBuildOutputPlugin", async (compilation) => {
|
|
45
|
+
const { outputPath } = compiler;
|
|
46
|
+
const outputString = outputPath.split("server")[0];
|
|
47
|
+
const isProd = compiler.options.mode === "production";
|
|
48
|
+
if (!isProd && !this.isServer) return;
|
|
49
|
+
const serverLoc = path.join(outputString, this.isServer && isProd ? "/ssr" : "/static/ssr");
|
|
50
|
+
const servingLoc = path.join(outputPath, "ssr");
|
|
51
|
+
await promises.mkdir(serverLoc, { recursive: true });
|
|
52
|
+
const sourcePath = this.isServer ? outputPath : servingLoc;
|
|
53
|
+
try {
|
|
54
|
+
await promises.access(sourcePath);
|
|
55
|
+
await copyFiles(sourcePath, serverLoc);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
logger.error(`File at ${sourcePath} does not exist.`);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { CopyBuildOutputPlugin as default };
|
|
65
|
+
//# sourceMappingURL=CopyFederationPlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyFederationPlugin.mjs","names":["fs"],"sources":["../../../src/plugins/CopyFederationPlugin.ts"],"sourcesContent":["import { promises as fs } from 'fs';\nimport path from 'path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport { bindLoggerToCompiler } from '@module-federation/sdk';\nimport logger from '../logger';\n\n/**\n * Plugin to copy build output files.\n * @class\n */\nclass CopyBuildOutputPlugin implements WebpackPluginInstance {\n private isServer: boolean;\n\n /**\n * @param {boolean} isServer - Indicates if the current environment is server.\n * @constructor\n */\n constructor(isServer: boolean) {\n this.isServer = isServer;\n }\n\n /**\n * Applies the plugin to the compiler.\n * @param {Compiler} compiler - The webpack compiler object.\n * @method\n */\n apply(compiler: Compiler): void {\n bindLoggerToCompiler(logger, compiler, 'CopyBuildOutputPlugin');\n /**\n * Copies files from source to destination.\n * @param {string} source - The source directory.\n * @param {string} destination - The destination directory.\n * @async\n * @function\n */\n const copyFiles = async (\n source: string,\n destination: string,\n ): Promise<void> => {\n const files = await fs.readdir(source);\n\n await Promise.all(\n files.map(async (file) => {\n const sourcePath = path.join(source, file);\n const destinationPath = path.join(destination, file);\n\n if ((await fs.lstat(sourcePath)).isDirectory()) {\n await fs.mkdir(destinationPath, { recursive: true });\n await copyFiles(sourcePath, destinationPath);\n } else {\n await fs.copyFile(sourcePath, destinationPath);\n }\n }),\n );\n };\n\n compiler.hooks.afterEmit.tapPromise(\n 'CopyBuildOutputPlugin',\n async (compilation: Compilation) => {\n const { outputPath } = compiler;\n const outputString = outputPath.split('server')[0];\n const isProd = compiler.options.mode === 'production';\n\n if (!isProd && !this.isServer) {\n return;\n }\n\n const serverLoc = path.join(\n outputString,\n this.isServer && isProd ? '/ssr' : '/static/ssr',\n );\n const servingLoc = path.join(outputPath, 'ssr');\n\n await fs.mkdir(serverLoc, { recursive: true });\n\n const sourcePath = this.isServer ? outputPath : servingLoc;\n\n try {\n await fs.access(sourcePath);\n // If the promise resolves, the file exists and you can proceed with copying.\n await copyFiles(sourcePath, serverLoc);\n } catch (error) {\n // If the promise rejects, the file does not exist.\n logger.error(`File at ${sourcePath} does not exist.`);\n }\n },\n );\n }\n}\n\nexport default CopyBuildOutputPlugin;\n"],"mappings":";;;;;;;;;;AAUA,IAAM,wBAAN,MAA6D;;;;;CAO3D,YAAY,UAAmB;AAC7B,OAAK,WAAW;;;;;;;CAQlB,MAAM,UAA0B;AAC9B,uBAAqB,QAAQ,UAAU,wBAAwB;;;;;;;;EAQ/D,MAAM,YAAY,OAChB,QACA,gBACkB;GAClB,MAAM,QAAQ,MAAMA,SAAG,QAAQ,OAAO;AAEtC,SAAM,QAAQ,IACZ,MAAM,IAAI,OAAO,SAAS;IACxB,MAAM,aAAa,KAAK,KAAK,QAAQ,KAAK;IAC1C,MAAM,kBAAkB,KAAK,KAAK,aAAa,KAAK;AAEpD,SAAK,MAAMA,SAAG,MAAM,WAAW,EAAE,aAAa,EAAE;AAC9C,WAAMA,SAAG,MAAM,iBAAiB,EAAE,WAAW,MAAM,CAAC;AACpD,WAAM,UAAU,YAAY,gBAAgB;UAE5C,OAAMA,SAAG,SAAS,YAAY,gBAAgB;KAEhD,CACH;;AAGH,WAAS,MAAM,UAAU,WACvB,yBACA,OAAO,gBAA6B;GAClC,MAAM,EAAE,eAAe;GACvB,MAAM,eAAe,WAAW,MAAM,SAAS,CAAC;GAChD,MAAM,SAAS,SAAS,QAAQ,SAAS;AAEzC,OAAI,CAAC,UAAU,CAAC,KAAK,SACnB;GAGF,MAAM,YAAY,KAAK,KACrB,cACA,KAAK,YAAY,SAAS,SAAS,cACpC;GACD,MAAM,aAAa,KAAK,KAAK,YAAY,MAAM;AAE/C,SAAMA,SAAG,MAAM,WAAW,EAAE,WAAW,MAAM,CAAC;GAE9C,MAAM,aAAa,KAAK,WAAW,aAAa;AAEhD,OAAI;AACF,UAAMA,SAAG,OAAO,WAAW;AAE3B,UAAM,UAAU,YAAY,UAAU;YAC/B,OAAO;AAEd,WAAO,MAAM,WAAW,WAAW,kBAAkB;;IAG1D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
2
|
+
const require_logger = require('../../logger.js');
|
|
3
|
+
const require_InvertedContainerPlugin = require('../container/InvertedContainerPlugin.js');
|
|
4
|
+
let _module_federation_node = require("@module-federation/node");
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/NextFederationPlugin/apply-client-plugins.ts
|
|
7
|
+
/**
|
|
8
|
+
* Applies client-specific plugins.
|
|
9
|
+
*
|
|
10
|
+
* @param compiler - The Webpack compiler instance.
|
|
11
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
12
|
+
* @param extraOptions - The NextFederationPluginExtraOptions instance.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This function applies plugins to the Webpack compiler instance that are specific to the client build of
|
|
16
|
+
* a Next.js application with Module Federation enabled. These plugins include the following:
|
|
17
|
+
*
|
|
18
|
+
* - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.
|
|
19
|
+
* - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its
|
|
20
|
+
* own remote interface at startup.
|
|
21
|
+
|
|
22
|
+
* If automatic page stitching is enabled, a warning is logged indicating that it is disabled in v7.
|
|
23
|
+
* If a custom library is specified in the options, an error is logged. The options.library property is
|
|
24
|
+
* also set to `{ type: 'window', name: options.name }`.
|
|
25
|
+
*/
|
|
26
|
+
function applyClientPlugins(compiler, options, extraOptions) {
|
|
27
|
+
const { name } = options;
|
|
28
|
+
if (compiler.options.output.publicPath === "/_next/") compiler.options.output.publicPath = "auto";
|
|
29
|
+
if (extraOptions.automaticPageStitching) require_logger.default.warn("automatic page stitching is disabled in v7");
|
|
30
|
+
if (options.library) require_logger.default.error("you cannot set custom library");
|
|
31
|
+
options.library = {
|
|
32
|
+
type: "window",
|
|
33
|
+
name
|
|
34
|
+
};
|
|
35
|
+
new _module_federation_node.ChunkCorrelationPlugin({ filename: ["static/chunks/federated-stats.json", "server/federated-stats.json"] }).apply(compiler);
|
|
36
|
+
new require_InvertedContainerPlugin.default().apply(compiler);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.applyClientPlugins = applyClientPlugins;
|
|
41
|
+
//# sourceMappingURL=apply-client-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-client-plugins.js","names":["ChunkCorrelationPlugin","InvertedContainerPlugin"],"sources":["../../../../src/plugins/NextFederationPlugin/apply-client-plugins.ts"],"sourcesContent":["import type { Compiler } from 'webpack';\nimport { ChunkCorrelationPlugin } from '@module-federation/node';\nimport InvertedContainerPlugin from '../container/InvertedContainerPlugin';\nimport type { moduleFederationPlugin } from '@module-federation/sdk';\nimport type { NextFederationPluginExtraOptions } from './next-fragments';\nimport logger from '../../logger';\n\n/**\n * Applies client-specific plugins.\n *\n * @param compiler - The Webpack compiler instance.\n * @param options - The ModuleFederationPluginOptions instance.\n * @param extraOptions - The NextFederationPluginExtraOptions instance.\n *\n * @remarks\n * This function applies plugins to the Webpack compiler instance that are specific to the client build of\n * a Next.js application with Module Federation enabled. These plugins include the following:\n *\n * - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.\n * - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its\n * own remote interface at startup.\n\n * If automatic page stitching is enabled, a warning is logged indicating that it is disabled in v7.\n * If a custom library is specified in the options, an error is logged. The options.library property is\n * also set to `{ type: 'window', name: options.name }`.\n */\nexport function applyClientPlugins(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n extraOptions: NextFederationPluginExtraOptions,\n): void {\n const { name } = options;\n\n // Adjust the public path if it is set to the default Next.js path\n if (compiler.options.output.publicPath === '/_next/') {\n compiler.options.output.publicPath = 'auto';\n }\n\n // Log a warning if automatic page stitching is enabled, as it is disabled in v7\n if (extraOptions.automaticPageStitching) {\n logger.warn('automatic page stitching is disabled in v7');\n }\n\n // Log an error if a custom library is set, as it is not allowed\n if (options.library) {\n logger.error('you cannot set custom library');\n }\n\n // Set the library option to be a window object with the name of the module federation plugin\n options.library = {\n type: 'window',\n name,\n };\n\n // Apply the ChunkCorrelationPlugin to collect metadata on chunks\n new ChunkCorrelationPlugin({\n filename: [\n 'static/chunks/federated-stats.json',\n 'server/federated-stats.json',\n ],\n }).apply(compiler);\n\n // Apply the InvertedContainerPlugin to add custom runtime modules to the container runtime\n new InvertedContainerPlugin().apply(compiler);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,mBACd,UACA,SACA,cACM;CACN,MAAM,EAAE,SAAS;AAGjB,KAAI,SAAS,QAAQ,OAAO,eAAe,UACzC,UAAS,QAAQ,OAAO,aAAa;AAIvC,KAAI,aAAa,uBACf,wBAAO,KAAK,6CAA6C;AAI3D,KAAI,QAAQ,QACV,wBAAO,MAAM,gCAAgC;AAI/C,SAAQ,UAAU;EAChB,MAAM;EACN;EACD;AAGD,KAAIA,+CAAuB,EACzB,UAAU,CACR,sCACA,8BACD,EACF,CAAC,CAAC,MAAM,SAAS;AAGlB,KAAIC,yCAAyB,CAAC,MAAM,SAAS"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import logger from "../../logger.mjs";
|
|
2
|
+
import InvertedContainerPlugin from "../container/InvertedContainerPlugin.mjs";
|
|
3
|
+
import { ChunkCorrelationPlugin } from "@module-federation/node";
|
|
4
|
+
|
|
5
|
+
//#region src/plugins/NextFederationPlugin/apply-client-plugins.ts
|
|
6
|
+
/**
|
|
7
|
+
* Applies client-specific plugins.
|
|
8
|
+
*
|
|
9
|
+
* @param compiler - The Webpack compiler instance.
|
|
10
|
+
* @param options - The ModuleFederationPluginOptions instance.
|
|
11
|
+
* @param extraOptions - The NextFederationPluginExtraOptions instance.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This function applies plugins to the Webpack compiler instance that are specific to the client build of
|
|
15
|
+
* a Next.js application with Module Federation enabled. These plugins include the following:
|
|
16
|
+
*
|
|
17
|
+
* - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.
|
|
18
|
+
* - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its
|
|
19
|
+
* own remote interface at startup.
|
|
20
|
+
|
|
21
|
+
* If automatic page stitching is enabled, a warning is logged indicating that it is disabled in v7.
|
|
22
|
+
* If a custom library is specified in the options, an error is logged. The options.library property is
|
|
23
|
+
* also set to `{ type: 'window', name: options.name }`.
|
|
24
|
+
*/
|
|
25
|
+
function applyClientPlugins(compiler, options, extraOptions) {
|
|
26
|
+
const { name } = options;
|
|
27
|
+
if (compiler.options.output.publicPath === "/_next/") compiler.options.output.publicPath = "auto";
|
|
28
|
+
if (extraOptions.automaticPageStitching) logger.warn("automatic page stitching is disabled in v7");
|
|
29
|
+
if (options.library) logger.error("you cannot set custom library");
|
|
30
|
+
options.library = {
|
|
31
|
+
type: "window",
|
|
32
|
+
name
|
|
33
|
+
};
|
|
34
|
+
new ChunkCorrelationPlugin({ filename: ["static/chunks/federated-stats.json", "server/federated-stats.json"] }).apply(compiler);
|
|
35
|
+
new InvertedContainerPlugin().apply(compiler);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { applyClientPlugins };
|
|
40
|
+
//# sourceMappingURL=apply-client-plugins.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-client-plugins.mjs","names":[],"sources":["../../../../src/plugins/NextFederationPlugin/apply-client-plugins.ts"],"sourcesContent":["import type { Compiler } from 'webpack';\nimport { ChunkCorrelationPlugin } from '@module-federation/node';\nimport InvertedContainerPlugin from '../container/InvertedContainerPlugin';\nimport type { moduleFederationPlugin } from '@module-federation/sdk';\nimport type { NextFederationPluginExtraOptions } from './next-fragments';\nimport logger from '../../logger';\n\n/**\n * Applies client-specific plugins.\n *\n * @param compiler - The Webpack compiler instance.\n * @param options - The ModuleFederationPluginOptions instance.\n * @param extraOptions - The NextFederationPluginExtraOptions instance.\n *\n * @remarks\n * This function applies plugins to the Webpack compiler instance that are specific to the client build of\n * a Next.js application with Module Federation enabled. These plugins include the following:\n *\n * - ChunkCorrelationPlugin: Collects metadata on chunks to enable proper module loading across different runtimes.\n * - InvertedContainerPlugin: Adds custom runtime modules to the container runtime to allow a host to expose its\n * own remote interface at startup.\n\n * If automatic page stitching is enabled, a warning is logged indicating that it is disabled in v7.\n * If a custom library is specified in the options, an error is logged. The options.library property is\n * also set to `{ type: 'window', name: options.name }`.\n */\nexport function applyClientPlugins(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n extraOptions: NextFederationPluginExtraOptions,\n): void {\n const { name } = options;\n\n // Adjust the public path if it is set to the default Next.js path\n if (compiler.options.output.publicPath === '/_next/') {\n compiler.options.output.publicPath = 'auto';\n }\n\n // Log a warning if automatic page stitching is enabled, as it is disabled in v7\n if (extraOptions.automaticPageStitching) {\n logger.warn('automatic page stitching is disabled in v7');\n }\n\n // Log an error if a custom library is set, as it is not allowed\n if (options.library) {\n logger.error('you cannot set custom library');\n }\n\n // Set the library option to be a window object with the name of the module federation plugin\n options.library = {\n type: 'window',\n name,\n };\n\n // Apply the ChunkCorrelationPlugin to collect metadata on chunks\n new ChunkCorrelationPlugin({\n filename: [\n 'static/chunks/federated-stats.json',\n 'server/federated-stats.json',\n ],\n }).apply(compiler);\n\n // Apply the InvertedContainerPlugin to add custom runtime modules to the container runtime\n new InvertedContainerPlugin().apply(compiler);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,mBACd,UACA,SACA,cACM;CACN,MAAM,EAAE,SAAS;AAGjB,KAAI,SAAS,QAAQ,OAAO,eAAe,UACzC,UAAS,QAAQ,OAAO,aAAa;AAIvC,KAAI,aAAa,uBACf,QAAO,KAAK,6CAA6C;AAI3D,KAAI,QAAQ,QACV,QAAO,MAAM,gCAAgC;AAI/C,SAAQ,UAAU;EAChB,MAAM;EACN;EACD;AAGD,KAAI,uBAAuB,EACzB,UAAU,CACR,sCACA,8BACD,EACF,CAAC,CAAC,MAAM,SAAS;AAGlB,KAAI,yBAAyB,CAAC,MAAM,SAAS"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
2
|
+
const require_InvertedContainerPlugin = require('../container/InvertedContainerPlugin.js');
|
|
3
|
+
let path = require("path");
|
|
4
|
+
path = require_runtime.__toESM(path);
|
|
5
|
+
let _module_federation_node_universe_entry_chunk_tracker_plugin = require("@module-federation/node/universe-entry-chunk-tracker-plugin");
|
|
6
|
+
_module_federation_node_universe_entry_chunk_tracker_plugin = require_runtime.__toESM(_module_federation_node_universe_entry_chunk_tracker_plugin);
|
|
7
|
+
|
|
8
|
+
//#region src/plugins/NextFederationPlugin/apply-server-plugins.ts
|
|
9
|
+
const isExternalItemValue = (value) => {
|
|
10
|
+
return typeof value === "string" || typeof value === "boolean" || Array.isArray(value) || !!value && typeof value === "object";
|
|
11
|
+
};
|
|
12
|
+
const runExternalFunction = async (external, data) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
let settled = false;
|
|
15
|
+
const settle = (err, result) => {
|
|
16
|
+
if (settled) return;
|
|
17
|
+
settled = true;
|
|
18
|
+
if (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (isExternalItemValue(result)) {
|
|
23
|
+
resolve(result);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
resolve(void 0);
|
|
27
|
+
};
|
|
28
|
+
const maybePromise = external(data, (err, result) => {
|
|
29
|
+
settle(err, result);
|
|
30
|
+
});
|
|
31
|
+
if (maybePromise !== void 0) Promise.resolve(maybePromise).then((result) => {
|
|
32
|
+
settle(void 0, result);
|
|
33
|
+
}).catch((error) => {
|
|
34
|
+
settle(error instanceof Error ? error : new Error(String(error)));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const isExternalItemFunction = (external) => {
|
|
39
|
+
return typeof external === "function";
|
|
40
|
+
};
|
|
41
|
+
const isSharedImportEnabled = (sharedConfigValue) => {
|
|
42
|
+
if (!sharedConfigValue || typeof sharedConfigValue !== "object") return true;
|
|
43
|
+
if (!Object.prototype.hasOwnProperty.call(sharedConfigValue, "import")) return true;
|
|
44
|
+
return Reflect.get(sharedConfigValue, "import") !== false;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Applies server-specific plugins to the webpack compiler.
|
|
48
|
+
*
|
|
49
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
50
|
+
* @param {moduleFederationPlugin.ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
51
|
+
*/
|
|
52
|
+
function applyServerPlugins(compiler, options) {
|
|
53
|
+
const chunkFileName = compiler.options?.output?.chunkFilename;
|
|
54
|
+
const uniqueName = compiler?.options?.output?.uniqueName || options.name;
|
|
55
|
+
const suffix = `-[contenthash].js`;
|
|
56
|
+
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) compiler.options.output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
57
|
+
new _module_federation_node_universe_entry_chunk_tracker_plugin.default().apply(compiler);
|
|
58
|
+
new require_InvertedContainerPlugin.default().apply(compiler);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Configures server-specific library and filename options.
|
|
62
|
+
*
|
|
63
|
+
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
64
|
+
*/
|
|
65
|
+
function configureServerLibraryAndFilename(options) {
|
|
66
|
+
options.library = {
|
|
67
|
+
type: "commonjs-module",
|
|
68
|
+
name: options.name
|
|
69
|
+
};
|
|
70
|
+
if (typeof options.filename === "string") options.filename = path.default.basename(options.filename);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Patches Next.js' default externals function to ensure shared modules are bundled and not treated as external.
|
|
74
|
+
*
|
|
75
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
76
|
+
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
77
|
+
*/
|
|
78
|
+
function handleServerExternals(compiler, options) {
|
|
79
|
+
if (Array.isArray(compiler.options.externals)) {
|
|
80
|
+
const functionIndex = compiler.options.externals.findIndex((external) => isExternalItemFunction(external));
|
|
81
|
+
if (functionIndex !== -1) {
|
|
82
|
+
const originalExternals = compiler.options.externals[functionIndex];
|
|
83
|
+
if (!isExternalItemFunction(originalExternals)) return;
|
|
84
|
+
compiler.options.externals[functionIndex] = async (ctx) => {
|
|
85
|
+
const fromNext = await runExternalFunction(originalExternals, ctx);
|
|
86
|
+
if (typeof fromNext !== "string") return fromNext;
|
|
87
|
+
const req = fromNext.split(" ")[1];
|
|
88
|
+
if (!req) return;
|
|
89
|
+
const isSharedRequest = (options.shared && !Array.isArray(options.shared) && typeof options.shared === "object" ? Object.entries(options.shared) : []).some(([key, sharedConfigValue]) => {
|
|
90
|
+
if (!isSharedImportEnabled(sharedConfigValue)) return false;
|
|
91
|
+
return key.endsWith("/") ? req.includes(key) : req === key;
|
|
92
|
+
});
|
|
93
|
+
if (ctx.request && (ctx.request.includes("@module-federation/utilities") || isSharedRequest || ctx.request.includes("@module-federation/"))) return;
|
|
94
|
+
if (req.startsWith("next") || req.startsWith("react/") || req.startsWith("react-dom/") || req === "react" || req === "styled-jsx/style" || req === "react-dom") return fromNext;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Configures server-specific compiler options.
|
|
101
|
+
*
|
|
102
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
103
|
+
*/
|
|
104
|
+
function configureServerCompilerOptions(compiler) {
|
|
105
|
+
compiler.options.node = {
|
|
106
|
+
...compiler.options.node,
|
|
107
|
+
global: false
|
|
108
|
+
};
|
|
109
|
+
compiler.options.target = "async-node";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
exports.applyServerPlugins = applyServerPlugins;
|
|
114
|
+
exports.configureServerCompilerOptions = configureServerCompilerOptions;
|
|
115
|
+
exports.configureServerLibraryAndFilename = configureServerLibraryAndFilename;
|
|
116
|
+
exports.handleServerExternals = handleServerExternals;
|
|
117
|
+
//# sourceMappingURL=apply-server-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-server-plugins.js","names":["UniverseEntryChunkTrackerPlugin","InvertedContainerPlugin"],"sources":["../../../../src/plugins/NextFederationPlugin/apply-server-plugins.ts"],"sourcesContent":["import type { WebpackOptionsNormalized, Compiler } from 'webpack';\nimport type ExternalModuleFactoryPlugin from 'webpack/lib/ExternalModuleFactoryPlugin';\nimport type { moduleFederationPlugin } from '@module-federation/sdk';\nimport path from 'path';\nimport InvertedContainerPlugin from '../container/InvertedContainerPlugin';\nimport UniverseEntryChunkTrackerPlugin from '@module-federation/node/universe-entry-chunk-tracker-plugin';\n\ntype EntryStaticNormalized = Awaited<\n ReturnType<Extract<WebpackOptionsNormalized['entry'], () => any>>\n>;\n\ninterface ModifyEntryOptions {\n compiler: Compiler;\n prependEntry?: (entry: EntryStaticNormalized) => void;\n staticEntry?: EntryStaticNormalized;\n}\n\ntype ExternalItemFunction =\n ExternalModuleFactoryPlugin.ExternalItemFunctionCallback;\ntype ExternalItemFunctionData =\n ExternalModuleFactoryPlugin.ExternalItemFunctionData;\ntype ExternalItemValue = ExternalModuleFactoryPlugin.ExternalItemValue;\n\nconst isExternalItemValue = (value: unknown): value is ExternalItemValue => {\n return (\n typeof value === 'string' ||\n typeof value === 'boolean' ||\n Array.isArray(value) ||\n (!!value && typeof value === 'object')\n );\n};\n\nconst runExternalFunction = async (\n external: ExternalItemFunction,\n data: ExternalItemFunctionData,\n): Promise<ExternalItemValue | undefined> => {\n return new Promise((resolve, reject) => {\n let settled = false;\n const settle = (err?: Error | null, result?: unknown) => {\n if (settled) {\n return;\n }\n settled = true;\n if (err) {\n reject(err);\n return;\n }\n if (isExternalItemValue(result)) {\n resolve(result);\n return;\n }\n resolve(undefined);\n };\n\n const maybePromise: unknown = external(data, (err, result) => {\n settle(err, result);\n });\n\n if (maybePromise !== undefined) {\n Promise.resolve(maybePromise)\n .then((result) => {\n settle(undefined, result);\n })\n .catch((error: unknown) => {\n const normalizedError =\n error instanceof Error ? error : new Error(String(error));\n settle(normalizedError);\n });\n }\n });\n};\n\nconst isExternalItemFunction = (\n external: unknown,\n): external is ExternalItemFunction => {\n return typeof external === 'function';\n};\n\nconst isSharedImportEnabled = (sharedConfigValue: unknown): boolean => {\n if (!sharedConfigValue || typeof sharedConfigValue !== 'object') {\n return true;\n }\n if (!Object.prototype.hasOwnProperty.call(sharedConfigValue, 'import')) {\n return true;\n }\n return Reflect.get(sharedConfigValue, 'import') !== false;\n};\n\n// Modifies the Webpack entry configuration\nexport function modifyEntry(options: ModifyEntryOptions): void {\n const { compiler, staticEntry, prependEntry } = options;\n const operator = (\n oriEntry: EntryStaticNormalized,\n newEntry: EntryStaticNormalized,\n ): EntryStaticNormalized => Object.assign(oriEntry, newEntry);\n\n // If the entry is a function, wrap it to modify the result\n if (typeof compiler.options.entry === 'function') {\n const prevEntryFn = compiler.options.entry;\n compiler.options.entry = async () => {\n let res = await prevEntryFn();\n if (staticEntry) {\n res = operator(res, staticEntry);\n }\n if (prependEntry) {\n prependEntry(res);\n }\n return res;\n };\n } else {\n // If the entry is an object, directly modify it\n if (staticEntry) {\n compiler.options.entry = operator(compiler.options.entry, staticEntry);\n }\n if (prependEntry) {\n prependEntry(compiler.options.entry);\n }\n }\n}\n\n/**\n * Applies server-specific plugins to the webpack compiler.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n * @param {moduleFederationPlugin.ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function applyServerPlugins(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n const chunkFileName = compiler.options?.output?.chunkFilename;\n const uniqueName = compiler?.options?.output?.uniqueName || options.name;\n const suffix = `-[contenthash].js`;\n\n // Modify chunk filename to include a unique suffix if not already present\n if (\n typeof chunkFileName === 'string' &&\n uniqueName &&\n !chunkFileName.includes(uniqueName)\n ) {\n compiler.options.output.chunkFilename = chunkFileName.replace(\n '.js',\n suffix,\n );\n }\n new UniverseEntryChunkTrackerPlugin().apply(compiler);\n new InvertedContainerPlugin().apply(compiler);\n}\n\n/**\n * Configures server-specific library and filename options.\n *\n * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function configureServerLibraryAndFilename(\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n // Set the library option to \"commonjs-module\" format with the name from the options\n options.library = {\n type: 'commonjs-module',\n name: options.name,\n };\n\n // Set the filename option to the basename of the current filename\n if (typeof options.filename === 'string') {\n options.filename = path.basename(options.filename);\n }\n}\n\n/**\n * Patches Next.js' default externals function to ensure shared modules are bundled and not treated as external.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function handleServerExternals(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n if (Array.isArray(compiler.options.externals)) {\n const functionIndex = compiler.options.externals.findIndex((external) =>\n isExternalItemFunction(external),\n );\n\n if (functionIndex !== -1) {\n const originalExternals = compiler.options.externals[functionIndex];\n if (!isExternalItemFunction(originalExternals)) {\n return;\n }\n\n compiler.options.externals[functionIndex] = async (\n ctx: ExternalItemFunctionData,\n ): Promise<ExternalItemValue | undefined> => {\n const fromNext = await runExternalFunction(originalExternals, ctx);\n if (typeof fromNext !== 'string') {\n return fromNext;\n }\n\n const req = fromNext.split(' ')[1];\n if (!req) {\n return;\n }\n\n const sharedEntries =\n options.shared &&\n !Array.isArray(options.shared) &&\n typeof options.shared === 'object'\n ? Object.entries(options.shared)\n : [];\n const isSharedRequest = sharedEntries.some(\n ([key, sharedConfigValue]) => {\n if (!isSharedImportEnabled(sharedConfigValue)) {\n return false;\n }\n return key.endsWith('/') ? req.includes(key) : req === key;\n },\n );\n\n if (\n ctx.request &&\n (ctx.request.includes('@module-federation/utilities') ||\n isSharedRequest ||\n ctx.request.includes('@module-federation/'))\n ) {\n return;\n }\n\n if (\n req.startsWith('next') ||\n req.startsWith('react/') ||\n req.startsWith('react-dom/') ||\n req === 'react' ||\n req === 'styled-jsx/style' ||\n req === 'react-dom'\n ) {\n return fromNext;\n }\n return;\n };\n }\n }\n}\n\n/**\n * Configures server-specific compiler options.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n */\nexport function configureServerCompilerOptions(compiler: Compiler): void {\n // Disable the global option in node builds and set the target to \"async-node\"\n compiler.options.node = {\n ...compiler.options.node,\n global: false,\n };\n // Set the compiler target to 'async-node' for server-side rendering compatibility\n // Set the target to 'async-node' for server-side builds\n compiler.options.target = 'async-node';\n\n // Runtime chunk creation is currently disabled\n // Uncomment if separate runtime chunk is needed for specific use cases\n // compiler.options.optimization.runtimeChunk = {\n // name: 'webpack-runtime',\n // };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import InvertedContainerPlugin from "../container/InvertedContainerPlugin.mjs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
4
|
+
|
|
5
|
+
//#region src/plugins/NextFederationPlugin/apply-server-plugins.ts
|
|
6
|
+
const isExternalItemValue = (value) => {
|
|
7
|
+
return typeof value === "string" || typeof value === "boolean" || Array.isArray(value) || !!value && typeof value === "object";
|
|
8
|
+
};
|
|
9
|
+
const runExternalFunction = async (external, data) => {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
let settled = false;
|
|
12
|
+
const settle = (err, result) => {
|
|
13
|
+
if (settled) return;
|
|
14
|
+
settled = true;
|
|
15
|
+
if (err) {
|
|
16
|
+
reject(err);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (isExternalItemValue(result)) {
|
|
20
|
+
resolve(result);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
resolve(void 0);
|
|
24
|
+
};
|
|
25
|
+
const maybePromise = external(data, (err, result) => {
|
|
26
|
+
settle(err, result);
|
|
27
|
+
});
|
|
28
|
+
if (maybePromise !== void 0) Promise.resolve(maybePromise).then((result) => {
|
|
29
|
+
settle(void 0, result);
|
|
30
|
+
}).catch((error) => {
|
|
31
|
+
settle(error instanceof Error ? error : new Error(String(error)));
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const isExternalItemFunction = (external) => {
|
|
36
|
+
return typeof external === "function";
|
|
37
|
+
};
|
|
38
|
+
const isSharedImportEnabled = (sharedConfigValue) => {
|
|
39
|
+
if (!sharedConfigValue || typeof sharedConfigValue !== "object") return true;
|
|
40
|
+
if (!Object.prototype.hasOwnProperty.call(sharedConfigValue, "import")) return true;
|
|
41
|
+
return Reflect.get(sharedConfigValue, "import") !== false;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Applies server-specific plugins to the webpack compiler.
|
|
45
|
+
*
|
|
46
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
47
|
+
* @param {moduleFederationPlugin.ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
48
|
+
*/
|
|
49
|
+
function applyServerPlugins(compiler, options) {
|
|
50
|
+
const chunkFileName = compiler.options?.output?.chunkFilename;
|
|
51
|
+
const uniqueName = compiler?.options?.output?.uniqueName || options.name;
|
|
52
|
+
const suffix = `-[contenthash].js`;
|
|
53
|
+
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) compiler.options.output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
54
|
+
new UniverseEntryChunkTrackerPlugin().apply(compiler);
|
|
55
|
+
new InvertedContainerPlugin().apply(compiler);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Configures server-specific library and filename options.
|
|
59
|
+
*
|
|
60
|
+
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
61
|
+
*/
|
|
62
|
+
function configureServerLibraryAndFilename(options) {
|
|
63
|
+
options.library = {
|
|
64
|
+
type: "commonjs-module",
|
|
65
|
+
name: options.name
|
|
66
|
+
};
|
|
67
|
+
if (typeof options.filename === "string") options.filename = path.basename(options.filename);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Patches Next.js' default externals function to ensure shared modules are bundled and not treated as external.
|
|
71
|
+
*
|
|
72
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
73
|
+
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
74
|
+
*/
|
|
75
|
+
function handleServerExternals(compiler, options) {
|
|
76
|
+
if (Array.isArray(compiler.options.externals)) {
|
|
77
|
+
const functionIndex = compiler.options.externals.findIndex((external) => isExternalItemFunction(external));
|
|
78
|
+
if (functionIndex !== -1) {
|
|
79
|
+
const originalExternals = compiler.options.externals[functionIndex];
|
|
80
|
+
if (!isExternalItemFunction(originalExternals)) return;
|
|
81
|
+
compiler.options.externals[functionIndex] = async (ctx) => {
|
|
82
|
+
const fromNext = await runExternalFunction(originalExternals, ctx);
|
|
83
|
+
if (typeof fromNext !== "string") return fromNext;
|
|
84
|
+
const req = fromNext.split(" ")[1];
|
|
85
|
+
if (!req) return;
|
|
86
|
+
const isSharedRequest = (options.shared && !Array.isArray(options.shared) && typeof options.shared === "object" ? Object.entries(options.shared) : []).some(([key, sharedConfigValue]) => {
|
|
87
|
+
if (!isSharedImportEnabled(sharedConfigValue)) return false;
|
|
88
|
+
return key.endsWith("/") ? req.includes(key) : req === key;
|
|
89
|
+
});
|
|
90
|
+
if (ctx.request && (ctx.request.includes("@module-federation/utilities") || isSharedRequest || ctx.request.includes("@module-federation/"))) return;
|
|
91
|
+
if (req.startsWith("next") || req.startsWith("react/") || req.startsWith("react-dom/") || req === "react" || req === "styled-jsx/style" || req === "react-dom") return fromNext;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Configures server-specific compiler options.
|
|
98
|
+
*
|
|
99
|
+
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
100
|
+
*/
|
|
101
|
+
function configureServerCompilerOptions(compiler) {
|
|
102
|
+
compiler.options.node = {
|
|
103
|
+
...compiler.options.node,
|
|
104
|
+
global: false
|
|
105
|
+
};
|
|
106
|
+
compiler.options.target = "async-node";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { applyServerPlugins, configureServerCompilerOptions, configureServerLibraryAndFilename, handleServerExternals };
|
|
111
|
+
//# sourceMappingURL=apply-server-plugins.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-server-plugins.mjs","names":[],"sources":["../../../../src/plugins/NextFederationPlugin/apply-server-plugins.ts"],"sourcesContent":["import type { WebpackOptionsNormalized, Compiler } from 'webpack';\nimport type ExternalModuleFactoryPlugin from 'webpack/lib/ExternalModuleFactoryPlugin';\nimport type { moduleFederationPlugin } from '@module-federation/sdk';\nimport path from 'path';\nimport InvertedContainerPlugin from '../container/InvertedContainerPlugin';\nimport UniverseEntryChunkTrackerPlugin from '@module-federation/node/universe-entry-chunk-tracker-plugin';\n\ntype EntryStaticNormalized = Awaited<\n ReturnType<Extract<WebpackOptionsNormalized['entry'], () => any>>\n>;\n\ninterface ModifyEntryOptions {\n compiler: Compiler;\n prependEntry?: (entry: EntryStaticNormalized) => void;\n staticEntry?: EntryStaticNormalized;\n}\n\ntype ExternalItemFunction =\n ExternalModuleFactoryPlugin.ExternalItemFunctionCallback;\ntype ExternalItemFunctionData =\n ExternalModuleFactoryPlugin.ExternalItemFunctionData;\ntype ExternalItemValue = ExternalModuleFactoryPlugin.ExternalItemValue;\n\nconst isExternalItemValue = (value: unknown): value is ExternalItemValue => {\n return (\n typeof value === 'string' ||\n typeof value === 'boolean' ||\n Array.isArray(value) ||\n (!!value && typeof value === 'object')\n );\n};\n\nconst runExternalFunction = async (\n external: ExternalItemFunction,\n data: ExternalItemFunctionData,\n): Promise<ExternalItemValue | undefined> => {\n return new Promise((resolve, reject) => {\n let settled = false;\n const settle = (err?: Error | null, result?: unknown) => {\n if (settled) {\n return;\n }\n settled = true;\n if (err) {\n reject(err);\n return;\n }\n if (isExternalItemValue(result)) {\n resolve(result);\n return;\n }\n resolve(undefined);\n };\n\n const maybePromise: unknown = external(data, (err, result) => {\n settle(err, result);\n });\n\n if (maybePromise !== undefined) {\n Promise.resolve(maybePromise)\n .then((result) => {\n settle(undefined, result);\n })\n .catch((error: unknown) => {\n const normalizedError =\n error instanceof Error ? error : new Error(String(error));\n settle(normalizedError);\n });\n }\n });\n};\n\nconst isExternalItemFunction = (\n external: unknown,\n): external is ExternalItemFunction => {\n return typeof external === 'function';\n};\n\nconst isSharedImportEnabled = (sharedConfigValue: unknown): boolean => {\n if (!sharedConfigValue || typeof sharedConfigValue !== 'object') {\n return true;\n }\n if (!Object.prototype.hasOwnProperty.call(sharedConfigValue, 'import')) {\n return true;\n }\n return Reflect.get(sharedConfigValue, 'import') !== false;\n};\n\n// Modifies the Webpack entry configuration\nexport function modifyEntry(options: ModifyEntryOptions): void {\n const { compiler, staticEntry, prependEntry } = options;\n const operator = (\n oriEntry: EntryStaticNormalized,\n newEntry: EntryStaticNormalized,\n ): EntryStaticNormalized => Object.assign(oriEntry, newEntry);\n\n // If the entry is a function, wrap it to modify the result\n if (typeof compiler.options.entry === 'function') {\n const prevEntryFn = compiler.options.entry;\n compiler.options.entry = async () => {\n let res = await prevEntryFn();\n if (staticEntry) {\n res = operator(res, staticEntry);\n }\n if (prependEntry) {\n prependEntry(res);\n }\n return res;\n };\n } else {\n // If the entry is an object, directly modify it\n if (staticEntry) {\n compiler.options.entry = operator(compiler.options.entry, staticEntry);\n }\n if (prependEntry) {\n prependEntry(compiler.options.entry);\n }\n }\n}\n\n/**\n * Applies server-specific plugins to the webpack compiler.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n * @param {moduleFederationPlugin.ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function applyServerPlugins(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n const chunkFileName = compiler.options?.output?.chunkFilename;\n const uniqueName = compiler?.options?.output?.uniqueName || options.name;\n const suffix = `-[contenthash].js`;\n\n // Modify chunk filename to include a unique suffix if not already present\n if (\n typeof chunkFileName === 'string' &&\n uniqueName &&\n !chunkFileName.includes(uniqueName)\n ) {\n compiler.options.output.chunkFilename = chunkFileName.replace(\n '.js',\n suffix,\n );\n }\n new UniverseEntryChunkTrackerPlugin().apply(compiler);\n new InvertedContainerPlugin().apply(compiler);\n}\n\n/**\n * Configures server-specific library and filename options.\n *\n * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function configureServerLibraryAndFilename(\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n // Set the library option to \"commonjs-module\" format with the name from the options\n options.library = {\n type: 'commonjs-module',\n name: options.name,\n };\n\n // Set the filename option to the basename of the current filename\n if (typeof options.filename === 'string') {\n options.filename = path.basename(options.filename);\n }\n}\n\n/**\n * Patches Next.js' default externals function to ensure shared modules are bundled and not treated as external.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n * @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.\n */\nexport function handleServerExternals(\n compiler: Compiler,\n options: moduleFederationPlugin.ModuleFederationPluginOptions,\n): void {\n if (Array.isArray(compiler.options.externals)) {\n const functionIndex = compiler.options.externals.findIndex((external) =>\n isExternalItemFunction(external),\n );\n\n if (functionIndex !== -1) {\n const originalExternals = compiler.options.externals[functionIndex];\n if (!isExternalItemFunction(originalExternals)) {\n return;\n }\n\n compiler.options.externals[functionIndex] = async (\n ctx: ExternalItemFunctionData,\n ): Promise<ExternalItemValue | undefined> => {\n const fromNext = await runExternalFunction(originalExternals, ctx);\n if (typeof fromNext !== 'string') {\n return fromNext;\n }\n\n const req = fromNext.split(' ')[1];\n if (!req) {\n return;\n }\n\n const sharedEntries =\n options.shared &&\n !Array.isArray(options.shared) &&\n typeof options.shared === 'object'\n ? Object.entries(options.shared)\n : [];\n const isSharedRequest = sharedEntries.some(\n ([key, sharedConfigValue]) => {\n if (!isSharedImportEnabled(sharedConfigValue)) {\n return false;\n }\n return key.endsWith('/') ? req.includes(key) : req === key;\n },\n );\n\n if (\n ctx.request &&\n (ctx.request.includes('@module-federation/utilities') ||\n isSharedRequest ||\n ctx.request.includes('@module-federation/'))\n ) {\n return;\n }\n\n if (\n req.startsWith('next') ||\n req.startsWith('react/') ||\n req.startsWith('react-dom/') ||\n req === 'react' ||\n req === 'styled-jsx/style' ||\n req === 'react-dom'\n ) {\n return fromNext;\n }\n return;\n };\n }\n }\n}\n\n/**\n * Configures server-specific compiler options.\n *\n * @param {Compiler} compiler - The Webpack compiler instance.\n */\nexport function configureServerCompilerOptions(compiler: Compiler): void {\n // Disable the global option in node builds and set the target to \"async-node\"\n compiler.options.node = {\n ...compiler.options.node,\n global: false,\n };\n // Set the compiler target to 'async-node' for server-side rendering compatibility\n // Set the target to 'async-node' for server-side builds\n compiler.options.target = 'async-node';\n\n // Runtime chunk creation is currently disabled\n // Uncomment if separate runtime chunk is needed for specific use cases\n // compiler.options.optimization.runtimeChunk = {\n // name: 'webpack-runtime',\n // };\n}\n"],"mappings":";;;;;AAuBA,MAAM,uBAAuB,UAA+C;AAC1E,QACE,OAAO,UAAU,YACjB,OAAO,UAAU,aACjB,MAAM,QAAQ,MAAM,IACnB,CAAC,CAAC,SAAS,OAAO,UAAU;;AAIjC,MAAM,sBAAsB,OAC1B,UACA,SAC2C;AAC3C,QAAO,IAAI,SAAS,SAAS,WAAW;EACtC,IAAI,UAAU;EACd,MAAM,UAAU,KAAoB,WAAqB;AACvD,OAAI,QACF;AAEF,aAAU;AACV,OAAI,KAAK;AACP,WAAO,IAAI;AACX;;AAEF,OAAI,oBAAoB,OAAO,EAAE;AAC/B,YAAQ,OAAO;AACf;;AAEF,WAAQ,OAAU;;EAGpB,MAAM,eAAwB,SAAS,OAAO,KAAK,WAAW;AAC5D,UAAO,KAAK,OAAO;IACnB;AAEF,MAAI,iBAAiB,OACnB,SAAQ,QAAQ,aAAa,CAC1B,MAAM,WAAW;AAChB,UAAO,QAAW,OAAO;IACzB,CACD,OAAO,UAAmB;AAGzB,UADE,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,CACpC;IACvB;GAEN;;AAGJ,MAAM,0BACJ,aACqC;AACrC,QAAO,OAAO,aAAa;;AAG7B,MAAM,yBAAyB,sBAAwC;AACrE,KAAI,CAAC,qBAAqB,OAAO,sBAAsB,SACrD,QAAO;AAET,KAAI,CAAC,OAAO,UAAU,eAAe,KAAK,mBAAmB,SAAS,CACpE,QAAO;AAET,QAAO,QAAQ,IAAI,mBAAmB,SAAS,KAAK;;;;;;;;AAyCtD,SAAgB,mBACd,UACA,SACM;CACN,MAAM,gBAAgB,SAAS,SAAS,QAAQ;CAChD,MAAM,aAAa,UAAU,SAAS,QAAQ,cAAc,QAAQ;CACpE,MAAM,SAAS;AAGf,KACE,OAAO,kBAAkB,YACzB,cACA,CAAC,cAAc,SAAS,WAAW,CAEnC,UAAS,QAAQ,OAAO,gBAAgB,cAAc,QACpD,OACA,OACD;AAEH,KAAI,iCAAiC,CAAC,MAAM,SAAS;AACrD,KAAI,yBAAyB,CAAC,MAAM,SAAS;;;;;;;AAQ/C,SAAgB,kCACd,SACM;AAEN,SAAQ,UAAU;EAChB,MAAM;EACN,MAAM,QAAQ;EACf;AAGD,KAAI,OAAO,QAAQ,aAAa,SAC9B,SAAQ,WAAW,KAAK,SAAS,QAAQ,SAAS;;;;;;;;AAUtD,SAAgB,sBACd,UACA,SACM;AACN,KAAI,MAAM,QAAQ,SAAS,QAAQ,UAAU,EAAE;EAC7C,MAAM,gBAAgB,SAAS,QAAQ,UAAU,WAAW,aAC1D,uBAAuB,SAAS,CACjC;AAED,MAAI,kBAAkB,IAAI;GACxB,MAAM,oBAAoB,SAAS,QAAQ,UAAU;AACrD,OAAI,CAAC,uBAAuB,kBAAkB,CAC5C;AAGF,YAAS,QAAQ,UAAU,iBAAiB,OAC1C,QAC2C;IAC3C,MAAM,WAAW,MAAM,oBAAoB,mBAAmB,IAAI;AAClE,QAAI,OAAO,aAAa,SACtB,QAAO;IAGT,MAAM,MAAM,SAAS,MAAM,IAAI,CAAC;AAChC,QAAI,CAAC,IACH;IASF,MAAM,mBALJ,QAAQ,UACR,CAAC,MAAM,QAAQ,QAAQ,OAAO,IAC9B,OAAO,QAAQ,WAAW,WACtB,OAAO,QAAQ,QAAQ,OAAO,GAC9B,EAAE,EAC8B,MACnC,CAAC,KAAK,uBAAuB;AAC5B,SAAI,CAAC,sBAAsB,kBAAkB,CAC3C,QAAO;AAET,YAAO,IAAI,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,QAAQ;MAE1D;AAED,QACE,IAAI,YACH,IAAI,QAAQ,SAAS,+BAA+B,IACnD,mBACA,IAAI,QAAQ,SAAS,sBAAsB,EAE7C;AAGF,QACE,IAAI,WAAW,OAAO,IACtB,IAAI,WAAW,SAAS,IACxB,IAAI,WAAW,aAAa,IAC5B,QAAQ,WACR,QAAQ,sBACR,QAAQ,YAER,QAAO;;;;;;;;;;AAajB,SAAgB,+BAA+B,UAA0B;AAEvE,UAAS,QAAQ,OAAO;EACtB,GAAG,SAAS,QAAQ;EACpB,QAAQ;EACT;AAGD,UAAS,QAAQ,SAAS"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NextFederationPluginOptions } from "./next-fragments.mjs";
|
|
2
|
+
import { Compiler } from "webpack";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/NextFederationPlugin/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* NextFederationPlugin is a webpack plugin that handles Next.js application federation using Module Federation.
|
|
7
|
+
*/
|
|
8
|
+
declare class NextFederationPlugin {
|
|
9
|
+
private _options;
|
|
10
|
+
private _extraOptions;
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs the NextFederationPlugin with the provided options.
|
|
14
|
+
*
|
|
15
|
+
* @param options The options to configure the plugin.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options: NextFederationPluginOptions);
|
|
18
|
+
/**
|
|
19
|
+
* The apply method is called by the webpack compiler and allows the plugin to hook into the webpack process.
|
|
20
|
+
* @param compiler The webpack compiler object.
|
|
21
|
+
*/
|
|
22
|
+
apply(compiler: Compiler): void;
|
|
23
|
+
private validateOptions;
|
|
24
|
+
private isServerCompiler;
|
|
25
|
+
private applyConditionalPlugins;
|
|
26
|
+
private getNormalFederationPluginOptions;
|
|
27
|
+
private getNoopPath;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { NextFederationPlugin };
|
|
31
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NextFederationPluginOptions } from "./next-fragments.js";
|
|
2
|
+
import { Compiler } from "webpack";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/NextFederationPlugin/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* NextFederationPlugin is a webpack plugin that handles Next.js application federation using Module Federation.
|
|
7
|
+
*/
|
|
8
|
+
declare class NextFederationPlugin {
|
|
9
|
+
private _options;
|
|
10
|
+
private _extraOptions;
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs the NextFederationPlugin with the provided options.
|
|
14
|
+
*
|
|
15
|
+
* @param options The options to configure the plugin.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options: NextFederationPluginOptions);
|
|
18
|
+
/**
|
|
19
|
+
* The apply method is called by the webpack compiler and allows the plugin to hook into the webpack process.
|
|
20
|
+
* @param compiler The webpack compiler object.
|
|
21
|
+
*/
|
|
22
|
+
apply(compiler: Compiler): void;
|
|
23
|
+
private validateOptions;
|
|
24
|
+
private isServerCompiler;
|
|
25
|
+
private applyConditionalPlugins;
|
|
26
|
+
private getNormalFederationPluginOptions;
|
|
27
|
+
private getNoopPath;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { NextFederationPlugin };
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|