Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bridge-react): change all logs from info to debug in all bridge packages #3360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/brave-boxes-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@module-federation/bridge-react': patch
'@module-federation/bridge-vue3': patch
---

fix(bridge-react): change all logs from info to debug in all bridge packages
6 changes: 3 additions & 3 deletions packages/bridge/bridge-react/src/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createLazyRemoteComponent<T, E extends keyof T>(
) {
const exportName = info?.export || 'default';
return React.lazy(async () => {
LoggerInstance.log(`createRemoteComponent LazyComponent create >>>`, {
LoggerInstance.debug(`createRemoteComponent LazyComponent create >>>`, {
lazyComponent: info.loader,
exportName,
});
Expand All @@ -39,7 +39,7 @@ function createLazyRemoteComponent<T, E extends keyof T>(
const m = (await info.loader()) as RemoteModule;
// @ts-ignore
const moduleName = m && m[Symbol.for('mf_module_id')];
LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent loadRemote info >>>`,
{ name: moduleName, module: m, exportName },
);
Expand Down Expand Up @@ -71,7 +71,7 @@ function createLazyRemoteComponent<T, E extends keyof T>(
default: RemoteAppComponent,
};
} else {
LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent module not found >>>`,
{ name: moduleName, module: m, exportName },
);
Expand Down
6 changes: 3 additions & 3 deletions packages/bridge/bridge-react/src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
return () => {
const rootMap = new Map<any, RootType>();
const instance = federationRuntime.instance;
LoggerInstance.log(
LoggerInstance.debug(
`createBridgeComponent instance from props >>>`,
instance,
);
Expand All @@ -53,7 +53,7 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {

return {
async render(info: RenderParams) {
LoggerInstance.log(`createBridgeComponent render Info`, info);
LoggerInstance.debug(`createBridgeComponent render Info`, info);
const {
moduleName,
dom,
Expand Down Expand Up @@ -102,7 +102,7 @@ export function createBridgeComponent<T>(bridgeInfo: ProviderFnParams<T>) {
},

async destroy(info: DestroyParams) {
LoggerInstance.log(`createBridgeComponent destroy Info`, {
LoggerInstance.debug(`createBridgeComponent destroy Info`, {
dom: info.dom,
});
instance?.bridgeHook?.lifecycle?.beforeBridgeDestroy?.emit(info);
Expand Down
23 changes: 13 additions & 10 deletions packages/bridge/bridge-react/src/remote/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const RemoteAppWrapper = forwardRef(function (
ref,
) {
const RemoteApp = () => {
LoggerInstance.log(`RemoteAppWrapper RemoteApp props >>>`, { props });
LoggerInstance.debug(`RemoteAppWrapper RemoteApp props >>>`, { props });
const {
moduleName,
memoryRoute,
Expand All @@ -62,7 +62,7 @@ const RemoteAppWrapper = forwardRef(function (
const renderDom: React.MutableRefObject<HTMLElement | null> = useRef(null);
const providerInfoRef = useRef<any>(null);

LoggerInstance.log(`RemoteAppWrapper instance from props >>>`, instance);
LoggerInstance.debug(`RemoteAppWrapper instance from props >>>`, instance);

useEffect(() => {
const renderTimeout = setTimeout(() => {
Expand All @@ -78,12 +78,12 @@ const RemoteAppWrapper = forwardRef(function (
...resProps,
};
renderDom.current = rootRef.current;
LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent render >>>`,
renderProps,
);

LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent hostInstance >>>`,
instance,
);
Expand All @@ -101,7 +101,7 @@ const RemoteAppWrapper = forwardRef(function (
clearTimeout(renderTimeout);
setTimeout(() => {
if (providerInfoRef.current?.destroy) {
LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent destroy >>>`,
{ moduleName, basename, dom: renderDom.current },
);
Expand Down Expand Up @@ -206,7 +206,7 @@ export function withRouterData<
}
}

LoggerInstance.log(`createRemoteComponent withRouterData >>>`, {
LoggerInstance.debug(`createRemoteComponent withRouterData >>>`, {
...props,
basename,
routerContextVal,
Expand All @@ -219,10 +219,13 @@ export function withRouterData<

useEffect(() => {
if (pathname !== '' && pathname !== location.pathname) {
LoggerInstance.log(`createRemoteComponent dispatchPopstateEnv >>>`, {
name: props.name,
pathname: location.pathname,
});
LoggerInstance.debug(
`createRemoteComponent dispatchPopstateEnv >>>`,
{
name: props.name,
pathname: location.pathname,
},
);
dispatchPopstateEnv();
}
setPathname(location.pathname);
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/bridge-react/src/router-v5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function WraperRouter(
const { basename, ...propsRes } = props;
const routerContextProps = useContext(RouterContext) || {};

LoggerInstance.log(`WraperRouter info >>>`, {
LoggerInstance.debug(`WraperRouter info >>>`, {
...routerContextProps,
routerContextProps,
WraperRouterProps: props,
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge/bridge-react/src/router-v6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function WraperRouter(
const { basename, ...propsRes } = props;
const routerContextProps = useContext(RouterContext) || {};

LoggerInstance.log(`WraperRouter info >>>`, {
LoggerInstance.debug(`WraperRouter info >>>`, {
...routerContextProps,
routerContextProps,
WraperRouterProps: props,
Expand Down Expand Up @@ -41,7 +41,7 @@ function WraperRouterProvider(
const { router, ...propsRes } = props;
const routerContextProps = useContext(RouterContext) || {};
const routers = router.routes;
LoggerInstance.log(`WraperRouterProvider info >>>`, {
LoggerInstance.debug(`WraperRouterProvider info >>>`, {
...routerContextProps,
routerContextProps,
WraperRouterProviderProps: props,
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge/bridge-react/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function WrapperRouter(
const { basename, ...propsRes } = props;
const routerContextProps = useContext(RouterContext) || {};

LoggerInstance.log(`WrapperRouter info >>>`, {
LoggerInstance.debug(`WrapperRouter info >>>`, {
...routerContextProps,
routerContextProps,
WrapperRouterProps: props,
Expand Down Expand Up @@ -40,7 +40,7 @@ function WrapperRouterProvider(
const { router, ...propsRes } = props;
const routerContextProps = useContext(RouterContext) || {};
const routers = router.routes;
LoggerInstance.log(`WrapperRouterProvider info >>>`, {
LoggerInstance.debug(`WrapperRouterProvider info >>>`, {
...routerContextProps,
routerContextProps,
WrapperRouterProviderProps: props,
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge/vue3-bridge/src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function createRemoteComponent(info: {
}

const exportName = info?.export || 'default';
LoggerInstance.log(`createRemoteComponent LazyComponent create >>>`, {
LoggerInstance.debug(`createRemoteComponent LazyComponent create >>>`, {
basename,
info,
});
Expand All @@ -37,7 +37,7 @@ export function createRemoteComponent(info: {
const moduleName = module && module[Symbol.for('mf_module_id')];
const exportFn = module[exportName];

LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent loadRemote info >>>`,
{ name: moduleName, module, exportName, basename, route },
);
Expand Down
6 changes: 3 additions & 3 deletions packages/bridge/vue3-bridge/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function createBridgeComponent(bridgeInfo: any) {
return {
__APP_VERSION__,
render(info: RenderFnParams) {
LoggerInstance.log(`createBridgeComponent render Info`, info);
LoggerInstance.debug(`createBridgeComponent render Info`, info);
const app = Vue.createApp(bridgeInfo.rootComponent);
rootMap.set(info.dom, app);

Expand Down Expand Up @@ -43,7 +43,7 @@ export function createBridgeComponent(bridgeInfo: any) {
routes: appOptions.router.getRoutes(),
});

LoggerInstance.log(`createBridgeComponent render router info>>>`, {
LoggerInstance.debug(`createBridgeComponent render router info>>>`, {
name: info.moduleName,
router,
});
Expand All @@ -61,7 +61,7 @@ export function createBridgeComponent(bridgeInfo: any) {
instance?.bridgeHook?.lifecycle?.afterBridgeRender?.emit(info) || {};
},
destroy(info: { dom: HTMLElement }) {
LoggerInstance.log(`createBridgeComponent destroy Info`, info);
LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
const root = rootMap.get(info?.dom);

instance?.bridgeHook?.lifecycle?.beforeBridgeDestroy?.emit(info);
Expand Down
15 changes: 9 additions & 6 deletions packages/bridge/vue3-bridge/src/remoteApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineComponent({
basename: props.basename,
memoryRoute: props.memoryRoute,
};
LoggerInstance.log(
LoggerInstance.debug(
`createRemoteComponent LazyComponent render >>>`,
renderProps,
);
Expand All @@ -53,10 +53,13 @@ export default defineComponent({

// dispatchPopstateEnv
if (pathname.value !== '' && pathname.value !== newPath) {
LoggerInstance.log(`createRemoteComponent dispatchPopstateEnv >>>`, {
...props,
pathname: route.path,
});
LoggerInstance.debug(
`createRemoteComponent dispatchPopstateEnv >>>`,
{
...props,
pathname: route.path,
},
);
dispatchPopstateEnv();
}
pathname.value = newPath;
Expand All @@ -68,7 +71,7 @@ export default defineComponent({
});

onBeforeUnmount(() => {
LoggerInstance.log(`createRemoteComponent LazyComponent destroy >>>`, {
LoggerInstance.debug(`createRemoteComponent LazyComponent destroy >>>`, {
...props,
});
watchStopHandle();
Expand Down
Loading