@tsplc/tmp-debug 0.0.0-stage → 0.6.3
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 +38 -2
- package/dist/api.js +744 -0
- package/dist/api.js.map +12 -0
- package/dist/constant.js +33 -0
- package/dist/constant.js.map +10 -0
- package/dist/explain-file.js +468 -0
- package/dist/explain-file.js.map +11 -0
- package/dist/explain.js +1310 -0
- package/dist/explain.js.map +19 -0
- package/dist/format.js +214 -0
- package/dist/format.js.map +12 -0
- package/dist/index.js +4066 -0
- package/dist/index.js.map +44 -0
- package/dist/manifest.js +240 -0
- package/dist/manifest.js.map +10 -0
- package/dist/paths.js +242 -0
- package/dist/paths.js.map +10 -0
- package/package.json +72 -4
- package/src/adapter.ts +77 -0
- package/src/api.ts +446 -0
- package/src/app-server.ts +151 -0
- package/src/build-files.ts +46 -0
- package/src/constant.ts +41 -0
- package/src/debugger.ts +237 -0
- package/src/errors.ts +13 -0
- package/src/explain-expressions.ts +484 -0
- package/src/explain-file.ts +325 -0
- package/src/explain-frames.ts +155 -0
- package/src/explain-loops.ts +151 -0
- package/src/explain-operations.ts +232 -0
- package/src/explain-tables.ts +345 -0
- package/src/explain-value.ts +203 -0
- package/src/explain-verdicts.ts +548 -0
- package/src/explain.ts +82 -0
- package/src/hardware.ts +159 -0
- package/src/http.ts +218 -0
- package/src/index.ts +44 -0
- package/src/jobs.ts +139 -0
- package/src/login-value.ts +165 -0
- package/src/login.ts +315 -0
- package/src/manifest.ts +328 -0
- package/src/opcua.ts +80 -0
- package/src/paths.ts +363 -0
- package/src/requests.ts +99 -0
- package/src/server-cursor.ts +22 -0
- package/src/shown.ts +229 -0
- package/src/telemetry.ts +125 -0
- package/src/timeline.ts +148 -0
- package/src/trace.ts +62 -0
- package/src/ui/bits.ts +48 -0
- package/src/ui/client.ts +87 -0
- package/src/ui/dom.ts +61 -0
- package/src/ui/explain-read.ts +105 -0
- package/src/ui/format.ts +261 -0
- package/src/ui/hardware.ts +425 -0
- package/src/ui/header.ts +207 -0
- package/src/ui/health.ts +64 -0
- package/src/ui/index.ts +27 -0
- package/src/ui/jobs.ts +263 -0
- package/src/ui/links.ts +59 -0
- package/src/ui/live-value.ts +85 -0
- package/src/ui/main.ts +76 -0
- package/src/ui/overview.ts +178 -0
- package/src/ui/page.ts +286 -0
- package/src/ui/pages.ts +64 -0
- package/src/ui/recent-window.ts +49 -0
- package/src/ui/recent.ts +355 -0
- package/src/ui/request-trace.ts +38 -0
- package/src/ui/requests.ts +80 -0
- package/src/ui/routes.ts +98 -0
- package/src/ui/store.ts +295 -0
- package/src/ui/success-cache.ts +11 -0
- package/src/ui/tree.ts +162 -0
- package/src/ui/variables.ts +597 -0
- package/src/ui/why-watch.ts +11 -0
- package/src/ui/why.ts +694 -0
- package/src/values.ts +170 -0
- package/src/watch.ts +32 -0
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// packages/debug/src/manifest.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var debugManifestFile = "debug.json";
|
|
4
|
+
var sourceRange = z.object({
|
|
5
|
+
file: z.number().int(),
|
|
6
|
+
line: z.number().int(),
|
|
7
|
+
column: z.number().int(),
|
|
8
|
+
endLine: z.number().int(),
|
|
9
|
+
endColumn: z.number().int()
|
|
10
|
+
});
|
|
11
|
+
var json = z.lazy(() => z.union([
|
|
12
|
+
z.string(),
|
|
13
|
+
z.number(),
|
|
14
|
+
z.boolean(),
|
|
15
|
+
z.null(),
|
|
16
|
+
z.array(json),
|
|
17
|
+
z.record(z.string(), json)
|
|
18
|
+
]));
|
|
19
|
+
var debugField = z.object({
|
|
20
|
+
name: z.string(),
|
|
21
|
+
target: z.string(),
|
|
22
|
+
type: z.string(),
|
|
23
|
+
declaration: sourceRange.optional(),
|
|
24
|
+
generated: z.literal(true).optional()
|
|
25
|
+
});
|
|
26
|
+
var debugType = z.discriminatedUnion("kind", [
|
|
27
|
+
z.object({
|
|
28
|
+
kind: z.literal("scalar"),
|
|
29
|
+
iec: z.string(),
|
|
30
|
+
capacity: z.number().int().optional()
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
kind: z.literal("enum"),
|
|
34
|
+
name: z.string(),
|
|
35
|
+
members: z.record(z.string(), z.number().int()),
|
|
36
|
+
texts: z.record(z.string(), z.string()).optional()
|
|
37
|
+
}),
|
|
38
|
+
z.object({
|
|
39
|
+
kind: z.literal("record"),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
declaration: sourceRange.optional(),
|
|
42
|
+
fields: z.array(debugField)
|
|
43
|
+
}),
|
|
44
|
+
z.object({
|
|
45
|
+
kind: z.literal("array"),
|
|
46
|
+
element: z.string(),
|
|
47
|
+
length: z.number().int(),
|
|
48
|
+
lower: z.number().int(),
|
|
49
|
+
index: z.string().optional()
|
|
50
|
+
})
|
|
51
|
+
]);
|
|
52
|
+
var debugRoot = z.object({
|
|
53
|
+
path: z.string(),
|
|
54
|
+
target: z.string(),
|
|
55
|
+
type: z.string(),
|
|
56
|
+
declaration: sourceRange.optional(),
|
|
57
|
+
readable: z.boolean(),
|
|
58
|
+
generated: z.literal(true).optional()
|
|
59
|
+
});
|
|
60
|
+
var debugConstant = z.object({
|
|
61
|
+
path: z.string(),
|
|
62
|
+
type: z.string(),
|
|
63
|
+
value: json,
|
|
64
|
+
declaration: sourceRange.optional()
|
|
65
|
+
});
|
|
66
|
+
var debugIo = z.object({
|
|
67
|
+
path: z.string(),
|
|
68
|
+
target: z.string(),
|
|
69
|
+
direction: z.enum(["input", "output"]),
|
|
70
|
+
type: z.string(),
|
|
71
|
+
device: z.string().optional(),
|
|
72
|
+
channel: z.string().optional(),
|
|
73
|
+
address: z.string().optional(),
|
|
74
|
+
inverted: z.literal(true).optional(),
|
|
75
|
+
shared: z.literal(true).optional()
|
|
76
|
+
});
|
|
77
|
+
var debugChannel = z.object({
|
|
78
|
+
id: z.string(),
|
|
79
|
+
name: z.string(),
|
|
80
|
+
direction: z.enum(["input", "output"]),
|
|
81
|
+
type: z.string(),
|
|
82
|
+
offsetBits: z.number().int(),
|
|
83
|
+
bits: z.number().int(),
|
|
84
|
+
address: z.string().optional(),
|
|
85
|
+
unit: z.string().optional(),
|
|
86
|
+
description: z.string().optional()
|
|
87
|
+
});
|
|
88
|
+
var debugDevice = z.object({
|
|
89
|
+
id: z.string(),
|
|
90
|
+
product: z.string().optional(),
|
|
91
|
+
vendor: z.string().optional(),
|
|
92
|
+
productCode: z.string().optional(),
|
|
93
|
+
network: z.object({ address: z.string(), rpiMs: z.number().optional() }).optional(),
|
|
94
|
+
connection: z.string().optional(),
|
|
95
|
+
assemblies: z.array(z.object({
|
|
96
|
+
direction: z.enum(["input", "output"]),
|
|
97
|
+
bytes: z.number().int(),
|
|
98
|
+
address: z.string().optional(),
|
|
99
|
+
raw: z.string().optional()
|
|
100
|
+
})),
|
|
101
|
+
health: z.object({
|
|
102
|
+
state: z.string().optional(),
|
|
103
|
+
states: z.record(z.string(), z.number().int()).optional(),
|
|
104
|
+
diagnostic: z.string().optional(),
|
|
105
|
+
message: z.string().optional()
|
|
106
|
+
}).optional(),
|
|
107
|
+
status: z.record(z.string(), z.string()).optional(),
|
|
108
|
+
channels: z.array(debugChannel)
|
|
109
|
+
});
|
|
110
|
+
var debugFunction = z.object({
|
|
111
|
+
id: z.number().int(),
|
|
112
|
+
name: z.string(),
|
|
113
|
+
declaration: sourceRange,
|
|
114
|
+
instance: z.string().optional(),
|
|
115
|
+
task: z.string().optional(),
|
|
116
|
+
target: z.string(),
|
|
117
|
+
reads: z.array(z.object({ range: sourceRange, path: z.string() }))
|
|
118
|
+
});
|
|
119
|
+
var jobStateFields = {
|
|
120
|
+
step: "UINT",
|
|
121
|
+
cancelling: "BOOL",
|
|
122
|
+
busy: "BOOL",
|
|
123
|
+
done: "BOOL",
|
|
124
|
+
error: "UDINT"
|
|
125
|
+
};
|
|
126
|
+
var instrumentationFields = {
|
|
127
|
+
busy: jobStateFields.busy,
|
|
128
|
+
step: jobStateFields.step,
|
|
129
|
+
startedAt: "UDINT",
|
|
130
|
+
job: "UDINT",
|
|
131
|
+
sequence: "UDINT"
|
|
132
|
+
};
|
|
133
|
+
var debugJob = z.object({
|
|
134
|
+
id: z.number().int(),
|
|
135
|
+
name: z.string(),
|
|
136
|
+
declaration: sourceRange,
|
|
137
|
+
instance: z.string().optional(),
|
|
138
|
+
target: z.string(),
|
|
139
|
+
steps: z.array(z.object({
|
|
140
|
+
step: z.number().int(),
|
|
141
|
+
kind: z.enum(["await", "return", "throw", "statement"]),
|
|
142
|
+
range: sourceRange,
|
|
143
|
+
text: z.string()
|
|
144
|
+
})),
|
|
145
|
+
startedAt: z.string().optional(),
|
|
146
|
+
requests: z.array(z.object({
|
|
147
|
+
service: z.string(),
|
|
148
|
+
target: z.string(),
|
|
149
|
+
sequence: z.string(),
|
|
150
|
+
job: z.number().int().optional()
|
|
151
|
+
})),
|
|
152
|
+
generated: z.literal(true).optional()
|
|
153
|
+
});
|
|
154
|
+
var debugEventSite = z.object({
|
|
155
|
+
id: z.number().int(),
|
|
156
|
+
kind: z.enum(["state", "decision", "job"]),
|
|
157
|
+
job: z.number().int().optional(),
|
|
158
|
+
phase: z.enum(["started", "finished"]).optional(),
|
|
159
|
+
path: z.string(),
|
|
160
|
+
function: z.number().int().optional(),
|
|
161
|
+
type: z.string(),
|
|
162
|
+
range: sourceRange,
|
|
163
|
+
text: z.string(),
|
|
164
|
+
task: z.string(),
|
|
165
|
+
operands: z.array(z.object({
|
|
166
|
+
text: z.string(),
|
|
167
|
+
range: sourceRange,
|
|
168
|
+
type: z.string(),
|
|
169
|
+
path: z.string().optional(),
|
|
170
|
+
stable: z.boolean()
|
|
171
|
+
}))
|
|
172
|
+
});
|
|
173
|
+
var neverWrittenSlot = 0;
|
|
174
|
+
var writerSlotType = "UINT";
|
|
175
|
+
var debugWriter = z.object({
|
|
176
|
+
output: z.string(),
|
|
177
|
+
target: z.string(),
|
|
178
|
+
exact: z.boolean().optional(),
|
|
179
|
+
sites: z.array(z.object({
|
|
180
|
+
id: z.number().int(),
|
|
181
|
+
range: sourceRange,
|
|
182
|
+
function: z.number().int(),
|
|
183
|
+
assignments: z.array(z.number().int()).optional()
|
|
184
|
+
}))
|
|
185
|
+
});
|
|
186
|
+
var scanClockType = "DINT";
|
|
187
|
+
var debugTask = z.object({
|
|
188
|
+
name: z.string(),
|
|
189
|
+
intervalMs: z.number(),
|
|
190
|
+
priority: z.number().int(),
|
|
191
|
+
clock: z.string().optional()
|
|
192
|
+
});
|
|
193
|
+
var debugManifest = z.object({
|
|
194
|
+
kind: z.literal("tsplc-debug"),
|
|
195
|
+
version: z.literal(1),
|
|
196
|
+
build: z.object({
|
|
197
|
+
id: z.string(),
|
|
198
|
+
target: z.string(),
|
|
199
|
+
compiler: z.string()
|
|
200
|
+
}),
|
|
201
|
+
sources: z.array(z.string()),
|
|
202
|
+
types: z.record(z.string(), debugType),
|
|
203
|
+
roots: z.array(debugRoot),
|
|
204
|
+
constants: z.array(debugConstant),
|
|
205
|
+
io: z.array(debugIo),
|
|
206
|
+
devices: z.array(debugDevice),
|
|
207
|
+
functions: z.array(debugFunction),
|
|
208
|
+
jobs: z.array(debugJob),
|
|
209
|
+
events: z.array(debugEventSite),
|
|
210
|
+
writers: z.array(debugWriter),
|
|
211
|
+
tasks: z.array(debugTask),
|
|
212
|
+
errors: z.record(z.string(), z.string()),
|
|
213
|
+
explain: z.object({ sha256: z.string() }).optional()
|
|
214
|
+
});
|
|
215
|
+
export {
|
|
216
|
+
debugChannel,
|
|
217
|
+
debugConstant,
|
|
218
|
+
debugDevice,
|
|
219
|
+
debugEventSite,
|
|
220
|
+
debugField,
|
|
221
|
+
debugFunction,
|
|
222
|
+
debugIo,
|
|
223
|
+
debugJob,
|
|
224
|
+
debugManifest,
|
|
225
|
+
debugManifestFile,
|
|
226
|
+
debugRoot,
|
|
227
|
+
debugTask,
|
|
228
|
+
debugType,
|
|
229
|
+
debugWriter,
|
|
230
|
+
instrumentationFields,
|
|
231
|
+
jobStateFields,
|
|
232
|
+
json,
|
|
233
|
+
neverWrittenSlot,
|
|
234
|
+
scanClockType,
|
|
235
|
+
sourceRange,
|
|
236
|
+
writerSlotType
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//# debugId=C738D993BBA759EC64756E2164756E21
|
|
240
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/manifest.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { z } from \"zod\";\n\n/**\n * What a build tells the debugger: every TypeScript identity it can show, and the target symbol each one reads.\n * TypeScript paths (`bench.instruments[10].phase`) are the identity; `target` strings are opaque to\n * everything except the target's adapter (for CODESYS, IEC symbol paths such as `Bench.instruments…`).\n * Written by the compiler beside its emitted ST and shipped with each release, as `debugManifestFile`.\n */\nexport const debugManifestFile = \"debug.json\";\n\n/** A location in the project's own sources: `file` indexes `sources`; lines and columns are 1-based. */\nexport const sourceRange = z.object({\n\tfile: z.number().int(),\n\tline: z.number().int(),\n\tcolumn: z.number().int(),\n\tendLine: z.number().int(),\n\tendColumn: z.number().int(),\n});\n\n/** Any JSON value. */\nexport const json: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\tz.number(),\n\t\tz.boolean(),\n\t\tz.null(),\n\t\tz.array(json),\n\t\tz.record(z.string(), json),\n\t]),\n);\n\nexport const debugField = z.object({\n\tname: z.string(),\n\ttarget: z.string(),\n\ttype: z.string(),\n\tdeclaration: sourceRange.optional(),\n\t/** Compiler-made storage, such as an async job's `step`; hidden unless asked for. */\n\tgenerated: z.literal(true).optional(),\n});\n\n/** Keys of `types` are opaque ids; scalars use their IEC name, such as `BOOL`. */\nexport const debugType = z.discriminatedUnion(\"kind\", [\n\tz.object({\n\t\tkind: z.literal(\"scalar\"),\n\t\tiec: z.string(),\n\t\t/** A STRING's or WSTRING's capacity in characters. */\n\t\tcapacity: z.number().int().optional(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"enum\"),\n\t\tname: z.string(),\n\t\tmembers: z.record(z.string(), z.number().int()),\n\t\t/** For a plain TypeScript program's string-literal union, the string each member stands for. */\n\t\ttexts: z.record(z.string(), z.string()).optional(),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"record\"),\n\t\tname: z.string(),\n\t\tdeclaration: sourceRange.optional(),\n\t\tfields: z.array(debugField),\n\t}),\n\tz.object({\n\t\tkind: z.literal(\"array\"),\n\t\telement: z.string(),\n\t\tlength: z.number().int(),\n\t\t/** The first index; TypeScript paths use the target's own indexes, `lower` to `lower + length - 1`. */\n\t\tlower: z.number().int(),\n\t\t/** For `Record<Enum, T>`, the enum whose member values are the indexes. */\n\t\tindex: z.string().optional(),\n\t}),\n]);\n\nexport const debugRoot = z.object({\n\tpath: z.string(),\n\ttarget: z.string(),\n\ttype: z.string(),\n\tdeclaration: sourceRange.optional(),\n\t/** Readable at runtime through the target's adapter; for CODESYS, all stored state is. */\n\treadable: z.boolean(),\n\tgenerated: z.literal(true).optional(),\n});\n\n/** A field the compiler folded away: it has no runtime storage, but its value is known. */\nexport const debugConstant = z.object({\n\tpath: z.string(),\n\ttype: z.string(),\n\t/** Integers and durations as `encodeConstant` writes them. */\n\tvalue: json,\n\tdeclaration: sourceRange.optional(),\n});\n\nexport const debugIo = z.object({\n\tpath: z.string(),\n\ttarget: z.string(),\n\tdirection: z.enum([\"input\", \"output\"]),\n\ttype: z.string(),\n\tdevice: z.string().optional(),\n\tchannel: z.string().optional(),\n\taddress: z.string().optional(),\n\tinverted: z.literal(true).optional(),\n\tshared: z.literal(true).optional(),\n});\n\nexport const debugChannel = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tdirection: z.enum([\"input\", \"output\"]),\n\ttype: z.string(),\n\toffsetBits: z.number().int(),\n\tbits: z.number().int(),\n\taddress: z.string().optional(),\n\tunit: z.string().optional(),\n\tdescription: z.string().optional(),\n});\n\nexport const debugDevice = z.object({\n\tid: z.string(),\n\tproduct: z.string().optional(),\n\tvendor: z.string().optional(),\n\tproductCode: z.string().optional(),\n\tnetwork: z\n\t\t.object({ address: z.string(), rpiMs: z.number().optional() })\n\t\t.optional(),\n\tconnection: z.string().optional(),\n\tassemblies: z.array(\n\t\tz.object({\n\t\t\tdirection: z.enum([\"input\", \"output\"]),\n\t\t\tbytes: z.number().int(),\n\t\t\taddress: z.string().optional(),\n\t\t\t/** A byte array over the whole assembly, mapped or not. */\n\t\t\traw: z.string().optional(),\n\t\t}),\n\t),\n\t/**\n\t * Target paths of the driver's own state, such as a generated adapter's `eState`; absent means\n\t * the device's health is unknown.\n\t */\n\thealth: z\n\t\t.object({\n\t\t\tstate: z.string().optional(),\n\t\t\tstates: z.record(z.string(), z.number().int()).optional(),\n\t\t\tdiagnostic: z.string().optional(),\n\t\t\tmessage: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\t/** Status symbols by label: hand-configured ones, and a generated Modbus server's error. */\n\tstatus: z.record(z.string(), z.string()).optional(),\n\tchannels: z.array(debugChannel),\n});\n\n/** A specialized function: one per method per instance, so `reads` resolve to concrete paths. */\nexport const debugFunction = z.object({\n\tid: z.number().int(),\n\tname: z.string(),\n\tdeclaration: sourceRange,\n\t/** The TypeScript path of `this`, for a method specialized to one instance. */\n\tinstance: z.string().optional(),\n\ttask: z.string().optional(),\n\ttarget: z.string(),\n\t/** Member reads in the body whose runtime path is static in this specialization. */\n\treads: z.array(z.object({ range: sourceRange, path: z.string() })),\n});\n\n/** The fields of a job's state, by name, with the IEC type the generated job block declares. */\nexport const jobStateFields = {\n\tstep: \"UINT\",\n\tcancelling: \"BOOL\",\n\tbusy: \"BOOL\",\n\tdone: \"BOOL\",\n\terror: \"UDINT\",\n} as const;\n\n/**\n * The fields the compiler adds to a block for the debugger, by key, with their IEC types: copies\n * of a job's `busy` and `step` for its trace, when it last started, and a service call's job and\n * request counter.\n */\nexport const instrumentationFields = {\n\tbusy: jobStateFields.busy,\n\tstep: jobStateFields.step,\n\tstartedAt: \"UDINT\",\n\tjob: \"UDINT\",\n\tsequence: \"UDINT\",\n} as const;\n\nexport const debugJob = z.object({\n\tid: z.number().int(),\n\tname: z.string(),\n\tdeclaration: sourceRange,\n\tinstance: z.string().optional(),\n\t/** The job's state, with the fields of `jobStateFields`. */\n\ttarget: z.string(),\n\tsteps: z.array(\n\t\tz.object({\n\t\t\tstep: z.number().int(),\n\t\t\tkind: z.enum([\"await\", \"return\", \"throw\", \"statement\"]),\n\t\t\trange: sourceRange,\n\t\t\ttext: z.string(),\n\t\t}),\n\t),\n\t/**\n\t * The PLC clock in milliseconds when the job last started: the clock of telemetry records'\n\t * `time` and a batch's `now`.\n\t */\n\tstartedAt: z.string().optional(),\n\t/**\n\t * Service calls the job awaits, its nested jobs' included; `sequence` is the request counter sent\n\t * as `x-tsplc-request`, with `job`'s id when a nested job makes the call.\n\t */\n\trequests: z.array(\n\t\tz.object({\n\t\t\tservice: z.string(),\n\t\t\ttarget: z.string(),\n\t\t\tsequence: z.string(),\n\t\t\tjob: z.number().int().optional(),\n\t\t}),\n\t),\n\t/** Made by the compiler, such as a service call's own job; hidden unless asked for. */\n\tgenerated: z.literal(true).optional(),\n});\n\n/**\n * Where `debug.trace` records: an enum state field changing, a decision function returning a\n * different value, or a job starting or finishing. Trace records name their site by `id`.\n */\nexport const debugEventSite = z.object({\n\tid: z.number().int(),\n\tkind: z.enum([\"state\", \"decision\", \"job\"]),\n\t/** For `kind: \"job\"`: the job, and whether it starts or finishes at this site. */\n\tjob: z.number().int().optional(),\n\tphase: z.enum([\"started\", \"finished\"]).optional(),\n\t/** The TypeScript path written, or of the job. */\n\tpath: z.string(),\n\tfunction: z.number().int().optional(),\n\ttype: z.string(),\n\trange: sourceRange,\n\ttext: z.string(),\n\ttask: z.string(),\n\t/**\n\t * Guard values captured in the same scan, at the write: each `if` condition leaf enclosing it.\n\t * `stable` is false when the body between the guard and the write can change the leaf.\n\t */\n\toperands: z.array(\n\t\tz.object({\n\t\t\ttext: z.string(),\n\t\t\trange: sourceRange,\n\t\t\ttype: z.string(),\n\t\t\tpath: z.string().optional(),\n\t\t\tstable: z.boolean(),\n\t\t}),\n\t),\n});\n\n/** A writer slot's value before any site writes it; site ids count from 1. */\nexport const neverWrittenSlot = 0;\n\n/** The IEC type of a writer slot, which holds the id of the site that last wrote its output. */\nexport const writerSlotType = \"UINT\";\n\n/** The statement that last wrote each output, per scan. */\nexport const debugWriter = z.object({\n\toutput: z.string(),\n\ttarget: z.string(),\n\t/** Every statement that can write `output` is probed, so the slot names its last writer exactly. */\n\texact: z.boolean().optional(),\n\tsites: z.array(\n\t\tz.object({\n\t\t\tid: z.number().int(),\n\t\t\trange: sourceRange,\n\t\t\tfunction: z.number().int(),\n\t\t\t/** The `explain.json` assignments this site is, one per instance that runs it. */\n\t\t\tassignments: z.array(z.number().int()).optional(),\n\t\t}),\n\t),\n});\n\n/** The IEC type of a task's scan clock. */\nexport const scanClockType = \"DINT\";\n\nexport const debugTask = z.object({\n\tname: z.string(),\n\tintervalMs: z.number(),\n\tpriority: z.number().int(),\n\t/** The PLC clock in milliseconds, of type `scanClockType`, as the task's first program read it this scan. */\n\tclock: z.string().optional(),\n});\n\nexport const debugManifest = z.object({\n\tkind: z.literal(\"tsplc-debug\"),\n\tversion: z.literal(1),\n\tbuild: z.object({\n\t\tid: z.string(),\n\t\t/** A variable holding `id`, to tell which build the controller runs. */\n\t\ttarget: z.string(),\n\t\tcompiler: z.string(),\n\t}),\n\t/** Project-relative paths. */\n\tsources: z.array(z.string()),\n\ttypes: z.record(z.string(), debugType),\n\troots: z.array(debugRoot),\n\tconstants: z.array(debugConstant),\n\tio: z.array(debugIo),\n\tdevices: z.array(debugDevice),\n\tfunctions: z.array(debugFunction),\n\tjobs: z.array(debugJob),\n\tevents: z.array(debugEventSite),\n\twriters: z.array(debugWriter),\n\ttasks: z.array(debugTask),\n\t/** Job error codes by number: 1 cancelled, 2 timeout… */\n\terrors: z.record(z.string(), z.string()),\n\t/** The digest of the build's `explain.json`; absent when the build has no explanations. */\n\texplain: z.object({ sha256: z.string() }).optional(),\n});\n\nexport type SourceRange = z.infer<typeof sourceRange>;\nexport type DebugType = z.infer<typeof debugType>;\nexport type DebugField = z.infer<typeof debugField>;\nexport type DebugRoot = z.infer<typeof debugRoot>;\nexport type DebugConstant = z.infer<typeof debugConstant>;\nexport type DebugIo = z.infer<typeof debugIo>;\nexport type DebugDevice = z.infer<typeof debugDevice>;\nexport type DebugChannel = z.infer<typeof debugChannel>;\nexport type DebugFunction = z.infer<typeof debugFunction>;\nexport type DebugJob = z.infer<typeof debugJob>;\nexport type DebugEventSite = z.infer<typeof debugEventSite>;\nexport type DebugWriter = z.infer<typeof debugWriter>;\nexport type DebugTask = z.infer<typeof debugTask>;\nexport type DebugManifest = z.infer<typeof debugManifest>;\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AAQO,IAAM,oBAAoB;AAG1B,IAAM,cAAc,EAAE,OAAO;AAAA,EACnC,MAAM,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,MAAM,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,QAAQ,EAAE,OAAO,EAAE,IAAI;AAAA,EACvB,SAAS,EAAE,OAAO,EAAE,IAAI;AAAA,EACxB,WAAW,EAAE,OAAO,EAAE,IAAI;AAC3B,CAAC;AAGM,IAAM,OAA2B,EAAE,KAAK,MAC9C,EAAE,MAAM;AAAA,EACP,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,EACT,EAAE,QAAQ;AAAA,EACV,EAAE,KAAK;AAAA,EACP,EAAE,MAAM,IAAI;AAAA,EACZ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;AAC1B,CAAC,CACF;AAEO,IAAM,aAAa,EAAE,OAAO;AAAA,EAClC,MAAM,EAAE,OAAO;AAAA,EACf,QAAQ,EAAE,OAAO;AAAA,EACjB,MAAM,EAAE,OAA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AAA,EACrC,OAAO,EAAE,MAAM,SAAS;AAAA,EACxB,WAAW,EAAE,MAAM,aAAa;AAAA,EAChC,IAAI,EAAE,MAAM,OAAO;AAAA,EACnB,SAAS,EAAE,MAAM,WAAW;AAAA,EAC5B,WAAW,EAAE,MAAM,aAAa;AAAA,EAChC,MAAM,EAAE,MAAM,QAAQ;AAAA,EACtB,QAAQ,EAAE,MAAM,cAAc;AAAA,EAC9B,SAAS,EAAE,MAAM,WAAW;AAAA,EAC5B,OAAO,EAAE,MAAM,SAAS;AAAA,EAExB,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAAA,EAEvC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS;AACpD,CAAC;",
|
|
8
|
+
"debugId": "C738D993BBA759EC64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// packages/debug/src/paths.ts
|
|
2
|
+
import { isWithin } from "@tsplc/iec/st";
|
|
3
|
+
import {
|
|
4
|
+
arrayIndex,
|
|
5
|
+
joinPath,
|
|
6
|
+
symbolPathSegments
|
|
7
|
+
} from "@tsplc/opcua/contract";
|
|
8
|
+
var anyIndex = "[*]";
|
|
9
|
+
var isPattern = (path) => path.includes("*");
|
|
10
|
+
|
|
11
|
+
class TooManyMatches extends RangeError {
|
|
12
|
+
constructor(limit) {
|
|
13
|
+
super(`More than ${limit} values match`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
var pathSegments = (path) => path.split(anyIndex).flatMap((part, index) => [
|
|
17
|
+
...index > 0 ? [anyIndex] : [],
|
|
18
|
+
...symbolPathSegments(part)
|
|
19
|
+
]);
|
|
20
|
+
var patternOf = (path) => pathSegments(path).map((segment) => arrayIndex(segment) === undefined ? segment : anyIndex).reduce(joinPath, "");
|
|
21
|
+
var typeOf = (manifest, id) => manifest.types[id] ?? { kind: "scalar", iec: id };
|
|
22
|
+
var createPaths = (manifest) => {
|
|
23
|
+
const typeOfId = (id) => typeOf(manifest, id);
|
|
24
|
+
const constants = new Map(manifest.constants.map(({ path, ...constant }) => [
|
|
25
|
+
path,
|
|
26
|
+
{ kind: "constant", path, ...constant }
|
|
27
|
+
]));
|
|
28
|
+
const roots = new Map(manifest.roots.map(({ path, ...root }) => [
|
|
29
|
+
path,
|
|
30
|
+
{ kind: "target", path, ...root }
|
|
31
|
+
]));
|
|
32
|
+
const walk = (bases, path) => {
|
|
33
|
+
const segments = pathSegments(path);
|
|
34
|
+
for (let length = segments.length;length > 0; length--) {
|
|
35
|
+
const base = bases.get(segments.slice(0, length).reduce(joinPath, ""));
|
|
36
|
+
if (!base) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
let resolved = base;
|
|
40
|
+
for (const segment of segments.slice(length)) {
|
|
41
|
+
const type = typeOfId(resolved.type);
|
|
42
|
+
if (type.kind === "record") {
|
|
43
|
+
const field = type.fields.find(({ name }) => name === segment);
|
|
44
|
+
if (!field) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
resolved = {
|
|
48
|
+
kind: "target",
|
|
49
|
+
path: joinPath(resolved.path, segment),
|
|
50
|
+
target: `${resolved.target}.${field.target}`,
|
|
51
|
+
type: field.type,
|
|
52
|
+
readable: resolved.readable,
|
|
53
|
+
...field.generated && { generated: true },
|
|
54
|
+
...field.declaration && { declaration: field.declaration }
|
|
55
|
+
};
|
|
56
|
+
} else if (type.kind === "array") {
|
|
57
|
+
const index = arrayIndex(segment);
|
|
58
|
+
if (index === undefined || index < type.lower || index >= type.lower + type.length) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
resolved = {
|
|
62
|
+
kind: "target",
|
|
63
|
+
path: joinPath(resolved.path, segment),
|
|
64
|
+
target: `${resolved.target}${segment}`,
|
|
65
|
+
type: type.element,
|
|
66
|
+
readable: resolved.readable,
|
|
67
|
+
...resolved.declaration && { declaration: resolved.declaration }
|
|
68
|
+
};
|
|
69
|
+
} else {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return resolved;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const bases = new Map([
|
|
77
|
+
...roots,
|
|
78
|
+
...manifest.io.map(({ path, target, type }) => {
|
|
79
|
+
const declared = walk(roots, path);
|
|
80
|
+
return [
|
|
81
|
+
path,
|
|
82
|
+
{
|
|
83
|
+
kind: "target",
|
|
84
|
+
path,
|
|
85
|
+
target,
|
|
86
|
+
type,
|
|
87
|
+
readable: true,
|
|
88
|
+
...declared?.generated && { generated: true },
|
|
89
|
+
...declared?.declaration && { declaration: declared.declaration }
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
})
|
|
93
|
+
]);
|
|
94
|
+
const groups = new Map;
|
|
95
|
+
for (const path of [...bases.keys(), ...constants.keys()]) {
|
|
96
|
+
let prefix = "";
|
|
97
|
+
for (const segment of pathSegments(path)) {
|
|
98
|
+
let children = groups.get(prefix);
|
|
99
|
+
if (!children) {
|
|
100
|
+
children = new Set;
|
|
101
|
+
groups.set(prefix, children);
|
|
102
|
+
}
|
|
103
|
+
children.add(segment);
|
|
104
|
+
prefix = joinPath(prefix, segment);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const resolve = (path) => constants.get(path) ?? walk(bases, path);
|
|
108
|
+
const typedChildren = (resolved) => {
|
|
109
|
+
const type = resolved?.kind === "target" ? typeOfId(resolved.type) : undefined;
|
|
110
|
+
if (type?.kind === "record") {
|
|
111
|
+
return type.fields.map(({ name }) => name);
|
|
112
|
+
}
|
|
113
|
+
if (type?.kind === "array") {
|
|
114
|
+
return Array.from({ length: type.length }, (_, index) => `[${type.lower + index}]`);
|
|
115
|
+
}
|
|
116
|
+
return [];
|
|
117
|
+
};
|
|
118
|
+
const children = (path) => {
|
|
119
|
+
const names = [
|
|
120
|
+
...typedChildren(resolve(path)),
|
|
121
|
+
...groups.get(path) ?? []
|
|
122
|
+
];
|
|
123
|
+
return [...new Set(names)].map((name) => {
|
|
124
|
+
const child = joinPath(path, name);
|
|
125
|
+
return { name, ...resolve(child) ?? { kind: "group", path: child } };
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const isLeaf = (node) => node.kind === "constant" || node.kind === "target" && ["scalar", "enum"].includes(typeOfId(node.type).kind);
|
|
129
|
+
const expand = (patterns, limit = 2000) => {
|
|
130
|
+
const leaves = new Set;
|
|
131
|
+
const add = (path) => {
|
|
132
|
+
leaves.add(path);
|
|
133
|
+
if (leaves.size > limit) {
|
|
134
|
+
throw new TooManyMatches(limit);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const below = (node) => {
|
|
138
|
+
if (isLeaf(node)) {
|
|
139
|
+
return add(node.path);
|
|
140
|
+
}
|
|
141
|
+
for (const child of children(node.path)) {
|
|
142
|
+
if (!(child.kind === "target" && child.generated)) {
|
|
143
|
+
below(child);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const match = (prefix, rest, wildcard) => {
|
|
148
|
+
const [head, ...tail] = rest;
|
|
149
|
+
if (head === undefined) {
|
|
150
|
+
const node = resolve(prefix) ?? (groups.has(prefix) ? { kind: "group", path: prefix } : undefined);
|
|
151
|
+
if (node) {
|
|
152
|
+
below(node);
|
|
153
|
+
} else if (!wildcard) {
|
|
154
|
+
add(prefix);
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (head === "*" || head === anyIndex) {
|
|
159
|
+
for (const child of children(prefix)) {
|
|
160
|
+
if (!(child.kind === "target" && child.generated) && (head === "*" || child.name.startsWith("["))) {
|
|
161
|
+
match(child.path, tail, true);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
match(joinPath(prefix, head), tail, wildcard);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
for (const pattern of patterns) {
|
|
169
|
+
match("", pathSegments(pattern), false);
|
|
170
|
+
}
|
|
171
|
+
return [...leaves];
|
|
172
|
+
};
|
|
173
|
+
const decode = (typeId, raw) => {
|
|
174
|
+
const type = typeOfId(typeId);
|
|
175
|
+
if (type.kind === "enum") {
|
|
176
|
+
return Object.entries(type.members).find(([, value]) => value === raw)?.[0] ?? raw;
|
|
177
|
+
}
|
|
178
|
+
if (type.kind === "scalar" && type.iec === "BOOL" && typeof raw === "number") {
|
|
179
|
+
return raw !== 0;
|
|
180
|
+
}
|
|
181
|
+
return raw;
|
|
182
|
+
};
|
|
183
|
+
const fromTarget = (expression) => {
|
|
184
|
+
const upper = expression.trim().toUpperCase();
|
|
185
|
+
const whole = targets.get(upper);
|
|
186
|
+
if (whole) {
|
|
187
|
+
return whole;
|
|
188
|
+
}
|
|
189
|
+
const root = manifest.roots.filter((item) => isWithin(item.target, upper)).sort((a, b) => b.target.length - a.target.length)[0];
|
|
190
|
+
if (!root) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
let path = root.path;
|
|
194
|
+
let type = root.type;
|
|
195
|
+
for (const segment of pathSegments(expression.trim().slice(root.target.length).replace(/^\./, ""))) {
|
|
196
|
+
const declared = typeOfId(type);
|
|
197
|
+
if (segment.startsWith("[")) {
|
|
198
|
+
if (declared.kind !== "array") {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
path = joinPath(path, segment);
|
|
202
|
+
type = declared.element;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const field = declared.kind === "record" ? declared.fields.find((item) => item.target.toUpperCase() === segment.toUpperCase()) : undefined;
|
|
206
|
+
if (!field) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
path = joinPath(path, field.name);
|
|
210
|
+
type = field.type;
|
|
211
|
+
}
|
|
212
|
+
return path;
|
|
213
|
+
};
|
|
214
|
+
const targets = new Map([
|
|
215
|
+
...manifest.io.flatMap((io) => [
|
|
216
|
+
[io.target.toUpperCase(), io.path],
|
|
217
|
+
...io.address ? [[io.address.toUpperCase(), io.path]] : []
|
|
218
|
+
]),
|
|
219
|
+
...manifest.roots.map((root) => [root.target.toUpperCase(), root.path])
|
|
220
|
+
]);
|
|
221
|
+
return {
|
|
222
|
+
typeOf: typeOfId,
|
|
223
|
+
resolve,
|
|
224
|
+
children,
|
|
225
|
+
isLeaf,
|
|
226
|
+
expand,
|
|
227
|
+
decode,
|
|
228
|
+
fromTarget
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
export {
|
|
232
|
+
TooManyMatches,
|
|
233
|
+
anyIndex,
|
|
234
|
+
createPaths,
|
|
235
|
+
isPattern,
|
|
236
|
+
pathSegments,
|
|
237
|
+
patternOf,
|
|
238
|
+
typeOf
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
//# debugId=D64654CCB7012F7164756E2164756E21
|
|
242
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/paths.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { isWithin } from \"@tsplc/iec/st\";\nimport {\n\tarrayIndex,\n\tjoinPath,\n\tsymbolPathSegments,\n} from \"@tsplc/opcua/contract\";\nimport type { DebugManifest, DebugType, SourceRange } from \"./manifest\";\n\n/**\n * TypeScript paths over a manifest: `bench.instruments[10].phase` names a root\n * (`program.benchs`), then record fields and array indexes. Pure, so the browser UI can use it.\n */\n\n/** A path that reads a target, or a constant the compiler folded. */\nexport type ResolvedPath =\n\t| {\n\t\t\tkind: \"target\";\n\t\t\tpath: string;\n\t\t\ttarget: string;\n\t\t\ttype: string;\n\t\t\treadable: boolean;\n\t\t\tgenerated?: true;\n\t\t\tdeclaration?: SourceRange;\n\t }\n\t| {\n\t\t\tkind: \"constant\";\n\t\t\tpath: string;\n\t\t\ttype: string;\n\t\t\tvalue: unknown;\n\t\t\tdeclaration?: SourceRange;\n\t };\n\ntype TargetPath = Extract<ResolvedPath, { kind: \"target\" }>;\n\n/** Roots or constants that share a prefix, such as `program` above `program.benchs`. */\ninterface GroupPath {\n\tkind: \"group\";\n\tpath: string;\n}\n\n/** A child in the instance tree. */\nexport type PathNode = { name: string } & (ResolvedPath | GroupPath);\n\n/** In a pattern, every index of an array. */\nexport const anyIndex = \"[*]\";\n\n/** Whether `path` is a pattern: `*` stands for any one segment and `[*]` for any index. */\nexport const isPattern = (path: string) => path.includes(\"*\");\n\n/** Thrown by `expand` when more paths match than its limit. */\nexport class TooManyMatches extends RangeError {\n\tconstructor(limit: number) {\n\t\tsuper(`More than ${limit} values match`);\n\t}\n}\n\n/** Names and indexes as the controller's symbol paths split them, and `[*]` in patterns. */\nexport const pathSegments = (path: string) =>\n\tpath\n\t\t.split(anyIndex)\n\t\t.flatMap((part, index) => [\n\t\t\t...(index > 0 ? [anyIndex] : []),\n\t\t\t...symbolPathSegments(part),\n\t\t]);\n\n/** `path` with every index as `[*]`, so a pattern and each of its elements compare equal. */\nexport const patternOf = (path: string) =>\n\tpathSegments(path)\n\t\t.map((segment) => (arrayIndex(segment) === undefined ? segment : anyIndex))\n\t\t.reduce(joinPath, \"\");\n\n/** Scalar type ids are their IEC names, and may have no entry in `types`. */\nexport const typeOf = (\n\tmanifest: Pick<DebugManifest, \"types\">,\n\tid: string,\n): DebugType => manifest.types[id] ?? { kind: \"scalar\", iec: id };\n\n/** What resolving and expanding paths needs from a manifest. */\nexport type PathManifest = Pick<\n\tDebugManifest,\n\t\"roots\" | \"io\" | \"constants\" | \"types\"\n>;\n\nexport const createPaths = (manifest: PathManifest) => {\n\tconst typeOfId = (id: string) => typeOf(manifest, id);\n\tconst constants = new Map(\n\t\tmanifest.constants.map(({ path, ...constant }) => [\n\t\t\tpath,\n\t\t\t{ kind: \"constant\" as const, path, ...constant },\n\t\t]),\n\t);\n\tconst roots = new Map<string, TargetPath>(\n\t\tmanifest.roots.map(({ path, ...root }) => [\n\t\t\tpath,\n\t\t\t{ kind: \"target\", path, ...root },\n\t\t]),\n\t);\n\t/** `path` walked from the longest prefix in `bases` through record fields and array indexes. */\n\tconst walk = (\n\t\tbases: ReadonlyMap<string, TargetPath>,\n\t\tpath: string,\n\t): TargetPath | undefined => {\n\t\tconst segments = pathSegments(path);\n\t\tfor (let length = segments.length; length > 0; length--) {\n\t\t\tconst base = bases.get(segments.slice(0, length).reduce(joinPath, \"\"));\n\t\t\tif (!base) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet resolved = base;\n\t\t\tfor (const segment of segments.slice(length)) {\n\t\t\t\tconst type = typeOfId(resolved.type);\n\t\t\t\tif (type.kind === \"record\") {\n\t\t\t\t\tconst field = type.fields.find(({ name }) => name === segment);\n\t\t\t\t\tif (!field) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tresolved = {\n\t\t\t\t\t\tkind: \"target\",\n\t\t\t\t\t\tpath: joinPath(resolved.path, segment),\n\t\t\t\t\t\ttarget: `${resolved.target}.${field.target}`,\n\t\t\t\t\t\ttype: field.type,\n\t\t\t\t\t\treadable: resolved.readable,\n\t\t\t\t\t\t...(field.generated && { generated: true }),\n\t\t\t\t\t\t...(field.declaration && { declaration: field.declaration }),\n\t\t\t\t\t};\n\t\t\t\t} else if (type.kind === \"array\") {\n\t\t\t\t\tconst index = arrayIndex(segment);\n\t\t\t\t\tif (\n\t\t\t\t\t\tindex === undefined ||\n\t\t\t\t\t\tindex < type.lower ||\n\t\t\t\t\t\tindex >= type.lower + type.length\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tresolved = {\n\t\t\t\t\t\tkind: \"target\",\n\t\t\t\t\t\tpath: joinPath(resolved.path, segment),\n\t\t\t\t\t\ttarget: `${resolved.target}${segment}`,\n\t\t\t\t\t\ttype: type.element,\n\t\t\t\t\t\treadable: resolved.readable,\n\t\t\t\t\t\t...(resolved.declaration && { declaration: resolved.declaration }),\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn resolved;\n\t\t}\n\t};\n\t// A logical input's or output's path is its root's too, and the root declares it.\n\tconst bases = new Map<string, TargetPath>([\n\t\t...roots,\n\t\t...manifest.io.map(({ path, target, type }): [string, TargetPath] => {\n\t\t\tconst declared = walk(roots, path);\n\t\t\treturn [\n\t\t\t\tpath,\n\t\t\t\t{\n\t\t\t\t\tkind: \"target\",\n\t\t\t\t\tpath,\n\t\t\t\t\ttarget,\n\t\t\t\t\ttype,\n\t\t\t\t\treadable: true,\n\t\t\t\t\t...(declared?.generated && { generated: true }),\n\t\t\t\t\t...(declared?.declaration && { declaration: declared.declaration }),\n\t\t\t\t},\n\t\t\t];\n\t\t}),\n\t]);\n\t/** Children of the prefixes of every root and constant path, which are groups unless they resolve. */\n\tconst groups = new Map<string, Set<string>>();\n\tfor (const path of [...bases.keys(), ...constants.keys()]) {\n\t\tlet prefix = \"\";\n\t\tfor (const segment of pathSegments(path)) {\n\t\t\tlet children = groups.get(prefix);\n\t\t\tif (!children) {\n\t\t\t\tchildren = new Set();\n\t\t\t\tgroups.set(prefix, children);\n\t\t\t}\n\t\t\tchildren.add(segment);\n\t\t\tprefix = joinPath(prefix, segment);\n\t\t}\n\t}\n\n\tconst resolve = (path: string): ResolvedPath | undefined =>\n\t\tconstants.get(path) ?? walk(bases, path);\n\n\tconst typedChildren = (resolved: ResolvedPath | undefined) => {\n\t\tconst type =\n\t\t\tresolved?.kind === \"target\" ? typeOfId(resolved.type) : undefined;\n\t\tif (type?.kind === \"record\") {\n\t\t\treturn type.fields.map(({ name }) => name);\n\t\t}\n\t\tif (type?.kind === \"array\") {\n\t\t\treturn Array.from(\n\t\t\t\t{ length: type.length },\n\t\t\t\t(_, index) => `[${type.lower + index}]`,\n\t\t\t);\n\t\t}\n\t\treturn [];\n\t};\n\n\t/** A path's fields or indexes, and the roots and constants below it. */\n\tconst children = (path: string): PathNode[] => {\n\t\tconst names = [\n\t\t\t...typedChildren(resolve(path)),\n\t\t\t...(groups.get(path) ?? []),\n\t\t];\n\t\treturn [...new Set(names)].map((name) => {\n\t\t\tconst child = joinPath(path, name);\n\t\t\treturn { name, ...(resolve(child) ?? { kind: \"group\", path: child }) };\n\t\t});\n\t};\n\n\tconst isLeaf = (node: ResolvedPath | GroupPath) =>\n\t\tnode.kind === \"constant\" ||\n\t\t(node.kind === \"target\" &&\n\t\t\t[\"scalar\", \"enum\"].includes(typeOfId(node.type).kind));\n\n\t/**\n\t * Leaf paths matching `patterns`, where `*` stands for one segment. A pattern naming a record,\n\t * array or group stands for all its leaves; wildcards and expansion skip compiler-made fields.\n\t * Paths that don't resolve are kept, so callers can report them.\n\t */\n\tconst expand = (patterns: readonly string[], limit = 2000) => {\n\t\tconst leaves = new Set<string>();\n\t\tconst add = (path: string) => {\n\t\t\tleaves.add(path);\n\t\t\tif (leaves.size > limit) {\n\t\t\t\tthrow new TooManyMatches(limit);\n\t\t\t}\n\t\t};\n\t\tconst below = (node: ResolvedPath | GroupPath) => {\n\t\t\tif (isLeaf(node)) {\n\t\t\t\treturn add(node.path);\n\t\t\t}\n\t\t\tfor (const child of children(node.path)) {\n\t\t\t\tif (!(child.kind === \"target\" && child.generated)) {\n\t\t\t\t\tbelow(child);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst match = (\n\t\t\tprefix: string,\n\t\t\trest: readonly string[],\n\t\t\twildcard: boolean,\n\t\t) => {\n\t\t\tconst [head, ...tail] = rest;\n\t\t\tif (head === undefined) {\n\t\t\t\tconst node: ResolvedPath | GroupPath | undefined =\n\t\t\t\t\tresolve(prefix) ??\n\t\t\t\t\t(groups.has(prefix) ? { kind: \"group\", path: prefix } : undefined);\n\t\t\t\tif (node) {\n\t\t\t\t\tbelow(node);\n\t\t\t\t} else if (!wildcard) {\n\t\t\t\t\tadd(prefix);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (head === \"*\" || head === anyIndex) {\n\t\t\t\tfor (const child of children(prefix)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t!(child.kind === \"target\" && child.generated) &&\n\t\t\t\t\t\t(head === \"*\" || child.name.startsWith(\"[\"))\n\t\t\t\t\t) {\n\t\t\t\t\t\tmatch(child.path, tail, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmatch(joinPath(prefix, head), tail, wildcard);\n\t\t\t}\n\t\t};\n\t\tfor (const pattern of patterns) {\n\t\t\tmatch(\"\", pathSegments(pattern), false);\n\t\t}\n\t\treturn [...leaves];\n\t};\n\n\t/** A value as TypeScript shows it: enum members by name, BOOL as a boolean. */\n\tconst decode = (typeId: string, raw: unknown) => {\n\t\tconst type = typeOfId(typeId);\n\t\tif (type.kind === \"enum\") {\n\t\t\treturn (\n\t\t\t\tObject.entries(type.members).find(([, value]) => value === raw)?.[0] ??\n\t\t\t\traw\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\ttype.kind === \"scalar\" &&\n\t\t\ttype.iec === \"BOOL\" &&\n\t\t\ttypeof raw === \"number\"\n\t\t) {\n\t\t\treturn raw !== 0;\n\t\t}\n\t\treturn raw;\n\t};\n\n\t/**\n\t * The TypeScript path an IEC symbol path names: an I/O binding by its target or address, or a\n\t * storage root's target followed by its fields' targets and indexes. IEC names are\n\t * case-insensitive. Undefined for one that names nothing the manifest knows.\n\t */\n\tconst fromTarget = (expression: string): string | undefined => {\n\t\tconst upper = expression.trim().toUpperCase();\n\t\tconst whole = targets.get(upper);\n\t\tif (whole) {\n\t\t\treturn whole;\n\t\t}\n\t\tconst root = manifest.roots\n\t\t\t.filter((item) => isWithin(item.target, upper))\n\t\t\t.sort((a, b) => b.target.length - a.target.length)[0];\n\t\tif (!root) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet path = root.path;\n\t\tlet type = root.type;\n\t\tfor (const segment of pathSegments(\n\t\t\texpression.trim().slice(root.target.length).replace(/^\\./, \"\"),\n\t\t)) {\n\t\t\tconst declared = typeOfId(type);\n\t\t\tif (segment.startsWith(\"[\")) {\n\t\t\t\tif (declared.kind !== \"array\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tpath = joinPath(path, segment);\n\t\t\t\ttype = declared.element;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst field =\n\t\t\t\tdeclared.kind === \"record\"\n\t\t\t\t\t? declared.fields.find(\n\t\t\t\t\t\t\t(item) => item.target.toUpperCase() === segment.toUpperCase(),\n\t\t\t\t\t\t)\n\t\t\t\t\t: undefined;\n\t\t\tif (!field) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tpath = joinPath(path, field.name);\n\t\t\ttype = field.type;\n\t\t}\n\t\treturn path;\n\t};\n\tconst targets = new Map<string, string>([\n\t\t...manifest.io.flatMap((io) => [\n\t\t\t[io.target.toUpperCase(), io.path] as const,\n\t\t\t...(io.address ? [[io.address.toUpperCase(), io.path] as const] : []),\n\t\t]),\n\t\t...manifest.roots.map(\n\t\t\t(root) => [root.target.toUpperCase(), root.path] as const,\n\t\t),\n\t]);\n\n\treturn {\n\t\ttypeOf: typeOfId,\n\t\tresolve,\n\t\tchildren,\n\t\tisLeaf,\n\t\texpand,\n\t\tdecode,\n\t\tfromTarget,\n\t};\n};\n\nexport type Paths = ReturnType<typeof createPaths>;\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AA2CO,IAAM,WAAW;AAGjB,IAAM,YAAY,CAAC,SAAiB,KAAK,SAAS,GAAG;AAAA;AAGrD,MAAM,uBAAuB,WAAW;AAAA,EAC9C,WAAW,CAAC,OAAe;AAAA,IAC1B,MAAM,aAAa,oBAAoB;AAAA;AAEzC;AAGO,IAAM,eAAe,CAAC,SAC5B,KACE,MAAM,QAAQ,EACd,QAAQ,CAAC,MAAM,UAAU;AAAA,EACzB,GAAI,QAAQ,IAAI,CAAC,QAAQ,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,QACA,OAAO,SAAS,MAAM,OAAO;AAAA,QAC7B,OAAO,SAAS;AAAA,QAChB;AAAA,MACD;AAAA,MACA,MAAM,QACL,SAAS,SAAS,WACf,SAAS,OAAO,KAChB,CAAC,SAAS,KAAK,OAAO,YAAY,MAAM,QAAQ,YAAY,CAC7D,IACC;AAAA,MACJ,IAAI,CAAC,OAAO;AAAA,QACX;AAAA,MACD;AAAA,MACA,OAAO,SAAS,MAAM,MAAM,IAAI;AAAA,MAChC,OAAO,MAAM;AAAA,IACd;AAAA,IACA,OAAO;AAAA;AAAA,EAER,MAAM,UAAU,IAAI,IAAoB;AAAA,IACvC,GAAG,SAAS,GAAG,QAAQ,CAAC,OAAO;AAAA,MAC9B,CAAC,GAAG,OAAO,YAAY,GAAG,GAAG,IAAI;AAAA,MACjC,GAAI,GAAG,UAAU,CAAC,CAAC,GAAG,QAAQ,YAAY,GAAG,GAAG,IAAI,CAAU,IAAI,CAAC;AAAA,IACpE,CAAC;AAAA,IACD,GAAG,SAAS,MAAM,IACjB,CAAC,SAAS,CAAC,KAAK,OAAO,YAAY,GAAG,KAAK,IAAI,CAChD;AAAA,EACD,CAAC;AAAA,EAED,OAAO;AAAA,IACN,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA;",
|
|
8
|
+
"debugId": "D64654CCB7012F7164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsplc/tmp-debug",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Debugger for tsPLC programs: live TypeScript variables, hardware, async jobs, backend requests and the program's recent telemetry.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rip-technologies/tsplc.git",
|
|
10
|
+
"directory": "packages/debug"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"bun": "./src/index.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./api": {
|
|
19
|
+
"types": "./src/api.ts",
|
|
20
|
+
"bun": "./src/api.ts",
|
|
21
|
+
"default": "./dist/api.js"
|
|
22
|
+
},
|
|
23
|
+
"./manifest": {
|
|
24
|
+
"types": "./src/manifest.ts",
|
|
25
|
+
"bun": "./src/manifest.ts",
|
|
26
|
+
"default": "./dist/manifest.js"
|
|
27
|
+
},
|
|
28
|
+
"./constant": {
|
|
29
|
+
"types": "./src/constant.ts",
|
|
30
|
+
"bun": "./src/constant.ts",
|
|
31
|
+
"default": "./dist/constant.js"
|
|
32
|
+
},
|
|
33
|
+
"./format": {
|
|
34
|
+
"types": "./src/ui/format.ts",
|
|
35
|
+
"bun": "./src/ui/format.ts",
|
|
36
|
+
"default": "./dist/format.js"
|
|
37
|
+
},
|
|
38
|
+
"./explain": {
|
|
39
|
+
"types": "./src/explain.ts",
|
|
40
|
+
"bun": "./src/explain.ts",
|
|
41
|
+
"default": "./dist/explain.js"
|
|
42
|
+
},
|
|
43
|
+
"./explain-file": {
|
|
44
|
+
"types": "./src/explain-file.ts",
|
|
45
|
+
"bun": "./src/explain-file.ts",
|
|
46
|
+
"default": "./dist/explain-file.js"
|
|
47
|
+
},
|
|
48
|
+
"./paths": {
|
|
49
|
+
"types": "./src/paths.ts",
|
|
50
|
+
"bun": "./src/paths.ts",
|
|
51
|
+
"default": "./dist/paths.js"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"src",
|
|
57
|
+
"!**/*.test.ts",
|
|
58
|
+
"!**/*.fixtures.ts",
|
|
59
|
+
"!**/test_*.py",
|
|
60
|
+
"!**/__pycache__/**",
|
|
61
|
+
"!**/*.pyc",
|
|
62
|
+
"!**/tests/**"
|
|
63
|
+
],
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@tsplc/config": "npm:@tsplc/tmp-config@0.6.3",
|
|
69
|
+
"@tsplc/opcua": "npm:@tsplc/tmp-opcua@0.6.3",
|
|
70
|
+
"@tsplc/server": "npm:@tsplc/tmp-server@0.6.3",
|
|
71
|
+
"zod": "4.3.6",
|
|
72
|
+
"@tsplc/iec": "npm:@tsplc/tmp-iec@0.6.3"
|
|
73
|
+
}
|
|
74
|
+
}
|