@module-federation/devtools 2.8.2 → 2.9.1

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/README.md +125 -0
  2. package/dist/es/App.js +6 -1
  3. package/dist/es/App.module.js +1 -1
  4. package/dist/es/App_module.css +106 -0
  5. package/dist/es/component/Form/index_module.css +40 -0
  6. package/dist/es/component/Layout/index.js +38 -21
  7. package/dist/es/component/Layout/index_module.css +30 -0
  8. package/dist/es/component/SharedDepsExplorer/index.js +3 -6
  9. package/dist/es/utils/chrome/fast-refresh.js +84 -5
  10. package/dist/es/utils/chrome/index.js +4 -1
  11. package/dist/es/utils/chrome/observability.js +1 -0
  12. package/dist/es/utils/chrome/override-remote.js +6 -1
  13. package/dist/es/utils/chrome/resolve-basic-proxy-core.js +4 -0
  14. package/dist/es/utils/chrome/webmcp-entry.js +2 -0
  15. package/dist/es/utils/chrome/webmcp.js +468 -0
  16. package/dist/es/utils/sdk/index.js +6 -0
  17. package/dist/es/worker/index.js +1 -1
  18. package/dist/lib/App.js +6 -1
  19. package/dist/lib/App.module.js +1 -1
  20. package/dist/lib/App_module.css +106 -0
  21. package/dist/lib/component/Form/index_module.css +40 -0
  22. package/dist/lib/component/Layout/index.js +38 -21
  23. package/dist/lib/component/Layout/index_module.css +30 -0
  24. package/dist/lib/component/SharedDepsExplorer/index.js +3 -6
  25. package/dist/lib/utils/chrome/fast-refresh.js +83 -4
  26. package/dist/lib/utils/chrome/index.js +4 -1
  27. package/dist/lib/utils/chrome/observability.js +2 -0
  28. package/dist/lib/utils/chrome/override-remote.js +4 -1
  29. package/dist/lib/utils/chrome/resolve-basic-proxy-core.js +27 -0
  30. package/dist/lib/utils/chrome/webmcp-entry.js +2 -0
  31. package/dist/lib/utils/chrome/webmcp.js +484 -0
  32. package/dist/lib/utils/sdk/index.js +7 -0
  33. package/dist/lib/worker/index.js +1 -1
  34. package/dist/types/App.js +6 -1
  35. package/dist/types/App.module.js +1 -1
  36. package/dist/types/App_module.css +106 -0
  37. package/dist/types/component/Form/index_module.css +40 -0
  38. package/dist/types/component/Layout/index.js +38 -21
  39. package/dist/types/component/Layout/index_module.css +30 -0
  40. package/dist/types/component/SharedDepsExplorer/index.js +3 -6
  41. package/dist/types/src/utils/chrome/observability.d.ts +11 -0
  42. package/dist/types/src/utils/chrome/resolve-basic-proxy-core.d.ts +6 -0
  43. package/dist/types/src/utils/chrome/webmcp-entry.d.ts +1 -0
  44. package/dist/types/src/utils/chrome/webmcp.d.ts +25 -0
  45. package/dist/types/src/utils/sdk/index.d.ts +1 -0
  46. package/dist/types/utils/chrome/fast-refresh.js +83 -4
  47. package/dist/types/utils/chrome/index.js +4 -1
  48. package/dist/types/utils/chrome/observability.js +2 -0
  49. package/dist/types/utils/chrome/override-remote.js +4 -1
  50. package/dist/types/utils/chrome/resolve-basic-proxy-core.js +27 -0
  51. package/dist/types/utils/chrome/webmcp-entry.js +2 -0
  52. package/dist/types/utils/chrome/webmcp.js +484 -0
  53. package/dist/types/utils/sdk/index.js +7 -0
  54. package/dist/types/worker/index.js +1 -1
  55. package/package.json +5 -4
