@bushscad/cli 0.0.0-stage → 0.3.0
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/LICENSE +202 -0
- package/README.md +4 -2
- package/dist/classic-benchmark.js +35250 -0
- package/dist/fonts/NotoSans-LICENSE.txt +94 -0
- package/dist/fonts/NotoSans-Regular.ttf +0 -0
- package/dist/fonts/NotoSansMono-LICENSE.txt +94 -0
- package/dist/fonts/NotoSansMono-Regular.ttf +0 -0
- package/dist/fonts/NotoSerif-LICENSE.txt +94 -0
- package/dist/fonts/NotoSerif-Regular.ttf +0 -0
- package/dist/index.js +40765 -0
- package/dist/index.js.map +7 -0
- package/dist/occt-cancellation-probe.js +107 -0
- package/dist/occt-probe-runner.js +232 -0
- package/dist/occt-probe-worker.js +13936 -0
- package/dist/p7-benchmark.js +623 -0
- package/package.json +49 -6
- package/src/dto/bufferDto.ts +22 -0
- package/src/dto/index.ts +28 -0
- package/src/dto/json.ts +39 -0
- package/src/dto/meshDto.ts +26 -0
- package/src/dto/message-parser.ts +158 -0
- package/src/dto/request-fields.ts +174 -0
- package/src/dto/request-parser.ts +214 -0
- package/src/dto/types.ts +195 -0
package/src/dto/types.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Aidan Boissonneault
|
|
3
|
+
* @file types.ts
|
|
4
|
+
* @purpose Provides types behavior for the dto in cli package.
|
|
5
|
+
* @last-edited October 6, 2026
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
CompileError,
|
|
10
|
+
DrawingResult,
|
|
11
|
+
ExportFormat,
|
|
12
|
+
IRProgram,
|
|
13
|
+
InteractionSnapshot,
|
|
14
|
+
MaterialAppearance,
|
|
15
|
+
OcctTraceEvent,
|
|
16
|
+
ResolvedJointData,
|
|
17
|
+
ValidationResult,
|
|
18
|
+
} from '@bushscad/ir';
|
|
19
|
+
import type { EnvManifestEntry } from '@bushscad/compiler';
|
|
20
|
+
import type {
|
|
21
|
+
CompileEntrypointMode,
|
|
22
|
+
FileOverlayMap,
|
|
23
|
+
} from '@bushscad/compiler/node';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Mesh dto, including part name, body name, color, uses default color, and material.
|
|
27
|
+
*/
|
|
28
|
+
export type MeshDto = {
|
|
29
|
+
partName: string;
|
|
30
|
+
bodyName?: string;
|
|
31
|
+
color: string;
|
|
32
|
+
usesDefaultColor?: boolean;
|
|
33
|
+
material?: MaterialAppearance;
|
|
34
|
+
vertices: number[];
|
|
35
|
+
normals: number[];
|
|
36
|
+
indices: number[];
|
|
37
|
+
isHardwareVisual?: boolean;
|
|
38
|
+
hardwareKind?: 'bolt' | 'insert';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Buffer dto, including name and encoded geometry data.
|
|
43
|
+
*/
|
|
44
|
+
export type BufferDto = {
|
|
45
|
+
name: string;
|
|
46
|
+
dataBase64: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Accepted values for compiler engine are 'classic' and 'parallel'.
|
|
51
|
+
*/
|
|
52
|
+
export type CompilerEngine = 'classic' | 'parallel';
|
|
53
|
+
/**
|
|
54
|
+
* Accepted values for drawing output mode are 'write-source-paths' and 'return-content'.
|
|
55
|
+
*/
|
|
56
|
+
export type DrawingOutputMode = 'write-source-paths' | 'return-content';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Measurements for compiler, including engine, fallback reason, worker count, ready worker
|
|
60
|
+
* count, and IR compilation time.
|
|
61
|
+
*/
|
|
62
|
+
export type CompilerMetrics = {
|
|
63
|
+
engine: CompilerEngine;
|
|
64
|
+
fallbackReason?: string;
|
|
65
|
+
workerCount: number;
|
|
66
|
+
readyWorkerCount: number;
|
|
67
|
+
compileIrMs: number;
|
|
68
|
+
geometryMs: number;
|
|
69
|
+
assemblyMs: number;
|
|
70
|
+
workerStartupMs: number;
|
|
71
|
+
reusedWarmWorkers: boolean;
|
|
72
|
+
schedulerTaskCount?: number;
|
|
73
|
+
workerBusyMs?: number;
|
|
74
|
+
workerCpuMs?: number;
|
|
75
|
+
queueWaitMs?: number;
|
|
76
|
+
transportMs?: number;
|
|
77
|
+
workerUtilization?: number;
|
|
78
|
+
longestWorkerTaskMs?: number;
|
|
79
|
+
aggregateWorkerRssBytes?: number;
|
|
80
|
+
peakWorkerRssBytes?: number;
|
|
81
|
+
componentPreparationMs?: number;
|
|
82
|
+
componentReductionMs?: number;
|
|
83
|
+
preparedComponentCount?: number;
|
|
84
|
+
componentRecipeCount?: number;
|
|
85
|
+
componentCacheHitCount?: number;
|
|
86
|
+
nativeBooleanBatchCount?: number;
|
|
87
|
+
nativeBooleanAvoidedBuildCount?: number;
|
|
88
|
+
nativeBooleanRejectionCount?: number;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Accepted values for compiler request kind are 'check', 'preview', 'export', and
|
|
93
|
+
* 'exportDrawings'.
|
|
94
|
+
*/
|
|
95
|
+
export type CompilerRequestKind =
|
|
96
|
+
| 'check'
|
|
97
|
+
| 'preview'
|
|
98
|
+
| 'export'
|
|
99
|
+
| 'exportDrawings';
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Request to compiler, including operation kind, source file path, workspace root, entrypoint
|
|
103
|
+
* mode, and source overlays.
|
|
104
|
+
*/
|
|
105
|
+
export type CompilerRequest = {
|
|
106
|
+
kind: CompilerRequestKind;
|
|
107
|
+
filePath: string;
|
|
108
|
+
rootPath?: string | null;
|
|
109
|
+
entrypointMode?: CompileEntrypointMode;
|
|
110
|
+
overlays?: FileOverlayMap;
|
|
111
|
+
env?: Record<string, string>;
|
|
112
|
+
format?: ExportFormat;
|
|
113
|
+
cursorOpIndex?: number;
|
|
114
|
+
suppressedOpIndices?: number[];
|
|
115
|
+
occtTrace?: boolean;
|
|
116
|
+
engine?: CompilerEngine;
|
|
117
|
+
drawingOutputMode?: DrawingOutputMode;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Derives `ServiceRequest` from `CompilerRequest & { id: number }` to preserve its type relationship
|
|
122
|
+
* in the dto layer.
|
|
123
|
+
*/
|
|
124
|
+
export type ServiceRequest = CompilerRequest & { id: number };
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Written drawing dto, including name, path, and export format.
|
|
128
|
+
*/
|
|
129
|
+
type WrittenDrawingDto = { name: string; path: string; format: string };
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Response from service is tagged by ok: 'true' carries program, meshes, interaction and 'false'
|
|
133
|
+
* carries errors.
|
|
134
|
+
*/
|
|
135
|
+
export type ServiceResponse =
|
|
136
|
+
| {
|
|
137
|
+
id: number;
|
|
138
|
+
kind: ServiceRequest['kind'];
|
|
139
|
+
ok: true;
|
|
140
|
+
program?: IRProgram;
|
|
141
|
+
meshes?: MeshDto[];
|
|
142
|
+
interaction?: InteractionSnapshot;
|
|
143
|
+
drawings?: DrawingResult[];
|
|
144
|
+
buffers?: BufferDto[];
|
|
145
|
+
validations?: ValidationResult[];
|
|
146
|
+
joints?: ResolvedJointData[];
|
|
147
|
+
writtenDrawings?: WrittenDrawingDto[];
|
|
148
|
+
occtTraceEvents?: OcctTraceEvent[];
|
|
149
|
+
env: EnvManifestEntry[];
|
|
150
|
+
dependents?: Record<string, string[]>;
|
|
151
|
+
elapsedMs: number;
|
|
152
|
+
compilerMetrics?: CompilerMetrics;
|
|
153
|
+
}
|
|
154
|
+
| {
|
|
155
|
+
id: number;
|
|
156
|
+
kind: ServiceRequest['kind'];
|
|
157
|
+
ok: false;
|
|
158
|
+
errors: CompileError[];
|
|
159
|
+
occtTraceEvents?: OcctTraceEvent[];
|
|
160
|
+
env: EnvManifestEntry[];
|
|
161
|
+
elapsedMs: number;
|
|
162
|
+
compilerMetrics?: CompilerMetrics;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Message for service trace, including identifier, operation kind, and event.
|
|
167
|
+
*/
|
|
168
|
+
export type ServiceTraceMessage = {
|
|
169
|
+
id: number;
|
|
170
|
+
kind: 'occt-trace';
|
|
171
|
+
event: OcctTraceEvent;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Message for service pool, including operation kind and status.
|
|
176
|
+
*/
|
|
177
|
+
export type ServicePoolMessage = {
|
|
178
|
+
kind: 'pool-status';
|
|
179
|
+
status: CompilerPoolStatus;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* status of compiler pool represented by
|
|
184
|
+
* import('../service/parallel/worker-protocol.js').ParallelPoolStatus.
|
|
185
|
+
*/
|
|
186
|
+
export type CompilerPoolStatus =
|
|
187
|
+
import('../service/parallel/worker-protocol.js').ParallelPoolStatus;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Message for service accepts ServiceResponse, ServiceTraceMessage, and ServicePoolMessage.
|
|
191
|
+
*/
|
|
192
|
+
export type ServiceMessage =
|
|
193
|
+
| ServiceResponse
|
|
194
|
+
| ServiceTraceMessage
|
|
195
|
+
| ServicePoolMessage;
|