@module-federation/bridge-react 0.0.0-perf-devtools-20260108034446 → 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 (161) hide show
  1. package/dist/base.cjs.js +4 -4
  2. package/dist/base.d.ts +8 -311
  3. package/dist/base.es.js +11 -11
  4. package/dist/{bridge-base-CPSTBjEp.mjs → bridge-base-CHnL6Q9P.mjs} +63 -103
  5. package/dist/{bridge-base-RStDxH71.js → bridge-base-DSYKAGGD.js} +63 -102
  6. package/dist/{createHelpers-Ui5pt7je.mjs → createHelpers-D3Sg5lKp.mjs} +32 -17
  7. package/dist/{createHelpers-B_L612IN.js → createHelpers-D6thyyLv.js} +30 -15
  8. package/dist/data-fetch-server-middleware.cjs.js +4 -4
  9. package/dist/data-fetch-server-middleware.d.ts +1 -15
  10. package/dist/data-fetch-server-middleware.es.js +2 -2
  11. package/dist/data-fetch-utils.cjs.js +2 -2
  12. package/dist/data-fetch-utils.d.ts +1 -81
  13. package/dist/data-fetch-utils.es.js +7 -7
  14. package/dist/data-fetch.cjs.js +22 -0
  15. package/dist/data-fetch.d.ts +4 -0
  16. package/dist/data-fetch.es.js +22 -0
  17. package/dist/error-boundary.d.ts +17 -0
  18. package/dist/error-boundary.spec.d.ts +1 -0
  19. package/dist/{index-DyQNwY2M.mjs → index-Bs2NxD2z.mjs} +1 -1
  20. package/dist/{index-DRSBaSu3.js → index-DbjGCKOr.js} +2 -2
  21. package/dist/index.cjs.js +27 -6
  22. package/dist/index.d.ts +12 -299
  23. package/dist/index.es.js +34 -13
  24. package/dist/lazy/AwaitDataFetch.d.ts +24 -0
  25. package/dist/lazy/HydratedStylesheetAssets.d.ts +4 -0
  26. package/dist/lazy/constant.d.ts +26 -0
  27. package/dist/lazy/createLazyComponent.d.ts +28 -0
  28. package/dist/lazy/data-fetch/cache.d.ts +34 -0
  29. package/dist/lazy/data-fetch/cache.spec.d.ts +1 -0
  30. package/dist/lazy/data-fetch/call-data-fetch.d.ts +1 -0
  31. package/dist/lazy/data-fetch/data-fetch-server-middleware.d.ts +3 -0
  32. package/{src/lazy/data-fetch/index.ts → dist/lazy/data-fetch/index.d.ts} +1 -11
  33. package/dist/lazy/data-fetch/inject-data-fetch.d.ts +4 -0
  34. package/dist/lazy/data-fetch/prefetch.d.ts +9 -0
  35. package/dist/lazy/data-fetch/runtime-plugin.d.ts +3 -0
  36. package/dist/lazy/index.d.ts +9 -0
  37. package/dist/lazy/logger.d.ts +2 -0
  38. package/dist/lazy/types.d.ts +60 -0
  39. package/dist/lazy/utils.d.ts +48 -0
  40. package/dist/lazy/wrapNoSSR.d.ts +9 -0
  41. package/dist/{lazy-load-component-plugin-BvnyaA6i.js → lazy-load-component-plugin-DSURjnZ0.js} +170 -44
  42. package/dist/{lazy-load-component-plugin-CVcFMRce.mjs → lazy-load-component-plugin-NZphPG7_.mjs} +174 -48
  43. package/dist/lazy-load-component-plugin.cjs.js +2 -2
  44. package/dist/lazy-load-component-plugin.d.ts +2 -16
  45. package/dist/lazy-load-component-plugin.es.js +2 -2
  46. package/dist/lazy-utils.cjs.js +2 -2
  47. package/dist/lazy-utils.d.ts +1 -149
  48. package/dist/lazy-utils.es.js +19 -19
  49. package/dist/logger-DwWkXsWl.mjs +139 -0
  50. package/dist/logger-Dxblx6P-.js +138 -0
  51. package/dist/plugin.d.ts +2 -22
  52. package/dist/plugins/lazy-load-component-plugin.d.ts +12 -0
  53. package/dist/plugins/lazy-load-component-plugin.spec.d.ts +1 -0
  54. package/dist/prefetch-Bxf6DSx_.js +1477 -0
  55. package/dist/prefetch-TKq_EK_q.mjs +1478 -0
  56. package/dist/provider/context.d.ts +3 -0
  57. package/dist/provider/plugin.d.ts +7 -0
  58. package/dist/provider/versions/bridge-base.d.ts +5 -0
  59. package/dist/provider/versions/legacy.d.ts +26 -0
  60. package/dist/provider/versions/v18.d.ts +19 -0
  61. package/dist/provider/versions/v19.d.ts +21 -0
  62. package/dist/remote/RemoteAppWrapper.d.ts +7 -0
  63. package/dist/remote/base-component/create.d.ts +9 -0
  64. package/dist/remote/base-component/index.d.ts +5 -0
  65. package/dist/remote/createHelpers.d.ts +17 -0
  66. package/dist/remote/router-component/component.d.ts +8 -0
  67. package/dist/remote/router-component/create.d.ts +9 -0
  68. package/dist/remote/router-component/index.d.ts +5 -0
  69. package/dist/router/default.d.ts +7 -0
  70. package/dist/router/v5.d.ts +4 -0
  71. package/dist/router/v6.d.ts +7 -0
  72. package/dist/router/v7.d.ts +6 -0
  73. package/dist/router-v5.cjs.js +5 -3
  74. package/dist/router-v5.d.ts +1 -18
  75. package/dist/router-v5.es.js +5 -3
  76. package/dist/router-v6.cjs.js +1 -1
  77. package/dist/router-v6.d.ts +1 -20
  78. package/dist/router-v6.es.js +1 -1
  79. package/dist/router-v7.cjs.js +5 -3
  80. package/dist/router-v7.d.ts +1 -20
  81. package/dist/router-v7.es.js +5 -3
  82. package/dist/router.cjs.js +1 -1
  83. package/dist/router.d.ts +1 -20
  84. package/dist/router.es.js +1 -1
  85. package/dist/shared/size-limited-cache.d.ts +29 -0
  86. package/dist/shared/size-limited-cache.spec.d.ts +1 -0
  87. package/dist/size-limited-cache.cjs.js +82 -0
  88. package/dist/size-limited-cache.d.ts +1 -0
  89. package/dist/size-limited-cache.es.js +82 -0
  90. package/dist/types.d.ts +137 -0
  91. package/dist/utils/index.d.ts +4 -0
  92. package/dist/utils-5dGErM3C.js +588 -0
  93. package/dist/utils-BBP3hEeV.mjs +589 -0
  94. package/dist/v18.cjs.js +1 -1
  95. package/dist/v18.d.ts +3 -114
  96. package/dist/v18.es.js +1 -1
  97. package/dist/v19.cjs.js +1 -1
  98. package/dist/v19.d.ts +3 -115
  99. package/dist/v19.es.js +1 -1
  100. package/package.json +35 -14
  101. package/CHANGELOG.md +0 -735
  102. package/__tests__/bridge.spec.tsx +0 -160
  103. package/__tests__/createLazyComponent.spec.tsx +0 -209
  104. package/__tests__/prefetch.spec.ts +0 -156
  105. package/__tests__/router.spec.tsx +0 -82
  106. package/__tests__/setupTests.ts +0 -8
  107. package/__tests__/util.ts +0 -36
  108. package/dist/index.esm-BWaKho-8.js +0 -491
  109. package/dist/index.esm-CPwSeCvw.mjs +0 -492
  110. package/dist/prefetch-CK3EZdY4.mjs +0 -1273
  111. package/dist/prefetch-MiXeF8KH.js +0 -1272
  112. package/dist/utils-dUgb9Jkm.mjs +0 -2016
  113. package/dist/utils-tM9yE73c.js +0 -2015
  114. package/jest.config.ts +0 -21
  115. package/project.json +0 -23
  116. package/src/base.ts +0 -50
  117. package/src/index.ts +0 -50
  118. package/src/lazy/AwaitDataFetch.tsx +0 -215
  119. package/src/lazy/constant.ts +0 -30
  120. package/src/lazy/createLazyComponent.tsx +0 -411
  121. package/src/lazy/data-fetch/cache.ts +0 -291
  122. package/src/lazy/data-fetch/call-data-fetch.ts +0 -13
  123. package/src/lazy/data-fetch/data-fetch-server-middleware.ts +0 -196
  124. package/src/lazy/data-fetch/inject-data-fetch.ts +0 -109
  125. package/src/lazy/data-fetch/prefetch.ts +0 -112
  126. package/src/lazy/data-fetch/runtime-plugin.ts +0 -115
  127. package/src/lazy/index.ts +0 -35
  128. package/src/lazy/logger.ts +0 -6
  129. package/src/lazy/types.ts +0 -75
  130. package/src/lazy/utils.ts +0 -372
  131. package/src/lazy/wrapNoSSR.tsx +0 -10
  132. package/src/modern-app-env.d.ts +0 -2
  133. package/src/plugins/lazy-load-component-plugin.spec.ts +0 -21
  134. package/src/plugins/lazy-load-component-plugin.ts +0 -57
  135. package/src/provider/context.tsx +0 -4
  136. package/src/provider/plugin.ts +0 -22
  137. package/src/provider/versions/bridge-base.tsx +0 -150
  138. package/src/provider/versions/legacy.ts +0 -87
  139. package/src/provider/versions/v18.ts +0 -47
  140. package/src/provider/versions/v19.ts +0 -48
  141. package/src/remote/RemoteAppWrapper.tsx +0 -108
  142. package/src/remote/base-component/create.tsx +0 -23
  143. package/src/remote/base-component/index.tsx +0 -10
  144. package/src/remote/createHelpers.tsx +0 -130
  145. package/src/remote/router-component/component.tsx +0 -104
  146. package/src/remote/router-component/create.tsx +0 -23
  147. package/src/remote/router-component/index.tsx +0 -10
  148. package/src/router/default.tsx +0 -73
  149. package/src/router/v5.tsx +0 -43
  150. package/src/router/v6.tsx +0 -74
  151. package/src/router/v7.tsx +0 -75
  152. package/src/types.ts +0 -147
  153. package/src/utils/index.ts +0 -44
  154. package/src/v18.ts +0 -9
  155. package/src/v19.ts +0 -9
  156. package/tsconfig.json +0 -42
  157. package/tsconfig.node.json +0 -11
  158. package/tsconfig.spec.json +0 -26
  159. package/vite.config.ts +0 -112
  160. package/vitest.config.ts +0 -27
  161. /package/{src/remote/base-component/component.tsx → dist/remote/base-component/component.d.ts} +0 -0
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class SizeLimitedCache {
5
+ constructor(options) {
6
+ __publicField(this, "maxSize");
7
+ __publicField(this, "entries", /* @__PURE__ */ new Map());
8
+ __publicField(this, "sizeCalculation");
9
+ __publicField(this, "currentSize", 0);
10
+ if (!Number.isInteger(options.maxSize) || options.maxSize <= 0) {
11
+ throw new TypeError("maxSize must be a positive integer");
12
+ }
13
+ this.maxSize = options.maxSize;
14
+ this.sizeCalculation = options.sizeCalculation;
15
+ }
16
+ get size() {
17
+ return this.entries.size;
18
+ }
19
+ get calculatedSize() {
20
+ return this.currentSize;
21
+ }
22
+ get(key) {
23
+ const entry = this.entries.get(key);
24
+ if (!entry) {
25
+ return void 0;
26
+ }
27
+ this.refresh(key, entry);
28
+ return entry.value;
29
+ }
30
+ has(key) {
31
+ const entry = this.entries.get(key);
32
+ if (!entry) {
33
+ return false;
34
+ }
35
+ this.refresh(key, entry);
36
+ return true;
37
+ }
38
+ set(key, value, options = {}) {
39
+ var _a;
40
+ const entrySize = options.size ?? ((_a = this.sizeCalculation) == null ? void 0 : _a.call(this, value, key)) ?? 1;
41
+ if (!Number.isInteger(entrySize) || entrySize <= 0) {
42
+ throw new TypeError("entry size must be a positive integer");
43
+ }
44
+ this.delete(key);
45
+ if (entrySize > this.maxSize) {
46
+ return this;
47
+ }
48
+ this.entries.set(key, { value, size: entrySize });
49
+ this.currentSize += entrySize;
50
+ this.evictUntilWithinLimit();
51
+ return this;
52
+ }
53
+ delete(key) {
54
+ const entry = this.entries.get(key);
55
+ if (!entry) {
56
+ return false;
57
+ }
58
+ this.currentSize -= entry.size;
59
+ return this.entries.delete(key);
60
+ }
61
+ clear() {
62
+ this.entries.clear();
63
+ this.currentSize = 0;
64
+ }
65
+ refresh(key, entry) {
66
+ this.entries.delete(key);
67
+ this.entries.set(key, entry);
68
+ }
69
+ evictUntilWithinLimit() {
70
+ while (this.currentSize > this.maxSize) {
71
+ const oldest = this.entries.keys().next();
72
+ if (oldest.done) {
73
+ this.currentSize = 0;
74
+ return;
75
+ }
76
+ this.delete(oldest.value);
77
+ }
78
+ }
79
+ }
80
+ export {
81
+ SizeLimitedCache
82
+ };
@@ -0,0 +1,137 @@
1
+ import * as React from 'react';
2
+ export type ErrorFallbackProps = {
3
+ error: unknown;
4
+ resetErrorBoundary: (...args: unknown[]) => void;
5
+ };
6
+ /**
7
+ * Options for creating a React root
8
+ */
9
+ export interface CreateRootOptions {
10
+ identifierPrefix?: string;
11
+ onRecoverableError?: (error: unknown) => void;
12
+ transitionCallbacks?: unknown;
13
+ }
14
+ /**
15
+ * Interface for a React root object
16
+ */
17
+ export interface Root {
18
+ render(children: React.ReactNode): void;
19
+ unmount(): void;
20
+ }
21
+ /**
22
+ * Type for a root element, which can be either an HTMLElement or a React root
23
+ */
24
+ export type RootType = HTMLElement | Root;
25
+ /**
26
+ * Parameters for the render function
27
+ */
28
+ export interface RenderParams {
29
+ moduleName?: string;
30
+ basename?: string;
31
+ memoryRoute?: {
32
+ entryPath: string;
33
+ initialState?: Record<string, unknown>;
34
+ };
35
+ dom: HTMLElement;
36
+ /**
37
+ * Options to pass to createRoot for React 18 and 19
38
+ * @example
39
+ * {
40
+ * identifierPrefix: 'app-',
41
+ * onRecoverableError: (err) => console.error(err)
42
+ * }
43
+ */
44
+ rootOptions?: CreateRootOptions;
45
+ [key: string]: unknown;
46
+ }
47
+ /**
48
+ * Parameters for the destroy function
49
+ */
50
+ export interface DestroyParams {
51
+ moduleName: string;
52
+ dom: HTMLElement;
53
+ }
54
+ /**
55
+ * Parameters for the provider function
56
+ */
57
+ export interface ProviderParams {
58
+ moduleName?: string;
59
+ basename?: string;
60
+ memoryRoute?: {
61
+ entryPath: string;
62
+ initialState?: Record<string, unknown>;
63
+ };
64
+ style?: React.CSSProperties;
65
+ className?: string;
66
+ }
67
+ /**
68
+ * Parameters for the render function, extending ProviderParams
69
+ */
70
+ export interface RenderFnParams extends ProviderParams {
71
+ dom: HTMLElement;
72
+ fallback?: React.ComponentType<{
73
+ error: Error;
74
+ }>;
75
+ [key: string]: unknown;
76
+ }
77
+ /**
78
+ * Parameters for the provider function
79
+ */
80
+ export interface ProviderFnParams<T> {
81
+ rootComponent: React.ComponentType<T>;
82
+ render?: (App: React.ReactElement, id?: HTMLElement | string) => RootType | Promise<RootType>;
83
+ createRoot?: (container: Element | DocumentFragment, options?: CreateRootOptions) => Root;
84
+ /**
85
+ * Default options to pass to createRoot for React 18 and 19
86
+ * These options will be used when creating a root unless overridden by rootOptions in render params
87
+ * @example
88
+ * {
89
+ * identifierPrefix: 'app-',
90
+ * onRecoverableError: (err) => console.error(err)
91
+ * }
92
+ */
93
+ defaultRootOptions?: CreateRootOptions;
94
+ }
95
+ /**
96
+ * Parameters for the remote component
97
+ */
98
+ export interface RemoteComponentProps<T = Record<string, unknown>> {
99
+ props?: T;
100
+ fallback?: React.ComponentType<{
101
+ error: Error;
102
+ }>;
103
+ loading?: React.ReactNode;
104
+ [key: string]: unknown;
105
+ }
106
+ /**
107
+ * Parameters for the remote component loader
108
+ */
109
+ export interface RemoteComponentParams<T = Record<string, unknown>, E extends keyof T = keyof T> {
110
+ loader: () => Promise<T>;
111
+ loading: React.ReactNode;
112
+ fallback: React.ComponentType<{
113
+ error: Error;
114
+ }>;
115
+ export?: E;
116
+ props?: T;
117
+ }
118
+ /**
119
+ * Interface for a remote module provider
120
+ */
121
+ export interface RemoteModule {
122
+ provider: () => {
123
+ render: (info: RenderFnParams) => void;
124
+ destroy: (info: {
125
+ dom: any;
126
+ }) => void;
127
+ };
128
+ }
129
+ /**
130
+ * Parameters for a remote app component
131
+ */
132
+ export interface RemoteAppParams extends ProviderParams {
133
+ moduleName: string;
134
+ providerInfo: NonNullable<RemoteModule['provider']>;
135
+ exportName: string | number | symbol;
136
+ fallback: React.ComponentType<ErrorFallbackProps>;
137
+ }
@@ -0,0 +1,4 @@
1
+ export declare const LoggerInstance: import("@module-federation/sdk").Logger;
2
+ export declare function pathJoin(...args: string[]): string;
3
+ export declare const getModuleName: (id: string) => string;
4
+ export declare const getRootDomDefaultClassName: (moduleName: string) => string;