@holoscript/core 6.0.3 → 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/README.md +40 -40
- package/dist/codebase/index.d.ts +25 -0
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +4 -0
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/entries/interop.d.ts +9 -0
- package/dist/entries/scripting.d.ts +7 -0
- package/dist/index.d.ts +520 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/self-improvement/index.d.ts +0 -48
- package/dist/storage/index.d.ts +24 -0
- package/dist/tools/index.d.ts +33 -0
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +102 -19
- package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
- package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
- package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
- package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
- package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
- package/dist/USDZExporter-YA55ZS35.js +0 -707
- package/dist/chunk-26TLYBFD.js +0 -309
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2UX5LRAP.cjs +0 -833
- package/dist/chunk-32TWR3HE.js +0 -70
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3KEU5QYY.cjs +0 -175
- package/dist/chunk-4FCZDTD5.js +0 -610
- package/dist/chunk-4KJ2R7VP.cjs +0 -507
- package/dist/chunk-4SMUJFHL.js +0 -1213
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-65RFOWZI.js +0 -765
- package/dist/chunk-6OQBLABR.js +0 -5240
- package/dist/chunk-6WNCRE6F.js +0 -126
- package/dist/chunk-74YCHHTE.js +0 -1872
- package/dist/chunk-7H5UNJZD.cjs +0 -1973
- package/dist/chunk-7KPI4EKH.cjs +0 -701
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-7N3JIJMT.js +0 -1395
- package/dist/chunk-7X2IEJIE.cjs +0 -2526
- package/dist/chunk-A6GO3DPZ.cjs +0 -1002
- package/dist/chunk-AC4BSHFV.js +0 -765
- package/dist/chunk-AIUXRS74.cjs +0 -3681
- package/dist/chunk-ARNKA274.cjs +0 -130
- package/dist/chunk-AW7WAELW.js +0 -975
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BO2OKHIY.js +0 -6055
- package/dist/chunk-BU5ZAFMC.js +0 -115
- package/dist/chunk-BY3B7ZYV.cjs +0 -457
- package/dist/chunk-C2QHVHZF.js +0 -4066
- package/dist/chunk-C7BNX4XJ.js +0 -1043
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CMYAWUX3.js +0 -4455
- package/dist/chunk-CN4NOESF.cjs +0 -416
- package/dist/chunk-CNVM7J3M.js +0 -883
- package/dist/chunk-CO2VM2DK.js +0 -1965
- package/dist/chunk-CQDOF3G7.cjs +0 -1404
- package/dist/chunk-DH5G2JUA.cjs +0 -614
- package/dist/chunk-DIEDKX5B.cjs +0 -660
- package/dist/chunk-DN7UFU63.cjs +0 -172
- package/dist/chunk-DXVCEFZB.js +0 -2027
- package/dist/chunk-EGIZHYJP.cjs +0 -85
- package/dist/chunk-EJA7G2C4.cjs +0 -428
- package/dist/chunk-ELLQPFAF.js +0 -830
- package/dist/chunk-EMO7HAKJ.cjs +0 -1875
- package/dist/chunk-ENV7K6XA.js +0 -282
- package/dist/chunk-EPWRXL6S.js +0 -2522
- package/dist/chunk-EUFLX2PI.js +0 -56956
- package/dist/chunk-F5LVGHNT.js +0 -449
- package/dist/chunk-FEFHPUEM.cjs +0 -6122
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-GC3YU46J.js +0 -762
- package/dist/chunk-H6WMMLQK.cjs +0 -4492
- package/dist/chunk-H7XMORZI.js +0 -2731
- package/dist/chunk-HAN4V3PF.cjs +0 -2037
- package/dist/chunk-HBZYCASG.js +0 -4208
- package/dist/chunk-HF4OFY25.cjs +0 -4097
- package/dist/chunk-HHS6FMOU.cjs +0 -3813
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HKCVM6OK.cjs +0 -2237
- package/dist/chunk-HUFNKFA6.js +0 -698
- package/dist/chunk-I3XGTIHM.cjs +0 -1505
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-KDB6BUMB.js +0 -3666
- package/dist/chunk-KUJRR4FJ.js +0 -657
- package/dist/chunk-KYM4XRFG.js +0 -421
- package/dist/chunk-L3Z2HIWJ.cjs +0 -793
- package/dist/chunk-LBPEZQAF.js +0 -2232
- package/dist/chunk-LER4WXW5.cjs +0 -286
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-M6FU6S22.js +0 -2911
- package/dist/chunk-MWEFR6YQ.js +0 -1857
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUHGRTZ.js +0 -752
- package/dist/chunk-NKRKT6V2.js +0 -69
- package/dist/chunk-NLPSZT4C.js +0 -630
- package/dist/chunk-NRUB55IT.cjs +0 -771
- package/dist/chunk-NTMZSDXM.cjs +0 -633
- package/dist/chunk-ODGMVILH.js +0 -9662
- package/dist/chunk-PBA6NXCT.cjs +0 -1216
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PJMOXFPR.cjs +0 -1861
- package/dist/chunk-PLMYCCA4.js +0 -504
- package/dist/chunk-PPULB4GG.cjs +0 -9728
- package/dist/chunk-PQLGZKMC.cjs +0 -755
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-QHVVVN47.cjs +0 -2033
- package/dist/chunk-QWKUKVRE.js +0 -2026
- package/dist/chunk-RE3OKSYF.cjs +0 -424
- package/dist/chunk-RT7LJRSF.cjs +0 -57378
- package/dist/chunk-SPDELRRV.cjs +0 -319
- package/dist/chunk-SUCBB66F.js +0 -229
- package/dist/chunk-TSWTWZ42.cjs +0 -4214
- package/dist/chunk-UITWA6DV.cjs +0 -2829
- package/dist/chunk-UQW6SLM5.js +0 -172
- package/dist/chunk-V2ILLPHK.cjs +0 -237
- package/dist/chunk-V42NTCFH.js +0 -3645
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-VJVCD5T5.cjs +0 -769
- package/dist/chunk-VK5AXKO3.js +0 -746
- package/dist/chunk-VSXOIUCF.cjs +0 -473
- package/dist/chunk-VZNKJZTT.cjs +0 -749
- package/dist/chunk-W76ETJTI.js +0 -678
- package/dist/chunk-WFJIDI2N.cjs +0 -424
- package/dist/chunk-WN3YF33G.cjs +0 -118
- package/dist/chunk-WUXIRGZP.cjs +0 -2915
- package/dist/chunk-WYH4GVZ5.js +0 -1488
- package/dist/chunk-X4YVN7H3.cjs +0 -888
- package/dist/chunk-X67XRI2T.js +0 -410
- package/dist/chunk-XDXZM3ZP.cjs +0 -1046
- package/dist/chunk-XH7SE4HH.cjs +0 -72
- package/dist/chunk-XNMEH2BI.js +0 -126
- package/dist/chunk-XSF76QRU.js +0 -468
- package/dist/chunk-XSUZMPVQ.cjs +0 -682
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-Y5MUAYTO.js +0 -167
- package/dist/chunk-Y7VK5TH3.cjs +0 -129
- package/dist/chunk-YCMQQQ5U.cjs +0 -5244
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-ZGTGVSTZ.js +0 -422
- package/dist/chunk-ZL6VJ6SN.js +0 -421
- package/dist/cli/holoscript-runner.cjs +0 -2258
- package/dist/cli/holoscript-runner.js +0 -2233
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -29
- package/dist/compiler/agent-inference.js +0 -6
- package/dist/compiler/android-xr.cjs +0 -20
- package/dist/compiler/android-xr.js +0 -10
- package/dist/compiler/android.cjs +0 -21
- package/dist/compiler/android.js +0 -11
- package/dist/compiler/ar.cjs +0 -21
- package/dist/compiler/ar.js +0 -9
- package/dist/compiler/babylon.cjs +0 -18
- package/dist/compiler/babylon.js +0 -12
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -595
- package/dist/compiler/domain-block-utils.js +0 -9
- package/dist/compiler/dtdl.cjs +0 -25
- package/dist/compiler/dtdl.js +0 -9
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -16
- package/dist/compiler/godot.js +0 -10
- package/dist/compiler/incremental.cjs +0 -30
- package/dist/compiler/incremental.js +0 -5
- package/dist/compiler/index.cjs +0 -1522
- package/dist/compiler/index.js +0 -1321
- package/dist/compiler/ios.cjs +0 -21
- package/dist/compiler/ios.js +0 -11
- package/dist/compiler/multi-layer.cjs +0 -27
- package/dist/compiler/multi-layer.js +0 -12
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -16
- package/dist/compiler/openxr.js +0 -10
- package/dist/compiler/playcanvas.cjs +0 -17
- package/dist/compiler/playcanvas.js +0 -11
- package/dist/compiler/r3f.cjs +0 -35
- package/dist/compiler/r3f.js +0 -13
- 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 -22
- package/dist/compiler/sdf.js +0 -10
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -18
- package/dist/compiler/state.js +0 -8
- package/dist/compiler/trait-composition.cjs +0 -27
- package/dist/compiler/trait-composition.js +0 -6
- package/dist/compiler/unity.cjs +0 -16
- package/dist/compiler/unity.js +0 -10
- package/dist/compiler/unreal.cjs +0 -20
- package/dist/compiler/unreal.js +0 -10
- package/dist/compiler/urdf.cjs +0 -46
- package/dist/compiler/urdf.js +0 -10
- package/dist/compiler/usd-physics.cjs +0 -24
- package/dist/compiler/usd-physics.js +0 -7
- package/dist/compiler/visionos.cjs +0 -16
- package/dist/compiler/visionos.js +0 -10
- package/dist/compiler/vrchat.cjs +0 -20
- package/dist/compiler/vrchat.js +0 -10
- package/dist/compiler/vrr.cjs +0 -22
- package/dist/compiler/vrr.js +0 -10
- package/dist/compiler/wasm.cjs +0 -34
- package/dist/compiler/wasm.js +0 -10
- package/dist/compiler/webgpu.cjs +0 -16
- package/dist/compiler/webgpu.js +0 -10
- 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 -67
- package/dist/entries/scripting.js +0 -10
- package/dist/index.cjs +0 -61703
- package/dist/index.js +0 -58652
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/parser.cjs +0 -26
- package/dist/parser.js +0 -9
- package/dist/playwright-7DTEQCBD.cjs +0 -98673
- package/dist/playwright-BIZXMLD2.js +0 -98660
- package/dist/post-quantum-JTTAAGO3.cjs +0 -6
- package/dist/post-quantum-RVPVDEPI.js +0 -4
- 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 -14331
- package/dist/traits/index.js +0 -12126
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
- package/dist/wot/index.cjs +0 -29
- package/dist/wot/index.js +0 -4
package/dist/chunk-KYM4XRFG.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
import { HoloScriptRuntime } from './chunk-C2QHVHZF.js';
|
|
2
|
-
import { HoloScriptCodeParser } from './chunk-EPWRXL6S.js';
|
|
3
|
-
|
|
4
|
-
// src/HoloScriptDebugger.ts
|
|
5
|
-
var HoloScriptDebugger = class {
|
|
6
|
-
constructor(runtime) {
|
|
7
|
-
this.breakpoints = /* @__PURE__ */ new Map();
|
|
8
|
-
this.callStack = [];
|
|
9
|
-
this.currentAST = [];
|
|
10
|
-
this.currentNodeIndex = 0;
|
|
11
|
-
this.frameIdCounter = 0;
|
|
12
|
-
this.breakpointIdCounter = 0;
|
|
13
|
-
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
14
|
-
this.state = {
|
|
15
|
-
status: "stopped",
|
|
16
|
-
currentLine: 0,
|
|
17
|
-
currentColumn: 0,
|
|
18
|
-
currentNode: null,
|
|
19
|
-
callStack: [],
|
|
20
|
-
breakpoints: []
|
|
21
|
-
};
|
|
22
|
-
this.runtime = runtime || new HoloScriptRuntime();
|
|
23
|
-
this.parser = new HoloScriptCodeParser();
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Load source code for debugging
|
|
27
|
-
*/
|
|
28
|
-
loadSource(code, file) {
|
|
29
|
-
const parseResult = this.parser.parse(code);
|
|
30
|
-
if (!parseResult.success) {
|
|
31
|
-
return {
|
|
32
|
-
success: false,
|
|
33
|
-
errors: parseResult.errors.map((e) => `Line ${e.line}: ${e.message}`)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
this.currentAST = parseResult.ast;
|
|
37
|
-
this.currentNodeIndex = 0;
|
|
38
|
-
this.state.status = "stopped";
|
|
39
|
-
this.callStack = [];
|
|
40
|
-
if (file) {
|
|
41
|
-
for (const node of this.currentAST) {
|
|
42
|
-
node.file = file;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return { success: true };
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Set a breakpoint at a line
|
|
49
|
-
*/
|
|
50
|
-
setBreakpoint(line, options = {}) {
|
|
51
|
-
const id = `bp_${++this.breakpointIdCounter}`;
|
|
52
|
-
const breakpoint = {
|
|
53
|
-
id,
|
|
54
|
-
line,
|
|
55
|
-
column: options.column,
|
|
56
|
-
condition: options.condition,
|
|
57
|
-
hitCount: 0,
|
|
58
|
-
enabled: options.enabled !== false,
|
|
59
|
-
file: options.file
|
|
60
|
-
};
|
|
61
|
-
this.breakpoints.set(id, breakpoint);
|
|
62
|
-
this.updateBreakpointList();
|
|
63
|
-
return breakpoint;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Remove a breakpoint by ID
|
|
67
|
-
*/
|
|
68
|
-
removeBreakpoint(id) {
|
|
69
|
-
const removed = this.breakpoints.delete(id);
|
|
70
|
-
if (removed) {
|
|
71
|
-
this.updateBreakpointList();
|
|
72
|
-
}
|
|
73
|
-
return removed;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Remove all breakpoints at a line
|
|
77
|
-
*/
|
|
78
|
-
removeBreakpointsAtLine(line) {
|
|
79
|
-
let removed = 0;
|
|
80
|
-
for (const [id, bp] of this.breakpoints) {
|
|
81
|
-
if (bp.line === line) {
|
|
82
|
-
this.breakpoints.delete(id);
|
|
83
|
-
removed++;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (removed > 0) {
|
|
87
|
-
this.updateBreakpointList();
|
|
88
|
-
}
|
|
89
|
-
return removed;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Toggle breakpoint enabled state
|
|
93
|
-
*/
|
|
94
|
-
toggleBreakpoint(id) {
|
|
95
|
-
const bp = this.breakpoints.get(id);
|
|
96
|
-
if (bp) {
|
|
97
|
-
bp.enabled = !bp.enabled;
|
|
98
|
-
this.updateBreakpointList();
|
|
99
|
-
return bp.enabled;
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get all breakpoints
|
|
105
|
-
*/
|
|
106
|
-
getBreakpoints() {
|
|
107
|
-
return Array.from(this.breakpoints.values());
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Clear all breakpoints
|
|
111
|
-
*/
|
|
112
|
-
clearBreakpoints() {
|
|
113
|
-
this.breakpoints.clear();
|
|
114
|
-
this.updateBreakpointList();
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Start debugging from the beginning
|
|
118
|
-
*/
|
|
119
|
-
async start() {
|
|
120
|
-
this.currentNodeIndex = 0;
|
|
121
|
-
this.callStack = [];
|
|
122
|
-
this.frameIdCounter = 0;
|
|
123
|
-
this.runtime.reset();
|
|
124
|
-
this.state.status = "running";
|
|
125
|
-
await this.runUntilBreakpoint();
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Continue execution until next breakpoint or end
|
|
129
|
-
*/
|
|
130
|
-
async continue() {
|
|
131
|
-
if (this.state.status !== "paused") return;
|
|
132
|
-
this.state.status = "running";
|
|
133
|
-
this.currentNodeIndex++;
|
|
134
|
-
await this.runUntilBreakpoint();
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Step into the next node
|
|
138
|
-
*/
|
|
139
|
-
async stepInto() {
|
|
140
|
-
if (this.state.status !== "paused") return;
|
|
141
|
-
this.state.status = "stepping";
|
|
142
|
-
await this.executeStep("into");
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Step over the current node
|
|
146
|
-
*/
|
|
147
|
-
async stepOver() {
|
|
148
|
-
if (this.state.status !== "paused") return;
|
|
149
|
-
this.state.status = "stepping";
|
|
150
|
-
await this.executeStep("over");
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Step out of the current function
|
|
154
|
-
*/
|
|
155
|
-
async stepOut() {
|
|
156
|
-
if (this.state.status !== "paused") return;
|
|
157
|
-
this.state.status = "stepping";
|
|
158
|
-
await this.executeStep("out");
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Stop debugging
|
|
162
|
-
*/
|
|
163
|
-
stop() {
|
|
164
|
-
this.state.status = "stopped";
|
|
165
|
-
this.callStack = [];
|
|
166
|
-
this.currentNodeIndex = 0;
|
|
167
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped" } });
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Pause execution
|
|
171
|
-
*/
|
|
172
|
-
pause() {
|
|
173
|
-
if (this.state.status === "running") {
|
|
174
|
-
this.state.status = "paused";
|
|
175
|
-
this.emitEvent({ type: "state-change", data: { status: "paused" } });
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Get current debug state
|
|
180
|
-
*/
|
|
181
|
-
getState() {
|
|
182
|
-
return { ...this.state };
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Get call stack
|
|
186
|
-
*/
|
|
187
|
-
getCallStack() {
|
|
188
|
-
return [...this.callStack];
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get variables at a specific stack frame
|
|
192
|
-
*/
|
|
193
|
-
getVariables(frameId) {
|
|
194
|
-
if (frameId !== void 0) {
|
|
195
|
-
const frame = this.callStack.find((f) => f.id === frameId);
|
|
196
|
-
return frame?.variables || /* @__PURE__ */ new Map();
|
|
197
|
-
}
|
|
198
|
-
return new Map(this.runtime.getContext().variables);
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Evaluate an expression in the current context
|
|
202
|
-
*/
|
|
203
|
-
async evaluate(expression) {
|
|
204
|
-
try {
|
|
205
|
-
const varValue = this.runtime.getVariable(expression);
|
|
206
|
-
if (varValue !== void 0) {
|
|
207
|
-
return { value: varValue };
|
|
208
|
-
}
|
|
209
|
-
const parseResult = this.parser.parse(expression);
|
|
210
|
-
if (!parseResult.success) {
|
|
211
|
-
return { value: void 0, error: parseResult.errors[0]?.message };
|
|
212
|
-
}
|
|
213
|
-
const results = await this.runtime.executeProgram(parseResult.ast);
|
|
214
|
-
const lastResult = results[results.length - 1];
|
|
215
|
-
return { value: lastResult?.output };
|
|
216
|
-
} catch (error) {
|
|
217
|
-
return { value: void 0, error: String(error) };
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Set a watch expression
|
|
222
|
-
*/
|
|
223
|
-
watch(expression) {
|
|
224
|
-
const id = `watch_${Date.now()}`;
|
|
225
|
-
return { id, expression };
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Register an event handler
|
|
229
|
-
*/
|
|
230
|
-
on(event, handler) {
|
|
231
|
-
if (!this.eventHandlers.has(event)) {
|
|
232
|
-
this.eventHandlers.set(event, []);
|
|
233
|
-
}
|
|
234
|
-
this.eventHandlers.get(event).push(handler);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Remove an event handler
|
|
238
|
-
*/
|
|
239
|
-
off(event, handler) {
|
|
240
|
-
const handlers = this.eventHandlers.get(event);
|
|
241
|
-
if (handlers) {
|
|
242
|
-
const index = handlers.indexOf(handler);
|
|
243
|
-
if (index !== -1) {
|
|
244
|
-
handlers.splice(index, 1);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Get the underlying runtime
|
|
250
|
-
*/
|
|
251
|
-
getRuntime() {
|
|
252
|
-
return this.runtime;
|
|
253
|
-
}
|
|
254
|
-
// Private methods
|
|
255
|
-
async runUntilBreakpoint() {
|
|
256
|
-
while (this.currentNodeIndex < this.currentAST.length) {
|
|
257
|
-
if (this.state.status === "stopped") break;
|
|
258
|
-
const node = this.currentAST[this.currentNodeIndex];
|
|
259
|
-
if (this.shouldBreakAt(node)) {
|
|
260
|
-
this.state.status = "paused";
|
|
261
|
-
this.updateCurrentState(node);
|
|
262
|
-
const bp = this.findBreakpointAtLine(node.line ?? 0);
|
|
263
|
-
if (bp) {
|
|
264
|
-
bp.hitCount++;
|
|
265
|
-
this.emitEvent({
|
|
266
|
-
type: "breakpoint-hit",
|
|
267
|
-
data: { breakpoint: bp, node, line: node.line ?? 0 }
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
await this.executeNode(node);
|
|
273
|
-
this.currentNodeIndex++;
|
|
274
|
-
}
|
|
275
|
-
this.state.status = "stopped";
|
|
276
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped", reason: "complete" } });
|
|
277
|
-
}
|
|
278
|
-
async executeStep(mode) {
|
|
279
|
-
const startStackDepth = this.callStack.length;
|
|
280
|
-
if (this.currentNodeIndex >= this.currentAST.length) {
|
|
281
|
-
this.state.status = "stopped";
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
const node = this.currentAST[this.currentNodeIndex];
|
|
285
|
-
switch (mode) {
|
|
286
|
-
case "into":
|
|
287
|
-
await this.executeNode(node);
|
|
288
|
-
this.currentNodeIndex++;
|
|
289
|
-
break;
|
|
290
|
-
case "over":
|
|
291
|
-
await this.executeNode(node);
|
|
292
|
-
this.currentNodeIndex++;
|
|
293
|
-
break;
|
|
294
|
-
case "out":
|
|
295
|
-
while (this.currentNodeIndex < this.currentAST.length) {
|
|
296
|
-
await this.executeNode(this.currentAST[this.currentNodeIndex]);
|
|
297
|
-
this.currentNodeIndex++;
|
|
298
|
-
if (this.callStack.length < startStackDepth) {
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
if (this.currentNodeIndex < this.currentAST.length) {
|
|
305
|
-
this.state.status = "paused";
|
|
306
|
-
this.updateCurrentState(this.currentAST[this.currentNodeIndex]);
|
|
307
|
-
this.emitEvent({
|
|
308
|
-
type: "step-complete",
|
|
309
|
-
data: { mode, node: this.currentAST[this.currentNodeIndex] }
|
|
310
|
-
});
|
|
311
|
-
} else {
|
|
312
|
-
this.state.status = "stopped";
|
|
313
|
-
this.emitEvent({ type: "state-change", data: { status: "stopped", reason: "complete" } });
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
async executeNode(node) {
|
|
317
|
-
if (node.type === "function") {
|
|
318
|
-
const funcNode = node;
|
|
319
|
-
this.pushStackFrame(funcNode.name, node);
|
|
320
|
-
}
|
|
321
|
-
try {
|
|
322
|
-
const result = await this.runtime.executeNode(node);
|
|
323
|
-
if (!result.success && result.error) {
|
|
324
|
-
this.emitEvent({
|
|
325
|
-
type: "exception",
|
|
326
|
-
data: { error: result.error, node, line: node.line }
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
if (result.output !== void 0) {
|
|
330
|
-
this.emitEvent({
|
|
331
|
-
type: "output",
|
|
332
|
-
data: { output: result.output, node }
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
} catch (error) {
|
|
336
|
-
this.emitEvent({
|
|
337
|
-
type: "exception",
|
|
338
|
-
data: { error: String(error), node, line: node.line }
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
if (node.type === "function") {
|
|
342
|
-
this.popStackFrame();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
shouldBreakAt(node) {
|
|
346
|
-
const line = node.line;
|
|
347
|
-
for (const bp of this.breakpoints.values()) {
|
|
348
|
-
if (!bp.enabled) continue;
|
|
349
|
-
if (bp.line !== line) continue;
|
|
350
|
-
if (bp.condition) {
|
|
351
|
-
try {
|
|
352
|
-
const value = this.runtime.getVariable(bp.condition);
|
|
353
|
-
if (!value) continue;
|
|
354
|
-
} catch {
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return true;
|
|
359
|
-
}
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
findBreakpointAtLine(line) {
|
|
363
|
-
for (const bp of this.breakpoints.values()) {
|
|
364
|
-
if (bp.line === line && bp.enabled) {
|
|
365
|
-
return bp;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return null;
|
|
369
|
-
}
|
|
370
|
-
pushStackFrame(name, node) {
|
|
371
|
-
const frame = {
|
|
372
|
-
id: ++this.frameIdCounter,
|
|
373
|
-
name,
|
|
374
|
-
file: node.file,
|
|
375
|
-
line: node.line ?? 0,
|
|
376
|
-
column: node.column ?? 0,
|
|
377
|
-
variables: new Map(this.runtime.getContext().variables),
|
|
378
|
-
node
|
|
379
|
-
};
|
|
380
|
-
this.callStack.push(frame);
|
|
381
|
-
this.state.callStack = [...this.callStack];
|
|
382
|
-
}
|
|
383
|
-
popStackFrame() {
|
|
384
|
-
const frame = this.callStack.pop();
|
|
385
|
-
this.state.callStack = [...this.callStack];
|
|
386
|
-
return frame;
|
|
387
|
-
}
|
|
388
|
-
updateCurrentState(node) {
|
|
389
|
-
this.state.currentLine = node.line ?? 0;
|
|
390
|
-
this.state.currentColumn = node.column ?? 0;
|
|
391
|
-
this.state.currentNode = node;
|
|
392
|
-
}
|
|
393
|
-
updateBreakpointList() {
|
|
394
|
-
this.state.breakpoints = Array.from(this.breakpoints.values());
|
|
395
|
-
}
|
|
396
|
-
emitEvent(event) {
|
|
397
|
-
const handlers = this.eventHandlers.get(event.type) || [];
|
|
398
|
-
for (const handler of handlers) {
|
|
399
|
-
try {
|
|
400
|
-
handler(event);
|
|
401
|
-
} catch (error) {
|
|
402
|
-
console.error("Debug event handler error:", error);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
const allHandlers = this.eventHandlers.get("all") || [];
|
|
406
|
-
for (const handler of allHandlers) {
|
|
407
|
-
try {
|
|
408
|
-
handler(event);
|
|
409
|
-
} catch (error) {
|
|
410
|
-
console.error("Debug event handler error:", error);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
function createDebugger(runtime) {
|
|
416
|
-
return new HoloScriptDebugger(runtime);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
export { HoloScriptDebugger, createDebugger };
|
|
420
|
-
//# sourceMappingURL=chunk-KYM4XRFG.js.map
|
|
421
|
-
//# sourceMappingURL=chunk-KYM4XRFG.js.map
|