@module-federation/node 2.7.32 → 2.7.33
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/_virtual/_rolldown/runtime.js +31 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/plugins/ChunkCorrelationPlugin.js +308 -0
- package/dist/plugins/ChunkCorrelationPlugin.js.map +1 -0
- package/dist/plugins/ChunkCorrelationPlugin.mjs +305 -0
- package/dist/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
- package/dist/src/filesystem/stratagies.d.mts +21 -0
- package/dist/src/filesystem/stratagies.d.ts +10 -7
- package/dist/src/filesystem/stratagies.js +97 -116
- package/dist/src/filesystem/stratagies.js.map +1 -1
- package/dist/src/filesystem/stratagies.mjs +103 -0
- package/dist/src/filesystem/stratagies.mjs.map +1 -0
- package/dist/src/index.d.mts +8 -0
- package/dist/src/index.d.ts +8 -7
- package/dist/src/index.js +16 -22
- package/dist/src/index.mjs +9 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.d.mts +12 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -7
- package/dist/src/plugins/AutomaticPublicPathPlugin.js +26 -35
- package/dist/src/plugins/AutomaticPublicPathPlugin.js.map +1 -1
- package/dist/src/plugins/AutomaticPublicPathPlugin.mjs +28 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.mjs.map +1 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.d.mts +5 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.d.ts +4 -61
- package/dist/src/plugins/ChunkCorrelationPlugin.js +8 -440
- package/dist/src/plugins/ChunkCorrelationPlugin.js.map +1 -1
- package/dist/src/plugins/ChunkCorrelationPlugin.mjs +8 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.mts +21 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.ts +16 -13
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.js +68 -118
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -1
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs +70 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs.map +1 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.mts +46 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +39 -34
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +110 -126
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -1
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs +111 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.d.mts +17 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.d.ts +14 -10
- package/dist/src/plugins/EntryChunkTrackerPlugin.js +30 -32
- package/dist/src/plugins/EntryChunkTrackerPlugin.js.map +1 -1
- package/dist/src/plugins/EntryChunkTrackerPlugin.mjs +38 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.mjs.map +1 -0
- package/dist/src/plugins/NodeFederationPlugin.d.mts +54 -0
- package/dist/src/plugins/NodeFederationPlugin.d.ts +33 -26
- package/dist/src/plugins/NodeFederationPlugin.js +69 -84
- package/dist/src/plugins/NodeFederationPlugin.js.map +1 -1
- package/dist/src/plugins/NodeFederationPlugin.mjs +70 -0
- package/dist/src/plugins/NodeFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.d.mts +15 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.d.ts +12 -8
- package/dist/src/plugins/RemotePublicPathRuntimeModule.js +34 -35
- package/dist/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -1
- package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs +132 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/StreamingTargetPlugin.d.mts +32 -0
- package/dist/src/plugins/StreamingTargetPlugin.d.ts +19 -16
- package/dist/src/plugins/StreamingTargetPlugin.js +43 -56
- package/dist/src/plugins/StreamingTargetPlugin.js.map +1 -1
- package/dist/src/plugins/StreamingTargetPlugin.mjs +46 -0
- package/dist/src/plugins/StreamingTargetPlugin.mjs.map +1 -0
- package/dist/src/plugins/UniversalFederationPlugin.d.mts +49 -0
- package/dist/src/plugins/UniversalFederationPlugin.d.ts +26 -23
- package/dist/src/plugins/UniversalFederationPlugin.js +58 -81
- package/dist/src/plugins/UniversalFederationPlugin.js.map +1 -1
- package/dist/src/plugins/UniversalFederationPlugin.mjs +61 -0
- package/dist/src/plugins/UniversalFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.mts +9 -0
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts +6 -3
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js +17 -17
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js.map +1 -1
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs +25 -0
- package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs.map +1 -0
- package/dist/src/plugins/webpackChunkUtilities.d.mts +55 -0
- package/dist/src/plugins/webpackChunkUtilities.d.ts +14 -9
- package/dist/src/plugins/webpackChunkUtilities.js +195 -257
- package/dist/src/plugins/webpackChunkUtilities.js.map +1 -1
- package/dist/src/plugins/webpackChunkUtilities.mjs +234 -0
- package/dist/src/plugins/webpackChunkUtilities.mjs.map +1 -0
- package/dist/src/recordDynamicRemoteEntryHashPlugin.d.mts +7 -0
- package/dist/src/recordDynamicRemoteEntryHashPlugin.d.ts +5 -2
- package/dist/src/recordDynamicRemoteEntryHashPlugin.js +24 -61
- package/dist/src/recordDynamicRemoteEntryHashPlugin.js.map +1 -1
- package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs +26 -0
- package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs.map +1 -0
- package/dist/src/runtimePlugin.d.mts +27 -0
- package/dist/src/runtimePlugin.d.ts +24 -19
- package/dist/src/runtimePlugin.js +157 -252
- package/dist/src/runtimePlugin.js.map +1 -1
- package/dist/src/runtimePlugin.mjs +169 -0
- package/dist/src/runtimePlugin.mjs.map +1 -0
- package/dist/src/types/index.d.mts +8 -0
- package/dist/src/types/index.d.ts +8 -3
- package/dist/src/types/index.js +1 -3
- package/dist/src/types/index.mjs +1 -0
- package/dist/src/utils/flush-chunks.d.mts +15 -0
- package/dist/src/utils/flush-chunks.d.ts +7 -3
- package/dist/src/utils/flush-chunks.js +87 -161
- package/dist/src/utils/flush-chunks.js.map +1 -1
- package/dist/src/utils/flush-chunks.mjs +99 -0
- package/dist/src/utils/flush-chunks.mjs.map +1 -0
- package/dist/src/utils/hot-reload.d.mts +16 -0
- package/dist/src/utils/hot-reload.d.ts +14 -10
- package/dist/src/utils/hot-reload.js +177 -264
- package/dist/src/utils/hot-reload.js.map +1 -1
- package/dist/src/utils/hot-reload.mjs +194 -0
- package/dist/src/utils/hot-reload.mjs.map +1 -0
- package/dist/src/utils/index.d.mts +3 -0
- package/dist/src/utils/index.d.ts +3 -2
- package/dist/src/utils/index.js +15 -19
- package/dist/src/utils/index.mjs +4 -0
- package/package.json +59 -15
- package/dist/jest.config.d.ts +0 -11
- package/dist/jest.config.js +0 -19
- package/dist/jest.config.js.map +0 -1
- package/dist/package.json +0 -82
- package/dist/src/index.js.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
|
@@ -1,85 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const StreamingTargetPlugin_1 = __importDefault(require("./StreamingTargetPlugin"));
|
|
10
|
-
const NodeFederationPlugin_1 = __importDefault(require("./NodeFederationPlugin"));
|
|
11
|
-
const webpack_1 = require("@module-federation/enhanced/webpack");
|
|
12
|
-
const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
const require_src_plugins_StreamingTargetPlugin = require('./StreamingTargetPlugin.js');
|
|
4
|
+
const require_src_plugins_NodeFederationPlugin = require('./NodeFederationPlugin.js');
|
|
5
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
6
|
+
let _module_federation_enhanced_webpack = require("@module-federation/enhanced/webpack");
|
|
7
|
+
|
|
8
|
+
//#region src/plugins/UniversalFederationPlugin.ts
|
|
13
9
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class UniversalFederationPlugin {
|
|
17
|
-
/**
|
|
18
|
-
* Create a UniversalFederationPlugin
|
|
19
|
-
* @param {NodeFederationOptions} options - The options for the plugin
|
|
20
|
-
* @param {NodeFederationContext} context - The context for the plugin
|
|
21
|
-
*/
|
|
22
|
-
constructor(options, context) {
|
|
23
|
-
this._options = options || {};
|
|
24
|
-
this.context = context || {};
|
|
25
|
-
this.name = 'ModuleFederationPlugin';
|
|
26
|
-
if (this._options.useRuntimePlugin && this._options.isServer) {
|
|
27
|
-
this._options.runtimePlugins = this._options.runtimePlugins
|
|
28
|
-
? this._options.runtimePlugins.concat([
|
|
29
|
-
require.resolve('../runtimePlugin.js'),
|
|
30
|
-
])
|
|
31
|
-
: [require.resolve('../runtimePlugin.js')];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
updateCompilerOptions(compiler) {
|
|
35
|
-
compiler.options.output.chunkFormat = 'commonjs';
|
|
36
|
-
if (compiler.options.output.enabledLibraryTypes === undefined) {
|
|
37
|
-
compiler.options.output.enabledLibraryTypes = ['commonjs-module'];
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
compiler.options.output.enabledLibraryTypes.push('commonjs-module');
|
|
41
|
-
}
|
|
42
|
-
const chunkFileName = compiler.options?.output?.chunkFilename;
|
|
43
|
-
const uniqueName = compiler?.options?.output?.uniqueName || this._options.name;
|
|
44
|
-
if (typeof chunkFileName === 'string' &&
|
|
45
|
-
uniqueName &&
|
|
46
|
-
!chunkFileName.includes(uniqueName)) {
|
|
47
|
-
const suffix = `-[contenthash].js`;
|
|
48
|
-
compiler.options.output.chunkFilename = chunkFileName.replace('.js', suffix);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Apply the plugin to the compiler
|
|
53
|
-
* @param {Compiler} compiler - The webpack compiler
|
|
54
|
-
*/
|
|
55
|
-
apply(compiler) {
|
|
56
|
-
const { isServer, debug, useRuntimePlugin, ...options } = this._options;
|
|
57
|
-
const { webpack } = compiler;
|
|
58
|
-
if (!process.env['FEDERATION_WEBPACK_PATH']) {
|
|
59
|
-
process.env['FEDERATION_WEBPACK_PATH'] = (0, normalize_webpack_path_1.getWebpackPath)(compiler);
|
|
60
|
-
}
|
|
61
|
-
if (isServer ||
|
|
62
|
-
compiler.options.name === 'server' ||
|
|
63
|
-
compiler.options.target === 'node' ||
|
|
64
|
-
compiler.options.target === 'async-node') {
|
|
65
|
-
if (useRuntimePlugin) {
|
|
66
|
-
this.updateCompilerOptions(compiler);
|
|
67
|
-
new webpack_1.ModuleFederationPlugin({
|
|
68
|
-
...options,
|
|
69
|
-
}).apply(compiler);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
new NodeFederationPlugin_1.default(options, this.context).apply(compiler);
|
|
73
|
-
new StreamingTargetPlugin_1.default({ ...options, debug }).apply(compiler);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
new webpack_1.ModuleFederationPlugin(options).apply(compiler);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
10
|
+
* Importing necessary plugins and types
|
|
11
|
+
*/
|
|
81
12
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
13
|
+
* Class representing a UniversalFederationPlugin
|
|
14
|
+
*/
|
|
15
|
+
var UniversalFederationPlugin = class {
|
|
16
|
+
/**
|
|
17
|
+
* Create a UniversalFederationPlugin
|
|
18
|
+
* @param {NodeFederationOptions} options - The options for the plugin
|
|
19
|
+
* @param {NodeFederationContext} context - The context for the plugin
|
|
20
|
+
*/
|
|
21
|
+
constructor(options, context) {
|
|
22
|
+
this._options = options || {};
|
|
23
|
+
this.context = context || {};
|
|
24
|
+
this.name = "ModuleFederationPlugin";
|
|
25
|
+
if (this._options.useRuntimePlugin && this._options.isServer) this._options.runtimePlugins = this._options.runtimePlugins ? this._options.runtimePlugins.concat([require.resolve("../runtimePlugin.js")]) : [require.resolve("../runtimePlugin.js")];
|
|
26
|
+
}
|
|
27
|
+
updateCompilerOptions(compiler) {
|
|
28
|
+
compiler.options.output.chunkFormat = "commonjs";
|
|
29
|
+
if (compiler.options.output.enabledLibraryTypes === void 0) compiler.options.output.enabledLibraryTypes = ["commonjs-module"];
|
|
30
|
+
else compiler.options.output.enabledLibraryTypes.push("commonjs-module");
|
|
31
|
+
const chunkFileName = compiler.options?.output?.chunkFilename;
|
|
32
|
+
const uniqueName = compiler?.options?.output?.uniqueName || this._options.name;
|
|
33
|
+
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
34
|
+
const suffix = `-[contenthash].js`;
|
|
35
|
+
compiler.options.output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Apply the plugin to the compiler
|
|
40
|
+
* @param {Compiler} compiler - The webpack compiler
|
|
41
|
+
*/
|
|
42
|
+
apply(compiler) {
|
|
43
|
+
const { isServer, debug, useRuntimePlugin, ...options } = this._options;
|
|
44
|
+
const { webpack } = compiler;
|
|
45
|
+
if (!process.env["FEDERATION_WEBPACK_PATH"]) process.env["FEDERATION_WEBPACK_PATH"] = (0, _module_federation_sdk_normalize_webpack_path.getWebpackPath)(compiler);
|
|
46
|
+
if (isServer || compiler.options.name === "server" || compiler.options.target === "node" || compiler.options.target === "async-node") if (useRuntimePlugin) {
|
|
47
|
+
this.updateCompilerOptions(compiler);
|
|
48
|
+
new _module_federation_enhanced_webpack.ModuleFederationPlugin({ ...options }).apply(compiler);
|
|
49
|
+
} else {
|
|
50
|
+
new require_src_plugins_NodeFederationPlugin.default(options, this.context).apply(compiler);
|
|
51
|
+
new require_src_plugins_StreamingTargetPlugin.default({
|
|
52
|
+
...options,
|
|
53
|
+
debug
|
|
54
|
+
}).apply(compiler);
|
|
55
|
+
}
|
|
56
|
+
else new _module_federation_enhanced_webpack.ModuleFederationPlugin(options).apply(compiler);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
84
61
|
exports.default = UniversalFederationPlugin;
|
|
85
62
|
//# sourceMappingURL=UniversalFederationPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniversalFederationPlugin.js","
|
|
1
|
+
{"version":3,"file":"UniversalFederationPlugin.js","names":["ModuleFederationPlugin","NodeFederationPlugin","StreamingTargetPlugin"],"sources":["../../../src/plugins/UniversalFederationPlugin.ts"],"sourcesContent":["/**\n * Importing necessary plugins and types\n */\nimport StreamingTargetPlugin from './StreamingTargetPlugin';\nimport NodeFederationPlugin from './NodeFederationPlugin';\nimport { ModuleFederationPlugin } from '@module-federation/enhanced/webpack';\nimport { ModuleFederationPluginOptions } from '../types';\nimport type { Compiler, container } from 'webpack';\nimport { getWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\n/**\n * Interface for NodeFederationOptions\n * @property {boolean} isServer - Indicates if the server is running\n * @property {string} [promiseBaseURI] - The base URI for the promise\n * @property {boolean} [debug] - Indicates if debug mode is enabled\n */\ninterface NodeFederationOptions extends ModuleFederationPluginOptions {\n isServer: boolean;\n promiseBaseURI?: string;\n debug?: boolean;\n useRuntimePlugin?: boolean;\n}\n\n/**\n * Interface for NodeFederationContext\n * @property {typeof container.ModuleFederationPlugin} [ModuleFederationPlugin] - The ModuleFederationPlugin from webpack container\n */\ninterface NodeFederationContext {\n ModuleFederationPlugin?: typeof container.ModuleFederationPlugin;\n}\n\n/**\n * Class representing a UniversalFederationPlugin\n */\nclass UniversalFederationPlugin {\n private _options: NodeFederationOptions;\n private context: NodeFederationContext;\n private name: string;\n\n /**\n * Create a UniversalFederationPlugin\n * @param {NodeFederationOptions} options - The options for the plugin\n * @param {NodeFederationContext} context - The context for the plugin\n */\n constructor(options: NodeFederationOptions, context: NodeFederationContext) {\n this._options = options || ({} as NodeFederationOptions);\n this.context = context || ({} as NodeFederationContext);\n this.name = 'ModuleFederationPlugin';\n if (this._options.useRuntimePlugin && this._options.isServer) {\n this._options.runtimePlugins = this._options.runtimePlugins\n ? this._options.runtimePlugins.concat([\n require.resolve('../runtimePlugin.js'),\n ])\n : [require.resolve('../runtimePlugin.js')];\n }\n }\n\n private updateCompilerOptions(compiler: Compiler): void {\n compiler.options.output.chunkFormat = 'commonjs';\n if (compiler.options.output.enabledLibraryTypes === undefined) {\n compiler.options.output.enabledLibraryTypes = ['commonjs-module'];\n } else {\n compiler.options.output.enabledLibraryTypes.push('commonjs-module');\n }\n\n const chunkFileName = compiler.options?.output?.chunkFilename;\n const uniqueName =\n compiler?.options?.output?.uniqueName || this._options.name;\n if (\n typeof chunkFileName === 'string' &&\n uniqueName &&\n !chunkFileName.includes(uniqueName)\n ) {\n const suffix = `-[contenthash].js`;\n compiler.options.output.chunkFilename = chunkFileName.replace(\n '.js',\n suffix,\n );\n }\n }\n\n /**\n * Apply the plugin to the compiler\n * @param {Compiler} compiler - The webpack compiler\n */\n apply(compiler: Compiler) {\n const { isServer, debug, useRuntimePlugin, ...options } = this._options;\n const { webpack } = compiler;\n if (!process.env['FEDERATION_WEBPACK_PATH']) {\n process.env['FEDERATION_WEBPACK_PATH'] = getWebpackPath(compiler);\n }\n if (\n isServer ||\n compiler.options.name === 'server' ||\n compiler.options.target === 'node' ||\n compiler.options.target === 'async-node'\n ) {\n if (useRuntimePlugin) {\n this.updateCompilerOptions(compiler);\n new ModuleFederationPlugin({\n ...options,\n }).apply(compiler);\n } else {\n new NodeFederationPlugin(options, this.context).apply(compiler);\n new StreamingTargetPlugin({ ...options, debug }).apply(compiler);\n }\n } else {\n new ModuleFederationPlugin(options).apply(compiler);\n }\n }\n}\n\n/**\n * Exporting UniversalFederationPlugin as default\n */\nexport default UniversalFederationPlugin;\n"],"mappings":";;;;;;;;;;;;;;AAkCA,IAAM,4BAAN,MAAgC;;;;;;CAU9B,YAAY,SAAgC,SAAgC;AAC1E,OAAK,WAAW,WAAY,EAAE;AAC9B,OAAK,UAAU,WAAY,EAAE;AAC7B,OAAK,OAAO;AACZ,MAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,SAClD,MAAK,SAAS,iBAAiB,KAAK,SAAS,iBACzC,KAAK,SAAS,eAAe,OAAO,CAClC,QAAQ,QAAQ,sBAAsB,CACvC,CAAC,GACF,CAAC,QAAQ,QAAQ,sBAAsB,CAAC;;CAIhD,AAAQ,sBAAsB,UAA0B;AACtD,WAAS,QAAQ,OAAO,cAAc;AACtC,MAAI,SAAS,QAAQ,OAAO,wBAAwB,OAClD,UAAS,QAAQ,OAAO,sBAAsB,CAAC,kBAAkB;MAEjE,UAAS,QAAQ,OAAO,oBAAoB,KAAK,kBAAkB;EAGrE,MAAM,gBAAgB,SAAS,SAAS,QAAQ;EAChD,MAAM,aACJ,UAAU,SAAS,QAAQ,cAAc,KAAK,SAAS;AACzD,MACE,OAAO,kBAAkB,YACzB,cACA,CAAC,cAAc,SAAS,WAAW,EACnC;GACA,MAAM,SAAS;AACf,YAAS,QAAQ,OAAO,gBAAgB,cAAc,QACpD,OACA,OACD;;;;;;;CAQL,MAAM,UAAoB;EACxB,MAAM,EAAE,UAAU,OAAO,kBAAkB,GAAG,YAAY,KAAK;EAC/D,MAAM,EAAE,YAAY;AACpB,MAAI,CAAC,QAAQ,IAAI,2BACf,SAAQ,IAAI,+FAA4C,SAAS;AAEnE,MACE,YACA,SAAS,QAAQ,SAAS,YAC1B,SAAS,QAAQ,WAAW,UAC5B,SAAS,QAAQ,WAAW,aAE5B,KAAI,kBAAkB;AACpB,QAAK,sBAAsB,SAAS;AACpC,OAAIA,2DAAuB,EACzB,GAAG,SACJ,CAAC,CAAC,MAAM,SAAS;SACb;AACL,OAAIC,iDAAqB,SAAS,KAAK,QAAQ,CAAC,MAAM,SAAS;AAC/D,OAAIC,kDAAsB;IAAE,GAAG;IAAS;IAAO,CAAC,CAAC,MAAM,SAAS;;MAGlE,KAAIF,2DAAuB,QAAQ,CAAC,MAAM,SAAS"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import StreamingTargetPlugin from "./StreamingTargetPlugin.mjs";
|
|
3
|
+
import NodeFederationPlugin from "./NodeFederationPlugin.mjs";
|
|
4
|
+
import { getWebpackPath } from "@module-federation/sdk/normalize-webpack-path";
|
|
5
|
+
import { ModuleFederationPlugin } from "@module-federation/enhanced/webpack";
|
|
6
|
+
|
|
7
|
+
//#region src/plugins/UniversalFederationPlugin.ts
|
|
8
|
+
/**
|
|
9
|
+
* Importing necessary plugins and types
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Class representing a UniversalFederationPlugin
|
|
13
|
+
*/
|
|
14
|
+
var UniversalFederationPlugin = class {
|
|
15
|
+
/**
|
|
16
|
+
* Create a UniversalFederationPlugin
|
|
17
|
+
* @param {NodeFederationOptions} options - The options for the plugin
|
|
18
|
+
* @param {NodeFederationContext} context - The context for the plugin
|
|
19
|
+
*/
|
|
20
|
+
constructor(options, context) {
|
|
21
|
+
this._options = options || {};
|
|
22
|
+
this.context = context || {};
|
|
23
|
+
this.name = "ModuleFederationPlugin";
|
|
24
|
+
if (this._options.useRuntimePlugin && this._options.isServer) this._options.runtimePlugins = this._options.runtimePlugins ? this._options.runtimePlugins.concat([__require.resolve("../runtimePlugin.js")]) : [__require.resolve("../runtimePlugin.js")];
|
|
25
|
+
}
|
|
26
|
+
updateCompilerOptions(compiler) {
|
|
27
|
+
compiler.options.output.chunkFormat = "commonjs";
|
|
28
|
+
if (compiler.options.output.enabledLibraryTypes === void 0) compiler.options.output.enabledLibraryTypes = ["commonjs-module"];
|
|
29
|
+
else compiler.options.output.enabledLibraryTypes.push("commonjs-module");
|
|
30
|
+
const chunkFileName = compiler.options?.output?.chunkFilename;
|
|
31
|
+
const uniqueName = compiler?.options?.output?.uniqueName || this._options.name;
|
|
32
|
+
if (typeof chunkFileName === "string" && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
33
|
+
const suffix = `-[contenthash].js`;
|
|
34
|
+
compiler.options.output.chunkFilename = chunkFileName.replace(".js", suffix);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Apply the plugin to the compiler
|
|
39
|
+
* @param {Compiler} compiler - The webpack compiler
|
|
40
|
+
*/
|
|
41
|
+
apply(compiler) {
|
|
42
|
+
const { isServer, debug, useRuntimePlugin, ...options } = this._options;
|
|
43
|
+
const { webpack } = compiler;
|
|
44
|
+
if (!process.env["FEDERATION_WEBPACK_PATH"]) process.env["FEDERATION_WEBPACK_PATH"] = getWebpackPath(compiler);
|
|
45
|
+
if (isServer || compiler.options.name === "server" || compiler.options.target === "node" || compiler.options.target === "async-node") if (useRuntimePlugin) {
|
|
46
|
+
this.updateCompilerOptions(compiler);
|
|
47
|
+
new ModuleFederationPlugin({ ...options }).apply(compiler);
|
|
48
|
+
} else {
|
|
49
|
+
new NodeFederationPlugin(options, this.context).apply(compiler);
|
|
50
|
+
new StreamingTargetPlugin({
|
|
51
|
+
...options,
|
|
52
|
+
debug
|
|
53
|
+
}).apply(compiler);
|
|
54
|
+
}
|
|
55
|
+
else new ModuleFederationPlugin(options).apply(compiler);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { UniversalFederationPlugin as default };
|
|
61
|
+
//# sourceMappingURL=UniversalFederationPlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniversalFederationPlugin.mjs","names":[],"sources":["../../../src/plugins/UniversalFederationPlugin.ts"],"sourcesContent":["/**\n * Importing necessary plugins and types\n */\nimport StreamingTargetPlugin from './StreamingTargetPlugin';\nimport NodeFederationPlugin from './NodeFederationPlugin';\nimport { ModuleFederationPlugin } from '@module-federation/enhanced/webpack';\nimport { ModuleFederationPluginOptions } from '../types';\nimport type { Compiler, container } from 'webpack';\nimport { getWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\n/**\n * Interface for NodeFederationOptions\n * @property {boolean} isServer - Indicates if the server is running\n * @property {string} [promiseBaseURI] - The base URI for the promise\n * @property {boolean} [debug] - Indicates if debug mode is enabled\n */\ninterface NodeFederationOptions extends ModuleFederationPluginOptions {\n isServer: boolean;\n promiseBaseURI?: string;\n debug?: boolean;\n useRuntimePlugin?: boolean;\n}\n\n/**\n * Interface for NodeFederationContext\n * @property {typeof container.ModuleFederationPlugin} [ModuleFederationPlugin] - The ModuleFederationPlugin from webpack container\n */\ninterface NodeFederationContext {\n ModuleFederationPlugin?: typeof container.ModuleFederationPlugin;\n}\n\n/**\n * Class representing a UniversalFederationPlugin\n */\nclass UniversalFederationPlugin {\n private _options: NodeFederationOptions;\n private context: NodeFederationContext;\n private name: string;\n\n /**\n * Create a UniversalFederationPlugin\n * @param {NodeFederationOptions} options - The options for the plugin\n * @param {NodeFederationContext} context - The context for the plugin\n */\n constructor(options: NodeFederationOptions, context: NodeFederationContext) {\n this._options = options || ({} as NodeFederationOptions);\n this.context = context || ({} as NodeFederationContext);\n this.name = 'ModuleFederationPlugin';\n if (this._options.useRuntimePlugin && this._options.isServer) {\n this._options.runtimePlugins = this._options.runtimePlugins\n ? this._options.runtimePlugins.concat([\n require.resolve('../runtimePlugin.js'),\n ])\n : [require.resolve('../runtimePlugin.js')];\n }\n }\n\n private updateCompilerOptions(compiler: Compiler): void {\n compiler.options.output.chunkFormat = 'commonjs';\n if (compiler.options.output.enabledLibraryTypes === undefined) {\n compiler.options.output.enabledLibraryTypes = ['commonjs-module'];\n } else {\n compiler.options.output.enabledLibraryTypes.push('commonjs-module');\n }\n\n const chunkFileName = compiler.options?.output?.chunkFilename;\n const uniqueName =\n compiler?.options?.output?.uniqueName || this._options.name;\n if (\n typeof chunkFileName === 'string' &&\n uniqueName &&\n !chunkFileName.includes(uniqueName)\n ) {\n const suffix = `-[contenthash].js`;\n compiler.options.output.chunkFilename = chunkFileName.replace(\n '.js',\n suffix,\n );\n }\n }\n\n /**\n * Apply the plugin to the compiler\n * @param {Compiler} compiler - The webpack compiler\n */\n apply(compiler: Compiler) {\n const { isServer, debug, useRuntimePlugin, ...options } = this._options;\n const { webpack } = compiler;\n if (!process.env['FEDERATION_WEBPACK_PATH']) {\n process.env['FEDERATION_WEBPACK_PATH'] = getWebpackPath(compiler);\n }\n if (\n isServer ||\n compiler.options.name === 'server' ||\n compiler.options.target === 'node' ||\n compiler.options.target === 'async-node'\n ) {\n if (useRuntimePlugin) {\n this.updateCompilerOptions(compiler);\n new ModuleFederationPlugin({\n ...options,\n }).apply(compiler);\n } else {\n new NodeFederationPlugin(options, this.context).apply(compiler);\n new StreamingTargetPlugin({ ...options, debug }).apply(compiler);\n }\n } else {\n new ModuleFederationPlugin(options).apply(compiler);\n }\n }\n}\n\n/**\n * Exporting UniversalFederationPlugin as default\n */\nexport default UniversalFederationPlugin;\n"],"mappings":";;;;;;;;;;;;;AAkCA,IAAM,4BAAN,MAAgC;;;;;;CAU9B,YAAY,SAAgC,SAAgC;AAC1E,OAAK,WAAW,WAAY,EAAE;AAC9B,OAAK,UAAU,WAAY,EAAE;AAC7B,OAAK,OAAO;AACZ,MAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,SAClD,MAAK,SAAS,iBAAiB,KAAK,SAAS,iBACzC,KAAK,SAAS,eAAe,OAAO,WAC1B,QAAQ,sBAAsB,CACvC,CAAC,GACF,WAAS,QAAQ,sBAAsB,CAAC;;CAIhD,AAAQ,sBAAsB,UAA0B;AACtD,WAAS,QAAQ,OAAO,cAAc;AACtC,MAAI,SAAS,QAAQ,OAAO,wBAAwB,OAClD,UAAS,QAAQ,OAAO,sBAAsB,CAAC,kBAAkB;MAEjE,UAAS,QAAQ,OAAO,oBAAoB,KAAK,kBAAkB;EAGrE,MAAM,gBAAgB,SAAS,SAAS,QAAQ;EAChD,MAAM,aACJ,UAAU,SAAS,QAAQ,cAAc,KAAK,SAAS;AACzD,MACE,OAAO,kBAAkB,YACzB,cACA,CAAC,cAAc,SAAS,WAAW,EACnC;GACA,MAAM,SAAS;AACf,YAAS,QAAQ,OAAO,gBAAgB,cAAc,QACpD,OACA,OACD;;;;;;;CAQL,MAAM,UAAoB;EACxB,MAAM,EAAE,UAAU,OAAO,kBAAkB,GAAG,YAAY,KAAK;EAC/D,MAAM,EAAE,YAAY;AACpB,MAAI,CAAC,QAAQ,IAAI,2BACf,SAAQ,IAAI,6BAA6B,eAAe,SAAS;AAEnE,MACE,YACA,SAAS,QAAQ,SAAS,YAC1B,SAAS,QAAQ,WAAW,UAC5B,SAAS,QAAQ,WAAW,aAE5B,KAAI,kBAAkB;AACpB,QAAK,sBAAsB,SAAS;AACpC,OAAI,uBAAuB,EACzB,GAAG,SACJ,CAAC,CAAC,MAAM,SAAS;SACb;AACL,OAAI,qBAAqB,SAAS,KAAK,QAAQ,CAAC,MAAM,SAAS;AAC/D,OAAI,sBAAsB;IAAE,GAAG;IAAS;IAAO,CAAC,CAAC,MAAM,SAAS;;MAGlE,KAAI,uBAAuB,QAAQ,CAAC,MAAM,SAAS"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/UniverseEntryChunkTrackerPlugin.d.ts
|
|
4
|
+
declare class UniverseEntryChunkTrackerPlugin implements WebpackPluginInstance {
|
|
5
|
+
apply(compiler: Compiler): void;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { UniverseEntryChunkTrackerPlugin as default };
|
|
9
|
+
//# sourceMappingURL=UniverseEntryChunkTrackerPlugin.d.mts.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/UniverseEntryChunkTrackerPlugin.d.ts
|
|
2
4
|
declare class UniverseEntryChunkTrackerPlugin implements WebpackPluginInstance {
|
|
3
|
-
|
|
5
|
+
apply(compiler: Compiler): void;
|
|
4
6
|
}
|
|
5
|
-
export
|
|
7
|
+
export = UniverseEntryChunkTrackerPlugin;
|
|
8
|
+
//# sourceMappingURL=UniverseEntryChunkTrackerPlugin.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let btoa = require("btoa");
|
|
4
|
+
btoa = require_runtime.__toESM(btoa);
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/UniverseEntryChunkTrackerPlugin.ts
|
|
7
|
+
var UniverseEntryChunkTrackerPlugin = class {
|
|
8
|
+
apply(compiler) {
|
|
9
|
+
const dataUrl = `data:text/javascript;base64,${(0, btoa.default)(`
|
|
10
10
|
if(typeof module !== 'undefined') {
|
|
11
11
|
globalThis.entryChunkCache = globalThis.entryChunkCache || new Set();
|
|
12
12
|
module.filename && globalThis.entryChunkCache.add(module.filename);
|
|
@@ -16,13 +16,13 @@ class UniverseEntryChunkTrackerPlugin {
|
|
|
16
16
|
})
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
`)}`;
|
|
20
|
+
compiler.hooks.afterPlugins.tap("UniverseEntryChunkTrackerPlugin", () => {
|
|
21
|
+
new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {}).apply(compiler);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
27
|
exports.default = UniverseEntryChunkTrackerPlugin;
|
|
28
28
|
//# sourceMappingURL=UniverseEntryChunkTrackerPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniverseEntryChunkTrackerPlugin.js","
|
|
1
|
+
{"version":3,"file":"UniverseEntryChunkTrackerPlugin.js","names":[],"sources":["../../../src/plugins/UniverseEntryChunkTrackerPlugin.ts"],"sourcesContent":["import pBtoa from 'btoa';\nimport type { WebpackPluginInstance, Compiler } from 'webpack';\n\nclass UniverseEntryChunkTrackerPlugin implements WebpackPluginInstance {\n apply(compiler: Compiler) {\n const code = `\n if(typeof module !== 'undefined') {\n globalThis.entryChunkCache = globalThis.entryChunkCache || new Set();\n module.filename && globalThis.entryChunkCache.add(module.filename);\n if(module.children) {\n module.children.forEach(function(c) {\n c.filename && globalThis.entryChunkCache.add(c.filename);\n })\n}\n }\n `;\n const base64Code = pBtoa(code);\n const dataUrl = `data:text/javascript;base64,${base64Code}`;\n\n compiler.hooks.afterPlugins.tap('UniverseEntryChunkTrackerPlugin', () => {\n new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {}).apply(\n compiler,\n );\n });\n }\n}\n\nexport default UniverseEntryChunkTrackerPlugin;\n"],"mappings":";;;;;;AAGA,IAAM,kCAAN,MAAuE;CACrE,MAAM,UAAoB;EAaxB,MAAM,UAAU,iDAZH;;;;;;;;;;MAWiB;AAG9B,WAAS,MAAM,aAAa,IAAI,yCAAyC;AACvE,OAAI,SAAS,QAAQ,YAAY,SAAS,SAAS,SAAS,EAAE,CAAC,CAAC,MAC9D,SACD;IACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pBtoa from "btoa";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/UniverseEntryChunkTrackerPlugin.ts
|
|
4
|
+
var UniverseEntryChunkTrackerPlugin = class {
|
|
5
|
+
apply(compiler) {
|
|
6
|
+
const dataUrl = `data:text/javascript;base64,${pBtoa(`
|
|
7
|
+
if(typeof module !== 'undefined') {
|
|
8
|
+
globalThis.entryChunkCache = globalThis.entryChunkCache || new Set();
|
|
9
|
+
module.filename && globalThis.entryChunkCache.add(module.filename);
|
|
10
|
+
if(module.children) {
|
|
11
|
+
module.children.forEach(function(c) {
|
|
12
|
+
c.filename && globalThis.entryChunkCache.add(c.filename);
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`)}`;
|
|
17
|
+
compiler.hooks.afterPlugins.tap("UniverseEntryChunkTrackerPlugin", () => {
|
|
18
|
+
new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {}).apply(compiler);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { UniverseEntryChunkTrackerPlugin as default };
|
|
25
|
+
//# sourceMappingURL=UniverseEntryChunkTrackerPlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniverseEntryChunkTrackerPlugin.mjs","names":[],"sources":["../../../src/plugins/UniverseEntryChunkTrackerPlugin.ts"],"sourcesContent":["import pBtoa from 'btoa';\nimport type { WebpackPluginInstance, Compiler } from 'webpack';\n\nclass UniverseEntryChunkTrackerPlugin implements WebpackPluginInstance {\n apply(compiler: Compiler) {\n const code = `\n if(typeof module !== 'undefined') {\n globalThis.entryChunkCache = globalThis.entryChunkCache || new Set();\n module.filename && globalThis.entryChunkCache.add(module.filename);\n if(module.children) {\n module.children.forEach(function(c) {\n c.filename && globalThis.entryChunkCache.add(c.filename);\n })\n}\n }\n `;\n const base64Code = pBtoa(code);\n const dataUrl = `data:text/javascript;base64,${base64Code}`;\n\n compiler.hooks.afterPlugins.tap('UniverseEntryChunkTrackerPlugin', () => {\n new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {}).apply(\n compiler,\n );\n });\n }\n}\n\nexport default UniverseEntryChunkTrackerPlugin;\n"],"mappings":";;;AAGA,IAAM,kCAAN,MAAuE;CACrE,MAAM,UAAoB;EAaxB,MAAM,UAAU,+BADG,MAXN;;;;;;;;;;MAWiB;AAG9B,WAAS,MAAM,aAAa,IAAI,yCAAyC;AACvE,OAAI,SAAS,QAAQ,YAAY,SAAS,SAAS,SAAS,EAAE,CAAC,CAAC,MAC9D,SACD;IACD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Chunk, ChunkGraph } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/webpackChunkUtilities.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates the hot module replacement (HMR) code.
|
|
6
|
+
* @param {boolean} withHmr - Flag indicating whether HMR is enabled.
|
|
7
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
8
|
+
* @returns {string} - The generated HMR code.
|
|
9
|
+
*/
|
|
10
|
+
declare function generateHmrCode(withHmr: boolean, rootOutputDir: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the initial chunk IDs.
|
|
13
|
+
* @param {Chunk} chunk - The chunk object.
|
|
14
|
+
* @param {ChunkGraph} chunkGraph - The chunk graph object.
|
|
15
|
+
* @param {any} chunkHasJs - Function to check if a chunk has JavaScript.
|
|
16
|
+
* @returns {Set} - The set of initial chunk IDs.
|
|
17
|
+
*/
|
|
18
|
+
declare function getInitialChunkIds(chunk: Chunk, chunkGraph: ChunkGraph, chunkHasJs: any): Set<Chunk.ChunkId>;
|
|
19
|
+
/**
|
|
20
|
+
* Generates the loading code for chunks.
|
|
21
|
+
* @param {boolean} withLoading - Flag indicating whether chunk loading is enabled.
|
|
22
|
+
* @param {string} fn - The function name.
|
|
23
|
+
* @param {any} hasJsMatcher - Function to check if a chunk has JavaScript.
|
|
24
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
25
|
+
* @param {Record<string, string>} remotes - The remotes object.
|
|
26
|
+
* @param {string | undefined} name - The name of the chunk.
|
|
27
|
+
* @returns {string} - The generated loading code.
|
|
28
|
+
*/
|
|
29
|
+
declare function generateLoadingCode(withLoading: boolean, fn: string, hasJsMatcher: any, rootOutputDir: string, remotes: Record<string, string>, name: string | undefined): string;
|
|
30
|
+
/**
|
|
31
|
+
* Generates the HMR manifest code.
|
|
32
|
+
* @param {boolean} withHmrManifest - Flag indicating whether HMR manifest is enabled.
|
|
33
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
34
|
+
* @returns {string} - The generated HMR manifest code.
|
|
35
|
+
*/
|
|
36
|
+
declare function generateHmrManifestCode(withHmrManifest: boolean, rootOutputDir: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Handles the on chunk load event.
|
|
39
|
+
* @param {boolean} withOnChunkLoad - Flag indicating whether on chunk load event is enabled.
|
|
40
|
+
* @param {any} runtimeTemplate - The runtime template.
|
|
41
|
+
* @returns {string} - The generated on chunk load event handler.
|
|
42
|
+
*/
|
|
43
|
+
declare function handleOnChunkLoad(withOnChunkLoad: boolean, runtimeTemplate: any): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generates the load script for server-side execution. This function creates a script that loads a remote module
|
|
46
|
+
* and executes it in the current context. It supports both browser and Node.js environments.
|
|
47
|
+
* @param {any} runtimeTemplate - The runtime template used to generate the load script.
|
|
48
|
+
* @returns {string} - The generated load script.
|
|
49
|
+
*/
|
|
50
|
+
declare function generateLoadScript(runtimeTemplate: any): string;
|
|
51
|
+
declare function generateInstallChunk(runtimeTemplate: any, withOnChunkLoad: boolean): string;
|
|
52
|
+
declare function generateExternalInstallChunkCode(withExternalInstallChunk: boolean, debug: boolean | undefined): string;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { generateExternalInstallChunkCode, generateHmrCode, generateHmrManifestCode, generateInstallChunk, generateLoadScript, generateLoadingCode, getInitialChunkIds, handleOnChunkLoad };
|
|
55
|
+
//# sourceMappingURL=webpackChunkUtilities.d.mts.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Chunk, ChunkGraph } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/webpackChunkUtilities.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Generates the hot module replacement (HMR) code.
|
|
4
6
|
* @param {boolean} withHmr - Flag indicating whether HMR is enabled.
|
|
5
7
|
* @param {string} rootOutputDir - The root output directory.
|
|
6
8
|
* @returns {string} - The generated HMR code.
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
declare function generateHmrCode(withHmr: boolean, rootOutputDir: string): string;
|
|
9
11
|
/**
|
|
10
12
|
* Retrieves the initial chunk IDs.
|
|
11
13
|
* @param {Chunk} chunk - The chunk object.
|
|
@@ -13,7 +15,7 @@ export declare function generateHmrCode(withHmr: boolean, rootOutputDir: string)
|
|
|
13
15
|
* @param {any} chunkHasJs - Function to check if a chunk has JavaScript.
|
|
14
16
|
* @returns {Set} - The set of initial chunk IDs.
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
declare function getInitialChunkIds(chunk: Chunk, chunkGraph: ChunkGraph, chunkHasJs: any): Set<Chunk.ChunkId>;
|
|
17
19
|
/**
|
|
18
20
|
* Generates the loading code for chunks.
|
|
19
21
|
* @param {boolean} withLoading - Flag indicating whether chunk loading is enabled.
|
|
@@ -24,27 +26,30 @@ export declare function getInitialChunkIds(chunk: Chunk, chunkGraph: ChunkGraph,
|
|
|
24
26
|
* @param {string | undefined} name - The name of the chunk.
|
|
25
27
|
* @returns {string} - The generated loading code.
|
|
26
28
|
*/
|
|
27
|
-
|
|
29
|
+
declare function generateLoadingCode(withLoading: boolean, fn: string, hasJsMatcher: any, rootOutputDir: string, remotes: Record<string, string>, name: string | undefined): string;
|
|
28
30
|
/**
|
|
29
31
|
* Generates the HMR manifest code.
|
|
30
32
|
* @param {boolean} withHmrManifest - Flag indicating whether HMR manifest is enabled.
|
|
31
33
|
* @param {string} rootOutputDir - The root output directory.
|
|
32
34
|
* @returns {string} - The generated HMR manifest code.
|
|
33
35
|
*/
|
|
34
|
-
|
|
36
|
+
declare function generateHmrManifestCode(withHmrManifest: boolean, rootOutputDir: string): string;
|
|
35
37
|
/**
|
|
36
38
|
* Handles the on chunk load event.
|
|
37
39
|
* @param {boolean} withOnChunkLoad - Flag indicating whether on chunk load event is enabled.
|
|
38
40
|
* @param {any} runtimeTemplate - The runtime template.
|
|
39
41
|
* @returns {string} - The generated on chunk load event handler.
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
declare function handleOnChunkLoad(withOnChunkLoad: boolean, runtimeTemplate: any): string;
|
|
42
44
|
/**
|
|
43
45
|
* Generates the load script for server-side execution. This function creates a script that loads a remote module
|
|
44
46
|
* and executes it in the current context. It supports both browser and Node.js environments.
|
|
45
47
|
* @param {any} runtimeTemplate - The runtime template used to generate the load script.
|
|
46
48
|
* @returns {string} - The generated load script.
|
|
47
49
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
declare function generateLoadScript(runtimeTemplate: any): string;
|
|
51
|
+
declare function generateInstallChunk(runtimeTemplate: any, withOnChunkLoad: boolean): string;
|
|
52
|
+
declare function generateExternalInstallChunkCode(withExternalInstallChunk: boolean, debug: boolean | undefined): string;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { generateExternalInstallChunkCode, generateHmrCode, generateHmrManifestCode, generateInstallChunk, generateLoadScript, generateLoadingCode, getInitialChunkIds, handleOnChunkLoad };
|
|
55
|
+
//# sourceMappingURL=webpackChunkUtilities.d.ts.map
|