@module-federation/devtools 0.0.0-next-20240425091022

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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/es/App.js +31 -0
  4. package/dist/es/App.module.js +5 -0
  5. package/dist/es/App_module.css +19 -0
  6. package/dist/es/component/Form/index.js +283 -0
  7. package/dist/es/component/Form/index.module.js +5 -0
  8. package/dist/es/component/Form/index_module.css +43 -0
  9. package/dist/es/component/Graph/index.js +127 -0
  10. package/dist/es/component/Graph/index.module.js +5 -0
  11. package/dist/es/component/Graph/index_module.css +12 -0
  12. package/dist/es/component/GraphItem/index.js +73 -0
  13. package/dist/es/component/GraphItem/index.module.js +5 -0
  14. package/dist/es/component/GraphItem/index_module.css +56 -0
  15. package/dist/es/component/Layout/index.js +207 -0
  16. package/dist/es/component/Layout/index.module.js +5 -0
  17. package/dist/es/component/Layout/index_module.css +48 -0
  18. package/dist/es/init.js +8 -0
  19. package/dist/es/template/constant.js +65 -0
  20. package/dist/es/template/index.js +1 -0
  21. package/dist/es/utils/chrome/fast-refresh-init.js +5 -0
  22. package/dist/es/utils/chrome/fast-refresh.js +113 -0
  23. package/dist/es/utils/chrome/index.js +211 -0
  24. package/dist/es/utils/chrome/post-message-init.js +5 -0
  25. package/dist/es/utils/chrome/post-message-listener.js +20 -0
  26. package/dist/es/utils/chrome/post-message-start.js +8 -0
  27. package/dist/es/utils/chrome/post-message.js +62 -0
  28. package/dist/es/utils/chrome/snapshot-plugin-init.js +5 -0
  29. package/dist/es/utils/chrome/snapshot-plugin.js +36 -0
  30. package/dist/es/utils/chrome/storage.js +45 -0
  31. package/dist/es/utils/data/index.js +79 -0
  32. package/dist/es/utils/data/snapshot.js +82 -0
  33. package/dist/es/utils/index.js +4 -0
  34. package/dist/es/utils/sdk/graph.js +148 -0
  35. package/dist/es/utils/sdk/index.js +55 -0
  36. package/dist/es/utils/types/common.js +0 -0
  37. package/dist/es/utils/types/index.js +1 -0
  38. package/dist/es/worker/index.js +1 -0
  39. package/dist/lib/App.js +61 -0
  40. package/dist/lib/App.module.js +25 -0
  41. package/dist/lib/App_module.css +19 -0
  42. package/dist/lib/component/Form/index.js +295 -0
  43. package/dist/lib/component/Form/index.module.js +25 -0
  44. package/dist/lib/component/Form/index_module.css +43 -0
  45. package/dist/lib/component/Graph/index.js +149 -0
  46. package/dist/lib/component/Graph/index.module.js +25 -0
  47. package/dist/lib/component/Graph/index_module.css +12 -0
  48. package/dist/lib/component/GraphItem/index.js +103 -0
  49. package/dist/lib/component/GraphItem/index.module.js +25 -0
  50. package/dist/lib/component/GraphItem/index_module.css +56 -0
  51. package/dist/lib/component/Layout/index.js +214 -0
  52. package/dist/lib/component/Layout/index.module.js +25 -0
  53. package/dist/lib/component/Layout/index_module.css +48 -0
  54. package/dist/lib/init.js +9 -0
  55. package/dist/lib/template/constant.js +95 -0
  56. package/dist/lib/template/index.js +22 -0
  57. package/dist/lib/utils/chrome/fast-refresh-init.js +6 -0
  58. package/dist/lib/utils/chrome/fast-refresh.js +114 -0
  59. package/dist/lib/utils/chrome/index.js +245 -0
  60. package/dist/lib/utils/chrome/post-message-init.js +6 -0
  61. package/dist/lib/utils/chrome/post-message-listener.js +21 -0
  62. package/dist/lib/utils/chrome/post-message-start.js +9 -0
  63. package/dist/lib/utils/chrome/post-message.js +83 -0
  64. package/dist/lib/utils/chrome/snapshot-plugin-init.js +6 -0
  65. package/dist/lib/utils/chrome/snapshot-plugin.js +59 -0
  66. package/dist/lib/utils/chrome/storage.js +67 -0
  67. package/dist/lib/utils/data/index.js +106 -0
  68. package/dist/lib/utils/data/snapshot.js +107 -0
  69. package/dist/lib/utils/index.js +28 -0
  70. package/dist/lib/utils/sdk/graph.js +171 -0
  71. package/dist/lib/utils/sdk/index.js +89 -0
  72. package/dist/lib/utils/types/common.js +16 -0
  73. package/dist/lib/utils/types/index.js +22 -0
  74. package/dist/lib/worker/index.js +2 -0
  75. package/dist/types/src/App.d.ts +6 -0
  76. package/dist/types/src/component/Form/index.d.ts +18 -0
  77. package/dist/types/src/component/Graph/index.d.ts +7 -0
  78. package/dist/types/src/component/GraphItem/index.d.ts +10 -0
  79. package/dist/types/src/component/Layout/index.d.ts +7 -0
  80. package/dist/types/src/index.d.ts +1 -0
  81. package/dist/types/src/init.d.ts +13 -0
  82. package/dist/types/src/template/constant.d.ts +23 -0
  83. package/dist/types/src/template/index.d.ts +1 -0
  84. package/dist/types/src/utils/chrome/fast-refresh-init.d.ts +1 -0
  85. package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
  86. package/dist/types/src/utils/chrome/index.d.ts +16 -0
  87. package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
  88. package/dist/types/src/utils/chrome/post-message-listener.d.ts +0 -0
  89. package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
  90. package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
  91. package/dist/types/src/utils/chrome/snapshot-plugin-init.d.ts +1 -0
  92. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +4 -0
  93. package/dist/types/src/utils/chrome/storage.d.ts +4 -0
  94. package/dist/types/src/utils/data/index.d.ts +11 -0
  95. package/dist/types/src/utils/data/snapshot.d.ts +3 -0
  96. package/dist/types/src/utils/index.d.ts +4 -0
  97. package/dist/types/src/utils/sdk/graph.d.ts +44 -0
  98. package/dist/types/src/utils/sdk/index.d.ts +10 -0
  99. package/dist/types/src/utils/types/common.d.ts +15 -0
  100. package/dist/types/src/utils/types/index.d.ts +1 -0
  101. package/dist/types/src/worker/index.d.ts +0 -0
  102. package/dist/types/stories/index.stories.d.ts +9 -0
  103. package/install-deps.bash +8 -0
  104. package/package.json +85 -0
