@module-federation/devtools 0.0.0-chore-bump-node-22-20260710161714

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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/es/App.css +13 -0
  4. package/dist/es/App.js +498 -0
  5. package/dist/es/App.module.js +5 -0
  6. package/dist/es/App_module.css +307 -0
  7. package/dist/es/component/DependencyGraph/index.js +204 -0
  8. package/dist/es/component/DependencyGraph/index.module.js +5 -0
  9. package/dist/es/component/DependencyGraph/index_module.css +100 -0
  10. package/dist/es/component/DependencyGraphItem/index.js +95 -0
  11. package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
  12. package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
  13. package/dist/es/component/Form/index.js +363 -0
  14. package/dist/es/component/Form/index.module.js +5 -0
  15. package/dist/es/component/Form/index_module.css +198 -0
  16. package/dist/es/component/LanguageSwitch.js +50 -0
  17. package/dist/es/component/Layout/index.js +470 -0
  18. package/dist/es/component/Layout/index.module.js +5 -0
  19. package/dist/es/component/Layout/index_module.css +68 -0
  20. package/dist/es/component/LoadingTrace/index.js +944 -0
  21. package/dist/es/component/LoadingTrace/index.module.js +5 -0
  22. package/dist/es/component/LoadingTrace/index_module.css +876 -0
  23. package/dist/es/component/ModuleInfo/index.js +313 -0
  24. package/dist/es/component/ModuleInfo/index.module.js +5 -0
  25. package/dist/es/component/ModuleInfo/index_module.css +184 -0
  26. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +35 -0
  27. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
  28. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  29. package/dist/es/component/SharedDepsExplorer/index.js +636 -0
  30. package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
  31. package/dist/es/component/SharedDepsExplorer/index_module.css +467 -0
  32. package/dist/es/component/SharedDepsExplorer/share-utils.js +222 -0
  33. package/dist/es/component/ThemeToggle.js +19 -0
  34. package/dist/es/component/ThemeToggle.module.js +5 -0
  35. package/dist/es/component/ThemeToggle_module.css +12 -0
  36. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  37. package/dist/es/i18n/index.js +688 -0
  38. package/dist/es/init.js +8 -0
  39. package/dist/es/template/constant.js +51 -0
  40. package/dist/es/template/index.js +1 -0
  41. package/dist/es/utils/chrome/fast-refresh.js +342 -0
  42. package/dist/es/utils/chrome/index.js +284 -0
  43. package/dist/es/utils/chrome/messages.js +12 -0
  44. package/dist/es/utils/chrome/observability-plugin.js +93 -0
  45. package/dist/es/utils/chrome/observability-shared.js +99 -0
  46. package/dist/es/utils/chrome/observability.js +208 -0
  47. package/dist/es/utils/chrome/override-remote.js +2 -0
  48. package/dist/es/utils/chrome/post-message-init.js +5 -0
  49. package/dist/es/utils/chrome/post-message-listener.js +39 -0
  50. package/dist/es/utils/chrome/post-message-start.js +10 -0
  51. package/dist/es/utils/chrome/post-message.js +71 -0
  52. package/dist/es/utils/chrome/safe-post-message.js +124 -0
  53. package/dist/es/utils/chrome/snapshot-plugin.js +2 -0
  54. package/dist/es/utils/chrome/storage.js +50 -0
  55. package/dist/es/utils/data/index.js +59 -0
  56. package/dist/es/utils/index.js +4 -0
  57. package/dist/es/utils/sdk/graph.js +190 -0
  58. package/dist/es/utils/sdk/index.js +70 -0
  59. package/dist/es/utils/types/common.js +0 -0
  60. package/dist/es/utils/types/index.js +1 -0
  61. package/dist/es/vendor/basic-proxy-core.js +155 -0
  62. package/dist/es/worker/index.js +187 -0
  63. package/dist/lib/App.css +13 -0
  64. package/dist/lib/App.js +519 -0
  65. package/dist/lib/App.module.js +24 -0
  66. package/dist/lib/App_module.css +307 -0
  67. package/dist/lib/component/DependencyGraph/index.js +225 -0
  68. package/dist/lib/component/DependencyGraph/index.module.js +24 -0
  69. package/dist/lib/component/DependencyGraph/index_module.css +100 -0
  70. package/dist/lib/component/DependencyGraphItem/index.js +124 -0
  71. package/dist/lib/component/DependencyGraphItem/index.module.js +24 -0
  72. package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
  73. package/dist/lib/component/Form/index.js +372 -0
  74. package/dist/lib/component/Form/index.module.js +24 -0
  75. package/dist/lib/component/Form/index_module.css +198 -0
  76. package/dist/lib/component/LanguageSwitch.js +79 -0
  77. package/dist/lib/component/Layout/index.js +471 -0
  78. package/dist/lib/component/Layout/index.module.js +24 -0
  79. package/dist/lib/component/Layout/index_module.css +68 -0
  80. package/dist/lib/component/LoadingTrace/index.js +953 -0
  81. package/dist/lib/component/LoadingTrace/index.module.js +24 -0
  82. package/dist/lib/component/LoadingTrace/index_module.css +876 -0
  83. package/dist/lib/component/ModuleInfo/index.js +342 -0
  84. package/dist/lib/component/ModuleInfo/index.module.js +24 -0
  85. package/dist/lib/component/ModuleInfo/index_module.css +184 -0
  86. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
  87. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
  88. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  89. package/dist/lib/component/SharedDepsExplorer/index.js +638 -0
  90. package/dist/lib/component/SharedDepsExplorer/index.module.js +24 -0
  91. package/dist/lib/component/SharedDepsExplorer/index_module.css +467 -0
  92. package/dist/lib/component/SharedDepsExplorer/share-utils.js +252 -0
  93. package/dist/lib/component/ThemeToggle.js +48 -0
  94. package/dist/lib/component/ThemeToggle.module.js +24 -0
  95. package/dist/lib/component/ThemeToggle_module.css +12 -0
  96. package/dist/lib/hooks/useDevtoolsTheme.js +100 -0
  97. package/dist/lib/i18n/index.js +721 -0
  98. package/dist/lib/init.js +8 -0
  99. package/dist/lib/template/constant.js +84 -0
  100. package/dist/lib/template/index.js +21 -0
  101. package/dist/lib/utils/chrome/fast-refresh.js +329 -0
  102. package/dist/lib/utils/chrome/index.js +321 -0
  103. package/dist/lib/utils/chrome/messages.js +39 -0
  104. package/dist/lib/utils/chrome/observability-plugin.js +85 -0
  105. package/dist/lib/utils/chrome/observability-shared.js +125 -0
  106. package/dist/lib/utils/chrome/observability.js +233 -0
  107. package/dist/lib/utils/chrome/override-remote.js +17 -0
  108. package/dist/lib/utils/chrome/post-message-init.js +5 -0
  109. package/dist/lib/utils/chrome/post-message-listener.js +36 -0
  110. package/dist/lib/utils/chrome/post-message-start.js +10 -0
  111. package/dist/lib/utils/chrome/post-message.js +91 -0
  112. package/dist/lib/utils/chrome/safe-post-message.js +147 -0
  113. package/dist/lib/utils/chrome/snapshot-plugin.js +17 -0
  114. package/dist/lib/utils/chrome/storage.js +71 -0
  115. package/dist/lib/utils/data/index.js +83 -0
  116. package/dist/lib/utils/index.js +27 -0
  117. package/dist/lib/utils/sdk/graph.js +213 -0
  118. package/dist/lib/utils/sdk/index.js +104 -0
  119. package/dist/lib/utils/types/common.js +15 -0
  120. package/dist/lib/utils/types/index.js +21 -0
  121. package/dist/lib/vendor/basic-proxy-core.js +147 -0
  122. package/dist/lib/worker/index.js +175 -0
  123. package/dist/types/src/App.d.ts +7 -0
  124. package/dist/types/src/component/DependencyGraph/index.d.ts +6 -0
  125. package/dist/types/src/component/DependencyGraphItem/index.d.ts +9 -0
  126. package/dist/types/src/component/Form/index.d.ts +21 -0
  127. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  128. package/dist/types/src/component/Layout/index.d.ts +15 -0
  129. package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
  130. package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
  131. package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
  132. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
  133. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +45 -0
  134. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  135. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  136. package/dist/types/src/i18n/index.d.ts +5 -0
  137. package/dist/types/src/index.d.ts +1 -0
  138. package/dist/types/src/init.d.ts +12 -0
  139. package/dist/types/src/template/constant.d.ts +21 -0
  140. package/dist/types/src/template/index.d.ts +1 -0
  141. package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
  142. package/dist/types/src/utils/chrome/index.d.ts +19 -0
  143. package/dist/types/src/utils/chrome/messages.d.ts +5 -0
  144. package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
  145. package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
  146. package/dist/types/src/utils/chrome/observability.d.ts +110 -0
  147. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  148. package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
  149. package/dist/types/src/utils/chrome/post-message-listener.d.ts +1 -0
  150. package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
  151. package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
  152. package/dist/types/src/utils/chrome/safe-post-message.d.ts +1 -0
  153. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +1 -0
  154. package/dist/types/src/utils/chrome/storage.d.ts +5 -0
  155. package/dist/types/src/utils/data/index.d.ts +10 -0
  156. package/dist/types/src/utils/index.d.ts +4 -0
  157. package/dist/types/src/utils/sdk/graph.d.ts +46 -0
  158. package/dist/types/src/utils/sdk/index.d.ts +11 -0
  159. package/dist/types/src/utils/types/common.d.ts +22 -0
  160. package/dist/types/src/utils/types/index.d.ts +1 -0
  161. package/dist/types/src/worker/index.d.ts +1 -0
  162. package/dist/types/stories/index.stories.d.ts +9 -0
  163. package/install-deps.bash +23 -0
  164. package/package.json +108 -0
