dsh-mermaid-plus 0.1.0 → 0.1.2
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/index.js +8 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -110,6 +110,8 @@ export const inject = ['webServer'];
|
|
|
110
110
|
*/
|
|
111
111
|
const DIAG_DIR = join(tmpdir(), PKG_NAME.replace(/^@/, '').replace(/[^a-z0-9]+/gi, '-').toLowerCase());
|
|
112
112
|
const DIAG_FILE = join(DIAG_DIR, 'report.json');
|
|
113
|
+
/** The Host half's own activation dump, separate from the browser's event log. */
|
|
114
|
+
const ACTIVATION_FILE = join(DIAG_DIR, 'activation.json');
|
|
113
115
|
|
|
114
116
|
/** Cap the diagnostic log so a long session cannot grow the file without bound. */
|
|
115
117
|
const DIAG_LIMIT = 200;
|
|
@@ -193,6 +195,10 @@ async function receiveReport(request, response) {
|
|
|
193
195
|
*/
|
|
194
196
|
async function dumpDiagnostics(ctx) {
|
|
195
197
|
try {
|
|
198
|
+
// The client-module graph is composed after plugins mount, so an immediate
|
|
199
|
+
// read sees nothing. One short delay makes the dump answer the question it
|
|
200
|
+
// exists for: is this package's browser row in the graph?
|
|
201
|
+
await new Promise((resolve) => setTimeout(resolve, 2500).unref?.());
|
|
196
202
|
const clientModules = ctx.get('clientModules');
|
|
197
203
|
const graph = clientModules?.graph?.();
|
|
198
204
|
const table = clientModules?.table;
|
|
@@ -218,7 +224,8 @@ async function dumpDiagnostics(ctx) {
|
|
|
218
224
|
}
|
|
219
225
|
})(),
|
|
220
226
|
};
|
|
221
|
-
await
|
|
227
|
+
await mkdir(DIAG_DIR, { recursive: true });
|
|
228
|
+
await writeFile(ACTIVATION_FILE, `${JSON.stringify(payload, null, 2)}\n`);
|
|
222
229
|
} catch (error) {
|
|
223
230
|
ctx.logger?.warn?.(`dsh-mermaid: diagnostics failed: ${String(error)}`);
|
|
224
231
|
}
|
package/package.json
CHANGED