@vercel/microfrontends
Version:
Defines configuration and utilities for microfrontends development
41 lines (35 loc) • 1.68 kB
TypeScript
import * as react from 'react';
import react__default, { AnchorHTMLAttributes } from 'react';
import { LinkProps as LinkProps$1 } from 'next/link.js';
import { Image as Image$1 } from 'next/dist/client/image-component.js';
interface BaseProps {
children: React.ReactNode;
href: string;
}
interface NextLinkProps extends LinkProps$1 {
}
type LinkProps = BaseProps & Omit<NextLinkProps, keyof BaseProps> & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseProps>;
declare function useZoneForHref(href: LinkProps['href'] | undefined): {
zoneOfHref: string | null;
isDifferentZone: boolean;
isLoading: boolean;
};
/**
* A Link component that works with microfrontend set-ups and will prefetch the
* cross zone links automatically.
*/
declare const Link: react.ForwardRefExoticComponent<BaseProps & Omit<NextLinkProps, keyof BaseProps> & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseProps> & react.RefAttributes<HTMLAnchorElement>>;
interface PrefetchCrossZoneLinksContext {
prefetchHref: (href: string) => void;
}
declare const PrefetchCrossZoneLinksContext: react__default.Context<PrefetchCrossZoneLinksContext>;
declare function PrefetchCrossZoneLinksProvider({ children, }: {
children: react__default.ReactNode;
}): JSX.Element | null;
declare function PrefetchCrossZoneLinks(): JSX.Element | null;
/**
* A Image component that prefixes microfrontend child zones with the asset prefix
* to ensure the image request is routed to the correct zone.
*/
declare const Image: typeof Image$1;
export { Image, Link, LinkProps, PrefetchCrossZoneLinks, PrefetchCrossZoneLinksContext, PrefetchCrossZoneLinksProvider, useZoneForHref };