@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.
Files changed (122) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +31 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  3. package/dist/plugins/ChunkCorrelationPlugin.js +308 -0
  4. package/dist/plugins/ChunkCorrelationPlugin.js.map +1 -0
  5. package/dist/plugins/ChunkCorrelationPlugin.mjs +305 -0
  6. package/dist/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  7. package/dist/src/filesystem/stratagies.d.mts +21 -0
  8. package/dist/src/filesystem/stratagies.d.ts +10 -7
  9. package/dist/src/filesystem/stratagies.js +97 -116
  10. package/dist/src/filesystem/stratagies.js.map +1 -1
  11. package/dist/src/filesystem/stratagies.mjs +103 -0
  12. package/dist/src/filesystem/stratagies.mjs.map +1 -0
  13. package/dist/src/index.d.mts +8 -0
  14. package/dist/src/index.d.ts +8 -7
  15. package/dist/src/index.js +16 -22
  16. package/dist/src/index.mjs +9 -0
  17. package/dist/src/plugins/AutomaticPublicPathPlugin.d.mts +12 -0
  18. package/dist/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -7
  19. package/dist/src/plugins/AutomaticPublicPathPlugin.js +26 -35
  20. package/dist/src/plugins/AutomaticPublicPathPlugin.js.map +1 -1
  21. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs +28 -0
  22. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs.map +1 -0
  23. package/dist/src/plugins/ChunkCorrelationPlugin.d.mts +5 -0
  24. package/dist/src/plugins/ChunkCorrelationPlugin.d.ts +4 -61
  25. package/dist/src/plugins/ChunkCorrelationPlugin.js +8 -440
  26. package/dist/src/plugins/ChunkCorrelationPlugin.js.map +1 -1
  27. package/dist/src/plugins/ChunkCorrelationPlugin.mjs +8 -0
  28. package/dist/src/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  29. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.mts +21 -0
  30. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.ts +16 -13
  31. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js +68 -118
  32. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -1
  33. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs +70 -0
  34. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs.map +1 -0
  35. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.mts +46 -0
  36. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +39 -34
  37. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +110 -126
  38. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -1
  39. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs +111 -0
  40. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs.map +1 -0
  41. package/dist/src/plugins/EntryChunkTrackerPlugin.d.mts +17 -0
  42. package/dist/src/plugins/EntryChunkTrackerPlugin.d.ts +14 -10
  43. package/dist/src/plugins/EntryChunkTrackerPlugin.js +30 -32
  44. package/dist/src/plugins/EntryChunkTrackerPlugin.js.map +1 -1
  45. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs +38 -0
  46. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs.map +1 -0
  47. package/dist/src/plugins/NodeFederationPlugin.d.mts +54 -0
  48. package/dist/src/plugins/NodeFederationPlugin.d.ts +33 -26
  49. package/dist/src/plugins/NodeFederationPlugin.js +69 -84
  50. package/dist/src/plugins/NodeFederationPlugin.js.map +1 -1
  51. package/dist/src/plugins/NodeFederationPlugin.mjs +70 -0
  52. package/dist/src/plugins/NodeFederationPlugin.mjs.map +1 -0
  53. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.mts +15 -0
  54. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.ts +12 -8
  55. package/dist/src/plugins/RemotePublicPathRuntimeModule.js +34 -35
  56. package/dist/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -1
  57. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs +132 -0
  58. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs.map +1 -0
  59. package/dist/src/plugins/StreamingTargetPlugin.d.mts +32 -0
  60. package/dist/src/plugins/StreamingTargetPlugin.d.ts +19 -16
  61. package/dist/src/plugins/StreamingTargetPlugin.js +43 -56
  62. package/dist/src/plugins/StreamingTargetPlugin.js.map +1 -1
  63. package/dist/src/plugins/StreamingTargetPlugin.mjs +46 -0
  64. package/dist/src/plugins/StreamingTargetPlugin.mjs.map +1 -0
  65. package/dist/src/plugins/UniversalFederationPlugin.d.mts +49 -0
  66. package/dist/src/plugins/UniversalFederationPlugin.d.ts +26 -23
  67. package/dist/src/plugins/UniversalFederationPlugin.js +58 -81
  68. package/dist/src/plugins/UniversalFederationPlugin.js.map +1 -1
  69. package/dist/src/plugins/UniversalFederationPlugin.mjs +61 -0
  70. package/dist/src/plugins/UniversalFederationPlugin.mjs.map +1 -0
  71. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.mts +9 -0
  72. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts +6 -3
  73. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js +17 -17
  74. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js.map +1 -1
  75. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs +25 -0
  76. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs.map +1 -0
  77. package/dist/src/plugins/webpackChunkUtilities.d.mts +55 -0
  78. package/dist/src/plugins/webpackChunkUtilities.d.ts +14 -9
  79. package/dist/src/plugins/webpackChunkUtilities.js +195 -257
  80. package/dist/src/plugins/webpackChunkUtilities.js.map +1 -1
  81. package/dist/src/plugins/webpackChunkUtilities.mjs +234 -0
  82. package/dist/src/plugins/webpackChunkUtilities.mjs.map +1 -0
  83. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.mts +7 -0
  84. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.ts +5 -2
  85. package/dist/src/recordDynamicRemoteEntryHashPlugin.js +24 -61
  86. package/dist/src/recordDynamicRemoteEntryHashPlugin.js.map +1 -1
  87. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs +26 -0
  88. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs.map +1 -0
  89. package/dist/src/runtimePlugin.d.mts +27 -0
  90. package/dist/src/runtimePlugin.d.ts +24 -19
  91. package/dist/src/runtimePlugin.js +157 -252
  92. package/dist/src/runtimePlugin.js.map +1 -1
  93. package/dist/src/runtimePlugin.mjs +169 -0
  94. package/dist/src/runtimePlugin.mjs.map +1 -0
  95. package/dist/src/types/index.d.mts +8 -0
  96. package/dist/src/types/index.d.ts +8 -3
  97. package/dist/src/types/index.js +1 -3
  98. package/dist/src/types/index.mjs +1 -0
  99. package/dist/src/utils/flush-chunks.d.mts +15 -0
  100. package/dist/src/utils/flush-chunks.d.ts +7 -3
  101. package/dist/src/utils/flush-chunks.js +87 -161
  102. package/dist/src/utils/flush-chunks.js.map +1 -1
  103. package/dist/src/utils/flush-chunks.mjs +99 -0
  104. package/dist/src/utils/flush-chunks.mjs.map +1 -0
  105. package/dist/src/utils/hot-reload.d.mts +16 -0
  106. package/dist/src/utils/hot-reload.d.ts +14 -10
  107. package/dist/src/utils/hot-reload.js +177 -264
  108. package/dist/src/utils/hot-reload.js.map +1 -1
  109. package/dist/src/utils/hot-reload.mjs +194 -0
  110. package/dist/src/utils/hot-reload.mjs.map +1 -0
  111. package/dist/src/utils/index.d.mts +3 -0
  112. package/dist/src/utils/index.d.ts +3 -2
  113. package/dist/src/utils/index.js +15 -19
  114. package/dist/src/utils/index.mjs +4 -0
  115. package/package.json +59 -15
  116. package/dist/jest.config.d.ts +0 -11
  117. package/dist/jest.config.js +0 -19
  118. package/dist/jest.config.js.map +0 -1
  119. package/dist/package.json +0 -82
  120. package/dist/src/index.js.map +0 -1
  121. package/dist/src/types/index.js.map +0 -1
  122. package/dist/src/utils/index.js.map +0 -1
