@module-federation/nextjs-mf 8.3.4 → 8.3.6
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/package.json +6 -6
- package/dist/client/UrlNode.d.ts +0 -17
- package/dist/client/UrlNode.js +0 -150
- package/dist/client/UrlNode.js.map +0 -1
- package/dist/node.d.ts +0 -1
- package/dist/node.js +0 -18
- package/dist/node.js.map +0 -1
- package/dist/package.json +0 -99
- package/dist/src/federation-noop.d.ts +0 -0
- package/dist/src/federation-noop.js +0 -15
- package/dist/src/federation-noop.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -12
- package/dist/src/index.js.map +0 -1
- package/dist/src/internal.d.ts +0 -48
- package/dist/src/internal.js +0 -177
- package/dist/src/internal.js.map +0 -1
- package/dist/src/loaders/fixImageLoader.d.ts +0 -22
- package/dist/src/loaders/fixImageLoader.js +0 -114
- package/dist/src/loaders/fixImageLoader.js.map +0 -1
- package/dist/src/loaders/fixUrlLoader.d.ts +0 -13
- package/dist/src/loaders/fixUrlLoader.js +0 -25
- package/dist/src/loaders/fixUrlLoader.js.map +0 -1
- package/dist/src/loaders/helpers.d.ts +0 -17
- package/dist/src/loaders/helpers.js +0 -60
- package/dist/src/loaders/helpers.js.map +0 -1
- package/dist/src/loaders/nextPageMapLoader.d.ts +0 -24
- package/dist/src/loaders/nextPageMapLoader.js +0 -167
- package/dist/src/loaders/nextPageMapLoader.js.map +0 -1
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +0 -5
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +0 -19
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +0 -1
- package/dist/src/plugins/CopyFederationPlugin.d.ts +0 -20
- package/dist/src/plugins/CopyFederationPlugin.js +0 -71
- package/dist/src/plugins/CopyFederationPlugin.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +0 -23
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +0 -73
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +0 -60
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +0 -170
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/index.d.ts +0 -27
- package/dist/src/plugins/NextFederationPlugin/index.js +0 -160
- package/dist/src/plugins/NextFederationPlugin/index.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.ts +0 -18
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js +0 -61
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/regex-equal.d.ts +0 -14
- package/dist/src/plugins/NextFederationPlugin/regex-equal.js +0 -25
- package/dist/src/plugins/NextFederationPlugin/regex-equal.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +0 -8
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +0 -31
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/set-options.d.ts +0 -20
- package/dist/src/plugins/NextFederationPlugin/set-options.js +0 -38
- package/dist/src/plugins/NextFederationPlugin/set-options.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/validate-options.d.ts +0 -25
- package/dist/src/plugins/NextFederationPlugin/validate-options.js +0 -46
- package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +0 -1
- package/dist/src/plugins/container/EmbeddedContainerPlugin.d.ts +0 -11
- package/dist/src/plugins/container/EmbeddedContainerPlugin.js +0 -23
- package/dist/src/plugins/container/EmbeddedContainerPlugin.js.map +0 -1
- package/dist/src/plugins/container/InvertedContainerPlugin.d.ts +0 -15
- package/dist/src/plugins/container/InvertedContainerPlugin.js +0 -25
- package/dist/src/plugins/container/InvertedContainerPlugin.js.map +0 -1
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.ts +0 -11
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js +0 -50
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +0 -1
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +0 -39
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +0 -72
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +0 -1
- package/dist/src/plugins/container/runtimePlugin.d.ts +0 -2
- package/dist/src/plugins/container/runtimePlugin.js +0 -166
- package/dist/src/plugins/container/runtimePlugin.js.map +0 -1
- package/dist/src/plugins/container/types.d.ts +0 -2
- package/dist/src/plugins/container/types.js +0 -3
- package/dist/src/plugins/container/types.js.map +0 -1
- package/dist/src/types.d.ts +0 -28
- package/dist/src/types.js +0 -3
- package/dist/src/types.js.map +0 -1
- package/dist/utilities.d.ts +0 -1
- package/dist/utilities.js +0 -18
- package/dist/utilities.js.map +0 -1
- package/dist/utils/build-utils.d.ts +0 -10
- package/dist/utils/build-utils.js +0 -24
- package/dist/utils/build-utils.js.map +0 -1
- package/dist/utils/flushedChunks.d.ts +0 -22
- package/dist/utils/flushedChunks.js +0 -67
- package/dist/utils/flushedChunks.js.map +0 -1
- package/dist/utils/index.d.ts +0 -27
- package/dist/utils/index.js +0 -69
- package/dist/utils/index.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function to remove unnecessary shared keys from the default share scope.
|
|
3
|
-
* It iterates over each key in the shared object and checks against the default share scope.
|
|
4
|
-
* If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
|
|
5
|
-
*
|
|
6
|
-
* @param {Record<string, unknown>} shared - The shared object to be checked.
|
|
7
|
-
*/
|
|
8
|
-
export declare function removeUnnecessarySharedKeys(shared: Record<string, unknown>): void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeUnnecessarySharedKeys = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility function to remove unnecessary shared keys from the default share scope.
|
|
6
|
-
* It checks each key in the shared object against the default share scope.
|
|
7
|
-
* If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
|
|
8
|
-
*
|
|
9
|
-
* @param {Record<string, unknown>} shared - The shared object to be checked.
|
|
10
|
-
*/
|
|
11
|
-
const internal_1 = require("../../internal");
|
|
12
|
-
/**
|
|
13
|
-
* Function to remove unnecessary shared keys from the default share scope.
|
|
14
|
-
* It iterates over each key in the shared object and checks against the default share scope.
|
|
15
|
-
* If a key is found in the default share scope, a warning is logged and the key is removed from the shared object.
|
|
16
|
-
*
|
|
17
|
-
* @param {Record<string, unknown>} shared - The shared object to be checked.
|
|
18
|
-
*/
|
|
19
|
-
function removeUnnecessarySharedKeys(shared) {
|
|
20
|
-
Object.keys(shared).forEach((key) => {
|
|
21
|
-
/**
|
|
22
|
-
* If the key is found in the default share scope, log a warning and remove the key from the shared object.
|
|
23
|
-
*/
|
|
24
|
-
if (internal_1.DEFAULT_SHARE_SCOPE[key]) {
|
|
25
|
-
console.warn(`%c[nextjs-mf] You are sharing ${key} from the default share scope. This is not necessary and can be removed.`, 'color: red');
|
|
26
|
-
delete shared[key];
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.removeUnnecessarySharedKeys = removeUnnecessarySharedKeys;
|
|
31
|
-
//# sourceMappingURL=remove-unnecessary-shared-keys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unnecessary-shared-keys.js","sourceRoot":"","sources":["../../../../src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAAqD;AAErD;;;;;;GAMG;AACH,SAAgB,2BAA2B,CACzC,MAA+B;IAE/B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;QAC1C;;WAEG;QACH,IAAI,8BAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CACV,iCAAiC,GAAG,0EAA0E,EAC9G,YAAY,CACb,CAAC;YACF,OAAQ,MAAqC,CAAC,GAAG,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,kEAeC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ModuleFederationPluginOptions, NextFederationPluginExtraOptions, NextFederationPluginOptions } from '@module-federation/utilities';
|
|
2
|
-
/**
|
|
3
|
-
* This function sets the main and extra options for NextFederationPlugin. It splits the options object into
|
|
4
|
-
* the main options and extra options, and sets default values for any options that are not defined.
|
|
5
|
-
*
|
|
6
|
-
* @param {NextFederationPluginOptions} options - The options for NextFederationPlugin.
|
|
7
|
-
* @returns {Object} An object containing the main options and extra options.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* The default extra options are:
|
|
11
|
-
* - automaticPageStitching: false
|
|
12
|
-
* - enableImageLoaderFix: false
|
|
13
|
-
* - enableUrlLoaderFix: false
|
|
14
|
-
* - skipSharingNextInternals: false
|
|
15
|
-
* - debug: false
|
|
16
|
-
*/
|
|
17
|
-
export declare function setOptions(options: NextFederationPluginOptions): {
|
|
18
|
-
mainOptions: ModuleFederationPluginOptions;
|
|
19
|
-
extraOptions: NextFederationPluginExtraOptions;
|
|
20
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setOptions = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This function sets the main and extra options for NextFederationPlugin. It splits the options object into
|
|
6
|
-
* the main options and extra options, and sets default values for any options that are not defined.
|
|
7
|
-
*
|
|
8
|
-
* @param {NextFederationPluginOptions} options - The options for NextFederationPlugin.
|
|
9
|
-
* @returns {Object} An object containing the main options and extra options.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* The default extra options are:
|
|
13
|
-
* - automaticPageStitching: false
|
|
14
|
-
* - enableImageLoaderFix: false
|
|
15
|
-
* - enableUrlLoaderFix: false
|
|
16
|
-
* - skipSharingNextInternals: false
|
|
17
|
-
* - debug: false
|
|
18
|
-
*/
|
|
19
|
-
function setOptions(options) {
|
|
20
|
-
const { extraOptions, ...mainOpts } = options;
|
|
21
|
-
/**
|
|
22
|
-
* Default extra options for NextFederationPlugin.
|
|
23
|
-
* @type {NextFederationPluginExtraOptions}
|
|
24
|
-
*/
|
|
25
|
-
const defaultExtraOptions = {
|
|
26
|
-
automaticPageStitching: false,
|
|
27
|
-
enableImageLoaderFix: false,
|
|
28
|
-
enableUrlLoaderFix: false,
|
|
29
|
-
skipSharingNextInternals: false,
|
|
30
|
-
debug: false,
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
mainOptions: mainOpts,
|
|
34
|
-
extraOptions: { ...defaultExtraOptions, ...extraOptions },
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
exports.setOptions = setOptions;
|
|
38
|
-
//# sourceMappingURL=set-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-options.js","sourceRoot":"","sources":["../../../../src/plugins/NextFederationPlugin/set-options.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAC,OAAoC;IAI7D,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE9C;;;OAGG;IACH,MAAM,mBAAmB,GAAqC;QAC5D,sBAAsB,EAAE,KAAK;QAC7B,oBAAoB,EAAE,KAAK;QAC3B,kBAAkB,EAAE,KAAK;QACzB,wBAAwB,EAAE,KAAK;QAC/B,KAAK,EAAE,KAAK;KACb,CAAC;IAEF,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,YAAY,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,YAAY,EAAE;KAC1D,CAAC;AACJ,CAAC;AAtBD,gCAsBC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
import { ModuleFederationPluginOptions } from '@module-federation/utilities';
|
|
3
|
-
/**
|
|
4
|
-
* Validates the compiler options.
|
|
5
|
-
*
|
|
6
|
-
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
7
|
-
* @returns {boolean} - Returns true if the compiler options are valid, false otherwise.
|
|
8
|
-
*
|
|
9
|
-
* @throws Will throw an error if the name option is not defined in the options.
|
|
10
|
-
* @remarks
|
|
11
|
-
* This function validates the options passed to the Webpack compiler. It checks if the name option is set to either "server" or
|
|
12
|
-
* "client", as Module Federation is only applied to the main server and client builds in Next.js.
|
|
13
|
-
*/
|
|
14
|
-
export declare function validateCompilerOptions(compiler: Compiler): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Validates the NextFederationPlugin options.
|
|
17
|
-
*
|
|
18
|
-
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
19
|
-
*
|
|
20
|
-
* @throws Will throw an error if the filename option is not defined in the options or if the name option is not specified.
|
|
21
|
-
* @remarks
|
|
22
|
-
* This function validates the options passed to NextFederationPlugin. It ensures that the filename and name options are defined,
|
|
23
|
-
* as they are required for using Module Federation.
|
|
24
|
-
*/
|
|
25
|
-
export declare function validatePluginOptions(options: ModuleFederationPluginOptions): boolean | void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePluginOptions = exports.validateCompilerOptions = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Validates the compiler options.
|
|
6
|
-
*
|
|
7
|
-
* @param {Compiler} compiler - The Webpack compiler instance.
|
|
8
|
-
* @returns {boolean} - Returns true if the compiler options are valid, false otherwise.
|
|
9
|
-
*
|
|
10
|
-
* @throws Will throw an error if the name option is not defined in the options.
|
|
11
|
-
* @remarks
|
|
12
|
-
* This function validates the options passed to the Webpack compiler. It checks if the name option is set to either "server" or
|
|
13
|
-
* "client", as Module Federation is only applied to the main server and client builds in Next.js.
|
|
14
|
-
*/
|
|
15
|
-
function validateCompilerOptions(compiler) {
|
|
16
|
-
// Throw an error if the name option is not defined in the options
|
|
17
|
-
if (!compiler.options.name) {
|
|
18
|
-
throw new Error('name is not defined in Compiler options');
|
|
19
|
-
}
|
|
20
|
-
// Only apply Module Federation to the main server and client builds in Next.js
|
|
21
|
-
return ['server', 'client'].includes(compiler.options.name);
|
|
22
|
-
}
|
|
23
|
-
exports.validateCompilerOptions = validateCompilerOptions;
|
|
24
|
-
/**
|
|
25
|
-
* Validates the NextFederationPlugin options.
|
|
26
|
-
*
|
|
27
|
-
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions instance.
|
|
28
|
-
*
|
|
29
|
-
* @throws Will throw an error if the filename option is not defined in the options or if the name option is not specified.
|
|
30
|
-
* @remarks
|
|
31
|
-
* This function validates the options passed to NextFederationPlugin. It ensures that the filename and name options are defined,
|
|
32
|
-
* as they are required for using Module Federation.
|
|
33
|
-
*/
|
|
34
|
-
function validatePluginOptions(options) {
|
|
35
|
-
// Throw an error if the filename option is not defined in the options
|
|
36
|
-
if (!options.filename) {
|
|
37
|
-
throw new Error('filename is not defined in NextFederation options');
|
|
38
|
-
}
|
|
39
|
-
// A requirement for using Module Federation is that a name must be specified
|
|
40
|
-
if (!options.name) {
|
|
41
|
-
throw new Error('Module federation "name" option must be specified');
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
exports.validatePluginOptions = validatePluginOptions;
|
|
46
|
-
//# sourceMappingURL=validate-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../../../../src/plugins/NextFederationPlugin/validate-options.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,QAAkB;IACxD,kEAAkE;IAClE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAED,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AARD,0DAQC;AAED;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,OAAsC;IAEtC,sEAAsE;IACtE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,6EAA6E;IAC7E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,sDAaC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
export interface EmbeddedContainerOptions {
|
|
3
|
-
runtime: string;
|
|
4
|
-
container?: string;
|
|
5
|
-
}
|
|
6
|
-
declare class EmbeddedContainerPlugin {
|
|
7
|
-
private options;
|
|
8
|
-
constructor(options: EmbeddedContainerOptions);
|
|
9
|
-
apply(compiler: Compiler): void;
|
|
10
|
-
}
|
|
11
|
-
export default EmbeddedContainerPlugin;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const InvertedContainerRuntimeModule_1 = __importDefault(require("./InvertedContainerRuntimeModule"));
|
|
7
|
-
class EmbeddedContainerPlugin {
|
|
8
|
-
constructor(options) {
|
|
9
|
-
this.options = options;
|
|
10
|
-
}
|
|
11
|
-
apply(compiler) {
|
|
12
|
-
compiler.hooks.thisCompilation.tap('EmbeddedContainerPlugin', (compilation) => {
|
|
13
|
-
// Adding the runtime module
|
|
14
|
-
compilation.hooks.additionalTreeRuntimeRequirements.tap('EmbeddedContainerPlugin', (chunk, set) => {
|
|
15
|
-
compilation.addRuntimeModule(chunk, new InvertedContainerRuntimeModule_1.default({
|
|
16
|
-
name: this.options.container,
|
|
17
|
-
}));
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.default = EmbeddedContainerPlugin;
|
|
23
|
-
//# sourceMappingURL=EmbeddedContainerPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedContainerPlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/EmbeddedContainerPlugin.ts"],"names":[],"mappings":";;;;;AACA,sGAA8E;AAO9E,MAAM,uBAAuB;IAG3B,YAAY,OAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,QAAkB;QAC7B,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,yBAAyB,EACzB,CAAC,WAAwB,EAAE,EAAE;YAC3B,4BAA4B;YAC5B,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,GAAG,CACrD,yBAAyB,EACzB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACb,WAAW,CAAC,gBAAgB,CAC1B,KAAK,EACL,IAAI,wCAA8B,CAAC;oBACjC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;iBAC7B,CAAC,CACH,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
import { ModuleFederationPluginOptions } from './types';
|
|
3
|
-
interface InvertedContainerOptions extends ModuleFederationPluginOptions {
|
|
4
|
-
container?: string;
|
|
5
|
-
remotes: Record<string, string>;
|
|
6
|
-
runtime: string;
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
chunkToEmbed: string;
|
|
9
|
-
}
|
|
10
|
-
declare class InvertedContainerPlugin {
|
|
11
|
-
private options;
|
|
12
|
-
constructor(options: InvertedContainerOptions);
|
|
13
|
-
apply(compiler: Compiler): void;
|
|
14
|
-
}
|
|
15
|
-
export default InvertedContainerPlugin;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const EmbeddedContainerPlugin_1 = __importDefault(require("./EmbeddedContainerPlugin"));
|
|
7
|
-
const enhanced_1 = require("@module-federation/enhanced");
|
|
8
|
-
class InvertedContainerPlugin {
|
|
9
|
-
constructor(options) {
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
apply(compiler) {
|
|
13
|
-
new EmbeddedContainerPlugin_1.default({
|
|
14
|
-
runtime: this.options.runtime,
|
|
15
|
-
container: this.options.container,
|
|
16
|
-
}).apply(compiler);
|
|
17
|
-
new enhanced_1.AsyncBoundaryPlugin({
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
eager: (module) => /\.federation/.test(module?.request || ''),
|
|
20
|
-
//@ts-ignore
|
|
21
|
-
}).apply(compiler);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.default = InvertedContainerPlugin;
|
|
25
|
-
//# sourceMappingURL=InvertedContainerPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InvertedContainerPlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/InvertedContainerPlugin.ts"],"names":[],"mappings":";;;;;AAEA,wFAAgE;AAChE,0DAAkE;AAUlE,MAAM,uBAAuB;IAG3B,YAAY,OAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,QAAkB;QAC7B,IAAI,iCAAuB,CAAC;YAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;SAClC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEnB,IAAI,8BAAmB,CAAC;YACtB,aAAa;YACb,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;YAC7D,YAAY;SACb,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare const RuntimeModule: typeof import("webpack").RuntimeModule;
|
|
2
|
-
interface InvertedContainerRuntimeModuleOptions {
|
|
3
|
-
name?: string;
|
|
4
|
-
}
|
|
5
|
-
declare class InvertedContainerRuntimeModule extends RuntimeModule {
|
|
6
|
-
private options;
|
|
7
|
-
constructor(options: InvertedContainerRuntimeModuleOptions);
|
|
8
|
-
private findEntryModuleOfContainer;
|
|
9
|
-
generate(): string;
|
|
10
|
-
}
|
|
11
|
-
export default InvertedContainerRuntimeModule;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
|
|
4
|
-
const enhanced_1 = require("@module-federation/enhanced");
|
|
5
|
-
const { RuntimeModule, Template, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
6
|
-
class InvertedContainerRuntimeModule extends RuntimeModule {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
super('inverted container startup', RuntimeModule.STAGE_TRIGGER);
|
|
9
|
-
this.options = options;
|
|
10
|
-
}
|
|
11
|
-
findEntryModuleOfContainer() {
|
|
12
|
-
if (!this.chunk || !this.chunkGraph)
|
|
13
|
-
return undefined;
|
|
14
|
-
const modules = this.chunkGraph.getChunkModules(this.chunk);
|
|
15
|
-
return Array.from(modules).find((module) => module instanceof enhanced_1.container.ContainerEntryModule);
|
|
16
|
-
}
|
|
17
|
-
generate() {
|
|
18
|
-
if (!this.compilation || !this.chunk || !this.compilation.chunkGraph) {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
const { name } = this.options;
|
|
22
|
-
const containerEntryModule = this.findEntryModuleOfContainer();
|
|
23
|
-
const containerModuleId = containerEntryModule
|
|
24
|
-
? this.compilation.chunkGraph.getModuleId(containerEntryModule)
|
|
25
|
-
: false;
|
|
26
|
-
if (!containerModuleId) {
|
|
27
|
-
return '';
|
|
28
|
-
}
|
|
29
|
-
const containerModuleIdJSON = JSON.stringify(containerModuleId);
|
|
30
|
-
const nameJSON = JSON.stringify(name);
|
|
31
|
-
return Template.asString([
|
|
32
|
-
`var innerRemote;`,
|
|
33
|
-
`function attachRemote (resolve) {`,
|
|
34
|
-
Template.indent([
|
|
35
|
-
`if(__webpack_require__.m[${containerModuleIdJSON}]) {`,
|
|
36
|
-
Template.indent(`innerRemote = __webpack_require__(${containerModuleIdJSON});`),
|
|
37
|
-
`}`,
|
|
38
|
-
`var gs = ${RuntimeGlobals.global} || globalThis`,
|
|
39
|
-
`gs[${nameJSON}] = innerRemote`,
|
|
40
|
-
`if(resolve) resolve(innerRemote);`,
|
|
41
|
-
`return innerRemote;`,
|
|
42
|
-
]),
|
|
43
|
-
`};`,
|
|
44
|
-
`${RuntimeGlobals.require}.federation.attachRemote = attachRemote;`,
|
|
45
|
-
`attachRemote();`,
|
|
46
|
-
]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.default = InvertedContainerRuntimeModule;
|
|
50
|
-
//# sourceMappingURL=InvertedContainerRuntimeModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InvertedContainerRuntimeModule.js","sourceRoot":"","sources":["../../../../src/plugins/container/InvertedContainerRuntimeModule.ts"],"names":[],"mappings":";;AAAA,0FAAqF;AAErF,0DAAwD;AAExD,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CACzD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAM9B,MAAM,8BAA+B,SAAQ,aAAa;IAGxD,YAAY,OAA8C;QACxD,KAAK,CAAC,4BAA4B,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEO,0BAA0B;QAChC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO,SAAS,CAAC;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAC7B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,YAAY,oBAAS,CAAC,oBAAoB,CAC7D,CAAC;IACJ,CAAC;IAEQ,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;YACrE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC9B,MAAM,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAE/C,CAAC;QAEd,MAAM,iBAAiB,GAAG,oBAAoB;YAC5C,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC/D,CAAC,CAAC,KAAK,CAAC;QAEV,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEtC,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,kBAAkB;YAClB,mCAAmC;YACnC,QAAQ,CAAC,MAAM,CAAC;gBACd,4BAA4B,qBAAqB,MAAM;gBACvD,QAAQ,CAAC,MAAM,CACb,qCAAqC,qBAAqB,IAAI,CAC/D;gBACD,GAAG;gBACH,YAAY,cAAc,CAAC,MAAM,gBAAgB;gBACjD,MAAM,QAAQ,iBAAiB;gBAC/B,mCAAmC;gBACnC,qBAAqB;aACtB,CAAC;YACF,IAAI;YACJ,GAAG,cAAc,CAAC,OAAO,0CAA0C;YACnE,iBAAiB;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,8BAA8B,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
/**
|
|
3
|
-
* This plugin removes eager modules from the runtime.
|
|
4
|
-
* @class RemoveEagerModulesFromRuntimePlugin
|
|
5
|
-
*/
|
|
6
|
-
declare class RemoveEagerModulesFromRuntimePlugin {
|
|
7
|
-
private container;
|
|
8
|
-
private debug;
|
|
9
|
-
private modulesToProcess;
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of RemoveEagerModulesFromRuntimePlugin.
|
|
12
|
-
* @param {Object} options - The options for the plugin.
|
|
13
|
-
* @param {string} options.container - The container to remove modules from.
|
|
14
|
-
* @param {boolean} options.debug - Whether to log debug information.
|
|
15
|
-
*/
|
|
16
|
-
constructor(options: {
|
|
17
|
-
container?: string;
|
|
18
|
-
debug?: boolean;
|
|
19
|
-
});
|
|
20
|
-
/**
|
|
21
|
-
* Applies the plugin to the compiler.
|
|
22
|
-
* @param {Compiler} compiler - The webpack compiler.
|
|
23
|
-
*/
|
|
24
|
-
apply(compiler: Compiler): void;
|
|
25
|
-
/**
|
|
26
|
-
* Processes the modules in the chunk.
|
|
27
|
-
* @param {Compilation} compilation - The webpack compilation.
|
|
28
|
-
* @param {Chunk} chunk - The chunk to process.
|
|
29
|
-
* @param {Iterable<Module>} modules - The modules in the chunk.
|
|
30
|
-
*/
|
|
31
|
-
private processModules;
|
|
32
|
-
/**
|
|
33
|
-
* Removes the modules from the chunk.
|
|
34
|
-
* @param {Compilation} compilation - The webpack compilation.
|
|
35
|
-
* @param {Chunk} chunk - The chunk to remove modules from.
|
|
36
|
-
*/
|
|
37
|
-
private removeModules;
|
|
38
|
-
}
|
|
39
|
-
export default RemoveEagerModulesFromRuntimePlugin;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* This plugin removes eager modules from the runtime.
|
|
5
|
-
* @class RemoveEagerModulesFromRuntimePlugin
|
|
6
|
-
*/
|
|
7
|
-
class RemoveEagerModulesFromRuntimePlugin {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of RemoveEagerModulesFromRuntimePlugin.
|
|
10
|
-
* @param {Object} options - The options for the plugin.
|
|
11
|
-
* @param {string} options.container - The container to remove modules from.
|
|
12
|
-
* @param {boolean} options.debug - Whether to log debug information.
|
|
13
|
-
*/
|
|
14
|
-
constructor(options) {
|
|
15
|
-
this.container = options.container;
|
|
16
|
-
this.debug = options.debug || false;
|
|
17
|
-
this.modulesToProcess = new Set();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Applies the plugin to the compiler.
|
|
21
|
-
* @param {Compiler} compiler - The webpack compiler.
|
|
22
|
-
*/
|
|
23
|
-
apply(compiler) {
|
|
24
|
-
if (!this.container) {
|
|
25
|
-
console.warn('[nextjs-mf]:', 'RemoveEagerModulesFromRuntimePlugin container is not defined:', this.container);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
compiler.hooks.thisCompilation.tap('RemoveEagerModulesFromRuntimePlugin', (compilation) => {
|
|
29
|
-
compilation.hooks.optimizeChunkModules.tap('RemoveEagerModulesFromRuntimePlugin', (chunks, modules) => {
|
|
30
|
-
for (const chunk of chunks) {
|
|
31
|
-
if (chunk.hasRuntime() && chunk.name === this.container) {
|
|
32
|
-
this.processModules(compilation, chunk, modules);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Processes the modules in the chunk.
|
|
40
|
-
* @param {Compilation} compilation - The webpack compilation.
|
|
41
|
-
* @param {Chunk} chunk - The chunk to process.
|
|
42
|
-
* @param {Iterable<Module>} modules - The modules in the chunk.
|
|
43
|
-
*/
|
|
44
|
-
processModules(compilation, chunk, modules) {
|
|
45
|
-
for (const module of modules) {
|
|
46
|
-
if (!compilation.chunkGraph.isModuleInChunk(module, chunk)) {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (module.constructor.name === 'NormalModule') {
|
|
50
|
-
this.modulesToProcess.add(module);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
this.removeModules(compilation, chunk);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Removes the modules from the chunk.
|
|
57
|
-
* @param {Compilation} compilation - The webpack compilation.
|
|
58
|
-
* @param {Chunk} chunk - The chunk to remove modules from.
|
|
59
|
-
*/
|
|
60
|
-
removeModules(compilation, chunk) {
|
|
61
|
-
for (const moduleToRemove of this.modulesToProcess) {
|
|
62
|
-
if (this.debug) {
|
|
63
|
-
console.log('removing', moduleToRemove.constructor.name);
|
|
64
|
-
}
|
|
65
|
-
if (compilation.chunkGraph.isModuleInChunk(moduleToRemove, chunk)) {
|
|
66
|
-
compilation.chunkGraph.disconnectChunkAndModule(chunk, moduleToRemove);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.default = RemoveEagerModulesFromRuntimePlugin;
|
|
72
|
-
//# sourceMappingURL=RemoveEagerModulesFromRuntimePlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveEagerModulesFromRuntimePlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/RemoveEagerModulesFromRuntimePlugin.ts"],"names":[],"mappings":";;AAEA;;;GAGG;AACH,MAAM,mCAAmC;IAKvC;;;;;OAKG;IACH,YAAY,OAAgD;QAC1D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,cAAc,EACd,+DAA+D,EAC/D,IAAI,CAAC,SAAS,CACf,CAAC;YACF,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,qCAAqC,EACrC,CAAC,WAAwB,EAAE,EAAE;YAC3B,WAAW,CAAC,KAAK,CAAC,oBAAo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CAAC,CAAC;YACzE,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,kBAAe,mCAAmC,CAAC"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function default_1() {
|
|
4
|
-
return {
|
|
5
|
-
name: 'next-internal-plugin',
|
|
6
|
-
errorLoadRemote({ id, error, from, origin }) {
|
|
7
|
-
console.error(id, 'offline');
|
|
8
|
-
const pg = function () {
|
|
9
|
-
console.error(id, 'offline', error);
|
|
10
|
-
return null;
|
|
11
|
-
};
|
|
12
|
-
pg.getInitialProps = function (ctx) {
|
|
13
|
-
return {};
|
|
14
|
-
};
|
|
15
|
-
let mod;
|
|
16
|
-
if (from === 'build') {
|
|
17
|
-
mod = () => ({
|
|
18
|
-
__esModule: true,
|
|
19
|
-
default: pg,
|
|
20
|
-
getServerSideProps: () => ({ props: {} }),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
mod = {
|
|
25
|
-
default: pg,
|
|
26
|
-
getServerSideProps: () => ({ props: {} }),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return mod;
|
|
30
|
-
},
|
|
31
|
-
beforeInit(args) {
|
|
32
|
-
const { userOptions, shareInfo } = args;
|
|
33
|
-
const { shared } = userOptions;
|
|
34
|
-
if (!globalThis.usedChunks)
|
|
35
|
-
globalThis.usedChunks = new Set();
|
|
36
|
-
if (shared) {
|
|
37
|
-
Object.keys(shared || {}).forEach((sharedKey) => {
|
|
38
|
-
if (!shared[sharedKey].strategy) {
|
|
39
|
-
shareInfo[sharedKey].strategy = 'loaded-first';
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
if (typeof __webpack_runtime_id__ === 'string' &&
|
|
44
|
-
!__webpack_runtime_id__.startsWith('webpack')) {
|
|
45
|
-
return args;
|
|
46
|
-
}
|
|
47
|
-
// if (__webpack_runtime_id__ && !__webpack_runtime_id__.startsWith('webpack')) return args;
|
|
48
|
-
const { moduleCache, name } = args.origin;
|
|
49
|
-
const gs = new Function('return globalThis')();
|
|
50
|
-
const attachedRemote = gs[name];
|
|
51
|
-
if (attachedRemote) {
|
|
52
|
-
moduleCache.set(name, attachedRemote);
|
|
53
|
-
}
|
|
54
|
-
return args;
|
|
55
|
-
},
|
|
56
|
-
init(args) {
|
|
57
|
-
return args;
|
|
58
|
-
},
|
|
59
|
-
beforeRequest: (args) => {
|
|
60
|
-
const { options, id } = args;
|
|
61
|
-
const remoteName = id.split('/').shift();
|
|
62
|
-
const remote = options.remotes.find((remote) => remote.name === remoteName);
|
|
63
|
-
if (!remote)
|
|
64
|
-
return args;
|
|
65
|
-
//@ts-ignore
|
|
66
|
-
if (remote?.entry?.includes('?t=')) {
|
|
67
|
-
return args;
|
|
68
|
-
}
|
|
69
|
-
//@ts-ignore
|
|
70
|
-
remote.entry = `${remote?.entry}?t=${Date.now()}`;
|
|
71
|
-
return args;
|
|
72
|
-
},
|
|
73
|
-
createScript({ url }) {
|
|
74
|
-
return;
|
|
75
|
-
},
|
|
76
|
-
afterResolve(args) {
|
|
77
|
-
return args;
|
|
78
|
-
},
|
|
79
|
-
onLoad(args) {
|
|
80
|
-
const { exposeModuleFactory, exposeModule, id } = args;
|
|
81
|
-
const moduleOrFactory = exposeModuleFactory || exposeModule;
|
|
82
|
-
if (!moduleOrFactory)
|
|
83
|
-
return args; // Ensure moduleOrFactory is defined
|
|
84
|
-
if (typeof window === 'undefined') {
|
|
85
|
-
let exposedModuleExports;
|
|
86
|
-
try {
|
|
87
|
-
exposedModuleExports = moduleOrFactory();
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
exposedModuleExports = moduleOrFactory;
|
|
91
|
-
}
|
|
92
|
-
const handler = {
|
|
93
|
-
get(target, prop, receiver) {
|
|
94
|
-
// Check if accessing a static property of the function itself
|
|
95
|
-
if (target === exposedModuleExports &&
|
|
96
|
-
typeof exposedModuleExports[prop] === 'function') {
|
|
97
|
-
return function (...args) {
|
|
98
|
-
globalThis.usedChunks.add(id);
|
|
99
|
-
return exposedModuleExports[prop].apply(this, args);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const originalMethod = target[prop];
|
|
103
|
-
if (typeof originalMethod === 'function') {
|
|
104
|
-
const proxiedFunction = function (...args) {
|
|
105
|
-
globalThis.usedChunks.add(id);
|
|
106
|
-
return originalMethod.apply(this, args);
|
|
107
|
-
};
|
|
108
|
-
// Copy all enumerable properties from the original method to the proxied function
|
|
109
|
-
Object.keys(originalMethod).forEach((prop) => {
|
|
110
|
-
Object.defineProperty(proxiedFunction, prop, {
|
|
111
|
-
value: originalMethod[prop],
|
|
112
|
-
writable: true,
|
|
113
|
-
enumerable: true,
|
|
114
|
-
configurable: true,
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
return proxiedFunction;
|
|
118
|
-
}
|
|
119
|
-
return Reflect.get(target, prop, receiver);
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
if (typeof exposedModuleExports === 'function') {
|
|
123
|
-
// If the module export is a function, we create a proxy that can handle both its
|
|
124
|
-
// call (as a function) and access to its properties (including static methods).
|
|
125
|
-
exposedModuleExports = new Proxy(exposedModuleExports, handler);
|
|
126
|
-
// Proxy static properties specifically
|
|
127
|
-
const staticProps = Object.getOwnPropertyNames(exposedModuleExports);
|
|
128
|
-
staticProps.forEach((prop) => {
|
|
129
|
-
if (typeof exposedModuleExports[prop] === 'function') {
|
|
130
|
-
exposedModuleExports[prop] = new Proxy(exposedModuleExports[prop], handler);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return () => exposedModuleExports;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// For objects, just wrap the exported object itself
|
|
137
|
-
exposedModuleExports = new Proxy(exposedModuleExports, handler);
|
|
138
|
-
}
|
|
139
|
-
return exposedModuleExports;
|
|
140
|
-
}
|
|
141
|
-
return args;
|
|
142
|
-
},
|
|
143
|
-
resolveShare(args) {
|
|
144
|
-
if (args.pkgName !== 'react' &&
|
|
145
|
-
args.pkgName !== 'react-dom' &&
|
|
146
|
-
!args.pkgName.startsWith('next/')) {
|
|
147
|
-
return args;
|
|
148
|
-
}
|
|
149
|
-
const { shareScopeMap, scope, pkgName, version, GlobalFederation } = args;
|
|
150
|
-
const host = GlobalFederation['__INSTANCES__'][0];
|
|
151
|
-
if (!host) {
|
|
152
|
-
return args;
|
|
153
|
-
}
|
|
154
|
-
args.resolver = function () {
|
|
155
|
-
shareScopeMap[scope][pkgName][version] = host.options.shared[pkgName]; // replace local share scope manually with desired module
|
|
156
|
-
return shareScopeMap[scope][pkgName][version];
|
|
157
|
-
};
|
|
158
|
-
return args;
|
|
159
|
-
},
|
|
160
|
-
async beforeLoadShare(args) {
|
|
161
|
-
return args;
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
exports.default = default_1;
|
|
166
|
-
//# sourceMappingURL=runtimePlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtimePlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/runtimePlugin.ts"],"names":[],"mappings":";;AACA;IACE,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,eAAe,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;YACzC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC7B,MAAM,EAAE,GAAG;gBACT,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;gBACpC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;YAEF,EAAE,CAAC,eAAe,GAAG,UAAU,GAAQ;gBACrC,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,IAAI,GAAG,CAAC;YACR,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACr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