@@ -0,0 +1,56 @@
1
+ .Wrapper_2fa4f {
2
+ display: flex;
3
+ box-sizing: border-box;
4
+ border-radius: 10px;
5
+ margin: 0;
6
+ padding: 0;
7
+ width: 300px;
8
+ overflow: hidden;
9
+ }
10
+ .Wrapper_2fa4f .container_2fa4f {
11
+ display: flex;
12
+ flex-direction: column;
13
+ width: 100%;
14
+ height: 100%;
15
+ margin: 0;
16
+ padding: 0;
17
+ }
18
+ .Wrapper_2fa4f .container_2fa4f .group_2fa4f {
19
+ display: flex;
20
+ align-items: center;
21
+ margin-bottom: 3px;
22
+ width: 100%;
23
+ padding: 5px 0;
24
+ }
25
+ .Wrapper_2fa4f .container_2fa4f .group_2fa4f .name_2fa4f {
26
+ color: white;
27
+ text-align: center;
28
+ margin: 0 auto;
29
+ }
30
+ .Wrapper_2fa4f .container_2fa4f .info_2fa4f {
31
+ display: flex;
32
+ flex-direction: column;
33
+ background-color: white;
34
+ margin: 0 4px 4px 4px;
35
+ padding: 10px;
36
+ border-radius: 0 0 5px 5px;
37
+ font-size: 12px;
38
+ }
39
+ .Wrapper_2fa4f .container_2fa4f .info_2fa4f .expose-container_2fa4f {
40
+ display: flex;
41
+ margin-bottom: 5px;
42
+ }
43
+ .Wrapper_2fa4f .container_2fa4f .info_2fa4f .type_2fa4f {
44
+ font-weight: bold;
45
+ margin-right: 10px;
46
+ }
47
+ .Wrapper_2fa4f .container_2fa4f .info_2fa4f .item_2fa4f {
48
+ display: inline-block;
49
+ padding: 5px;
50
+ background: lightgray;
51
+ border-radius: 15px;
52
+ font-size: 8px;
53
+ margin-right: 5px;
54
+ margin-bottom: 5px;
55
+ font-weight: 300;
56
+ }
@@ -0,0 +1,207 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
+ import { useEffect, useState } from "react";
23
+ import { useDebounceFn, useUpdateEffect } from "ahooks";
24
+ import { Form } from "@arco-design/web-react";
25
+ import {
26
+ MODULE_DEVTOOL_IDENTIFIER
27
+ } from "@module-federation/sdk";
28
+ import FormComponent from "../Form";
29
+ import Dependency from "../Graph";
30
+ import {
31
+ getModuleInfo,
32
+ getScope,
33
+ injectScript,
34
+ isObject,
35
+ separateType,
36
+ reloadPage,
37
+ setChromeStorage,
38
+ mergeStorage,
39
+ removeStorageKey,
40
+ removeStorage,
41
+ setStorage
42
+ } from "../../utils";
43
+ import {
44
+ defaultModuleData,
45
+ proxyFormField,
46
+ FormID,
47
+ statusInfo,
48
+ ENABLEHMR,
49
+ __ENABLE_FAST_REFRESH__,
50
+ BROWSER_ENV_KEY,
51
+ __FEDERATION_DEVTOOLS__
52
+ } from "../../template/constant";
53
+ const Layout = (props) => {
54
+ const {
55
+ moduleInfo,
56
+ handleSnapshot,
57
+ versionList,
58
+ setVersionList,
59
+ getVersion
60
+ } = props;
61
+ const { producer } = separateType(moduleInfo);
62
+ const [condition, setCondition] = useState(statusInfo.processing);
63
+ const [formStatus, setFormStatus] = useState([]);
64
+ const [snapshot, setSnapshot] = useState(moduleInfo);
65
+ const [form] = Form.useForm();
66
+ const [enableHMR, setEnalbeHMR] = useState("disable");
67
+ const { run } = useDebounceFn(
68
+ (formData) => __async(void 0, null, function* () {
69
+ window.__FEDERATION__.moduleInfo = JSON.parse(
70
+ JSON.stringify(window.__FEDERATION__.originModuleInfo)
71
+ );
72
+ const filterFormData = formData[proxyFormField].reduce(
73
+ (memo, current, idx) => {
74
+ if (!formStatus[idx]) {
75
+ return memo;
76
+ }
77
+ const { keyStatus, valueStatus } = formStatus[idx];
78
+ if (!keyStatus || !valueStatus || !current.checked) {
79
+ return memo;
80
+ }
81
+ const duplicate = JSON.parse(JSON.stringify(current));
82
+ return [...memo, duplicate];
83
+ },
84
+ []
85
+ );
86
+ try {
87
+ setCondition(statusInfo.processing);
88
+ if (!filterFormData.length) {
89
+ yield removeStorage(MODULE_DEVTOOL_IDENTIFIER);
90
+ yield removeStorage(BROWSER_ENV_KEY);
91
+ yield removeStorageKey(__FEDERATION_DEVTOOLS__, "overrides");
92
+ yield injectScript(reloadPage, false);
93
+ setCondition(statusInfo.noProxy);
94
+ setSnapshot(window.__FEDERATION__.originModuleInfo);
95
+ return;
96
+ }
97
+ const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(filterFormData) : yield getModuleInfo(filterFormData);
98
+ const snapshotJson = JSON.stringify(moduleInfo2);
99
+ yield setStorage(MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
100
+ yield setStorage(BROWSER_ENV_KEY);
101
+ yield mergeStorage(__FEDERATION_DEVTOOLS__, "overrides", overrides);
102
+ yield injectScript(reloadPage, false);
103
+ window.__FEDERATION__.moduleInfo = moduleInfo2;
104
+ setSnapshot(moduleInfo2);
105
+ setCondition(statusInfo[status]);
106
+ } catch (e) {
107
+ console.log(e);
108
+ setCondition(statusInfo.error);
109
+ }
110
+ }),
111
+ {
112
+ wait: 700
113
+ }
114
+ );
115
+ useEffect(() => {
116
+ setSnapshot(moduleInfo);
117
+ }, [moduleInfo]);
118
+ useEffect(() => {
119
+ getScope().then((scope) => __async(void 0, null, function* () {
120
+ var _a, _b, _c;
121
+ const data = yield chrome.storage.sync.get([FormID]);
122
+ const config = (_a = data == null ? void 0 : data[FormID]) == null ? void 0 : _a[scope];
123
+ let storeData;
124
+ if (isObject(config)) {
125
+ storeData = JSON.parse(JSON.stringify(config));
126
+ storeData[proxyFormField] = (_b = storeData[proxyFormField]) == null ? void 0 : _b.filter(
127
+ (item) => producer.includes(item.key)
128
+ );
129
+ if (!((_c = storeData[proxyFormField]) == null ? void 0 : _c.length)) {
130
+ storeData = defaultModuleData;
131
+ }
132
+ } else {
133
+ storeData = defaultModuleData;
134
+ }
135
+ form.setFieldsValue(storeData);
136
+ }));
137
+ }, []);
138
+ useEffect(() => {
139
+ chrome.storage.sync.get([ENABLEHMR]).then((data) => {
140
+ const enable = data[ENABLEHMR];
141
+ if (typeof enable === "boolean") {
142
+ onHMRChange(enable);
143
+ }
144
+ });
145
+ }, []);
146
+ useEffect(() => {
147
+ validateForm(form);
148
+ }, []);
149
+ useUpdateEffect(() => {
150
+ const formData = form.getFieldsValue();
151
+ run(formData);
152
+ }, []);
153
+ const validateForm = (form2) => {
154
+ setTimeout(() => {
155
+ form2.validate().catch(() => {
156
+ console.log("Invalid proxy rules");
157
+ });
158
+ }, 50);
159
+ };
160
+ const onValuesChange = (target, formData) => {
161
+ validateForm(form);
162
+ setChromeStorage(formData);
163
+ run(formData);
164
+ };
165
+ const onHMRChange = (on) => {
166
+ setEnalbeHMR(on ? "enable" : "disable");
167
+ chrome.storage.sync.set({
168
+ [ENABLEHMR]: on
169
+ });
170
+ if (on) {
171
+ mergeStorage(__FEDERATION_DEVTOOLS__, __ENABLE_FAST_REFRESH__, on);
172
+ } else {
173
+ removeStorageKey(__FEDERATION_DEVTOOLS__, __ENABLE_FAST_REFRESH__);
174
+ }
175
+ injectScript(reloadPage, false);
176
+ };
177
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
178
+ /* @__PURE__ */ jsx(
179
+ Form,
180
+ {
181
+ form,
182
+ onValuesChange: (value, formData) => onValuesChange(value, formData),
183
+ initialValues: defaultModuleData,
184
+ children: /* @__PURE__ */ jsx(
185
+ FormComponent,
186
+ {
187
+ form,
188
+ condition,
189
+ formStatus,
190
+ setFormStatus,
191
+ validateForm: () => validateForm(form),
192
+ enableHMR,
193
+ onHMRChange,
194
+ versionList,
195
+ setVersionList,
196
+ getVersion
197
+ }
198
+ )
199
+ }
200
+ ),
201
+ /* @__PURE__ */ jsx(Dependency, { snapshot })
202
+ ] });
203
+ };
204
+ var Layout_default = Layout;
205
+ export {
206
+ Layout_default as default
207
+ };
@@ -0,0 +1,5 @@
1
+ import "./index_module.css";
2
+ var index_module_default = { "select": "select_084ab", "card": "card_084ab", "appName": "appName_084ab", "tagContainer": "tagContainer_084ab", "tag": "tag_084ab", "header": "header_084ab", "add": "add_084ab", "title": "title_084ab", "status": "status_084ab", "switch": "switch_084ab", "badge": "badge_084ab" };
3
+ export {
4
+ index_module_default as default
5
+ };
@@ -0,0 +1,48 @@
1
+ .select_084ab {
2
+ margin-top: 1vh;
3
+ }
4
+
5
+ .card_084ab {
6
+ display: flex;
7
+ height: 4vh;
8
+ align-items: center;
9
+ }
10
+ .card_084ab .appName_084ab {
11
+ margin: 1vh 0;
12
+ }
13
+
14
+ .tagContainer_084ab {
15
+ display: flex;
16
+ align-items: center;
17
+ margin-bottom: 1vh;
18
+ color: rgb(78, 89, 105);
19
+ }
20
+ .tagContainer_084ab .tag_084ab {
21
+ margin-left: 1vw;
22
+ }
23
+
24
+ .header_084ab {
25
+ display: flex;
26
+ align-items: center;
27
+ margin: 1vh 0;
28
+ }
29
+ .header_084ab .add_084ab {
30
+ margin: 0 0.5vw;
31
+ }
32
+ .header_084ab .title_084ab {
33
+ margin: 0 0.5vw;
34
+ }
35
+ .header_084ab .status_084ab {
36
+ display: flex;
37
+ flex: 1 1;
38
+ justify-content: flex-end;
39
+ align-items: center;
40
+ }
41
+ .header_084ab .status_084ab .switch_084ab {
42
+ margin-left: 0.5vw;
43
+ }
44
+ .header_084ab .badge_084ab {
45
+ display: flex;
46
+ transform: scale(1.6);
47
+ margin: 0 0.6vw;
48
+ }
@@ -0,0 +1,8 @@
1
+ if (process.env.NODE_ENV === "development") {
2
+ const createProxy = () => new Proxy(() => Promise.resolve({}), {
3
+ get: () => {
4
+ return createProxy();
5
+ }
6
+ });
7
+ window.chrome = createProxy();
8
+ }
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ const FormID = "FormID";
18
+ const ENABLEHMR = "enableHMR";
19
+ const proxyFormField = "proxyFormField";
20
+ const defaultDataItem = {
21
+ key: "",
22
+ value: "",
23
+ checked: true
24
+ };
25
+ const defaultModuleData = {
26
+ proxyFormField: [
27
+ __spreadValues({}, defaultDataItem)
28
+ ]
29
+ };
30
+ const statusInfo = {
31
+ noProxy: {
32
+ status: "noProxy",
33
+ message: "Modules are not currently proxied",
34
+ color: "#698cee"
35
+ },
36
+ processing: {
37
+ status: "processing",
38
+ message: "Obtaining remote module information",
39
+ color: "#FF7D00"
40
+ },
41
+ success: {
42
+ status: "success",
43
+ message: "The proxy configuration has taken effect and the corresponding page has been automatically refreshed.",
44
+ color: "#50b042"
45
+ },
46
+ error: {
47
+ status: "error",
48
+ message: "Calculating Snapshot failed, please confirm whether the package information is correct",
49
+ color: "#F53F3F"
50
+ }
51
+ };
52
+ const __ENABLE_FAST_REFRESH__ = "enableFastRefresh";
53
+ const BROWSER_ENV_KEY = "MF_ENV";
54
+ const __FEDERATION_DEVTOOLS__ = "__MF_DEVTOOLS__";
55
+ export {
56
+ BROWSER_ENV_KEY,
57
+ ENABLEHMR,
58
+ FormID,
59
+ __ENABLE_FAST_REFRESH__,
60
+ __FEDERATION_DEVTOOLS__,
61
+ defaultDataItem,
62
+ defaultModuleData,
63
+ proxyFormField,
64
+ statusInfo
65
+ };
@@ -0,0 +1 @@
1
+ export * from "./constant";
@@ -0,0 +1,5 @@
1
+ import { getUrl } from "./index";
2
+ const fastRefreshMessageUrl = getUrl("fast-refresh.js");
3
+ const script = document.createElement("script");
4
+ script.src = fastRefreshMessageUrl;
5
+ document.getElementsByTagName("html")[0].appendChild(script);
@@ -0,0 +1,113 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ var _a;
22
+ import { loadScript } from "@module-federation/sdk";
23
+ import { isObject, getUnpkgUrl } from "../index";
24
+ import { definePropertyGlobalVal } from "../sdk";
25
+ import { __FEDERATION_DEVTOOLS__ } from "../../template";
26
+ const fastRefreshPlugin = () => {
27
+ return {
28
+ name: "mf-fast-refresh-plugin",
29
+ // @ts-expect-error
30
+ beforeInit({ origin, userOptions, options, shareInfo }) {
31
+ let enableFastRefresh;
32
+ let devtoolsMessage;
33
+ const devtoolsMessageStr = localStorage.getItem(__FEDERATION_DEVTOOLS__);
34
+ if (devtoolsMessageStr) {
35
+ try {
36
+ devtoolsMessage = JSON.parse(devtoolsMessageStr);
37
+ enableFastRefresh = devtoolsMessage == null ? void 0 : devtoolsMessage.enableFastRefresh;
38
+ } catch (e) {
39
+ console.debug("Fast Refresh Plugin Error: ", e);
40
+ }
41
+ }
42
+ if (isObject(shareInfo)) {
43
+ let orderResolve;
44
+ const orderPromise = new Promise((resolve) => {
45
+ orderResolve = resolve;
46
+ });
47
+ Object.keys(shareInfo).forEach((share) => __async(this, null, function* () {
48
+ const sharedArr = Array.isArray(shareInfo[share]) ? shareInfo[share] : [shareInfo[share]];
49
+ sharedArr.forEach((shared) => {
50
+ let get;
51
+ if (share === "react") {
52
+ get = () => loadScript(getUnpkgUrl(share, shared.version), {
53
+ attrs: { defer: true, async: false }
54
+ }).then(() => {
55
+ orderResolve();
56
+ });
57
+ }
58
+ if (share === "react-dom") {
59
+ get = () => orderPromise.then(
60
+ () => loadScript(getUnpkgUrl(share, shared.version), {
61
+ attrs: { defer: true, async: false }
62
+ })
63
+ );
64
+ }
65
+ if (enableFastRefresh && typeof get === "function") {
66
+ if (share === "react") {
67
+ shared.get = () => __async(this, null, function* () {
68
+ if (!window.React) {
69
+ yield get();
70
+ console.warn(
71
+ "[Module Federation HMR]: You are using Module Federation Devtools to debug online host, it will cause your project load Dev mode React and ReactDOM. If not in this mode, please disable it in Module Federation Devtools"
72
+ );
73
+ }
74
+ shared.lib = () => window.React;
75
+ return () => window.React;
76
+ });
77
+ }
78
+ if (share === "react-dom") {
79
+ shared.get = () => __async(this, null, function* () {
80
+ if (!window.ReactDOM) {
81
+ yield get();
82
+ }
83
+ shared.lib = () => window.ReactDOM;
84
+ return () => window.ReactDOM;
85
+ });
86
+ }
87
+ }
88
+ });
89
+ }));
90
+ return {
91
+ origin,
92
+ userOptions,
93
+ options,
94
+ shareInfo
95
+ };
96
+ } else {
97
+ return {
98
+ origin,
99
+ userOptions,
100
+ options
101
+ };
102
+ }
103
+ }
104
+ };
105
+ };
106
+ if (!(window == null ? void 0 : window.__FEDERATION__)) {
107
+ definePropertyGlobalVal(window, "__FEDERATION__", {});
108
+ definePropertyGlobalVal(window, "__VMOK__", window.__FEDERATION__);
109
+ }
110
+ if (!(window == null ? void 0 : window.__FEDERATION__.__GLOBAL_PLUGIN__)) {
111
+ window.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
112
+ }
113
+ (_a = window.__FEDERATION__.__GLOBAL_PLUGIN__) == null ? void 0 : _a.push(fastRefreshPlugin());