@@ -1,85 +1,62 @@
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
- /**
7
- * Importing necessary plugins and types
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
- * Class representing a UniversalFederationPlugin
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
- * Exporting UniversalFederationPlugin as default
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","sourceRoot":"","sources":["../../../src/plugins/UniversalFederationPlugin.ts"],"names":[],"mappings":"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"}
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 type { WebpackPluginInstance, Compiler } from 'webpack';
1
+ import { Compiler, WebpackPluginInstance } from "webpack";
2
+
3
+ //#region src/plugins/UniverseEntryChunkTrackerPlugin.d.ts
2
4
  declare class UniverseEntryChunkTrackerPlugin implements WebpackPluginInstance {
3
- apply(compiler: Compiler): void;
5
+ apply(compiler: Compiler): void;
4
6
  }
5
- export default UniverseEntryChunkTrackerPlugin;
7
+ export = UniverseEntryChunkTrackerPlugin;
8
+ //# sourceMappingURL=UniverseEntryChunkTrackerPlugin.d.ts.map
@@ -1,12 +1,12 @@
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 btoa_1 = __importDefault(require("btoa"));
7
- class UniverseEntryChunkTrackerPlugin {
8
- apply(compiler) {
9
- const code = `
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
- const base64Code = (0, btoa_1.default)(code);
21
- const dataUrl = `data:text/javascript;base64,${base64Code}`;
22
- compiler.hooks.afterPlugins.tap('UniverseEntryChunkTrackerPlugin', () => {
23
- new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {}).apply(compiler);
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","sourceRoot":"","sources":["../../../src/plugins/UniverseEntryChunkTrackerPlugin.ts"],"names":[],"mappings":";;;;;AAAA,gDAAyB;AAGzB,MAAM,+BAA+B;IACnC,KAAK,CAAC,QAAkB;QACtB,MAAM,IAAI,GAAG;;;;;;;;;;KAUZ,CAAC;QACF,MAAM,UAAU,GAAG,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,+BAA+B,UAAU,EAAE,CAAC;QAE5D,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,iCAAiC,EAAE,GAAG,EAAE;YACtE,IAAI,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CACnE,QAAQ,CACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,+BAA+B,CAAC"}
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 type { Chunk, ChunkGraph } from 'webpack';
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
- export declare function generateHmrCode(withHmr: boolean, rootOutputDir: string): string;
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
- export declare function getInitialChunkIds(chunk: Chunk, chunkGraph: ChunkGraph, chunkHasJs: any): Set<Chunk.ChunkId>;
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
- export declare function generateLoadingCode(withLoading: boolean, fn: string, hasJsMatcher: any, rootOutputDir: string, remotes: Record<string, string>, name: string | undefined): string;
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
- export declare function generateHmrManifestCode(withHmrManifest: boolean, rootOutputDir: string): string;
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
- export declare function handleOnChunkLoad(withOnChunkLoad: boolean, runtimeTemplate: any): string;
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
- export declare function generateLoadScript(runtimeTemplate: any): string;
49
- export declare function generateInstallChunk(runtimeTemplate: any, withOnChunkLoad: boolean): string;
50
- export declare function generateExternalInstallChunkCode(withExternalInstallChunk: boolean, debug: boolean | undefined): string;
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