remote-components 0.0.51 → 0.1.2
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/dist/{component-loader-1838f572.d.ts → component-loader-21865da3.d.ts} +142 -16
- package/dist/host-config-58cdccea.d.ts +87 -0
- package/dist/html/host.cjs +589 -377
- package/dist/html/host.cjs.map +1 -1
- package/dist/html/host.d.ts +2 -0
- package/dist/html/host.js +588 -377
- package/dist/html/host.js.map +1 -1
- package/dist/html/remote.cjs +65 -57
- package/dist/html/remote.cjs.map +1 -1
- package/dist/html/remote.js +65 -57
- package/dist/html/remote.js.map +1 -1
- package/dist/internal/next/host/app-router-client.cjs +21 -10
- package/dist/internal/next/host/app-router-client.cjs.map +1 -1
- package/dist/internal/next/host/app-router-client.d.ts +36 -14
- package/dist/internal/next/host/app-router-client.js +21 -10
- package/dist/internal/next/host/app-router-client.js.map +1 -1
- package/dist/internal/next/remote/render-server.cjs.map +1 -1
- package/dist/internal/next/remote/render-server.d.ts +13 -14
- package/dist/internal/next/remote/render-server.js.map +1 -1
- package/dist/internal/react/context.cjs +43 -0
- package/dist/internal/react/context.cjs.map +1 -0
- package/dist/internal/react/context.d.ts +20 -0
- package/dist/internal/react/context.js +18 -0
- package/dist/internal/react/context.js.map +1 -0
- package/dist/internal/react/hooks/use-resolve-client-url.cjs +39 -0
- package/dist/internal/react/hooks/use-resolve-client-url.cjs.map +1 -0
- package/dist/internal/react/hooks/use-resolve-client-url.d.ts +5 -0
- package/dist/internal/react/hooks/use-resolve-client-url.js +15 -0
- package/dist/internal/react/hooks/use-resolve-client-url.js.map +1 -0
- package/dist/internal/shared/client/apply-origin.cjs +10 -5
- package/dist/internal/shared/client/apply-origin.cjs.map +1 -1
- package/dist/internal/shared/client/apply-origin.d.ts +3 -1
- package/dist/internal/shared/client/apply-origin.js +10 -5
- package/dist/internal/shared/client/apply-origin.js.map +1 -1
- package/dist/internal/shared/client/default-resolve-client-url.cjs +32 -0
- package/dist/internal/shared/client/default-resolve-client-url.cjs.map +1 -0
- package/dist/internal/shared/client/default-resolve-client-url.d.ts +5 -0
- package/dist/internal/shared/client/default-resolve-client-url.js +10 -0
- package/dist/internal/shared/client/default-resolve-client-url.js.map +1 -0
- package/dist/internal/shared/client/protected-rc-fallback.cjs +11 -2
- package/dist/internal/shared/client/protected-rc-fallback.cjs.map +1 -1
- package/dist/internal/shared/client/protected-rc-fallback.d.ts +2 -1
- package/dist/internal/shared/client/protected-rc-fallback.js +9 -1
- package/dist/internal/shared/client/protected-rc-fallback.js.map +1 -1
- package/dist/internal/shared/client/proxy-through-host.cjs +65 -0
- package/dist/internal/shared/client/proxy-through-host.cjs.map +1 -0
- package/dist/internal/shared/client/proxy-through-host.d.ts +62 -0
- package/dist/internal/shared/client/proxy-through-host.js +40 -0
- package/dist/internal/shared/client/proxy-through-host.js.map +1 -0
- package/dist/internal/shared/client/remote-component.cjs +121 -137
- package/dist/internal/shared/client/remote-component.cjs.map +1 -1
- package/dist/internal/shared/client/remote-component.d.ts +7 -5
- package/dist/internal/shared/client/remote-component.js +120 -137
- package/dist/internal/shared/client/remote-component.js.map +1 -1
- package/dist/internal/shared/constants.cjs +3 -0
- package/dist/internal/shared/constants.cjs.map +1 -1
- package/dist/internal/shared/constants.d.ts +2 -1
- package/dist/internal/shared/constants.js +2 -0
- package/dist/internal/shared/constants.js.map +1 -1
- package/dist/internal/shared/contract/host-state.cjs +38 -0
- package/dist/internal/shared/contract/host-state.cjs.map +1 -0
- package/dist/internal/shared/contract/host-state.d.ts +53 -0
- package/dist/internal/shared/contract/host-state.js +14 -0
- package/dist/internal/shared/contract/host-state.js.map +1 -0
- package/dist/internal/shared/contract/resolve-name-from-src.cjs +40 -0
- package/dist/internal/shared/contract/resolve-name-from-src.cjs.map +1 -0
- package/dist/internal/shared/contract/resolve-name-from-src.d.ts +13 -0
- package/dist/internal/shared/contract/resolve-name-from-src.js +16 -0
- package/dist/internal/shared/contract/resolve-name-from-src.js.map +1 -0
- package/dist/internal/shared/error.cjs +70 -0
- package/dist/internal/shared/error.cjs.map +1 -1
- package/dist/internal/shared/error.d.ts +3 -1
- package/dist/internal/shared/error.js +71 -0
- package/dist/internal/shared/error.js.map +1 -1
- package/dist/internal/shared/ssr/dom-flight.d.ts +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.d.ts +1 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.cjs +7 -2
- package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +1 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.d.ts +1 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.js +7 -2
- package/dist/internal/shared/ssr/fetch-with-hooks.js.map +1 -1
- package/dist/internal/shared/utils/logger.cjs +26 -10
- package/dist/internal/shared/utils/logger.cjs.map +1 -1
- package/dist/internal/shared/utils/logger.d.ts +6 -1
- package/dist/internal/shared/utils/logger.js +24 -9
- package/dist/internal/shared/utils/logger.js.map +1 -1
- package/dist/next/config.cjs +2 -2
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +2 -2
- package/dist/next/config.js.map +1 -1
- package/dist/next/host/app-router-server.cjs.map +1 -1
- package/dist/next/host/app-router-server.d.ts +11 -41
- package/dist/next/host/app-router-server.js.map +1 -1
- package/dist/next/host/client/index.cjs +467 -298
- package/dist/next/host/client/index.cjs.map +1 -1
- package/dist/next/host/client/index.d.ts +3 -1
- package/dist/next/host/client/index.js +445 -277
- package/dist/next/host/client/index.js.map +1 -1
- package/dist/next/host/pages-router-client.cjs +15 -2
- package/dist/next/host/pages-router-client.cjs.map +1 -1
- package/dist/next/host/pages-router-client.d.ts +14 -26
- package/dist/next/host/pages-router-client.js +15 -2
- package/dist/next/host/pages-router-client.js.map +1 -1
- package/dist/next/host/pages-router-server.cjs +2 -0
- package/dist/next/host/pages-router-server.cjs.map +1 -1
- package/dist/next/host/pages-router-server.d.ts +17 -31
- package/dist/next/host/pages-router-server.js +2 -0
- package/dist/next/host/pages-router-server.js.map +1 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.ts +13 -39
- package/dist/next/index.js.map +1 -1
- package/dist/next/proxy.cjs +33 -6
- package/dist/next/proxy.cjs.map +1 -1
- package/dist/next/proxy.js +33 -6
- package/dist/next/proxy.js.map +1 -1
- package/dist/next/remote/server.d.ts +4 -0
- package/dist/proxy-through-host-a676a522.d.ts +52 -0
- package/dist/react/index.cjs +486 -298
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +27 -40
- package/dist/react/index.js +463 -277
- package/dist/react/index.js.map +1 -1
- package/dist/shared/host/proxy.cjs +32 -6
- package/dist/shared/host/proxy.cjs.map +1 -1
- package/dist/shared/host/proxy.js +36 -7
- package/dist/shared/host/proxy.js.map +1 -1
- package/dist/{types-cbe44b51.d.ts → types-2b26a246.d.ts} +23 -6
- package/package.json +1 -1
- package/dist/internal/shared/client/fetch-with-protected-rc-fallback.cjs +0 -65
- package/dist/internal/shared/client/fetch-with-protected-rc-fallback.cjs.map +0 -1
- package/dist/internal/shared/client/fetch-with-protected-rc-fallback.d.ts +0 -13
- package/dist/internal/shared/client/fetch-with-protected-rc-fallback.js +0 -41
- package/dist/internal/shared/client/fetch-with-protected-rc-fallback.js.map +0 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { R as ResolveClientUrl } from '../proxy-through-host-a676a522.js';
|
|
3
|
+
export { p as proxyClientRequestsThroughHost } from '../proxy-through-host-a676a522.js';
|
|
4
|
+
import { H as HostConfig, C as ClientHostConfig, a as HostLifecycleCallbacks, L as LoadRemoteComponentProps } from '../component-loader-21865da3.js';
|
|
5
|
+
export { b as HookOptions, O as OnRequestHook, c as OnResponseHook } from '../component-loader-21865da3.js';
|
|
4
6
|
import 'react';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Client-side context provider for passing `resolveClientUrl` to all nested
|
|
10
|
+
* `<RemoteComponent>` instances. Since `resolveClientUrl` is a function, it
|
|
11
|
+
* can't be passed as a prop through Server Components — this provider should
|
|
12
|
+
* wrap the tree in a Client Component boundary so the callback is available
|
|
13
|
+
* on the client where asset fetches happen.
|
|
14
|
+
*/
|
|
15
|
+
declare function RemoteComponentsProvider({ resolveClientUrl, children, }: {
|
|
16
|
+
resolveClientUrl?: ResolveClientUrl;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
6
20
|
declare module 'react/jsx-runtime' {
|
|
7
21
|
namespace JSX {
|
|
8
22
|
interface IntrinsicElements {
|
|
@@ -18,45 +32,18 @@ declare module 'react/jsx-runtime' {
|
|
|
18
32
|
}
|
|
19
33
|
}
|
|
20
34
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
reset?: boolean;
|
|
30
|
-
/** The credentials to use for the fetch request. Defaults to `same-origin`. */
|
|
31
|
-
credentials?: RequestCredentials;
|
|
32
|
-
name?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Props for the React remote component host.
|
|
37
|
+
*
|
|
38
|
+
* Extends {@link HostConfig}, {@link ClientHostConfig}, and
|
|
39
|
+
* {@link HostLifecycleCallbacks}. Adds `shared` for module sharing and
|
|
40
|
+
* `children` for loading fallback content.
|
|
41
|
+
*/
|
|
42
|
+
interface RemoteComponentProps extends HostConfig, ClientHostConfig, HostLifecycleCallbacks {
|
|
33
43
|
/** Shared modules to include in the remote component's context. */
|
|
34
44
|
shared?: LoadRemoteComponentProps['shared'];
|
|
35
|
-
/**
|
|
45
|
+
/** Loading fallback content displayed while the remote component is being fetched. */
|
|
36
46
|
children?: React.ReactNode;
|
|
37
|
-
/** Called right before a new remote component load starts. */
|
|
38
|
-
onBeforeLoad?: (src: string | URL) => void;
|
|
39
|
-
/** Called when the remote component has been successfully loaded and mounted. */
|
|
40
|
-
onLoad?: (src: string | URL) => void;
|
|
41
|
-
/** Called when an error occurs while loading or mounting the remote component. */
|
|
42
|
-
onError?: (error: unknown) => void;
|
|
43
|
-
/** Called when a different remote component is loaded into the same wrapper. */
|
|
44
|
-
onChange?: (info: {
|
|
45
|
-
previousSrc: string | URL | null;
|
|
46
|
-
nextSrc: string | URL | null;
|
|
47
|
-
previousName: string | undefined;
|
|
48
|
-
nextName: string | undefined;
|
|
49
|
-
}) => void;
|
|
50
|
-
/**
|
|
51
|
-
* Called when a fetch request is made to retrieve the remote component payload.
|
|
52
|
-
* Can be used to intercept requests, modify headers, or provide a custom response.
|
|
53
|
-
*/
|
|
54
|
-
onRequest?: OnRequestHook;
|
|
55
|
-
/**
|
|
56
|
-
* Called after a fetch completes to retrieve the remote component payload.
|
|
57
|
-
* Can be used to inspect the response (e.g., check for redirects) or transform it.
|
|
58
|
-
*/
|
|
59
|
-
onResponse?: OnResponseHook;
|
|
60
47
|
}
|
|
61
48
|
/**
|
|
62
49
|
* RemoteComponent is a React component that fetches and renders a remote component.
|
|
@@ -94,6 +81,6 @@ interface RemoteComponentProps {
|
|
|
94
81
|
* />
|
|
95
82
|
* ```
|
|
96
83
|
*/
|
|
97
|
-
declare function RemoteComponent({ src, isolate, mode, reset, credentials, name: nameProp, shared, children, onBeforeLoad, onLoad, onError, onChange, onRequest, onResponse, }: RemoteComponentProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
declare function RemoteComponent({ src, isolate, mode, reset, credentials, name: nameProp, shared, children, onBeforeLoad, onLoad, onError, onChange, onRequest, onResponse, resolveClientUrl: _resolveClientUrl, }: RemoteComponentProps): react_jsx_runtime.JSX.Element;
|
|
98
85
|
|
|
99
|
-
export {
|
|
86
|
+
export { RemoteComponent, RemoteComponentProps, RemoteComponentsProvider, ResolveClientUrl };
|