@module-federation/nextjs-mf 0.0.0-next-20240227135200 → 0.0.0-next-20240228024304
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/dist/package.json +3 -8
- package/dist/src/internal.js +0 -78
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +0 -1
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -1
- package/dist/src/plugins/container/runtimePlugin.js.map +1 -1
- package/package.json +6 -6
- package/dist/src/plugins/container/HoistPseudoEagerModules.d.ts +0 -19
- package/dist/src/plugins/container/HoistPseudoEagerModules.js +0 -79
- package/dist/src/plugins/container/HoistPseudoEagerModules.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/package.json
CHANGED
|
@@ -48,25 +48,20 @@
|
|
|
48
48
|
"@module-federation/webpack-type": "workspace:*",
|
|
49
49
|
"acorn": "7.4.1",
|
|
50
50
|
"buffer": "5.7.1",
|
|
51
|
-
"chalk": "3.0.0",
|
|
52
51
|
"chrome-trace-event": "1.0.3",
|
|
53
|
-
"enhanced-resolve": "5.
|
|
52
|
+
"enhanced-resolve": "5.15.0",
|
|
54
53
|
"eslint-scope": "7.2.2",
|
|
55
54
|
"eventemitter3": "^5.0.0",
|
|
56
55
|
"events": "3.3.0",
|
|
57
56
|
"fast-glob": "^3.2.11",
|
|
58
|
-
"
|
|
59
|
-
"fs-extra": "9.1.0",
|
|
57
|
+
"node-fetch": "2.7.0",
|
|
60
58
|
"schema-utils": "3.3.0",
|
|
61
59
|
"semver": "6.3.1",
|
|
62
60
|
"tapable": "2.2.1",
|
|
63
|
-
"terser-webpack-plugin": "5.3.9",
|
|
64
61
|
"upath": "2.0.1",
|
|
65
62
|
"url": "0.11.3",
|
|
66
63
|
"util": "0.12.5",
|
|
67
|
-
"webpack-sources": "^3.2.3"
|
|
68
|
-
"@module-federation/managers": "0.0.1",
|
|
69
|
-
"@module-federation/manifest": "0.0.1"
|
|
64
|
+
"webpack-sources": "^3.2.3"
|
|
70
65
|
},
|
|
71
66
|
"peerDependencies": {
|
|
72
67
|
"next": "^12 || ^13 || ^14",
|
package/dist/src/internal.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toDisplayErrors = exports.getDelegates = exports.parseRemotes = exports.DEFAULT_SHARE_SCOPE_BROWSER = exports.DEFAULT_SHARE_SCOPE = void 0;
|
|
4
|
-
const enhanced_1 = require("@module-federation/enhanced");
|
|
5
4
|
/**
|
|
6
5
|
* @typedef SharedObject
|
|
7
6
|
* @type {object}
|
|
@@ -32,12 +31,6 @@ exports.DEFAULT_SHARE_SCOPE = {
|
|
|
32
31
|
singleton: true,
|
|
33
32
|
import: undefined,
|
|
34
33
|
},
|
|
35
|
-
'@module-federation/utilities': {
|
|
36
|
-
eager: true,
|
|
37
|
-
version: require('@module-federation/utilities/package.json').version,
|
|
38
|
-
requiredVersion: require('@module-federation/utilities/package.json')
|
|
39
|
-
.version,
|
|
40
|
-
},
|
|
41
34
|
'next/image': {
|
|
42
35
|
requiredVersion: undefined,
|
|
43
36
|
singleton: true,
|
|
@@ -71,12 +64,10 @@ exports.DEFAULT_SHARE_SCOPE = {
|
|
|
71
64
|
'react/jsx-dev-runtime': {
|
|
72
65
|
singleton: true,
|
|
73
66
|
requiredVersion: undefined,
|
|
74
|
-
import: undefined,
|
|
75
67
|
},
|
|
76
68
|
'react/jsx-runtime': {
|
|
77
69
|
singleton: true,
|
|
78
70
|
requiredVersion: undefined,
|
|
79
|
-
// import: false,
|
|
80
71
|
},
|
|
81
72
|
'styled-jsx': {
|
|
82
73
|
singleton: true,
|
|
@@ -119,15 +110,6 @@ exports.DEFAULT_SHARE_SCOPE_BROWSER = Object.entries(exports.DEFAULT_SHARE_SCOPE
|
|
|
119
110
|
* @returns {boolean} - True if the value is an internal or promise delegate module reference, false otherwise.
|
|
120
111
|
*/
|
|
121
112
|
const isInternalOrPromise = (value) => ['internal ', 'promise '].some((prefix) => value.startsWith(prefix));
|
|
122
|
-
/**
|
|
123
|
-
* Checks if the remote value is using the standard remote syntax.
|
|
124
|
-
*
|
|
125
|
-
* @param {string} value - The remote value to check.
|
|
126
|
-
* @returns {boolean} - True if the value is using the standard remote syntax, false otherwise.
|
|
127
|
-
*/
|
|
128
|
-
const isStandardRemoteSyntax = (value) => {
|
|
129
|
-
return value.includes('@');
|
|
130
|
-
};
|
|
131
113
|
/**
|
|
132
114
|
* Parses the remotes object and checks if they are using a custom promise template or not.
|
|
133
115
|
* If it's a custom promise template, the remote syntax is parsed to get the module name and version number.
|
|
@@ -167,66 +149,6 @@ const isInternalDelegate = (value) => {
|
|
|
167
149
|
*/
|
|
168
150
|
const getDelegates = (remotes) => Object.entries(remotes).reduce((acc, [key, value]) => isInternalDelegate(value) ? { ...acc, [key]: value } : acc, {});
|
|
169
151
|
exports.getDelegates = getDelegates;
|
|
170
|
-
/**
|
|
171
|
-
* This function validates the type of the shared item and constructs a shared configuration object based on the item and key.
|
|
172
|
-
* If the item is identical to the key or if the item does not necessitate a specific version,
|
|
173
|
-
* the function returns an object with the import property set to the item.
|
|
174
|
-
* Otherwise, it returns an object with the import property set to the key and the requiredVersion property set to the item.
|
|
175
|
-
*
|
|
176
|
-
* @param {string | string[]} item - The shared item to be validated and used to construct the shared configuration object. It can be a string or an array of strings.
|
|
177
|
-
* @param {string} key - The key associated with the shared item.
|
|
178
|
-
* @returns {object} - The constructed shared configuration object.
|
|
179
|
-
* @throws {Error} - An error is thrown if the item type is not a string or an array of strings.
|
|
180
|
-
*/
|
|
181
|
-
const getSharedConfig = (item, key) => {
|
|
182
|
-
if (Array.isArray(item)) {
|
|
183
|
-
// This handles the case where item is an array
|
|
184
|
-
// Replace the following line with your actual logic
|
|
185
|
-
return item.map((i) => ({
|
|
186
|
-
import: i === key || !(0, enhanced_1.isRequiredVersion)(i) ? i : key,
|
|
187
|
-
requiredVersion: i === key || !(0, enhanced_1.isRequiredVersion)(i) ? undefined : i,
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
else if (typeof item === 'string') {
|
|
191
|
-
// Handle the case where item is a string
|
|
192
|
-
return {
|
|
193
|
-
import: item === key || !(0, enhanced_1.isRequiredVersion)(item) ? item : key,
|
|
194
|
-
requiredVersion: item === key || !(0, enhanced_1.isRequiredVersion)(item) ? undefined : item,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
throw new Error('Unexpected type in shared');
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Parses the share options from the provided ModuleFederationPluginOptions object and constructs a new object containing all shared configurations.
|
|
203
|
-
* This newly constructed object is then used as the value for the 'shared' property of the Module Federation Plugin Options.
|
|
204
|
-
* The function uses the 'parseOptions' utility function from webpack to parse the 'shared' property of the provided options object.
|
|
205
|
-
* The 'getSharedConfig' function is used as the 'config' argument for 'parseOptions' to construct the shared configuration object for each shared item.
|
|
206
|
-
* The 'item' argument for 'parseOptions' is a function that simply returns the item as it is.
|
|
207
|
-
* The function then reduces the parsed shared options into a new object with the shared configuration for each shared item.
|
|
208
|
-
*
|
|
209
|
-
* @param {ModuleFederationPluginOptions} options - The ModuleFederationPluginOptions object to parse the share options from.
|
|
210
|
-
* @returns {Record<string, SharedConfig>} - An object containing the shared configuration for each shared item.
|
|
211
|
-
*/
|
|
212
|
-
const parseShareOptions = (options) => {
|
|
213
|
-
if (!options.shared)
|
|
214
|
-
return options;
|
|
215
|
-
const sharedOptions = (0, enhanced_1.parseOptions)(options.shared, getSharedConfig, (item) => item);
|
|
216
|
-
return sharedOptions.reduce((acc, [key, options]) => {
|
|
217
|
-
acc[key] = {
|
|
218
|
-
import: options.import,
|
|
219
|
-
shareKey: options.shareKey || key,
|
|
220
|
-
shareScope: options.shareScope,
|
|
221
|
-
requiredVersion: options.requiredVersion,
|
|
222
|
-
strictVersion: options.strictVersion,
|
|
223
|
-
singleton: options.singleton,
|
|
224
|
-
packageName: options.packageName,
|
|
225
|
-
eager: options.eager,
|
|
226
|
-
};
|
|
227
|
-
return acc;
|
|
228
|
-
}, {});
|
|
229
|
-
};
|
|
230
152
|
/**
|
|
231
153
|
* Takes an error object and formats it into a displayable string.
|
|
232
154
|
* If the error object contains a stack trace, it is appended to the error message.
|
package/dist/src/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":";;;AAOA;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAiB;IAC/C,cAAc,EAAE;QACd,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,WAAW,EAAE;QACX,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,WAAW,EAAE;QACX,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,aAAa,EAAE;QACb,eAAe,EAAE,KAAK;QACtB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,YAAY,EAAE;QACZ,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,aAAa,EAAE;QACb,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,SAAS;KAClB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,IAAI;Q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AK,CAAC,EAAE,EAAE,CACpB,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAC5D,EAAE,CACH,CAAC;AAPS,QAAA,YAAY,gBAOrB;AAEJ;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,KAAY,EAAU,EAAE;IAC3C,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACxB,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,IAAI,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,GAAY,EAAU,EAAE;IACtD,OAAO,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
|
|
@@ -114,7 +114,6 @@ function handleServerExternals(compiler, options) {
|
|
|
114
114
|
// Check if the module should not be treated as external
|
|
115
115
|
if (ctx.request &&
|
|
116
116
|
(ctx.request.includes('@module-federation/utilities') ||
|
|
117
|
-
ctx.request.includes('internal-delegate-hoist') ||
|
|
118
117
|
Object.keys(options.shared || {}).some((key) => {
|
|
119
118
|
return (
|
|
120
119
|
//@ts-ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-server-plugins.js","sourceRoot":"","sources":["../../../../src/plugins/NextFederationPlugin/apply-server-plugins.ts"],"names":[],"mappings":";;;;;;AAEA,0DAA6E;AAC7E,gDAAwB;AACxB,mGAA2E;AAC3E,0DAAqE;AACrE;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,QAAkB,EAClB,OAAsC;IAEtC,gEAAgE;IAChE,MAAM,EAAE,qBAAqB,EAAE,G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AAO,CAAC,IAAI;KACnB,CAAC;IAEF,kEAAkE;IAClE,OAAO,CAAC,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;AAC/D,CAAC;AAXD,8EAWC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CACnC,QAAkB,EAClB,OAAsC;IAEtC,qDAAqD;IACrD,oCAAoC;IACpC,gCAAgC;IAChC,uCAAuC;IACvC,gFAAgF;IAChF,IACE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC;QACzC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAC7B,CAAC;QACD,2CAA2C;QAC3C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAExD,2EAA2E;QAC3E,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,WAAW,GAAQ,EAAE,QAAa;YACrE,YAAY;YACZ,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACxD,2DAA2D;YAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO;YACT,CAAC;YACD,qEAAqE;YACrE,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACnC,wDAAwD;YACxD,IACE,GAAG,CAAC,OAAO;gBACX,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAC;oBACnD,
|
|
1
|
+
{"version":3,"file":"apply-server-plugins.js","sourceRoot":"","sources":["../../../../src/plugins/NextFederationPlugin/apply-server-plugins.ts"],"names":[],"mappings":";;;;;;AAEA,0DAA6E;AAC7E,gDAAwB;AACxB,mGAA2E;AAC3E,0DAAqE;AACrE;;;;;;;GAOG;AACH,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
|
1
|
-
{"version":3,"file":"runtimePlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/runtimePlugin.ts"],"names":[],"mappings":";;
|
|
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;gBACrB,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC;oBACX,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,EAAE;oBACX,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;iBAC1C,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG;oBACJ,OAAO,EAAE,EAAE;oBACX,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;iBAC1C,CAAC;YACJ,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC;QACD,UAAU,CAAC,IAAI;YACb,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;YACxC,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,UAAU,CAAC,UAAU;gBAAE,U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C,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,yDAAyD;gBAChI,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;YAChD,CAAC,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,eAAe,CAAC,IAAI;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AA1HD,4BA0HC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/nextjs-mf",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240228024304",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"fast-glob": "^3.2.11",
|
|
42
42
|
"webpack-sources": "^3.2.3",
|
|
43
43
|
"eventemitter3": "^5.0.0",
|
|
44
|
-
"@module-federation/utilities": "
|
|
45
|
-
"@module-federation/runtime": "0.0.0-next-
|
|
46
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
47
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
48
|
-
"@module-federation/node": "0.0.0-next-
|
|
44
|
+
"@module-federation/utilities": "0.0.0-next-20240228024304",
|
|
45
|
+
"@module-federation/runtime": "0.0.0-next-20240228024304",
|
|
46
|
+
"@module-federation/sdk": "0.0.0-next-20240228024304",
|
|
47
|
+
"@module-federation/enhanced": "0.0.0-next-20240228024304",
|
|
48
|
+
"@module-federation/node": "0.0.0-next-20240228024304",
|
|
49
49
|
"@module-federation/webpack-type": "0.0.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {import("webpack").Compiler} Compiler
|
|
4
|
-
* @typedef {import("webpack").Compilation} Compilation
|
|
5
|
-
* @typedef {import("webpack").Chunk} Chunk
|
|
6
|
-
* @typedef {import("webpack").Module} Module
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* This class is responsible for hoisting container references in the code.
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
export declare class HoistPseudoEager {
|
|
13
|
-
/**
|
|
14
|
-
* @function apply
|
|
15
|
-
* @param {Compiler} compiler The webpack compiler object
|
|
16
|
-
*/
|
|
17
|
-
apply(compiler: Compiler): void;
|
|
18
|
-
}
|
|
19
|
-
export default HoistPseudoEager;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HoistPseudoEager = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import("webpack").Compiler} Compiler
|
|
6
|
-
* @typedef {import("webpack").Compilation} Compilation
|
|
7
|
-
* @typedef {import("webpack").Chunk} Chunk
|
|
8
|
-
* @typedef {import("webpack").Module} Module
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* This class is responsible for hoisting container references in the code.
|
|
12
|
-
* @constructor
|
|
13
|
-
*/
|
|
14
|
-
class HoistPseudoEager {
|
|
15
|
-
/**
|
|
16
|
-
* @function apply
|
|
17
|
-
* @param {Compiler} compiler The webpack compiler object
|
|
18
|
-
*/
|
|
19
|
-
apply(compiler) {
|
|
20
|
-
// Hook into the compilation process
|
|
21
|
-
compiler.hooks.thisCompilation.tap('HoistPseudoEager', (compilation) => {
|
|
22
|
-
// Perform the hoisting after chunks are optimized
|
|
23
|
-
compilation.hooks.afterOptimizeChunks.tap('HoistPseudoEager', (chunks, chunkGroups) => {
|
|
24
|
-
// Create a map to store chunks by their id or name
|
|
25
|
-
/** @type {Map<(string|number), Chunk>} */
|
|
26
|
-
const chunkSet = new Map();
|
|
27
|
-
// Create a set to store external module requests
|
|
28
|
-
/** @type {Set<Module>} */
|
|
29
|
-
const externalRequests = new Set();
|
|
30
|
-
// Populate the chunkSet with chunks
|
|
31
|
-
for (const chunk of chunks) {
|
|
32
|
-
const ident = chunk.id || chunk.name;
|
|
33
|
-
if (ident) {
|
|
34
|
-
chunkSet.set(ident, chunk);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// Iterate over chunks again to handle remote modules
|
|
38
|
-
for (const chunk of chunks) {
|
|
39
|
-
// Get iterable of remote modules for the chunk
|
|
40
|
-
const remoteModules = compilation.chunkGraph.getChunkModulesIterableBySourceType(chunk, 'remote');
|
|
41
|
-
if (!remoteModules)
|
|
42
|
-
continue;
|
|
43
|
-
const runtime = chunkSet.get('webpack-runtime') || chunkSet.get('webpack');
|
|
44
|
-
const runtimeRoots = runtime
|
|
45
|
-
? compilation.chunkGraph.getChunkRootModules(runtime)
|
|
46
|
-
: null;
|
|
47
|
-
const refChunks = runtime
|
|
48
|
-
? Array.from(runtime.getAllReferencedChunks())
|
|
49
|
-
: null;
|
|
50
|
-
if (refChunks) {
|
|
51
|
-
for (const refChunk of refChunks) {
|
|
52
|
-
const consumeSharedModules = compilation.chunkGraph.getChunkModulesIterableBySourceType(refChunk, 'consume-shared');
|
|
53
|
-
if (!consumeSharedModules)
|
|
54
|
-
continue;
|
|
55
|
-
//loop through consume-shared modules
|
|
56
|
-
for (const module of consumeSharedModules) {
|
|
57
|
-
// Get the module associated with the dependency
|
|
58
|
-
for (const block of module.blocks) {
|
|
59
|
-
for (const dep of block.dependencies) {
|
|
60
|
-
const mod = compilation.moduleGraph.getModule(dep);
|
|
61
|
-
// If the module exists and the chunk has a runtime, add the module to externalRequests
|
|
62
|
-
if (mod !== null && runtime) {
|
|
63
|
-
// Get the runtime chunk from the chunkSet
|
|
64
|
-
// If the runtime chunk exists, connect it with the module in the chunk graph
|
|
65
|
-
compilation.chunkGraph.connectChunkAndModule(runtime, mod);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.HoistPseudoEager = HoistPseudoEager;
|
|
78
|
-
exports.default = HoistPseudoEager;
|
|
79
|
-
//# sourceMappingURL=HoistPseudoEagerModules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HoistPseudoEagerModules.js","sourceRoot":"","sources":["../../../../src/plugins/container/HoistPseudoEagerModules.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAa,gBAAgB;IAC3B;;;OAGG;IACH,KAAK,CAAC,QAAkB;QACtB,oCAAoC;QACpC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,kBAAkB,EAClB,CAAC,WAAwB,EAAE,EAAE;YAC3B,kDAAkD;YAClD,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CACvC,kBAAkB,EAClB,CAAC,MAAuB,EAAE,WAAyB,EAAE,EAAE;gBACrD,mDAAmD;gBACnD,0CAA0C;gBAC1C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;gBACnD,iDAAiD;gBACjD,0BAA0B;gBAC1B,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;gBAC3C,oCAAoC;gBACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC;oBACrC,IAAI,KAAK,EAAE,CAAC;wBACV,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBAED,qDAAqD;gBACrD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE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CACJ,CAAC;oCACH,CAAC;gCACH,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA/ED,4CA+EC;AACD,kBAAe,gBAAgB,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,OA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