@tsplc/compiler 0.2.16 → 0.2.18

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.
Files changed (157) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +920 -943
  3. package/dist/cli.js.map +13 -10
  4. package/dist/codesys.js +3893 -3352
  5. package/dist/codesys.js.map +29 -20
  6. package/dist/elaborate-capture.js +33 -17
  7. package/dist/elaborate-capture.js.map +3 -3
  8. package/dist/index.js +8787 -6855
  9. package/dist/index.js.map +40 -20
  10. package/dist/ir.js +1575 -1072
  11. package/dist/ir.js.map +21 -17
  12. package/dist/math.js.map +2 -2
  13. package/dist/project.js +154 -60
  14. package/dist/project.js.map +5 -5
  15. package/dist/telemetry.js +27 -9
  16. package/dist/telemetry.js.map +5 -5
  17. package/package.json +112 -112
  18. package/src/codesys/config.ts +50 -0
  19. package/src/codesys/debug.ts +670 -0
  20. package/src/codesys/emit.ts +142 -0
  21. package/src/codesys/engineering.ts +109 -0
  22. package/src/codesys/expressions.ts +92 -0
  23. package/src/codesys/global-lists.ts +250 -0
  24. package/src/codesys/global-names.ts +68 -0
  25. package/src/codesys/http.ts +890 -0
  26. package/src/codesys/index.ts +30 -0
  27. package/src/codesys/instrumentation.ts +430 -0
  28. package/src/codesys/io-paths.ts +140 -0
  29. package/src/codesys/manifest.ts +643 -0
  30. package/src/codesys/names.ts +81 -0
  31. package/src/codesys/numeric.ts +409 -0
  32. package/src/codesys/operands.ts +62 -0
  33. package/src/codesys/plan.ts +605 -0
  34. package/src/codesys/programs.ts +53 -0
  35. package/src/codesys/publication.ts +171 -0
  36. package/src/codesys/routines.ts +603 -0
  37. package/src/codesys/sources.ts +71 -0
  38. package/src/codesys/st-files.ts +115 -0
  39. package/src/codesys/storage.ts +97 -0
  40. package/src/codesys/symbols.ts +220 -0
  41. package/src/codesys/task-access.ts +320 -0
  42. package/src/codesys/telemetry.ts +732 -0
  43. package/src/codesys/types.ts +250 -0
  44. package/src/codesys/vendor.ts +150 -0
  45. package/src/frontend/analyzer.ts +794 -0
  46. package/src/frontend/async.ts +317 -1137
  47. package/src/frontend/blocks.ts +537 -403
  48. package/src/frontend/configuration.ts +176 -144
  49. package/src/frontend/const-functions.ts +183 -148
  50. package/src/frontend/cooperative.ts +73 -43
  51. package/src/frontend/coroutines.ts +1032 -0
  52. package/src/frontend/elaborate/calls.ts +535 -0
  53. package/src/frontend/elaborate/capture.ts +157 -101
  54. package/src/frontend/elaborate/dialect.ts +257 -0
  55. package/src/frontend/elaborate/expressions.ts +992 -0
  56. package/src/frontend/elaborate/frame.ts +53 -0
  57. package/src/frontend/elaborate/graph.ts +116 -71
  58. package/src/frontend/elaborate/imports.ts +70 -0
  59. package/src/frontend/elaborate/index.ts +435 -331
  60. package/src/frontend/elaborate/initializers.ts +198 -0
  61. package/src/frontend/elaborate/layouts.ts +591 -384
  62. package/src/frontend/elaborate/model.ts +264 -169
  63. package/src/frontend/elaborate/specialize.ts +343 -2586
  64. package/src/frontend/elaborate/statements.ts +606 -0
  65. package/src/frontend/elaborate/storage.ts +546 -0
  66. package/src/frontend/elaborate/values.ts +58 -0
  67. package/src/frontend/elaborate/writes.ts +100 -0
  68. package/src/frontend/exposure.ts +172 -140
  69. package/src/frontend/expressions.ts +1383 -0
  70. package/src/frontend/intrinsics.ts +337 -0
  71. package/src/frontend/module-graph.ts +89 -59
  72. package/src/frontend/positions.ts +271 -200
  73. package/src/frontend/promise-chains.ts +897 -0
  74. package/src/frontend/promises.ts +390 -747
  75. package/src/frontend/routines.ts +181 -0
  76. package/src/frontend/sdk.ts +82 -0
  77. package/src/frontend/services.ts +506 -372
  78. package/src/frontend/statements.ts +855 -0
  79. package/src/frontend/tasks.ts +471 -0
  80. package/src/frontend/telemetry.ts +174 -0
  81. package/src/frontend/types.ts +845 -551
  82. package/src/frontend/typescript.ts +323 -2543
  83. package/src/index.ts +5 -5
  84. package/src/ir/aggregates.ts +275 -0
  85. package/src/ir/allocation.ts +84 -0
  86. package/src/ir/core-model.ts +146 -0
  87. package/src/ir/declarations.ts +295 -0
  88. package/src/ir/diagnostics.ts +61 -0
  89. package/src/ir/domains.ts +152 -0
  90. package/src/ir/fold.ts +342 -0
  91. package/src/ir/index.ts +90 -0
  92. package/{ir/errors.ts → src/ir/job-errors.ts} +12 -10
  93. package/src/ir/layouts.ts +181 -0
  94. package/src/ir/link.ts +354 -0
  95. package/src/ir/model.ts +386 -0
  96. package/{ir → src/ir}/normalization-error.ts +4 -4
  97. package/src/ir/normalize.ts +70 -0
  98. package/src/ir/numeric.ts +171 -0
  99. package/src/ir/ranges.ts +256 -0
  100. package/src/ir/routine.ts +1163 -0
  101. package/src/ir/scalars.ts +321 -0
  102. package/src/ir/types.ts +127 -0
  103. package/src/project/artifacts.ts +342 -0
  104. package/src/project/cli.ts +177 -0
  105. package/src/project/debugger.ts +82 -0
  106. package/src/project/index.ts +6 -0
  107. package/src/project/plant.ts +467 -0
  108. package/src/project/project-commands.ts +372 -0
  109. package/src/project/project.ts +457 -0
  110. package/src/project/release.ts +153 -0
  111. package/src/project/server.ts +150 -0
  112. package/src/project/terminal.ts +32 -0
  113. package/stdlib/math.ts +14 -10
  114. package/stdlib/telemetry.ts +71 -47
  115. package/types/async.d.ts +46 -40
  116. package/types/data-types.d.ts +26 -26
  117. package/types/globals.d.ts +41 -38
  118. package/types/index.d.ts +96 -51
  119. package/types/plc.d.ts +3 -4
  120. package/types/telemetry.d.ts +14 -14
  121. package/backends/codesys/config.ts +0 -54
  122. package/backends/codesys/debug.ts +0 -509
  123. package/backends/codesys/emit.ts +0 -1738
  124. package/backends/codesys/engineering.ts +0 -88
  125. package/backends/codesys/global-names.ts +0 -49
  126. package/backends/codesys/http.ts +0 -675
  127. package/backends/codesys/index.ts +0 -13
  128. package/backends/codesys/io-paths.ts +0 -105
  129. package/backends/codesys/manifest.ts +0 -312
  130. package/backends/codesys/names.ts +0 -76
  131. package/backends/codesys/numeric.ts +0 -356
  132. package/backends/codesys/plan.ts +0 -457
  133. package/backends/codesys/publication.ts +0 -59
  134. package/backends/codesys/storage.ts +0 -70
  135. package/backends/codesys/task-access.ts +0 -293
  136. package/backends/codesys/telemetry.ts +0 -593
  137. package/backends/codesys/types.ts +0 -179
  138. package/backends/codesys/vendor.ts +0 -108
  139. package/ir/aggregates.ts +0 -333
  140. package/ir/allocation.ts +0 -74
  141. package/ir/core-model.ts +0 -129
  142. package/ir/core.ts +0 -64
  143. package/ir/declarations.ts +0 -208
  144. package/ir/diagnostics.ts +0 -43
  145. package/ir/domains.ts +0 -96
  146. package/ir/index.ts +0 -8
  147. package/ir/link.ts +0 -185
  148. package/ir/model.ts +0 -346
  149. package/ir/routine.ts +0 -859
  150. package/ir/scalars.ts +0 -675
  151. package/ir/types.ts +0 -76
  152. package/project/artifacts.ts +0 -277
  153. package/project/cli.ts +0 -395
  154. package/project/index.ts +0 -1
  155. package/project/plant.ts +0 -509
  156. package/project/project.ts +0 -358
  157. package/project/server.ts +0 -113
