@module-federation/nextjs-mf 0.0.0-perf-devtools-20260107043700 → 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.
Files changed (147) hide show
  1. package/dist/LICENSE +21 -0
  2. package/dist/_virtual/_rolldown/runtime.js +29 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  4. package/dist/client/UrlNode.d.mts +17 -0
  5. package/dist/client/UrlNode.js +89 -147
  6. package/dist/client/UrlNode.js.map +1 -1
  7. package/dist/client/UrlNode.mjs +91 -0
  8. package/dist/client/UrlNode.mjs.map +1 -0
  9. package/dist/node.d.mts +1 -0
  10. package/dist/src/federation-noop.d.mts +0 -0
  11. package/dist/src/federation-noop.js +17 -0
  12. package/dist/src/federation-noop.js.map +1 -1
  13. package/dist/src/federation-noop.mjs +23 -0
  14. package/dist/src/federation-noop.mjs.map +1 -0
  15. package/dist/src/index.d.mts +3 -0
  16. package/dist/src/index.js +13 -11
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/index.mjs +8 -0
  19. package/dist/src/index.mjs.map +1 -0
  20. package/dist/src/internal.d.mts +50 -0
  21. package/dist/src/internal.js +140 -243
  22. package/dist/src/internal.js.map +1 -1
  23. package/dist/src/internal.mjs +152 -0
  24. package/dist/src/internal.mjs.map +1 -0
  25. package/dist/src/loaders/fixImageLoader.d.mts +22 -0
  26. package/dist/src/loaders/fixImageLoader.js +91 -103
  27. package/dist/src/loaders/fixImageLoader.js.map +1 -1
  28. package/dist/src/loaders/fixImageLoader.mjs +101 -0
  29. package/dist/src/loaders/fixImageLoader.mjs.map +1 -0
  30. package/dist/src/loaders/fixUrlLoader.d.mts +13 -0
  31. package/dist/src/loaders/fixUrlLoader.js +17 -19
  32. package/dist/src/loaders/fixUrlLoader.js.map +1 -1
  33. package/dist/src/loaders/fixUrlLoader.mjs +19 -0
  34. package/dist/src/loaders/fixUrlLoader.mjs.map +1 -0
  35. package/dist/src/loaders/helpers.d.mts +17 -0
  36. package/dist/src/loaders/helpers.js +72 -124
  37. package/dist/src/loaders/helpers.js.map +1 -1
  38. package/dist/src/loaders/helpers.mjs +79 -0
  39. package/dist/src/loaders/helpers.mjs.map +1 -0
  40. package/dist/src/loaders/nextPageMapLoader.d.mts +24 -0
  41. package/dist/src/loaders/nextPageMapLoader.js +126 -144
  42. package/dist/src/loaders/nextPageMapLoader.js.map +1 -1
  43. package/dist/src/loaders/nextPageMapLoader.mjs +143 -0
  44. package/dist/src/loaders/nextPageMapLoader.mjs.map +1 -0
  45. package/dist/src/logger.d.mts +2 -0
  46. package/dist/src/logger.js +7 -7
  47. package/dist/src/logger.js.map +1 -1
  48. package/dist/src/logger.mjs +8 -0
  49. package/dist/src/logger.mjs.map +1 -0
  50. package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.mts +5 -0
  51. package/dist/src/plugins/CopyFederationPlugin.d.mts +20 -0
  52. package/dist/src/plugins/CopyFederationPlugin.js +64 -71
  53. package/dist/src/plugins/CopyFederationPlugin.js.map +1 -1
  54. package/dist/src/plugins/CopyFederationPlugin.mjs +65 -0
  55. package/dist/src/plugins/CopyFederationPlugin.mjs.map +1 -0
  56. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.d.mts +22 -0
  57. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.d.ts +22 -0
  58. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.js +43 -0
  59. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.js.map +1 -0
  60. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.mjs +42 -0
  61. package/dist/src/plugins/NextFederationPlugin/FederatedStatsCompatibilityPlugin.mjs.map +1 -0
  62. package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.d.mts +23 -0
  63. package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +42 -53
  64. package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -1
  65. package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs +46 -0
  66. package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs.map +1 -0
  67. package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.d.mts +36 -0
  68. package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +103 -121
  69. package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -1
  70. package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs +111 -0
  71. package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs.map +1 -0
  72. package/dist/src/plugins/NextFederationPlugin/index.d.mts +27 -0
  73. package/dist/src/plugins/NextFederationPlugin/index.js +149 -181
  74. package/dist/src/plugins/NextFederationPlugin/index.js.map +1 -1
  75. package/dist/src/plugins/NextFederationPlugin/index.mjs +151 -0
  76. package/dist/src/plugins/NextFederationPlugin/index.mjs.map +1 -0
  77. package/dist/src/plugins/NextFederationPlugin/manifest-options.d.mts +4 -0
  78. package/dist/src/plugins/NextFederationPlugin/manifest-options.d.ts +4 -0
  79. package/dist/src/plugins/NextFederationPlugin/manifest-options.js +13 -0
  80. package/dist/src/plugins/NextFederationPlugin/manifest-options.js.map +1 -0
  81. package/dist/src/plugins/NextFederationPlugin/manifest-options.mjs +12 -0
  82. package/dist/src/plugins/NextFederationPlugin/manifest-options.mjs.map +1 -0
  83. package/dist/src/plugins/NextFederationPlugin/next-fragments.d.mts +20 -0
  84. package/dist/src/plugins/NextFederationPlugin/next-fragments.js +58 -93
  85. package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -1
  86. package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs +63 -0
  87. package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs.map +1 -0
  88. package/dist/src/plugins/NextFederationPlugin/{regex-equal.js → regex-equal.d.mts} +2 -13
  89. package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.mts +8 -0
  90. package/dist/src/plugins/NextFederationPlugin/set-options.d.mts +6 -0
  91. package/dist/src/plugins/NextFederationPlugin/set-options.d.ts +1 -11
  92. package/dist/src/plugins/NextFederationPlugin/set-options.js +17 -19
  93. package/dist/src/plugins/NextFederationPlugin/set-options.js.map +1 -1
  94. package/dist/src/plugins/NextFederationPlugin/set-options.mjs +19 -0
  95. package/dist/src/plugins/NextFederationPlugin/set-options.mjs.map +1 -0
  96. package/dist/src/plugins/NextFederationPlugin/validate-options.d.mts +25 -0
  97. package/dist/src/plugins/NextFederationPlugin/validate-options.js +30 -38
  98. package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +1 -1
  99. package/dist/src/plugins/NextFederationPlugin/validate-options.mjs +35 -0
  100. package/dist/src/plugins/NextFederationPlugin/validate-options.mjs.map +1 -0
  101. package/dist/src/plugins/container/InvertedContainerPlugin.d.mts +5 -0
  102. package/dist/src/plugins/container/InvertedContainerPlugin.js +23 -25
  103. package/dist/src/plugins/container/InvertedContainerPlugin.js.map +1 -1
  104. package/dist/src/plugins/container/InvertedContainerPlugin.mjs +27 -0
  105. package/dist/src/plugins/container/InvertedContainerPlugin.mjs.map +1 -0
  106. package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.mts +11 -0
  107. package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.ts +1 -1
  108. package/dist/src/plugins/container/InvertedContainerRuntimeModule.js +55 -67
  109. package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -1
  110. package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs +57 -0
  111. package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs.map +1 -0
  112. package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.mts +39 -0
  113. package/dist/src/plugins/container/runtimePlugin.d.mts +2 -0
  114. package/dist/src/plugins/container/runtimePlugin.d.ts +1 -1
  115. package/dist/src/plugins/container/runtimePlugin.js +170 -0
  116. package/dist/src/plugins/container/runtimePlugin.js.map +1 -1
  117. package/dist/src/plugins/container/runtimePlugin.mjs +169 -0
  118. package/dist/src/plugins/container/runtimePlugin.mjs.map +1 -0
  119. package/dist/src/plugins/container/types.d.mts +2 -0
  120. package/dist/src/types.d.mts +28 -0
  121. package/dist/utils/flushedChunks.d.mts +22 -0
  122. package/dist/utils/flushedChunks.js +32 -72
  123. package/dist/utils/flushedChunks.js.map +1 -1
  124. package/dist/utils/flushedChunks.mjs +35 -0
  125. package/dist/utils/flushedChunks.mjs.map +1 -0
  126. package/dist/utils/index.d.mts +20 -0
  127. package/dist/utils/index.js +27 -62
  128. package/dist/utils/index.js.map +1 -1
  129. package/dist/utils/index.mjs +22 -0
  130. package/dist/utils/index.mjs.map +1 -0
  131. package/package.json +45 -10
  132. package/dist/node.js +0 -18
  133. package/dist/node.js.map +0 -1
  134. package/dist/package.json +0 -71
  135. package/dist/src/federation-noop.cjs +0 -15
  136. package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +0 -19
  137. package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +0 -1
  138. package/dist/src/plugins/NextFederationPlugin/regex-equal.js.map +0 -1
  139. package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +0 -34
  140. package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +0 -1
  141. package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +0 -78
  142. package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +0 -1
  143. package/dist/src/plugins/container/runtimePlugin.cjs +0 -216
  144. package/dist/src/plugins/container/types.js +0 -3
  145. package/dist/src/plugins/container/types.js.map +0 -1
  146. package/dist/src/types.js +0 -3
  147. package/dist/src/types.js.map +0 -1
