@tsplc/typegen 0.5.14 → 0.5.15
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 +29 -3
- package/dist/cli.js +574 -424
- package/dist/cli.js.map +21 -16
- package/dist/codegen.js +242 -192
- package/dist/codegen.js.map +8 -6
- package/dist/declarations.js +277 -138
- package/dist/declarations.js.map +8 -7
- package/dist/hardware.js +348 -105
- package/dist/hardware.js.map +13 -10
- package/dist/index.js +617 -459
- package/dist/index.js.map +21 -17
- package/dist/project-snapshot.js +17 -19
- package/dist/project-snapshot.js.map +5 -4
- package/package.json +3 -3
- package/src/cli.ts +25 -33
- package/src/codegen/constants.ts +19 -25
- package/src/codegen/declarations.ts +12 -39
- package/src/codegen/generate.ts +118 -179
- package/src/codegen/parser.ts +121 -63
- package/src/codegen/resolution.ts +68 -0
- package/src/device-tree.ts +14 -97
- package/src/files.ts +40 -0
- package/src/hardware/catalog.ts +49 -0
- package/src/hardware/channels.ts +12 -5
- package/src/hardware/eds.ts +165 -31
- package/src/hardware/mapping-types.ts +58 -21
- package/src/hardware/modbus.ts +42 -28
- package/src/hardware/process-image.ts +57 -24
- package/src/hardware/selection.ts +25 -9
- package/src/hardware.ts +56 -77
- package/src/index.ts +4 -7
- package/src/outputs.ts +50 -0
- package/src/project-snapshot.ts +13 -25
- package/src/project.ts +108 -136
package/README.md
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
# @tsplc/typegen
|
|
2
2
|
|
|
3
|
-
Part of [tsPLC](https://github.com/rip-technologies/tsplc).
|
|
3
|
+
Generates TypeScript from Structured Text declarations and EtherNet/IP EDS files: the PLC contract that `@tsplc/opcua` reads, and the hardware I/O types that check a project's `io`. Part of [tsPLC](https://github.com/rip-technologies/tsplc); in a tsPLC project, `tsplc typegen` runs it.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```sh
|
|
8
|
+
bun add -d @tsplc/typegen
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Without a tsPLC project, generate a contract from declaration directories:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bunx tsplc-typegen --types src/types --globals src/globals --out generated/plc.ts
|
|
17
|
+
bunx tsplc-typegen --types src/types --globals src/globals --out generated/plc.ts --check
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or from code:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { generateTypes } from "@tsplc/typegen";
|
|
24
|
+
|
|
25
|
+
const source = await generateTypes({ types: "src/types", globals: ["src/globals"], publication: null, declarations: true });
|
|
26
|
+
await Bun.write("generated/plc.ts", source);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
[Type generation](https://github.com/rip-technologies/tsplc/blob/master/docs/03-guides/type-generation.md).
|
|
32
|
+
|
|
33
|
+
MIT licensed.
|