@module-federation/devtools 0.22.1 → 0.23.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.
Files changed (55) hide show
  1. package/dist/es/App.css +6 -5
  2. package/dist/es/App.js +191 -59
  3. package/dist/es/App.module.js +1 -1
  4. package/dist/es/App_module.css +38 -36
  5. package/dist/es/component/DependencyGraph/index.js +10 -11
  6. package/dist/es/component/DependencyGraph/index_module.css +20 -17
  7. package/dist/es/component/DependencyGraphItem/index.js +5 -3
  8. package/dist/es/component/DependencyGraphItem/index_module.css +7 -7
  9. package/dist/es/component/Form/index.js +24 -31
  10. package/dist/es/component/Form/index.module.js +1 -1
  11. package/dist/es/component/Form/index_module.css +22 -25
  12. package/dist/es/component/LanguageSwitch.js +50 -0
  13. package/dist/es/component/Layout/index.js +6 -10
  14. package/dist/es/component/Layout/index_module.css +7 -7
  15. package/dist/es/component/ModuleInfo/index.js +65 -41
  16. package/dist/es/component/ModuleInfo/index_module.css +12 -11
  17. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
  18. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
  19. package/dist/es/component/SharedDepsExplorer/index.js +64 -75
  20. package/dist/es/component/SharedDepsExplorer/index_module.css +12 -2
  21. package/dist/es/component/ThemeToggle.js +19 -0
  22. package/dist/es/component/ThemeToggle.module.js +5 -0
  23. package/dist/es/component/ThemeToggle_module.css +12 -0
  24. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  25. package/dist/es/i18n/index.js +506 -0
  26. package/dist/lib/App.css +6 -5
  27. package/dist/lib/App.js +189 -59
  28. package/dist/lib/App.module.js +1 -1
  29. package/dist/lib/App_module.css +38 -36
  30. package/dist/lib/component/DependencyGraph/index.js +10 -11
  31. package/dist/lib/component/DependencyGraph/index_module.css +20 -17
  32. package/dist/lib/component/DependencyGraphItem/index.js +5 -3
  33. package/dist/lib/component/DependencyGraphItem/index_module.css +7 -7
  34. package/dist/lib/component/Form/index.js +24 -31
  35. package/dist/lib/component/Form/index.module.js +1 -1
  36. package/dist/lib/component/Form/index_module.css +22 -25
  37. package/dist/lib/component/LanguageSwitch.js +80 -0
  38. package/dist/lib/component/Layout/index.js +6 -10
  39. package/dist/lib/component/Layout/index_module.css +7 -7
  40. package/dist/lib/component/ModuleInfo/index.js +65 -41
  41. package/dist/lib/component/ModuleInfo/index_module.css +12 -11
  42. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
  43. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
  44. package/dist/lib/component/SharedDepsExplorer/index.js +64 -75
  45. package/dist/lib/component/SharedDepsExplorer/index_module.css +12 -2
  46. package/dist/lib/component/ThemeToggle.js +49 -0
  47. package/dist/lib/component/ThemeToggle.module.js +25 -0
  48. package/dist/lib/component/ThemeToggle_module.css +12 -0
  49. package/dist/lib/hooks/useDevtoolsTheme.js +101 -0
  50. package/dist/lib/i18n/index.js +540 -0
  51. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  52. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  53. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  54. package/dist/types/src/i18n/index.d.ts +5 -0
  55. package/package.json +10 -8
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { Empty, Select, Tag, Table } from "@arco-design/web-react";
4
+ import { useTranslation } from "react-i18next";
4
5
  import styles from "./index.module";
