@modern-js/plugin-garfish 2.4.0 → 2.5.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/CHANGELOG.md +26 -0
- package/dist/{js/node → cjs}/cli/index.js +10 -41
- package/dist/{js/node → cjs}/cli/utils.js +5 -2
- package/dist/{js/node → cjs}/deps/index.js +0 -0
- package/dist/{js/node → cjs}/index.js +0 -0
- package/dist/{js/node → cjs}/runtime/index.js +0 -0
- package/dist/{js/node → cjs}/runtime/loadable.js +11 -38
- package/dist/{js/node → cjs}/runtime/plugin.js +32 -79
- package/dist/{js/node → cjs}/runtime/useModuleApps.js +8 -20
- package/dist/{js/node → cjs}/runtime/utils/Context.js +0 -0
- package/dist/{js/node → cjs}/runtime/utils/MApp.js +4 -30
- package/dist/{js/node → cjs}/runtime/utils/apps.js +43 -88
- package/dist/{js/node → cjs}/runtime/utils/setExternal.js +0 -0
- package/dist/{js/node → cjs}/util.js +0 -0
- package/dist/{js/treeshaking → esm}/cli/index.js +22 -22
- package/dist/{js/treeshaking → esm}/cli/utils.js +8 -8
- package/dist/{js/treeshaking → esm}/deps/index.js +0 -0
- package/dist/{js/treeshaking → esm}/index.js +0 -0
- package/dist/{js/treeshaking → esm}/runtime/index.js +0 -0
- package/dist/{js/treeshaking → esm}/runtime/loadable.js +5 -5
- package/dist/{js/treeshaking → esm}/runtime/plugin.js +7 -7
- package/dist/{js/treeshaking → esm}/runtime/useModuleApps.js +1 -1
- package/dist/{js/treeshaking → esm}/runtime/utils/Context.js +0 -0
- package/dist/{js/treeshaking → esm}/runtime/utils/MApp.js +3 -3
- package/dist/{js/treeshaking → esm}/runtime/utils/apps.js +12 -12
- package/dist/{js/treeshaking → esm}/runtime/utils/setExternal.js +0 -0
- package/dist/{js/treeshaking → esm}/util.js +0 -0
- package/dist/{js/modern → esm-node}/cli/index.js +10 -43
- package/dist/{js/modern → esm-node}/cli/utils.js +5 -2
- package/dist/{js/modern → esm-node}/deps/index.js +0 -0
- package/dist/{js/modern → esm-node}/index.js +0 -0
- package/dist/{js/modern → esm-node}/runtime/index.js +0 -0
- package/dist/{js/modern → esm-node}/runtime/loadable.js +11 -40
- package/dist/esm-node/runtime/plugin.js +107 -0
- package/dist/esm-node/runtime/useModuleApps.js +36 -0
- package/dist/{js/modern → esm-node}/runtime/utils/Context.js +0 -0
- package/dist/{js/modern → esm-node}/runtime/utils/MApp.js +4 -32
- package/dist/{js/modern → esm-node}/runtime/utils/apps.js +43 -90
- package/dist/{js/modern → esm-node}/runtime/utils/setExternal.js +0 -0
- package/dist/{js/modern → esm-node}/util.js +0 -0
- package/package.json +16 -17
- package/dist/js/modern/runtime/plugin.js +0 -156
- package/dist/js/modern/runtime/useModuleApps.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @modern-js/plugin-garfish
|
|
2
2
|
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 89ca6cc: refactor: merge build-config into scripts/build
|
|
8
|
+
|
|
9
|
+
refactor: 把 build-config 合并进 scripts/build
|
|
10
|
+
|
|
11
|
+
- 30614fa: chore: modify package.json entry fields and build config
|
|
12
|
+
chore: 更改 package.json entry 字段以及构建配置
|
|
13
|
+
- 97cc2d0: feat: pass origin bootstrap function to custom render
|
|
14
|
+
feat: 自定义渲染中传入原始 bootstrap 函数
|
|
15
|
+
- b139eab: fix: avoid do not get provider when in micro-frontend mode
|
|
16
|
+
避免微前端模式下 provider 获取不到
|
|
17
|
+
- Updated dependencies [89ca6cc]
|
|
18
|
+
- Updated dependencies [7cb8bb4]
|
|
19
|
+
- Updated dependencies [30614fa]
|
|
20
|
+
- Updated dependencies [7a25271]
|
|
21
|
+
- Updated dependencies [8871bb8]
|
|
22
|
+
- Updated dependencies [1b0ce87]
|
|
23
|
+
- Updated dependencies [0d75c27]
|
|
24
|
+
- Updated dependencies [11c053b]
|
|
25
|
+
- Updated dependencies [a0f2ab1]
|
|
26
|
+
- @modern-js/runtime@2.5.0
|
|
27
|
+
- @modern-js/utils@2.5.0
|
|
28
|
+
|
|
3
29
|
## 2.4.0
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
5
|
var __export = (target, all) => {
|
|
20
6
|
for (var name in all)
|
|
21
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -29,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
29
15
|
return to;
|
|
30
16
|
};
|
|
31
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
18
|
var cli_exports = {};
|
|
53
19
|
__export(cli_exports, {
|
|
54
20
|
default: () => cli_default,
|
|
@@ -68,10 +34,11 @@ function getDefaultMicroFrontedConfig(microFrontend) {
|
|
|
68
34
|
moduleApp: ""
|
|
69
35
|
};
|
|
70
36
|
}
|
|
71
|
-
return
|
|
37
|
+
return {
|
|
72
38
|
enableHtmlEntry: true,
|
|
73
|
-
externalBasicLibrary: false
|
|
74
|
-
|
|
39
|
+
externalBasicLibrary: false,
|
|
40
|
+
...microFrontend
|
|
41
|
+
};
|
|
75
42
|
}
|
|
76
43
|
var cli_default = ({
|
|
77
44
|
pluginName = "@modern-js/plugin-garfish",
|
|
@@ -84,12 +51,14 @@ var cli_default = ({
|
|
|
84
51
|
validateSchema() {
|
|
85
52
|
return import_utils.PLUGIN_SCHEMAS["@modern-js/plugin-garfish"];
|
|
86
53
|
},
|
|
87
|
-
resolvedConfig: (config) =>
|
|
54
|
+
resolvedConfig: async (config) => {
|
|
88
55
|
var _a, _b;
|
|
89
56
|
const { resolved } = config;
|
|
90
57
|
const { masterApp, router } = (0, import_utils2.getRuntimeConfig)(resolved);
|
|
91
58
|
const nConfig = {
|
|
92
|
-
resolved:
|
|
59
|
+
resolved: {
|
|
60
|
+
...resolved
|
|
61
|
+
}
|
|
93
62
|
};
|
|
94
63
|
if (masterApp) {
|
|
95
64
|
const useConfig = useConfigContext();
|
|
@@ -103,7 +72,7 @@ var cli_default = ({
|
|
|
103
72
|
nConfig.resolved,
|
|
104
73
|
"masterApp",
|
|
105
74
|
Object.assign(
|
|
106
|
-
typeof masterApp === "object" ?
|
|
75
|
+
typeof masterApp === "object" ? { ...masterApp } : {},
|
|
107
76
|
{
|
|
108
77
|
basename: baseUrl || ((_b = router == null ? void 0 : router.historyOptions) == null ? void 0 : _b.basename) || (router == null ? void 0 : router.basename) || "/"
|
|
109
78
|
}
|
|
@@ -117,7 +86,7 @@ var cli_default = ({
|
|
|
117
86
|
server: nConfig.resolved.server
|
|
118
87
|
});
|
|
119
88
|
return nConfig;
|
|
120
|
-
}
|
|
89
|
+
},
|
|
121
90
|
config() {
|
|
122
91
|
var _a, _b, _c;
|
|
123
92
|
const useConfig = useConfigContext();
|
|
@@ -115,8 +115,8 @@ const makeRenderFunction = (code) => {
|
|
|
115
115
|
`bootstrap(AppWrapper, mountNode, root`,
|
|
116
116
|
"bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null"
|
|
117
117
|
).replace(
|
|
118
|
-
`customBootstrap(AppWrapper
|
|
119
|
-
"customBootstrap(AppWrapper, mountNode
|
|
118
|
+
`customBootstrap(AppWrapper`,
|
|
119
|
+
"customBootstrap(AppWrapper, mountNode"
|
|
120
120
|
);
|
|
121
121
|
};
|
|
122
122
|
function getRuntimeConfig(config) {
|
|
@@ -149,6 +149,9 @@ const generateAsyncEntry = (code) => {
|
|
|
149
149
|
return exports.provider.apply(null, args);
|
|
150
150
|
};
|
|
151
151
|
${transformCode}
|
|
152
|
+
if (typeof __GARFISH_EXPORTS__ !== 'undefined') {
|
|
153
|
+
__GARFISH_EXPORTS__.provider = provider;
|
|
154
|
+
}
|
|
152
155
|
`;
|
|
153
156
|
};
|
|
154
157
|
// Annotate the CommonJS export names for ESM import in node:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
5
|
var __export = (target, all) => {
|
|
35
6
|
for (var name in all)
|
|
36
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -60,8 +31,8 @@ const DEFAULT_LOADABLE = {
|
|
|
60
31
|
function Loadable(WrapComponent) {
|
|
61
32
|
return function(defaultLoadable) {
|
|
62
33
|
return function Lodable(props) {
|
|
63
|
-
var
|
|
64
|
-
const
|
|
34
|
+
var _a;
|
|
35
|
+
const { loadable = defaultLoadable != null ? defaultLoadable : DEFAULT_LOADABLE, ...otherProps } = props;
|
|
65
36
|
let delayTimer = null;
|
|
66
37
|
let timeoutTimer = null;
|
|
67
38
|
const [state, setState] = (0, import_react.useState)(() => {
|
|
@@ -88,7 +59,7 @@ function Loadable(WrapComponent) {
|
|
|
88
59
|
}
|
|
89
60
|
return initState;
|
|
90
61
|
});
|
|
91
|
-
const LoadingComponent = (
|
|
62
|
+
const LoadingComponent = (_a = props.loadable) == null ? void 0 : _a.loading;
|
|
92
63
|
(0, import_react.useEffect)(() => {
|
|
93
64
|
(0, import_util.logger)("Loadable render state", {
|
|
94
65
|
state,
|
|
@@ -112,15 +83,16 @@ function Loadable(WrapComponent) {
|
|
|
112
83
|
};
|
|
113
84
|
}, []);
|
|
114
85
|
const retry = (0, import_react.useCallback)(() => {
|
|
115
|
-
setState(
|
|
86
|
+
setState({
|
|
87
|
+
...state,
|
|
116
88
|
error: null,
|
|
117
89
|
isLoading: true,
|
|
118
90
|
timedOut: false
|
|
119
|
-
})
|
|
91
|
+
});
|
|
120
92
|
}, [state]);
|
|
121
93
|
const setStateWithMountCheck = (0, import_react.useCallback)(
|
|
122
94
|
(newState) => {
|
|
123
|
-
setState((state2) =>
|
|
95
|
+
setState((state2) => ({ ...state2, ...newState }));
|
|
124
96
|
},
|
|
125
97
|
[state]
|
|
126
98
|
);
|
|
@@ -134,15 +106,16 @@ function Loadable(WrapComponent) {
|
|
|
134
106
|
error: state == null ? void 0 : state.error,
|
|
135
107
|
retry
|
|
136
108
|
}),
|
|
137
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrapComponent,
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrapComponent, {
|
|
138
110
|
style: { display: showLoading ? "none" : "block" },
|
|
139
111
|
setLoadingState: (props2) => {
|
|
140
112
|
if (props2.error && !LoadingComponent) {
|
|
141
113
|
throw props2.error;
|
|
142
114
|
}
|
|
143
115
|
setStateWithMountCheck(props2);
|
|
144
|
-
}
|
|
145
|
-
|
|
116
|
+
},
|
|
117
|
+
...otherProps
|
|
118
|
+
})
|
|
146
119
|
]
|
|
147
120
|
});
|
|
148
121
|
};
|
|
@@ -1,38 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
7
|
var __export = (target, all) => {
|
|
37
8
|
for (var name in all)
|
|
38
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -50,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
50
21
|
mod
|
|
51
22
|
));
|
|
52
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
53
|
-
var __async = (__this, __arguments, generator) => {
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
var fulfilled = (value) => {
|
|
56
|
-
try {
|
|
57
|
-
step(generator.next(value));
|
|
58
|
-
} catch (e) {
|
|
59
|
-
reject(e);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var rejected = (value) => {
|
|
63
|
-
try {
|
|
64
|
-
step(generator.throw(value));
|
|
65
|
-
} catch (e) {
|
|
66
|
-
reject(e);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
70
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
24
|
var plugin_exports = {};
|
|
74
25
|
__export(plugin_exports, {
|
|
75
26
|
default: () => plugin_default
|
|
@@ -84,37 +35,36 @@ var import_Context = require("./utils/Context");
|
|
|
84
35
|
var import_setExternal = __toESM(require("./utils/setExternal"));
|
|
85
36
|
var import_MApp = require("./utils/MApp");
|
|
86
37
|
var import_apps = require("./utils/apps");
|
|
87
|
-
function initOptions() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (manifest == null ? void 0 : manifest.modules) {
|
|
92
|
-
|
|
93
|
-
apps = manifest == null ? void 0 : manifest.modules;
|
|
94
|
-
}
|
|
95
|
-
(0, import_util.logger)("manifest modules", apps);
|
|
96
|
-
}
|
|
97
|
-
if (manifest == null ? void 0 : manifest.getAppList) {
|
|
98
|
-
const getAppList = yield manifest == null ? void 0 : manifest.getAppList(manifest);
|
|
99
|
-
if (getAppList.length > 0) {
|
|
100
|
-
apps = getAppList;
|
|
101
|
-
}
|
|
102
|
-
(0, import_util.logger)("getAppList modules", apps);
|
|
38
|
+
async function initOptions(manifest = {}, options) {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
let apps = options.apps || [];
|
|
41
|
+
if (manifest == null ? void 0 : manifest.modules) {
|
|
42
|
+
if ((manifest == null ? void 0 : manifest.modules.length) > 0) {
|
|
43
|
+
apps = manifest == null ? void 0 : manifest.modules;
|
|
103
44
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
45
|
+
(0, import_util.logger)("manifest modules", apps);
|
|
46
|
+
}
|
|
47
|
+
if (manifest == null ? void 0 : manifest.getAppList) {
|
|
48
|
+
const getAppList = await (manifest == null ? void 0 : manifest.getAppList(manifest));
|
|
49
|
+
if (getAppList.length > 0) {
|
|
50
|
+
apps = getAppList;
|
|
107
51
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
52
|
+
(0, import_util.logger)("getAppList modules", apps);
|
|
53
|
+
}
|
|
54
|
+
if (((_a = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _a.modules) && ((_b = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _b.modules.length) > 0) {
|
|
55
|
+
apps = (_c = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _c.modules;
|
|
56
|
+
(0, import_util.logger)("modern_manifest", apps);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...options,
|
|
60
|
+
apps
|
|
61
|
+
};
|
|
112
62
|
}
|
|
113
63
|
var plugin_default = (config) => ({
|
|
114
64
|
name: "@modern-js/garfish-plugin",
|
|
115
65
|
setup: () => {
|
|
116
66
|
(0, import_setExternal.default)();
|
|
117
|
-
const
|
|
67
|
+
const { manifest, ...options } = config;
|
|
118
68
|
(0, import_util.logger)("createPlugin", config);
|
|
119
69
|
const promise = initOptions(manifest, options);
|
|
120
70
|
return {
|
|
@@ -137,15 +87,16 @@ var plugin_default = (config) => ({
|
|
|
137
87
|
),
|
|
138
88
|
appInfoList: []
|
|
139
89
|
};
|
|
140
|
-
const load = () =>
|
|
141
|
-
import_garfish.default.setOptions(
|
|
90
|
+
const load = async () => {
|
|
91
|
+
import_garfish.default.setOptions({
|
|
92
|
+
...options,
|
|
142
93
|
insulationVariable: [
|
|
143
94
|
...options.insulationVariable || [],
|
|
144
95
|
"_SERVER_DATA"
|
|
145
96
|
],
|
|
146
97
|
apps: []
|
|
147
|
-
})
|
|
148
|
-
const GarfishConfig =
|
|
98
|
+
});
|
|
99
|
+
const GarfishConfig = await promise;
|
|
149
100
|
const { appInfoList, apps } = (0, import_apps.generateApps)(
|
|
150
101
|
GarfishConfig,
|
|
151
102
|
manifest
|
|
@@ -159,14 +110,16 @@ var plugin_default = (config) => ({
|
|
|
159
110
|
apps,
|
|
160
111
|
appInfoList
|
|
161
112
|
});
|
|
162
|
-
}
|
|
113
|
+
};
|
|
163
114
|
load();
|
|
164
115
|
}
|
|
165
116
|
render() {
|
|
166
117
|
(0, import_util.logger)("GarfishProvider state", this.state);
|
|
167
118
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Context.GarfishProvider, {
|
|
168
119
|
value: this.state,
|
|
169
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App,
|
|
120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
121
|
+
...this.props
|
|
122
|
+
})
|
|
170
123
|
});
|
|
171
124
|
}
|
|
172
125
|
}
|
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
7
|
var __export = (target, all) => {
|
|
22
8
|
for (var name in all)
|
|
23
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -46,15 +32,17 @@ var import_util = require("../util");
|
|
|
46
32
|
var import_Context = require("./utils/Context");
|
|
47
33
|
function useModuleApps() {
|
|
48
34
|
const { apps, MApp, appInfoList } = (0, import_react.useContext)(import_Context.GarfishContext);
|
|
49
|
-
(0, import_util.logger)("call useModuleApps",
|
|
35
|
+
(0, import_util.logger)("call useModuleApps", {
|
|
50
36
|
MApp,
|
|
51
|
-
apps: appInfoList
|
|
52
|
-
|
|
37
|
+
apps: appInfoList,
|
|
38
|
+
...apps
|
|
39
|
+
});
|
|
53
40
|
const Info = new Proxy(
|
|
54
|
-
|
|
41
|
+
{
|
|
55
42
|
MApp,
|
|
56
|
-
apps: appInfoList
|
|
57
|
-
|
|
43
|
+
apps: appInfoList,
|
|
44
|
+
...apps
|
|
45
|
+
},
|
|
58
46
|
{
|
|
59
47
|
get(target, p, receiver) {
|
|
60
48
|
if (typeof p === "string" && p in target) {
|
|
File without changes
|
|
@@ -2,34 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
7
|
var __export = (target, all) => {
|
|
34
8
|
for (var name in all)
|
|
35
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -135,7 +109,7 @@ function generateMApp(options, manifest) {
|
|
|
135
109
|
return {
|
|
136
110
|
mount: (appInfo) => {
|
|
137
111
|
const transferProps = this.filterTransferProps();
|
|
138
|
-
appInfo.props =
|
|
112
|
+
appInfo.props = { ...appInfo.props, ...transferProps };
|
|
139
113
|
if (componetRenderMode) {
|
|
140
114
|
this.setState({
|
|
141
115
|
SubModuleComponent: SubModuleComponent != null ? SubModuleComponent : jupiter_submodule_app_key
|
|
@@ -148,7 +122,7 @@ function generateMApp(options, manifest) {
|
|
|
148
122
|
},
|
|
149
123
|
unmount: (appInfo) => {
|
|
150
124
|
const transferProps = this.filterTransferProps();
|
|
151
|
-
appInfo.props =
|
|
125
|
+
appInfo.props = { ...appInfo.props, ...transferProps };
|
|
152
126
|
if (componetRenderMode) {
|
|
153
127
|
return void 0;
|
|
154
128
|
}
|
|
@@ -171,14 +145,14 @@ function generateMApp(options, manifest) {
|
|
|
171
145
|
(0, import_util.logger)("MApp componentWillUnmount");
|
|
172
146
|
}
|
|
173
147
|
filterTransferProps() {
|
|
174
|
-
const
|
|
148
|
+
const { style, setLoadingState, ...others } = this.props;
|
|
175
149
|
return others;
|
|
176
150
|
}
|
|
177
151
|
render() {
|
|
178
152
|
const { style } = this.props;
|
|
179
153
|
const { SubModuleComponent } = this.state;
|
|
180
154
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
181
|
-
style:
|
|
155
|
+
style: { ...style },
|
|
182
156
|
id: (0, import_util.generateSubAppContainerKey)(),
|
|
183
157
|
children: SubModuleComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubModuleComponent, {})
|
|
184
158
|
});
|