@@ -1,675 +0,0 @@
1
- import type { CoreFunctionBlock, GeneratedObject, PlcType } from "@tsplc/compiler/ir";
2
- import type { HttpOptions } from "@tsplc/config";
3
- import type { CodesysTypes } from "./types.ts";
4
-
5
- export const opcuaServiceCapacity = 16;
6
-
7
- export interface HttpEndpoint {
8
- transport?: "http" | "opcua";
9
- host: string;
10
- port: number;
11
- authority: string;
12
- path: string;
13
- token: string;
14
- timeoutMs: number;
15
- tls: boolean;
16
- }
17
- export const resolveHttpEndpoint = (value: string, input: HttpOptions): HttpEndpoint => {
18
- const url = new URL(value);
19
- if (
20
- !["http:", "https:"].includes(url.protocol) ||
21
- url.username ||
22
- url.password ||
23
- url.hash ||
24
- url.hostname.includes(":")
25
- )
26
- throw new Error(
27
- "fetch requires an HTTP(S) URL with an IPv4 address or DNS hostname, without credentials or fragment.",
28
- );
29
- if (
30
- (url.pathname + url.search).length > 2048 ||
31
- url.hostname.length > 253 ||
32
- Number(url.port || (url.protocol === "https:" ? 443 : 80)) === 0
33
- )
34
- throw new Error("HTTP URL exceeds the native host/path limits or has an invalid port.");
35
- let token = "";
36
- const origins = new Set<string>();
37
- for (const credential of input.credentials) {
38
- const configured = process.env[credential.originEnv],
39
- secret = process.env[credential.bearerTokenEnv];
40
- if (!configured || !secret)
41
- throw new Error(
42
- `HTTP credentials require ${credential.originEnv} and ${credential.bearerTokenEnv}.`,
43
- );
44
- const origin = new URL(configured);
45
- if (
46
- !["http:", "https:"].includes(origin.protocol) ||
47
- origin.username ||
48
- origin.password ||
49
- origin.pathname !== "/" ||
50
- origin.search ||
51
- origin.hash
52
- )
53
- throw new Error(
54
- `HTTP credential origin ${credential.originEnv} must contain only a scheme, host and port.`,
55
- );
56
- if (origins.has(origin.origin)) throw new Error("HTTP credential origins must be unique.");
57
- origins.add(origin.origin);
58
- if (/[\r\n\0]/.test(secret) || secret.length > 512)
59
- throw new Error(`Invalid bearer token in ${credential.bearerTokenEnv}.`);
60
- if (origin.origin === url.origin) token = secret;
61
- }
62
- return {
63
- host: url.hostname,
64
- port: Number(url.port || (url.protocol === "https:" ? 443 : 80)),
65
- authority: url.host,
66
- path: url.pathname + url.search,
67
- token,
68
- timeoutMs: input.timeoutMs,
69
- tls: url.protocol === "https:",
70
- };
71
- };
72
- const escapes: Record<string, string> = { $: "$$", "'": "$'", "\r": "$R", "\n": "$N" };
73
- /** An ST string literal. */
74
- export const quote = (text: string) =>
75
- `'${text.replace(/[$'\r\n]/g, (character) => escapes[character]!)}'`;
76
-
77
- /**
78
- * The ST that appends a BOOL, integer, bit string or UTF-8 STRING `value` as JSON with the
79
- * encoder methods of `httpMethods`, and the most bytes it can append.
80
- */
81
- export const jsonScalar = (
82
- type: PlcType,
83
- value: string,
84
- ): { code: string; size: number } | undefined => {
85
- if (type.kind === "string" && type.encoding === "utf8" && type.capacity <= 2048)
86
- return { code: `WriteString(${value});`, size: type.capacity * 6 + 2 };
87
- if (type.kind === "bool")
88
- return { code: `IF ${value} THEN Append('true'); ELSE Append('false'); END_IF;`, size: 5 };
89
- if (type.kind === "bits") {
90
- const wide = type.bits <= 32 ? "UDINT" : "ULINT";
91
- return {
92
- code: `Append(${wide}_TO_STRING(TO_${wide}(${value})));`,
93
- size: String(2n ** BigInt(type.bits) - 1n).length,
94
- };
95
- }
96
- if (type.kind === "integer") {
97
- const bits = BigInt(type.bits);
98
- return {
99
- code: `Append(${type.id}_TO_STRING(${value}));`,
100
- size: String(type.signed ? -(2n ** (bits - 1n)) : 2n ** bits - 1n).length,
101
- };
102
- }
103
- return undefined;
104
- };
105
-
106
- const httpLayouts = (block: CoreFunctionBlock, types: ReadonlyMap<string, PlcType>) => {
107
- const request = block.inputs.find((v) => v.name === "request"),
108
- response = block.outputs.find((v) => v.name === "result");
109
- if (!request || !response) throw new Error("Missing HTTP record ports.");
110
- const requestLayout = types.get(request.type),
111
- responseLayout = types.get(response.type);
112
- if (
113
- requestLayout?.kind !== "record" ||
114
- responseLayout?.kind !== "record" ||
115
- responseLayout.fields.length === 0 ||
116
- responseLayout.fields.length > 31
117
- )
118
- throw new Error("HTTP requires closed request/response records with 1..31 response fields.");
119
- const scalarSize = (id: string): number => {
120
- const type = types.get(id);
121
- if (type?.kind === "enum")
122
- return Math.max(...type.members.map((member) => member.value.length));
123
- const scalar =
124
- type && !((type.kind === "integer" || type.kind === "bits") && type.bits > 32)
125
- ? jsonScalar(type, "")
126
- : undefined;
127
- if (!scalar)
128
- throw new Error(
129
- "HTTP JSON supports bounded UTF-8 strings, BOOL, enums, and integers up to 32 bits.",
130
- );
131
- return scalar.size;
132
- };
133
- const recordSize = (record: typeof requestLayout, response: boolean) =>
134
- 2 +
135
- record.fields.reduce((size, field) => {
136
- const type = types.get(field.type);
137
- const valueSize =
138
- type?.kind === "array" && !response
139
- ? 2 + type.length * (scalarSize(type.element) + 1)
140
- : scalarSize(field.type);
141
- return size + field.name.length + 4 + valueSize;
142
- }, 0);
143
- if (recordSize(requestLayout, false) > 2048 || recordSize(responseLayout, true) > 2048)
144
- throw new Error(
145
- "The worst-case HTTP JSON payload exceeds the native 2048-byte buffer; reduce record/string/array bounds.",
146
- );
147
- return { request, response, requestLayout, responseLayout };
148
- };
149
- export const validateHttpLayout = (
150
- block: CoreFunctionBlock,
151
- types: ReadonlyMap<string, PlcType>,
152
- ): void => {
153
- httpLayouts(block, types);
154
- };
155
-
156
- /** Native transport and typed JSON codecs; no application protocol lives here. */
157
- export const emitHttp = (
158
- block: CoreFunctionBlock,
159
- name: string,
160
- fields: ReadonlyMap<string, string>,
161
- types: ReadonlyMap<string, PlcType>,
162
- target: CodesysTypes,
163
- endpoint: HttpEndpoint,
164
- network: string,
165
- rpcGlobal?: string,
166
- /** The requesting job's id input and this block's request counter, sent as `x-tsplc-request`. */
167
- trace?: { job: string; sequence: string },
168
- ): GeneratedObject => {
169
- const port = (label: string) => {
170
- const variable = [...block.inputs, ...block.outputs].find((v) => v.name === label);
171
- if (!variable) throw new Error("Missing HTTP port " + label);
172
- return fields.get(variable.id)!;
173
- };
174
- const { request, response, requestLayout, responseLayout } = httpLayouts(block, types);
175
- const encode = (typeId: string, value: string): string => {
176
- const type = types.get(typeId)!;
177
- if (type.kind === "array")
178
- return Array.from(
179
- { length: type.length },
180
- (_, i) =>
181
- `${i ? "Append(',');" : ""}${encode(type.element, `${value}[${i + type.lowerBound}]`)}`,
182
- ).join("\n");
183
- if (type.kind === "enum") return `Append(DINT_TO_STRING(TO_DINT(${value})));`;
184
- const scalar = jsonScalar(type, value);
185
- if (scalar) return scalar.code;
186
- throw new Error(
187
- "HTTP JSON supports bounded UTF-8 strings, BOOL, enums, integers up to 32 bits and fixed arrays.",
188
- );
189
- };
190
- const requestCode = requestLayout.fields
191
- .map((field, i) => {
192
- const type = types.get(field.type)!,
193
- value = `${port("request")}.${target.field(request.type, field.name)}`;
194
- return `Append(${quote((i ? "," : "") + '"' + field.name + '":')});${type.kind === "array" ? "Append('[');" : ""}${encode(field.type, value)}${type.kind === "array" ? "Append(']');" : ""}`;
195
- })
196
- .join("\n");
197
- const responseCode = responseLayout.fields
198
- .map((field, i) => {
199
- const type = types.get(field.type)!,
200
- value = `${port("result")}.${target.field(response.type, field.name)}`;
201
- let decode: string;
202
- if (type.kind === "string" && type.encoding === "utf8" && type.capacity <= 2048)
203
- decode = `ReadString(); IF ByteLength(token) > ${type.capacity} THEN malformed := TRUE; ELSE ${value} := token; END_IF;`;
204
- else if (type.kind === "bool")
205
- decode = `IF MatchLiteral('true') THEN ${value}:=TRUE; ELSIF MatchLiteral('false') THEN ${value}:=FALSE; ELSE malformed:=TRUE;END_IF;`;
206
- else if (
207
- ((type.kind === "integer" || type.kind === "bits") && type.bits <= 32) ||
208
- type.kind === "enum"
209
- ) {
210
- const signed = type.kind === "enum" || (type.kind === "integer" && type.signed),
211
- bits = type.kind === "enum" ? 32 : type.bits;
212
- const min = signed ? -(2 ** (bits - 1)) : 0,
213
- max = signed ? 2 ** (bits - 1) - 1 : 2 ** bits - 1;
214
- decode = `ReadInteger(); IF numberValue < ${min} OR numberValue > ${max} THEN malformed:=TRUE; ELSE `;
215
- if (type.kind === "enum")
216
- decode += `CASE numberValue OF ${type.members.map((m) => `${m.value}: ${value}:=${target.name(field.type)}.${target.field(field.type, m.name)};`).join(" ")} ELSE malformed:=TRUE; END_CASE;`;
217
- else decode += `${value}:=TO_${target.name(field.type)}(numberValue);`;
218
- decode += " END_IF;";
219
- } else throw new Error("HTTP responses currently require flat scalar records.");
220
- return `${i === 0 ? "IF" : "ELSIF"} part = ${quote(field.name)} THEN IF (seen AND SHL(DWORD#1,${i})) <> 0 THEN malformed:=TRUE; END_IF; seen:=seen OR SHL(DWORD#1,${i}); ${decode}`;
221
- })
222
- .join("\n");
223
- const inputs = block.inputs
224
- .map((v) => `${fields.get(v.id)} : ${target.name(v.type)};`)
225
- .join("\n");
226
- const outputs = block.outputs
227
- .map((v) => `${fields.get(v.id)} : ${target.name(v.type)};`)
228
- .join("\n");
229
- const decodeResponse = `cursor:=1;malformed:=FALSE;seen:=0;
230
- SkipWhitespace();Expect(123);SkipWhitespace();
231
- WHILE cursor<=TO_UINT(ByteLength(payload)) AND NOT malformed DO
232
- IF payload[cursor-1]=125 THEN cursor:=cursor+1;EXIT;END_IF;
233
- ReadString();part:=token;SkipWhitespace();Expect(58);SkipWhitespace();
234
- ${responseCode} ELSE malformed:=TRUE;END_IF;
235
- SkipWhitespace();
236
- IF payload[cursor-1]=44 THEN cursor:=cursor+1;SkipWhitespace();IF payload[cursor-1]=125 THEN malformed:=TRUE;END_IF;
237
- ELSIF payload[cursor-1]<>125 THEN malformed:=TRUE;END_IF;
238
- END_WHILE;
239
- SkipWhitespace();
240
- IF malformed OR cursor<>TO_UINT(ByteLength(payload))+1 OR seen<>DWORD#${2 ** responseLayout.fields.length - 1} THEN ${port("error")}:=4;END_IF;`;
241
- if (endpoint.transport === "opcua") {
242
- if (!rpcGlobal) throw new Error("Missing OPC UA RPC global.");
243
- const channel = (field: string, index = "slotIndex") => `${rpcGlobal}.${field}[${index}]`;
244
- return {
245
- id: block.id,
246
- kind: "functionBlock",
247
- name,
248
- declaration: `FUNCTION_BLOCK ${name}
249
- VAR_INPUT ${inputs} END_VAR
250
- VAR_OUTPUT ${outputs} END_VAR
251
- VAR
252
- timeout:TON;stage:UINT;slotIndex:UINT;candidate:UINT;
253
- identity:STRING(64);epoch:STRING(32);prefix:STRING(80);
254
- payload:STRING(2048);token:STRING(2048);part:STRING(2048);
255
- cursor:UINT;malformed:BOOL;seen:DWORD;numberValue:LINT;tokenUsed:UINT;
256
- END_VAR`,
257
- implementation: `IF NOT ${port("start")} OR ${port("cancel")} THEN
258
- IF slotIndex>0 THEN ${channel("requestIds")}:='';${channel("requests")}:='';${channel("inUse")}:=0;END_IF;
259
- slotIndex:=0;stage:=0;timeout(IN:=FALSE);${port("busy")}:=FALSE;${port("done")}:=FALSE;${port("error")}:=0;RETURN;
260
- END_IF;
261
- IF stage=0 THEN
262
- FOR candidate:=1 TO ${opcuaServiceCapacity} DO
263
- (* __COMPARE_AND_SWAP can fail spuriously on ARM64; retry while the slot reads free. *)
264
- WHILE slotIndex=0 AND ${channel("epochs", "candidate")}<>'' AND ${channel("inUse", "candidate")}=0 DO
265
- IF __COMPARE_AND_SWAP(ADR(${channel("inUse", "candidate")}),0,1) THEN slotIndex:=candidate;END_IF;
266
- END_WHILE;
267
- IF slotIndex>0 THEN EXIT;END_IF;
268
- END_FOR;
269
- IF slotIndex=0 THEN ${port("error")}:=7;stage:=90;
270
- ELSE
271
- ${channel("sequence")}:=${channel("sequence")}+1;
272
- IF ${channel("sequence")}=0 THEN ${channel("epochs")}:='';${port("error")}:=5;stage:=90;
273
- ELSE
274
- epoch:=${channel("epochs")};identity:=CONCAT(CONCAT(epoch,':'),UDINT_TO_STRING(${channel("sequence")}));
275
- prefix:=CONCAT(identity,'|');payload:='';malformed:=FALSE;
276
- Append('{');${requestCode}Append('}');
277
- IF malformed THEN ${port("error")}:=3;stage:=90;
278
- ELSIF ByteLength(payload)+LEN(prefix)>2048 THEN ${port("error")}:=3;stage:=90;
279
- ELSE
280
- FOR candidate:=0 TO LEN(prefix)-1 DO ${channel("requests")}[candidate]:=prefix[candidate];END_FOR;
281
- FOR candidate:=0 TO ByteLength(payload)-1 DO ${channel("requests")}[candidate+LEN(prefix)]:=payload[candidate];END_FOR;
282
- ${channel("requests")}[ByteLength(payload)+LEN(prefix)]:=0;${channel("requestIds")}:=identity;stage:=1;
283
- END_IF;
284
- END_IF;
285
- END_IF;
286
- END_IF;
287
- timeout(IN:=stage<90,PT:=T#${endpoint.timeoutMs}ms);
288
- IF timeout.Q THEN ${port("error")}:=2;stage:=90;END_IF;
289
- IF stage=1 THEN
290
- IF ${channel("epochs")}<>epoch THEN ${port("error")}:=5;stage:=90;
291
- ELSIF ${channel("replyIds")}=identity AND_THEN LEFT(${channel("replies")},LEN(prefix))=prefix THEN
292
- payload:='';cursor:=LEN(prefix);
293
- IF ByteLength(${channel("replies")})<cursor+4 THEN ${port("error")}:=4;
294
- ELSIF ${channel("replies")}[cursor]<>48 OR ${channel("replies")}[cursor+1]<>124 THEN ${port("error")}:=5;
295
- ELSE
296
- FOR candidate:=cursor+2 TO ByteLength(${channel("replies")})-1 DO payload[candidate-cursor-2]:=${channel("replies")}[candidate];END_FOR;
297
- payload[ByteLength(${channel("replies")})-cursor-2]:=0;
298
- ${decodeResponse}
299
- END_IF;
300
- stage:=90;
301
- END_IF;
302
- END_IF;
303
- ${port("busy")}:=stage<90;
304
- IF stage=90 THEN
305
- IF slotIndex>0 THEN ${channel("requestIds")}:='';${channel("requests")}:='';${channel("inUse")}:=0;slotIndex:=0;END_IF;
306
- timeout(IN:=FALSE);${port("busy")}:=FALSE;${port("done")}:=TRUE;
307
- END_IF;`,
308
- };
309
- }
310
- return nativeHttp({
311
- id: block.id,
312
- name,
313
- ports: `VAR_INPUT
314
- ${inputs}${trace ? `\n${trace.job} : UDINT;` : ""}
315
- END_VAR
316
- VAR_OUTPUT
317
- ${outputs}
318
- END_VAR`,
319
- port,
320
- endpoint,
321
- network,
322
- method: block.runtime?.kind === "http" ? block.runtime.method : "GET",
323
- json: block.runtime?.kind === "http" && block.runtime.json,
324
- body:
325
- block.runtime?.kind === "http" && block.runtime.json
326
- ? `Append('{'); ${requestCode} Append('}');`
327
- : "",
328
- decode: decodeResponse,
329
- ...(trace && { trace }),
330
- });
331
- };
332
-
333
- /**
334
- * A native HTTP/1.1 client block over Net Base Services: it sends what `body` appends to
335
- * `payload` and, on a 2xx response, runs `decode` over the response body in `payload`.
336
- */
337
- export const nativeHttp = ({
338
- id,
339
- name,
340
- ports,
341
- port,
342
- endpoint,
343
- network,
344
- method,
345
- json,
346
- body,
347
- decode,
348
- trace,
349
- }: {
350
- id: string;
351
- name: string;
352
- /** Its input and output declarations, with `start`, `cancel`, `busy`, `done` and `error`. */
353
- ports: string;
354
- port: (label: string) => string;
355
- endpoint: HttpEndpoint;
356
- network: string;
357
- method: string;
358
- json: boolean;
359
- body: string;
360
- decode: string;
361
- /** The requesting job's id input and this block's request counter, sent as `x-tsplc-request`. */
362
- trace?: { job: string; sequence: string };
363
- }): GeneratedObject => {
364
- const requestHeader = trace
365
- ? `AppendWire(UDINT_TO_STRING(${trace.job}));AppendWire(':');AppendWire(UDINT_TO_STRING(${trace.sequence}));AppendWire('$R$NContent-Length: ');`
366
- : "";
367
- // Helpers are emitted as native methods under the HTTP block by the emitter.
368
- return {
369
- id,
370
- kind: "functionBlock",
371
- name,
372
- declaration: `FUNCTION_BLOCK ${name}
373
- ${ports}
374
- VAR
375
- remoteAddress : NBS.IPv4Address;
376
- remoteIP : NBS.IIPAddress := remoteAddress;
377
- resolver : NBS.ResolveHostname := (itfAsyncProperty:=${network});
378
- ${endpoint.tls ? `certificateVerifier : ${name}_CertificateVerifier;\n tlsContext : NBS.TLSContext := (itfCertVerifer:=certificateVerifier,sUseCaseName:='tsPLC HTTPS',ePurpose:=NBS.PURPOSE.CLIENT_SIDE,sTLSVersion:='1.2',sHostname:=${quote(endpoint.host)},udiVerificationMode:=2);` : ""}
379
- client : NBS.TCP_Client := (itfAsyncProperty:=${network},itfIPAddress:=remoteAddress,uiPort:=${endpoint.port},udiTimeOut:=${endpoint.timeoutMs * 1000}${endpoint.tls ? ",itfTLSContext:=tlsContext" : ""});
380
- writer : NBS.TCP_Write;
381
- reader : NBS.TCP_Read;
382
- timeout : TON;
383
- stage : UINT;
384
- wire : STRING(8192);
385
- received : STRING(8192);
386
- chunk : ARRAY[0..8191] OF BYTE;
387
- payload : STRING(2048);
388
- token : STRING(2048);
389
- part : STRING(2048);
390
- used : UINT;
391
- headerEnd : UINT;
392
- contentLength : DINT;
393
- status : UINT;
394
- cursor : UINT;
395
- malformed : BOOL;
396
- seen : DWORD;
397
- numberValue : LINT;
398
- wireUsed : UINT;
399
- tokenUsed : UINT;
400
- index : UINT;${trace ? `\n ${trace.sequence} : UDINT;` : ""}
401
- END_VAR
402
- `,
403
- // The host goes in the resolver call, not an initial value: an online change keeps the values
404
- // an instance already holds, so a changed host would otherwise wait for a download.
405
- implementation: `IF NOT ${port("start")} OR ${port("cancel")} THEN
406
- resolver(xExecute:=FALSE,itfIPAddress:=remoteIP);client(xEnable:=FALSE); writer(xExecute:=FALSE); reader(xEnable:=FALSE); timeout(IN:=FALSE);
407
- stage:=0; ${port("busy")}:=FALSE; ${port("done")}:=FALSE; ${port("error")}:=0;
408
- RETURN;
409
- END_IF;
410
- IF stage=0 THEN
411
- payload:=''; malformed:=FALSE; used:=0; received:='';${trace ? `\n ${trace.sequence}:=${trace.sequence}+1;` : ""}
412
- ${body}
413
- IF malformed THEN ${port("error")}:=3; stage:=90;
414
- ELSE
415
- wire:='';wireUsed:=0;
416
- AppendWire(${quote(method + " " + endpoint.path + " HTTP/1.1\r\nHost: " + endpoint.authority + "\r\n" + (endpoint.token ? "Authorization: Bearer " + endpoint.token + "\r\n" : "") + (json ? "Content-Type: application/json\r\n" : "") + "Accept: application/json\r\nConnection: close\r\n" + (trace ? "x-tsplc-request: " : "Content-Length: "))});${requestHeader}
417
- AppendWire(UINT_TO_STRING(ByteLength(payload)));AppendWire('$R$N$R$N');AppendWire(payload); stage:=10;
418
- END_IF;
419
- END_IF;
420
- timeout(IN:=stage<90,PT:=T#${endpoint.timeoutMs}ms);
421
- IF timeout.Q THEN ${port("error")}:=2; stage:=90; END_IF;
422
- ${port("busy")}:=stage<90;
423
- IF stage=10 THEN
424
- resolver(xExecute:=TRUE,sHostname:=${quote(endpoint.host)},itfIPAddress:=remoteIP);
425
- IF resolver.xError THEN ${port("error")}:=5;stage:=90;ELSIF resolver.xDone THEN stage:=1;END_IF;
426
- END_IF;
427
- IF stage=1 THEN
428
- client(xEnable:=TRUE);
429
- IF client.xError THEN ${port("error")}:=${endpoint.tls ? 6 : 5};stage:=90; ELSIF client.xActive THEN stage:=2;END_IF;
430
- END_IF;
431
- IF stage=2 THEN
432
- writer(xExecute:=TRUE,itfConnection:=client.itfConnection,pData:=ADR(wire),udiSize:=UINT_TO_UDINT(wireUsed));
433
- IF writer.xError THEN ${port("error")}:=5;stage:=90;ELSIF writer.xDone THEN stage:=3;END_IF;
434
- END_IF;
435
- IF stage=3 THEN
436
- IF used>=8191 THEN ${port("error")}:=3;stage:=90;
437
- ELSE
438
- reader(xEnable:=TRUE,itfConnection:=client.itfConnection,pData:=ADR(chunk),udiSize:=8191);
439
- IF reader.xError THEN ${port("error")}:=5;stage:=90;
440
- ELSIF reader.xReady AND reader.udiCount>0 THEN
441
- IF TO_UDINT(used)+reader.udiCount>8191 THEN ${port("error")}:=3;stage:=90;
442
- ELSE
443
- FOR index:=0 TO TO_UINT(reader.udiCount)-1 DO received[used+index]:=chunk[index];END_FOR;
444
- used:=used+TO_UINT(reader.udiCount);received[used]:=0;
445
- FindHeaders();
446
- IF headerEnd=0 AND used>4096 THEN ${port("error")}:=3;stage:=90;END_IF;
447
- IF headerEnd>0 THEN
448
- IF headerEnd>4096 THEN ${port("error")}:=3;stage:=90;
449
- ELSE
450
- ReadHeaders();
451
- IF malformed OR contentLength<0 OR contentLength>2048 THEN ${port("error")}:=3;stage:=90;
452
- ELSIF TO_DINT(used)>=TO_DINT(headerEnd)+3+contentLength THEN
453
- IF status<200 OR status>=300 THEN ${port("error")}:=10000+status;stage:=90;
454
- ELSE
455
- payload:='';IF contentLength>0 THEN FOR index:=0 TO TO_UINT(contentLength)-1 DO payload[index]:=received[headerEnd+3+index]; END_FOR;END_IF;payload[TO_UINT(contentLength)]:=0; ${decode}
456
- stage:=90;
457
- END_IF;
458
- END_IF;
459
- END_IF;
460
- END_IF;
461
- END_IF;
462
- END_IF;
463
- END_IF;
464
- END_IF;
465
- IF stage=90 THEN
466
- resolver(xExecute:=FALSE,itfIPAddress:=remoteIP);client(xEnable:=FALSE);writer(xExecute:=FALSE);reader(xEnable:=FALSE);timeout(IN:=FALSE);
467
- ${port("busy")}:=FALSE;${port("done")}:=TRUE;
468
- END_IF;
469
- `,
470
- };
471
- };
472
-
473
- export const httpCertificateVerifier = (
474
- owner: string,
475
- name: string,
476
- endpoint: HttpEndpoint,
477
- ): GeneratedObject[] => {
478
- if (!endpoint.tls) return [];
479
- const id = `${owner}:certificateVerifier`;
480
- // NBS represents certificate handles as pointers; verification keeps the native trust result.
481
- const ipv4 = /^\d+\.\d+\.\d+\.\d+$/.test(endpoint.host);
482
- return [
483
- {
484
- id,
485
- kind: "functionBlock",
486
- name: `${name}_CertificateVerifier`,
487
- declaration: `FUNCTION_BLOCK ${name}_CertificateVerifier IMPLEMENTS NBS.ICertificateVerifier
488
- VAR
489
- hostname:STRING(255):=${quote(endpoint.host)};
490
- ${ipv4 ? `address:ARRAY[0..3] OF BYTE := [${endpoint.host.split(".").join(",")}];` : ""}
491
- END_VAR`,
492
- implementation: "",
493
- },
494
- {
495
- id: `${id}:VerifyCertificate`,
496
- parent: id,
497
- kind: "method",
498
- name: "VerifyCertificate",
499
- declaration: `METHOD PUBLIC VerifyCertificate : UDINT
500
- VAR_INPUT hCert:POINTER TO BYTE;eCurState:UDINT;END_VAR
501
- VAR matched:BOOL;result:UDINT;END_VAR`,
502
- implementation: `VerifyCertificate:=eCurState;
503
- IF eCurState<>0 THEN RETURN;END_IF;
504
- matched:=CmpX509Cert_Implementation.${ipv4 ? "X509CertCheckIP(hCert,ADR(address),0,ADR(result))" : "X509CertCheckHost(hCert,ADR(hostname),4,ADR(result))"};
505
- IF result<>0 THEN VerifyCertificate:=result;ELSIF NOT matched THEN VerifyCertificate:=1;END_IF;`,
506
- },
507
- ];
508
- };
509
-
510
- export const httpMethods = (
511
- owner: string,
512
- transport: "http" | "opcua" = "http",
513
- ): GeneratedObject[] => {
514
- const method = (
515
- name: string,
516
- declaration: string,
517
- implementation: string,
518
- result?: string,
519
- ): GeneratedObject => ({
520
- id: `${owner}:${name}`,
521
- parent: owner,
522
- kind: "method",
523
- name,
524
- declaration: `METHOD PRIVATE ${name}${result ? ` : ${result}` : ""}\n${declaration}`,
525
- implementation,
526
- });
527
- return [
528
- // Standard string helpers accept STRING(255); native buffers must retain their full byte length.
529
- method(
530
- "ByteLength",
531
- "VAR_INPUT value:STRING(8192);END_VAR\nVAR i:UINT;END_VAR",
532
- "ByteLength:=0;FOR i:=0 TO 8191 DO IF value[i]=0 THEN ByteLength:=i;RETURN;END_IF;END_FOR;ByteLength:=8192;",
533
- "UINT",
534
- ),
535
- method(
536
- "Append",
537
- "VAR_INPUT value : STRING(2048); END_VAR\nVAR offset:UINT;i:UINT;END_VAR",
538
- `offset:=TO_UINT(ByteLength(payload));IF offset+TO_UINT(ByteLength(value))>2048 THEN malformed:=TRUE; ELSE IF ByteLength(value)>0 THEN FOR i:=0 TO TO_UINT(ByteLength(value))-1 DO payload[offset+i]:=value[i];END_FOR;END_IF;payload[offset+TO_UINT(ByteLength(value))]:=0;END_IF;`,
539
- ),
540
- method(
541
- "AppendWire",
542
- "VAR_INPUT value:STRING(8192);END_VAR\nVAR i:UINT;END_VAR",
543
- `IF wireUsed+TO_UINT(ByteLength(value))>8191 THEN malformed:=TRUE;RETURN;END_IF;IF ByteLength(value)>0 THEN FOR i:=0 TO TO_UINT(ByteLength(value))-1 DO wire[wireUsed+i]:=value[i];END_FOR;END_IF;wireUsed:=wireUsed+TO_UINT(ByteLength(value));wire[wireUsed]:=0;`,
544
- ),
545
- method(
546
- "FindHeaders",
547
- "VAR i:UINT;END_VAR",
548
- `headerEnd:=0;IF used<4 THEN RETURN;END_IF;
549
- FOR i:=0 TO used-4 DO IF received[i]=13 AND received[i+1]=10 AND received[i+2]=13 AND received[i+3]=10 THEN headerEnd:=i+1;RETURN;END_IF;END_FOR;`,
550
- ),
551
- method(
552
- "MatchLiteral",
553
- "VAR_INPUT value:STRING(8);END_VAR\nVAR i:UINT;size:UINT;END_VAR",
554
- `MatchLiteral:=FALSE;size:=TO_UINT(ByteLength(value));IF cursor+size-1>TO_UINT(ByteLength(payload)) THEN RETURN;END_IF;
555
- FOR i:=0 TO size-1 DO IF payload[cursor-1+i]<>value[i] THEN RETURN;END_IF;END_FOR;cursor:=cursor+size;MatchLiteral:=TRUE;`,
556
- "BOOL",
557
- ),
558
- method(
559
- "ReadHeaders",
560
- `VAR lineStart:UINT;lineEnd:UINT;i:UINT;j:UINT;key:STRING(64);octet:BYTE;found:BOOL;digits:UINT;END_VAR`,
561
- `malformed:=FALSE;found:=FALSE;contentLength:=-1;
562
- IF LEFT(received,9)<>'HTTP/1.1 ' AND LEFT(received,9)<>'HTTP/1.0 ' THEN malformed:=TRUE;RETURN;END_IF;
563
- status:=0;FOR i:=9 TO 11 DO IF received[i]<48 OR received[i]>57 THEN malformed:=TRUE;RETURN;END_IF;status:=status*10+TO_UINT(received[i]-48);END_FOR;
564
- lineStart:=1;
565
- WHILE lineStart<headerEnd DO
566
- lineEnd:=lineStart;WHILE lineEnd<headerEnd AND received[lineEnd-1]<>13 DO lineEnd:=lineEnd+1;END_WHILE;
567
- key:='';j:=0;i:=lineStart;
568
- WHILE i<lineEnd AND received[i-1]<>58 AND j<63 DO octet:=received[i-1];IF octet>=65 AND octet<=90 THEN octet:=octet+32;END_IF;key[j]:=octet;j:=j+1;i:=i+1;END_WHILE;key[j]:=0;
569
- IF key='transfer-encoding' THEN malformed:=TRUE;RETURN;END_IF;
570
- IF key='content-length' THEN
571
- IF found THEN malformed:=TRUE;RETURN;END_IF;found:=TRUE;contentLength:=0;digits:=0;i:=i+1;
572
- WHILE i<lineEnd AND received[i-1]=32 DO i:=i+1;END_WHILE;
573
- WHILE i<lineEnd DO octet:=received[i-1];IF octet<48 OR octet>57 OR digits>=5 THEN malformed:=TRUE;RETURN;END_IF;contentLength:=contentLength*10+TO_DINT(octet-48);digits:=digits+1;i:=i+1;END_WHILE;
574
- IF digits=0 THEN malformed:=TRUE;RETURN;END_IF;
575
- END_IF;
576
- lineStart:=lineEnd+2;
577
- END_WHILE;`,
578
- ),
579
- method(
580
- "WriteString",
581
- `VAR_INPUT value : STRING(2048); END_VAR\nVAR i:UINT; one:STRING(1); hex:STRING(16):='0123456789abcdef'; END_VAR`,
582
- `Append('"');IF ByteLength(value)>0 THEN FOR i:=0 TO ByteLength(value)-1 DO
583
- one[0]:=value[i];one[1]:=0;
584
- IF value[i]=34 OR value[i]=92 THEN Append('\\');Append(one);
585
- ELSIF value[i]<32 THEN Append('\\u00');one[0]:=hex[SHR(value[i],4)];Append(one);one[0]:=hex[value[i] AND 15];Append(one);
586
- ELSE Append(one);END_IF;
587
- END_FOR;END_IF;Append('"');`,
588
- ),
589
- method(
590
- "SkipWhitespace",
591
- "",
592
- `WHILE cursor<=TO_UINT(ByteLength(payload)) DO IF payload[cursor-1]<>32 AND payload[cursor-1]<>9 AND payload[cursor-1]<>10 AND payload[cursor-1]<>13 THEN EXIT;END_IF;cursor:=cursor+1;END_WHILE;`,
593
- ),
594
- method(
595
- "Expect",
596
- "VAR_INPUT value:BYTE; END_VAR",
597
- `IF cursor>TO_UINT(ByteLength(payload)) OR_ELSE payload[cursor-1]<>value THEN malformed:=TRUE;ELSE cursor:=cursor+1;END_IF;`,
598
- ),
599
- method(
600
- "TokenByte",
601
- "VAR_INPUT value:BYTE;END_VAR",
602
- `IF tokenUsed>=2048 OR value=0 THEN malformed:=TRUE;RETURN;END_IF;token[tokenUsed]:=value;tokenUsed:=tokenUsed+1;token[tokenUsed]:=0;`,
603
- ),
604
- method(
605
- "ReadHex",
606
- "VAR value:UDINT;i:UINT;octet:BYTE;END_VAR",
607
- `numberValue:=0;FOR i:=1 TO 4 DO
608
- IF cursor>TO_UINT(ByteLength(payload)) THEN malformed:=TRUE;RETURN;END_IF;
609
- octet:=payload[cursor-1];cursor:=cursor+1;
610
- IF octet>=48 AND octet<=57 THEN value:=TO_UDINT(octet-48);ELSIF octet>=65 AND octet<=70 THEN value:=TO_UDINT(octet-55);ELSIF octet>=97 AND octet<=102 THEN value:=TO_UDINT(octet-87);ELSE malformed:=TRUE;RETURN;END_IF;
611
- numberValue:=numberValue*16+TO_LINT(value);END_FOR;`,
612
- ),
613
- method(
614
- "ReadString",
615
- `VAR octet:BYTE;point:UDINT;high:UDINT;END_VAR`,
616
- `token:='';tokenUsed:=0;Expect(34);
617
- WHILE cursor<=TO_UINT(ByteLength(payload)) AND NOT malformed DO
618
- octet:=payload[cursor-1];cursor:=cursor+1;
619
- IF octet=34 THEN ValidateUtf8();RETURN;END_IF;
620
- IF octet=92 THEN
621
- IF cursor>TO_UINT(ByteLength(payload)) THEN malformed:=TRUE;RETURN;END_IF;
622
- octet:=payload[cursor-1];cursor:=cursor+1;
623
- CASE octet OF
624
- 34,47,92: TokenByte(octet);
625
- 98:TokenByte(8);102:TokenByte(12);110:TokenByte(10);114:TokenByte(13);116:TokenByte(9);
626
- 117:
627
- ReadHex();point:=TO_UDINT(numberValue);
628
- IF point>=55296 AND point<=56319 THEN
629
- high:=point;Expect(92);Expect(117);ReadHex();
630
- IF numberValue<56320 OR numberValue>57343 THEN malformed:=TRUE;RETURN;END_IF;
631
- point:=65536+(high-55296)*1024+TO_UDINT(numberValue)-56320;
632
- ELSIF point>=56320 AND point<=57343 THEN malformed:=TRUE;RETURN;END_IF;
633
- IF point<128 THEN TokenByte(TO_BYTE(point));
634
- ELSIF point<2048 THEN TokenByte(TO_BYTE(192+SHR(point,6)));TokenByte(TO_BYTE(128+(point AND 63)));
635
- ELSIF point<65536 THEN TokenByte(TO_BYTE(224+SHR(point,12)));TokenByte(TO_BYTE(128+(SHR(point,6) AND 63)));TokenByte(TO_BYTE(128+(point AND 63)));
636
- ELSE TokenByte(TO_BYTE(240+SHR(point,18)));TokenByte(TO_BYTE(128+(SHR(point,12) AND 63)));TokenByte(TO_BYTE(128+(SHR(point,6) AND 63)));TokenByte(TO_BYTE(128+(point AND 63)));END_IF;
637
- ELSE malformed:=TRUE;RETURN;
638
- END_CASE;
639
- ELSIF octet<32 THEN malformed:=TRUE;RETURN;ELSE TokenByte(octet);END_IF;
640
- END_WHILE;malformed:=TRUE;`,
641
- ),
642
- method(
643
- "ValidateUtf8",
644
- "VAR i:UINT;j:UINT;count:UINT;first:BYTE;next:BYTE;END_VAR",
645
- `i:=0;
646
- WHILE i<tokenUsed AND NOT malformed DO
647
- first:=token[i];
648
- IF first<128 THEN i:=i+1;
649
- ELSE
650
- IF first>=194 AND first<=223 THEN count:=1;ELSIF first>=224 AND first<=239 THEN count:=2;ELSIF first>=240 AND first<=244 THEN count:=3;ELSE malformed:=TRUE;RETURN;END_IF;
651
- IF i+count>=tokenUsed THEN malformed:=TRUE;RETURN;END_IF;
652
- next:=token[i+1];
653
- IF (first=224 AND next<160) OR (first=237 AND next>=160) OR (first=240 AND next<144) OR (first=244 AND next>=144) THEN malformed:=TRUE;RETURN;END_IF;
654
- FOR j:=1 TO count DO IF token[i+j]<128 OR token[i+j]>191 THEN malformed:=TRUE;RETURN;END_IF;END_FOR;
655
- i:=i+count+1;
656
- END_IF;
657
- END_WHILE;`,
658
- ),
659
- method(
660
- "ReadInteger",
661
- "VAR negative:BOOL;digits:UINT;octet:BYTE;END_VAR",
662
- `numberValue:=0;negative:=FALSE;digits:=0;
663
- IF payload[cursor-1]=45 THEN negative:=TRUE;cursor:=cursor+1;END_IF;
664
- WHILE cursor<=TO_UINT(ByteLength(payload)) DO
665
- octet:=payload[cursor-1];IF octet<48 OR octet>57 THEN EXIT;END_IF;
666
- IF digits>=10 THEN malformed:=TRUE;RETURN;END_IF;
667
- IF digits>0 AND numberValue=0 THEN malformed:=TRUE;RETURN;END_IF;numberValue:=numberValue*10+TO_LINT(octet-48);digits:=digits+1;cursor:=cursor+1;
668
- END_WHILE;
669
- IF digits=0 THEN malformed:=TRUE;END_IF;IF negative THEN numberValue:=-numberValue;END_IF;`,
670
- ),
671
- ].filter(
672
- (item) =>
673
- transport === "http" || !["AppendWire", "FindHeaders", "ReadHeaders"].includes(item.name),
674
- );
675
- };
@@ -1,13 +0,0 @@
1
- export { type CodesysOptions, codesys, direct } from "./config.ts";
2
- export { emitCodesys, type SourceMapping } from "./emit.ts";
3
- export {
4
- buildCodesys,
5
- codesysBuildConfig,
6
- type CodesysEngineeringBuild,
7
- engineeringBuildSchema,
8
- } from "./engineering.ts";
9
- export { type CodesysPlan, type CodesysProject, planCodesys } from "./plan.ts";
10
- export type { ProjectHardware } from "./manifest.ts";
11
- export { diagnoseCodesys } from "./vendor.ts";
12
- export { ioTargets } from "./io-paths.ts";
13
- export { publicationSelectors } from "./publication.ts";