@module-federation/bridge-react 0.0.0-next-20250708134245 → 0.0.0-next-20250709032753

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 (70) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/__tests__/bridge.spec.tsx +7 -7
  3. package/dist/{bridge-base-UGCwcMnG.js → bridge-base-BBH982Tz.cjs} +1 -1
  4. package/dist/{bridge-base-BoshEggF.mjs → bridge-base-P6pEjY1q.js} +1 -1
  5. package/dist/index-Cv3p6r66.cjs +235 -0
  6. package/dist/index-D4yt7Udv.js +236 -0
  7. package/dist/index.cjs.js +9 -35
  8. package/dist/index.d.ts +0 -144
  9. package/dist/index.es.js +12 -38
  10. package/dist/plugin.d.ts +0 -9
  11. package/dist/router-v5.cjs.js +1 -1
  12. package/dist/router-v5.d.ts +0 -9
  13. package/dist/router-v5.es.js +1 -1
  14. package/dist/router-v6.cjs.js +1 -1
  15. package/dist/router-v6.d.ts +0 -9
  16. package/dist/router-v6.es.js +1 -1
  17. package/dist/router.cjs.js +1 -1
  18. package/dist/router.d.ts +0 -9
  19. package/dist/router.es.js +1 -1
  20. package/dist/v18.cjs.js +1 -1
  21. package/dist/v18.d.ts +0 -9
  22. package/dist/v18.es.js +1 -1
  23. package/dist/v19.cjs.js +1 -1
  24. package/dist/v19.d.ts +0 -9
  25. package/dist/v19.es.js +1 -1
  26. package/package.json +5 -46
  27. package/src/.eslintrc.js +9 -0
  28. package/src/index.ts +1 -32
  29. package/src/remote/component.tsx +3 -3
  30. package/src/remote/create.tsx +4 -17
  31. package/tsconfig.json +1 -1
  32. package/vite.config.ts +0 -13
  33. package/dist/data-fetch-server-middleware.cjs.js +0 -163
  34. package/dist/data-fetch-server-middleware.d.ts +0 -15
  35. package/dist/data-fetch-server-middleware.es.js +0 -164
  36. package/dist/data-fetch-utils.cjs.js +0 -24
  37. package/dist/data-fetch-utils.d.ts +0 -86
  38. package/dist/data-fetch-utils.es.js +0 -26
  39. package/dist/index-C0fDZB5b.js +0 -45
  40. package/dist/index-CqxytsLY.mjs +0 -46
  41. package/dist/index.esm-BCeUd-x9.mjs +0 -418
  42. package/dist/index.esm-j_1sIRzg.js +0 -417
  43. package/dist/lazy-load-component-plugin-Bobxn-VP.js +0 -524
  44. package/dist/lazy-load-component-plugin-Dvi5dnb7.mjs +0 -525
  45. package/dist/lazy-load-component-plugin.cjs.js +0 -6
  46. package/dist/lazy-load-component-plugin.d.ts +0 -16
  47. package/dist/lazy-load-component-plugin.es.js +0 -6
  48. package/dist/lazy-utils.cjs.js +0 -24
  49. package/dist/lazy-utils.d.ts +0 -149
  50. package/dist/lazy-utils.es.js +0 -24
  51. package/dist/prefetch-BWabXlKU.js +0 -1332
  52. package/dist/prefetch-Dq-ZhN17.mjs +0 -1333
  53. package/dist/utils-Cy-amYU5.mjs +0 -2016
  54. package/dist/utils-iEVlDmyk.js +0 -2015
  55. package/src/lazy/AwaitDataFetch.tsx +0 -215
  56. package/src/lazy/constant.ts +0 -30
  57. package/src/lazy/createLazyComponent.tsx +0 -414
  58. package/src/lazy/data-fetch/cache.ts +0 -296
  59. package/src/lazy/data-fetch/call-data-fetch.ts +0 -13
  60. package/src/lazy/data-fetch/data-fetch-server-middleware.ts +0 -196
  61. package/src/lazy/data-fetch/index.ts +0 -16
  62. package/src/lazy/data-fetch/inject-data-fetch.ts +0 -109
  63. package/src/lazy/data-fetch/prefetch.ts +0 -106
  64. package/src/lazy/data-fetch/runtime-plugin.ts +0 -115
  65. package/src/lazy/index.ts +0 -35
  66. package/src/lazy/logger.ts +0 -6
  67. package/src/lazy/types.ts +0 -75
  68. package/src/lazy/utils.ts +0 -372
  69. package/src/lazy/wrapNoSSR.tsx +0 -10
  70. package/src/plugins/lazy-load-component-plugin.ts +0 -62
