@modern-js/plugin-garfish 2.40.0 → 2.42.0
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/esm/runtime/utils/apps.js +6 -6
- package/dist/types/cli/index.d.ts +6 -9
- package/dist/types/cli/utils.d.ts +1 -1
- package/dist/types/deps/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/runtime/index.d.ts +1 -1
- package/dist/types/runtime/loadable.d.ts +6 -6
- package/dist/types/runtime/plugin.d.ts +1 -1
- package/dist/types/runtime/useModuleApps.d.ts +24 -22
- package/dist/types/runtime/utils/Context.d.ts +4 -4
- package/dist/types/runtime/utils/MApp.d.ts +6 -6
- package/dist/types/runtime/utils/apps.d.ts +6 -6
- package/dist/types/runtime/utils/setExternal.d.ts +1 -1
- package/dist/types/util.d.ts +1 -1
- package/package.json +13 -13
|
@@ -32,7 +32,8 @@ function pathJoin() {
|
|
|
32
32
|
return res || "/";
|
|
33
33
|
}
|
|
34
34
|
function getAppInstance(options, appInfo, manifest) {
|
|
35
|
-
var
|
|
35
|
+
var locationHref = "";
|
|
36
|
+
function MicroApp(props) {
|
|
36
37
|
var _context_router_useRouteMatch, _context_router, _context_router_useMatches, _context_router1, _context_router_useLocation, _context_router2;
|
|
37
38
|
var appRef = useRef(null);
|
|
38
39
|
var domId = generateSubAppContainerKey(appInfo);
|
|
@@ -63,6 +64,9 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
63
64
|
location
|
|
64
65
|
]);
|
|
65
66
|
useEffect(function() {
|
|
67
|
+
var renderApp = function renderApp2() {
|
|
68
|
+
return _renderApp.apply(this, arguments);
|
|
69
|
+
};
|
|
66
70
|
var setLoadingState = props.setLoadingState, userProps = _object_without_properties(props, [
|
|
67
71
|
"setLoadingState"
|
|
68
72
|
]);
|
|
@@ -110,9 +114,6 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
110
114
|
logger('MicroApp Garfish.loadApp "'.concat(appInfo.name, '"'), {
|
|
111
115
|
loadAppOptions
|
|
112
116
|
});
|
|
113
|
-
function renderApp() {
|
|
114
|
-
return _renderApp.apply(this, arguments);
|
|
115
|
-
}
|
|
116
117
|
function _renderApp() {
|
|
117
118
|
_renderApp = _async_to_generator(function() {
|
|
118
119
|
var appInstance, error;
|
|
@@ -215,8 +216,7 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
215
216
|
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, {})
|
|
216
217
|
})
|
|
217
218
|
});
|
|
218
|
-
}
|
|
219
|
-
var locationHref = "";
|
|
219
|
+
}
|
|
220
220
|
return Loadable(MicroApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
|
|
221
221
|
}
|
|
222
222
|
function generateApps(options, manifest) {
|
|
@@ -2,17 +2,14 @@ import type { CliHookCallbacks, useConfigContext } from '@modern-js/core';
|
|
|
2
2
|
import type { CliPlugin, AppTools } from '@modern-js/app-tools';
|
|
3
3
|
export type UseConfig = ReturnType<typeof useConfigContext>;
|
|
4
4
|
export declare const externals: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
'react-dom': string;
|
|
6
|
+
react: string;
|
|
7
7
|
};
|
|
8
8
|
export type LifeCycle = CliHookCallbacks;
|
|
9
9
|
type NonInValidAble<T> = T extends null | undefined | false ? never : T;
|
|
10
10
|
export declare function getDefaultMicroFrontedConfig(microFrontend: NonInValidAble<NonNullable<UseConfig['deploy']>['microFrontend']>): any;
|
|
11
|
-
export declare const garfishPlugin: ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}?: {
|
|
15
|
-
pluginName?: string | undefined;
|
|
16
|
-
runtimePluginName?: string | undefined;
|
|
11
|
+
export declare const garfishPlugin: ({ pluginName, runtimePluginName, }?: {
|
|
12
|
+
pluginName?: string | undefined;
|
|
13
|
+
runtimePluginName?: string | undefined;
|
|
17
14
|
}) => CliPlugin<AppTools>;
|
|
18
|
-
export default garfishPlugin;
|
|
15
|
+
export default garfishPlugin;
|
|
@@ -3,4 +3,4 @@ export declare const makeProvider: () => string;
|
|
|
3
3
|
export declare const makeRenderFunction: (code: string) => string;
|
|
4
4
|
export declare function getRuntimeConfig(config: Partial<AppNormalizedConfig>): any;
|
|
5
5
|
export declare function setRuntimeConfig(config: Partial<AppNormalizedConfig>, key: string, value: any): undefined;
|
|
6
|
-
export declare const generateAsyncEntry: (code: string) => string;
|
|
6
|
+
export declare const generateAsyncEntry: (code: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as hoistNonReactStatics } from 'hoist-non-react-statics';
|
|
1
|
+
export { default as hoistNonReactStatics } from 'hoist-non-react-statics';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './runtime';
|
|
2
|
-
export * from './runtime';
|
|
2
|
+
export * from './runtime';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './plugin';
|
|
2
2
|
export { useModuleApps, useModuleApp } from './useModuleApps';
|
|
3
3
|
export type { Manifest, ModuleInfo, Config } from './useModuleApps';
|
|
4
|
-
export { default as Garfish, default as garfish } from 'garfish';
|
|
4
|
+
export { default as Garfish, default as garfish } from 'garfish';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LoadableConfig, MicroComponentProps } from './useModuleApps';
|
|
3
3
|
export interface MicroProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
setLoadingState: (state: {
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
}) => void;
|
|
8
|
+
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
-
export declare function Loadable(WrapComponent: any): (defaultLoadable?: LoadableConfig) => (props: MicroComponentProps) => JSX.Element;
|
|
10
|
+
export declare function Loadable(WrapComponent: any): (defaultLoadable?: LoadableConfig) => (props: MicroComponentProps) => JSX.Element;
|
|
@@ -2,40 +2,42 @@ import garfish, { interfaces as GarfishInterfaces } from 'garfish';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export type Options = typeof garfish.options;
|
|
4
4
|
export type ModuleInfo = GarfishInterfaces.AppInfo & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Component?: React.ComponentType | React.ElementType;
|
|
6
|
+
path?: string;
|
|
7
|
+
originInfo?: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
9
|
export type ModulesInfo = Array<ModuleInfo>;
|
|
10
10
|
export type Manifest = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
modules?: ModulesInfo;
|
|
12
|
+
loadable?: LoadableConfig;
|
|
13
|
+
componentRender?: boolean;
|
|
14
|
+
getAppList?: (info: any) => Promise<Array<GarfishInterfaces.AppInfo>>;
|
|
15
15
|
};
|
|
16
16
|
export type LoadingComponent = React.ComponentType<{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
pastDelay: boolean;
|
|
19
|
+
timedOut: boolean;
|
|
20
|
+
error: any;
|
|
21
|
+
retry: () => void;
|
|
22
22
|
}>;
|
|
23
23
|
export interface LoadableConfig {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
timeout?: number;
|
|
25
|
+
delay?: number;
|
|
26
|
+
loading?: LoadingComponent;
|
|
27
27
|
}
|
|
28
28
|
export type ModernGarfishConfig = {
|
|
29
|
-
|
|
29
|
+
manifest?: Manifest;
|
|
30
30
|
};
|
|
31
31
|
export type MicroComponentProps = {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
loadable?: LoadableConfig;
|
|
33
|
+
[index: string]: any;
|
|
34
34
|
};
|
|
35
35
|
export type Config = Partial<Options> & ModernGarfishConfig;
|
|
36
|
-
export type UseModuleApps = {
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
export type UseModuleApps = {
|
|
37
|
+
[index in 'apps' | string]: index extends 'apps' ? ModulesInfo : React.FC<MicroComponentProps>;
|
|
38
|
+
} & {
|
|
39
|
+
readonly MApp: React.FC<MicroComponentProps>;
|
|
40
|
+
readonly apps: ModulesInfo;
|
|
39
41
|
};
|
|
40
42
|
export declare function useModuleApps(): UseModuleApps;
|
|
41
|
-
export declare function useModuleApp(): React.FC<any>;
|
|
43
|
+
export declare function useModuleApp(): React.FC<any>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ModulesInfo } from '../useModuleApps';
|
|
3
3
|
export interface GarfishContextType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
MApp: React.FC<any>;
|
|
5
|
+
apps: Record<string, React.FC<any>>;
|
|
6
|
+
appInfoList: ModulesInfo;
|
|
7
7
|
}
|
|
8
8
|
declare const GarfishContext: React.Context<GarfishContextType>;
|
|
9
9
|
declare const GarfishProvider: React.Provider<GarfishContextType>;
|
|
10
|
-
export { GarfishContext, GarfishProvider };
|
|
10
|
+
export { GarfishContext, GarfishProvider };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import Garfish from 'garfish';
|
|
3
3
|
import { Manifest, ModulesInfo } from '../useModuleApps';
|
|
4
4
|
declare global {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
interface Window {
|
|
6
|
+
modern_manifest?: {
|
|
7
|
+
modules: ModulesInfo;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
10
|
}
|
|
11
|
-
export declare function generateMApp(options: typeof Garfish.options, manifest?: Manifest): (props: import("../useModuleApps").MicroComponentProps) => JSX.Element;
|
|
11
|
+
export declare function generateMApp(options: typeof Garfish.options, manifest?: Manifest): (props: import("../useModuleApps").MicroComponentProps) => JSX.Element;
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import Garfish, { interfaces } from 'garfish';
|
|
3
3
|
import { Manifest, MicroComponentProps, ModulesInfo } from '../useModuleApps';
|
|
4
4
|
export interface Provider extends interfaces.Provider {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
SubModuleComponent?: React.ComponentType<any>;
|
|
6
|
+
jupiter_submodule_app_key?: React.ComponentType<any>;
|
|
7
7
|
}
|
|
8
8
|
export interface AppMap {
|
|
9
|
-
|
|
9
|
+
[key: string]: React.FC<MicroComponentProps>;
|
|
10
10
|
}
|
|
11
11
|
export declare function pathJoin(...args: string[]): string;
|
|
12
12
|
export declare function generateApps(options: typeof Garfish.options, manifest?: Manifest): {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
13
|
+
apps: AppMap;
|
|
14
|
+
appInfoList: ModulesInfo;
|
|
15
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const _default: () => void;
|
|
2
|
-
export default _default;
|
|
2
|
+
export default _default;
|
package/dist/types/util.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import createDebug from 'debug';
|
|
|
5
5
|
import { ModuleInfo } from './runtime';
|
|
6
6
|
export declare const logger: createDebug.Debugger;
|
|
7
7
|
export declare const SUBMODULE_APP_COMPONENT_KEY = "SubModuleComponent";
|
|
8
|
-
export declare function generateSubAppContainerKey(moduleInfo?: ModuleInfo): string;
|
|
8
|
+
export declare function generateSubAppContainerKey(moduleInfo?: ModuleInfo): string;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.42.0",
|
|
19
19
|
"jsnext:source": "./src/cli/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"typesVersions": {
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@types/debug": "
|
|
66
|
+
"@types/debug": "4.1.7",
|
|
67
67
|
"@types/react-loadable": "^5.5.6",
|
|
68
|
-
"debug": "
|
|
68
|
+
"debug": "4.3.4",
|
|
69
69
|
"garfish": "^1.8.1",
|
|
70
70
|
"hoist-non-react-statics": "^3.3.2",
|
|
71
71
|
"react-loadable": "^5.5.0",
|
|
72
|
-
"@swc/helpers": "0.5.
|
|
73
|
-
"@modern-js/utils": "2.
|
|
72
|
+
"@swc/helpers": "0.5.3",
|
|
73
|
+
"@modern-js/utils": "2.42.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@modern-js/runtime": "^2.
|
|
76
|
+
"@modern-js/runtime": "^2.42.0",
|
|
77
77
|
"react": ">=17",
|
|
78
78
|
"react-dom": ">=17"
|
|
79
79
|
},
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
"react-dom": "^18",
|
|
92
92
|
"react-router-dom": "6.17.0",
|
|
93
93
|
"typescript": "^5",
|
|
94
|
-
"@modern-js/
|
|
95
|
-
"@modern-js/
|
|
96
|
-
"@modern-js/
|
|
97
|
-
"@modern-js/
|
|
98
|
-
"@modern-js/types": "2.
|
|
99
|
-
"@scripts/build": "2.
|
|
100
|
-
"@scripts/jest-config": "2.
|
|
94
|
+
"@modern-js/core": "2.42.0",
|
|
95
|
+
"@modern-js/plugin-router-v5": "2.42.0",
|
|
96
|
+
"@modern-js/runtime": "2.42.0",
|
|
97
|
+
"@modern-js/app-tools": "2.42.0",
|
|
98
|
+
"@modern-js/types": "2.42.0",
|
|
99
|
+
"@scripts/build": "2.42.0",
|
|
100
|
+
"@scripts/jest-config": "2.42.0"
|
|
101
101
|
},
|
|
102
102
|
"sideEffects": false,
|
|
103
103
|
"publishConfig": {
|