5
6
  const renderValue = (value) => {
6
7
  if (value === void 0 || value === null) {
@@ -43,6 +44,7 @@ const renderValue = (value) => {
43
44
  return /* @__PURE__ */ jsx("span", { className: styles.valueText, children: String(value) });
44
45
  };
45
46
  const RemotesTable = ({ data }) => {
47
+ const { t } = useTranslation();
46
48
  if (!data || Object.keys(data).length === 0) {
47
49
  return null;
48
50
  }
@@ -54,10 +56,13 @@ const RemotesTable = ({ data }) => {
54
56
  scmVersion: val.scmVersion || val.buildVersion || "-"
55
57
  }));
56
58
  const columns = [
57
- { title: "Name", dataIndex: "name" },
58
- { title: "Type", dataIndex: "type" },
59
- { title: "Version", dataIndex: "version" },
60
- { title: "SCM Version", dataIndex: "scmVersion" }
59
+ { title: t("moduleInfo.tables.remotes.name"), dataIndex: "name" },
60
+ { title: t("moduleInfo.tables.remotes.type"), dataIndex: "type" },
61
+ { title: t("moduleInfo.tables.remotes.version"), dataIndex: "version" },
62
+ {
63
+ title: t("moduleInfo.tables.remotes.scmVersion"),
64
+ dataIndex: "scmVersion"
65
+ }
61
66
  ];
62
67
  return /* @__PURE__ */ jsx(
63
68
  Table,
@@ -72,6 +77,7 @@ const RemotesTable = ({ data }) => {
72
77
  );
73
78
  };
74
79
  const ExposesTable = ({ data }) => {
80
+ const { t } = useTranslation();
75
81
  if (!Array.isArray(data) || data.length === 0) {
76
82
  return null;
77
83
  }
@@ -79,12 +85,15 @@ const ExposesTable = ({ data }) => {
79
85
  key: index,
80
86
  name: item.name || item.moduleName || item.expose || "-",
81
87
  path: item.path || item.file || "-",
82
- shared: Array.isArray(item.requires) ? item.requires.join(", ") : item.requires || "None"
88
+ shared: Array.isArray(item.requires) ? item.requires.join(", ") : item.requires || t("moduleInfo.tables.exposes.noShared")
83
89
  }));
84
90
  const columns = [
85
- { title: "Module Name", dataIndex: "name" },
86
- { title: "File Path", dataIndex: "path" },
87
- { title: "Shared Dependencies", dataIndex: "shared" }
91
+ { title: t("moduleInfo.tables.exposes.moduleName"), dataIndex: "name" },
92
+ { title: t("moduleInfo.tables.exposes.filePath"), dataIndex: "path" },
93
+ {
94
+ title: t("moduleInfo.tables.exposes.sharedDependencies"),
95
+ dataIndex: "shared"
96
+ }
88
97
  ];
89
98
  return /* @__PURE__ */ jsx(
90
99
  Table,
@@ -99,6 +108,7 @@ const ExposesTable = ({ data }) => {
99
108
  );
100
109
  };
101
110
  const ConsumersTable = ({ data }) => {
111
+ const { t } = useTranslation();
102
112
  if (!Array.isArray(data) || data.length === 0) {
103
113
  return null;
104
114
  }
@@ -112,12 +122,15 @@ const ConsumersTable = ({ data }) => {
112
122
  time: item.time || "-"
113
123
  }));
114
124
  const columns = [
115
- { title: "Consumer Name", dataIndex: "name" },
116
- { title: "Consumer Type", dataIndex: "type" },
117
- { title: "Consumer Version", dataIndex: "version" },
118
- { title: "Consumed Module Name", dataIndex: "moduleName" },
119
- { title: "Used In", dataIndex: "usedIn" },
120
- { title: "Time", dataIndex: "time" }
125
+ { title: t("moduleInfo.tables.consumers.name"), dataIndex: "name" },
126
+ { title: t("moduleInfo.tables.consumers.type"), dataIndex: "type" },
127
+ { title: t("moduleInfo.tables.consumers.version"), dataIndex: "version" },
128
+ {
129
+ title: t("moduleInfo.tables.consumers.moduleName"),
130
+ dataIndex: "moduleName"
131
+ },
132
+ { title: t("moduleInfo.tables.consumers.usedIn"), dataIndex: "usedIn" },
133
+ { title: t("moduleInfo.tables.consumers.time"), dataIndex: "time" }
121
134
  ];
