@module-federation/bridge-react 0.0.0-next-20250707074728 → 0.0.0-next-20250708033956

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 (62) hide show
  1. package/CHANGELOG.md +8 -4
  2. package/__tests__/bridge.spec.tsx +7 -7
  3. package/dist/{bridge-base-P6pEjY1q.js → bridge-base-BoshEggF.mjs} +1 -1
  4. package/dist/{bridge-base-BBH982Tz.cjs → bridge-base-UGCwcMnG.js} +1 -1
  5. package/dist/data-fetch-runtime-plugin.cjs.js +73 -0
  6. package/dist/data-fetch-runtime-plugin.d.ts +6 -0
  7. package/dist/data-fetch-runtime-plugin.es.js +74 -0
  8. package/dist/data-fetch-server-middleware.cjs.js +163 -0
  9. package/dist/data-fetch-server-middleware.d.ts +6 -0
  10. package/dist/data-fetch-server-middleware.es.js +164 -0
  11. package/dist/data-fetch-utils.cjs.js +1273 -0
  12. package/dist/data-fetch-utils.d.ts +77 -0
  13. package/dist/data-fetch-utils.es.js +1275 -0
  14. package/dist/index-C0fDZB5b.js +45 -0
  15. package/dist/index-CqxytsLY.mjs +46 -0
  16. package/dist/index.cjs.js +461 -9
  17. package/dist/index.d.ts +143 -0
  18. package/dist/index.es.js +464 -11
  19. package/dist/index.esm-BCeUd-x9.mjs +418 -0
  20. package/dist/index.esm-j_1sIRzg.js +417 -0
  21. package/dist/inject-data-fetch-CAvi-gSf.js +79 -0
  22. package/dist/inject-data-fetch-errCdqBS.mjs +80 -0
  23. package/dist/lazy-utils.cjs.js +24 -0
  24. package/dist/lazy-utils.d.ts +140 -0
  25. package/dist/lazy-utils.es.js +24 -0
  26. package/dist/plugin.d.ts +4 -4
  27. package/dist/router-v5.cjs.js +1 -1
  28. package/dist/router-v5.es.js +1 -1
  29. package/dist/router-v6.cjs.js +1 -1
  30. package/dist/router-v6.es.js +1 -1
  31. package/dist/router.cjs.js +1 -1
  32. package/dist/router.es.js +1 -1
  33. package/dist/utils-Bk8hGjjF.mjs +2016 -0
  34. package/dist/utils-iEVlDmyk.js +2015 -0
  35. package/dist/v18.cjs.js +1 -1
  36. package/dist/v18.es.js +1 -1
  37. package/dist/v19.cjs.js +1 -1
  38. package/dist/v19.es.js +1 -1
  39. package/package.json +45 -5
  40. package/src/index.ts +30 -1
  41. package/src/lazy/AwaitDataFetch.tsx +215 -0
  42. package/src/lazy/constant.ts +30 -0
  43. package/src/lazy/createLazyComponent.tsx +404 -0
  44. package/src/lazy/data-fetch/cache.ts +296 -0
  45. package/src/lazy/data-fetch/call-data-fetch.ts +13 -0
  46. package/src/lazy/data-fetch/data-fetch-server-middleware.ts +196 -0
  47. package/src/lazy/data-fetch/index.ts +15 -0
  48. package/src/lazy/data-fetch/inject-data-fetch.ts +109 -0
  49. package/src/lazy/data-fetch/prefetch.ts +102 -0
  50. package/src/lazy/data-fetch/runtime-plugin.ts +116 -0
  51. package/src/lazy/index.ts +31 -0
  52. package/src/lazy/logger.ts +6 -0
  53. package/src/lazy/types.ts +75 -0
  54. package/src/lazy/utils.ts +372 -0
  55. package/src/lazy/wrapNoSSR.tsx +10 -0
  56. package/src/provider/plugin.ts +4 -4
  57. package/src/remote/component.tsx +3 -3
  58. package/src/remote/create.tsx +17 -4
  59. package/tsconfig.json +1 -1
  60. package/vite.config.ts +13 -0
  61. package/dist/index-Cv3p6r66.cjs +0 -235
  62. package/dist/index-D4yt7Udv.js +0 -236
@@ -0,0 +1,77 @@
1
+ import { getInstance } from '@module-federation/runtime';
2
+
3
+ export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
4
+
5
+ declare interface CacheConfig {
6
+ maxSize?: number;
7
+ unstable_shouldDisable?: ({ request, }: {
8
+ request: Request;
9
+ }) => boolean | Promise<boolean>;
10
+ }
11
+
12
+ declare interface CacheOptions {
13
+ tag?: string | string[];
14
+ maxAge?: number;
15
+ revalidate?: number;
16
+ getKey?: <Args extends any[]>(...args: Args) => string;
17
+ customKey?: <Args extends any[]>(options: {
18
+ params: Args;
19
+ fn: (...args: Args) => any;
20
+ generatedKey: string;
21
+ }) => string | symbol;
22
+ onCache?: (info: CacheStatsInfo) => boolean;
23
+ }
24
+
25
+ export declare const CacheSize: {
26
+ readonly KB: 1024;
27
+ readonly MB: number;
28
+ readonly GB: number;
29
+ };
30
+
31
+ export declare interface CacheStatsInfo {
32
+ status: CacheStatus;
33
+ key: string | symbol;
34
+ params: DataFetchParams;
35
+ result: any;
36
+ }
37
+
38
+ export declare type CacheStatus = 'hit' | 'stale' | 'miss';
39
+
40
+ export declare const CacheTime: {
41
+ readonly SECOND: 1000;
42
+ readonly MINUTE: number;
43
+ readonly HOUR: number;
44
+ readonly DAY: number;
45
+ readonly WEEK: number;
46
+ readonly MONTH: number;
47
+ };
48
+
49
+ export declare function callDataFetch(): Promise<void>;
50
+
51
+ export declare function clearStore(): void;
52
+
53
+ export declare function configureCache(config: CacheConfig): void;
54
+
55
+ declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
56
+
57
+ declare type DataFetchParams = {
58
+ isDowngrade: boolean;
59
+ _id?: string;
60
+ } & Record<string, unknown>;
61
+
62
+ export declare function generateKey(dataFetchOptions: DataFetchParams): string;
63
+
64
+ export declare function injectDataFetch(): void;
65
+
66
+ export declare function prefetch(options: PrefetchOptions): Promise<void>;
67
+
68
+ declare type PrefetchOptions = {
69
+ id: string;
70
+ instance: ReturnType<typeof getInstance>;
71
+ dataFetchParams?: DataFetchParams;
72
+ preloadComponentResource?: boolean;
73
+ };
74
+
75
+ export declare function revalidateTag(tag: string): void;
76
+
77
+ export { }