@@ -0,0 +1,93 @@
1
+ import {
2
+ ChromeObservabilityPlugin
3
+ } from "@module-federation/observability-plugin/chrome-devtool";
4
+ import {
5
+ OBSERVABILITY_DEVTOOLS_SOURCE,
6
+ OBSERVABILITY_DEVTOOLS_STORAGE_KEY
7
+ } from "./messages";
8
+ import {
9
+ createObservabilityPluginOptions,
10
+ normalizeObservabilityDevtoolsConfig
11
+ } from "./observability-shared";
12
+ const DEVTOOLS_PLUGIN_NAME = "observability-plugin:chrome-extension";
13
+ const LEGACY_DEVTOOLS_PLUGIN_NAME = "observability-plugin-devtools";
14
+ const getFederationWindow = () => window;
15
+ const safeReadStoredConfig = () => {
16
+ var _a;
17
+ try {
18
+ const raw = (_a = window.localStorage) == null ? void 0 : _a.getItem(
19
+ OBSERVABILITY_DEVTOOLS_STORAGE_KEY
20
+ );
21
+ if (!raw) {
22
+ return void 0;
23
+ }
24
+ return normalizeObservabilityDevtoolsConfig(JSON.parse(raw));
25
+ } catch (e) {
26
+ return void 0;
27
+ }
28
+ };
29
+ const defineWritableGlobal = (key, value) => {
30
+ const targetWindow = getFederationWindow();
31
+ try {
32
+ Object.defineProperty(targetWindow, key, {
33
+ value,
34
+ configurable: true,
35
+ writable: true
36
+ });
37
+ } catch (e) {
38
+ targetWindow[key] = value;
39
+ }
40
+ };
41
+ const ensureFederationGlobal = () => {
42
+ var _a;
43
+ const targetWindow = getFederationWindow();
44
+ const federation = targetWindow.__FEDERATION__ || targetWindow.__VMOK__ || {};
45
+ if (!targetWindow.__FEDERATION__) {
46
+ defineWritableGlobal("__FEDERATION__", federation);
47
+ }
48
+ if (!targetWindow.__VMOK__) {
49
+ defineWritableGlobal("__VMOK__", targetWindow.__FEDERATION__);
50
+ }
51
+ if (!((_a = targetWindow.__FEDERATION__) == null ? void 0 : _a.__GLOBAL_PLUGIN__)) {
52
+ targetWindow.__FEDERATION__ = targetWindow.__FEDERATION__ || federation;
53
+ targetWindow.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
54
+ }
55
+ return targetWindow.__FEDERATION__;
56
+ };
57
+ const notifyInstalled = (status, reason, config) => {
58
+ try {
59
+ window.postMessage(
60
+ {
61
+ schemaVersion: 1,
62
+ source: OBSERVABILITY_DEVTOOLS_SOURCE,
63
+ kind: status,
64
+ reason,
65
+ config,
66
+ createdAt: Date.now()
67
+ },
68
+ "*"
69
+ );
70
+ } catch (e) {
71
+ }
72
+ };
73
+ const install = () => {
74
+ const config = safeReadStoredConfig();
75
+ if (!(config == null ? void 0 : config.enabled)) {
76
+ return;
77
+ }
78
+ const federation = ensureFederationGlobal();
79
+ const globalPlugins = (federation == null ? void 0 : federation.__GLOBAL_PLUGIN__) || [];
80
+ if (globalPlugins.some(
81
+ (plugin2) => (plugin2 == null ? void 0 : plugin2.name) === DEVTOOLS_PLUGIN_NAME || (plugin2 == null ? void 0 : plugin2.name) === LEGACY_DEVTOOLS_PLUGIN_NAME
82
+ )) {
83
+ notifyInstalled("skipped", "already-installed", config);
84
+ return;
85
+ }
86
+ const plugin = ChromeObservabilityPlugin(
87
+ createObservabilityPluginOptions(config)
88
+ );
89
+ globalPlugins.push(plugin);
90
+ federation.__GLOBAL_PLUGIN__ = globalPlugins;
91
+ notifyInstalled("installed", void 0, config);
92
+ };
93
+ install();
@@ -0,0 +1,99 @@
1
+ import { OBSERVABILITY_DEVTOOLS_SOURCE } from "./messages";
2
+ const CHROME_OBSERVABILITY_SCOPE = "chrome_extension";
3
+ const MIN_EVENTS = 10;
4
+ const MAX_EVENTS = 1e3;
5
+ const DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG = {
6
+ enabled: true,
7
+ level: "verbose",
8
+ maxEvents: 300,
9
+ console: true,
10
+ browser: {
11
+ enabled: true,
12
+ scope: CHROME_OBSERVABILITY_SCOPE,
13
+ mode: "development"
14
+ },
15
+ trace: {
16
+ printStart: true
17
+ },
18
+ react: {
19
+ injectLoadedCallback: false,
20
+ remoteIds: []
21
+ }
22
+ };
23
+ const isObject = (value) => typeof value === "object" && value !== null;
24
+ const normalizeBoolean = (value, fallback) => typeof value === "boolean" ? value : fallback;
25
+ const normalizeLevel = (value) => value === "error" || value === "summary" || value === "verbose" ? value : DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.level;
26
+ const normalizeMode = (value) => value === "production" || value === "development" ? value : DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.browser.mode;
27
+ const normalizeMaxEvents = (value) => {
28
+ const parsed = Number(value);
29
+ if (!Number.isFinite(parsed)) {
30
+ return DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.maxEvents;
31
+ }
32
+ return Math.max(MIN_EVENTS, Math.min(MAX_EVENTS, Math.floor(parsed)));
33
+ };
34
+ const normalizeScope = (value) => {
35
+ if (typeof value !== "string") {
36
+ return CHROME_OBSERVABILITY_SCOPE;
37
+ }
38
+ const trimmed = value.trim().replace(/[^\w:@.-]+/g, "-");
39
+ return trimmed || CHROME_OBSERVABILITY_SCOPE;
40
+ };
41
+ const normalizeObservabilityDevtoolsConfig = (value) => {
42
+ const source = isObject(value) ? value : {};
43
+ const browser = isObject(source.browser) ? source.browser : {};
44
+ const trace = isObject(source.trace) ? source.trace : {};
45
+ return {
46
+ enabled: normalizeBoolean(
47
+ source.enabled,
48
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.enabled
49
+ ),
50
+ level: normalizeLevel(source.level),
51
+ maxEvents: normalizeMaxEvents(source.maxEvents),
52
+ console: normalizeBoolean(
53
+ source.console,
54
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.console
55
+ ),
56
+ browser: {
57
+ enabled: normalizeBoolean(
58
+ browser.enabled,
59
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.browser.enabled
60
+ ),
61
+ scope: normalizeScope(browser.scope),
62
+ mode: normalizeMode(browser.mode)
63
+ },
64
+ trace: {
65
+ printStart: normalizeBoolean(
66
+ trace.printStart,
67
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG.trace.printStart
68
+ )
69
+ },
70
+ react: {
71
+ injectLoadedCallback: false,
72
+ remoteIds: []
73
+ }
74
+ };
75
+ };
76
+ const createObservabilityPluginOptions = (config) => ({
77
+ enabled: config.enabled,
78
+ level: config.level,
79
+ maxEvents: config.maxEvents,
80
+ console: config.console,
81
+ browser: {
82
+ enabled: config.browser.enabled,
83
+ scope: config.browser.scope,
84
+ mode: config.browser.mode
85
+ },
86
+ trace: {
87
+ printStart: config.trace.printStart
88
+ },
89
+ devtools: {
90
+ enabled: true,
91
+ source: OBSERVABILITY_DEVTOOLS_SOURCE
92
+ }
93
+ });
94
+ export {
95
+ CHROME_OBSERVABILITY_SCOPE,
96
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG,
97
+ createObservabilityPluginOptions,
98
+ normalizeObservabilityDevtoolsConfig
99
+ };
@@ -0,0 +1,208 @@
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 { injectScript } from "./index";
22
+ import { OBSERVABILITY_DEVTOOLS_STORAGE_KEY } from "./messages";
23
+ import {
24
+ CHROME_OBSERVABILITY_SCOPE,
25
+ DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG,
26
+ normalizeObservabilityDevtoolsConfig
27
+ } from "./observability-shared";
28
+ const USER_OBSERVABILITY_PLUGIN_NAME = "observability-plugin";
29
+ const CHROME_OBSERVABILITY_PLUGIN_NAME = "observability-plugin:chrome-extension";
30
+ const LEGACY_CHROME_OBSERVABILITY_PLUGIN_NAME = "observability-plugin-devtools";
31
+ const OBSERVABILITY_SNAPSHOT_CONTEXT = {
32
+ chromeScope: CHROME_OBSERVABILITY_SCOPE,
33
+ userPluginName: USER_OBSERVABILITY_PLUGIN_NAME,
34
+ chromePluginNames: [
35
+ CHROME_OBSERVABILITY_PLUGIN_NAME,
36
+ LEGACY_CHROME_OBSERVABILITY_PLUGIN_NAME
37
+ ]
38
+ };
39
+ const readConfigFromPage = (storageKey) => {
40
+ var _a;
41
+ try {
42
+ const raw = (_a = window.localStorage) == null ? void 0 : _a.getItem(storageKey);
43
+ return raw ? JSON.parse(raw) : null;
44
+ } catch (e) {
45
+ return null;
46
+ }
47
+ };
48
+ const writeConfigToPage = (storageKey, config) => {
49
+ var _a;
50
+ (_a = window.localStorage) == null ? void 0 : _a.setItem(storageKey, JSON.stringify(config));
51
+ return config;
52
+ };
53
+ const removeConfigFromPage = (storageKey) => {
54
+ var _a;
55
+ (_a = window.localStorage) == null ? void 0 : _a.removeItem(storageKey);
56
+ return true;
57
+ };
58
+ const reloadPage = () => {
59
+ var _a;
60
+ (_a = globalThis.location) == null ? void 0 : _a.reload();
61
+ };
62
+ const readSnapshotFromPage = (storageKey, context) => {
63
+ const chromeScope = typeof (context == null ? void 0 : context.chromeScope) === "string" ? context.chromeScope : "chrome_extension";
64
+ const userPluginName = typeof (context == null ? void 0 : context.userPluginName) === "string" ? context.userPluginName : "observability-plugin";
65
+ const chromePluginNames = Array.isArray(context == null ? void 0 : context.chromePluginNames) ? context.chromePluginNames : [
66
+ "observability-plugin:chrome-extension",
67
+ "observability-plugin-devtools"
68
+ ];
69
+ const safeCopy = (value) => {
70
+ try {
71
+ return JSON.parse(JSON.stringify(value));
72
+ } catch (e) {
73
+ return void 0;
74
+ }
75
+ };
76
+ const rawConfig = (() => {
77
+ var _a;
78
+ try {
79
+ const raw = (_a = window.localStorage) == null ? void 0 : _a.getItem(storageKey);
80
+ return raw ? JSON.parse(raw) : null;
81
+ } catch (e) {
82
+ return null;
83
+ }
84
+ })();
85
+ const federation = window.__FEDERATION__ || window.__VMOK__;
86
+ const readers = (federation == null ? void 0 : federation.__OBSERVABILITY__) || {};
87
+ const reports = [];
88
+ const scopes = Object.keys(readers);
89
+ const isChromeObservabilityPluginName = (name) => chromePluginNames.includes(String(name));
90
+ const hasUserObservabilityPluginFromInstances = Array.isArray(
91
+ federation == null ? void 0 : federation.__INSTANCES__
92
+ ) ? federation.__INSTANCES__.some((instance) => {
93
+ var _a;
94
+ const plugins = (_a = instance == null ? void 0 : instance.options) == null ? void 0 : _a.plugins;
95
+ if (!Array.isArray(plugins)) {
96
+ return false;
97
+ }
98
+ return plugins.some(
99
+ (plugin) => (plugin == null ? void 0 : plugin.name) === userPluginName && !isChromeObservabilityPluginName(plugin == null ? void 0 : plugin.name)
100
+ );
101
+ }) : false;
102
+ const hasUserObservabilityPluginFromReaders = scopes.some(
103
+ (scope) => scope !== chromeScope
104
+ );
105
+ scopes.forEach((scope) => {
106
+ const reader = readers[scope];
107
+ if (!reader || typeof reader.getReports !== "function") {
108
+ return;
109
+ }
110
+ try {
111
+ const scopeReports = reader.getReports({ limit: 100 });
112
+ if (!Array.isArray(scopeReports)) {
113
+ return;
114
+ }
115
+ scopeReports.forEach((report) => {
116
+ const copied = safeCopy(report);
117
+ if (copied == null ? void 0 : copied.traceId) {
118
+ copied.__scope = scope;
119
+ reports.push(copied);
120
+ }
121
+ });
122
+ } catch (e) {
123
+ }
124
+ });
125
+ return {
126
+ config: rawConfig,
127
+ stored: Boolean(rawConfig),
128
+ scopes,
129
+ reports,
130
+ hasUserObservabilityPlugin: hasUserObservabilityPluginFromInstances || hasUserObservabilityPluginFromReaders
131
+ };
132
+ };
133
+ const readObservabilityConfig = () => __async(void 0, null, function* () {
134
+ const config = yield injectScript(
135
+ readConfigFromPage,
136
+ false,
137
+ OBSERVABILITY_DEVTOOLS_STORAGE_KEY
138
+ );
139
+ return normalizeObservabilityDevtoolsConfig(
140
+ config || DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
141
+ );
142
+ });
143
+ const applyObservabilityConfig = (config) => __async(void 0, null, function* () {
144
+ return injectScript(
145
+ writeConfigToPage,
146
+ false,
147
+ OBSERVABILITY_DEVTOOLS_STORAGE_KEY,
148
+ normalizeObservabilityDevtoolsConfig(config)
149
+ );
150
+ });
151
+ const disableObservabilityConfig = () => __async(void 0, null, function* () {
152
+ return injectScript(removeConfigFromPage, false, OBSERVABILITY_DEVTOOLS_STORAGE_KEY);
153
+ });
154
+ const reloadInspectedPage = () => __async(void 0, null, function* () {
155
+ return injectScript(reloadPage, false);
156
+ });
157
+ const readObservabilitySnapshot = () => __async(void 0, null, function* () {
158
+ const snapshot = yield injectScript(
159
+ readSnapshotFromPage,
160
+ true,
161
+ OBSERVABILITY_DEVTOOLS_STORAGE_KEY,
162
+ OBSERVABILITY_SNAPSHOT_CONTEXT
163
+ );
164
+ return {
165
+ config: normalizeObservabilityDevtoolsConfig(
166
+ (snapshot == null ? void 0 : snapshot.config) || DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
167
+ ),
168
+ stored: Boolean(snapshot == null ? void 0 : snapshot.stored),
169
+ scopes: Array.isArray(snapshot == null ? void 0 : snapshot.scopes) ? snapshot.scopes : [],
170
+ reports: Array.isArray(snapshot == null ? void 0 : snapshot.reports) ? snapshot.reports : [],
171
+ hasUserObservabilityPlugin: Boolean(snapshot == null ? void 0 : snapshot.hasUserObservabilityPlugin)
172
+ };
173
+ });
174
+ const mergeObservabilityReports = (currentReports, incomingReports) => {
175
+ const merged = /* @__PURE__ */ new Map();
176
+ currentReports.forEach((report) => {
177
+ if (report.traceId) {
178
+ merged.set(report.traceId, report);
179
+ }
180
+ });
181
+ incomingReports.forEach((report) => {
182
+ if (report.traceId) {
183
+ merged.set(report.traceId, report);
184
+ }
185
+ });
186
+ return Array.from(merged.values()).sort((left, right) => {
187
+ if ((right.updatedAt || 0) !== (left.updatedAt || 0)) {
188
+ return (right.updatedAt || 0) - (left.updatedAt || 0);
189
+ }
190
+ return (right.startedAt || 0) - (left.startedAt || 0);
191
+ });
192
+ };
193
+ const getObservabilityReportScopeLabel = (report) => {
194
+ const scope = report.__scope;
195
+ if (!scope || scope === CHROME_OBSERVABILITY_SCOPE) {
196
+ return void 0;
197
+ }
198
+ return `custom: ${scope}`;
199
+ };
200
+ export {
201
+ applyObservabilityConfig,
202
+ disableObservabilityConfig,
203
+ getObservabilityReportScopeLabel,
204
+ mergeObservabilityReports,
205
+ readObservabilityConfig,
206
+ readObservabilitySnapshot,
207
+ reloadInspectedPage
208
+ };
@@ -0,0 +1,2 @@
1
+ const basicProxyCore = require("../../vendor/basic-proxy-core.js");
2
+ basicProxyCore.registerOverridePlugin(globalThis);
@@ -0,0 +1,5 @@
1
+ import { getUrl } from "./index";
2
+ const postMessageUrl = getUrl("post-message.js");
3
+ const script = document.createElement("script");
4
+ script.src = postMessageUrl;
5
+ document.getElementsByTagName("html")[0].appendChild(script);
@@ -0,0 +1,39 @@
1
+ import { sanitizePostMessagePayload } from "./safe-post-message";
2
+ import {
3
+ MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT,
4
+ OBSERVABILITY_DEVTOOLS_SOURCE
5
+ } from "./messages";
6
+ const isModuleInfoPayload = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
7
+ const getMessageData = (data) => Boolean(data) && typeof data === "object" ? data : {};
8
+ if (window.moduleHandler) {
9
+ window.removeEventListener("message", window.moduleHandler);
10
+ } else {
11
+ window.moduleHandler = (event) => {
12
+ const { origin } = event;
13
+ const data = getMessageData(event.data);
14
+ if ((data == null ? void 0 : data.source) === OBSERVABILITY_DEVTOOLS_SOURCE) {
15
+ chrome.runtime.sendMessage({
16
+ type: MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT,
17
+ origin,
18
+ data: sanitizePostMessagePayload(data)
19
+ }).catch(() => {
20
+ return false;
21
+ });
22
+ return;
23
+ }
24
+ if (!isModuleInfoPayload(data.moduleInfo)) {
25
+ return;
26
+ }
27
+ chrome.runtime.sendMessage({
28
+ origin,
29
+ data: sanitizePostMessagePayload({
30
+ moduleInfo: data.moduleInfo,
31
+ updateModule: data.updateModule,
32
+ share: data.share
33
+ })
34
+ }).catch(() => {
35
+ return false;
36
+ });
37
+ };
38
+ }
39
+ window.addEventListener("message", window.moduleHandler);
@@ -0,0 +1,10 @@
1
+ var _a, _b;
2
+ import { sanitizePostMessagePayload } from "./safe-post-message";
3
+ const moduleInfo = (_a = window == null ? void 0 : window.__FEDERATION__) == null ? void 0 : _a.moduleInfo;
4
+ window.postMessage(
5
+ sanitizePostMessagePayload({
6
+ moduleInfo,
7
+ share: (_b = window == null ? void 0 : window.__FEDERATION__) == null ? void 0 : _b.__SHARE__
8
+ }),
9
+ "*"
10
+ );
@@ -0,0 +1,71 @@
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
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+ var _a;
30
+ import helpers from "@module-federation/runtime/helpers";
31
+ import { definePropertyGlobalVal } from "../sdk";
32
+ import { sanitizePostMessagePayload } from "./safe-post-message";
33
+ const getModuleInfo = () => {
34
+ return {
35
+ name: "mf-devtool-getModuleInfo-plugin",
36
+ loadRemoteSnapshot(_a2) {
37
+ var _b = _a2, {
38
+ options,
39
+ moduleInfo,
40
+ remoteSnapshot
41
+ } = _b, res = __objRest(_b, [
42
+ "options",
43
+ "moduleInfo",
44
+ "remoteSnapshot"
45
+ ]);
46
+ const globalSnapshot = helpers.global.getGlobalSnapshot();
47
+ if (!options || options.inBrowser) {
48
+ window.postMessage(
49
+ sanitizePostMessagePayload({
50
+ moduleInfo: globalSnapshot,
51
+ updateModule: moduleInfo
52
+ }),
53
+ "*"
54
+ );
55
+ }
56
+ return __spreadValues({
57
+ options,
58
+ moduleInfo,
59
+ remoteSnapshot
60
+ }, res);
61
+ }
62
+ };
63
+ };
64
+ if (!(window == null ? void 0 : window.__FEDERATION__)) {
65
+ definePropertyGlobalVal(window, "__FEDERATION__", {});
66
+ definePropertyGlobalVal(window, "__VMOK__", window.__FEDERATION__);
67
+ }
68
+ if (!(window == null ? void 0 : window.__FEDERATION__.__GLOBAL_PLUGIN__)) {
69
+ window.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
70
+ }
71
+ (_a = window.__FEDERATION__.__GLOBAL_PLUGIN__) == null ? void 0 : _a.push(getModuleInfo());
@@ -0,0 +1,124 @@
1
+ const FUNCTION_PLACEHOLDER = "function(){}";
2
+ const UNDEFINED_PLACEHOLDER = "[undefined]";
3
+ const CIRCULAR_PLACEHOLDER = "[circular]";
4
+ const NON_SERIALIZABLE_PLACEHOLDER = "[unserializable]";
5
+ const toStringTag = (value) => Object.prototype.toString.call(value).slice(8, -1);
6
+ const isPlainObject = (value) => {
7
+ if (!value || typeof value !== "object") {
8
+ return false;
9
+ }
10
+ const proto = Object.getPrototypeOf(value);
11
+ return proto === Object.prototype || proto === null;
12
+ };
13
+ const sanitizeValue = (value, seen) => {
14
+ if (value === null || typeof value === "string" || typeof value === "number") {
15
+ return Number.isNaN(value) ? "[NaN]" : value;
16
+ }
17
+ if (typeof value === "boolean") {
18
+ return value;
19
+ }
20
+ if (typeof value === "function") {
21
+ return FUNCTION_PLACEHOLDER;
22
+ }
23
+ if (typeof value === "undefined") {
24
+ return UNDEFINED_PLACEHOLDER;
25
+ }
26
+ if (typeof value === "bigint" || typeof value === "symbol") {
27
+ return String(value);
28
+ }
29
+ if (!(value instanceof Object)) {
30
+ return NON_SERIALIZABLE_PLACEHOLDER;
31
+ }
32
+ if (seen.has(value)) {
33
+ return CIRCULAR_PLACEHOLDER;
34
+ }
35
+ if (Array.isArray(value)) {
36
+ const next2 = [];
37
+ seen.set(value, next2);
38
+ value.forEach((item, index) => {
39
+ next2[index] = sanitizeValue(item, seen);
40
+ });
41
+ return next2;
42
+ }
43
+ if (value instanceof Date) {
44
+ return value.toISOString();
45
+ }
46
+ if (value instanceof RegExp) {
47
+ return value.toString();
48
+ }
49
+ if (value instanceof Error) {
50
+ const next2 = {
51
+ name: value.name,
52
+ message: value.message,
53
+ stack: value.stack || ""
54
+ };
55
+ seen.set(value, next2);
56
+ return next2;
57
+ }
58
+ if (value instanceof Map) {
59
+ const next2 = [];
60
+ seen.set(value, next2);
61
+ next2.push(
62
+ ...Array.from(value.entries()).map(([key, item]) => [
63
+ sanitizeValue(key, seen),
64
+ sanitizeValue(item, seen)
65
+ ])
66
+ );
67
+ return next2;
68
+ }
69
+ if (value instanceof Set) {
70
+ const next2 = [];
71
+ seen.set(value, next2);
72
+ next2.push(
73
+ ...Array.from(value.values()).map((item) => sanitizeValue(item, seen))
74
+ );
75
+ return next2;
76
+ }
77
+ if (ArrayBuffer.isView(value)) {
78
+ return Array.from(new Uint8Array(value.buffer));
79
+ }
80
+ if (value instanceof ArrayBuffer) {
81
+ return Array.from(new Uint8Array(value));
82
+ }
83
+ if (typeof Node !== "undefined" && value instanceof Node) {
84
+ return `[${toStringTag(value)}]`;
85
+ }
86
+ if (typeof Window !== "undefined" && value instanceof Window) {
87
+ return "[Window]";
88
+ }
89
+ if (typeof Document !== "undefined" && value instanceof Document) {
90
+ return "[Document]";
91
+ }
92
+ const next = {};
93
+ seen.set(value, next);
94
+ const entries = isPlainObject(value) ? Object.keys(value).map((key) => {
95
+ try {
96
+ return [key, value[key]];
97
+ } catch (_error) {
98
+ return [key, NON_SERIALIZABLE_PLACEHOLDER];
99
+ }
100
+ }) : Reflect.ownKeys(value).map((key) => {
101
+ try {
102
+ return [
103
+ String(key),
104
+ value[key]
105
+ ];
106
+ } catch (_error) {
107
+ return [String(key), NON_SERIALIZABLE_PLACEHOLDER];
108
+ }
109
+ });
110
+ entries.forEach(([key, item]) => {
111
+ try {
112
+ next[key] = sanitizeValue(item, seen);
113
+ } catch (_error) {
114
+ next[key] = NON_SERIALIZABLE_PLACEHOLDER;
115
+ }
116
+ });
117
+ return next;
118
+ };
119
+ const sanitizePostMessagePayload = (payload) => {
120
+ return sanitizeValue(payload, /* @__PURE__ */ new WeakMap());
121
+ };
122
+ export {
123
+ sanitizePostMessagePayload
124
+ };
@@ -0,0 +1,2 @@
1
+ const basicProxyCore = require("../../vendor/basic-proxy-core.js");
2
+ basicProxyCore.registerSnapshotPlugin(globalThis);