@@ -0,0 +1,484 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ 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 __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
+ }
32
+ return to;
33
+ };
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __async = (__this, __arguments, generator) => {
36
+ return new Promise((resolve, reject) => {
37
+ var fulfilled = (value) => {
38
+ try {
39
+ step(generator.next(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var rejected = (value) => {
45
+ try {
46
+ step(generator.throw(value));
47
+ } catch (e) {
48
+ reject(e);
49
+ }
50
+ };
51
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
52
+ step((generator = generator.apply(__this, __arguments)).next());
53
+ });
54
+ };
55
+ var webmcp_exports = {};
56
+ __export(webmcp_exports, {
57
+ createDevtoolsTools: () => createDevtoolsTools,
58
+ getModelContext: () => getModelContext,
59
+ registerDevtoolsWebMCP: () => registerDevtoolsWebMCP,
60
+ startDevtoolsWebMCP: () => startDevtoolsWebMCP
61
+ });
62
+ module.exports = __toCommonJS(webmcp_exports);
63
+ var import_sdk = require("@module-federation/sdk");
64
+ var import_constant = require("../../template/constant");
65
+ var import_safe_post_message = require("./safe-post-message");
66
+ var import_observability_shared = require("./observability-shared");
67
+ var import_messages = require("./messages");
68
+ var import_observability = require("./observability");
69
+ const coreModule = require("../../vendor/basic-proxy-core.js");
70
+ const core = coreModule.default || coreModule;
71
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
72
+ const readConfig = () => {
73
+ const raw = localStorage.getItem(import_constant.__FEDERATION_DEVTOOLS__);
74
+ const value = raw ? JSON.parse(raw) : {};
75
+ if (!isRecord(value))
76
+ throw new Error("Invalid devtools configuration in page storage.");
77
+ return value;
78
+ };
79
+ const persist = (values) => {
80
+ var _a;
81
+ const previous = Object.fromEntries(
82
+ Object.keys(values).map((key) => [key, localStorage.getItem(key)])
83
+ );
84
+ try {
85
+ for (const [key, value] of Object.entries(values)) {
86
+ if (value === null)
87
+ localStorage.removeItem(key);
88
+ else
89
+ localStorage.setItem(key, value);
90
+ }
91
+ } catch (error) {
92
+ for (const [key, value] of Object.entries(previous)) {
93
+ try {
94
+ if (value === null)
95
+ localStorage.removeItem(key);
96
+ else
97
+ localStorage.setItem(key, value);
98
+ } catch (e) {
99
+ }
100
+ }
101
+ throw error;
102
+ }
103
+ try {
104
+ window.postMessage(
105
+ (0, import_safe_post_message.sanitizePostMessagePayload)({
106
+ moduleInfo: modules(),
107
+ share: ((_a = federation()) == null ? void 0 : _a.__SHARE__) || {}
108
+ }),
109
+ location.origin
110
+ );
111
+ } catch (e) {
112
+ }
113
+ };
114
+ const federation = () => window.__FEDERATION__ || window.__VMOK__;
115
+ const modules = () => {
116
+ var _a;
117
+ return ((_a = federation()) == null ? void 0 : _a.moduleInfo) || {};
118
+ };
119
+ const reloadResult = () => ({
120
+ saved: true,
121
+ reloadRequired: true,
122
+ instruction: "Reload this page using browser navigation, then call mf_get_state to verify. No navigation has been started by this tool."
123
+ });
124
+ const boolean = (value, name) => {
125
+ if (typeof value !== "boolean")
126
+ throw new Error(`${name} must be a boolean.`);
127
+ return value;
128
+ };
129
+ const validateRules = (value) => {
130
+ if (!Array.isArray(value) || value.length > 100)
131
+ throw new Error("rules must be an array of at most 100 rules.");
132
+ const names = /* @__PURE__ */ new Set();
133
+ return value.map((rule) => {
134
+ if (!isRecord(rule) || typeof rule.key !== "string" || !rule.key.trim() || typeof rule.value !== "string" || !rule.value.trim())
135
+ throw new Error("Each rule needs a nonempty key and value.");
136
+ const key = rule.key.trim();
137
+ const destination = rule.value.trim();
138
+ if (key.split(":").some(
139
+ (part) => ["__proto__", "constructor", "prototype"].includes(part)
140
+ ) || names.has(key))
141
+ throw new Error(`Invalid or duplicate remote key: ${key}`);
142
+ names.add(key);
143
+ if (/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(destination)) {
144
+ const url = new URL(destination, location.href);
145
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password)
146
+ throw new Error(
147
+ "Remote URLs must use HTTP(S), without embedded credentials."
148
+ );
149
+ } else if (!/^[\w.*^~<>=|+ -]+$/.test(destination)) {
150
+ throw new Error("Use an absolute HTTP(S) URL or a registry version/tag.");
151
+ }
152
+ return {
153
+ key,
154
+ value: destination,
155
+ checked: rule.checked === void 0 ? true : boolean(rule.checked, "checked")
156
+ };
157
+ });
158
+ };
159
+ const writeProxy = (rules, clip) => {
160
+ const active = rules.filter((rule) => rule.checked);
161
+ const snapshot = core.getModuleInfo(active, modules());
162
+ if (clip) {
163
+ for (const entry of Object.values(snapshot.moduleInfo)) {
164
+ if (!isRecord(entry))
165
+ continue;
166
+ if (entry.modules)
167
+ entry.modules = [];
168
+ if (entry.shared)
169
+ entry.shared = [];
170
+ }
171
+ }
172
+ persist({
173
+ [import_sdk.MODULE_DEVTOOL_IDENTIFIER]: active.length ? JSON.stringify(snapshot.moduleInfo) : null,
174
+ [import_constant.BROWSER_ENV_KEY]: active.length ? "true" : null,
175
+ [import_constant.__FEDERATION_DEVTOOLS__]: JSON.stringify(__spreadProps(__spreadValues({}, readConfig()), {
176
+ overrides: snapshot.overrides,
177
+ proxyRules: rules,
178
+ enableClip: clip
179
+ }))
180
+ });
181
+ return __spreadProps(__spreadValues({}, reloadResult()), { rules, clip });
182
+ };
183
+ const state = () => {
184
+ var _a, _b;
185
+ return {
186
+ url: location.href,
187
+ moduleInfo: modules(),
188
+ shared: ((_a = federation()) == null ? void 0 : _a.__SHARE__) || {},
189
+ registeredPlugins: (((_b = federation()) == null ? void 0 : _b.__GLOBAL_PLUGIN__) || []).map(
190
+ (plugin) => plugin.name
191
+ ),
192
+ config: readConfig(),
193
+ observability: (0, import_observability.readSnapshotFromPage)(import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY)
194
+ };
195
+ };
196
+ const schema = (properties = {}, required = []) => ({
197
+ type: "object",
198
+ properties,
199
+ required,
200
+ additionalProperties: false
201
+ });
202
+ const boolSchema = { type: "boolean" };
203
+ const ruleSchema = schema(
204
+ {
205
+ key: { type: "string", minLength: 1 },
206
+ value: { type: "string", minLength: 1 },
207
+ checked: boolSchema
208
+ },
209
+ ["key", "value"]
210
+ );
211
+ const createDevtoolsTools = () => {
212
+ const tool = (name, description, inputSchema, readOnly, execute) => ({
213
+ name,
214
+ description,
215
+ inputSchema,
216
+ annotations: { readOnlyHint: readOnly },
217
+ execute: (..._0) => __async(void 0, [..._0], function* (input = {}) {
218
+ try {
219
+ if (!isRecord(input) || Object.keys(input).some(
220
+ (key) => !Object.hasOwn(inputSchema.properties, key)
221
+ ))
222
+ throw new Error("Unexpected tool arguments.");
223
+ const result = yield execute(input);
224
+ return {
225
+ content: [
226
+ {
227
+ type: "text",
228
+ text: JSON.stringify((0, import_safe_post_message.sanitizePostMessagePayload)(result))
229
+ }
230
+ ]
231
+ };
232
+ } catch (error) {
233
+ return {
234
+ isError: true,
235
+ content: [
236
+ {
237
+ type: "text",
238
+ text: error instanceof Error ? error.message : String(error)
239
+ }
240
+ ]
241
+ };
242
+ }
243
+ })
244
+ });
245
+ return [
246
+ tool(
247
+ "mf_get_state",
248
+ "Read Module Federation runtime, proxy/HMR settings and loading reports for this page. Saved settings may require a page reload before taking effect.",
249
+ schema(),
250
+ true,
251
+ state
252
+ ),
253
+ tool(
254
+ "mf_get_modules",
255
+ "Read all module snapshots, or one snapshot by its exact module ID.",
256
+ schema({ moduleId: { type: "string" } }),
257
+ true,
258
+ ({ moduleId }) => {
259
+ if (moduleId === void 0)
260
+ return modules();
261
+ if (typeof moduleId !== "string" || !Object.hasOwn(modules(), moduleId))
262
+ throw new Error(
263
+ "Unknown module ID. Call mf_get_modules without arguments to list IDs."
264
+ );
265
+ return modules()[moduleId];
266
+ }
267
+ ),
268
+ tool(
269
+ "mf_get_dependencies",
270
+ "Read dependency graph data: module snapshots, consumers and remote IDs.",
271
+ schema(),
272
+ true,
273
+ () => __spreadValues({ modules: modules() }, core.separateType(modules()))
274
+ ),
275
+ tool(
276
+ "mf_get_shared",
277
+ "Read shared dependency scopes, versions and loaded state. Functions are returned as placeholders and are never invoked.",
278
+ schema(),
279
+ true,
280
+ () => {
281
+ var _a;
282
+ return ((_a = federation()) == null ? void 0 : _a.__SHARE__) || {};
283
+ }
284
+ ),
285
+ tool(
286
+ "mf_set_proxy",
287
+ "Replace all proxy rules on this page. key is a remote name/ID; value is an HTTP(S) manifest/entry URL or registry version. checked=false disables a rule. clip removes module/shared snapshot lists. Returns reloadRequired; CSP/CORS still apply.",
288
+ schema(
289
+ {
290
+ rules: { type: "array", maxItems: 100, items: ruleSchema },
291
+ clip: boolSchema
292
+ },
293
+ ["rules"]
294
+ ),
295
+ false,
296
+ ({ rules, clip }) => writeProxy(
297
+ validateRules(rules),
298
+ clip === void 0 ? Boolean(readConfig().enableClip) : boolean(clip, "clip")
299
+ )
300
+ ),
301
+ tool(
302
+ "mf_clear_proxy",
303
+ "Clear all proxy rules and injected snapshot data for this page, preserving HMR and tracing settings. Reload afterwards.",
304
+ schema(),
305
+ false,
306
+ () => writeProxy([], Boolean(readConfig().enableClip))
307
+ ),
308
+ tool(
309
+ "mf_set_hmr",
310
+ "Enable or disable the extension React Fast Refresh/shared development React replacement for this page. Save first, then reload so document_start scripts apply it before React loads. Eager shares may require an additional automatic reload.",
311
+ schema({ enabled: boolSchema }, ["enabled"]),
312
+ false,
313
+ ({ enabled }) => {
314
+ const next = __spreadProps(__spreadValues({}, readConfig()), {
315
+ [import_constant.__ENABLE_FAST_REFRESH__]: boolean(enabled, "enabled")
316
+ });
317
+ if (!enabled)
318
+ delete next[import_constant.__EAGER_SHARE__];
319
+ persist({ [import_constant.__FEDERATION_DEVTOOLS__]: JSON.stringify(next) });
320
+ return reloadResult();
321
+ }
322
+ ),
323
+ tool(
324
+ "mf_configure_loading_trace",
325
+ "Configure the extension Loading Trace plugin on this page. enabled=false disables it on next reload. Does not disable user-installed observability plugins.",
326
+ schema(
327
+ {
328
+ enabled: boolSchema,
329
+ level: { type: "string", enum: ["error", "summary", "verbose"] },
330
+ maxEvents: { type: "integer", minimum: 10, maximum: 1e3 },
331
+ console: boolSchema,
332
+ browserEnabled: boolSchema,
333
+ scope: { type: "string", minLength: 1 },
334
+ mode: { type: "string", enum: ["development", "production"] },
335
+ printStart: boolSchema
336
+ },
337
+ ["enabled"]
338
+ ),
339
+ false,
340
+ (input) => {
341
+ var _a, _b, _c, _d;
342
+ const enabled = boolean(input.enabled, "enabled");
343
+ for (const key of ["console", "browserEnabled", "printStart"])
344
+ if (input[key] !== void 0)
345
+ boolean(input[key], key);
346
+ if (input.level !== void 0 && !["error", "summary", "verbose"].includes(String(input.level)))
347
+ throw new Error("Invalid trace level.");
348
+ if (input.mode !== void 0 && !["development", "production"].includes(String(input.mode)))
349
+ throw new Error("Invalid trace mode.");
350
+ if (input.scope !== void 0 && (typeof input.scope !== "string" || !input.scope.trim()))
351
+ throw new Error("Invalid trace scope.");
352
+ if (input.maxEvents !== void 0 && (typeof input.maxEvents !== "number" || !Number.isInteger(input.maxEvents) || input.maxEvents < 10 || input.maxEvents > 1e3))
353
+ throw new Error("maxEvents must be an integer between 10 and 1000.");
354
+ const raw = localStorage.getItem(import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY);
355
+ const old = (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(
356
+ raw ? JSON.parse(raw) : void 0
357
+ );
358
+ const config = (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(__spreadProps(__spreadValues(__spreadValues({}, old), input), {
359
+ enabled,
360
+ browser: {
361
+ enabled: (_a = input.browserEnabled) != null ? _a : old.browser.enabled,
362
+ scope: (_b = input.scope) != null ? _b : old.browser.scope,
363
+ mode: (_c = input.mode) != null ? _c : old.browser.mode
364
+ },
365
+ trace: { printStart: (_d = input.printStart) != null ? _d : old.trace.printStart }
366
+ }));
367
+ persist({
368
+ [import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY]: enabled ? JSON.stringify(config) : null
369
+ });
370
+ window.postMessage(
371
+ {
372
+ source: import_messages.OBSERVABILITY_DEVTOOLS_SOURCE,
373
+ kind: "config-saved",
374
+ config
375
+ },
376
+ location.origin
377
+ );
378
+ return __spreadProps(__spreadValues({}, reloadResult()), { config });
379
+ }
380
+ ),
381
+ tool(
382
+ "mf_get_loading_reports",
383
+ "Read current loading reports and trace configuration from all available observability scopes.",
384
+ schema(),
385
+ true,
386
+ () => (0, import_observability.readSnapshotFromPage)(import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY)
387
+ ),
388
+ tool(
389
+ "mf_export_snapshot",
390
+ "Export a JSON snapshot of modules, shared dependencies, proxy/HMR configuration and loading reports. Returns data without initiating a download.",
391
+ schema(),
392
+ true,
393
+ () => __spreadValues({ exportedAt: (/* @__PURE__ */ new Date()).toISOString() }, state())
394
+ )
395
+ ];
396
+ };
397
+ const getModelContext = () => [document.modelContext, navigator.modelContext].find(
398
+ (context) => typeof (context == null ? void 0 : context.registerTool) === "function"
399
+ );
400
+ const registerDevtoolsWebMCP = (..._0) => __async(void 0, [..._0], function* (context = getModelContext()) {
401
+ if (typeof (context == null ? void 0 : context.registerTool) !== "function")
402
+ return () => __async(void 0, null, function* () {
403
+ });
404
+ const registered = [];
405
+ const cleanup = () => __async(void 0, null, function* () {
406
+ for (const name of registered.splice(0)) {
407
+ try {
408
+ if (typeof context.unregisterTool === "function")
409
+ yield context.unregisterTool(name);
410
+ } catch (e) {
411
+ }
412
+ }
413
+ });
414
+ try {
415
+ for (const tool of createDevtoolsTools()) {
416
+ yield context.registerTool(tool);
417
+ registered.push(tool.name);
418
+ }
419
+ } catch (error) {
420
+ yield cleanup();
421
+ throw error;
422
+ }
423
+ return cleanup;
424
+ });
425
+ const startDevtoolsWebMCP = (retryMs = 250, maxAttempts = 120) => {
426
+ const diagnostic = {
427
+ status: "waiting",
428
+ attempts: 0,
429
+ tools: [],
430
+ error: void 0
431
+ };
432
+ window.__MF_DEVTOOLS_WEBMCP__ = diagnostic;
433
+ let timer;
434
+ let stopped = false;
435
+ let cleanup;
436
+ const attempt = () => __async(void 0, null, function* () {
437
+ if (stopped)
438
+ return;
439
+ diagnostic.attempts++;
440
+ const context = getModelContext();
441
+ if (!context) {
442
+ if (diagnostic.attempts < maxAttempts) {
443
+ timer = setTimeout(() => void attempt(), retryMs);
444
+ } else {
445
+ diagnostic.status = "unavailable";
446
+ console.warn(
447
+ "[Module Federation Devtools] WebMCP host API unavailable",
448
+ diagnostic
449
+ );
450
+ }
451
+ return;
452
+ }
453
+ diagnostic.status = "registering";
454
+ try {
455
+ cleanup = yield registerDevtoolsWebMCP(context);
456
+ if (stopped) {
457
+ yield cleanup();
458
+ return;
459
+ }
460
+ diagnostic.tools = createDevtoolsTools().map(({ name }) => name);
461
+ diagnostic.status = "registered";
462
+ } catch (error) {
463
+ diagnostic.status = "error";
464
+ diagnostic.error = error instanceof Error ? error.message : String(error);
465
+ console.warn(
466
+ "[Module Federation Devtools] WebMCP registration failed",
467
+ error
468
+ );
469
+ }
470
+ });
471
+ void attempt();
472
+ return () => __async(void 0, null, function* () {
473
+ stopped = true;
474
+ clearTimeout(timer);
475
+ yield cleanup == null ? void 0 : cleanup();
476
+ });
477
+ };
478
+ // Annotate the CommonJS export names for ESM import in node:
479
+ 0 && (module.exports = {
480
+ createDevtoolsTools,
481
+ getModelContext,
482
+ registerDevtoolsWebMCP,
483
+ startDevtoolsWebMCP
484
+ });
@@ -18,6 +18,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var sdk_exports = {};
20
20
  __export(sdk_exports, {
21
+ REACT_19_DEV_VERSION: () => REACT_19_DEV_VERSION,
21
22
  definePropertyGlobalVal: () => definePropertyGlobalVal,
22
23
  getLocalStorage: () => getLocalStorage,
23
24
  getUnpkgUrl: () => getUnpkgUrl,
@@ -68,7 +69,12 @@ const reloadPage = () => {
68
69
  (_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.reload();
69
70
  };
70
71
  const validateCustom = (schema) => schema == null ? void 0 : schema.endsWith(".json");
72
+ const REACT_19_DEV_VERSION = "19.2.4";
71
73
  const getUnpkgUrl = (pkg, version) => {
74
+ if (/^19\./.test(version) && ["react", "react-dom", "react-dom/client"].includes(pkg)) {
75
+ const name = pkg === "react" ? "react" : "react-dom";
76
+ return `https://unpkg.com/umd-react@${REACT_19_DEV_VERSION}/dist/${name}.development.js`;
77
+ }
72
78
  if (pkg === "react") {
73
79
  return `https://unpkg.com/react@${version}/umd/react.development.js`;
74
80
  } else if (pkg === "react-dom") {
@@ -90,6 +96,7 @@ const definePropertyGlobalVal = (target, key, val) => {
90
96
  };
91
97
  // Annotate the CommonJS export names for ESM import in node:
92
98
  0 && (module.exports = {
99
+ REACT_19_DEV_VERSION,
93
100
  definePropertyGlobalVal,
94
101
  getLocalStorage,
95
102
  getUnpkgUrl,
@@ -36,7 +36,7 @@ var __async = (__this, __arguments, generator) => {
36
36
  };
37
37
  var import_messages = require("../utils/chrome/messages");
38
38
  const SIDE_PANEL_PATH = "html/main/index.html";
39
- const getSidePanel = () => chrome == null ? void 0 : chrome.sidePanel;
39
+ const getSidePanel = () => chrome.runtime.getManifest().side_panel ? chrome == null ? void 0 : chrome.sidePanel : void 0;
40
40
  const resolveTabId = (tabId) => __async(exports, null, function* () {
41
41
  if (typeof tabId === "number") {
42
42
  return tabId;
package/dist/types/App.js CHANGED
@@ -274,6 +274,8 @@ const InnerApp = (props) => {
274
274
  const bootstrap = () => __async(void 0, null, function* () {
275
275
  const tab = yield (0, import_utils.syncActiveTab)();
276
276
  setInspectedTab(tab || void 0);
277
+ if (typeof (tab == null ? void 0 : tab.id) !== "number")
278
+ return;
277
279
  const detach = yield (0, import_utils.getGlobalModuleInfo)(
278
280
  (info) => applyModuleUpdate(info)
279
281
  );
@@ -385,6 +387,9 @@ const InnerApp = (props) => {
385
387
  }, [activePanel, applyModuleUpdate]);
386
388
  const renderContent = () => {
387
389
  var _a;
390
+ if (typeof (inspectedTab == null ? void 0 : inspectedTab.id) !== "number") {
391
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Empty, { description: t("app.header.scope.waiting") });
392
+ }
388
393
  switch (activePanel) {
389
394
  case "moduleInfo":
390
395
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -425,7 +430,7 @@ const InnerApp = (props) => {
425
430
  import_SharedDepsExplorer.default,
426
431
  {
427
432
  shareData: JSON.parse(
428
- JSON.stringify((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__)
433
+ JSON.stringify(((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__) || {})
429
434
  )
430
435
  }
431
436
  );
@@ -21,4 +21,4 @@ __export(App_module_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(App_module_exports);
23
23
  var import_App_module = require("./App_module.css");
24
- var App_module_default = { "shell": "shell_ae2ee", "sidebar": "sidebar_ae2ee", "tabItem": "tabItem_ae2ee", "activeTab": "activeTab_ae2ee", "panel": "panel_ae2ee", "header": "header_ae2ee", "headerTop": "headerTop_ae2ee", "branding": "branding_ae2ee", "logo": "logo_ae2ee", "subtitle": "subtitle_ae2ee", "meta": "meta_ae2ee", "scope": "scope_ae2ee", "scopeLabel": "scopeLabel_ae2ee", "stats": "stats_ae2ee", "statBlock": "statBlock_ae2ee", "statValue": "statValue_ae2ee", "statLabel": "statLabel_ae2ee", "body": "body_ae2ee", "content": "content_ae2ee", "emptyState": "emptyState_ae2ee", "empty": "empty_ae2ee", "placeholder": "placeholder_ae2ee", "overrideArco": "overrideArco_ae2ee" };
24
+ var App_module_default = { "shell": "shell_ae2ee", "sidebar": "sidebar_ae2ee", "tabItem": "tabItem_ae2ee", "activeTab": "activeTab_ae2ee", "panel": "panel_ae2ee", "header": "header_ae2ee", "headerTop": "headerTop_ae2ee", "branding": "branding_ae2ee", "logo": "logo_ae2ee", "subtitle": "subtitle_ae2ee", "meta": "meta_ae2ee", "scope": "scope_ae2ee", "scopeLabel": "scopeLabel_ae2ee", "stats": "stats_ae2ee", "statBlock": "statBlock_ae2ee", "statValue": "statValue_ae2ee", "statLabel": "statLabel_ae2ee", "body": "body_ae2ee", "content": "content_ae2ee", "emptyState": "emptyState_ae2ee", "empty": "empty_ae2ee", "placeholder": "placeholder_ae2ee", "overrideArco": "overrideArco_ae2ee", "headerActions": "headerActions_ae2ee" };
@@ -304,4 +304,110 @@ body[arco-theme=dark] {
304
304
 
305
305
  .shell_ae2ee.arco-theme-dark {
306
306
  background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.98) 55%), linear-gradient(135deg, var(--color-bg-1, #020617) 0%, var(--color-bg-2, #020617) 100%);
307
+ }
308
+
309
+ html[data-devtools-view="popup"] {
310
+ overflow: hidden;
311
+ }
312
+ html[data-devtools-view="popup"] body {
313
+ margin: 0;
314
+ height: 100%;
315
+ overflow: hidden;
316
+ }
317
+ html[data-devtools-view="popup"] .shell_ae2ee {
318
+ height: 100vh;
319
+ min-height: 0;
320
+ padding: 10px;
321
+ gap: 8px;
322
+ flex-direction: column;
323
+ background: var(--color-bg-1, #fff);
324
+ }
325
+ html[data-devtools-view="popup"] .sidebar_ae2ee {
326
+ flex: 0 0 auto;
327
+ width: 100%;
328
+ min-width: 0;
329
+ padding: 4px;
330
+ gap: 2px;
331
+ border-radius: 8px;
332
+ box-shadow: none;
333
+ }
334
+ html[data-devtools-view="popup"] .tabItem_ae2ee {
335
+ padding: 7px 9px;
336
+ font-size: 12px;
337
+ border-radius: 5px;
338
+ letter-spacing: 0;
339
+ text-transform: none;
340
+ }
341
+ html[data-devtools-view="popup"] .tabItem_ae2ee:focus-visible {
342
+ outline: 2px solid var(--color-primary-6, #165dff);
343
+ outline-offset: -2px;
344
+ }
345
+ html[data-devtools-view="popup"] .panel_ae2ee {
346
+ flex: 1 1;
347
+ min-height: 0;
348
+ padding: 12px;
349
+ gap: 10px;
350
+ border-radius: 8px;
351
+ box-shadow: none;
352
+ overflow: hidden;
353
+ }
354
+ html[data-devtools-view="popup"] .header_ae2ee {
355
+ flex: 0 0 auto;
356
+ gap: 6px;
357
+ }
358
+ html[data-devtools-view="popup"] .logo_ae2ee {
359
+ font-size: 16px;
360
+ }
361
+ html[data-devtools-view="popup"] .subtitle_ae2ee,
362
+ html[data-devtools-view="popup"] .scopeLabel_ae2ee {
363
+ display: none;
364
+ }
365
+ html[data-devtools-view="popup"] .headerActions_ae2ee {
366
+ display: flex;
367
+ align-items: center;
368
+ gap: 6px;
369
+ }
370
+ html[data-devtools-view="popup"] .meta_ae2ee {
371
+ align-items: center;
372
+ gap: 8px;
373
+ flex-wrap: nowrap;
374
+ }
375
+ html[data-devtools-view="popup"] .scope_ae2ee {
376
+ min-width: 0;
377
+ flex: 1 1;
378
+ overflow: hidden;
379
+ }
380
+ html[data-devtools-view="popup"] .scope_ae2ee .arco-tag {
381
+ max-width: 100%;
382
+ overflow: hidden;
383
+ text-overflow: ellipsis;
384
+ }
385
+ html[data-devtools-view="popup"] .stats_ae2ee {
386
+ flex: 0 0 auto;
387
+ gap: 12px;
388
+ width: auto;
389
+ }
390
+ html[data-devtools-view="popup"] .statBlock_ae2ee {
391
+ padding: 0;
392
+ min-width: 0;
393
+ flex-direction: row;
394
+ align-items: baseline;
395
+ gap: 4px;
396
+ border: 0;
397
+ background: none;
398
+ box-shadow: none;
399
+ }
400
+ html[data-devtools-view="popup"] .statValue_ae2ee {
401
+ font-size: 14px;
402
+ }
403
+ html[data-devtools-view="popup"] .statLabel_ae2ee {
404
+ font-size: 10px;
405
+ text-transform: none;
406
+ }
407
+ html[data-devtools-view="popup"] .body_ae2ee {
408
+ flex: 1 1;
409
+ }
410
+ html[data-devtools-view="popup"] .content_ae2ee {
411
+ flex: 1 1;
412
+ overscroll-behavior: contain;
307
413
  }