File tree Expand file tree Collapse file tree 12 files changed +38
-38
lines changed Expand file tree Collapse file tree 12 files changed +38
-38
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/runtime ' : patch
3
+ ' @module-federation/sdk ' : patch
4
+ ---
5
+
6
+ Remove duplicated util functions and referecne central ones
Original file line number Diff line number Diff line change 1
1
import type { CreateScriptHookReturn } from '@module-federation/sdk' ;
2
+ import { isBrowserEnv } from '@module-federation/sdk' ;
2
3
import {
3
4
Options ,
4
5
PreloadRemoteArgs ,
@@ -25,7 +26,6 @@ import {
25
26
} from './utils/hooks' ;
26
27
import { generatePreloadAssetsPlugin } from './plugins/generate-preload-assets' ;
27
28
import { snapshotPlugin } from './plugins/snapshot' ;
28
- import { isBrowserEnv } from './utils/env' ;
29
29
import { getRemoteInfo } from './utils/load' ;
30
30
import { DEFAULT_SCOPE } from './constant' ;
31
31
import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler' ;
Original file line number Diff line number Diff line change @@ -6,8 +6,12 @@ import {
6
6
Optional ,
7
7
} from './type' ;
8
8
import { getFMId } from './utils/tool' ;
9
- import { GlobalModuleInfo , ModuleInfo } from '@module-federation/sdk' ;
10
- import { getBuilderId , isDebugMode } from './utils/env' ;
9
+ import {
10
+ GlobalModuleInfo ,
11
+ ModuleInfo ,
12
+ isDebugMode ,
13
+ } from '@module-federation/sdk' ;
14
+ import { getBuilderId } from './utils/env' ;
11
15
import { warn } from './utils/logger' ;
12
16
import { FederationRuntimePlugin } from './type/plugin' ;
13
17
Original file line number Diff line number Diff line change 1
- import { getFMId , safeToString , assert } from '../utils' ;
1
+ import { getFMId , assert } from '../utils' ;
2
+ import { safeToString } from '@module-federation/sdk' ;
2
3
import { getRemoteEntry } from '../utils/load' ;
3
4
import { FederationHost } from '../core' ;
4
5
import { RemoteEntryExports , RemoteInfo , InitScope } from '../type' ;
Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ import {
4
4
ModuleInfo ,
5
5
generateSnapshotFromManifest ,
6
6
isManifestProvider ,
7
+ isBrowserEnv ,
7
8
} from '@module-federation/sdk' ;
8
9
import { Optional , Options , Remote } from '../../type' ;
9
10
import {
10
11
isRemoteInfoWithEntry ,
11
12
error ,
12
13
getRemoteEntryInfoFromSnapshot ,
13
- isBrowserEnv ,
14
14
} from '../../utils' ;
15
15
import {
16
16
getGlobalSnapshot ,
Original file line number Diff line number Diff line change 1
- import { ModuleInfo , getResourceUrl } from '@module-federation/sdk' ;
2
- import { FederationRuntimePlugin } from '../../type/plugin' ;
3
1
import {
2
+ ModuleInfo ,
3
+ getResourceUrl ,
4
4
isBrowserEnv ,
5
+ } from '@module-federation/sdk' ;
6
+ import { FederationRuntimePlugin } from '../../type/plugin' ;
7
+ import {
5
8
error ,
6
9
isPureRemoteEntry ,
7
10
isRemoteInfoWithEntry ,
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import {
2
2
isBrowserEnv ,
3
3
warn ,
4
4
composeKeyWithSeparator ,
5
+ ModuleInfo ,
6
+ GlobalModuleInfo ,
5
7
} from '@module-federation/sdk' ;
6
8
import { Global , getInfoWithoutType , globalLoading } from '../global' ;
7
- import type { ModuleInfo , GlobalModuleInfo } from '@module-federation/sdk' ;
8
9
import {
9
10
Options ,
10
11
UserOptions ,
@@ -561,6 +562,7 @@ export class RemoteHandler {
561
562
if ( remoteKey ) {
562
563
delete hostGlobalSnapshot . remotesInfo [ remoteKey ] ;
563
564
if (
565
+ //eslint-disable-next-line no-extra-boolean-cast
564
566
Boolean ( Global . __FEDERATION__ . __MANIFEST_LOADING__ [ remoteKey ] )
565
567
) {
566
568
delete Global . __FEDERATION__ . __MANIFEST_LOADING__ [ remoteKey ] ;
Original file line number Diff line number Diff line change @@ -9,11 +9,3 @@ export function getBuilderId(): string {
9
9
FEDERATION_BUILD_IDENTIFIER
10
10
: '' ;
11
11
}
12
-
13
- export function isDebugMode ( ) : boolean {
14
- return typeof FEDERATION_DEBUG !== 'undefined' && Boolean ( FEDERATION_DEBUG ) ;
15
- }
16
-
17
- export function isBrowserEnv ( ) : boolean {
18
- return typeof window !== 'undefined' ;
19
- }
Original file line number Diff line number Diff line change 1
- import { createLink , createScript } from '@module-federation/sdk' ;
1
+ import { createLink , createScript , safeToString } from '@module-federation/sdk' ;
2
2
import {
3
3
PreloadAssets ,
4
4
PreloadConfig ,
@@ -10,7 +10,6 @@ import {
10
10
} from '../type' ;
11
11
import { matchRemote } from './manifest' ;
12
12
import { assert } from './logger' ;
13
- import { safeToString } from './tool' ;
14
13
import { FederationHost } from '../core' ;
15
14
import { getRemoteEntry } from './load' ;
16
15
Original file line number Diff line number Diff line change 1
- import type {
1
+ import {
2
2
RemoteWithEntry ,
3
3
ModuleInfo ,
4
4
RemoteEntryType ,
5
+ isBrowserEnv ,
5
6
} from '@module-federation/sdk' ;
6
- import { Remote , RemoteInfoOptionalVersion , UserOptions } from '../type' ;
7
+ import { Remote , RemoteInfoOptionalVersion } from '../type' ;
7
8
import { warn } from './logger' ;
8
- import { isBrowserEnv } from './env' ;
9
9
10
10
export function addUniqueItem ( arr : Array < string > , item : string ) : Array < string > {
11
11
if ( arr . findIndex ( ( name ) => name === item ) === - 1 ) {
@@ -50,15 +50,6 @@ export async function safeWrapper<T extends (...args: Array<any>) => any>(
50
50
}
51
51
}
52
52
53
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
54
- export function safeToString ( info : any ) : string {
55
- try {
56
- return JSON . stringify ( info , null , 2 ) ;
57
- } catch ( e ) {
58
- return '' ;
59
- }
60
- }
61
-
62
53
export function isObject ( val : any ) : boolean {
63
54
return val && typeof val === 'object' ;
64
55
}
You can’t perform that action at this time.
0 commit comments