@module-federation/vite 1.23.1 → 1.23.3
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/README.md +51 -0
- package/lib/{dtsConstants-Bs4FukGL.js → dtsConstants-DSTzyKSG.js} +12 -3
- package/lib/index.d.ts +1 -260
- package/lib/index.js +629 -143
- package/lib/{logger--uKHOVjR.js → logger-DOwfTlw5.js} +1 -1
- package/lib/normalizeModuleFederationOptions-DNUlv-AL.d.ts +303 -0
- package/lib/{pluginDts-DxgS2FEd.js → pluginDts-CVyHPAEq.js} +3 -3
- package/lib/{ssrEntryLoader-DmqLXUmm.js → ssrEntryLoader-DjZj-5Lw.js} +61 -28
- package/lib/{ssrVmStrategy-B_e3yqa2.js → ssrVmStrategy-Dk5xXVvR.js} +15 -20
- package/lib/utils/ssrEntryLoader.d.ts +2 -59
- package/lib/utils/ssrEntryLoader.js +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,5 @@
|
|
|
1
|
+
import { i as SsrEntryLoaderConfig } from "../normalizeModuleFederationOptions-DNUlv-AL.js";
|
|
1
2
|
//#region src/utils/ssrEntryLoader.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* MF runtime plugin that intercepts the `loadEntry` lifecycle hook on the
|
|
4
|
-
* server and loads the SSR-compatible remote entry instead of the browser one.
|
|
5
|
-
*
|
|
6
|
-
* This completely replaces the need for any `@module-federation/sdk` patches.
|
|
7
|
-
* The `loadEntry` hook is emitted by `runtime-core` before it falls through to
|
|
8
|
-
* `loadScriptNode` — if the hook returns a value, the runtime uses it directly.
|
|
9
|
-
*
|
|
10
|
-
* Strategy:
|
|
11
|
-
* - In Node (detected through process.versions.node), fetch the remote's mf-manifest.json
|
|
12
|
-
* to discover the ssrRemoteEntry URL and its type.
|
|
13
|
-
* - ESM entry: use a dynamic `import()` — the SSR entry has no browser
|
|
14
|
-
* globals and all shared packages are external.
|
|
15
|
-
* - Dev mode (Vite 8+ only): use `ModuleRunner` with an HTTP transport backed
|
|
16
|
-
* by the remote's `/__mf_runner__` endpoint. This fetches fully-transformed
|
|
17
|
-
* module source through Vite's plugin pipeline, avoiding serialisation which
|
|
18
|
-
* cannot faithfully represent React components or closures.
|
|
19
|
-
*
|
|
20
|
-
* Dev mode on Vite < 8 is NOT supported by this integration because the
|
|
21
|
-
* cross-process `fetchModule` proxy uses Vite 8's environment APIs.
|
|
22
|
-
* `ModuleRunner` itself is available in earlier Vite versions, but an older
|
|
23
|
-
* remote needs a different transport and server endpoint.
|
|
24
|
-
*
|
|
25
|
-
* Exported as a plain factory function so it can be serialised into the
|
|
26
|
-
* generated runtimePlugins list in virtualRemotes.ts.
|
|
27
|
-
*/
|
|
28
3
|
interface RemoteInfo {
|
|
29
4
|
name: string;
|
|
30
5
|
entry: string;
|
|
@@ -63,7 +38,7 @@ declare function neutralizeBrowserPreloadHelpers(code: string): string;
|
|
|
63
38
|
*
|
|
64
39
|
* The plugin is also injected automatically for SSR contexts by the vite plugin.
|
|
65
40
|
*/
|
|
66
|
-
interface SsrEntryLoaderOptions {
|
|
41
|
+
interface SsrEntryLoaderOptions extends SsrEntryLoaderConfig {
|
|
67
42
|
/**
|
|
68
43
|
* Pre-resolved absolute file paths for common shared packages, keyed by
|
|
69
44
|
* bare specifier. Populated at build time by the Vite plugin from the MF
|
|
@@ -72,43 +47,11 @@ interface SsrEntryLoaderOptions {
|
|
|
72
47
|
* in remote SSR entry temp files — no runtime createRequire walk-up needed.
|
|
73
48
|
*/
|
|
74
49
|
resolvedShared?: Record<string, string>;
|
|
75
|
-
/**
|
|
76
|
-
* How to evaluate remote SSR entries on the server.
|
|
77
|
-
*
|
|
78
|
-
* - `'temp-file'` (default): fetch the ESM graph, rewrite specifiers, write
|
|
79
|
-
* temp files and `import()` them. Works on stock Node; shared packages are
|
|
80
|
-
* pinned to the host's copies via `resolvedShared` (no version negotiation).
|
|
81
|
-
* - `'vm'`: evaluate the graph with `vm.SourceTextModule` and link bare
|
|
82
|
-
* shared imports through the host's federation share scope (`loadShare`),
|
|
83
|
-
* restoring version negotiation. Requires `--experimental-vm-modules`;
|
|
84
|
-
* falls back to `'temp-file'` when unavailable.
|
|
85
|
-
*/
|
|
86
|
-
strategy?: 'temp-file' | 'vm';
|
|
87
50
|
/**
|
|
88
51
|
* Share scope consulted by the `'vm'` strategy when linking bare imports.
|
|
89
52
|
* Defaults to `'default'`.
|
|
90
53
|
*/
|
|
91
54
|
shareScopeName?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Re-check each remote's manifest when the cached SSR entry resolution is
|
|
94
|
-
* older than this many milliseconds. When the manifest's version changes
|
|
95
|
-
* (remote redeployed at the same URL), the loader drops its caches for that
|
|
96
|
-
* remote so subsequent loads use the new build. Omit to cache until process
|
|
97
|
-
* exit or an explicit `revalidate()` call. Only manifest-resolved entries
|
|
98
|
-
* can be revalidated this way — convention-resolved entries have no version
|
|
99
|
-
* source.
|
|
100
|
-
*/
|
|
101
|
-
maxAgeMs?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Maximum time in milliseconds for each SSR network request. Defaults to
|
|
104
|
-
* 10 seconds. Set to `0` to disable the timeout.
|
|
105
|
-
*/
|
|
106
|
-
fetchTimeoutMs?: number;
|
|
107
|
-
/**
|
|
108
|
-
* Maximum response body size in bytes for each SSR network request. Defaults
|
|
109
|
-
* to 10 MiB. Set to `0` to disable the limit.
|
|
110
|
-
*/
|
|
111
|
-
fetchMaxBytes?: number;
|
|
112
55
|
}
|
|
113
56
|
declare function ssrEntryLoaderPlugin(options?: SsrEntryLoaderOptions): {
|
|
114
57
|
name: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ssrEntryLoaderPlugin, n as neutralizeBrowserPreloadHelpers, r as revalidate, t as SsrEntryHttpError } from "../ssrEntryLoader-
|
|
1
|
+
import { i as ssrEntryLoaderPlugin, n as neutralizeBrowserPreloadHelpers, r as revalidate, t as SsrEntryHttpError } from "../ssrEntryLoader-DjZj-5Lw.js";
|
|
2
2
|
export { SsrEntryHttpError, ssrEntryLoaderPlugin as default, neutralizeBrowserPreloadHelpers, revalidate };
|