@module-federation/devtools 0.0.0-next-20250925034616 → 0.0.0-perf-devtools-20260106124142
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/es/App.js +328 -22
- package/dist/es/App.module.js +1 -1
- package/dist/es/App_module.css +291 -5
- package/dist/es/component/DependencyGraph/index.js +205 -0
- package/dist/es/component/DependencyGraph/index.module.js +5 -0
- package/dist/es/component/DependencyGraph/index_module.css +97 -0
- package/dist/es/component/{GraphItem → DependencyGraphItem}/index.js +15 -6
- package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
- package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/es/component/Form/index.js +191 -109
- package/dist/es/component/Form/index.module.js +1 -1
- package/dist/es/component/Form/index_module.css +179 -25
- package/dist/es/component/Layout/index.js +288 -51
- package/dist/es/component/Layout/index.module.js +1 -1
- package/dist/es/component/Layout/index_module.css +52 -32
- package/dist/es/component/ModuleInfo/index.js +289 -0
- package/dist/es/component/ModuleInfo/index.module.js +5 -0
- package/dist/es/component/ModuleInfo/index_module.css +183 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +39 -0
- package/dist/es/component/SharedDepsExplorer/index.js +505 -0
- package/dist/es/component/SharedDepsExplorer/share-utils.js +206 -0
- package/dist/es/index.css +15 -0
- package/dist/es/template/constant.js +5 -19
- package/dist/es/utils/chrome/fast-refresh.js +80 -7
- package/dist/es/utils/chrome/index.js +91 -38
- package/dist/es/utils/chrome/messages.js +6 -0
- package/dist/es/utils/chrome/post-message-listener.js +2 -1
- package/dist/es/utils/chrome/post-message-start.js +10 -2
- package/dist/es/utils/chrome/storage.js +6 -1
- package/dist/es/utils/sdk/graph.js +25 -4
- package/dist/es/utils/sdk/index.js +9 -0
- package/dist/es/worker/index.js +168 -1
- package/dist/lib/App.js +318 -17
- package/dist/lib/App.module.js +1 -1
- package/dist/lib/App_module.css +291 -5
- package/dist/lib/component/DependencyGraph/index.js +227 -0
- package/dist/lib/component/{GraphItem → DependencyGraph}/index.module.js +1 -1
- package/dist/lib/component/DependencyGraph/index_module.css +97 -0
- package/dist/lib/component/{GraphItem → DependencyGraphItem}/index.js +18 -9
- package/dist/lib/component/{Graph → DependencyGraphItem}/index.module.js +1 -1
- package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/lib/component/Form/index.js +188 -107
- package/dist/lib/component/Form/index.module.js +1 -1
- package/dist/lib/component/Form/index_module.css +179 -25
- package/dist/lib/component/Layout/index.js +280 -48
- package/dist/lib/component/Layout/index.module.js +1 -1
- package/dist/lib/component/Layout/index_module.css +52 -32
- package/dist/lib/component/ModuleInfo/index.js +319 -0
- package/dist/lib/component/ModuleInfo/index.module.js +25 -0
- package/dist/lib/component/ModuleInfo/index_module.css +183 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +59 -0
- package/dist/lib/component/SharedDepsExplorer/index.js +512 -0
- package/dist/lib/component/SharedDepsExplorer/share-utils.js +237 -0
- package/dist/lib/index.css +15 -0
- package/dist/lib/template/constant.js +7 -17
- package/dist/lib/utils/chrome/fast-refresh.js +77 -8
- package/dist/lib/utils/chrome/index.js +94 -38
- package/dist/lib/utils/chrome/messages.js +31 -0
- package/dist/lib/utils/chrome/post-message-listener.js +2 -1
- package/dist/lib/utils/chrome/post-message-start.js +10 -2
- package/dist/lib/utils/chrome/storage.js +5 -0
- package/dist/lib/utils/sdk/graph.js +25 -4
- package/dist/lib/utils/sdk/index.js +10 -0
- package/dist/lib/worker/index.js +156 -1
- package/dist/types/src/App.d.ts +0 -1
- package/dist/types/src/component/{Graph → DependencyGraph}/index.d.ts +0 -1
- package/dist/types/src/component/{GraphItem → DependencyGraphItem}/index.d.ts +0 -1
- package/dist/types/src/component/Form/index.d.ts +2 -0
- package/dist/types/src/component/Layout/index.d.ts +0 -1
- package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
- package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
- package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
- package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +44 -0
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/init.d.ts +0 -1
- package/dist/types/src/template/constant.d.ts +3 -5
- package/dist/types/src/utils/chrome/index.d.ts +5 -3
- package/dist/types/src/utils/chrome/messages.d.ts +2 -0
- package/dist/types/src/utils/chrome/storage.d.ts +5 -4
- package/dist/types/src/utils/sdk/graph.d.ts +2 -1
- package/dist/types/src/utils/sdk/index.d.ts +1 -0
- package/dist/types/src/utils/types/common.d.ts +4 -0
- package/dist/types/src/worker/index.d.ts +1 -0
- package/package.json +18 -14
- package/dist/es/component/Graph/index.js +0 -127
- package/dist/es/component/Graph/index.module.js +0 -5
- package/dist/es/component/Graph/index_module.css +0 -12
- package/dist/es/component/GraphItem/index.module.js +0 -5
- package/dist/es/component/GraphItem/index_module.css +0 -61
- package/dist/lib/component/Graph/index.js +0 -149
- package/dist/lib/component/Graph/index_module.css +0 -12
- package/dist/lib/component/GraphItem/index_module.css +0 -61
|
@@ -1,47 +1,201 @@
|
|
|
1
|
-
.
|
|
1
|
+
.wrapper_20b79 {
|
|
2
2
|
display: flex;
|
|
3
|
-
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 18px;
|
|
5
|
+
color: #1f2937;
|
|
4
6
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
.sectionHeader_20b79 {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
gap: 18px;
|
|
13
|
+
padding: 12px 16px;
|
|
14
|
+
background: rgba(228, 228, 231, 0.5);
|
|
15
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
7
16
|
}
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
|
|
18
|
+
.heading_20b79 {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 6px;
|
|
10
22
|
flex: 1 1;
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
|
|
25
|
+
.titleRow_20b79 {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 10px;
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
color: #1f2937;
|
|
32
|
+
}
|
|
33
|
+
.titleRow_20b79 .arco-icon {
|
|
34
|
+
color: rgba(23, 75, 180, 0.9);
|
|
35
|
+
font-size: 18px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.title_20b79 {
|
|
39
|
+
letter-spacing: 0.02em;
|
|
14
40
|
}
|
|
15
41
|
|
|
16
|
-
.
|
|
42
|
+
.subtitle_20b79 {
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
color: #4b5563;
|
|
45
|
+
line-height: 1.5;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.headerActions_20b79 {
|
|
17
49
|
display: flex;
|
|
18
50
|
align-items: center;
|
|
19
|
-
|
|
51
|
+
gap: 12px;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
}
|
|
54
|
+
.headerActions_20b79 .add_20b79 {
|
|
55
|
+
box-shadow: 0 8px 16px rgba(243, 244, 246, 0.9);
|
|
20
56
|
}
|
|
21
|
-
|
|
22
|
-
|
|
57
|
+
|
|
58
|
+
.badge_20b79 {
|
|
59
|
+
transform: scale(1.4);
|
|
60
|
+
margin-right: 6px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.statusMessage_20b79 {
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
color: #4b5563;
|
|
66
|
+
max-width: 260px;
|
|
67
|
+
line-height: 1.4;
|
|
23
68
|
}
|
|
24
|
-
|
|
25
|
-
|
|
69
|
+
|
|
70
|
+
.divider_20b79 {
|
|
71
|
+
width: 1px;
|
|
72
|
+
height: 1px;
|
|
73
|
+
background: rgba(96, 165, 250, 0.3);
|
|
26
74
|
}
|
|
27
|
-
|
|
75
|
+
|
|
76
|
+
.hmrArea_20b79 {
|
|
28
77
|
display: flex;
|
|
29
|
-
flex: 1 1;
|
|
30
|
-
justify-content: flex-end;
|
|
31
78
|
align-items: center;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
font-size: 12px;
|
|
81
|
+
color: #4b5563;
|
|
32
82
|
}
|
|
33
|
-
|
|
34
|
-
|
|
83
|
+
|
|
84
|
+
.switch_20b79 .arco-switch {
|
|
85
|
+
background: rgba(243, 244, 246, 0.9);
|
|
86
|
+
border-color: rgba(96, 165, 250, 0.35);
|
|
87
|
+
color: #4b5563;
|
|
35
88
|
}
|
|
36
|
-
.
|
|
37
|
-
|
|
89
|
+
.switch_20b79 .arco-switch-checked {
|
|
90
|
+
background: rgba(243, 244, 246, 0.9);
|
|
91
|
+
border-color: rgba(96, 165, 250, 0.35);
|
|
38
92
|
}
|
|
39
|
-
|
|
93
|
+
|
|
94
|
+
.rules_20b79 {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: 16px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ruleCard_20b79 {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
gap: 14px;
|
|
104
|
+
padding: 18px;
|
|
105
|
+
border-radius: 18px;
|
|
106
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
107
|
+
background: rgba(255, 255, 255, 0.9);
|
|
108
|
+
box-shadow: 0 15px 32px rgba(8, 11, 25, 0.45);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ruleHeader_20b79 {
|
|
40
112
|
display: flex;
|
|
41
113
|
align-items: center;
|
|
114
|
+
justify-content: space-between;
|
|
42
115
|
}
|
|
43
|
-
|
|
116
|
+
|
|
117
|
+
.toggle_20b79 .arco-checkbox {
|
|
118
|
+
transform: scale(1.4);
|
|
119
|
+
}
|
|
120
|
+
.toggle_20b79 .arco-checkbox-icon {
|
|
121
|
+
border-radius: 6px;
|
|
122
|
+
border-color: rgba(228, 228, 231, 0.5);
|
|
123
|
+
background: rgba(243, 244, 246, 0.9);
|
|
124
|
+
}
|
|
125
|
+
.toggle_20b79 .arco-checkbox-checked .arco-checkbox-icon {
|
|
126
|
+
background: rgba(243, 244, 246, 0.9);
|
|
127
|
+
border-color: rgba(228, 228, 231, 0.5);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.inputs_20b79 {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@media (min-width: 520px) {
|
|
137
|
+
.inputs_20b79 {
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
.field_20b79 {
|
|
142
|
+
flex: 1 1;
|
|
143
|
+
}
|
|
144
|
+
.field_20b79 .arco-form-item-content {
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
.field_20b79 .arco-select-view {
|
|
148
|
+
background: rgba(243, 244, 246, 0.9);
|
|
149
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
150
|
+
border-radius: 14px;
|
|
151
|
+
color: #1f2937;
|
|
152
|
+
min-height: 42px;
|
|
153
|
+
padding: 6px 12px;
|
|
154
|
+
}
|
|
155
|
+
.field_20b79 .arco-select-view-input {
|
|
156
|
+
color: #4b5563;
|
|
157
|
+
}
|
|
158
|
+
.field_20b79 .arco-select-view-placeholder {
|
|
159
|
+
color: #4b5563;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.dropdown_20b79 {
|
|
163
|
+
background: rgba(255, 255, 255, 0.9);
|
|
164
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
165
|
+
box-shadow: 0 16px 30px rgba(8, 11, 25, 0.45);
|
|
166
|
+
}
|
|
167
|
+
.dropdown_20b79 .arco-select-option {
|
|
168
|
+
color: #4b5563;
|
|
169
|
+
}
|
|
170
|
+
.dropdown_20b79 .arco-select-option:hover,
|
|
171
|
+
.dropdown_20b79 .arco-select-option.arco-select-option-selected {
|
|
172
|
+
background: rgba(243, 244, 246, 0.9);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.delete_20b79 {
|
|
176
|
+
box-shadow: 0 8px 16px rgba(248, 113, 113, 0.18);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.emptyWrapper_20b79 {
|
|
180
|
+
border-radius: 16px;
|
|
181
|
+
border: 1px dashed rgba(228, 228, 231, 0.5);
|
|
182
|
+
padding: 28px 16px;
|
|
183
|
+
background: rgba(255, 255, 255, 0.9);
|
|
184
|
+
display: flex;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.empty_20b79 .arco-empty-description {
|
|
189
|
+
color: #4b5563;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.footerHint_20b79 {
|
|
193
|
+
font-size: 11px;
|
|
194
|
+
color: #4b5563;
|
|
195
|
+
text-align: right;
|
|
196
|
+
letter-spacing: 0.04em;
|
|
197
|
+
text-transform: uppercase;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: center;
|
|
44
200
|
display: flex;
|
|
45
|
-
transform: scale(1.6);
|
|
46
|
-
margin: 0 0.6vw;
|
|
47
201
|
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
8
25
|
var __export = (target, all) => {
|
|
9
26
|
for (var name in all)
|
|
10
27
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -57,9 +74,21 @@ var import_ahooks = require("ahooks");
|
|
|
57
74
|
var import_web_react = require("@arco-design/web-react");
|
|
58
75
|
var import_sdk = require("@module-federation/sdk");
|
|
59
76
|
var import_Form = __toESM(require("../Form"));
|
|
60
|
-
var import_Graph = __toESM(require("../Graph"));
|
|
61
77
|
var import_utils = require("../../utils");
|
|
62
78
|
var import_constant = require("../../template/constant");
|
|
79
|
+
var import_index = __toESM(require("./index.module"));
|
|
80
|
+
const sortRulesForSignature = (rules) => [...rules].sort((a, b) => {
|
|
81
|
+
const keyCompare = (a.key || "").localeCompare(b.key || "");
|
|
82
|
+
if (keyCompare !== 0) {
|
|
83
|
+
return keyCompare;
|
|
84
|
+
}
|
|
85
|
+
return (a.value || "").localeCompare(b.value || "");
|
|
86
|
+
}).map((rule) => ({
|
|
87
|
+
key: rule.key || "",
|
|
88
|
+
value: rule.value || "",
|
|
89
|
+
checked: Boolean(rule.checked)
|
|
90
|
+
}));
|
|
91
|
+
const getEffectiveSignature = (rules) => rules.length ? JSON.stringify(sortRulesForSignature(rules)) : "";
|
|
63
92
|
const Layout = (props) => {
|
|
64
93
|
const {
|
|
65
94
|
moduleInfo,
|
|
@@ -69,57 +98,153 @@ const Layout = (props) => {
|
|
|
69
98
|
getVersion,
|
|
70
99
|
handleProxyAddress,
|
|
71
100
|
customValueValidate,
|
|
72
|
-
headerSlot
|
|
101
|
+
headerSlot,
|
|
102
|
+
onModuleInfoChange,
|
|
103
|
+
onModuleInfoReset,
|
|
104
|
+
tabId
|
|
73
105
|
} = props;
|
|
74
106
|
const { producer } = (0, import_utils.separateType)(moduleInfo);
|
|
107
|
+
const producerKey = (0, import_react.useMemo)(() => producer.join("|"), [producer]);
|
|
75
108
|
const [condition, setCondition] = (0, import_react.useState)(import_constant.statusInfo.processing);
|
|
76
109
|
const [formStatus, setFormStatus] = (0, import_react.useState)([]);
|
|
77
|
-
const [snapshot, setSnapshot] = (0, import_react.useState)(moduleInfo);
|
|
78
110
|
const [form] = import_web_react.Form.useForm();
|
|
79
111
|
const [enableHMR, setEnalbeHMR] = (0, import_react.useState)("disable");
|
|
112
|
+
const [enableClip, setEnableClip] = (0, import_react.useState)(() => {
|
|
113
|
+
try {
|
|
114
|
+
if (tabId) {
|
|
115
|
+
return localStorage.getItem(`${import_constant.ENABLE_CLIP}_${tabId}`) === "true";
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const lastFormSignatureRef = (0, import_react.useRef)("");
|
|
123
|
+
const lastEffectiveRulesRef = (0, import_react.useRef)("");
|
|
124
|
+
const lastRawRulesRef = (0, import_react.useRef)([]);
|
|
125
|
+
const lastEnableClipRef = (0, import_react.useRef)(enableClip);
|
|
126
|
+
const ensureFederationContext = () => {
|
|
127
|
+
if (!window.__FEDERATION__) {
|
|
128
|
+
window.__FEDERATION__ = {
|
|
129
|
+
originModuleInfo: moduleInfo || {},
|
|
130
|
+
moduleInfo: moduleInfo || {}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (!window.__FEDERATION__.originModuleInfo) {
|
|
134
|
+
window.__FEDERATION__.originModuleInfo = moduleInfo || {};
|
|
135
|
+
}
|
|
136
|
+
if (!window.__FEDERATION__.moduleInfo) {
|
|
137
|
+
window.__FEDERATION__.moduleInfo = moduleInfo || {};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
(0, import_react.useEffect)(() => {
|
|
141
|
+
ensureFederationContext();
|
|
142
|
+
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
143
|
+
JSON.stringify(moduleInfo || {})
|
|
144
|
+
);
|
|
145
|
+
window.__FEDERATION__.originModuleInfo = JSON.parse(
|
|
146
|
+
JSON.stringify(moduleInfo || {})
|
|
147
|
+
);
|
|
148
|
+
const rawRules = form.getFieldValue(import_constant.proxyFormField) || [];
|
|
149
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rawRules));
|
|
150
|
+
}, [moduleInfo, form]);
|
|
151
|
+
const collectEffectiveRules = (rules, statusList) => {
|
|
152
|
+
return rules.reduce((memo, current, idx) => {
|
|
153
|
+
if (!(current == null ? void 0 : current.checked)) {
|
|
154
|
+
return memo;
|
|
155
|
+
}
|
|
156
|
+
const status = statusList[idx];
|
|
157
|
+
const keyValid = status ? status.keyStatus : Boolean(current.key);
|
|
158
|
+
const valueValid = status ? status.valueStatus : Boolean(current.value);
|
|
159
|
+
if (!keyValid || !valueValid) {
|
|
160
|
+
return memo;
|
|
161
|
+
}
|
|
162
|
+
const duplicate = JSON.parse(JSON.stringify(current));
|
|
163
|
+
if (handleProxyAddress) {
|
|
164
|
+
duplicate.value = handleProxyAddress(duplicate.value);
|
|
165
|
+
}
|
|
166
|
+
memo.push(duplicate);
|
|
167
|
+
return memo;
|
|
168
|
+
}, []);
|
|
169
|
+
};
|
|
170
|
+
const hasPendingRule = (rules, statusList) => {
|
|
171
|
+
return rules.some((rule, idx) => {
|
|
172
|
+
if (!(rule == null ? void 0 : rule.checked)) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
const status = statusList[idx];
|
|
176
|
+
if (!status) {
|
|
177
|
+
return Boolean(rule.key) && !rule.value;
|
|
178
|
+
}
|
|
179
|
+
return Boolean(status.keyStatus) && !status.valueStatus;
|
|
180
|
+
});
|
|
181
|
+
};
|
|
80
182
|
const { run } = (0, import_ahooks.useDebounceFn)(
|
|
81
183
|
(formData) => __async(void 0, null, function* () {
|
|
184
|
+
ensureFederationContext();
|
|
82
185
|
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
83
186
|
JSON.stringify(window.__FEDERATION__.originModuleInfo)
|
|
84
187
|
);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const value = handleProxyAddress(duplicate.value);
|
|
97
|
-
duplicate.value = value;
|
|
98
|
-
}
|
|
99
|
-
return [...memo, duplicate];
|
|
100
|
-
},
|
|
101
|
-
[]
|
|
102
|
-
);
|
|
188
|
+
const rawRules = formData[import_constant.proxyFormField] || [];
|
|
189
|
+
const rawSignature = JSON.stringify(rawRules);
|
|
190
|
+
if (rawSignature === lastFormSignatureRef.current) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const effectiveRules = collectEffectiveRules(rawRules, formStatus);
|
|
194
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
195
|
+
const pendingRule = hasPendingRule(rawRules, formStatus);
|
|
196
|
+
const hadPreviousEffective = lastEffectiveRulesRef.current !== "" && lastEffectiveRulesRef.current !== "[]";
|
|
197
|
+
const clipChanged = enableClip !== lastEnableClipRef.current;
|
|
198
|
+
lastEnableClipRef.current = enableClip;
|
|
103
199
|
try {
|
|
104
200
|
setCondition(import_constant.statusInfo.processing);
|
|
105
|
-
if (!
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
201
|
+
if (!effectiveRules.length) {
|
|
202
|
+
if (pendingRule) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (hadPreviousEffective) {
|
|
206
|
+
yield (0, import_utils.removeStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER);
|
|
207
|
+
yield (0, import_utils.removeStorage)(import_constant.BROWSER_ENV_KEY);
|
|
208
|
+
yield (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, "overrides");
|
|
209
|
+
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
210
|
+
setCondition(import_constant.statusInfo.noProxy);
|
|
211
|
+
lastEffectiveRulesRef.current = "";
|
|
212
|
+
if (typeof onModuleInfoReset === "function") {
|
|
213
|
+
onModuleInfoReset();
|
|
214
|
+
} else {
|
|
215
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(window.__FEDERATION__.originModuleInfo);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
setCondition(import_constant.statusInfo.noProxy);
|
|
219
|
+
}
|
|
112
220
|
return;
|
|
113
221
|
}
|
|
114
|
-
|
|
222
|
+
if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (rawRules.every((rule) => !rule.value)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield (0, import_utils.getModuleInfo)(effectiveRules);
|
|
229
|
+
if (enableClip) {
|
|
230
|
+
Object.values(moduleInfo2).forEach((val) => {
|
|
231
|
+
if (val.modules) {
|
|
232
|
+
val.modules = [];
|
|
233
|
+
}
|
|
234
|
+
if (val.shared) {
|
|
235
|
+
val.shared = [];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
115
239
|
const snapshotJson = JSON.stringify(moduleInfo2);
|
|
116
240
|
yield (0, import_utils.setStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
|
|
117
241
|
yield (0, import_utils.setStorage)(import_constant.BROWSER_ENV_KEY);
|
|
118
242
|
yield (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, "overrides", overrides);
|
|
119
243
|
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
120
244
|
window.__FEDERATION__.moduleInfo = moduleInfo2;
|
|
121
|
-
|
|
245
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
|
|
122
246
|
setCondition(import_constant.statusInfo[status]);
|
|
247
|
+
lastEffectiveRulesRef.current = effectiveSignature;
|
|
123
248
|
} catch (e) {
|
|
124
249
|
console.log(e);
|
|
125
250
|
setCondition(import_constant.statusInfo.error);
|
|
@@ -130,28 +255,81 @@ const Layout = (props) => {
|
|
|
130
255
|
}
|
|
131
256
|
);
|
|
132
257
|
(0, import_react.useEffect)(() => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
(0, import_utils.getScope)().then((scope) => __async(void 0, null, function* () {
|
|
258
|
+
ensureFederationContext();
|
|
259
|
+
let cancelled = false;
|
|
260
|
+
const hydrateForm = () => __async(void 0, null, function* () {
|
|
137
261
|
var _a, _b, _c;
|
|
262
|
+
const scope = yield (0, import_utils.getScope)();
|
|
138
263
|
const data = yield chrome.storage.sync.get([import_constant.FormID]);
|
|
139
264
|
const config = (_a = data == null ? void 0 : data[import_constant.FormID]) == null ? void 0 : _a[scope];
|
|
140
265
|
let storeData;
|
|
141
266
|
if ((0, import_utils.isObject)(config)) {
|
|
142
267
|
storeData = JSON.parse(JSON.stringify(config));
|
|
143
|
-
|
|
144
|
-
(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
268
|
+
if (producer.length) {
|
|
269
|
+
storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
|
|
270
|
+
(item) => producer.includes(item.key)
|
|
271
|
+
);
|
|
272
|
+
if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
|
|
273
|
+
storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
|
|
274
|
+
}
|
|
148
275
|
}
|
|
149
276
|
} else {
|
|
150
|
-
storeData = import_constant.defaultModuleData;
|
|
277
|
+
storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
|
|
151
278
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
279
|
+
let overridesApplied = false;
|
|
280
|
+
try {
|
|
281
|
+
const overridesState = yield (0, import_utils.getStorageValue)(import_constant.__FEDERATION_DEVTOOLS__);
|
|
282
|
+
if (typeof overridesState === "string" && overridesState) {
|
|
283
|
+
const parsedState = JSON.parse(overridesState);
|
|
284
|
+
const overrides = parsedState == null ? void 0 : parsedState.overrides;
|
|
285
|
+
if ((0, import_utils.isObject)(overrides)) {
|
|
286
|
+
const overrideRules = Object.entries(overrides).map(([key, value]) => ({
|
|
287
|
+
key,
|
|
288
|
+
value: typeof value === "string" ? value : "",
|
|
289
|
+
checked: true
|
|
290
|
+
})).filter(
|
|
291
|
+
(rule) => Boolean(rule.key) && Boolean(rule.value)
|
|
292
|
+
);
|
|
293
|
+
const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
|
|
294
|
+
if (filteredRules.length) {
|
|
295
|
+
storeData = __spreadProps(__spreadValues({}, storeData), {
|
|
296
|
+
[import_constant.proxyFormField]: filteredRules
|
|
297
|
+
});
|
|
298
|
+
overridesApplied = true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
console.warn(
|
|
304
|
+
"[MF Devtools] hydrate overrides from localStorage failed",
|
|
305
|
+
error
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (!cancelled) {
|
|
309
|
+
form.setFieldsValue(storeData);
|
|
310
|
+
lastFormSignatureRef.current = JSON.stringify(storeData);
|
|
311
|
+
const rules = Array.isArray(
|
|
312
|
+
storeData[import_constant.proxyFormField]
|
|
313
|
+
) ? storeData[import_constant.proxyFormField] : [];
|
|
314
|
+
const effectiveRules = collectEffectiveRules(rules, []);
|
|
315
|
+
lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
|
|
316
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
|
|
317
|
+
setFormStatus(
|
|
318
|
+
rules.map((rule) => ({
|
|
319
|
+
keyStatus: Boolean(rule == null ? void 0 : rule.key),
|
|
320
|
+
valueStatus: Boolean(rule == null ? void 0 : rule.value)
|
|
321
|
+
}))
|
|
322
|
+
);
|
|
323
|
+
if (overridesApplied) {
|
|
324
|
+
(0, import_utils.setChromeStorage)(storeData);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
hydrateForm();
|
|
329
|
+
return () => {
|
|
330
|
+
cancelled = true;
|
|
331
|
+
};
|
|
332
|
+
}, [moduleInfo, producerKey, form]);
|
|
155
333
|
(0, import_react.useEffect)(() => {
|
|
156
334
|
chrome.storage.sync.get([import_constant.ENABLEHMR]).then((data) => {
|
|
157
335
|
const enable = data[import_constant.ENABLEHMR];
|
|
@@ -164,9 +342,25 @@ const Layout = (props) => {
|
|
|
164
342
|
validateForm(form);
|
|
165
343
|
}, []);
|
|
166
344
|
(0, import_ahooks.useUpdateEffect)(() => {
|
|
345
|
+
if (!producer.length) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
167
348
|
const formData = form.getFieldsValue();
|
|
349
|
+
const signature = JSON.stringify(formData);
|
|
350
|
+
if (signature === lastFormSignatureRef.current) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
lastFormSignatureRef.current = signature;
|
|
354
|
+
const effectiveRules = collectEffectiveRules(
|
|
355
|
+
formData[import_constant.proxyFormField] || [],
|
|
356
|
+
formStatus
|
|
357
|
+
);
|
|
358
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
359
|
+
if (effectiveSignature === lastEffectiveRulesRef.current) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
168
362
|
run(formData);
|
|
169
|
-
}, []);
|
|
363
|
+
}, [producerKey, formStatus]);
|
|
170
364
|
const validateForm = (form2) => {
|
|
171
365
|
setTimeout(() => {
|
|
172
366
|
form2.validate().catch(() => {
|
|
@@ -176,6 +370,11 @@ const Layout = (props) => {
|
|
|
176
370
|
};
|
|
177
371
|
const onValuesChange = (target, formData) => {
|
|
178
372
|
validateForm(form);
|
|
373
|
+
const signature = JSON.stringify(formData);
|
|
374
|
+
if (signature === lastFormSignatureRef.current) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
lastFormSignatureRef.current = signature;
|
|
179
378
|
(0, import_utils.setChromeStorage)(formData);
|
|
180
379
|
run(formData);
|
|
181
380
|
};
|
|
@@ -188,11 +387,43 @@ const Layout = (props) => {
|
|
|
188
387
|
(0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__, on);
|
|
189
388
|
} else {
|
|
190
389
|
(0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__);
|
|
390
|
+
(0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__EAGER_SHARE__);
|
|
191
391
|
}
|
|
192
392
|
(0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
193
393
|
};
|
|
194
|
-
|
|
195
|
-
|
|
394
|
+
const onClipChange = (on) => {
|
|
395
|
+
setEnableClip(on);
|
|
396
|
+
try {
|
|
397
|
+
if (tabId) {
|
|
398
|
+
localStorage.setItem(`${import_constant.ENABLE_CLIP}_${tabId}`, String(on));
|
|
399
|
+
}
|
|
400
|
+
} catch (e) {
|
|
401
|
+
console.error(e);
|
|
402
|
+
}
|
|
403
|
+
run(form.getFieldsValue());
|
|
404
|
+
};
|
|
405
|
+
const remotePreview = producer.map((id) => {
|
|
406
|
+
const [, name] = id.split(":");
|
|
407
|
+
return name || id;
|
|
408
|
+
}).filter(Boolean);
|
|
409
|
+
const previewList = remotePreview.slice(0, 4);
|
|
410
|
+
const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryCard, children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryHeader, children: [
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryTitle, children: "Remotes in scope" }),
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryHint, children: "Override manifests to verify integration without redeploying." })
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.chipGroup, children: [
|
|
418
|
+
previewList.length ? previewList.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.chip, children: name }, name)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.chipPlaceholder, children: "Waiting for module map" }),
|
|
419
|
+
extraCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.moreChip, children: [
|
|
420
|
+
"+",
|
|
421
|
+
extraCount,
|
|
422
|
+
" more"
|
|
423
|
+
] })
|
|
424
|
+
] })
|
|
425
|
+
] }),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: import_index.default.formSection, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
427
|
import_web_react.Form,
|
|
197
428
|
{
|
|
198
429
|
form,
|
|
@@ -208,6 +439,8 @@ const Layout = (props) => {
|
|
|
208
439
|
validateForm: () => validateForm(form),
|
|
209
440
|
enableHMR,
|
|
210
441
|
onHMRChange,
|
|
442
|
+
enableClip,
|
|
443
|
+
onClipChange,
|
|
211
444
|
versionList,
|
|
212
445
|
setVersionList,
|
|
213
446
|
getVersion,
|
|
@@ -216,8 +449,7 @@ const Layout = (props) => {
|
|
|
216
449
|
}
|
|
217
450
|
)
|
|
218
451
|
}
|
|
219
|
-
)
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Graph.default, { snapshot })
|
|
452
|
+
) })
|
|
221
453
|
] });
|
|
222
454
|
};
|
|
223
455
|
var Layout_default = Layout;
|
|
@@ -22,4 +22,4 @@ __export(index_module_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(index_module_exports);
|
|
24
24
|
var import_index_module = require("./index_module.css");
|
|
25
|
-
var index_module_default = { "
|
|
25
|
+
var index_module_default = { "wrapper": "wrapper_084ab", "summaryCard": "summaryCard_084ab", "summaryHeader": "summaryHeader_084ab", "summaryTitle": "summaryTitle_084ab", "summaryHint": "summaryHint_084ab", "chipGroup": "chipGroup_084ab", "chip": "chip_084ab", "moreChip": "moreChip_084ab", "chipPlaceholder": "chipPlaceholder_084ab", "formSection": "formSection_084ab" };
|