122
135
  return /* @__PURE__ */ jsx(
123
136
  Table,
@@ -134,20 +147,30 @@ const ConsumersTable = ({ data }) => {
134
147
  const SharedTable = ({
135
148
  data
136
149
  }) => {
150
+ const { t } = useTranslation();
137
151
  if (!data || Array.isArray(data) && data.length === 0) {
138
152
  return null;
139
153
  }
140
- const dataSource = Object.entries(data).map(([key, val]) => ({
141
- key,
142
- name: val.sharedName,
143
- version: val.version || "-"
144
- }));
154
+ const dataSource = Object.entries(data).map(([key, val]) => {
155
+ var _a, _b, _c;
156
+ return {
157
+ key,
158
+ name: val.sharedName,
159
+ version: val.version || "-",
160
+ requiredVersion: (_a = val.shareConfig) == null ? void 0 : _a.requiredVersion,
161
+ singleton: (_b = val.shareConfig) == null ? void 0 : _b.singleton,
162
+ eager: (_c = val.shareConfig) == null ? void 0 : _c.eager
163
+ };
164
+ });
145
165
  const columns = [
146
- { title: "Dependency Name", dataIndex: "name" },
147
- { title: "Version", dataIndex: "version" },
148
- { title: "Required Version", dataIndex: "requiredVersion" },
149
- { title: "Singleton", dataIndex: "singleton" },
150
- { title: "Eager", dataIndex: "eager" }
166
+ { title: t("moduleInfo.tables.shared.dependencyName"), dataIndex: "name" },
167
+ { title: t("moduleInfo.tables.shared.version"), dataIndex: "version" },
168
+ {
169
+ title: t("moduleInfo.tables.shared.requiredVersion"),
170
+ dataIndex: "requiredVersion"
171
+ },
172
+ { title: t("moduleInfo.tables.shared.singleton"), dataIndex: "singleton" },
173
+ { title: t("moduleInfo.tables.shared.eager"), dataIndex: "eager" }
151
174
  ];
152
175
  return /* @__PURE__ */ jsx(
153
176
  Table,
@@ -169,49 +192,50 @@ const extractDetailSections = (moduleSnapshot) => {
169
192
  const remoteEntry = moduleSnapshot.remoteEntry || moduleSnapshot.entry || moduleSnapshot.version;
170
193
  if (remoteEntry) {
171
194
  sections.push({
172
- label: "Remote Entry",
195
+ key: "remoteEntry",
173
196
  value: remoteEntry
174
197
  });
175
198
  }
176
199
  if (moduleSnapshot.version) {
177
200
  sections.push({
178
- label: "Version",
201
+ key: "version",
179
202
  value: moduleSnapshot.version
180
203
  });
181
204
  }
182
205
  if (moduleSnapshot.consumerList) {
183
206
  sections.push({
184
- label: "Consumers",
207
+ key: "consumers",
185
208
  value: moduleSnapshot.consumerList
186
209
  });
187
210
  }
188
211
  if (moduleSnapshot.modules) {
189
212
  sections.push({
190
- label: "Exposes",
213
+ key: "exposes",
191
214
  value: moduleSnapshot.modules
192
215
  });
193
216
  }
194
217
  if (moduleSnapshot.remotesInfo) {
195
218
  sections.push({
196
- label: "Remotes",
219
+ key: "remotes",
197
220
  value: moduleSnapshot.remotesInfo
198
221
  });
199
222
  }
200
223
  if (moduleSnapshot.shared) {
201
224
  sections.push({
202
- label: "Shared",
225
+ key: "shared",
203
226
  value: moduleSnapshot.shared
204
227
  });
205
228
  }
206
229
  if (!sections.length) {
207
230
  sections.push({
208
- label: "Snapshot",
231
+ key: "snapshot",
209
232
  value: moduleSnapshot
210
233
  });
211
234
  }
212
235
  return sections;
213
236
  };
214
237
  const Home = (props) => {
238
+ const { t } = useTranslation();
215
239
  const { moduleInfo, selectedModuleId, onSelectModule } = props;
216
240
  const moduleEntries = useMemo(
217
241
  () => Object.entries(moduleInfo || {}).filter(([key]) => key !== "extendInfos"),
@@ -229,21 +253,21 @@ const Home = (props) => {
229
253
  [currentSnapshot]
230
254
  );
231
255
  if (!moduleEntries.length || !currentModuleId) {
232
- return /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx(Empty, { description: "No ModuleInfo Detected" }) });
256
+ return /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx(Empty, { description: t("moduleInfo.empty.noModuleInfo") }) });
233
257
  }
234
258
  return /* @__PURE__ */ jsxs("div", { className: styles.home, children: [
235
259
  /* @__PURE__ */ jsx(
236
260
  Select,
237
261
  {
238
262
  className: styles.moduleSelect,
239
- placeholder: "Select MF module",
263
+ placeholder: t("moduleInfo.selector.placeholder"),
240
264
  style: { width: "100%" },
241
265
  allowClear: true,
242
266
  showSearch: true,
243
267
  autoWidth: true,
244
268
  onChange: onSelectModule,
245
269
  children: moduleEntries.map(([moduleId, snapshot]) => /* @__PURE__ */ jsxs(Select.Option, { value: moduleId, children: [
246
- snapshot && "remotesInfo" in snapshot && Object.keys(snapshot.remotesInfo).length ? /* @__PURE__ */ jsx(Tag, { color: "pinkpurple", children: "Consumer" }) : /* @__PURE__ */ jsx(Tag, { color: "cyan", children: "Provider" }),
270
+ snapshot && "remotesInfo" in snapshot && Object.keys(snapshot.remotesInfo).length ? /* @__PURE__ */ jsx(Tag, { color: "pinkpurple", children: t("moduleInfo.selector.consumerTag") }) : /* @__PURE__ */ jsx(Tag, { color: "cyan", children: t("moduleInfo.selector.providerTag") }),
247
271
  " ",
248
272
  moduleId
249
273
  ] }, moduleId))
@@ -256,17 +280,17 @@ const Home = (props) => {
256
280
  ] }) }),
257
281
  /* @__PURE__ */ jsx("div", { className: styles.detailBody, children: detailSections.map((section) => {
258
282
  let content;
259
- switch (section.label) {
260
- case "Remotes":
283
+ switch (section.key) {
284
+ case "remotes":
261
285
  content = /* @__PURE__ */ jsx(RemotesTable, { data: section.value });
262
286
  break;
263
- case "Exposes":
287
+ case "exposes":
264
288
  content = /* @__PURE__ */ jsx(ExposesTable, { data: section.value });
265
289
  break;
266
- case "Consumers":
290
+ case "consumers":
267
291
  content = /* @__PURE__ */ jsx(ConsumersTable, { data: section.value });
268
292
  break;
269
- case "Shared":
293
+ case "shared":
270
294
  content = /* @__PURE__ */ jsx(SharedTable, { data: section.value });
271
295
  break;
272
296
  default:
@@ -276,9 +300,9 @@ const Home = (props) => {
276
300
  return null;
277
301
  }
278
302
  return /* @__PURE__ */ jsxs("div", { className: styles.detailRow, children: [
279
- /* @__PURE__ */ jsx("div", { className: styles.detailLabel, children: section.label }),
303
+ /* @__PURE__ */ jsx("div", { className: styles.detailLabel, children: t(`moduleInfo.detail.${section.key}`) }),
280
304
  /* @__PURE__ */ jsx("div", { className: styles.detailValue, children: content })
281
- ] }, section.label);
305
+ ] }, section.key);
282
306
  }) })
283
307
  ] }) })
