posipaki 0.20.0 → 0.20.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.
- package/dist/plugins/debug-logger.js +1 -13
- package/dist/plugins/debug-logger.js.map +1 -1
- package/dist/pname-match-ddweNtrI.js +16 -0
- package/dist/pname-match-ddweNtrI.js.map +1 -0
- package/dist/testing/index.d.ts +36 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +106 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { r as mergeConfigs } from "../hooks-Q4l5ggDj.js";
|
|
2
|
-
|
|
3
|
-
/** True if `name` matches any of `patterns`. */
|
|
4
|
-
function pnameMatch(name, patterns) {
|
|
5
|
-
for (const p of patterns) {
|
|
6
|
-
if (p === "*") return true;
|
|
7
|
-
if (p.endsWith(":*")) {
|
|
8
|
-
const prefix = p.slice(0, -2);
|
|
9
|
-
if (name === prefix || name.startsWith(prefix + ":")) return true;
|
|
10
|
-
} else if (p === name) return true;
|
|
11
|
-
}
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
2
|
+
import { t as pnameMatch } from "../pname-match-ddweNtrI.js";
|
|
15
3
|
//#region src/plugins/debug-logger.ts
|
|
16
4
|
function patterns() {
|
|
17
5
|
const raw = (process.env.DEBUG ?? "").trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-logger.js","names":[],"sources":["../../src/
|
|
1
|
+
{"version":3,"file":"debug-logger.js","names":[],"sources":["../../src/plugins/debug-logger.ts"],"sourcesContent":["import type { ActorPlugin } from \"../hooks\";\nimport { mergeConfigs } from \"../hooks\";\nimport type { Message } from \"../types\";\nimport { pnameMatch } from \"../testing/pname-match\";\n\ndeclare module \"../hooks\" {\n interface ActorDecorated {\n log: Logger;\n }\n}\n\nexport interface DebugLogFn {\n (message: string, ...args: unknown[]): void;\n}\nexport interface Logger {\n debug: DebugLogFn;\n info: DebugLogFn;\n warn: DebugLogFn;\n error: DebugLogFn;\n}\nexport type LoggerFactory = (name: string) => Logger;\nexport interface DebugLoggerOpts {\n ignore?: string[];\n factory?: LoggerFactory;\n}\n\nfunction patterns(): string[] {\n const raw = (process.env.DEBUG ?? \"\").trim();\n if (!raw) return [];\n return raw\n .split(\",\")\n .map((p) => p.trim())\n .filter(Boolean);\n}\nfunction defaultFactory(name: string): Logger {\n return {\n debug: (...a: unknown[]) => console.debug(`[${name}]`, ...a),\n info: (...a: unknown[]) => console.info(`[${name}]`, ...a),\n warn: (...a: unknown[]) => console.warn(`[${name}]`, ...a),\n error: (...a: unknown[]) => console.error(`[${name}]`, ...a),\n };\n}\n\nexport function debugLogger(opts?: DebugLoggerOpts): ActorPlugin {\n const ignoreSet = new Set(opts?.ignore ?? []);\n const factory = opts?.factory ?? defaultFactory;\n return async (config) => {\n const name: string = config.name ?? \"actor\";\n const pats = patterns();\n const log = factory(name);\n\n // Always decorate this.log — even when DEBUG is empty\n let result = mergeConfigs(config, {\n methods: { ...config.methods },\n $decorate: { log },\n });\n\n if (pnameMatch(name, pats)) {\n result = mergeConfigs(result, {\n onMessage(msg: Message) {\n if (!ignoreSet.has(msg.type)) log.debug(`${name} ← ${msg.type}`, msg);\n },\n onEmit(msg: Message) {\n log.debug(`${name} → ${msg.type}`, msg);\n },\n onChildExit(childName: string) {\n log.debug(`child ${childName} exited`);\n },\n onError(err: unknown) {\n log.error(`${(err as Error).message ?? err}`);\n },\n });\n }\n\n return result;\n };\n}\n"],"mappings":";;;AA0BA,SAAS,WAAqB;CAC5B,MAAM,OAAO,QAAQ,IAAI,SAAS,IAAI,KAAK;CAC3C,IAAI,CAAC,KAAK,OAAO,CAAC;CAClB,OAAO,IACJ,MAAM,GAAG,EACT,KAAK,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO;AACnB;AACA,SAAS,eAAe,MAAsB;CAC5C,OAAO;EACL,QAAQ,GAAG,MAAiB,QAAQ,MAAM,IAAI,KAAK,IAAI,GAAG,CAAC;EAC3D,OAAO,GAAG,MAAiB,QAAQ,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC;EACzD,OAAO,GAAG,MAAiB,QAAQ,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC;EACzD,QAAQ,GAAG,MAAiB,QAAQ,MAAM,IAAI,KAAK,IAAI,GAAG,CAAC;CAC7D;AACF;AAEA,SAAgB,YAAY,MAAqC;CAC/D,MAAM,YAAY,IAAI,IAAI,MAAM,UAAU,CAAC,CAAC;CAC5C,MAAM,UAAU,MAAM,WAAW;CACjC,OAAO,OAAO,WAAW;EACvB,MAAM,OAAe,OAAO,QAAQ;EACpC,MAAM,OAAO,SAAS;EACtB,MAAM,MAAM,QAAQ,IAAI;EAGxB,IAAI,SAAS,aAAa,QAAQ;GAChC,SAAS,EAAE,GAAG,OAAO,QAAQ;GAC7B,WAAW,EAAE,IAAI;EACnB,CAAC;EAED,IAAI,WAAW,MAAM,IAAI,GACvB,SAAS,aAAa,QAAQ;GAC5B,UAAU,KAAc;IACtB,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,GAAG,IAAI,MAAM,GAAG,KAAK,KAAK,IAAI,QAAQ,GAAG;GACtE;GACA,OAAO,KAAc;IACnB,IAAI,MAAM,GAAG,KAAK,KAAK,IAAI,QAAQ,GAAG;GACxC;GACA,YAAY,WAAmB;IAC7B,IAAI,MAAM,SAAS,UAAU,QAAQ;GACvC;GACA,QAAQ,KAAc;IACpB,IAAI,MAAM,GAAI,IAAc,WAAW,KAAK;GAC9C;EACF,CAAC;EAGH,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/testing/pname-match.ts
|
|
2
|
+
/** True if `name` matches any of `patterns`. */
|
|
3
|
+
function pnameMatch(name, patterns) {
|
|
4
|
+
for (const p of patterns) {
|
|
5
|
+
if (p === "*") return true;
|
|
6
|
+
if (p.endsWith(":*")) {
|
|
7
|
+
const prefix = p.slice(0, -2);
|
|
8
|
+
if (name === prefix || name.startsWith(prefix + ":")) return true;
|
|
9
|
+
} else if (p === name) return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { pnameMatch as t };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=pname-match-ddweNtrI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pname-match-ddweNtrI.js","names":[],"sources":["../src/testing/pname-match.ts"],"sourcesContent":["// ── Process Name Match ───────────────────────────────────────────────────\n//\n// Tree-prefix matching for posipaki process names (`parent:child:...`).\n//\n// Pattern language (same as debug-logger's DEBUG env filtering):\n// - \"*\" matches any name\n// - \"name\" matches exactly\n// - \"prefix:*\" matches `prefix` and `prefix:` + anything below it\n\n/** True if `name` matches any of `patterns`. */\nexport function pnameMatch(name: string, patterns: string[]): boolean {\n for (const p of patterns) {\n if (p === \"*\") return true;\n if (p.endsWith(\":*\")) {\n const prefix = p.slice(0, -2);\n if (name === prefix || name.startsWith(prefix + \":\")) return true;\n } else if (p === name) {\n return true;\n }\n }\n return false;\n}\n"],"mappings":";;AAUA,SAAgB,WAAW,MAAc,UAA6B;CACpE,KAAK,MAAM,KAAK,UAAU;EACxB,IAAI,MAAM,KAAK,OAAO;EACtB,IAAI,EAAE,SAAS,IAAI,GAAG;GACpB,MAAM,SAAS,EAAE,MAAM,GAAG,EAAE;GAC5B,IAAI,SAAS,UAAU,KAAK,WAAW,SAAS,GAAG,GAAG,OAAO;EAC/D,OAAO,IAAI,MAAM,MACf,OAAO;CAEX;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { r as Message } from "../types-D4ZgiRY9.js";
|
|
2
|
+
import { d as ActorPlugin } from "../hooks-DfhM6sqw.js";
|
|
3
|
+
|
|
4
|
+
//#region src/testing/msg-matcher.d.ts
|
|
5
|
+
type Matcher<M extends Message> = (msg: M, history: M[]) => boolean;
|
|
6
|
+
type MatchSpec<M extends Message> = Matcher<M> | Partial<M> | Array<Partial<M>>;
|
|
7
|
+
/** Convert a matcher spec to a canonical matcher function. */
|
|
8
|
+
declare function toMatcher<M extends Message>(spec: MatchSpec<M>): Matcher<M>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/testing/test-plugin.d.ts
|
|
11
|
+
interface MatchResult {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
detail?: string;
|
|
14
|
+
}
|
|
15
|
+
interface Collector<M extends Message> {
|
|
16
|
+
plugin: ActorPlugin;
|
|
17
|
+
messages: M[];
|
|
18
|
+
resolved(): Promise<MatchResult>;
|
|
19
|
+
next(filter: MatchSpec<M>): Promise<MatchResult>;
|
|
20
|
+
reset(filter?: MatchSpec<M>): void;
|
|
21
|
+
}
|
|
22
|
+
interface RootTracker {
|
|
23
|
+
plugin: ActorPlugin;
|
|
24
|
+
stopAll(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
declare function createCollector<M extends Message>(filter: MatchSpec<M>, opts?: {
|
|
27
|
+
scope?: string | string[];
|
|
28
|
+
}): Collector<M>;
|
|
29
|
+
declare function createRootTracker(): RootTracker;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/testing/pname-match.d.ts
|
|
32
|
+
/** True if `name` matches any of `patterns`. */
|
|
33
|
+
declare function pnameMatch(name: string, patterns: string[]): boolean;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type Collector, type MatchResult, type MatchSpec, type Matcher, type RootTracker, createCollector, createRootTracker, pnameMatch, toMatcher };
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/testing/msg-matcher.ts","../../src/testing/test-plugin.ts","../../src/testing/pname-match.ts"],"mappings":";;;;KAaY,OAAA,WAAkB,OAAA,KAAY,GAAA,EAAK,CAAA,EAAG,OAAA,EAAS,CAAA;AAAA,KAE/C,SAAA,WAAoB,OAAA,IAC5B,OAAA,CAAQ,CAAA,IACR,OAAA,CAAQ,CAAA,IACR,KAAA,CAAM,OAAA,CAAQ,CAAA;;iBAUF,SAAA,WAAoB,OAAA,EAAS,IAAA,EAAM,SAAA,CAAU,CAAA,IAAK,OAAA,CAAQ,CAAA;;;UChBzD,WAAA;EACf,EAAA;EACA,MAAM;AAAA;AAAA,UAGS,SAAA,WAAoB,OAAA;EACnC,MAAA,EAAQ,WAAA;EACR,QAAA,EAAU,CAAA;EACV,QAAA,IAAY,OAAA,CAAQ,WAAA;EACpB,IAAA,CAAK,MAAA,EAAQ,SAAA,CAAU,CAAA,IAAK,OAAA,CAAQ,WAAA;EACpC,KAAA,CAAM,MAAA,GAAS,SAAA,CAAU,CAAA;AAAA;AAAA,UAGV,WAAA;EACf,MAAA,EAAQ,WAAA;EACR,OAAA,IAAW,OAAO;AAAA;AAAA,iBAKJ,eAAA,WAA0B,OAAA,EACxC,MAAA,EAAQ,SAAA,CAAU,CAAA,GAClB,IAAA;EAAS,KAAA;AAAA,IACR,SAAA,CAAU,CAAA;AAAA,iBAwEG,iBAAA,IAAqB,WAAW;;;;iBCjGhC,UAAA,CAAW,IAAA,UAAc,QAAkB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { r as mergeConfigs } from "../hooks-Q4l5ggDj.js";
|
|
2
|
+
import { t as pnameMatch } from "../pname-match-ddweNtrI.js";
|
|
3
|
+
//#region src/testing/msg-matcher.ts
|
|
4
|
+
function shallowMatch(msg, spec) {
|
|
5
|
+
for (const key of Object.keys(spec)) if (msg[key] !== spec[key]) return false;
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
/** Convert a matcher spec to a canonical matcher function. */
|
|
9
|
+
function toMatcher(spec) {
|
|
10
|
+
if (typeof spec === "function") return spec;
|
|
11
|
+
if (Array.isArray(spec)) return (_msg, history) => {
|
|
12
|
+
if (history.length < spec.length) return false;
|
|
13
|
+
const tail = history.slice(-spec.length);
|
|
14
|
+
return spec.every((s, i) => shallowMatch(tail[i], s));
|
|
15
|
+
};
|
|
16
|
+
return (msg) => shallowMatch(msg, spec);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/testing/test-plugin.ts
|
|
20
|
+
function createCollector(filter, opts) {
|
|
21
|
+
const messages = [];
|
|
22
|
+
let matcher = toMatcher(filter);
|
|
23
|
+
let defaultScope = [];
|
|
24
|
+
let installed = false;
|
|
25
|
+
let waiters = [];
|
|
26
|
+
function scopePatterns() {
|
|
27
|
+
if (opts?.scope === void 0) return defaultScope;
|
|
28
|
+
return Array.isArray(opts.scope) ? opts.scope : [opts.scope];
|
|
29
|
+
}
|
|
30
|
+
function checkAndNotify() {
|
|
31
|
+
const last = messages[messages.length - 1];
|
|
32
|
+
if (last !== void 0 && matcher(last, messages)) {
|
|
33
|
+
const ws = waiters.splice(0);
|
|
34
|
+
for (const w of ws) w({ ok: true });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function resolved() {
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
const last = messages[messages.length - 1];
|
|
40
|
+
if (last !== void 0 && matcher(last, messages)) {
|
|
41
|
+
resolve({ ok: true });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
waiters.push(resolve);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const collectorPlugin = (config) => {
|
|
48
|
+
const isRoot = !installed;
|
|
49
|
+
installed = true;
|
|
50
|
+
return mergeConfigs(config, {
|
|
51
|
+
beforeStart() {
|
|
52
|
+
if (isRoot) defaultScope = [this.name];
|
|
53
|
+
},
|
|
54
|
+
onEmit(msg, sender) {
|
|
55
|
+
if (!pnameMatch(sender.fromName, scopePatterns())) return;
|
|
56
|
+
messages.push(msg);
|
|
57
|
+
checkAndNotify();
|
|
58
|
+
},
|
|
59
|
+
onEnd() {
|
|
60
|
+
const ws = waiters.splice(0);
|
|
61
|
+
for (const w of ws) w({
|
|
62
|
+
ok: false,
|
|
63
|
+
detail: "actor exited before match"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(collectorPlugin, "name", { value: "messageCollector" });
|
|
69
|
+
return {
|
|
70
|
+
plugin: collectorPlugin,
|
|
71
|
+
messages,
|
|
72
|
+
resolved,
|
|
73
|
+
next(nextFilter) {
|
|
74
|
+
matcher = toMatcher(nextFilter);
|
|
75
|
+
return resolved();
|
|
76
|
+
},
|
|
77
|
+
reset(newFilter) {
|
|
78
|
+
if (newFilter) matcher = toMatcher(newFilter);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function createRootTracker() {
|
|
83
|
+
const roots = /* @__PURE__ */ new Set();
|
|
84
|
+
const rootTrackerPlugin = (config) => mergeConfigs(config, {
|
|
85
|
+
beforeStart() {
|
|
86
|
+
roots.add(this.ctx);
|
|
87
|
+
},
|
|
88
|
+
onEnd() {
|
|
89
|
+
roots.delete(this.ctx);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(rootTrackerPlugin, "name", { value: "rootTracker" });
|
|
93
|
+
return {
|
|
94
|
+
plugin: rootTrackerPlugin,
|
|
95
|
+
async stopAll() {
|
|
96
|
+
for (const root of roots) try {
|
|
97
|
+
root.sendSelf({ type: "STOP" });
|
|
98
|
+
} catch {}
|
|
99
|
+
roots.clear();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { createCollector, createRootTracker, pnameMatch, toMatcher };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/testing/msg-matcher.ts","../../src/testing/test-plugin.ts"],"sourcesContent":["// ── Message Matcher ──────────────────────────────────────────────────────\n//\n// Canonical form: `fn(msg, history) => boolean`. `msg` is the just-arrived\n// message (also the last element of `history`); `history` is the full\n// accumulated list *including* `msg`.\n//\n// Two shortcuts:\n// - a message literal `{ type: \"X\" }` → matches the latest message\n// - a list `[{...}, {...}]` → matches the tail of history,\n// in order, from oldest to newest\n\nimport type { Message } from \"../types.js\";\n\nexport type Matcher<M extends Message> = (msg: M, history: M[]) => boolean;\n\nexport type MatchSpec<M extends Message> =\n | Matcher<M>\n | Partial<M>\n | Array<Partial<M>>;\n\nfunction shallowMatch<M extends Message>(msg: M, spec: Partial<M>): boolean {\n for (const key of Object.keys(spec) as Array<keyof M>) {\n if (msg[key] !== spec[key]) return false;\n }\n return true;\n}\n\n/** Convert a matcher spec to a canonical matcher function. */\nexport function toMatcher<M extends Message>(spec: MatchSpec<M>): Matcher<M> {\n if (typeof spec === \"function\") return spec as Matcher<M>;\n\n if (Array.isArray(spec)) {\n // Sequence: the tail of history must equal `spec`, in order.\n return (_msg, history) => {\n if (history.length < spec.length) return false;\n const tail = history.slice(-spec.length);\n return spec.every((s, i) => shallowMatch(tail[i], s));\n };\n }\n\n // Single literal: the latest message must shallow-match.\n return (msg) => shallowMatch(msg, spec);\n}\n","// ── Test Plugins ─────────────────────────────────────────────────────────\n//\n// createCollector: per-actor message collector plugin.\n// createRootTracker: global process tracker for cleanup.\n\nimport { mergeConfigs, type ActorPlugin } from \"../hooks.js\";\nimport type { Message, StopMessage, SenderInfo, ProcessCtx } from \"../types.js\";\nimport { toMatcher, type MatchSpec } from \"./msg-matcher.js\";\nimport { pnameMatch } from \"./pname-match.js\";\n\n// ── types ────────────────────────────────────────────────────────────────\n\nexport interface MatchResult {\n ok: boolean;\n detail?: string;\n}\n\nexport interface Collector<M extends Message> {\n plugin: ActorPlugin;\n messages: M[];\n resolved(): Promise<MatchResult>;\n next(filter: MatchSpec<M>): Promise<MatchResult>;\n reset(filter?: MatchSpec<M>): void;\n}\n\nexport interface RootTracker {\n plugin: ActorPlugin;\n stopAll(): Promise<void>;\n}\n\n// ── createCollector ──────────────────────────────────────────────────────\n\nexport function createCollector<M extends Message>(\n filter: MatchSpec<M>,\n opts?: { scope?: string | string[] },\n): Collector<M> {\n const messages: M[] = [];\n let matcher = toMatcher(filter);\n // Captured from the root's beforeStart; used as the default scope.\n let defaultScope: string[] = [];\n // The plugin is installed on the root first (spawn assembles before any\n // child is forked), so the first install's beforeStart is the root.\n let installed = false;\n let waiters: Array<(result: MatchResult) => void> = [];\n\n function scopePatterns(): string[] {\n if (opts?.scope === undefined) return defaultScope;\n return Array.isArray(opts.scope) ? opts.scope : [opts.scope];\n }\n\n function checkAndNotify() {\n const last = messages[messages.length - 1];\n if (last !== undefined && matcher(last, messages)) {\n const ws = waiters.splice(0);\n for (const w of ws) w({ ok: true });\n }\n }\n\n function resolved(): Promise<MatchResult> {\n return new Promise((resolve) => {\n const last = messages[messages.length - 1];\n if (last !== undefined && matcher(last, messages)) {\n resolve({ ok: true });\n return;\n }\n waiters.push(resolve);\n });\n }\n\n const collectorPlugin: ActorPlugin = (config) => {\n const isRoot = !installed;\n installed = true;\n return mergeConfigs(config, {\n beforeStart() {\n if (isRoot) defaultScope = [this.name];\n },\n onEmit(msg: Message, sender: SenderInfo) {\n if (!pnameMatch(sender.fromName, scopePatterns())) return;\n messages.push(msg as M);\n checkAndNotify();\n },\n onEnd() {\n const ws = waiters.splice(0);\n for (const w of ws) w({ ok: false, detail: \"actor exited before match\" });\n },\n });\n };\n\n // Named function so framework deduplication works.\n Object.defineProperty(collectorPlugin, \"name\", { value: \"messageCollector\" });\n\n return {\n plugin: collectorPlugin,\n messages,\n resolved,\n next(nextFilter) {\n matcher = toMatcher(nextFilter);\n return resolved();\n },\n reset(newFilter) {\n if (newFilter) matcher = toMatcher(newFilter);\n },\n };\n}\n\n// ── createRootTracker ────────────────────────────────────────────────────\n\nexport function createRootTracker(): RootTracker {\n const roots = new Set<{ sendSelf: (msg: StopMessage) => void }>();\n\n const rootTrackerPlugin: ActorPlugin = (config) =>\n mergeConfigs(config, {\n beforeStart(this: { ctx: ProcessCtx<unknown, unknown, Message, Message> }) {\n roots.add(this.ctx);\n },\n onEnd(this: { ctx: ProcessCtx<unknown, unknown, Message, Message> }) {\n roots.delete(this.ctx);\n },\n });\n\n Object.defineProperty(rootTrackerPlugin, \"name\", { value: \"rootTracker\" });\n\n return {\n plugin: rootTrackerPlugin,\n async stopAll() {\n for (const root of roots) {\n try {\n root.sendSelf({ type: \"STOP\" });\n } catch {}\n }\n roots.clear();\n },\n };\n}\n"],"mappings":";;;AAoBA,SAAS,aAAgC,KAAQ,MAA2B;CAC1E,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAChC,IAAI,IAAI,SAAS,KAAK,MAAM,OAAO;CAErC,OAAO;AACT;;AAGA,SAAgB,UAA6B,MAAgC;CAC3E,IAAI,OAAO,SAAS,YAAY,OAAO;CAEvC,IAAI,MAAM,QAAQ,IAAI,GAEpB,QAAQ,MAAM,YAAY;EACxB,IAAI,QAAQ,SAAS,KAAK,QAAQ,OAAO;EACzC,MAAM,OAAO,QAAQ,MAAM,CAAC,KAAK,MAAM;EACvC,OAAO,KAAK,OAAO,GAAG,MAAM,aAAa,KAAK,IAAI,CAAC,CAAC;CACtD;CAIF,QAAQ,QAAQ,aAAa,KAAK,IAAI;AACxC;;;ACVA,SAAgB,gBACd,QACA,MACc;CACd,MAAM,WAAgB,CAAC;CACvB,IAAI,UAAU,UAAU,MAAM;CAE9B,IAAI,eAAyB,CAAC;CAG9B,IAAI,YAAY;CAChB,IAAI,UAAgD,CAAC;CAErD,SAAS,gBAA0B;EACjC,IAAI,MAAM,UAAU,KAAA,GAAW,OAAO;EACtC,OAAO,MAAM,QAAQ,KAAK,KAAK,IAAI,KAAK,QAAQ,CAAC,KAAK,KAAK;CAC7D;CAEA,SAAS,iBAAiB;EACxB,MAAM,OAAO,SAAS,SAAS,SAAS;EACxC,IAAI,SAAS,KAAA,KAAa,QAAQ,MAAM,QAAQ,GAAG;GACjD,MAAM,KAAK,QAAQ,OAAO,CAAC;GAC3B,KAAK,MAAM,KAAK,IAAI,EAAE,EAAE,IAAI,KAAK,CAAC;EACpC;CACF;CAEA,SAAS,WAAiC;EACxC,OAAO,IAAI,SAAS,YAAY;GAC9B,MAAM,OAAO,SAAS,SAAS,SAAS;GACxC,IAAI,SAAS,KAAA,KAAa,QAAQ,MAAM,QAAQ,GAAG;IACjD,QAAQ,EAAE,IAAI,KAAK,CAAC;IACpB;GACF;GACA,QAAQ,KAAK,OAAO;EACtB,CAAC;CACH;CAEA,MAAM,mBAAgC,WAAW;EAC/C,MAAM,SAAS,CAAC;EAChB,YAAY;EACZ,OAAO,aAAa,QAAQ;GAC1B,cAAc;IACZ,IAAI,QAAQ,eAAe,CAAC,KAAK,IAAI;GACvC;GACA,OAAO,KAAc,QAAoB;IACvC,IAAI,CAAC,WAAW,OAAO,UAAU,cAAc,CAAC,GAAG;IACnD,SAAS,KAAK,GAAQ;IACtB,eAAe;GACjB;GACA,QAAQ;IACN,MAAM,KAAK,QAAQ,OAAO,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,EAAE;KAAE,IAAI;KAAO,QAAQ;IAA4B,CAAC;GAC1E;EACF,CAAC;CACH;CAGA,OAAO,eAAe,iBAAiB,QAAQ,EAAE,OAAO,mBAAmB,CAAC;CAE5E,OAAO;EACL,QAAQ;EACR;EACA;EACA,KAAK,YAAY;GACf,UAAU,UAAU,UAAU;GAC9B,OAAO,SAAS;EAClB;EACA,MAAM,WAAW;GACf,IAAI,WAAW,UAAU,UAAU,SAAS;EAC9C;CACF;AACF;AAIA,SAAgB,oBAAiC;CAC/C,MAAM,wBAAQ,IAAI,IAA8C;CAEhE,MAAM,qBAAkC,WACtC,aAAa,QAAQ;EACnB,cAA2E;GACzE,MAAM,IAAI,KAAK,GAAG;EACpB;EACA,QAAqE;GACnE,MAAM,OAAO,KAAK,GAAG;EACvB;CACF,CAAC;CAEH,OAAO,eAAe,mBAAmB,QAAQ,EAAE,OAAO,cAAc,CAAC;CAEzE,OAAO;EACL,QAAQ;EACR,MAAM,UAAU;GACd,KAAK,MAAM,QAAQ,OACjB,IAAI;IACF,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;GAChC,QAAQ,CAAC;GAEX,MAAM,MAAM;EACd;CACF;AACF"}
|