@bleedingdev/modern-js-federation-runtime 3.9.0-ultramodern.16 → 3.9.0-ultramodern.18

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.
@@ -99,7 +99,12 @@ function DistributedSsrBoundary({ children, expose, fallback, fragmentProps, rem
99
99
  function createDistributedSsrComponent({ createComponent, expose, fallback, remote }) {
100
100
  let RemoteComponent;
101
101
  function DeferredRemoteComponent(props) {
102
- RemoteComponent ??= createComponent();
102
+ RemoteComponent ??= createComponent({
103
+ export: 'default',
104
+ fallback,
105
+ injectLink: false,
106
+ loading: null
107
+ });
103
108
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RemoteComponent, {
104
109
  ...props
105
110
  });
@@ -62,7 +62,12 @@ function DistributedSsrBoundary({ children, expose, fallback, fragmentProps, rem
62
62
  function createDistributedSsrComponent({ createComponent, expose, fallback, remote }) {
63
63
  let RemoteComponent;
64
64
  function DeferredRemoteComponent(props) {
65
- RemoteComponent ??= createComponent();
65
+ RemoteComponent ??= createComponent({
66
+ export: 'default',
67
+ fallback,
68
+ injectLink: false,
69
+ loading: null
70
+ });
66
71
  return /*#__PURE__*/ jsx(RemoteComponent, {
67
72
  ...props
68
73
  });
@@ -63,7 +63,12 @@ function DistributedSsrBoundary({ children, expose, fallback, fragmentProps, rem
63
63
  function createDistributedSsrComponent({ createComponent, expose, fallback, remote }) {
64
64
  let RemoteComponent;
65
65
  function DeferredRemoteComponent(props) {
66
- RemoteComponent ??= createComponent();
66
+ RemoteComponent ??= createComponent({
67
+ export: 'default',
68
+ fallback,
69
+ injectLink: false,
70
+ loading: null
71
+ });
67
72
  return /*#__PURE__*/ jsx(RemoteComponent, {
68
73
  ...props
69
74
  });
@@ -30,8 +30,25 @@ export type DistributedSsrBoundaryProps<Props extends object = Record<string, un
30
30
  fragmentProps?: Props;
31
31
  remote: string;
32
32
  };
33
+ /**
34
+ * The Module Federation `createLazyComponent` options the distributed boundary
35
+ * owns. `injectLink` is always false: the boundary owns remote CSS (the
36
+ * fragment CSS inventory in workerd, the MF manifest in the browser), so the
37
+ * bridge must not render a second `<link>` in SSR HTML.
38
+ */
39
+ export type DistributedSsrLazyComponentOptions = {
40
+ export: 'default';
41
+ fallback: ReactNode;
42
+ injectLink: false;
43
+ loading: null;
44
+ };
33
45
  export type CreateDistributedSsrComponentOptions<Props extends object> = {
34
- createComponent: () => ComponentType<Props>;
46
+ /**
47
+ * Creates the native remote on first render. Spread `options` into
48
+ * Module Federation's `createLazyComponent` and add the instance and
49
+ * loader.
50
+ */
51
+ createComponent: (options: DistributedSsrLazyComponentOptions) => ComponentType<Props>;
35
52
  expose: string;
36
53
  fallback: ReactNode;
37
54
  remote: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bleedingdev/modern-js-federation-runtime",
3
- "version": "3.9.0-ultramodern.16",
3
+ "version": "3.9.0-ultramodern.18",
4
4
  "description": "Federated surface consumption, distributed SSR, and bounded manifest recovery.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -62,15 +62,15 @@
62
62
  ],
63
63
  "sideEffects": false,
64
64
  "dependencies": {
65
- "@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.0-ultramodern.16"
65
+ "@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.0-ultramodern.18"
66
66
  },
67
67
  "peerDependencies": {
68
- "@modern-js/runtime": "3.9.0-ultramodern.16",
68
+ "@modern-js/runtime": "3.9.0-ultramodern.18",
69
69
  "react": "^19.2.8"
70
70
  },
71
71
  "devDependencies": {
72
- "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.16",
73
- "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.16",
72
+ "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.18",
73
+ "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.18",
74
74
  "@rsbuild/core": "2.2.9",
75
75
  "@rslib/core": "1.0.2",
76
76
  "@scripts/rstest-config": "2.66.0",
@@ -51,8 +51,28 @@ export type DistributedSsrBoundaryProps<
51
51
  remote: string;
52
52
  };
53
53
 
54
+ /**
55
+ * The Module Federation `createLazyComponent` options the distributed boundary
56
+ * owns. `injectLink` is always false: the boundary owns remote CSS (the
57
+ * fragment CSS inventory in workerd, the MF manifest in the browser), so the
58
+ * bridge must not render a second `<link>` in SSR HTML.
59
+ */
60
+ export type DistributedSsrLazyComponentOptions = {
61
+ export: 'default';
62
+ fallback: ReactNode;
63
+ injectLink: false;
64
+ loading: null;
65
+ };
66
+
54
67
  export type CreateDistributedSsrComponentOptions<Props extends object> = {
55
- createComponent: () => ComponentType<Props>;
68
+ /**
69
+ * Creates the native remote on first render. Spread `options` into
70
+ * Module Federation's `createLazyComponent` and add the instance and
71
+ * loader.
72
+ */
73
+ createComponent: (
74
+ options: DistributedSsrLazyComponentOptions,
75
+ ) => ComponentType<Props>;
56
76
  expose: string;
57
77
  fallback: ReactNode;
58
78
  remote: string;
@@ -221,7 +241,12 @@ export function createDistributedSsrComponent<Props extends object>({
221
241
  let RemoteComponent: ComponentType<Props> | undefined;
222
242
 
223
243
  function DeferredRemoteComponent(props: Props) {
224
- RemoteComponent ??= createComponent();
244
+ RemoteComponent ??= createComponent({
245
+ export: 'default',
246
+ fallback,
247
+ injectLink: false,
248
+ loading: null,
249
+ });
225
250
  return <RemoteComponent {...props} />;
226
251
  }
227
252