@module-federation/nextjs-mf 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +5 -0
- 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.js +92 -0
- package/dist/client/UrlNode.js.map +1 -0
- package/dist/client/UrlNode.mjs +91 -0
- package/dist/client/UrlNode.mjs.map +1 -0
- package/dist/src/federation-noop.d.mts +1 -0
- package/dist/src/federation-noop.d.ts +1 -0
- package/dist/src/federation-noop.js +17 -0
- package/dist/src/federation-noop.js.map +1 -0
- package/dist/src/federation-noop.mjs +23 -0
- package/dist/src/federation-noop.mjs.map +1 -0
- package/dist/src/index.d.mts +2 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.mjs +8 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/internal.js +152 -0
- package/dist/src/internal.js.map +1 -0
- package/dist/src/internal.mjs +152 -0
- package/dist/src/internal.mjs.map +1 -0
- package/dist/src/loaders/fixImageLoader.d.mts +27 -0
- package/dist/src/loaders/fixImageLoader.d.ts +27 -0
- package/dist/src/loaders/fixImageLoader.js +104 -0
- package/dist/src/loaders/fixImageLoader.js.map +1 -0
- package/dist/src/loaders/fixImageLoader.mjs +101 -0
- package/dist/src/loaders/fixImageLoader.mjs.map +1 -0
- package/dist/src/loaders/fixUrlLoader.d.mts +16 -0
- package/dist/src/loaders/fixUrlLoader.d.ts +16 -0
- package/dist/src/loaders/fixUrlLoader.js +22 -0
- package/dist/src/loaders/fixUrlLoader.js.map +1 -0
- package/dist/src/loaders/fixUrlLoader.mjs +19 -0
- package/dist/src/loaders/fixUrlLoader.mjs.map +1 -0
- package/dist/src/loaders/helpers.js +82 -0
- package/dist/src/loaders/helpers.js.map +1 -0
- package/dist/src/loaders/helpers.mjs +79 -0
- package/dist/src/loaders/helpers.mjs.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.d.mts +29 -0
- package/dist/src/loaders/nextPageMapLoader.d.ts +29 -0
- package/dist/src/loaders/nextPageMapLoader.js +148 -0
- package/dist/src/loaders/nextPageMapLoader.js.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.mjs +143 -0
- package/dist/src/loaders/nextPageMapLoader.mjs.map +1 -0
- package/dist/src/logger.js +9 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/logger.mjs +8 -0
- package/dist/src/logger.mjs.map +1 -0
- package/dist/src/plugins/CopyFederationPlugin.js +67 -0
- package/dist/src/plugins/CopyFederationPlugin.js.map +1 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs +65 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +41 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs +40 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +117 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -0
- 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 +31 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.ts +31 -0
- package/dist/src/plugins/NextFederationPlugin/index.js +156 -0
- package/dist/src/plugins/NextFederationPlugin/index.js.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs +153 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.mts +18 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.ts +18 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js +65 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -0
- 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/set-options.js +20 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.js.map +1 -0
- 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.js +37 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +1 -0
- 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.js +26 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.js.map +1 -0
- 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.js +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/container/runtimePlugin.d.mts +7 -0
- package/dist/src/plugins/container/runtimePlugin.d.ts +6 -0
- package/dist/src/plugins/container/runtimePlugin.js +168 -0
- package/dist/src/plugins/container/runtimePlugin.js.map +1 -0
- package/dist/src/plugins/container/runtimePlugin.mjs +167 -0
- package/dist/src/plugins/container/runtimePlugin.mjs.map +1 -0
- package/dist/utils/flushedChunks.d.mts +29 -0
- package/dist/utils/flushedChunks.d.ts +29 -0
- package/dist/utils/flushedChunks.js +37 -0
- package/dist/utils/flushedChunks.js.map +1 -0
- package/dist/utils/flushedChunks.mjs +35 -0
- package/dist/utils/flushedChunks.mjs.map +1 -0
- package/dist/utils/index.d.mts +14 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +22 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { matchRemoteWithNameAndExpose } from "@module-federation/runtime-core";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/container/runtimePlugin.ts
|
|
4
|
+
function runtimePlugin_default() {
|
|
5
|
+
return {
|
|
6
|
+
name: "next-internal-plugin",
|
|
7
|
+
createScript: function(args) {
|
|
8
|
+
const url = args.url;
|
|
9
|
+
const attrs = args.attrs;
|
|
10
|
+
if (typeof window !== "undefined") {
|
|
11
|
+
const script = document.createElement("script");
|
|
12
|
+
script.src = url;
|
|
13
|
+
script.async = true;
|
|
14
|
+
delete attrs?.["crossorigin"];
|
|
15
|
+
return {
|
|
16
|
+
script,
|
|
17
|
+
timeout: 8e3
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
errorLoadRemote: function(args) {
|
|
22
|
+
const id = args.id;
|
|
23
|
+
const error = args.error;
|
|
24
|
+
const from = args.from;
|
|
25
|
+
globalThis.moduleGraphDirty = true;
|
|
26
|
+
console.error(id, "offline");
|
|
27
|
+
const pg = function() {
|
|
28
|
+
console.error(id, "offline", error);
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
pg.getInitialProps = function(ctx) {
|
|
32
|
+
return {};
|
|
33
|
+
};
|
|
34
|
+
let mod;
|
|
35
|
+
if (from === "build") mod = function() {
|
|
36
|
+
return {
|
|
37
|
+
__esModule: true,
|
|
38
|
+
default: pg,
|
|
39
|
+
getServerSideProps: function() {
|
|
40
|
+
return { props: {} };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
else mod = {
|
|
45
|
+
default: pg,
|
|
46
|
+
getServerSideProps: function() {
|
|
47
|
+
return { props: {} };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return mod;
|
|
51
|
+
},
|
|
52
|
+
beforeInit: function(args) {
|
|
53
|
+
if (!globalThis.usedChunks) globalThis.usedChunks = /* @__PURE__ */ new Set();
|
|
54
|
+
if (typeof __webpack_runtime_id__ === "string" && !__webpack_runtime_id__.startsWith("webpack")) return args;
|
|
55
|
+
const moduleCache = args.origin.moduleCache;
|
|
56
|
+
const name = args.origin.name;
|
|
57
|
+
let gs;
|
|
58
|
+
try {
|
|
59
|
+
gs = new Function("return globalThis")();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
gs = globalThis;
|
|
62
|
+
}
|
|
63
|
+
const attachedRemote = gs[name];
|
|
64
|
+
if (attachedRemote) moduleCache.set(name, attachedRemote);
|
|
65
|
+
return args;
|
|
66
|
+
},
|
|
67
|
+
init: function(args) {
|
|
68
|
+
return args;
|
|
69
|
+
},
|
|
70
|
+
beforeRequest: function(args) {
|
|
71
|
+
const options = args.options;
|
|
72
|
+
const id = args.id;
|
|
73
|
+
const match = matchRemoteWithNameAndExpose(options.remotes, id);
|
|
74
|
+
if (!match) return args;
|
|
75
|
+
const remote = match.remote;
|
|
76
|
+
if (!("entry" in remote) || !remote.entry || /[?&]t=/.test(remote.entry)) return args;
|
|
77
|
+
remote.entry = remote.entry + (remote.entry.includes("?") ? "&" : "?") + "t=" + Date.now();
|
|
78
|
+
return args;
|
|
79
|
+
},
|
|
80
|
+
afterResolve: function(args) {
|
|
81
|
+
return args;
|
|
82
|
+
},
|
|
83
|
+
onLoad: function(args) {
|
|
84
|
+
const exposeModuleFactory = args.exposeModuleFactory;
|
|
85
|
+
const exposeModule = args.exposeModule;
|
|
86
|
+
const id = args.id;
|
|
87
|
+
const moduleOrFactory = exposeModuleFactory || exposeModule;
|
|
88
|
+
if (!moduleOrFactory) return args;
|
|
89
|
+
if (typeof window === "undefined") {
|
|
90
|
+
let exposedModuleExports;
|
|
91
|
+
try {
|
|
92
|
+
exposedModuleExports = moduleOrFactory();
|
|
93
|
+
} catch (e) {
|
|
94
|
+
exposedModuleExports = moduleOrFactory;
|
|
95
|
+
}
|
|
96
|
+
const handler = { get: function(target, prop, receiver) {
|
|
97
|
+
if (target === exposedModuleExports && typeof exposedModuleExports[prop] === "function") return function() {
|
|
98
|
+
globalThis.usedChunks.add(id);
|
|
99
|
+
return exposedModuleExports[prop].apply(this, arguments);
|
|
100
|
+
};
|
|
101
|
+
const originalMethod = target[prop];
|
|
102
|
+
if (typeof originalMethod === "function") {
|
|
103
|
+
const proxiedFunction = function() {
|
|
104
|
+
globalThis.usedChunks.add(id);
|
|
105
|
+
return originalMethod.apply(this, arguments);
|
|
106
|
+
};
|
|
107
|
+
Object.keys(originalMethod).forEach(function(prop) {
|
|
108
|
+
Object.defineProperty(proxiedFunction, prop, {
|
|
109
|
+
value: originalMethod[prop],
|
|
110
|
+
writable: true,
|
|
111
|
+
enumerable: true,
|
|
112
|
+
configurable: true
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
return proxiedFunction;
|
|
116
|
+
}
|
|
117
|
+
return Reflect.get(target, prop, receiver);
|
|
118
|
+
} };
|
|
119
|
+
if (typeof exposedModuleExports === "function") {
|
|
120
|
+
exposedModuleExports = new Proxy(exposedModuleExports, handler);
|
|
121
|
+
Object.getOwnPropertyNames(exposedModuleExports).forEach(function(prop) {
|
|
122
|
+
if (typeof exposedModuleExports[prop] === "function") exposedModuleExports[prop] = new Proxy(exposedModuleExports[prop], handler);
|
|
123
|
+
});
|
|
124
|
+
return function() {
|
|
125
|
+
return exposedModuleExports;
|
|
126
|
+
};
|
|
127
|
+
} else exposedModuleExports = new Proxy(exposedModuleExports, handler);
|
|
128
|
+
return exposedModuleExports;
|
|
129
|
+
}
|
|
130
|
+
return args;
|
|
131
|
+
},
|
|
132
|
+
loadRemoteSnapshot(args) {
|
|
133
|
+
const { from, remoteSnapshot, manifestUrl, manifestJson, options } = args;
|
|
134
|
+
if (from !== "manifest" || !manifestUrl || !manifestJson || !("publicPath" in remoteSnapshot)) return args;
|
|
135
|
+
const { publicPath } = remoteSnapshot;
|
|
136
|
+
if (options.inBrowser && publicPath.includes("/_next/")) remoteSnapshot.publicPath = publicPath.substring(0, publicPath.lastIndexOf("/_next/") + 7);
|
|
137
|
+
else remoteSnapshot.publicPath = manifestUrl.substring(0, manifestUrl.indexOf("mf-manifest.json"));
|
|
138
|
+
if ("publicPath" in manifestJson.metaData) manifestJson.metaData.publicPath = remoteSnapshot.publicPath;
|
|
139
|
+
return args;
|
|
140
|
+
},
|
|
141
|
+
resolveShare: function(args) {
|
|
142
|
+
if (args.pkgName !== "react" && args.pkgName !== "react-dom" && !args.pkgName.startsWith("next/")) return args;
|
|
143
|
+
const shareScopeMap = args.shareScopeMap;
|
|
144
|
+
const scope = args.scope;
|
|
145
|
+
const pkgName = args.pkgName;
|
|
146
|
+
const version = args.version;
|
|
147
|
+
const host = args.GlobalFederation["__INSTANCES__"][0];
|
|
148
|
+
if (!host) return args;
|
|
149
|
+
if (!host.options.shared[pkgName]) return args;
|
|
150
|
+
args.resolver = function() {
|
|
151
|
+
shareScopeMap[scope][pkgName][version] = host.options.shared[pkgName][0];
|
|
152
|
+
return {
|
|
153
|
+
shared: shareScopeMap[scope][pkgName][version],
|
|
154
|
+
useTreesShaking: false
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
return args;
|
|
158
|
+
},
|
|
159
|
+
beforeLoadShare: async function(args) {
|
|
160
|
+
return args;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//#endregion
|
|
166
|
+
export { runtimePlugin_default as default };
|
|
167
|
+
//# 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\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: 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 const handler: ProxyHandler<any> = {\n get: function (target, prop, receiver) {\n if (\n target === exposedModuleExports &&\n typeof exposedModuleExports[prop] === 'function'\n ) {\n return function (this: unknown) {\n globalThis.usedChunks.add(id);\n //eslint-disable-next-line\n return exposedModuleExports[prop].apply(this, arguments);\n };\n }\n\n const originalMethod = target[prop];\n if (typeof originalMethod === 'function') {\n const proxiedFunction = function (this: unknown) {\n globalThis.usedChunks.add(id);\n //eslint-disable-next-line\n return originalMethod.apply(this, arguments);\n };\n\n Object.keys(originalMethod).forEach(function (prop) {\n Object.defineProperty(proxiedFunction, prop, {\n value: originalMethod[prop],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n });\n\n return proxiedFunction;\n }\n\n return Reflect.get(target, prop, receiver);\n },\n };\n\n if (typeof exposedModuleExports === 'function') {\n exposedModuleExports = new Proxy(exposedModuleExports, handler);\n\n const staticProps = Object.getOwnPropertyNames(exposedModuleExports);\n staticProps.forEach(function (prop) {\n if (typeof exposedModuleExports[prop] === 'function') {\n exposedModuleExports[prop] = new Proxy(\n exposedModuleExports[prop],\n handler,\n );\n }\n });\n return function () {\n return exposedModuleExports;\n };\n } else {\n exposedModuleExports = new Proxy(exposedModuleExports, handler);\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,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;;AAGT,GAAC,GAAW,kBAAkB,SAAU,KAAU;AAChD,WAAO,EAAE;;GAEX,IAAI;AACJ,OAAI,SAAS,QACX,OAAM,WAAY;AAChB,WAAO;KACL,YAAY;KACZ,SAAS;KACT,oBAAoB,WAAY;AAC9B,aAAO,EAAE,OAAO,EAAE,EAAE;;KAEvB;;OAGH,OAAM;IACJ,SAAS;IACT,oBAAoB,WAAY;AAC9B,YAAO,EAAE,OAAO,EAAE,EAAE;;IAEvB;AAGH,UAAO;;EAET,YAAY,SAAU,MAAM;AAC1B,OAAI,CAAC,WAAW,WAAY,YAAW,6BAAa,IAAI,KAAK;AAC7D,OACE,OAAO,2BAA2B,YAClC,CAAC,uBAAuB,WAAW,UAAU,CAE7C,QAAO;GAGT,MAAM,cAAc,KAAK,OAAO;GAChC,MAAM,OAAO,KAAK,OAAO;GACzB,IAAI;AACJ,OAAI;AACF,SAAK,IAAI,SAAS,oBAAoB,EAAE;YACjC,GAAG;AACV,SAAK;;GAGP,MAAM,iBAAiB,GAAG;AAC1B,OAAI,eACF,aAAY,IAAI,MAAM,eAAe;AAGvC,UAAO;;EAET,MAAM,SAAU,MAAW;AACzB,UAAO;;EAET,eAAe,SAAU,MAAW;GAClC,MAAM,UAAU,KAAK;GACrB,MAAM,KAAK,KAAK;GAChB,MAAM,QAAQ,6BAA6B,QAAQ,SAAS,GAAG;AAC/D,OAAI,CAAC,MAAO,QAAO;GACnB,MAAM,SAAS,MAAM;AACrB,OACE,EAAE,WAAW,WACb,CAAC,OAAO,SACR,SAAS,KAAK,OAAO,MAAM,CAE3B,QAAO;AAET,UAAO,QACL,OAAO,SACN,OAAO,MAAM,SAAS,IAAI,GAAG,MAAM,OACpC,OACA,KAAK,KAAK;AACZ,UAAO;;EAET,cAAc,SAAU,MAAW;AACjC,UAAO;;EAET,QAAQ,SAAU,MAAW;GAC3B,MAAM,sBAAsB,KAAK;GACjC,MAAM,eAAe,KAAK;GAC1B,MAAM,KAAK,KAAK;GAChB,MAAM,kBAAkB,uBAAuB;AAC/C,OAAI,CAAC,gBAAiB,QAAO;AAE7B,OAAI,OAAO,WAAW,aAAa;IACjC,IAAI;AACJ,QAAI;AACF,4BAAuB,iBAAiB;aACjC,GAAG;AACV,4BAAuB;;IAGzB,MAAM,UAA6B,EACjC,KAAK,SAAU,QAAQ,MAAM,UAAU;AACrC,SACE,WAAW,wBACX,OAAO,qBAAqB,UAAU,WAEtC,QAAO,WAAyB;AAC9B,iBAAW,WAAW,IAAI,GAAG;AAE7B,aAAO,qBAAqB,MAAM,MAAM,MAAM,UAAU;;KAI5D,MAAM,iBAAiB,OAAO;AAC9B,SAAI,OAAO,mBAAmB,YAAY;MACxC,MAAM,kBAAkB,WAAyB;AAC/C,kBAAW,WAAW,IAAI,GAAG;AAE7B,cAAO,eAAe,MAAM,MAAM,UAAU;;AAG9C,aAAO,KAAK,eAAe,CAAC,QAAQ,SAAU,MAAM;AAClD,cAAO,eAAe,iBAAiB,MAAM;QAC3C,OAAO,eAAe;QACtB,UAAU;QACV,YAAY;QACZ,cAAc;QACf,CAAC;QACF;AAEF,aAAO;;AAGT,YAAO,QAAQ,IAAI,QAAQ,MAAM,SAAS;OAE7C;AAED,QAAI,OAAO,yBAAyB,YAAY;AAC9C,4BAAuB,IAAI,MAAM,sBAAsB,QAAQ;AAG/D,KADoB,OAAO,oBAAoB,qBAAqB,CACxD,QAAQ,SAAU,MAAM;AAClC,UAAI,OAAO,qBAAqB,UAAU,WACxC,sBAAqB,QAAQ,IAAI,MAC/B,qBAAqB,OACrB,QACD;OAEH;AACF,YAAO,WAAY;AACjB,aAAO;;UAGT,wBAAuB,IAAI,MAAM,sBAAsB,QAAQ;AAGjE,WAAO;;AAGT,UAAO;;EAET,mBAAmB,MAAM;GACvB,MAAM,EAAE,MAAM,gBAAgB,aAAa,cAAc,YAAY;AAGrE,OACE,SAAS,cACT,CAAC,eACD,CAAC,gBACD,EAAE,gBAAgB,gBAElB,QAAO;GAIT,MAAM,EAAE,eAAe;AACvB,OAAI,QAAQ,aAAa,WAAW,SAAS,UAAU,CACrD,gBAAe,aAAa,WAAW,UACrC,GACA,WAAW,YAAY,UAAU,GAAG,EACrC;OAMD,gBAAe,aAJU,YAAY,UACnC,GACA,YAAY,QAAQ,mBAAmB,CACxC;AAIH,OAAI,gBAAgB,aAAa,SAC/B,cAAa,SAAS,aAAa,eAAe;AAGpD,UAAO;;EAET,cAAc,SAAU,MAAW;AACjC,OACE,KAAK,YAAY,WACjB,KAAK,YAAY,eACjB,CAAC,KAAK,QAAQ,WAAW,QAAQ,CAEjC,QAAO;GAET,MAAM,gBAAgB,KAAK;GAC3B,MAAM,QAAQ,KAAK;GACnB,MAAM,UAAU,KAAK;GACrB,MAAM,UAAU,KAAK;GAErB,MAAM,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,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region utils/flushedChunks.d.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
|
+
declare const FlushedChunks: ({
|
|
13
|
+
chunks
|
|
14
|
+
}: FlushedChunksProps) => React.FunctionComponentElement<{
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* FlushedChunksProps interface.
|
|
19
|
+
* This interface represents the properties of the FlushedChunks component.
|
|
20
|
+
*
|
|
21
|
+
* @interface
|
|
22
|
+
* @property {string[]} chunks - The chunks to be flushed.
|
|
23
|
+
*/
|
|
24
|
+
interface FlushedChunksProps {
|
|
25
|
+
chunks: string[];
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { FlushedChunks, FlushedChunksProps };
|
|
29
|
+
//# sourceMappingURL=flushedChunks.d.mts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region utils/flushedChunks.d.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
|
+
declare const FlushedChunks: ({
|
|
13
|
+
chunks
|
|
14
|
+
}: FlushedChunksProps) => React.FunctionComponentElement<{
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* FlushedChunksProps interface.
|
|
19
|
+
* This interface represents the properties of the FlushedChunks component.
|
|
20
|
+
*
|
|
21
|
+
* @interface
|
|
22
|
+
* @property {string[]} chunks - The chunks to be flushed.
|
|
23
|
+
*/
|
|
24
|
+
interface FlushedChunksProps {
|
|
25
|
+
chunks: string[];
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { FlushedChunks, FlushedChunksProps };
|
|
29
|
+
//# sourceMappingURL=flushedChunks.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
6
|
+
/**
|
|
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
|
+
*/
|
|
14
|
+
const FlushedChunks = ({ chunks = [] }) => {
|
|
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);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.FlushedChunks = FlushedChunks;
|
|
37
|
+
//# sourceMappingURL=flushedChunks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,14 @@
|
|
|
1
|
+
import { FlushedChunks, FlushedChunksProps } from "./flushedChunks.mjs";
|
|
2
|
+
import { flushChunks } from "@module-federation/node/utils";
|
|
3
|
+
|
|
4
|
+
//#region utils/index.d.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
|
+
declare const revalidate: (fetchModule?: any, force?: boolean) => Promise<boolean>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { FlushedChunks, type FlushedChunksProps, flushChunks, revalidate };
|
|
14
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlushedChunks, FlushedChunksProps } from "./flushedChunks.js";
|
|
2
|
+
import { flushChunks } from "@module-federation/node/utils";
|
|
3
|
+
|
|
4
|
+
//#region utils/index.d.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
|
+
declare const revalidate: (fetchModule?: any, force?: boolean) => Promise<boolean>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { FlushedChunks, type FlushedChunksProps, flushChunks, revalidate };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
7
|
+
/**
|
|
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
|
+
});
|
|
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
|
+
});
|
|
30
|
+
exports.revalidate = revalidate;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@module-federation/nextjs-mf",
|
|
3
|
+
"version": "0.0.0-chore-bump-node-22-20260710161714",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"module": "dist/src/index.mjs",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"description": "Module Federation helper for NextJS",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/module-federation/core.git",
|
|
13
|
+
"directory": "packages/nextjs-mf"
|
|
14
|
+
},
|
|
15
|
+
"author": "Zack Jackson <zackary.l.jackson@gmail.com>",
|
|
16
|
+
"contributors": [
|
|
17
|
+
"Pavel Chertorogov, nodkz <pavel.chertorogov@gmail.com> (www.ps.kz)"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/src/index.d.mts",
|
|
27
|
+
"default": "./dist/src/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/src/index.d.ts",
|
|
31
|
+
"default": "./dist/src/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./utils": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/utils/index.d.mts",
|
|
37
|
+
"default": "./dist/utils/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/utils/index.d.ts",
|
|
41
|
+
"default": "./dist/utils/index.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"./*": "./*"
|
|
45
|
+
},
|
|
46
|
+
"typesVersions": {
|
|
47
|
+
"*": {
|
|
48
|
+
".": [
|
|
49
|
+
"./dist/src/index.d.ts"
|
|
50
|
+
],
|
|
51
|
+
"utils": [
|
|
52
|
+
"./dist/utils/index.d.ts"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"fast-glob": "^3.2.11",
|
|
61
|
+
"@module-federation/runtime": "0.0.0-chore-bump-node-22-20260710161714",
|
|
62
|
+
"@module-federation/runtime-core": "0.0.0-chore-bump-node-22-20260710161714",
|
|
63
|
+
"@module-federation/enhanced": "0.0.0-chore-bump-node-22-20260710161714",
|
|
64
|
+
"@module-federation/node": "0.0.0-chore-bump-node-22-20260710161714",
|
|
65
|
+
"@module-federation/webpack-bundler-runtime": "0.0.0-chore-bump-node-22-20260710161714",
|
|
66
|
+
"@module-federation/sdk": "0.0.0-chore-bump-node-22-20260710161714"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@types/btoa": "^1.2.5",
|
|
70
|
+
"@types/react": "^18.3.1",
|
|
71
|
+
"@types/react-dom": "^18.3.1",
|
|
72
|
+
"tsdown": "0.20.3",
|
|
73
|
+
"typescript": "6.0.3"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"webpack": "^5.40.0",
|
|
77
|
+
"next": "^12 || ^13 || ^14 || ^15",
|
|
78
|
+
"react": "^17 || ^18 || ^19",
|
|
79
|
+
"react-dom": "^17 || ^18 || ^19",
|
|
80
|
+
"styled-jsx": "*"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"webpack": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"next": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"react": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"react-dom": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"styled-jsx": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"scripts": {
|
|
100
|
+
"postinstall": "echo \"Deprecation Notice: We intend to deprecate 'nextjs-mf'. Please see https://github.com/module-federation/core/issues/3153 for more details.\"",
|
|
101
|
+
"build": "tsdown --config tsdown.config.mts",
|
|
102
|
+
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.js\" \"**/*.ts\"",
|
|
103
|
+
"test": "pnpm exec jest --config jest.config.js --passWithNoTests",
|
|
104
|
+
"pre-release": "pnpm run test && pnpm run build && rm -f ./dist/package.json"
|
|
105
|
+
}
|
|
106
|
+
}
|