@@ -1,149 +0,0 @@
1
- import { FederationHost } from '@module-federation/runtime';
2
- import { GlobalModuleInfo } from '@module-federation/sdk';
3
- import { LRUCache } from 'lru-cache';
4
- import { ManifestProvider } from '@module-federation/sdk';
5
- import { ModuleInfo } from '@module-federation/sdk';
6
- import { PureEntryProvider } from '@module-federation/sdk';
7
- import { RemoteEntryType } from '@module-federation/sdk';
8
-
9
- declare interface CacheConfig {
10
- maxSize?: number;
11
- unstable_shouldDisable?: ({ request, }: {
12
- request: Request;
13
- }) => boolean | Promise<boolean>;
14
- }
15
-
16
- declare interface CacheItem<T> {
17
- data: T;
18
- timestamp: number;
19
- isRevalidating?: boolean;
20
- }
21
-
22
- export declare function callAllDowngrade(): void;
23
-
24
- export declare function callDowngrade(id: string, params?: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<unknown>;
25
-
26
- declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
27
-
28
- declare type DataFetchParams = {
29
- isDowngrade: boolean;
30
- _id?: string;
31
- } & Record<string, unknown>;
32
-
33
- export declare function fetchData(id: string, params: DataFetchParams, remoteInfo?: NoSSRRemoteInfo): Promise<unknown | undefined>;
34
-
35
- export declare const flushDataFetch: () => void;
36
-
37
- export declare function getDataFetchCache(): MF_DATA_FETCH_CACHE;
38
-
39
- export declare const getDataFetchIdWithErrorMsgs: (errMsgs: string) => string | undefined;
40
-
41
- export declare const getDataFetchInfo: ({ name, alias, id, remoteSnapshot, }: {
42
- id: string;
43
- name: string;
44
- remoteSnapshot: GlobalModuleInfo[string];
45
- alias?: string;
46
- }) => {
47
- dataFetchName: string;
48
- dataFetchId: string;
49
- dataFetchKey: string;
50
- } | undefined;
51
-
52
- export declare function getDataFetchItem(id: string): MF_DATA_FETCH_MAP_VALUE;
53
-
54
- export declare function getDataFetchMap(): MF_DATA_FETCH_MAP;
55
-
56
- export declare function getDataFetchMapKey(dataFetchInfo?: ReturnType<typeof getDataFetchInfo>, hostInfo?: {
57
- name: string;
58
- version?: string;
59
- }): string | undefined;
60
-
61
- export declare function getDowngradeTag(): MF_SSR_DOWNGRADE;
62
-
63
- export declare function getLoadedRemoteInfos(id: string, instance: FederationHost | null): {
64
- snapshot: ModuleInfo | ManifestProvider | PureEntryProvider | undefined;
65
- expose: string;
66
- alias?: string;
67
- name: string;
68
- version?: string;
69
- buildVersion?: string;
70
- entry: string;
71
- type: RemoteEntryType;
72
- entryGlobalName: string;
73
- shareScope: string | string[];
74
- } | undefined;
75
-
76
- export declare function initDataFetchMap(): void;
77
-
78
- export declare function isCSROnly(): boolean;
79
-
80
- export declare function isDataLoaderExpose(exposeKey: string): boolean;
81
-
82
- export declare function isServerEnv(): boolean;
83
-
84
- export declare function loadDataFetchModule(instance: FederationHost, id: string): Promise<(params: DataFetchParams) => Promise<unknown>>;
85
-
86
- declare type MF_DATA_FETCH_CACHE = {
87
- cacheStore?: LRUCache<string, Map<string, CacheItem<any>>>;
88
- tagKeyMap?: Map<string, Set<string>>;
89
- cacheConfig?: CacheConfig;
90
- };
91
-
92
- declare type MF_DATA_FETCH_MAP = Record<string, MF_DATA_FETCH_MAP_VALUE>;
93
-
94
- declare type MF_DATA_FETCH_MAP_VALUE = [
95
- [
96
- () => Promise<DataFetch<unknown>>,
97
- MF_DATA_FETCH_TYPE,
98
- Promise<DataFetch<unknown>>?
99
- ],
100
- MF_DATA_FETCH_MAP_VALUE_PROMISE_SET?,
101
- MF_DATA_FETCH_STATUS?
102
- ];
103
-
104
- declare type MF_DATA_FETCH_MAP_VALUE_PROMISE_SET = [
105
- Promise<unknown>,
106
- ((data: unknown) => void)?,
107
- ((err: unknown) => void)?
108
- ];
109
-
110
- declare const enum MF_DATA_FETCH_STATUS {
111
- LOADED = 1,
112
- LOADING = 2,
113
- AWAIT = 0,
114
- ERROR = 3
115
- }
116
-
117
- declare const enum MF_DATA_FETCH_TYPE {
118
- FETCH_SERVER = 1,
119
- FETCH_CLIENT = 2
120
- }
121
-
122
- declare type MF_SSR_DOWNGRADE = string[] | true | undefined;
123
-
124
- declare type NoSSRRemoteInfo = {
125
- name: string;
126
- version: string;
127
- ssrPublicPath: string;
128
- ssrRemoteEntry: string;
129
- globalName: string;
130
- };
131
-
132
- export declare function setDataFetchItemLoadedStatus(id: string): void;
133
-
134
- export declare function setSSREnv({ fetchServerQuery, }: {
135
- fetchServerQuery?: Record<string, unknown>;
136
- }): void;
137
-
138
- export declare const wrapDataFetchId: (id?: string) => string;
139
-
140
- export { }
141
-
142
-
143
- declare module '@module-federation/runtime-core' {
144
- interface FederationHost {
145
- createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
146
- prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
147
- collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
148
- }
149
- }
@@ -1,24 +0,0 @@
1
- import "./index.esm-BCeUd-x9.mjs";
2
- import { G, H, f, J, I, u, k, n, g, m, B, y, i, t, j, q, a, z, s, w } from "./utils-Cy-amYU5.mjs";
3
- export {
4
- G as callAllDowngrade,
5
- H as callDowngrade,
6
- f as fetchData,
7
- J as flushDataFetch,
8
- I as getDataFetchCache,
9
- u as getDataFetchIdWithErrorMsgs,
10
- k as getDataFetchInfo,
11
- n as getDataFetchItem,
12
- g as getDataFetchMap,
13
- m as getDataFetchMapKey,
14
- B as getDowngradeTag,
15
- y as getLoadedRemoteInfos,
16
- i as initDataFetchMap,
17
- t as isCSROnly,
18
- j as isDataLoaderExpose,
19
- q as isServerEnv,
20
- a as loadDataFetchModule,
21
- z as setDataFetchItemLoadedStatus,
22
- s as setSSREnv,
23
- w as wrapDataFetchId
24
- };