@module-federation/nextjs-mf 0.0.0-perf-devtools-20260108034446 → 0.0.0-perf-website-code-usage-20260914033703
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/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/client/UrlNode.d.mts +17 -0
- package/dist/client/UrlNode.js +89 -147
- package/dist/client/UrlNode.js.map +1 -1
- package/dist/client/UrlNode.mjs +91 -0
- package/dist/client/UrlNode.mjs.map +1 -0
- package/dist/node.d.mts +1 -0
- package/dist/src/federation-noop.d.mts +0 -0
- package/dist/src/federation-noop.js +17 -0
- package/dist/src/federation-noop.js.map +1 -1
- package/dist/src/federation-noop.mjs +23 -0
- package/dist/src/federation-noop.mjs.map +1 -0
- package/dist/src/index.d.mts +3 -0
- package/dist/src/index.js +13 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +8 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/internal.d.mts +50 -0
- package/dist/src/internal.js +140 -243
- package/dist/src/internal.js.map +1 -1
- package/dist/src/internal.mjs +152 -0
- package/dist/src/internal.mjs.map +1 -0
- package/dist/src/loaders/fixImageLoader.d.mts +22 -0
- package/dist/src/loaders/fixImageLoader.js +91 -103
- package/dist/src/loaders/fixImageLoader.js.map +1 -1
- package/dist/src/loaders/fixImageLoader.mjs +101 -0
- package/dist/src/loaders/fixImageLoader.mjs.map +1 -0
- package/dist/src/loaders/fixUrlLoader.d.mts +13 -0
- package/dist/src/loaders/fixUrlLoader.js +17 -19
- package/dist/src/loaders/fixUrlLoader.js.map +1 -1
- package/dist/src/loaders/fixUrlLoader.mjs +19 -0
- package/dist/src/loaders/fixUrlLoader.mjs.map +1 -0
- package/dist/src/loaders/helpers.d.mts +17 -0
- package/dist/src/loaders/helpers.js +72 -124
- package/dist/src/loaders/helpers.js.map +1 -1
- package/dist/src/loaders/helpers.mjs +79 -0
- package/dist/src/loaders/helpers.mjs.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.d.mts +24 -0
- package/dist/src/loaders/nextPageMapLoader.js +126 -144
- package/dist/src/loaders/nextPageMapLoader.js.map +1 -1
- package/dist/src/loaders/nextPageMapLoader.mjs +143 -0
- package/dist/src/loaders/nextPageMapLoader.mjs.map +1 -0
- package/dist/src/logger.d.mts +2 -0
- package/dist/src/logger.js +7 -7
- package/dist/src/logger.js.map +1 -1
- package/dist/src/logger.mjs +8 -0
- package/dist/src/logger.mjs.map +1 -0
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.mts +5 -0
- package/dist/src/plugins/CopyFederationPlugin.d.mts +20 -0
- package/dist/src/plugins/CopyFederationPlugin.js +64 -71
- package/dist/src/plugins/CopyFederationPlugin.js.map +1 -1
- package/dist/src/plugins/CopyFederationPlugin.mjs +65 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.d.mts +22 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.d.ts +22 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.js +43 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.mjs +42 -0
- package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.d.mts +23 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +42 -53
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs +46 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.d.mts +36 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +103 -121
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs +111 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.mts +27 -0
- package/dist/src/plugins/NextFederationPlugin/index.js +149 -181
- package/dist/src/plugins/NextFederationPlugin/index.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/index.mjs +151 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.d.mts +4 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.d.ts +4 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.js +13 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.mjs +12 -0
- package/dist/src/plugins/NextFederationPlugin/manifest-options.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.mts +20 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js +58 -93
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs +63 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/{regex-equal.js → regex-equal.d.mts} +2 -13
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.mts +8 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.d.mts +6 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.d.ts +1 -11
- package/dist/src/plugins/NextFederationPlugin/set-options.js +17 -19
- package/dist/src/plugins/NextFederationPlugin/set-options.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs +19 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.d.mts +25 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.js +30 -38
- package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs +35 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.d.mts +5 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.js +23 -25
- package/dist/src/plugins/container/InvertedContainerPlugin.js.map +1 -1
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs +27 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.mts +11 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.ts +1 -1
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js +55 -67
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -1
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.mts +39 -0
- package/dist/src/plugins/container/runtimePlugin.d.mts +2 -0
- package/dist/src/plugins/container/runtimePlugin.d.ts +1 -1
- package/dist/src/plugins/container/runtimePlugin.js +170 -0
- package/dist/src/plugins/container/runtimePlugin.js.map +1 -1
- package/dist/src/plugins/container/runtimePlugin.mjs +169 -0
- package/dist/src/plugins/container/runtimePlugin.mjs.map +1 -0
- package/dist/src/plugins/container/types.d.mts +2 -0
- package/dist/src/types.d.mts +28 -0
- package/dist/utils/flushedChunks.d.mts +22 -0
- package/dist/utils/flushedChunks.js +32 -72
- package/dist/utils/flushedChunks.js.map +1 -1
- package/dist/utils/flushedChunks.mjs +35 -0
- package/dist/utils/flushedChunks.mjs.map +1 -0
- package/dist/utils/index.d.mts +20 -0
- package/dist/utils/index.js +27 -62
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +22 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +45 -10
- package/dist/node.js +0 -18
- package/dist/node.js.map +0 -1
- package/dist/package.json +0 -71
- package/dist/src/federation-noop.cjs +0 -15
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +0 -19
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/regex-equal.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +0 -34
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +0 -1
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +0 -78
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +0 -1
- package/dist/src/plugins/container/runtimePlugin.cjs +0 -216
- package/dist/src/plugins/container/types.js +0 -3
- package/dist/src/plugins/container/types.js.map +0 -1
- package/dist/src/types.js +0 -3
- package/dist/src/types.js.map +0 -1
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_InvertedContainerRuntimeModule = require('./InvertedContainerRuntimeModule.js');
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/container/InvertedContainerPlugin.ts
|
|
4
|
+
const loadEnhanced = () => {
|
|
5
|
+
const enhancedModule = require("@module-federation/enhanced");
|
|
6
|
+
return enhancedModule.default ? enhancedModule.default : enhancedModule;
|
|
4
7
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}));
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
8
|
+
var InvertedContainerPlugin = class {
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
const { FederationModulesPlugin, dependencies } = loadEnhanced();
|
|
11
|
+
compiler.hooks.thisCompilation.tap("EmbeddedContainerPlugin", (compilation) => {
|
|
12
|
+
const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
|
|
13
|
+
const containers = /* @__PURE__ */ new Set();
|
|
14
|
+
hooks.addContainerEntryDependency.tap("EmbeddedContainerPlugin", (dependency) => {
|
|
15
|
+
if (dependency instanceof dependencies.ContainerEntryDependency) containers.add(dependency);
|
|
16
|
+
});
|
|
17
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap("EmbeddedContainerPlugin", (chunk, set) => {
|
|
18
|
+
compilation.addRuntimeModule(chunk, new require_InvertedContainerRuntimeModule.default({ containers }));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
27
25
|
exports.default = InvertedContainerPlugin;
|
|
28
26
|
//# sourceMappingURL=InvertedContainerPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvertedContainerPlugin.js","
|
|
1
|
+
{"version":3,"file":"InvertedContainerPlugin.js","names":["InvertedContainerRuntimeModule"],"sources":["../../../../src/plugins/container/InvertedContainerPlugin.ts"],"sourcesContent":["import type { Compilation, Compiler, Chunk } from 'webpack';\nimport InvertedContainerRuntimeModule from './InvertedContainerRuntimeModule';\n\ntype EnhancedModuleExports = typeof import('@module-federation/enhanced');\n\nconst loadEnhanced = (): EnhancedModuleExports => {\n const enhancedModule = require('@module-federation/enhanced') as\n | EnhancedModuleExports\n | { default: EnhancedModuleExports };\n\n return (enhancedModule as { default?: EnhancedModuleExports }).default\n ? (enhancedModule as { default: EnhancedModuleExports }).default\n : (enhancedModule as EnhancedModuleExports);\n};\n\nclass InvertedContainerPlugin {\n public apply(compiler: Compiler): void {\n const { FederationModulesPlugin, dependencies } = loadEnhanced();\n\n compiler.hooks.thisCompilation.tap(\n 'EmbeddedContainerPlugin',\n (compilation: Compilation) => {\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n const containers = new Set();\n hooks.addContainerEntryDependency.tap(\n 'EmbeddedContainerPlugin',\n (dependency) => {\n if (dependency instanceof dependencies.ContainerEntryDependency) {\n containers.add(dependency);\n }\n },\n );\n // Adding the runtime module\n compilation.hooks.additionalTreeRuntimeRequirements.tap(\n 'EmbeddedContainerPlugin',\n (chunk, set) => {\n compilation.addRuntimeModule(\n chunk,\n new InvertedContainerRuntimeModule({\n containers,\n }),\n );\n },\n );\n },\n );\n }\n}\n\nexport default InvertedContainerPlugin;\n"],"mappings":";;;AAKA,MAAM,qBAA4C;CAChD,MAAM,iBAAiB,QAAQ,8BAA8B;AAI7D,QAAQ,eAAuD,UAC1D,eAAsD,UACtD;;AAGP,IAAM,0BAAN,MAA8B;CAC5B,AAAO,MAAM,UAA0B;EACrC,MAAM,EAAE,yBAAyB,iBAAiB,cAAc;AAEhE,WAAS,MAAM,gBAAgB,IAC7B,4BACC,gBAA6B;GAC5B,MAAM,QAAQ,wBAAwB,oBAAoB,YAAY;GACtE,MAAM,6BAAa,IAAI,KAAK;AAC5B,SAAM,4BAA4B,IAChC,4BACC,eAAe;AACd,QAAI,sBAAsB,aAAa,yBACrC,YAAW,IAAI,WAAW;KAG/B;AAED,eAAY,MAAM,kCAAkC,IAClD,4BACC,OAAO,QAAQ;AACd,gBAAY,iBACV,OACA,IAAIA,+CAA+B,EACjC,YACD,CAAC,CACH;KAEJ;IAEJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __require } from "../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import InvertedContainerRuntimeModule from "./InvertedContainerRuntimeModule.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/container/InvertedContainerPlugin.ts
|
|
5
|
+
const loadEnhanced = () => {
|
|
6
|
+
const enhancedModule = __require("@module-federation/enhanced");
|
|
7
|
+
return enhancedModule.default ? enhancedModule.default : enhancedModule;
|
|
8
|
+
};
|
|
9
|
+
var InvertedContainerPlugin = class {
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
const { FederationModulesPlugin, dependencies } = loadEnhanced();
|
|
12
|
+
compiler.hooks.thisCompilation.tap("EmbeddedContainerPlugin", (compilation) => {
|
|
13
|
+
const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
|
|
14
|
+
const containers = /* @__PURE__ */ new Set();
|
|
15
|
+
hooks.addContainerEntryDependency.tap("EmbeddedContainerPlugin", (dependency) => {
|
|
16
|
+
if (dependency instanceof dependencies.ContainerEntryDependency) containers.add(dependency);
|
|
17
|
+
});
|
|
18
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap("EmbeddedContainerPlugin", (chunk, set) => {
|
|
19
|
+
compilation.addRuntimeModule(chunk, new InvertedContainerRuntimeModule({ containers }));
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { InvertedContainerPlugin as default };
|
|
27
|
+
//# sourceMappingURL=InvertedContainerPlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvertedContainerPlugin.mjs","names":[],"sources":["../../../../src/plugins/container/InvertedContainerPlugin.ts"],"sourcesContent":["import type { Compilation, Compiler, Chunk } from 'webpack';\nimport InvertedContainerRuntimeModule from './InvertedContainerRuntimeModule';\n\ntype EnhancedModuleExports = typeof import('@module-federation/enhanced');\n\nconst loadEnhanced = (): EnhancedModuleExports => {\n const enhancedModule = require('@module-federation/enhanced') as\n | EnhancedModuleExports\n | { default: EnhancedModuleExports };\n\n return (enhancedModule as { default?: EnhancedModuleExports }).default\n ? (enhancedModule as { default: EnhancedModuleExports }).default\n : (enhancedModule as EnhancedModuleExports);\n};\n\nclass InvertedContainerPlugin {\n public apply(compiler: Compiler): void {\n const { FederationModulesPlugin, dependencies } = loadEnhanced();\n\n compiler.hooks.thisCompilation.tap(\n 'EmbeddedContainerPlugin',\n (compilation: Compilation) => {\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n const containers = new Set();\n hooks.addContainerEntryDependency.tap(\n 'EmbeddedContainerPlugin',\n (dependency) => {\n if (dependency instanceof dependencies.ContainerEntryDependency) {\n containers.add(dependency);\n }\n },\n );\n // Adding the runtime module\n compilation.hooks.additionalTreeRuntimeRequirements.tap(\n 'EmbeddedContainerPlugin',\n (chunk, set) => {\n compilation.addRuntimeModule(\n chunk,\n new InvertedContainerRuntimeModule({\n containers,\n }),\n );\n },\n );\n },\n );\n }\n}\n\nexport default InvertedContainerPlugin;\n"],"mappings":";;;;AAKA,MAAM,qBAA4C;CAChD,MAAM,2BAAyB,8BAA8B;AAI7D,QAAQ,eAAuD,UAC1D,eAAsD,UACtD;;AAGP,IAAM,0BAAN,MAA8B;CAC5B,AAAO,MAAM,UAA0B;EACrC,MAAM,EAAE,yBAAyB,iBAAiB,cAAc;AAEhE,WAAS,MAAM,gBAAgB,IAC7B,4BACC,gBAA6B;GAC5B,MAAM,QAAQ,wBAAwB,oBAAoB,YAAY;GACtE,MAAM,6BAAa,IAAI,KAAK;AAC5B,SAAM,4BAA4B,IAChC,4BACC,eAAe;AACd,QAAI,sBAAsB,aAAa,yBACrC,YAAW,IAAI,WAAW;KAG/B;AAED,eAAY,MAAM,kCAAkC,IAClD,4BACC,OAAO,QAAQ;AACd,gBAAY,iBACV,OACA,IAAI,+BAA+B,EACjC,YACD,CAAC,CACH;KAEJ;IAEJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const RuntimeModule: typeof import("node_modules/webpack/types").RuntimeModule;
|
|
2
|
+
interface InvertedContainerRuntimeModuleOptions {
|
|
3
|
+
name?: string;
|
|
4
|
+
containers: Set<any>;
|
|
5
|
+
}
|
|
6
|
+
declare class InvertedContainerRuntimeModule extends RuntimeModule {
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options: InvertedContainerRuntimeModuleOptions);
|
|
9
|
+
generate(): string;
|
|
10
|
+
}
|
|
11
|
+
export default InvertedContainerRuntimeModule;
|
|
@@ -1,69 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`}`,
|
|
57
|
-
`cachedRemote = ${initRuntimeModuleGetter};`,
|
|
58
|
-
`var gs = ${RuntimeGlobals.global} || globalThis;`,
|
|
59
|
-
`gs[${nameJSON}] = cachedRemote;`,
|
|
60
|
-
])),
|
|
61
|
-
`} else if (typeof prevStartup === 'function') {`,
|
|
62
|
-
Template.indent(`prevStartup();`),
|
|
63
|
-
`}`,
|
|
64
|
-
]))};`,
|
|
65
|
-
]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
2
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/container/InvertedContainerRuntimeModule.ts
|
|
5
|
+
const { RuntimeModule, Template, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
6
|
+
var InvertedContainerRuntimeModule = class extends RuntimeModule {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super("inverted container startup", RuntimeModule.STAGE_TRIGGER);
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
generate() {
|
|
12
|
+
const { compilation, chunk, chunkGraph } = this;
|
|
13
|
+
if (!compilation || !chunk || !chunkGraph) return "";
|
|
14
|
+
if (chunk.runtime === "webpack-api-runtime") return "";
|
|
15
|
+
const runtimeChunk = compilation.options.optimization?.runtimeChunk;
|
|
16
|
+
if (typeof runtimeChunk === "object" && runtimeChunk !== null) compilation.getLogger("InvertedContainerRuntimeModule").info("Runtime chunk is configured. Consider adding runtime: false to your ModuleFederationPlugin configuration to prevent runtime conflicts.");
|
|
17
|
+
let containerEntryModule;
|
|
18
|
+
for (const containerDep of this.options.containers) {
|
|
19
|
+
const mod = compilation.moduleGraph.getModule(containerDep);
|
|
20
|
+
if (!mod) continue;
|
|
21
|
+
if (chunkGraph.isModuleInChunk(mod, chunk)) containerEntryModule = mod;
|
|
22
|
+
}
|
|
23
|
+
if (!containerEntryModule) return "";
|
|
24
|
+
if (compilation.chunkGraph.isEntryModuleInChunk(containerEntryModule, chunk)) return "";
|
|
25
|
+
const initRuntimeModuleGetter = compilation.runtimeTemplate.moduleRaw({
|
|
26
|
+
module: containerEntryModule,
|
|
27
|
+
chunkGraph,
|
|
28
|
+
weak: false,
|
|
29
|
+
runtimeRequirements: /* @__PURE__ */ new Set()
|
|
30
|
+
});
|
|
31
|
+
const nameJSON = JSON.stringify(containerEntryModule._name);
|
|
32
|
+
return Template.asString([
|
|
33
|
+
`var prevStartup = ${RuntimeGlobals.startup};`,
|
|
34
|
+
`var hasRun = false;`,
|
|
35
|
+
`var cachedRemote;`,
|
|
36
|
+
`${RuntimeGlobals.startup} = ${compilation.runtimeTemplate.basicFunction("", Template.asString([
|
|
37
|
+
`if (!hasRun) {`,
|
|
38
|
+
Template.indent(Template.asString([
|
|
39
|
+
`hasRun = true;`,
|
|
40
|
+
`if (typeof prevStartup === 'function') {`,
|
|
41
|
+
Template.indent(Template.asString([`prevStartup();`])),
|
|
42
|
+
`}`,
|
|
43
|
+
`cachedRemote = ${initRuntimeModuleGetter};`,
|
|
44
|
+
`var gs = ${RuntimeGlobals.global} || globalThis;`,
|
|
45
|
+
`gs[${nameJSON}] = cachedRemote;`
|
|
46
|
+
])),
|
|
47
|
+
`} else if (typeof prevStartup === 'function') {`,
|
|
48
|
+
Template.indent(`prevStartup();`),
|
|
49
|
+
`}`
|
|
50
|
+
]))};`
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
68
56
|
exports.default = InvertedContainerRuntimeModule;
|
|
69
57
|
//# sourceMappingURL=InvertedContainerRuntimeModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvertedContainerRuntimeModule.js","
|
|
1
|
+
{"version":3,"file":"InvertedContainerRuntimeModule.js","names":[],"sources":["../../../../src/plugins/container/InvertedContainerRuntimeModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nconst { RuntimeModule, Template, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack') & {\n RuntimeGlobals: Record<string, string>;\n};\n\ninterface InvertedContainerRuntimeModuleOptions {\n name?: string;\n containers: Set<any>; // Adjust the type as necessary\n}\n\ntype ContainerEntryModule = NonNullable<\n ReturnType<CompilationModuleGraph['getModule']>\n> & {\n _name?: string;\n};\n\ntype CompilationModuleGraph = {\n getModule: (dependency: unknown) => unknown;\n};\n\nclass InvertedContainerRuntimeModule extends RuntimeModule {\n private options: InvertedContainerRuntimeModuleOptions;\n\n constructor(options: InvertedContainerRuntimeModuleOptions) {\n super('inverted container startup', RuntimeModule.STAGE_TRIGGER);\n this.options = options;\n }\n\n override generate(): string {\n const { compilation, chunk, chunkGraph } = this;\n if (!compilation || !chunk || !chunkGraph) {\n return '';\n }\n if (chunk.runtime === 'webpack-api-runtime') {\n return '';\n }\n\n const runtimeChunk = compilation.options.optimization?.runtimeChunk;\n if (typeof runtimeChunk === 'object' && runtimeChunk !== null) {\n const logger = compilation.getLogger('InvertedContainerRuntimeModule');\n logger.info(\n 'Runtime chunk is configured. Consider adding runtime: false to your ModuleFederationPlugin configuration to prevent runtime conflicts.',\n );\n }\n\n let containerEntryModule;\n for (const containerDep of this.options.containers) {\n const mod = compilation.moduleGraph.getModule(containerDep);\n if (!mod) continue;\n if (chunkGraph.isModuleInChunk(mod, chunk)) {\n containerEntryModule = mod as ContainerEntryModule;\n }\n }\n\n if (!containerEntryModule) return '';\n\n if (\n compilation.chunkGraph.isEntryModuleInChunk(containerEntryModule, chunk)\n ) {\n // Don't apply to the remote entry itself\n return '';\n }\n const initRuntimeModuleGetter = compilation.runtimeTemplate.moduleRaw({\n module: containerEntryModule,\n chunkGraph,\n weak: false,\n runtimeRequirements: new Set(),\n });\n\n //@ts-ignore\n const nameJSON = JSON.stringify(containerEntryModule._name);\n\n return Template.asString([\n `var prevStartup = ${RuntimeGlobals.startup};`,\n `var hasRun = false;`,\n `var cachedRemote;`,\n `${RuntimeGlobals.startup} = ${compilation.runtimeTemplate.basicFunction(\n '',\n Template.asString([\n `if (!hasRun) {`,\n Template.indent(\n Template.asString([\n `hasRun = true;`,\n `if (typeof prevStartup === 'function') {`,\n Template.indent(Template.asString([`prevStartup();`])),\n `}`,\n `cachedRemote = ${initRuntimeModuleGetter};`,\n `var gs = ${RuntimeGlobals.global} || globalThis;`,\n `gs[${nameJSON}] = cachedRemote;`,\n ]),\n ),\n `} else if (typeof prevStartup === 'function') {`,\n Template.indent(`prevStartup();`),\n `}`,\n ]),\n )};`,\n ]);\n }\n}\n\nexport default InvertedContainerRuntimeModule;\n"],"mappings":";;;;AACA,MAAM,EAAE,eAAe,UAAU,mBAAmB,gFAC7B,UAAU,CAChC;AAmBD,IAAM,iCAAN,cAA6C,cAAc;CAGzD,YAAY,SAAgD;AAC1D,QAAM,8BAA8B,cAAc,cAAc;AAChE,OAAK,UAAU;;CAGjB,AAAS,WAAmB;EAC1B,MAAM,EAAE,aAAa,OAAO,eAAe;AAC3C,MAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAC7B,QAAO;AAET,MAAI,MAAM,YAAY,sBACpB,QAAO;EAGT,MAAM,eAAe,YAAY,QAAQ,cAAc;AACvD,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,KAEvD,CADe,YAAY,UAAU,iCAAiC,CAC/D,KACL,yIACD;EAGH,IAAI;AACJ,OAAK,MAAM,gBAAgB,KAAK,QAAQ,YAAY;GAClD,MAAM,MAAM,YAAY,YAAY,UAAU,aAAa;AAC3D,OAAI,CAAC,IAAK;AACV,OAAI,WAAW,gBAAgB,KAAK,MAAM,CACxC,wBAAuB;;AAI3B,MAAI,CAAC,qBAAsB,QAAO;AAElC,MACE,YAAY,WAAW,qBAAqB,sBAAsB,MAAM,CAGxE,QAAO;EAET,MAAM,0BAA0B,YAAY,gBAAgB,UAAU;GACpE,QAAQ;GACR;GACA,MAAM;GACN,qCAAqB,IAAI,KAAK;GAC/B,CAAC;EAGF,MAAM,WAAW,KAAK,UAAU,qBAAqB,MAAM;AAE3D,SAAO,SAAS,SAAS;GACvB,qBAAqB,eAAe,QAAQ;GAC5C;GACA;GACA,GAAG,eAAe,QAAQ,KAAK,YAAY,gBAAgB,cACzD,IACA,SAAS,SAAS;IAChB;IACA,SAAS,OACP,SAAS,SAAS;KAChB;KACA;KACA,SAAS,OAAO,SAAS,SAAS,CAAC,iBAAiB,CAAC,CAAC;KACtD;KACA,kBAAkB,wBAAwB;KAC1C,YAAY,eAAe,OAAO;KAClC,MAAM,SAAS;KAChB,CAAC,CACH;IACD;IACA,SAAS,OAAO,iBAAiB;IACjC;IACD,CAAC,CACH,CAAC;GACH,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __require } from "../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { normalizeWebpackPath } from "@module-federation/sdk/normalize-webpack-path";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/container/InvertedContainerRuntimeModule.ts
|
|
5
|
+
const { RuntimeModule, Template, RuntimeGlobals } = __require(normalizeWebpackPath("webpack"));
|
|
6
|
+
var InvertedContainerRuntimeModule = class extends RuntimeModule {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super("inverted container startup", RuntimeModule.STAGE_TRIGGER);
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
generate() {
|
|
12
|
+
const { compilation, chunk, chunkGraph } = this;
|
|
13
|
+
if (!compilation || !chunk || !chunkGraph) return "";
|
|
14
|
+
if (chunk.runtime === "webpack-api-runtime") return "";
|
|
15
|
+
const runtimeChunk = compilation.options.optimization?.runtimeChunk;
|
|
16
|
+
if (typeof runtimeChunk === "object" && runtimeChunk !== null) compilation.getLogger("InvertedContainerRuntimeModule").info("Runtime chunk is configured. Consider adding runtime: false to your ModuleFederationPlugin configuration to prevent runtime conflicts.");
|
|
17
|
+
let containerEntryModule;
|
|
18
|
+
for (const containerDep of this.options.containers) {
|
|
19
|
+
const mod = compilation.moduleGraph.getModule(containerDep);
|
|
20
|
+
if (!mod) continue;
|
|
21
|
+
if (chunkGraph.isModuleInChunk(mod, chunk)) containerEntryModule = mod;
|
|
22
|
+
}
|
|
23
|
+
if (!containerEntryModule) return "";
|
|
24
|
+
if (compilation.chunkGraph.isEntryModuleInChunk(containerEntryModule, chunk)) return "";
|
|
25
|
+
const initRuntimeModuleGetter = compilation.runtimeTemplate.moduleRaw({
|
|
26
|
+
module: containerEntryModule,
|
|
27
|
+
chunkGraph,
|
|
28
|
+
weak: false,
|
|
29
|
+
runtimeRequirements: /* @__PURE__ */ new Set()
|
|
30
|
+
});
|
|
31
|
+
const nameJSON = JSON.stringify(containerEntryModule._name);
|
|
32
|
+
return Template.asString([
|
|
33
|
+
`var prevStartup = ${RuntimeGlobals.startup};`,
|
|
34
|
+
`var hasRun = false;`,
|
|
35
|
+
`var cachedRemote;`,
|
|
36
|
+
`${RuntimeGlobals.startup} = ${compilation.runtimeTemplate.basicFunction("", Template.asString([
|
|
37
|
+
`if (!hasRun) {`,
|
|
38
|
+
Template.indent(Template.asString([
|
|
39
|
+
`hasRun = true;`,
|
|
40
|
+
`if (typeof prevStartup === 'function') {`,
|
|
41
|
+
Template.indent(Template.asString([`prevStartup();`])),
|
|
42
|
+
`}`,
|
|
43
|
+
`cachedRemote = ${initRuntimeModuleGetter};`,
|
|
44
|
+
`var gs = ${RuntimeGlobals.global} || globalThis;`,
|
|
45
|
+
`gs[${nameJSON}] = cachedRemote;`
|
|
46
|
+
])),
|
|
47
|
+
`} else if (typeof prevStartup === 'function') {`,
|
|
48
|
+
Template.indent(`prevStartup();`),
|
|
49
|
+
`}`
|
|
50
|
+
]))};`
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { InvertedContainerRuntimeModule as default };
|
|
57
|
+
//# sourceMappingURL=InvertedContainerRuntimeModule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvertedContainerRuntimeModule.mjs","names":[],"sources":["../../../../src/plugins/container/InvertedContainerRuntimeModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nconst { RuntimeModule, Template, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack') & {\n RuntimeGlobals: Record<string, string>;\n};\n\ninterface InvertedContainerRuntimeModuleOptions {\n name?: string;\n containers: Set<any>; // Adjust the type as necessary\n}\n\ntype ContainerEntryModule = NonNullable<\n ReturnType<CompilationModuleGraph['getModule']>\n> & {\n _name?: string;\n};\n\ntype CompilationModuleGraph = {\n getModule: (dependency: unknown) => unknown;\n};\n\nclass InvertedContainerRuntimeModule extends RuntimeModule {\n private options: InvertedContainerRuntimeModuleOptions;\n\n constructor(options: InvertedContainerRuntimeModuleOptions) {\n super('inverted container startup', RuntimeModule.STAGE_TRIGGER);\n this.options = options;\n }\n\n override generate(): string {\n const { compilation, chunk, chunkGraph } = this;\n if (!compilation || !chunk || !chunkGraph) {\n return '';\n }\n if (chunk.runtime === 'webpack-api-runtime') {\n return '';\n }\n\n const runtimeChunk = compilation.options.optimization?.runtimeChunk;\n if (typeof runtimeChunk === 'object' && runtimeChunk !== null) {\n const logger = compilation.getLogger('InvertedContainerRuntimeModule');\n logger.info(\n 'Runtime chunk is configured. Consider adding runtime: false to your ModuleFederationPlugin configuration to prevent runtime conflicts.',\n );\n }\n\n let containerEntryModule;\n for (const containerDep of this.options.containers) {\n const mod = compilation.moduleGraph.getModule(containerDep);\n if (!mod) continue;\n if (chunkGraph.isModuleInChunk(mod, chunk)) {\n containerEntryModule = mod as ContainerEntryModule;\n }\n }\n\n if (!containerEntryModule) return '';\n\n if (\n compilation.chunkGraph.isEntryModuleInChunk(containerEntryModule, chunk)\n ) {\n // Don't apply to the remote entry itself\n return '';\n }\n const initRuntimeModuleGetter = compilation.runtimeTemplate.moduleRaw({\n module: containerEntryModule,\n chunkGraph,\n weak: false,\n runtimeRequirements: new Set(),\n });\n\n //@ts-ignore\n const nameJSON = JSON.stringify(containerEntryModule._name);\n\n return Template.asString([\n `var prevStartup = ${RuntimeGlobals.startup};`,\n `var hasRun = false;`,\n `var cachedRemote;`,\n `${RuntimeGlobals.startup} = ${compilation.runtimeTemplate.basicFunction(\n '',\n Template.asString([\n `if (!hasRun) {`,\n Template.indent(\n Template.asString([\n `hasRun = true;`,\n `if (typeof prevStartup === 'function') {`,\n Template.indent(Template.asString([`prevStartup();`])),\n `}`,\n `cachedRemote = ${initRuntimeModuleGetter};`,\n `var gs = ${RuntimeGlobals.global} || globalThis;`,\n `gs[${nameJSON}] = cachedRemote;`,\n ]),\n ),\n `} else if (typeof prevStartup === 'function') {`,\n Template.indent(`prevStartup();`),\n `}`,\n ]),\n )};`,\n ]);\n }\n}\n\nexport default InvertedContainerRuntimeModule;\n"],"mappings":";;;;AACA,MAAM,EAAE,eAAe,UAAU,6BAC/B,qBAAqB,UAAU,CAChC;AAmBD,IAAM,iCAAN,cAA6C,cAAc;CAGzD,YAAY,SAAgD;AAC1D,QAAM,8BAA8B,cAAc,cAAc;AAChE,OAAK,UAAU;;CAGjB,AAAS,WAAmB;EAC1B,MAAM,EAAE,aAAa,OAAO,eAAe;AAC3C,MAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAC7B,QAAO;AAET,MAAI,MAAM,YAAY,sBACpB,QAAO;EAGT,MAAM,eAAe,YAAY,QAAQ,cAAc;AACvD,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,KAEvD,CADe,YAAY,UAAU,iCAAiC,CAC/D,KACL,yIACD;EAGH,IAAI;AACJ,OAAK,MAAM,gBAAgB,KAAK,QAAQ,YAAY;GAClD,MAAM,MAAM,YAAY,YAAY,UAAU,aAAa;AAC3D,OAAI,CAAC,IAAK;AACV,OAAI,WAAW,gBAAgB,KAAK,MAAM,CACxC,wBAAuB;;AAI3B,MAAI,CAAC,qBAAsB,QAAO;AAElC,MACE,YAAY,WAAW,qBAAqB,sBAAsB,MAAM,CAGxE,QAAO;EAET,MAAM,0BAA0B,YAAY,gBAAgB,UAAU;GACpE,QAAQ;GACR;GACA,MAAM;GACN,qCAAqB,IAAI,KAAK;GAC/B,CAAC;EAGF,MAAM,WAAW,KAAK,UAAU,qBAAqB,MAAM;AAE3D,SAAO,SAAS,SAAS;GACvB,qBAAqB,eAAe,QAAQ;GAC5C;GACA;GACA,GAAG,eAAe,QAAQ,KAAK,YAAY,gBAAgB,cACzD,IACA,SAAS,SAAS;IAChB;IACA,SAAS,OACP,SAAS,SAAS;KAChB;KACA;KACA,SAAS,OAAO,SAAS,SAAS,CAAC,iBAAiB,CAAC,CAAC;KACtD;KACA,kBAAkB,wBAAwB;KAC1C,YAAY,eAAe,OAAO;KAClC,MAAM,SAAS;KAChB,CAAC,CACH;IACD;IACA,SAAS,OAAO,iBAAiB;IACjC;IACD,CAAC,CACH,CAAC;GACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime
|
|
1
|
+
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
2
2
|
export default function (): ModuleFederationRuntimePlugin;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
2
|
+
let _module_federation_runtime_core = require("@module-federation/runtime-core");
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/container/runtimePlugin.ts
|
|
5
|
+
function wrapCallableForChunkTracking(fn, id) {
|
|
6
|
+
return new Proxy(fn, {
|
|
7
|
+
apply(_target, thisArg, args) {
|
|
8
|
+
globalThis.usedChunks.add(id);
|
|
9
|
+
return Reflect.apply(fn, thisArg, args);
|
|
10
|
+
},
|
|
11
|
+
construct(_target, args, newTarget) {
|
|
12
|
+
globalThis.usedChunks.add(id);
|
|
13
|
+
return Reflect.construct(fn, args, newTarget);
|
|
14
|
+
},
|
|
15
|
+
get(target, prop, receiver) {
|
|
16
|
+
return Reflect.get(target, prop, receiver);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function runtimePlugin_default() {
|
|
21
|
+
return {
|
|
22
|
+
name: "next-internal-plugin",
|
|
23
|
+
createScript: function(args) {
|
|
24
|
+
const url = args.url;
|
|
25
|
+
const attrs = args.attrs;
|
|
26
|
+
if (typeof window !== "undefined") {
|
|
27
|
+
const script = document.createElement("script");
|
|
28
|
+
script.src = url;
|
|
29
|
+
script.async = true;
|
|
30
|
+
delete attrs?.["crossorigin"];
|
|
31
|
+
return {
|
|
32
|
+
script,
|
|
33
|
+
timeout: 8e3
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
errorLoadRemote: function(args) {
|
|
38
|
+
const id = args.id;
|
|
39
|
+
const error = args.error;
|
|
40
|
+
const from = args.from;
|
|
41
|
+
globalThis.moduleGraphDirty = true;
|
|
42
|
+
console.error(id, "offline");
|
|
43
|
+
const pg = function() {
|
|
44
|
+
console.error(id, "offline", error);
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
pg.getInitialProps = function(ctx) {
|
|
48
|
+
return {};
|
|
49
|
+
};
|
|
50
|
+
let mod;
|
|
51
|
+
if (from === "build") mod = function() {
|
|
52
|
+
return {
|
|
53
|
+
__esModule: true,
|
|
54
|
+
default: pg,
|
|
55
|
+
getServerSideProps: function() {
|
|
56
|
+
return { props: {} };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
else mod = {
|
|
61
|
+
default: pg,
|
|
62
|
+
getServerSideProps: function() {
|
|
63
|
+
return { props: {} };
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return mod;
|
|
67
|
+
},
|
|
68
|
+
beforeInit: function(args) {
|
|
69
|
+
if (!globalThis.usedChunks) globalThis.usedChunks = /* @__PURE__ */ new Set();
|
|
70
|
+
if (typeof __webpack_runtime_id__ === "string" && !__webpack_runtime_id__.startsWith("webpack")) return args;
|
|
71
|
+
const moduleCache = args.origin.moduleCache;
|
|
72
|
+
const name = args.origin.name;
|
|
73
|
+
let gs;
|
|
74
|
+
try {
|
|
75
|
+
gs = new Function("return globalThis")();
|
|
76
|
+
} catch (e) {
|
|
77
|
+
gs = globalThis;
|
|
78
|
+
}
|
|
79
|
+
const attachedRemote = gs[name];
|
|
80
|
+
if (attachedRemote) moduleCache.set(name, attachedRemote);
|
|
81
|
+
return args;
|
|
82
|
+
},
|
|
83
|
+
init: function(args) {
|
|
84
|
+
return args;
|
|
85
|
+
},
|
|
86
|
+
beforeRequest: function(args) {
|
|
87
|
+
const options = args.options;
|
|
88
|
+
const id = args.id;
|
|
89
|
+
const match = (0, _module_federation_runtime_core.matchRemoteWithNameAndExpose)(options.remotes, id);
|
|
90
|
+
if (!match) return args;
|
|
91
|
+
const remote = match.remote;
|
|
92
|
+
if (!("entry" in remote) || !remote.entry || /[?&]t=/.test(remote.entry)) return args;
|
|
93
|
+
remote.entry = remote.entry + (remote.entry.includes("?") ? "&" : "?") + "t=" + Date.now();
|
|
94
|
+
return args;
|
|
95
|
+
},
|
|
96
|
+
afterResolve: function(args) {
|
|
97
|
+
return args;
|
|
98
|
+
},
|
|
99
|
+
onLoad: async function(args) {
|
|
100
|
+
const exposeModuleFactory = args.exposeModuleFactory;
|
|
101
|
+
const exposeModule = args.exposeModule;
|
|
102
|
+
const id = args.id;
|
|
103
|
+
const moduleOrFactory = exposeModuleFactory || exposeModule;
|
|
104
|
+
if (!moduleOrFactory) return args;
|
|
105
|
+
if (typeof window === "undefined") {
|
|
106
|
+
let exposedModuleExports;
|
|
107
|
+
try {
|
|
108
|
+
exposedModuleExports = moduleOrFactory();
|
|
109
|
+
} catch (e) {
|
|
110
|
+
exposedModuleExports = moduleOrFactory;
|
|
111
|
+
}
|
|
112
|
+
exposedModuleExports = await exposedModuleExports;
|
|
113
|
+
const handler = { get: function(target, prop, receiver) {
|
|
114
|
+
const value = Reflect.get(target, prop, receiver);
|
|
115
|
+
if (typeof value === "function") return wrapCallableForChunkTracking(value, id);
|
|
116
|
+
return value;
|
|
117
|
+
} };
|
|
118
|
+
if (typeof exposedModuleExports === "function") {
|
|
119
|
+
exposedModuleExports = wrapCallableForChunkTracking(exposedModuleExports, id);
|
|
120
|
+
return function() {
|
|
121
|
+
return exposedModuleExports;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
exposedModuleExports = new Proxy(exposedModuleExports, handler);
|
|
125
|
+
if (exposeModuleFactory) {
|
|
126
|
+
const wrappedExports = exposedModuleExports;
|
|
127
|
+
return function() {
|
|
128
|
+
return wrappedExports;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return exposedModuleExports;
|
|
132
|
+
}
|
|
133
|
+
return args;
|
|
134
|
+
},
|
|
135
|
+
loadRemoteSnapshot(args) {
|
|
136
|
+
const { from, remoteSnapshot, manifestUrl, manifestJson, options } = args;
|
|
137
|
+
if (from !== "manifest" || !manifestUrl || !manifestJson || !("publicPath" in remoteSnapshot)) return args;
|
|
138
|
+
const { publicPath } = remoteSnapshot;
|
|
139
|
+
if (options.inBrowser && publicPath.includes("/_next/")) remoteSnapshot.publicPath = publicPath.substring(0, publicPath.lastIndexOf("/_next/") + 7);
|
|
140
|
+
else remoteSnapshot.publicPath = manifestUrl.substring(0, manifestUrl.indexOf("mf-manifest.json"));
|
|
141
|
+
if ("publicPath" in manifestJson.metaData) manifestJson.metaData.publicPath = remoteSnapshot.publicPath;
|
|
142
|
+
return args;
|
|
143
|
+
},
|
|
144
|
+
resolveShare: function(args) {
|
|
145
|
+
if (args.pkgName !== "react" && args.pkgName !== "react-dom" && !args.pkgName.startsWith("next/")) return args;
|
|
146
|
+
const shareScopeMap = args.shareScopeMap;
|
|
147
|
+
const scope = args.scope;
|
|
148
|
+
const pkgName = args.pkgName;
|
|
149
|
+
const version = args.version;
|
|
150
|
+
const host = args.GlobalFederation["__INSTANCES__"][0];
|
|
151
|
+
if (!host) return args;
|
|
152
|
+
if (!host.options.shared[pkgName]) return args;
|
|
153
|
+
args.resolver = function() {
|
|
154
|
+
shareScopeMap[scope][pkgName][version] = host.options.shared[pkgName][0];
|
|
155
|
+
return {
|
|
156
|
+
shared: shareScopeMap[scope][pkgName][version],
|
|
157
|
+
useTreesShaking: false
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
return args;
|
|
161
|
+
},
|
|
162
|
+
beforeLoadShare: async function(args) {
|
|
163
|
+
return args;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
169
|
+
module.exports = runtimePlugin_default;
|
|
170
|
+
//# sourceMappingURL=runtimePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimePlugin.js","sourceRoot":"","sources":["../../../../src/plugins/container/runtimePlugin.ts"],"names":[],"mappings":";;AAEA,4BAwPC;AAxPD;IACE,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,YAAY,EAAE,UAAU,IAGvB;YACC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;YACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAChD,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;gBACjB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;gBACpB,OAAO,KAAK,EAAE,CAAC,aAAa,CAAC,CAAC;gBAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC3C,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,eAAe,EAAE,UAAU,IAK1B;YACC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,YAAY;YACZ,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC;YACnC,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;YAED,EAAU,CAAC,eAAe,GAAG,UAAU,GAAQ;gBAC9C,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,IAAI,GAAG,CA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,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;YAChD,CAAC,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,eAAe,EAAE,KAAK,WAAW,IAAS;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"runtimePlugin.js","names":[],"sources":["../../../../src/plugins/container/runtimePlugin.ts"],"sourcesContent":["import { ModuleFederationRuntimePlugin } from '@module-federation/runtime';\nimport { matchRemoteWithNameAndExpose } from '@module-federation/runtime-core';\n\nfunction wrapCallableForChunkTracking<T extends (...args: any[]) => any>(\n fn: T,\n id: string,\n): T {\n return new Proxy(fn, {\n apply(_target, thisArg, args) {\n globalThis.usedChunks.add(id);\n return Reflect.apply(fn, thisArg, args);\n },\n construct(_target, args, newTarget) {\n globalThis.usedChunks.add(id);\n return Reflect.construct(fn, args, newTarget);\n },\n get(target, prop, receiver) {\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\nexport default function (): ModuleFederationRuntimePlugin {\n return {\n name: 'next-internal-plugin',\n createScript: function (args: {\n url: string;\n attrs?: Record<string, any>;\n }) {\n const url = args.url;\n const attrs = args.attrs;\n if (typeof window !== 'undefined') {\n const script = document.createElement('script');\n script.src = url;\n script.async = true;\n delete attrs?.['crossorigin'];\n\n return { script: script, timeout: 8000 };\n }\n return undefined;\n },\n errorLoadRemote: function (args: {\n id: string;\n error: any;\n from: string;\n origin: any;\n }) {\n const id = args.id;\n const error = args.error;\n const from = args.from;\n //@ts-ignore\n globalThis.moduleGraphDirty = true;\n console.error(id, 'offline');\n const pg = function () {\n console.error(id, 'offline', error);\n return null;\n };\n\n (pg as any).getInitialProps = function (ctx: any) {\n return {};\n };\n let mod;\n if (from === 'build') {\n mod = function () {\n return {\n __esModule: true,\n default: pg,\n getServerSideProps: function () {\n return { props: {} };\n },\n };\n };\n } else {\n mod = {\n default: pg,\n getServerSideProps: function () {\n return { props: {} };\n },\n };\n }\n\n return mod;\n },\n beforeInit: function (args) {\n if (!globalThis.usedChunks) globalThis.usedChunks = new Set();\n if (\n typeof __webpack_runtime_id__ === 'string' &&\n !__webpack_runtime_id__.startsWith('webpack')\n ) {\n return args;\n }\n\n const moduleCache = args.origin.moduleCache;\n const name = args.origin.name;\n let gs;\n try {\n gs = new Function('return globalThis')();\n } catch (e) {\n gs = globalThis; // fallback for browsers without 'unsafe-eval' CSP policy enabled\n }\n //@ts-ignore\n const attachedRemote = gs[name];\n if (attachedRemote) {\n moduleCache.set(name, attachedRemote);\n }\n\n return args;\n },\n init: function (args: any) {\n return args;\n },\n beforeRequest: function (args: any) {\n const options = args.options;\n const id = args.id;\n const match = matchRemoteWithNameAndExpose(options.remotes, id);\n if (!match) return args;\n const remote = match.remote;\n if (\n !('entry' in remote) ||\n !remote.entry ||\n /[?&]t=/.test(remote.entry)\n ) {\n return args;\n }\n remote.entry =\n remote.entry +\n (remote.entry.includes('?') ? '&' : '?') +\n 't=' +\n Date.now();\n return args;\n },\n afterResolve: function (args: any) {\n return args;\n },\n onLoad: async function (args: any) {\n const exposeModuleFactory = args.exposeModuleFactory;\n const exposeModule = args.exposeModule;\n const id = args.id;\n const moduleOrFactory = exposeModuleFactory || exposeModule;\n if (!moduleOrFactory) return args;\n\n if (typeof window === 'undefined') {\n let exposedModuleExports: any;\n try {\n exposedModuleExports = moduleOrFactory();\n } catch (e) {\n exposedModuleExports = moduleOrFactory;\n }\n\n exposedModuleExports = await exposedModuleExports;\n\n const handler: ProxyHandler<any> = {\n get: function (target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value === 'function') {\n return wrapCallableForChunkTracking(value, id);\n }\n return value;\n },\n };\n\n if (typeof exposedModuleExports === 'function') {\n exposedModuleExports = wrapCallableForChunkTracking(\n exposedModuleExports,\n id,\n );\n return function () {\n return exposedModuleExports;\n };\n }\n\n exposedModuleExports = new Proxy(exposedModuleExports, handler);\n\n if (exposeModuleFactory) {\n const wrappedExports = exposedModuleExports;\n return function () {\n return wrappedExports;\n };\n }\n\n return exposedModuleExports;\n }\n\n return args;\n },\n loadRemoteSnapshot(args) {\n const { from, remoteSnapshot, manifestUrl, manifestJson, options } = args;\n\n // ensure snapshot is loaded from manifest\n if (\n from !== 'manifest' ||\n !manifestUrl ||\n !manifestJson ||\n !('publicPath' in remoteSnapshot)\n ) {\n return args;\n }\n\n // re-assign publicPath based on remoteEntry location if in browser nextjs remote\n const { publicPath } = remoteSnapshot;\n if (options.inBrowser && publicPath.includes('/_next/')) {\n remoteSnapshot.publicPath = publicPath.substring(\n 0,\n publicPath.lastIndexOf('/_next/') + 7,\n );\n } else {\n const serverPublicPath = manifestUrl.substring(\n 0,\n manifestUrl.indexOf('mf-manifest.json'),\n );\n remoteSnapshot.publicPath = serverPublicPath;\n }\n\n if ('publicPath' in manifestJson.metaData) {\n manifestJson.metaData.publicPath = remoteSnapshot.publicPath;\n }\n\n return args;\n },\n resolveShare: function (args: any) {\n if (\n args.pkgName !== 'react' &&\n args.pkgName !== 'react-dom' &&\n !args.pkgName.startsWith('next/')\n ) {\n return args;\n }\n const shareScopeMap = args.shareScopeMap;\n const scope = args.scope;\n const pkgName = args.pkgName;\n const version = args.version;\n const GlobalFederation = args.GlobalFederation;\n const host = GlobalFederation['__INSTANCES__'][0];\n if (!host) {\n return args;\n }\n\n if (!host.options.shared[pkgName]) {\n return args;\n }\n args.resolver = function () {\n shareScopeMap[scope][pkgName][version] =\n host.options.shared[pkgName][0];\n return {\n shared: shareScopeMap[scope][pkgName][version],\n useTreesShaking: false,\n };\n };\n return args;\n },\n beforeLoadShare: async function (args: any) {\n return args;\n },\n };\n}\n"],"mappings":";;;;AAGA,SAAS,6BACP,IACA,IACG;AACH,QAAO,IAAI,MAAM,IAAI;EACnB,MAAM,SAAS,SAAS,MAAM;AAC5B,cAAW,WAAW,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