@@ -0,0 +1,169 @@
1
+ import { matchRemoteWithNameAndExpose } from "@module-federation/runtime-core";
2
+
3
+ //#region src/plugins/container/runtimePlugin.ts
4
+ function wrapCallableForChunkTracking(fn, id) {
5
+ return new Proxy(fn, {
6
+ apply(_target, thisArg, args) {
7
+ globalThis.usedChunks.add(id);
8
+ return Reflect.apply(fn, thisArg, args);
9
+ },
10
+ construct(_target, args, newTarget) {
11
+ globalThis.usedChunks.add(id);
12
+ return Reflect.construct(fn, args, newTarget);
13
+ },
14
+ get(target, prop, receiver) {
15
+ return Reflect.get(target, prop, receiver);
16
+ }
17
+ });
18
+ }
19
+ function runtimePlugin_default() {
20
+ return {
21
+ name: "next-internal-plugin",
22
+ createScript: function(args) {
23
+ const url = args.url;
24
+ const attrs = args.attrs;
25
+ if (typeof window !== "undefined") {
26
+ const script = document.createElement("script");
27
+ script.src = url;
28
+ script.async = true;
29
+ delete attrs?.["crossorigin"];
30
+ return {
31
+ script,
32
+ timeout: 8e3
33
+ };
34
+ }
35
+ },
36
+ errorLoadRemote: function(args) {
37
+ const id = args.id;
38
+ const error = args.error;
39
+ const from = args.from;
40
+ globalThis.moduleGraphDirty = true;
41
+ console.error(id, "offline");
42
+ const pg = function() {
43
+ console.error(id, "offline", error);
44
+ return null;
45
+ };
46
+ pg.getInitialProps = function(ctx) {
47
+ return {};
48
+ };
49
+ let mod;
50
+ if (from === "build") mod = function() {
51
+ return {
52
+ __esModule: true,
53
+ default: pg,
54
+ getServerSideProps: function() {
55
+ return { props: {} };
56
+ }
57
+ };
58
+ };
59
+ else mod = {
60
+ default: pg,
61
+ getServerSideProps: function() {
62
+ return { props: {} };
63
+ }
64
+ };
65
+ return mod;
66
+ },
67
+ beforeInit: function(args) {
68
+ if (!globalThis.usedChunks) globalThis.usedChunks = /* @__PURE__ */ new Set();
69
+ if (typeof __webpack_runtime_id__ === "string" && !__webpack_runtime_id__.startsWith("webpack")) return args;
70
+ const moduleCache = args.origin.moduleCache;
71
+ const name = args.origin.name;
72
+ let gs;
73
+ try {
74
+ gs = new Function("return globalThis")();
75
+ } catch (e) {
76
+ gs = globalThis;
77
+ }
78
+ const attachedRemote = gs[name];
79
+ if (attachedRemote) moduleCache.set(name, attachedRemote);
80
+ return args;
81
+ },
82
+ init: function(args) {
83
+ return args;
84
+ },
85
+ beforeRequest: function(args) {
86
+ const options = args.options;
87
+ const id = args.id;
88
+ const match = matchRemoteWithNameAndExpose(options.remotes, id);
89
+ if (!match) return args;
90
+ const remote = match.remote;
91
+ if (!("entry" in remote) || !remote.entry || /[?&]t=/.test(remote.entry)) return args;
92
+ remote.entry = remote.entry + (remote.entry.includes("?") ? "&" : "?") + "t=" + Date.now();
93
+ return args;
94
+ },
95
+ afterResolve: function(args) {
96
+ return args;
97
+ },
98
+ onLoad: async function(args) {
99
+ const exposeModuleFactory = args.exposeModuleFactory;
100
+ const exposeModule = args.exposeModule;
101
+ const id = args.id;
102
+ const moduleOrFactory = exposeModuleFactory || exposeModule;
103
+ if (!moduleOrFactory) return args;
104
+ if (typeof window === "undefined") {
105
+ let exposedModuleExports;
106
+ try {
107
+ exposedModuleExports = moduleOrFactory();
108
+ } catch (e) {
109
+ exposedModuleExports = moduleOrFactory;
110
+ }
111
+ exposedModuleExports = await exposedModuleExports;
112
+ const handler = { get: function(target, prop, receiver) {
113
+ const value = Reflect.get(target, prop, receiver);
114
+ if (typeof value === "function") return wrapCallableForChunkTracking(value, id);
115
+ return value;
116
+ } };
117
+ if (typeof exposedModuleExports === "function") {
118
+ exposedModuleExports = wrapCallableForChunkTracking(exposedModuleExports, id);
119
+ return function() {
120
+ return exposedModuleExports;
121
+ };
122
+ }
123
+ exposedModuleExports = new Proxy(exposedModuleExports, handler);
124
+ if (exposeModuleFactory) {
125
+ const wrappedExports = exposedModuleExports;
126
+ return function() {
127
+ return wrappedExports;
128
+ };
129
+ }
130
+ return exposedModuleExports;
131
+ }
132
+ return args;
133
+ },
134
+ loadRemoteSnapshot(args) {
135
+ const { from, remoteSnapshot, manifestUrl, manifestJson, options } = args;
136
+ if (from !== "manifest" || !manifestUrl || !manifestJson || !("publicPath" in remoteSnapshot)) return args;
137
+ const { publicPath } = remoteSnapshot;
138
+ if (options.inBrowser && publicPath.includes("/_next/")) remoteSnapshot.publicPath = publicPath.substring(0, publicPath.lastIndexOf("/_next/") + 7);
139
+ else remoteSnapshot.publicPath = manifestUrl.substring(0, manifestUrl.indexOf("mf-manifest.json"));
140
+ if ("publicPath" in manifestJson.metaData) manifestJson.metaData.publicPath = remoteSnapshot.publicPath;
141
+ return args;
142
+ },
143
+ resolveShare: function(args) {
144
+ if (args.pkgName !== "react" && args.pkgName !== "react-dom" && !args.pkgName.startsWith("next/")) return args;
145
+ const shareScopeMap = args.shareScopeMap;
146
+ const scope = args.scope;
147
+ const pkgName = args.pkgName;
148
+ const version = args.version;
149
+ const host = args.GlobalFederation["__INSTANCES__"][0];
150
+ if (!host) return args;
151
+ if (!host.options.shared[pkgName]) return args;
152
+ args.resolver = function() {
153
+ shareScopeMap[scope][pkgName][version] = host.options.shared[pkgName][0];
154
+ return {
155
+ shared: shareScopeMap[scope][pkgName][version],
156
+ useTreesShaking: false
157
+ };
158
+ };
159
+ return args;
160
+ },
161
+ beforeLoadShare: async function(args) {
162
+ return args;
163
+ }
164
+ };
165
+ }
166
+
167
+ //#endregion
168
+ export { runtimePlugin_default as default };
169
+ //# sourceMappingURL=runtimePlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimePlugin.mjs","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,IAAI,GAAG;AAC7B,UAAO,QAAQ,MAAM,IAAI,SAAS,KAAK;;EAEzC,UAAU,SAAS,MAAM,WAAW;AAClC,cAAW,WAAW,IAAI,GAAG;AAC7B,UAAO,QAAQ,UAAU,IAAI,MAAM,UAAU;;EAE/C,IAAI,QAAQ,MAAM,UAAU;AAC1B,UAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;;EAE7C,CAAC;;AAGJ,iCAA0D;AACxD,QAAO;EACL,MAAM;EACN,cAAc,SAAU,MAGrB;GACD,MAAM,MAAM,KAAK;GACjB,MAAM,QAAQ,KAAK;AACnB,OAAI,OAAO,WAAW,aAAa;IACjC,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,WAAO,MAAM;AACb,WAAO,QAAQ;AACf,WAAO,QAAQ;AAEf,WAAO;KAAU;KAAQ,SAAS;KAAM;;;EAI5C,iBAAiB,SAAU,MAKxB;GACD,MAAM,KAAK,KAAK;GAChB,MAAM,QAAQ,KAAK;GACnB,MAAM,OAAO,KAAK;AAElB,cAAW,mBAAmB;AAC9B,WAAQ,MAAM,IAAI,UAAU;GAC5B,MAAM,KAAK,WAAY;AACrB,YAAQ,MAAM,IAAI,WAAW,MAAM;AACnC,WAAO;;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AM,OADmB,KAAK,iBACA,iBAAiB;AAC/C,OAAI,CAAC,KACH,QAAO;AAGT,OAAI,CAAC,KAAK,QAAQ,OAAO,SACvB,QAAO;AAET,QAAK,WAAW,WAAY;AAC1B,kBAAc,OAAO,SAAS,WAC5B,KAAK,QAAQ,OAAO,SAAS;AAC/B,WAAO;KACL,QAAQ,cAAc,OAAO,SAAS;KACtC,iBAAiB;KAClB;;AAEH,UAAO;;EAET,iBAAiB,eAAgB,MAAW;AAC1C,UAAO;;EAEV"}
@@ -0,0 +1,2 @@
1
+ import type { container } from 'webpack';
2
+ export type ModuleFederationPluginOptions = ConstructorParameters<typeof container.ModuleFederationPlugin>['0'];
@@ -0,0 +1,28 @@
1
+ export declare interface WatchOptions {
2
+ /**
3
+ * Delay the rebuilt after the first change. Value is a time in ms.
4
+ */
5
+ aggregateTimeout?: number;
6
+ /**
7
+ * Resolve symlinks and watch symlink and real file. This is usually not needed as webpack already resolves symlinks ('resolve.symlinks').
8
+ */
9
+ followSymlinks?: boolean;
10
+ /**
11
+ * Ignore some files from watching (glob pattern or regexp).
12
+ */
13
+ ignored?: string | RegExp | string[];
14
+ /**
15
+ * Enable polling mode for watching.
16
+ */
17
+ poll?: number | boolean;
18
+ /**
19
+ * Stop watching when stdin stream has ended.
20
+ */
21
+ stdin?: boolean;
22
+ }
23
+ export declare interface CallbackFunction<T> {
24
+ (err?: null | Error, result?: T): any;
25
+ }
26
+ declare global {
27
+ var usedChunks: Set<string>;
28
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * FlushedChunks component.
4
+ * This component creates script and link elements for each chunk.
5
+ *
6
+ * @param {FlushedChunksProps} props - The properties of the component.
7
+ * @param {string[]} props.chunks - The chunks to be flushed.
8
+ * @returns {React.ReactElement} The created script and link elements.
9
+ */
10
+ export declare const FlushedChunks: ({ chunks }: FlushedChunksProps) => React.FunctionComponentElement<{
11
+ children?: React.ReactNode | undefined;
12
+ }>;
13
+ /**
14
+ * FlushedChunksProps interface.
15
+ * This interface represents the properties of the FlushedChunks component.
16
+ *
17
+ * @interface
18
+ * @property {string[]} chunks - The chunks to be flushed.
19
+ */
20
+ export interface FlushedChunksProps {
21
+ chunks: string[];
22
+ }
@@ -1,77 +1,37 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.FlushedChunks = void 0;
37
- const React = __importStar(require("react"));
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
+ let react = require("react");
3
+ react = require_runtime.__toESM(react);
4
+
5
+ //#region utils/flushedChunks.ts
38
6
  /**
39
- * FlushedChunks component.
40
- * This component creates script and link elements for each chunk.
41
- *
42
- * @param {FlushedChunksProps} props - The properties of the component.
43
- * @param {string[]} props.chunks - The chunks to be flushed.
44
- * @returns {React.ReactElement} The created script and link elements.
45
- */
7
+ * FlushedChunks component.
8
+ * This component creates script and link elements for each chunk.
9
+ *
10
+ * @param {FlushedChunksProps} props - The properties of the component.
11
+ * @param {string[]} props.chunks - The chunks to be flushed.
12
+ * @returns {React.ReactElement} The created script and link elements.
13
+ */
46
14
  const FlushedChunks = ({ chunks = [] }) => {
47
- const scripts = chunks
48
- .filter((c) => {
49
- // TODO: host shouldnt flush its own remote out
50
- // if(c.includes('?')) {
51
- // return c.split('?')[0].endsWith('.js')
52
- // }
53
- return c.endsWith('.js');
54
- })
55
- .map((chunk) => {
56
- if (!chunk.includes('?') && chunk.includes('remoteEntry')) {
57
- chunk = chunk + '?t=' + Date.now();
58
- }
59
- return React.createElement('script', {
60
- key: chunk,
61
- src: chunk,
62
- async: true,
63
- }, null);
64
- });
65
- const css = chunks
66
- .filter((c) => c.endsWith('.css'))
67
- .map((chunk) => {
68
- return React.createElement('link', {
69
- key: chunk,
70
- href: chunk,
71
- rel: 'stylesheet',
72
- }, null);
73
- });
74
- return React.createElement(React.Fragment, null, css, scripts);
15
+ const scripts = chunks.filter((c) => {
16
+ return c.endsWith(".js");
17
+ }).map((chunk) => {
18
+ if (!chunk.includes("?") && chunk.includes("remoteEntry")) chunk = chunk + "?t=" + Date.now();
19
+ return react.createElement("script", {
20
+ key: chunk,
21
+ src: chunk,
22
+ async: true
23
+ }, null);
24
+ });
25
+ const css = chunks.filter((c) => c.endsWith(".css")).map((chunk) => {
26
+ return react.createElement("link", {
27
+ key: chunk,
28
+ href: chunk,
29
+ rel: "stylesheet"
30
+ }, null);
31
+ });
32
+ return react.createElement(react.Fragment, null, css, scripts);
75
33
  };
34
+
35
+ //#endregion
76
36
  exports.FlushedChunks = FlushedChunks;
77
37
  //# sourceMappingURL=flushedChunks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flushedChunks.js","sourceRoot":"","sources":["../../utils/flushedChunks.ts"],"names":[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a,iBAuCxB"}
1
+ {"version":3,"file":"flushedChunks.js","names":["React"],"sources":["../../utils/flushedChunks.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * FlushedChunks component.\n * This component creates script and link elements for each chunk.\n *\n * @param {FlushedChunksProps} props - The properties of the component.\n * @param {string[]} props.chunks - The chunks to be flushed.\n * @returns {React.ReactElement} The created script and link elements.\n */\nexport const FlushedChunks = ({ chunks = [] }: FlushedChunksProps) => {\n const scripts = chunks\n .filter((c) => {\n // TODO: host shouldnt flush its own remote out\n // if(c.includes('?')) {\n // return c.split('?')[0].endsWith('.js')\n // }\n return c.endsWith('.js');\n })\n .map((chunk) => {\n if (!chunk.includes('?') && chunk.includes('remoteEntry')) {\n chunk = chunk + '?t=' + Date.now();\n }\n return React.createElement(\n 'script',\n {\n key: chunk,\n src: chunk,\n async: true,\n },\n null,\n );\n });\n\n const css = chunks\n .filter((c) => c.endsWith('.css'))\n .map((chunk) => {\n return React.createElement(\n 'link',\n {\n key: chunk,\n href: chunk,\n rel: 'stylesheet',\n },\n null,\n );\n });\n\n return React.createElement(React.Fragment, null, css, scripts);\n};\n\n/**\n * FlushedChunksProps interface.\n * This interface represents the properties of the FlushedChunks component.\n *\n * @interface\n * @property {string[]} chunks - The chunks to be flushed.\n */\nexport interface FlushedChunksProps {\n chunks: string[];\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAa,iBAAiB,EAAE,SAAS,EAAE,OAA2B;CACpE,MAAM,UAAU,OACb,QAAQ,MAAM;AAKb,SAAO,EAAE,SAAS,MAAM;GACxB,CACD,KAAK,UAAU;AACd,MAAI,CAAC,MAAM,SAAS,IAAI,IAAI,MAAM,SAAS,cAAc,CACvD,SAAQ,QAAQ,QAAQ,KAAK,KAAK;AAEpC,SAAOA,MAAM,cACX,UACA;GACE,KAAK;GACL,KAAK;GACL,OAAO;GACR,EACD,KACD;GACD;CAEJ,MAAM,MAAM,OACT,QAAQ,MAAM,EAAE,SAAS,OAAO,CAAC,CACjC,KAAK,UAAU;AACd,SAAOA,MAAM,cACX,QACA;GACE,KAAK;GACL,MAAM;GACN,KAAK;GACN,EACD,KACD;GACD;AAEJ,QAAOA,MAAM,cAAcA,MAAM,UAAU,MAAM,KAAK,QAAQ"}
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+
3
+ //#region utils/flushedChunks.ts
4
+ /**
5
+ * FlushedChunks component.
6
+ * This component creates script and link elements for each chunk.
7
+ *
8
+ * @param {FlushedChunksProps} props - The properties of the component.
9
+ * @param {string[]} props.chunks - The chunks to be flushed.
10
+ * @returns {React.ReactElement} The created script and link elements.
11
+ */
12
+ const FlushedChunks = ({ chunks = [] }) => {
13
+ const scripts = chunks.filter((c) => {
14
+ return c.endsWith(".js");
15
+ }).map((chunk) => {
16
+ if (!chunk.includes("?") && chunk.includes("remoteEntry")) chunk = chunk + "?t=" + Date.now();
17
+ return React.createElement("script", {
18
+ key: chunk,
19
+ src: chunk,
20
+ async: true
21
+ }, null);
22
+ });
23
+ const css = chunks.filter((c) => c.endsWith(".css")).map((chunk) => {
24
+ return React.createElement("link", {
25
+ key: chunk,
26
+ href: chunk,
27
+ rel: "stylesheet"
28
+ }, null);
29
+ });
30
+ return React.createElement(React.Fragment, null, css, scripts);
31
+ };
32
+
33
+ //#endregion
34
+ export { FlushedChunks };
35
+ //# sourceMappingURL=flushedChunks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flushedChunks.mjs","names":[],"sources":["../../utils/flushedChunks.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * FlushedChunks component.\n * This component creates script and link elements for each chunk.\n *\n * @param {FlushedChunksProps} props - The properties of the component.\n * @param {string[]} props.chunks - The chunks to be flushed.\n * @returns {React.ReactElement} The created script and link elements.\n */\nexport const FlushedChunks = ({ chunks = [] }: FlushedChunksProps) => {\n const scripts = chunks\n .filter((c) => {\n // TODO: host shouldnt flush its own remote out\n // if(c.includes('?')) {\n // return c.split('?')[0].endsWith('.js')\n // }\n return c.endsWith('.js');\n })\n .map((chunk) => {\n if (!chunk.includes('?') && chunk.includes('remoteEntry')) {\n chunk = chunk + '?t=' + Date.now();\n }\n return React.createElement(\n 'script',\n {\n key: chunk,\n src: chunk,\n async: true,\n },\n null,\n );\n });\n\n const css = chunks\n .filter((c) => c.endsWith('.css'))\n .map((chunk) => {\n return React.createElement(\n 'link',\n {\n key: chunk,\n href: chunk,\n rel: 'stylesheet',\n },\n null,\n );\n });\n\n return React.createElement(React.Fragment, null, css, scripts);\n};\n\n/**\n * FlushedChunksProps interface.\n * This interface represents the properties of the FlushedChunks component.\n *\n * @interface\n * @property {string[]} chunks - The chunks to be flushed.\n */\nexport interface FlushedChunksProps {\n chunks: string[];\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,iBAAiB,EAAE,SAAS,EAAE,OAA2B;CACpE,MAAM,UAAU,OACb,QAAQ,MAAM;AAKb,SAAO,EAAE,SAAS,MAAM;GACxB,CACD,KAAK,UAAU;AACd,MAAI,CAAC,MAAM,SAAS,IAAI,IAAI,MAAM,SAAS,cAAc,CACvD,SAAQ,QAAQ,QAAQ,KAAK,KAAK;AAEpC,SAAO,MAAM,cACX,UACA;GACE,KAAK;GACL,KAAK;GACL,OAAO;GACR,EACD,KACD;GACD;CAEJ,MAAM,MAAM,OACT,QAAQ,MAAM,EAAE,SAAS,OAAO,CAAC,CACjC,KAAK,UAAU;AACd,SAAO,MAAM,cACX,QACA;GACE,KAAK;GACL,MAAM;GACN,KAAK;GACN,EACD,KACD;GACD;AAEJ,QAAO,MAAM,cAAc,MAAM,UAAU,MAAM,KAAK,QAAQ"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Flushes chunks from the module federation node utilities.
3
+ * @module @module-federation/node/utils
4
+ */
5
+ export { flushChunks } from '@module-federation/node/utils';
6
+ /**
7
+ * Exports the FlushedChunks component from the current directory.
8
+ */
9
+ export { FlushedChunks } from './flushedChunks';
10
+ /**
11
+ * Exports the FlushedChunksProps type from the current directory.
12
+ */
13
+ export type { FlushedChunksProps } from './flushedChunks';
14
+ /**
15
+ * Revalidates the current state.
16
+ * If the function is called on the client side, it logs an error and returns a resolved promise with false.
17
+ * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.
18
+ * @returns {Promise<boolean>} A promise that resolves with a boolean.
19
+ */
20
+ export declare const revalidate: (fetchModule?: any, force?: boolean) => Promise<boolean>;
@@ -1,66 +1,31 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.revalidate = exports.FlushedChunks = exports.flushChunks = void 0;
37
- /**
38
- * Flushes chunks from the module federation node utilities.
39
- * @module @module-federation/node/utils
40
- */
41
- var utils_1 = require("@module-federation/node/utils");
42
- Object.defineProperty(exports, "flushChunks", { enumerable: true, get: function () { return utils_1.flushChunks; } });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.js');
3
+ const require_flushedChunks = require('./flushedChunks.js');
4
+ let _module_federation_node_utils = require("@module-federation/node/utils");
5
+
6
+ //#region utils/index.ts
43
7
  /**
44
- * Exports the FlushedChunks component from the current directory.
45
- */
46
- var flushedChunks_1 = require("./flushedChunks");
47
- Object.defineProperty(exports, "FlushedChunks", { enumerable: true, get: function () { return flushedChunks_1.FlushedChunks; } });
48
- /**
49
- * Revalidates the current state.
50
- * If the function is called on the client side, it logs an error and returns a resolved promise with false.
51
- * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.
52
- * @returns {Promise<boolean>} A promise that resolves with a boolean.
53
- */
54
- const revalidate = function (fetchModule = undefined, force = false) {
55
- if (typeof window !== 'undefined') {
56
- console.error('revalidate should only be called server-side');
57
- return Promise.resolve(false);
58
- }
59
- else {
60
- return Promise.resolve().then(() => __importStar(require('@module-federation/node/utils'))).then(function (utils) {
61
- return utils.revalidate(fetchModule, force);
62
- });
63
- }
8
+ * Revalidates the current state.
9
+ * If the function is called on the client side, it logs an error and returns a resolved promise with false.
10
+ * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.
11
+ * @returns {Promise<boolean>} A promise that resolves with a boolean.
12
+ */
13
+ const revalidate = function(fetchModule = void 0, force = false) {
14
+ if (typeof window !== "undefined") {
15
+ console.error("revalidate should only be called server-side");
16
+ return Promise.resolve(false);
17
+ } else return import("@module-federation/node/utils").then(function(utils) {
18
+ return utils.revalidate(fetchModule, force);
19
+ });
64
20
  };
21
+
22
+ //#endregion
23
+ exports.FlushedChunks = require_flushedChunks.FlushedChunks;
24
+ Object.defineProperty(exports, 'flushChunks', {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _module_federation_node_utils.flushChunks;
28
+ }
29
+ });
65
30
  exports.revalidate = revalidate;
66
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,uDAA4D;AAAnD,oGAAA,WAAW,OAAA;AAEpB;;GAEG;AACH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAOtB;;;;;GAKG;AACI,MAAM,UAAU,GAAG,UACxB,cAAmB,SAAS,EAC5B,KAAK,GAAG,KAAK;IAEb,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,kDAAO,+BAA+B,IAAE,IAAI,CAAC,UAAU,KAAK;YACjE,OAAO,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../utils/index.ts"],"sourcesContent":["/**\n * Flushes chunks from the module federation node utilities.\n * @module @module-federation/node/utils\n */\nexport { flushChunks } from '@module-federation/node/utils';\n\n/**\n * Exports the FlushedChunks component from the current directory.\n */\nexport { FlushedChunks } from './flushedChunks';\n\n/**\n * Exports the FlushedChunksProps type from the current directory.\n */\nexport type { FlushedChunksProps } from './flushedChunks';\n\n/**\n * Revalidates the current state.\n * If the function is called on the client side, it logs an error and returns a resolved promise with false.\n * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.\n * @returns {Promise<boolean>} A promise that resolves with a boolean.\n */\nexport const revalidate = function (\n fetchModule: any = undefined,\n force = false,\n): Promise<boolean> {\n if (typeof window !== 'undefined') {\n console.error('revalidate should only be called server-side');\n return Promise.resolve(false);\n } else {\n return import('@module-federation/node/utils').then(function (utils) {\n return utils.revalidate(fetchModule, force);\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,aAAa,SACxB,cAAmB,QACnB,QAAQ,OACU;AAClB,KAAI,OAAO,WAAW,aAAa;AACjC,UAAQ,MAAM,+CAA+C;AAC7D,SAAO,QAAQ,QAAQ,MAAM;OAE7B,QAAO,OAAO,iCAAiC,KAAK,SAAU,OAAO;AACnE,SAAO,MAAM,WAAW,aAAa,MAAM;GAC3C"}
@@ -0,0 +1,22 @@
1
+ import { FlushedChunks } from "./flushedChunks.mjs";
2
+ import { flushChunks } from "@module-federation/node/utils";
3
+
4
+ //#region utils/index.ts
5
+ /**
6
+ * Revalidates the current state.
7
+ * If the function is called on the client side, it logs an error and returns a resolved promise with false.
8
+ * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.
9
+ * @returns {Promise<boolean>} A promise that resolves with a boolean.
10
+ */
11
+ const revalidate = function(fetchModule = void 0, force = false) {
12
+ if (typeof window !== "undefined") {
13
+ console.error("revalidate should only be called server-side");
14
+ return Promise.resolve(false);
15
+ } else return import("@module-federation/node/utils").then(function(utils) {
16
+ return utils.revalidate(fetchModule, force);
17
+ });
18
+ };
19
+
20
+ //#endregion
21
+ export { FlushedChunks, flushChunks, revalidate };
22
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../utils/index.ts"],"sourcesContent":["/**\n * Flushes chunks from the module federation node utilities.\n * @module @module-federation/node/utils\n */\nexport { flushChunks } from '@module-federation/node/utils';\n\n/**\n * Exports the FlushedChunks component from the current directory.\n */\nexport { FlushedChunks } from './flushedChunks';\n\n/**\n * Exports the FlushedChunksProps type from the current directory.\n */\nexport type { FlushedChunksProps } from './flushedChunks';\n\n/**\n * Revalidates the current state.\n * If the function is called on the client side, it logs an error and returns a resolved promise with false.\n * If the function is called on the server side, it imports the revalidate function from the module federation node utilities and returns the result of calling that function.\n * @returns {Promise<boolean>} A promise that resolves with a boolean.\n */\nexport const revalidate = function (\n fetchModule: any = undefined,\n force = false,\n): Promise<boolean> {\n if (typeof window !== 'undefined') {\n console.error('revalidate should only be called server-side');\n return Promise.resolve(false);\n } else {\n return import('@module-federation/node/utils').then(function (utils) {\n return utils.revalidate(fetchModule, force);\n });\n }\n};\n"],"mappings":";;;;;;;;;;AAsBA,MAAa,aAAa,SACxB,cAAmB,QACnB,QAAQ,OACU;AAClB,KAAI,OAAO,WAAW,aAAa;AACjC,UAAQ,MAAM,+CAA+C;AAC7D,SAAO,QAAQ,QAAQ,MAAM;OAE7B,QAAO,OAAO,iCAAiC,KAAK,SAAU,OAAO;AACnE,SAAO,MAAM,WAAW,aAAa,MAAM;GAC3C"}