284
308
  ] });
@@ -17,8 +17,8 @@
17
17
  max-width: 40%;
18
18
  padding: 12px;
19
19
  border-radius: 16px;
20
- border: 1px solid rgba(96, 165, 250, 0.3);
21
- background: rgba(255, 255, 255, 0.9);
20
+ border: 1px solid var(--color-border-1, rgba(96, 165, 250, 0.3));
21
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.9));
22
22
  display: flex;
23
23
  flex-direction: column;
24
24
  gap: 8px;
@@ -30,7 +30,7 @@
30
30
  border-radius: 12px;
31
31
  padding: 10px 12px;
32
32
  background: rgba(243, 244, 246, 0.4);
33
- color: #1f2937;
33
+ color: var(--color-text-1, #1f2937);
34
34
  font-size: 13px;
35
35
  text-align: left;
36
36
  cursor: pointer;
@@ -62,8 +62,8 @@
62
62
  min-height: 0;
63
63
  padding: 16px 20px;
64
64
  border-radius: 20px;
65
- border: 1px solid rgba(228, 228, 231, 0.5);
66
- background: rgba(255, 255, 255, 0.9);
65
+ border: 1px solid var(--color-border-2, rgba(228, 228, 231, 0.5));
66
+ background: var(--color-bg-1, rgba(255, 255, 255, 0.9));
67
67
  }
68
68
 
