@modern-js/plugin-garfish 2.4.1-beta.0 → 2.6.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 +33 -3
- 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 +4 -0
- package/dist/{js/node → cjs}/index.js +4 -0
- package/dist/{js/node → cjs}/runtime/index.js +4 -0
- package/dist/{js/node → cjs}/runtime/loadable.js +21 -44
- package/dist/{js/node → cjs}/runtime/plugin.js +34 -82
- package/dist/{js/node → cjs}/runtime/useModuleApps.js +12 -20
- package/dist/{js/node → cjs}/runtime/utils/Context.js +4 -0
- package/dist/{js/node → cjs}/runtime/utils/MApp.js +8 -34
- package/dist/{js/node → cjs}/runtime/utils/apps.js +48 -94
- package/dist/{js/node → cjs}/runtime/utils/setExternal.js +4 -0
- package/dist/{js/node → cjs}/util.js +4 -0
- package/dist/{js/treeshaking → esm}/cli/utils.js +2 -2
- 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}/runtime/loadable.js +21 -46
- package/dist/esm-node/runtime/plugin.js +102 -0
- package/dist/esm-node/runtime/useModuleApps.js +36 -0
- package/dist/{js/modern → esm-node}/runtime/utils/MApp.js +4 -36
- package/dist/{js/modern → esm-node}/runtime/utils/apps.js +44 -96
- package/package.json +16 -17
- package/dist/js/modern/runtime/plugin.js +0 -156
- package/dist/js/modern/runtime/useModuleApps.js +0 -50
- /package/dist/{js/treeshaking → esm}/cli/index.js +0 -0
- /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 +0 -0
- /package/dist/{js/treeshaking → esm}/runtime/plugin.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime/useModuleApps.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime/utils/Context.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime/utils/MApp.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime/utils/apps.js +0 -0
- /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}/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/utils/Context.js +0 -0
- /package/dist/{js/modern → esm-node}/runtime/utils/setExternal.js +0 -0
- /package/dist/{js/modern → esm-node}/util.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
# @modern-js/plugin-garfish
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.6.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- Updated dependencies [671477d]
|
|
8
|
+
- Updated dependencies [e1f799e]
|
|
9
|
+
- Updated dependencies [7915ab3]
|
|
10
|
+
- Updated dependencies [a909ad1]
|
|
11
|
+
- Updated dependencies [49fa0b1]
|
|
12
|
+
- Updated dependencies [0fe658a]
|
|
13
|
+
- Updated dependencies [1906d7b]
|
|
14
|
+
- @modern-js/runtime@2.6.0
|
|
15
|
+
- @modern-js/utils@2.6.0
|
|
16
|
+
|
|
17
|
+
## 2.5.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 89ca6cc: refactor: merge build-config into scripts/build
|
|
22
|
+
|
|
23
|
+
refactor: 把 build-config 合并进 scripts/build
|
|
24
|
+
|
|
25
|
+
- 30614fa: chore: modify package.json entry fields and build config
|
|
26
|
+
chore: 更改 package.json entry 字段以及构建配置
|
|
27
|
+
- 97cc2d0: feat: pass origin bootstrap function to custom render
|
|
28
|
+
feat: 自定义渲染中传入原始 bootstrap 函数
|
|
29
|
+
- b139eab: fix: avoid do not get provider when in micro-frontend mode
|
|
30
|
+
避免微前端模式下 provider 获取不到
|
|
31
|
+
- Updated dependencies [89ca6cc]
|
|
32
|
+
- Updated dependencies [7cb8bb4]
|
|
33
|
+
- Updated dependencies [30614fa]
|
|
7
34
|
- Updated dependencies [7a25271]
|
|
35
|
+
- Updated dependencies [8871bb8]
|
|
36
|
+
- Updated dependencies [1b0ce87]
|
|
37
|
+
- Updated dependencies [0d75c27]
|
|
8
38
|
- Updated dependencies [11c053b]
|
|
9
39
|
- Updated dependencies [a0f2ab1]
|
|
10
|
-
- @modern-js/runtime@2.
|
|
11
|
-
- @modern-js/utils@2.
|
|
40
|
+
- @modern-js/runtime@2.5.0
|
|
41
|
+
- @modern-js/utils@2.5.0
|
|
12
42
|
|
|
13
43
|
## 2.4.0
|
|
14
44
|
|
|
@@ -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:
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -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,39 +83,45 @@ 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
|
);
|
|
127
99
|
const showLoading = (state.isLoading || state.error) && LoadingComponent;
|
|
128
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
129
|
-
|
|
130
|
-
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
101
|
+
showLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
+
LoadingComponent,
|
|
103
|
+
{
|
|
131
104
|
isLoading: state.isLoading,
|
|
132
105
|
pastDelay: state.pastDelay,
|
|
133
106
|
timedOut: state.timedOut,
|
|
134
107
|
error: state == null ? void 0 : state.error,
|
|
135
108
|
retry
|
|
136
|
-
}
|
|
137
|
-
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
WrapComponent,
|
|
113
|
+
{
|
|
138
114
|
style: { display: showLoading ? "none" : "block" },
|
|
139
115
|
setLoadingState: (props2) => {
|
|
140
116
|
if (props2.error && !LoadingComponent) {
|
|
141
117
|
throw props2.error;
|
|
142
118
|
}
|
|
143
119
|
setStateWithMountCheck(props2);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
120
|
+
},
|
|
121
|
+
...otherProps
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] });
|
|
148
125
|
};
|
|
149
126
|
};
|
|
150
127
|
}
|
|
@@ -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 });
|
|
@@ -46,30 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
46
17
|
return to;
|
|
47
18
|
};
|
|
48
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
49
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
50
25
|
mod
|
|
51
26
|
));
|
|
52
27
|
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
28
|
var plugin_exports = {};
|
|
74
29
|
__export(plugin_exports, {
|
|
75
30
|
default: () => plugin_default
|
|
@@ -84,37 +39,36 @@ var import_Context = require("./utils/Context");
|
|
|
84
39
|
var import_setExternal = __toESM(require("./utils/setExternal"));
|
|
85
40
|
var import_MApp = require("./utils/MApp");
|
|
86
41
|
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);
|
|
42
|
+
async function initOptions(manifest = {}, options) {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
let apps = options.apps || [];
|
|
45
|
+
if (manifest == null ? void 0 : manifest.modules) {
|
|
46
|
+
if ((manifest == null ? void 0 : manifest.modules.length) > 0) {
|
|
47
|
+
apps = manifest == null ? void 0 : manifest.modules;
|
|
103
48
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
49
|
+
(0, import_util.logger)("manifest modules", apps);
|
|
50
|
+
}
|
|
51
|
+
if (manifest == null ? void 0 : manifest.getAppList) {
|
|
52
|
+
const getAppList = await (manifest == null ? void 0 : manifest.getAppList(manifest));
|
|
53
|
+
if (getAppList.length > 0) {
|
|
54
|
+
apps = getAppList;
|
|
107
55
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
56
|
+
(0, import_util.logger)("getAppList modules", apps);
|
|
57
|
+
}
|
|
58
|
+
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) {
|
|
59
|
+
apps = (_c = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _c.modules;
|
|
60
|
+
(0, import_util.logger)("modern_manifest", apps);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...options,
|
|
64
|
+
apps
|
|
65
|
+
};
|
|
112
66
|
}
|
|
113
67
|
var plugin_default = (config) => ({
|
|
114
68
|
name: "@modern-js/garfish-plugin",
|
|
115
69
|
setup: () => {
|
|
116
70
|
(0, import_setExternal.default)();
|
|
117
|
-
const
|
|
71
|
+
const { manifest, ...options } = config;
|
|
118
72
|
(0, import_util.logger)("createPlugin", config);
|
|
119
73
|
const promise = initOptions(manifest, options);
|
|
120
74
|
return {
|
|
@@ -137,15 +91,16 @@ var plugin_default = (config) => ({
|
|
|
137
91
|
),
|
|
138
92
|
appInfoList: []
|
|
139
93
|
};
|
|
140
|
-
const load = () =>
|
|
141
|
-
import_garfish.default.setOptions(
|
|
94
|
+
const load = async () => {
|
|
95
|
+
import_garfish.default.setOptions({
|
|
96
|
+
...options,
|
|
142
97
|
insulationVariable: [
|
|
143
98
|
...options.insulationVariable || [],
|
|
144
99
|
"_SERVER_DATA"
|
|
145
100
|
],
|
|
146
101
|
apps: []
|
|
147
|
-
})
|
|
148
|
-
const GarfishConfig =
|
|
102
|
+
});
|
|
103
|
+
const GarfishConfig = await promise;
|
|
149
104
|
const { appInfoList, apps } = (0, import_apps.generateApps)(
|
|
150
105
|
GarfishConfig,
|
|
151
106
|
manifest
|
|
@@ -159,15 +114,12 @@ var plugin_default = (config) => ({
|
|
|
159
114
|
apps,
|
|
160
115
|
appInfoList
|
|
161
116
|
});
|
|
162
|
-
}
|
|
117
|
+
};
|
|
163
118
|
load();
|
|
164
119
|
}
|
|
165
120
|
render() {
|
|
166
121
|
(0, import_util.logger)("GarfishProvider state", this.state);
|
|
167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Context.GarfishProvider, {
|
|
168
|
-
value: this.state,
|
|
169
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, this.props))
|
|
170
|
-
});
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Context.GarfishProvider, { value: this.state, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, { ...this.props }) });
|
|
171
123
|
}
|
|
172
124
|
}
|
|
173
125
|
return next({
|
|
@@ -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 });
|
|
@@ -31,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
31
17
|
return to;
|
|
32
18
|
};
|
|
33
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
25
|
mod
|
|
36
26
|
));
|
|
@@ -46,15 +36,17 @@ var import_util = require("../util");
|
|
|
46
36
|
var import_Context = require("./utils/Context");
|
|
47
37
|
function useModuleApps() {
|
|
48
38
|
const { apps, MApp, appInfoList } = (0, import_react.useContext)(import_Context.GarfishContext);
|
|
49
|
-
(0, import_util.logger)("call useModuleApps",
|
|
39
|
+
(0, import_util.logger)("call useModuleApps", {
|
|
50
40
|
MApp,
|
|
51
|
-
apps: appInfoList
|
|
52
|
-
|
|
41
|
+
apps: appInfoList,
|
|
42
|
+
...apps
|
|
43
|
+
});
|
|
53
44
|
const Info = new Proxy(
|
|
54
|
-
|
|
45
|
+
{
|
|
55
46
|
MApp,
|
|
56
|
-
apps: appInfoList
|
|
57
|
-
|
|
47
|
+
apps: appInfoList,
|
|
48
|
+
...apps
|
|
49
|
+
},
|
|
58
50
|
{
|
|
59
51
|
get(target, p, receiver) {
|
|
60
52
|
if (typeof p === "string" && p in target) {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -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 });
|
|
@@ -43,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
43
17
|
return to;
|
|
44
18
|
};
|
|
45
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
46
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
47
25
|
mod
|
|
48
26
|
));
|
|
@@ -135,7 +113,7 @@ function generateMApp(options, manifest) {
|
|
|
135
113
|
return {
|
|
136
114
|
mount: (appInfo) => {
|
|
137
115
|
const transferProps = this.filterTransferProps();
|
|
138
|
-
appInfo.props =
|
|
116
|
+
appInfo.props = { ...appInfo.props, ...transferProps };
|
|
139
117
|
if (componetRenderMode) {
|
|
140
118
|
this.setState({
|
|
141
119
|
SubModuleComponent: SubModuleComponent != null ? SubModuleComponent : jupiter_submodule_app_key
|
|
@@ -148,7 +126,7 @@ function generateMApp(options, manifest) {
|
|
|
148
126
|
},
|
|
149
127
|
unmount: (appInfo) => {
|
|
150
128
|
const transferProps = this.filterTransferProps();
|
|
151
|
-
appInfo.props =
|
|
129
|
+
appInfo.props = { ...appInfo.props, ...transferProps };
|
|
152
130
|
if (componetRenderMode) {
|
|
153
131
|
return void 0;
|
|
154
132
|
}
|
|
@@ -171,17 +149,13 @@ function generateMApp(options, manifest) {
|
|
|
171
149
|
(0, import_util.logger)("MApp componentWillUnmount");
|
|
172
150
|
}
|
|
173
151
|
filterTransferProps() {
|
|
174
|
-
const
|
|
152
|
+
const { style, setLoadingState, ...others } = this.props;
|
|
175
153
|
return others;
|
|
176
154
|
}
|
|
177
155
|
render() {
|
|
178
156
|
const { style } = this.props;
|
|
179
157
|
const { SubModuleComponent } = this.state;
|
|
180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
181
|
-
style: __spreadValues({}, style),
|
|
182
|
-
id: (0, import_util.generateSubAppContainerKey)(),
|
|
183
|
-
children: SubModuleComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubModuleComponent, {})
|
|
184
|
-
});
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...style }, id: (0, import_util.generateSubAppContainerKey)(), children: SubModuleComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubModuleComponent, {}) });
|
|
185
159
|
}
|
|
186
160
|
}
|
|
187
161
|
return (0, import_loadable.Loadable)(MApp)(manifest == null ? void 0 : manifest.loadable);
|