@holoscript/core 6.0.4 → 7.0.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 +21 -0
- package/README.md +1 -1
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/index.d.ts +501 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +105 -57
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
- package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
- package/dist/USDZExporter-NTMBNTDB.js +0 -707
- package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2CWOLHTE.js +0 -69
- package/dist/chunk-33LSUQDD.cjs +0 -835
- package/dist/chunk-3FJCK5XA.js +0 -2232
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3SAK5KFL.cjs +0 -83
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5BGSECRJ.cjs +0 -2237
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5O6TQC6M.cjs +0 -1871
- package/dist/chunk-5OEOHAAW.cjs +0 -682
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-5WUNN6ZN.cjs +0 -428
- package/dist/chunk-6TZPZCOJ.cjs +0 -1404
- package/dist/chunk-6UEHYZ7V.cjs +0 -773
- package/dist/chunk-6XSERL6L.js +0 -5678
- package/dist/chunk-72EQECGT.cjs +0 -908
- package/dist/chunk-7AGYRWKW.cjs +0 -507
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-ATSKSYVE.cjs +0 -51683
- package/dist/chunk-B5TCIAPQ.cjs +0 -117
- package/dist/chunk-BF2235SI.cjs +0 -5714
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BND3ST2K.cjs +0 -662
- package/dist/chunk-BU7VWW2K.js +0 -2522
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CAUCGUEA.cjs +0 -130
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-CDPGV4DN.js +0 -114
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CS2EMTGF.js +0 -1966
- package/dist/chunk-DMG7C4H2.js +0 -975
- package/dist/chunk-DXJQDCFL.js +0 -468
- package/dist/chunk-E3FWRT3Z.js +0 -608
- package/dist/chunk-E3UALNFA.js +0 -421
- package/dist/chunk-EONILVMF.js +0 -762
- package/dist/chunk-EQV4R3EV.cjs +0 -769
- package/dist/chunk-F3HH56EB.cjs +0 -5538
- package/dist/chunk-F4IULT7N.js +0 -1488
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-FFKU7BTK.cjs +0 -1046
- package/dist/chunk-FHQVYCH2.js +0 -70
- package/dist/chunk-FSF7EQVA.cjs +0 -1974
- package/dist/chunk-G4VZTCIB.js +0 -659
- package/dist/chunk-G7CT3EMP.cjs +0 -1002
- package/dist/chunk-GGHSW2NN.js +0 -51334
- package/dist/chunk-GVUR45UF.cjs +0 -777
- package/dist/chunk-H5Z7NASB.js +0 -9662
- package/dist/chunk-HE7ULERA.cjs +0 -697
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HPS76H7Q.js +0 -309
- package/dist/chunk-HQUEA5R6.cjs +0 -424
- package/dist/chunk-HYNTS5CP.js +0 -422
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IBDG74G2.cjs +0 -1219
- package/dist/chunk-IFNQFCTM.js +0 -3098
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-IWI6J7FX.js +0 -421
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-K6EKD26I.js +0 -630
- package/dist/chunk-KCQ5NDYC.cjs +0 -3172
- package/dist/chunk-KED34ILP.js +0 -832
- package/dist/chunk-KSGXLT74.cjs +0 -457
- package/dist/chunk-L4G4RLXX.js +0 -767
- package/dist/chunk-LDP5OK6G.js +0 -1216
- package/dist/chunk-LGGRPKTV.cjs +0 -735
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-LXJ4667L.cjs +0 -3874
- package/dist/chunk-LZ266PCM.cjs +0 -4499
- package/dist/chunk-MD6KDHVE.cjs +0 -237
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-MPXBVFHQ.js +0 -768
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-NDQNIJEH.js +0 -1715
- package/dist/chunk-NOZZ46QU.js +0 -168
- package/dist/chunk-OFKWH2IP.js +0 -449
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PMGODDJA.cjs +0 -319
- package/dist/chunk-Q4QX3AET.cjs +0 -1505
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-QLEAOI3Q.cjs +0 -424
- package/dist/chunk-R7MA7QWV.js +0 -732
- package/dist/chunk-RVYPEYPX.js +0 -678
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-S565K7NK.js +0 -752
- package/dist/chunk-SDAMZIRE.js +0 -765
- package/dist/chunk-T36DDXSF.js +0 -4250
- package/dist/chunk-T4NKMBDL.js +0 -5474
- package/dist/chunk-T7LEXZUZ.cjs +0 -2526
- package/dist/chunk-TEWCN33Y.js +0 -694
- package/dist/chunk-TQSZUOW5.cjs +0 -793
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-UERJ3YJV.js +0 -504
- package/dist/chunk-UPJBDCVF.js +0 -1395
- package/dist/chunk-V3NN3HPP.js +0 -4462
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-WB4Z63GG.js +0 -229
- package/dist/chunk-WDW67DZB.cjs +0 -9728
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X4ZF6CNE.cjs +0 -473
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
- package/dist/chunk-XCWFGZAA.js +0 -1043
- package/dist/chunk-XD6IYDUX.js +0 -903
- package/dist/chunk-XG23EUQX.cjs +0 -1717
- package/dist/chunk-XRKWN5PL.cjs +0 -173
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-XUTX5CBW.js +0 -126
- package/dist/chunk-XWPNTWDN.cjs +0 -755
- package/dist/chunk-XXINBTZK.cjs +0 -633
- package/dist/chunk-YCXFCXDS.js +0 -1868
- package/dist/chunk-YQK5JNFK.js +0 -3725
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-Z34RLXRA.cjs +0 -612
- package/dist/chunk-ZP4D3CSX.cjs +0 -72
- package/dist/cli/holoscript-runner.cjs +0 -2259
- package/dist/cli/holoscript-runner.js +0 -2234
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -28
- package/dist/compiler/agent-inference.js +0 -5
- package/dist/compiler/android-xr.cjs +0 -19
- package/dist/compiler/android-xr.js +0 -9
- package/dist/compiler/android.cjs +0 -20
- package/dist/compiler/android.js +0 -10
- package/dist/compiler/ar.cjs +0 -20
- package/dist/compiler/ar.js +0 -8
- package/dist/compiler/babylon.cjs +0 -17
- package/dist/compiler/babylon.js +0 -11
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -602
- package/dist/compiler/domain-block-utils.js +0 -8
- package/dist/compiler/dtdl.cjs +0 -24
- package/dist/compiler/dtdl.js +0 -8
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -15
- package/dist/compiler/godot.js +0 -9
- package/dist/compiler/incremental.cjs +0 -29
- package/dist/compiler/incremental.js +0 -4
- package/dist/compiler/index.cjs +0 -2578
- package/dist/compiler/index.js +0 -2383
- package/dist/compiler/ios.cjs +0 -20
- package/dist/compiler/ios.js +0 -10
- package/dist/compiler/multi-layer.cjs +0 -20
- package/dist/compiler/multi-layer.js +0 -11
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -15
- package/dist/compiler/openxr.js +0 -9
- package/dist/compiler/playcanvas.cjs +0 -16
- package/dist/compiler/playcanvas.js +0 -10
- package/dist/compiler/r3f.cjs +0 -34
- package/dist/compiler/r3f.js +0 -12
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -21
- package/dist/compiler/sdf.js +0 -9
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -17
- package/dist/compiler/state.js +0 -7
- package/dist/compiler/trait-composition.cjs +0 -26
- package/dist/compiler/trait-composition.js +0 -5
- package/dist/compiler/unity.cjs +0 -15
- package/dist/compiler/unity.js +0 -9
- package/dist/compiler/unreal.cjs +0 -19
- package/dist/compiler/unreal.js +0 -9
- package/dist/compiler/urdf.cjs +0 -45
- package/dist/compiler/urdf.js +0 -9
- package/dist/compiler/usd-physics.cjs +0 -23
- package/dist/compiler/usd-physics.js +0 -6
- package/dist/compiler/visionos.cjs +0 -15
- package/dist/compiler/visionos.js +0 -9
- package/dist/compiler/vrchat.cjs +0 -19
- package/dist/compiler/vrchat.js +0 -9
- package/dist/compiler/vrr.cjs +0 -21
- package/dist/compiler/vrr.js +0 -9
- package/dist/compiler/wasm.cjs +0 -33
- package/dist/compiler/wasm.js +0 -9
- package/dist/compiler/webgpu.cjs +0 -15
- package/dist/compiler/webgpu.js +0 -9
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -68
- package/dist/entries/scripting.js +0 -11
- package/dist/index.cjs +0 -40921
- package/dist/index.js +0 -37763
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
- package/dist/ml-dsa-WYLJHJO6.js +0 -1178
- package/dist/parser.cjs +0 -27
- package/dist/parser.js +0 -10
- package/dist/playwright-5OSAPTNH.js +0 -98660
- package/dist/playwright-RL6GY4F7.cjs +0 -98673
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14649
- package/dist/traits/index.js +0 -12243
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
package/dist/chunk-HQUEA5R6.cjs
DELETED
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkX6SEAXAX_cjs = require('./chunk-X6SEAXAX.cjs');
|
|
4
|
-
var chunkT7LEXZUZ_cjs = require('./chunk-T7LEXZUZ.cjs');
|
|
5
|
-
|
|
6
|
-
// src/HoloScriptDebugger.ts
|
|
7
|
-
var HoloScriptDebugger = class {
|
|
8
|
-
constructor(runtime) {
|
|
9
|
-
this.breakpoints = /* @__PURE__ */ new Map();
|
|
10
|
-
this.callStack = [];
|
|
11
|
-
this.currentAST = [];
|
|
12
|
-
this.currentNodeIndex = 0;
|
|
13
|
-
this.frameIdCounter = 0;
|
|
14
|
-
this.breakpointIdCounter = 0;
|
|
15
|
-
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
16
|
-
this.state = {
|
|
17
|
-
status: "stopped",
|
|
18
|
-
currentLine: 0,
|
|
19
|
-
currentColumn: 0,
|
|
20
|
-
currentNode: null,
|
|
21
|
-
callStack: [],
|
|
22
|
-
breakpoints: []
|
|
23
|
-
};
|
|
24
|
-
this.runtime = runtime || new chunkX6SEAXAX_cjs.HoloScriptRuntime();
|
|
25
|
-
this.parser = new chunkT7LEXZUZ_cjs.HoloScriptCodeParser();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Load source code for debugging
|
|
29
|
-
*/
|
|
30
|
-
loadSource(code, file) {
|
|
31
|
-
const parseResult = this.parser.parse(code);
|
|
32
|
-
if (!parseResult.success) {
|
|
33
|
-
return {
|
|
34
|
-
success: false,
|
|
35
|
-
errors: parseResult.errors.map((e) => `Line ${e.line}: ${e.message}`)
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
this.currentAST = parseResult.ast;
|
|
39
|
-
this.currentNodeIndex = 0;
|
|
40
|
-
this.state.status = "stopped";
|
|
41
|
-
this.callStack = [];
|
|
42
|
-
if (file) {
|
|
43
|
-
for (const node of this.currentAST) {
|
|
44
|
-
node.file = file;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return { success: true };
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Set a breakpoint at a line
|
|
51
|
-
*/
|
|
52
|
-
setBreakpoint(line, options = {}) {
|
|
53
|
-
const id = `bp_${++this.breakpointIdCounter}`;
|
|
54
|
-
const breakpoint = {
|
|
55
|
-
id,
|
|
56
|
-
line,
|
|
57
|
-
column: options.column,
|
|
58
|
-
condition: options.condition,
|
|
59
|
-
hitCount: 0,
|
|
60
|
-
enabled: options.enabled !== false,
|
|
61
|
-
file: options.file
|
|
62
|
-
};
|
|
63
|
-
this.breakpoints.set(id, breakpoint);
|
|
64
|
-
this.updateBreakpointList();
|
|
65
|
-
return breakpoint;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Remove a breakpoint by ID
|
|
69
|
-
*/
|
|
70
|
-
removeBreakpoint(id) {
|
|
71
|
-
const removed = this.breakpoints.delete(id);
|
|
72
|
-
if (removed) {
|
|
73
|
-
this.updateBreakpointList();
|
|
74
|
-
}
|
|
75
|
-
return removed;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Remove all breakpoints at a line
|
|
79
|
-
*/
|
|
80
|
-
removeBreakpointsAtLine(line) {
|
|
81
|
-
let removed = 0;
|
|
82
|
-
for (const [id, bp] of this.breakpoints) {
|
|
83
|
-
if (bp.line === line) {
|
|
84
|
-
this.breakpoints.delete(id);
|
|
85
|
-
removed++;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (removed > 0) {
|
|
89
|
-
this.updateBreakpointList();
|
|
90
|
-
}
|
|
91
|
-
return removed;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Toggle breakpoint enabled state
|
|
95
|
-
*/
|
|
96
|
-
toggleBreakpoint(id) {
|
|
97
|
-
const bp = this.breakpoints.get(id);
|
|
98
|
-
if (bp) {
|
|
99
|
-
bp.enabled = !bp.enabled;
|
|
100
|
-
this.updateBreakpointList();
|
|
101
|
-
return bp.enabled;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Get all breakpoints
|
|
107
|
-
*/
|
|
108
|
-
getBreakpoints() {
|
|
109
|
-
return Array.from(this.breakpoints.values());
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Clear all breakpoints
|
|
113
|
-
*/
|
|
114
|
-
clearBreakpoints() {
|
|
115
|
-
this.breakpoints.clear();
|
|
116
|
-
this.updateBreakpointList();
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Start debugging from the beginning
|
|
120
|
-
*/
|
|
121
|
-
async start() {
|
|
122
|
-
this.currentNodeIndex = 0;
|
|
123
|
-
this.callStack = [];
|
|
124
|
-
this.frameIdCounter = 0;
|
|
125
|
-
this.runtime.reset();
|
|
126
|
-
this.state.status = "running";
|
|
127
|
-
await this.runUntilBreakpoint();
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Continue execution until next breakpoint or end
|
|
131
|
-
*/
|
|
132
|
-
async continue() {
|
|
133
|
-
if (this.state.status !== "paused") return;
|
|
134
|
-
this.state.status = "running";
|
|
135
|
-
this.currentNodeIndex++;
|
|
136
|
-
await this.runUntilBreakpoint();
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Step into the next node
|
|
140
|
-
*/
|
|
141
|
-
async stepInto() {
|
|
142
|
-
if (this.state.status !== "paused") return;
|
|
143
|
-
this.state.status = "stepping";
|
|
144
|
-
await this.executeStep("into");
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Step over the current node
|
|
148
|
-
*/
|
|
149
|
-
async stepOver() {
|
|
150
|
-
if (this.state.status !== "paused") return;
|
|
151
|
-
this.state.status = "stepping";
|
|
152
|
-
await this.executeStep("over");
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Step out of the current function
|
|
156
|
-
*/
|
|
157
|
-
async stepOut() {
|
|
158
|
-
if (this.state.status !== "paused") return;
|
|
159
|
-
this.state.status = "stepping";
|
|
160
|
-
await this.executeStep("out");
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Stop debugging
|
|
164
|
-
*/
|
|
165
|
-
stop() {
|
|
166
|
-
this.state.status = "stopped";
|
|
167
|
-
this.callStack = [];
|
|
168
|
-
this.currentNodeIndex = 0;
|
|
169
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped" } });
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Pause execution
|
|
173
|
-
*/
|
|
174
|
-
pause() {
|
|
175
|
-
if (this.state.status === "running") {
|
|
176
|
-
this.state.status = "paused";
|
|
177
|
-
this.emitEvent({ type: "state-change", data: { status: "paused" } });
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Get current debug state
|
|
182
|
-
*/
|
|
183
|
-
getState() {
|
|
184
|
-
return { ...this.state };
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Get call stack
|
|
188
|
-
*/
|
|
189
|
-
getCallStack() {
|
|
190
|
-
return [...this.callStack];
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Get variables at a specific stack frame
|
|
194
|
-
*/
|
|
195
|
-
getVariables(frameId) {
|
|
196
|
-
if (frameId !== void 0) {
|
|
197
|
-
const frame = this.callStack.find((f) => f.id === frameId);
|
|
198
|
-
return frame?.variables || /* @__PURE__ */ new Map();
|
|
199
|
-
}
|
|
200
|
-
return new Map(this.runtime.getContext().variables);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Evaluate an expression in the current context
|
|
204
|
-
*/
|
|
205
|
-
async evaluate(expression) {
|
|
206
|
-
try {
|
|
207
|
-
const varValue = this.runtime.getVariable(expression);
|
|
208
|
-
if (varValue !== void 0) {
|
|
209
|
-
return { value: varValue };
|
|
210
|
-
}
|
|
211
|
-
const parseResult = this.parser.parse(expression);
|
|
212
|
-
if (!parseResult.success) {
|
|
213
|
-
return { value: void 0, error: parseResult.errors[0]?.message };
|
|
214
|
-
}
|
|
215
|
-
const results = await this.runtime.executeProgram(parseResult.ast);
|
|
216
|
-
const lastResult = results[results.length - 1];
|
|
217
|
-
return { value: lastResult?.output };
|
|
218
|
-
} catch (error) {
|
|
219
|
-
return { value: void 0, error: String(error) };
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Set a watch expression
|
|
224
|
-
*/
|
|
225
|
-
watch(expression) {
|
|
226
|
-
const id = `watch_${Date.now()}`;
|
|
227
|
-
return { id, expression };
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Register an event handler
|
|
231
|
-
*/
|
|
232
|
-
on(event, handler) {
|
|
233
|
-
if (!this.eventHandlers.has(event)) {
|
|
234
|
-
this.eventHandlers.set(event, []);
|
|
235
|
-
}
|
|
236
|
-
this.eventHandlers.get(event).push(handler);
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Remove an event handler
|
|
240
|
-
*/
|
|
241
|
-
off(event, handler) {
|
|
242
|
-
const handlers = this.eventHandlers.get(event);
|
|
243
|
-
if (handlers) {
|
|
244
|
-
const index = handlers.indexOf(handler);
|
|
245
|
-
if (index !== -1) {
|
|
246
|
-
handlers.splice(index, 1);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Get the underlying runtime
|
|
252
|
-
*/
|
|
253
|
-
getRuntime() {
|
|
254
|
-
return this.runtime;
|
|
255
|
-
}
|
|
256
|
-
// Private methods
|
|
257
|
-
async runUntilBreakpoint() {
|
|
258
|
-
while (this.currentNodeIndex < this.currentAST.length) {
|
|
259
|
-
if (this.state.status === "stopped") break;
|
|
260
|
-
const node = this.currentAST[this.currentNodeIndex];
|
|
261
|
-
if (this.shouldBreakAt(node)) {
|
|
262
|
-
this.state.status = "paused";
|
|
263
|
-
this.updateCurrentState(node);
|
|
264
|
-
const bp = this.findBreakpointAtLine(node.line ?? 0);
|
|
265
|
-
if (bp) {
|
|
266
|
-
bp.hitCount++;
|
|
267
|
-
this.emitEvent({
|
|
268
|
-
type: "breakpoint-hit",
|
|
269
|
-
data: { breakpoint: bp, node, line: node.line ?? 0 }
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
await this.executeNode(node);
|
|
275
|
-
this.currentNodeIndex++;
|
|
276
|
-
}
|
|
277
|
-
this.state.status = "stopped";
|
|
278
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped", reason: "complete" } });
|
|
279
|
-
}
|
|
280
|
-
async executeStep(mode) {
|
|
281
|
-
const startStackDepth = this.callStack.length;
|
|
282
|
-
if (this.currentNodeIndex >= this.currentAST.length) {
|
|
283
|
-
this.state.status = "stopped";
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
const node = this.currentAST[this.currentNodeIndex];
|
|
287
|
-
switch (mode) {
|
|
288
|
-
case "into":
|
|
289
|
-
await this.executeNode(node);
|
|
290
|
-
this.currentNodeIndex++;
|
|
291
|
-
break;
|
|
292
|
-
case "over":
|
|
293
|
-
await this.executeNode(node);
|
|
294
|
-
this.currentNodeIndex++;
|
|
295
|
-
break;
|
|
296
|
-
case "out":
|
|
297
|
-
while (this.currentNodeIndex < this.currentAST.length) {
|
|
298
|
-
await this.executeNode(this.currentAST[this.currentNodeIndex]);
|
|
299
|
-
this.currentNodeIndex++;
|
|
300
|
-
if (this.callStack.length < startStackDepth) {
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
if (this.currentNodeIndex < this.currentAST.length) {
|
|
307
|
-
this.state.status = "paused";
|
|
308
|
-
this.updateCurrentState(this.currentAST[this.currentNodeIndex]);
|
|
309
|
-
this.emitEvent({
|
|
310
|
-
type: "step-complete",
|
|
311
|
-
data: { mode, node: this.currentAST[this.currentNodeIndex] }
|
|
312
|
-
});
|
|
313
|
-
} else {
|
|
314
|
-
this.state.status = "stopped";
|
|
315
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped", reason: "complete" } });
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
async executeNode(node) {
|
|
319
|
-
if (node.type === "function") {
|
|
320
|
-
const funcNode = node;
|
|
321
|
-
this.pushStackFrame(funcNode.name, node);
|
|
322
|
-
}
|
|
323
|
-
try {
|
|
324
|
-
const result = await this.runtime.executeNode(node);
|
|
325
|
-
if (!result.success && result.error) {
|
|
326
|
-
this.emitEvent({
|
|
327
|
-
type: "exception",
|
|
328
|
-
data: { error: result.error, node, line: node.line }
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
if (result.output !== void 0) {
|
|
332
|
-
this.emitEvent({
|
|
333
|
-
type: "output",
|
|
334
|
-
data: { output: result.output, node }
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
} catch (error) {
|
|
338
|
-
this.emitEvent({
|
|
339
|
-
type: "exception",
|
|
340
|
-
data: { error: String(error), node, line: node.line }
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
if (node.type === "function") {
|
|
344
|
-
this.popStackFrame();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
shouldBreakAt(node) {
|
|
348
|
-
const line = node.line;
|
|
349
|
-
for (const bp of this.breakpoints.values()) {
|
|
350
|
-
if (!bp.enabled) continue;
|
|
351
|
-
if (bp.line !== line) continue;
|
|
352
|
-
if (bp.condition) {
|
|
353
|
-
try {
|
|
354
|
-
const value = this.runtime.getVariable(bp.condition);
|
|
355
|
-
if (!value) continue;
|
|
356
|
-
} catch {
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return true;
|
|
361
|
-
}
|
|
362
|
-
return false;
|
|
363
|
-
}
|
|
364
|
-
findBreakpointAtLine(line) {
|
|
365
|
-
for (const bp of this.breakpoints.values()) {
|
|
366
|
-
if (bp.line === line && bp.enabled) {
|
|
367
|
-
return bp;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
pushStackFrame(name, node) {
|
|
373
|
-
const frame = {
|
|
374
|
-
id: ++this.frameIdCounter,
|
|
375
|
-
name,
|
|
376
|
-
file: node.file,
|
|
377
|
-
line: node.line ?? 0,
|
|
378
|
-
column: node.column ?? 0,
|
|
379
|
-
variables: new Map(this.runtime.getContext().variables),
|
|
380
|
-
node
|
|
381
|
-
};
|
|
382
|
-
this.callStack.push(frame);
|
|
383
|
-
this.state.callStack = [...this.callStack];
|
|
384
|
-
}
|
|
385
|
-
popStackFrame() {
|
|
386
|
-
const frame = this.callStack.pop();
|
|
387
|
-
this.state.callStack = [...this.callStack];
|
|
388
|
-
return frame;
|
|
389
|
-
}
|
|
390
|
-
updateCurrentState(node) {
|
|
391
|
-
this.state.currentLine = node.line ?? 0;
|
|
392
|
-
this.state.currentColumn = node.column ?? 0;
|
|
393
|
-
this.state.currentNode = node;
|
|
394
|
-
}
|
|
395
|
-
updateBreakpointList() {
|
|
396
|
-
this.state.breakpoints = Array.from(this.breakpoints.values());
|
|
397
|
-
}
|
|
398
|
-
emitEvent(event) {
|
|
399
|
-
const handlers = this.eventHandlers.get(event.type) || [];
|
|
400
|
-
for (const handler of handlers) {
|
|
401
|
-
try {
|
|
402
|
-
handler(event);
|
|
403
|
-
} catch (error) {
|
|
404
|
-
console.error("Debug event handler error:", error);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
const allHandlers = this.eventHandlers.get("all") || [];
|
|
408
|
-
for (const handler of allHandlers) {
|
|
409
|
-
try {
|
|
410
|
-
handler(event);
|
|
411
|
-
} catch (error) {
|
|
412
|
-
console.error("Debug event handler error:", error);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
function createDebugger(runtime) {
|
|
418
|
-
return new HoloScriptDebugger(runtime);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
exports.HoloScriptDebugger = HoloScriptDebugger;
|
|
422
|
-
exports.createDebugger = createDebugger;
|
|
423
|
-
//# sourceMappingURL=chunk-HQUEA5R6.cjs.map
|
|
424
|
-
//# sourceMappingURL=chunk-HQUEA5R6.cjs.map
|