69
69
  .detailHeader_cde89 {
@@ -76,8 +76,9 @@
76
76
  .detailTitle_cde89 {
77
77
  font-size: 16px;
78
78
  font-weight: 600;
79
- color: #1f2937;
79
+ color: var(--color-text-1, #1f2937);
80
80
  word-break: break-word;
81
+ margin-right: 10px;
81
82
  }
82
83
 
83
84
  .detailBody_cde89 {
@@ -102,12 +103,12 @@
102
103
  font-size: 12px;
103
104
  letter-spacing: 0.08em;
104
105
  text-transform: uppercase;
105
- color: #4b5563;
106
+ color: var(--color-text-2, #4b5563);
106
107
  }
107
108
 
108
109
  .detailValue_cde89 {
109
110
  font-size: 13px;
110
- color: #1f2937;
111
+ color: var(--color-text-1, #1f2937);
111
112
  }
112
113
 
113
114
  .valueText_cde89 {
@@ -126,7 +127,7 @@
126
127
  background: rgba(243, 244, 246, 0.4);
127
128
  border: 1px solid rgba(96, 165, 250, 0.3);
128
129
  font-size: 11px;
129
- color: #1f2937;
130
+ color: var(--color-text-1, #1f2937);
130
131
  max-width: 100%;
131
132
  text-overflow: ellipsis;
132
133
  overflow: hidden;
@@ -139,7 +140,7 @@
139
140
  background: rgba(243, 244, 246, 0.4);
140
141
  border: 1px solid rgba(96, 165, 250, 0.3);
141
142
  font-size: 12px;
142
- color: #1f2937;
143
+ color: var(--color-text-1, #1f2937);
143
144
  overflow-x: auto;
144
145
  }
145
146
 
@@ -150,7 +151,7 @@
150
151
  justify-content: center;
151
152
  border-radius: 18px;
152
153
  border: 1px dashed rgba(96, 165, 250, 0.3);
153
- background: rgba(255, 255, 255, 0.9);
154
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.9));
154
155
  }
155
156
 
156
157
  @media (max-width: 960px) {
@@ -1,11 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Tag } from "@arco-design/web-react";
3
+ import { useTranslation } from "react-i18next";
3
4
  import styles from "./FocusResultDisplay.module";
4
5
  const FocusResultDisplay = ({
5
6
  focusResult,
6
7
  hasData,
7
8
  loadedStatusLabel
8
9
  }) => {
10
+ const { t } = useTranslation();
9
11
  if (focusResult) {
10
12
  return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
11
13
  /* @__PURE__ */ jsxs("div", { className: styles.header, children: [
@@ -17,15 +19,15 @@ const FocusResultDisplay = ({
17
19
  /* @__PURE__ */ jsx(Tag, { size: "small", className: "loaded-status-tag", children: loadedStatusLabel(focusResult.status) })
18
20
  ] }),
19
21
  /* @__PURE__ */ jsxs("div", { className: styles.providers, children: [
20
- /* @__PURE__ */ jsx("span", { className: styles.label, children: "Provider: " }),
22
+ /* @__PURE__ */ jsx("span", { className: styles.label, children: t("sharedDeps.focusResult.providerLabel") }),
21
23
  focusResult.providers.map((p) => /* @__PURE__ */ jsx("span", { className: styles.providerTag, children: p }, p))
22
24
  ] })
23
25
  ] });
24
26
  }
25
27
  if (hasData) {
26
- return /* @__PURE__ */ jsx("p", { className: styles.emptyText, children: "No version matching the criteria was found in the current shared data. Please check if the package name / version is correct." });
28
+ return /* @__PURE__ */ jsx("p", { className: styles.emptyText, children: t("sharedDeps.messages.noFocusMatch") });
27
29
  }
28
- return /* @__PURE__ */ jsx("p", { className: styles.emptyText, children: "No shared dependency data loaded yet." });
30
+ return /* @__PURE__ */ jsx("p", { className: styles.emptyText, children: t("sharedDeps.messages.noData") });
29
31
  };
30
32
  var FocusResultDisplay_default = FocusResultDisplay;
31
33
  export {
@@ -22,24 +22,24 @@
22
22
  align-items: center;
23
23
  gap: 4px;
24
24
  font-size: 11px;
25
- color: #374151; /* text-zinc-700 */
25
+ color: var(--color-text-1, #374151); /* text-zinc-700 */
26
26
  }
27
27
 
28
28
  .label_ee3c9 {
29
- color: #71717a; /* text-zinc-500 */
29
+ color: var(--color-text-2, #71717a); /* text-zinc-500 */
30
30
  }
31
31
 
32
32
  .providerTag_ee3c9 {
33
33
  border-radius: 4px;
34
- background-color: white;
34
+ background-color: var(--color-bg-1, #ffffff);
35
35
  padding: 2px 6px;
36
36
  font-weight: 500;
37
- color: #27272a; /* text-zinc-800 */
37
+ color: var(--color-text-1, #27272a); /* text-zinc-800 */
38
38
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
39
39
  }
40
40
 
41
41
  .emptyText_ee3c9 {
42
42
  font-size: 11px;
43
- color: #71717a; /* text-zinc-500 */
43
+ color: var(--color-text-2, #71717a); /* text-zinc-500 */
44
44
  margin: 0;
45
45
  }