jeopi-utils 16.2.13 → 16.2.14
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/CHANGELOG.md +3 -1
- package/README.md +2 -2
- package/package.json +6 -6
- package/src/dirs.ts +123 -75
- package/src/logger.ts +1 -1
- package/src/procmgr.ts +2 -2
- package/dist/types/abortable.d.ts +0 -32
- package/dist/types/async.d.ts +0 -6
- package/dist/types/binary.d.ts +0 -17
- package/dist/types/cli.d.ts +0 -117
- package/dist/types/color.d.ts +0 -102
- package/dist/types/dirs.d.ts +0 -260
- package/dist/types/env.d.ts +0 -74
- package/dist/types/fetch-retry.d.ts +0 -94
- package/dist/types/format.d.ts +0 -37
- package/dist/types/frontmatter.d.ts +0 -25
- package/dist/types/fs-error.d.ts +0 -31
- package/dist/types/glob.d.ts +0 -28
- package/dist/types/index.d.ts +0 -35
- package/dist/types/json-parse.d.ts +0 -48
- package/dist/types/json.d.ts +0 -4
- package/dist/types/logger.d.ts +0 -83
- package/dist/types/loop-phase.d.ts +0 -10
- package/dist/types/mermaid-ascii.d.ts +0 -11
- package/dist/types/mime.d.ts +0 -29
- package/dist/types/module-timer.d.ts +0 -1
- package/dist/types/path-tree.d.ts +0 -76
- package/dist/types/path.d.ts +0 -2
- package/dist/types/peek-file.d.ts +0 -29
- package/dist/types/postmortem.d.ts +0 -37
- package/dist/types/procmgr.d.ts +0 -29
- package/dist/types/prompt.d.ts +0 -18
- package/dist/types/ptree.d.ts +0 -108
- package/dist/types/ring.d.ts +0 -93
- package/dist/types/runtime-install.d.ts +0 -68
- package/dist/types/sanitize-text.d.ts +0 -29
- package/dist/types/snowflake.d.ts +0 -25
- package/dist/types/stream.d.ts +0 -68
- package/dist/types/tab-spacing.d.ts +0 -24
- package/dist/types/temp.d.ts +0 -17
- package/dist/types/timing-buffer.d.ts +0 -22
- package/dist/types/tls-fetch.d.ts +0 -37
- package/dist/types/type-guards.d.ts +0 -3
- package/dist/types/vendor/mermaid-ascii/ascii/ansi.d.ts +0 -41
- package/dist/types/vendor/mermaid-ascii/ascii/canvas.d.ts +0 -89
- package/dist/types/vendor/mermaid-ascii/ascii/class-diagram.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/converter.d.ts +0 -12
- package/dist/types/vendor/mermaid-ascii/ascii/draw.d.ts +0 -66
- package/dist/types/vendor/mermaid-ascii/ascii/edge-bundling.d.ts +0 -48
- package/dist/types/vendor/mermaid-ascii/ascii/edge-routing.d.ts +0 -43
- package/dist/types/vendor/mermaid-ascii/ascii/er-diagram.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/grid.d.ts +0 -56
- package/dist/types/vendor/mermaid-ascii/ascii/index.d.ts +0 -65
- package/dist/types/vendor/mermaid-ascii/ascii/multiline-utils.d.ts +0 -27
- package/dist/types/vendor/mermaid-ascii/ascii/pathfinder.d.ts +0 -17
- package/dist/types/vendor/mermaid-ascii/ascii/sequence.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/circle.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/corners.d.ts +0 -34
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/diamond.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/hexagon.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/index.d.ts +0 -26
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rectangle.d.ts +0 -31
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/rounded.d.ts +0 -11
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/special.d.ts +0 -59
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/stadium.d.ts +0 -17
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/state.d.ts +0 -30
- package/dist/types/vendor/mermaid-ascii/ascii/shapes/types.d.ts +0 -55
- package/dist/types/vendor/mermaid-ascii/ascii/types.d.ts +0 -206
- package/dist/types/vendor/mermaid-ascii/ascii/validate.d.ts +0 -51
- package/dist/types/vendor/mermaid-ascii/ascii/xychart.d.ts +0 -2
- package/dist/types/vendor/mermaid-ascii/class/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/class/types.d.ts +0 -102
- package/dist/types/vendor/mermaid-ascii/er/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/er/types.d.ts +0 -76
- package/dist/types/vendor/mermaid-ascii/index.d.ts +0 -1
- package/dist/types/vendor/mermaid-ascii/multiline-utils.d.ts +0 -9
- package/dist/types/vendor/mermaid-ascii/parser.d.ts +0 -7
- package/dist/types/vendor/mermaid-ascii/sequence/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/sequence/types.d.ts +0 -130
- package/dist/types/vendor/mermaid-ascii/text-metrics.d.ts +0 -21
- package/dist/types/vendor/mermaid-ascii/types.d.ts +0 -114
- package/dist/types/vendor/mermaid-ascii/xychart/colors.d.ts +0 -25
- package/dist/types/vendor/mermaid-ascii/xychart/parser.d.ts +0 -6
- package/dist/types/vendor/mermaid-ascii/xychart/types.d.ts +0 -145
- package/dist/types/which.d.ts +0 -37
- package/dist/types/worker-host.d.ts +0 -47
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
export interface MermaidGraph {
|
|
2
|
-
direction: Direction;
|
|
3
|
-
nodes: Map<string, MermaidNode>;
|
|
4
|
-
edges: MermaidEdge[];
|
|
5
|
-
subgraphs: MermaidSubgraph[];
|
|
6
|
-
classDefs: Map<string, Record<string, string>>;
|
|
7
|
-
/** Maps node IDs to their class names (from `class X className` or `:::className` shorthand) */
|
|
8
|
-
classAssignments: Map<string, string>;
|
|
9
|
-
/** Maps node IDs to inline styles (from `style X fill:#f00,stroke:#333`) */
|
|
10
|
-
nodeStyles: Map<string, Record<string, string>>;
|
|
11
|
-
/** Maps edge indices (or 'default') to inline styles from `linkStyle` directives */
|
|
12
|
-
linkStyles: Map<number | 'default', Record<string, string>>;
|
|
13
|
-
}
|
|
14
|
-
export type Direction = 'TD' | 'TB' | 'LR' | 'BT' | 'RL';
|
|
15
|
-
export interface MermaidNode {
|
|
16
|
-
id: string;
|
|
17
|
-
label: string;
|
|
18
|
-
shape: NodeShape;
|
|
19
|
-
}
|
|
20
|
-
export type NodeShape = 'rectangle' | 'rounded' | 'diamond' | 'stadium' | 'circle' | 'subroutine' | 'doublecircle' | 'hexagon' | 'cylinder' | 'asymmetric' | 'trapezoid' | 'trapezoid-alt' | 'state-start' | 'state-end';
|
|
21
|
-
export interface MermaidEdge {
|
|
22
|
-
source: string;
|
|
23
|
-
target: string;
|
|
24
|
-
label?: string;
|
|
25
|
-
style: EdgeStyle;
|
|
26
|
-
/** Whether to render an arrowhead at the start (source end) of the edge */
|
|
27
|
-
hasArrowStart: boolean;
|
|
28
|
-
/** Whether to render an arrowhead at the end (target end) of the edge */
|
|
29
|
-
hasArrowEnd: boolean;
|
|
30
|
-
}
|
|
31
|
-
export type EdgeStyle = 'solid' | 'dotted' | 'thick';
|
|
32
|
-
export interface MermaidSubgraph {
|
|
33
|
-
id: string;
|
|
34
|
-
label: string;
|
|
35
|
-
nodeIds: string[];
|
|
36
|
-
children: MermaidSubgraph[];
|
|
37
|
-
/** Optional direction override for this subgraph's internal layout */
|
|
38
|
-
direction?: Direction;
|
|
39
|
-
}
|
|
40
|
-
export interface PositionedGraph {
|
|
41
|
-
width: number;
|
|
42
|
-
height: number;
|
|
43
|
-
nodes: PositionedNode[];
|
|
44
|
-
edges: PositionedEdge[];
|
|
45
|
-
groups: PositionedGroup[];
|
|
46
|
-
}
|
|
47
|
-
export interface PositionedNode {
|
|
48
|
-
id: string;
|
|
49
|
-
label: string;
|
|
50
|
-
shape: NodeShape;
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
width: number;
|
|
54
|
-
height: number;
|
|
55
|
-
/** Inline styles resolved from classDef + explicit `style` statements — override theme defaults */
|
|
56
|
-
inlineStyle?: Record<string, string>;
|
|
57
|
-
}
|
|
58
|
-
export interface PositionedEdge {
|
|
59
|
-
source: string;
|
|
60
|
-
target: string;
|
|
61
|
-
label?: string;
|
|
62
|
-
style: EdgeStyle;
|
|
63
|
-
hasArrowStart: boolean;
|
|
64
|
-
hasArrowEnd: boolean;
|
|
65
|
-
/** Full path including bends — array of {x, y} points */
|
|
66
|
-
points: Point[];
|
|
67
|
-
/** Layout-computed label center position (avoids label-label collisions) */
|
|
68
|
-
labelPosition?: Point;
|
|
69
|
-
/** Inline styles resolved from `linkStyle` directives — override theme defaults */
|
|
70
|
-
inlineStyle?: Record<string, string>;
|
|
71
|
-
}
|
|
72
|
-
export interface Point {
|
|
73
|
-
x: number;
|
|
74
|
-
y: number;
|
|
75
|
-
}
|
|
76
|
-
export interface PositionedGroup {
|
|
77
|
-
id: string;
|
|
78
|
-
label: string;
|
|
79
|
-
x: number;
|
|
80
|
-
y: number;
|
|
81
|
-
width: number;
|
|
82
|
-
height: number;
|
|
83
|
-
children: PositionedGroup[];
|
|
84
|
-
}
|
|
85
|
-
export interface RenderOptions {
|
|
86
|
-
/** Background color → CSS variable --bg. Default: '#FFFFFF' */
|
|
87
|
-
bg?: string;
|
|
88
|
-
/** Foreground / primary text color → CSS variable --fg. Default: '#27272A' */
|
|
89
|
-
fg?: string;
|
|
90
|
-
/** Edge/connector color → CSS variable --line */
|
|
91
|
-
line?: string;
|
|
92
|
-
/** Arrow heads, highlights → CSS variable --accent */
|
|
93
|
-
accent?: string;
|
|
94
|
-
/** Secondary text, edge labels → CSS variable --muted */
|
|
95
|
-
muted?: string;
|
|
96
|
-
/** Node/box fill tint → CSS variable --surface */
|
|
97
|
-
surface?: string;
|
|
98
|
-
/** Node/group stroke color → CSS variable --border */
|
|
99
|
-
border?: string;
|
|
100
|
-
/** Font family for all text. Default: 'Inter' */
|
|
101
|
-
font?: string;
|
|
102
|
-
/** Canvas padding in px. Default: 40 */
|
|
103
|
-
padding?: number;
|
|
104
|
-
/** Horizontal spacing between sibling nodes. Default: 24 */
|
|
105
|
-
nodeSpacing?: number;
|
|
106
|
-
/** Vertical spacing between layers. Default: 40 */
|
|
107
|
-
layerSpacing?: number;
|
|
108
|
-
/** Spacing between disconnected components. Default: nodeSpacing (24) */
|
|
109
|
-
componentSpacing?: number;
|
|
110
|
-
/** Render with transparent background (no background style on SVG). Default: false */
|
|
111
|
-
transparent?: boolean;
|
|
112
|
-
/** Enable hover tooltips on chart data points (xychart only). Default: false */
|
|
113
|
-
interactive?: boolean;
|
|
114
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Default accent for charts when the theme doesn't provide one. */
|
|
2
|
-
export declare const CHART_ACCENT_FALLBACK = "#3b82f6";
|
|
3
|
-
/** Check whether a string is a valid 6-digit hex color (e.g. "#3b82f6"). */
|
|
4
|
-
export declare function isValidHex(color: string): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Detect whether a background color is dark (lightness < 50%).
|
|
7
|
-
*/
|
|
8
|
-
export declare function isDarkBackground(bgHex: string): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Mix two hex colors in RGB space.
|
|
11
|
-
* `ratio` controls how much of `fgHex` shows: 0 = pure bg, 1 = pure fg.
|
|
12
|
-
* Equivalent to alpha-compositing fg over bg at the given opacity.
|
|
13
|
-
*/
|
|
14
|
-
export declare function mixHexColors(bgHex: string, fgHex: string, ratio: number): string;
|
|
15
|
-
/**
|
|
16
|
-
* Get the hex color for a series index.
|
|
17
|
-
* Index 0 returns the accent color as-is.
|
|
18
|
-
* Index 1+ alternate between darker and lighter shades of the same hue
|
|
19
|
-
* with subtle hue drift (±8-12° per tier) to stay in the same family.
|
|
20
|
-
*
|
|
21
|
-
* When `bgColor` is provided, shade direction adapts to the background:
|
|
22
|
-
* - Light bg: odd = darker, even = lighter (default)
|
|
23
|
-
* - Dark bg: odd = lighter, even = darker (so shades stay visible)
|
|
24
|
-
*/
|
|
25
|
-
export declare function getSeriesColor(index: number, accentColor: string, bgColor?: string): string;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/** Parsed XY chart — logical structure from mermaid text */
|
|
2
|
-
export interface XYChart {
|
|
3
|
-
/** Optional chart title */
|
|
4
|
-
title?: string;
|
|
5
|
-
/** Chart orientation: vertical (default) or horizontal */
|
|
6
|
-
horizontal: boolean;
|
|
7
|
-
/** X-axis configuration */
|
|
8
|
-
xAxis: XYAxis;
|
|
9
|
-
/** Y-axis configuration */
|
|
10
|
-
yAxis: XYAxis;
|
|
11
|
-
/** Data series (bar and/or line) */
|
|
12
|
-
series: XYChartSeries[];
|
|
13
|
-
}
|
|
14
|
-
/** Axis configuration — categorical (labels) or numeric (range) */
|
|
15
|
-
export interface XYAxis {
|
|
16
|
-
/** Optional axis title/label */
|
|
17
|
-
title?: string;
|
|
18
|
-
/** Categorical labels (e.g., ["jan", "feb", "mar"]) — mutually exclusive with range */
|
|
19
|
-
categories?: string[];
|
|
20
|
-
/** Numeric range — mutually exclusive with categories */
|
|
21
|
-
range?: {
|
|
22
|
-
min: number;
|
|
23
|
-
max: number;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/** A single data series (bar or line) */
|
|
27
|
-
export interface XYChartSeries {
|
|
28
|
-
/** Series type */
|
|
29
|
-
type: 'bar' | 'line';
|
|
30
|
-
/** Data values — one per category, or evenly spaced across numeric range */
|
|
31
|
-
data: number[];
|
|
32
|
-
}
|
|
33
|
-
export interface PositionedXYChart {
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
/** Whether this is a horizontal (rotated) chart */
|
|
37
|
-
horizontal?: boolean;
|
|
38
|
-
/** Title text and position (if present) */
|
|
39
|
-
title?: PositionedTitle;
|
|
40
|
-
/** Positioned x-axis with tick marks and labels */
|
|
41
|
-
xAxis: PositionedAxis;
|
|
42
|
-
/** Positioned y-axis with tick marks and labels */
|
|
43
|
-
yAxis: PositionedAxis;
|
|
44
|
-
/** The plot area bounds (inside axes) */
|
|
45
|
-
plotArea: PlotArea;
|
|
46
|
-
/** Positioned bar groups */
|
|
47
|
-
bars: PositionedBar[];
|
|
48
|
-
/** Positioned line polylines */
|
|
49
|
-
lines: PositionedLine[];
|
|
50
|
-
/** Horizontal grid lines for readability */
|
|
51
|
-
gridLines: GridLine[];
|
|
52
|
-
/** Legend items (shown when multiple series) */
|
|
53
|
-
legend: LegendItem[];
|
|
54
|
-
}
|
|
55
|
-
export interface LegendItem {
|
|
56
|
-
/** Display label */
|
|
57
|
-
label: string;
|
|
58
|
-
/** Position of the swatch/icon */
|
|
59
|
-
x: number;
|
|
60
|
-
y: number;
|
|
61
|
-
/** Series type determines swatch shape (rect for bar, line+dot for line) */
|
|
62
|
-
type: 'bar' | 'line';
|
|
63
|
-
/** Series index within its type (for layout grouping) */
|
|
64
|
-
seriesIndex: number;
|
|
65
|
-
/** Global color index across all series (for unified color assignment) */
|
|
66
|
-
colorIndex: number;
|
|
67
|
-
}
|
|
68
|
-
export interface PositionedTitle {
|
|
69
|
-
text: string;
|
|
70
|
-
x: number;
|
|
71
|
-
y: number;
|
|
72
|
-
}
|
|
73
|
-
export interface PositionedAxis {
|
|
74
|
-
/** Optional axis title text and position */
|
|
75
|
-
title?: {
|
|
76
|
-
text: string;
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
rotate?: number;
|
|
80
|
-
};
|
|
81
|
-
/** Tick positions along the axis */
|
|
82
|
-
ticks: AxisTick[];
|
|
83
|
-
/** Axis line: start and end coordinates */
|
|
84
|
-
line: {
|
|
85
|
-
x1: number;
|
|
86
|
-
y1: number;
|
|
87
|
-
x2: number;
|
|
88
|
-
y2: number;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
export interface AxisTick {
|
|
92
|
-
/** Label text for this tick */
|
|
93
|
-
label: string;
|
|
94
|
-
/** Position of the tick mark on the axis */
|
|
95
|
-
x: number;
|
|
96
|
-
y: number;
|
|
97
|
-
/** End of the tick mark (short perpendicular line) */
|
|
98
|
-
tx: number;
|
|
99
|
-
ty: number;
|
|
100
|
-
/** Label anchor position */
|
|
101
|
-
labelX: number;
|
|
102
|
-
labelY: number;
|
|
103
|
-
/** Text anchor for label */
|
|
104
|
-
textAnchor: 'start' | 'middle' | 'end';
|
|
105
|
-
}
|
|
106
|
-
export interface PlotArea {
|
|
107
|
-
x: number;
|
|
108
|
-
y: number;
|
|
109
|
-
width: number;
|
|
110
|
-
height: number;
|
|
111
|
-
}
|
|
112
|
-
export interface PositionedBar {
|
|
113
|
-
/** Bar rectangle in SVG coordinates */
|
|
114
|
-
x: number;
|
|
115
|
-
y: number;
|
|
116
|
-
width: number;
|
|
117
|
-
height: number;
|
|
118
|
-
/** Original data value */
|
|
119
|
-
value: number;
|
|
120
|
-
/** Category label for this bar (e.g. "Jan") */
|
|
121
|
-
label?: string;
|
|
122
|
-
/** Series index within bar type (for layout grouping) */
|
|
123
|
-
seriesIndex: number;
|
|
124
|
-
/** Global color index across all series */
|
|
125
|
-
colorIndex: number;
|
|
126
|
-
}
|
|
127
|
-
export interface PositionedLine {
|
|
128
|
-
/** Polyline points */
|
|
129
|
-
points: Array<{
|
|
130
|
-
x: number;
|
|
131
|
-
y: number;
|
|
132
|
-
value: number;
|
|
133
|
-
label?: string;
|
|
134
|
-
}>;
|
|
135
|
-
/** Series index within line type (for layout grouping) */
|
|
136
|
-
seriesIndex: number;
|
|
137
|
-
/** Global color index across all series */
|
|
138
|
-
colorIndex: number;
|
|
139
|
-
}
|
|
140
|
-
export interface GridLine {
|
|
141
|
-
x1: number;
|
|
142
|
-
y1: number;
|
|
143
|
-
x2: number;
|
|
144
|
-
y2: number;
|
|
145
|
-
}
|
package/dist/types/which.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache policy for which lookups.
|
|
3
|
-
*/
|
|
4
|
-
export declare const enum WhichCachePolicy {
|
|
5
|
-
/**
|
|
6
|
-
* Use cached result if available.
|
|
7
|
-
*/
|
|
8
|
-
Cached = 0,
|
|
9
|
-
/**
|
|
10
|
-
* Bypass cache and perform a new lookup.
|
|
11
|
-
*/
|
|
12
|
-
Bypass = 1,
|
|
13
|
-
/**
|
|
14
|
-
* Always update cache.
|
|
15
|
-
*/
|
|
16
|
-
Fresh = 2,
|
|
17
|
-
/**
|
|
18
|
-
* Read-only, serves from cache if present, but doesn't write.
|
|
19
|
-
*/
|
|
20
|
-
ReadOnly = 3
|
|
21
|
-
}
|
|
22
|
-
export interface WhichOptions extends Bun.WhichOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Cache policy for the lookup.
|
|
25
|
-
* Defaults to `WhichCachePolicy.Fresh`.
|
|
26
|
-
*/
|
|
27
|
-
cache?: WhichCachePolicy;
|
|
28
|
-
}
|
|
29
|
-
export declare const whichFresh: typeof Bun.which;
|
|
30
|
-
/**
|
|
31
|
-
* Locate binary on PATH (with flexible caching).
|
|
32
|
-
*
|
|
33
|
-
* @param command - Binary name to resolve
|
|
34
|
-
* @param options - Bun.WhichOptions plus `cache` control
|
|
35
|
-
* @returns Filesystem path if found, else null
|
|
36
|
-
*/
|
|
37
|
-
export declare function $which(command: string, options?: WhichOptions): string | null;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/** Called by CLI entrypoints whose main module dispatches worker argv selectors. */
|
|
2
|
-
export declare function declareWorkerHostEntry(): void;
|
|
3
|
-
/** Main-module path of the self-dispatching CLI host, or null outside it. */
|
|
4
|
-
export declare function workerHostEntry(): string | null;
|
|
5
|
-
/**
|
|
6
|
-
* Buffers messages a Bun worker thread receives before its real handler is
|
|
7
|
-
* attached, then hands them off once it is.
|
|
8
|
-
*
|
|
9
|
-
* Bun delivers messages the parent posted before the worker spawned exactly
|
|
10
|
-
* once — when the worker entry module's top-level evaluation completes — to the
|
|
11
|
-
* `message` listeners present at that moment. A worker whose handler attaches
|
|
12
|
-
* via a later `await import(...)` therefore misses that flush. The
|
|
13
|
-
* self-dispatching CLI host imports each worker module dynamically from inside
|
|
14
|
-
* its argv dispatch, so the worker's own `parentPort.on("message")` lands after
|
|
15
|
-
* the flush and the parent's synchronously-posted `init` handshake is dropped —
|
|
16
|
-
* every run then stalls until the init timeout fires and silently falls back to
|
|
17
|
-
* the inline worker (issue: eval cells always taking the full timeout).
|
|
18
|
-
*
|
|
19
|
-
* The host calls {@link installWorkerInbox} synchronously in the entry's sync
|
|
20
|
-
* prefix (before importing the worker module) so a `parentPort` listener exists
|
|
21
|
-
* at flush time; the worker module then {@link consumeWorkerInbox}es it and
|
|
22
|
-
* binds the real handler, replaying anything buffered. Re-dispatching through
|
|
23
|
-
* `parentPort.emit("message", …)` is not an option — Bun's port is an
|
|
24
|
-
* `EventTarget` whose `emit` throws — so the inbox calls the handler directly.
|
|
25
|
-
*/
|
|
26
|
-
export interface WorkerInbox {
|
|
27
|
-
/** Route buffered and subsequent messages to `handler`; returns an unbind fn. */
|
|
28
|
-
bind(handler: (message: unknown) => void): () => void;
|
|
29
|
-
}
|
|
30
|
-
/** Minimal `parentPort` surface the inbox needs (Node/Bun `MessagePort`). */
|
|
31
|
-
interface MessageListenerPort {
|
|
32
|
-
on(event: "message", listener: (value: unknown) => void): unknown;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Attach a buffering `message` listener on `port` synchronously and stash the
|
|
36
|
-
* resulting inbox for the worker module to {@link consumeWorkerInbox}. MUST be
|
|
37
|
-
* called in the entry module's synchronous prefix — before the worker module is
|
|
38
|
-
* imported — so the listener exists when Bun flushes pre-spawn messages.
|
|
39
|
-
*/
|
|
40
|
-
export declare function installWorkerInbox(port: MessageListenerPort): WorkerInbox;
|
|
41
|
-
/**
|
|
42
|
-
* Take the inbox installed by {@link installWorkerInbox} for this worker, or
|
|
43
|
-
* `null` when the worker module was loaded directly (no host pre-buffering, so
|
|
44
|
-
* the module's own synchronous top-level listener already wins the flush).
|
|
45
|
-
*/
|
|
46
|
-
export declare function consumeWorkerInbox(): WorkerInbox | null;
|
|
47
|
-
export {};
|