@tsplc/typegen 0.5.3 → 0.5.4
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/dist/cli.js.map +10 -10
- package/dist/codegen.js.map +1 -1
- package/dist/declarations.js.map +2 -2
- package/dist/hardware.js.map +6 -6
- package/dist/index.js +50 -47
- package/dist/index.js.map +13 -13
- package/package.json +3 -3
- package/src/cli.ts +1 -1
- package/src/codegen/constants.ts +1 -1
- package/src/codegen/declarations.ts +3 -3
- package/src/device-tree.ts +3 -3
- package/src/hardware/channels.ts +2 -2
- package/src/hardware/mapping-types.ts +2 -2
- package/src/hardware/modbus.ts +2 -2
- package/src/hardware/selection.ts +1 -1
- package/src/hardware.ts +10 -13
- package/src/index.ts +14 -14
- package/src/project.ts +4 -4
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "git+https://github.com/rip-technologies/tsplc.git",
|
|
17
17
|
"directory": "packages/typegen"
|
|
18
18
|
},
|
|
19
|
-
"version": "0.5.
|
|
19
|
+
"version": "0.5.4",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"bun": ">=1.4.3"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@tsplc/config": "0.5.
|
|
62
|
+
"@tsplc/config": "0.5.4",
|
|
63
63
|
"prettier": "3.9.10",
|
|
64
64
|
"zod": "4.3.6",
|
|
65
|
-
"@tsplc/iec": "0.5.
|
|
65
|
+
"@tsplc/iec": "0.5.4"
|
|
66
66
|
},
|
|
67
67
|
"bin": {
|
|
68
68
|
"tsplc-typegen": "./dist/cli.js"
|
package/src/cli.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
import { generateTypes } from "./codegen/generate";
|
|
6
|
-
import { generateProject } from "./project
|
|
6
|
+
import { generateProject } from "./project";
|
|
7
7
|
|
|
8
8
|
async function main(): Promise<void> {
|
|
9
9
|
const { values } = parseArgs({
|
package/src/codegen/constants.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
integerRange,
|
|
5
5
|
isIntegerValued,
|
|
6
6
|
} from "@tsplc/iec";
|
|
7
|
-
import type { GlobalList } from "./parser
|
|
7
|
+
import type { GlobalList } from "./parser";
|
|
8
8
|
|
|
9
9
|
// Constants and enum values are emitted as numbers, so they take integer types of 32 bits and under.
|
|
10
10
|
export const isNumberInteger = (name: string) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
import { blockCommentEnd, lineCommentEnd } from "@tsplc/iec/st";
|
|
4
|
-
import { stFiles } from "./generate
|
|
4
|
+
import { stFiles } from "./generate";
|
|
5
5
|
import {
|
|
6
6
|
type Declaration,
|
|
7
7
|
type GlobalList,
|
|
8
8
|
parseDeclarations,
|
|
9
9
|
parseGlobals,
|
|
10
|
-
} from "./parser
|
|
10
|
+
} from "./parser";
|
|
11
11
|
|
|
12
12
|
export type {
|
|
13
13
|
Declaration,
|
|
@@ -15,7 +15,7 @@ export type {
|
|
|
15
15
|
Member,
|
|
16
16
|
SymbolAccess,
|
|
17
17
|
TypeReference,
|
|
18
|
-
} from "./parser
|
|
18
|
+
} from "./parser";
|
|
19
19
|
|
|
20
20
|
/** Where ST code begins at or after `offset`: past whitespace, comments and pragmas. */
|
|
21
21
|
const codeStart = (text: string, offset: number): number => {
|
package/src/device-tree.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import type { DeviceTree, ResolvedTsplcConfig } from "@tsplc/config";
|
|
4
4
|
import { iecName } from "@tsplc/config/build";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
5
|
+
import type { HardwareCatalog } from "./hardware";
|
|
6
|
+
import { edsSections } from "./hardware/eds";
|
|
7
|
+
import { byteOffset } from "./hardware/process-image";
|
|
8
8
|
|
|
9
9
|
const quoted = (value: string) => `"${value.replaceAll('"', '""')}"`;
|
|
10
10
|
|
package/src/hardware/channels.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ioScalarBits } from "@tsplc/iec";
|
|
2
|
-
import type { EdsMember } from "./eds
|
|
3
|
-
import { directAddress } from "./process-image
|
|
2
|
+
import type { EdsMember } from "./eds";
|
|
3
|
+
import { directAddress } from "./process-image";
|
|
4
4
|
|
|
5
5
|
export interface IoChannel {
|
|
6
6
|
device: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// biome-ignore-all lint/suspicious/noTemplateCurlyInString: These strings describe Docker or generated TypeScript interpolation, not JavaScript interpolation here.
|
|
2
2
|
import { ioScalarBits } from "@tsplc/iec";
|
|
3
|
-
import type { HardwareCatalog } from "../hardware
|
|
4
|
-
import { addressSize, ioLayout } from "./process-image
|
|
3
|
+
import type { HardwareCatalog } from "../hardware";
|
|
4
|
+
import { addressSize, ioLayout } from "./process-image";
|
|
5
5
|
|
|
6
6
|
/** A bindable `io` key with its layout; array indexes appear as the literal `${number}`. */
|
|
7
7
|
export interface IoTarget {
|
package/src/hardware/modbus.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// biome-ignore-all lint/style/noNonNullAssertion: Retain existing non-null assertions during the tooling migration; changing their contracts requires a separate review.
|
|
2
|
-
import type { IoChannel } from "./channels
|
|
2
|
+
import type { IoChannel } from "./channels";
|
|
3
3
|
import {
|
|
4
4
|
byteOffset,
|
|
5
5
|
directAddress,
|
|
6
6
|
type ProcessImageRegion,
|
|
7
|
-
} from "./process-image
|
|
7
|
+
} from "./process-image";
|
|
8
8
|
|
|
9
9
|
export interface ModbusRegister {
|
|
10
10
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HardwareDevice } from "@tsplc/config";
|
|
2
|
-
import type { EdsAssembly, EdsConnection, HardwareDescriptor } from "./eds
|
|
2
|
+
import type { EdsAssembly, EdsConnection, HardwareDescriptor } from "./eds";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* An explicit connection must carry the selected assemblies. Otherwise the one
|
package/src/hardware.ts
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
import { readdir, readFile } from "node:fs/promises";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import type { ResolvedTsplcConfig } from "@tsplc/config";
|
|
5
|
-
import { assemblyChannels, type IoChannel } from "./hardware/channels
|
|
5
|
+
import { assemblyChannels, type IoChannel } from "./hardware/channels";
|
|
6
6
|
import {
|
|
7
7
|
type EdsConnection,
|
|
8
8
|
type HardwareDescriptor,
|
|
9
9
|
parseEds,
|
|
10
|
-
} from "./hardware/eds
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./hardware/modbus.ts";
|
|
15
|
-
import { byteOffset, regionPlacer } from "./hardware/process-image.ts";
|
|
16
|
-
import { selectAssemblies, selectConnection } from "./hardware/selection.ts";
|
|
10
|
+
} from "./hardware/eds";
|
|
11
|
+
import { type ModbusRegister, placeModbusRegisters } from "./hardware/modbus";
|
|
12
|
+
import { byteOffset, regionPlacer } from "./hardware/process-image";
|
|
13
|
+
import { selectAssemblies, selectConnection } from "./hardware/selection";
|
|
17
14
|
|
|
18
15
|
export { ioScalarBits } from "@tsplc/iec";
|
|
19
|
-
export type { IoChannel } from "./hardware/channels
|
|
16
|
+
export type { IoChannel } from "./hardware/channels";
|
|
20
17
|
export {
|
|
21
18
|
type EdsAssembly,
|
|
22
19
|
type EdsConnection,
|
|
@@ -26,14 +23,14 @@ export {
|
|
|
26
23
|
type HardwareDescriptor,
|
|
27
24
|
parseEds,
|
|
28
25
|
readEdsRecords,
|
|
29
|
-
} from "./hardware/eds
|
|
26
|
+
} from "./hardware/eds";
|
|
30
27
|
export {
|
|
31
28
|
generateHardwareTypes,
|
|
32
29
|
type IoTarget,
|
|
33
30
|
type ProjectTargets,
|
|
34
|
-
} from "./hardware/mapping-types
|
|
35
|
-
export type { ModbusRegister } from "./hardware/modbus
|
|
36
|
-
export { ioLayout } from "./hardware/process-image
|
|
31
|
+
} from "./hardware/mapping-types";
|
|
32
|
+
export type { ModbusRegister } from "./hardware/modbus";
|
|
33
|
+
export { ioLayout } from "./hardware/process-image";
|
|
37
34
|
|
|
38
35
|
export interface SelectedAssembly {
|
|
39
36
|
direction: "input" | "output";
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export { ioScalarBits } from "@tsplc/iec";
|
|
2
|
-
export { generateTypes } from "./codegen/generate
|
|
3
|
-
export { deviceTree, normalizeEds } from "./device-tree
|
|
4
|
-
export
|
|
2
|
+
export { generateTypes } from "./codegen/generate";
|
|
3
|
+
export { deviceTree, normalizeEds } from "./device-tree";
|
|
4
|
+
export {
|
|
5
|
+
type HardwareCatalog,
|
|
6
|
+
loadHardware,
|
|
7
|
+
resolveIo,
|
|
8
|
+
type SelectedAssembly,
|
|
9
|
+
} from "./hardware";
|
|
10
|
+
export type { IoChannel } from "./hardware/channels";
|
|
5
11
|
export {
|
|
6
12
|
type EdsAssembly,
|
|
7
13
|
type EdsConnection,
|
|
@@ -11,19 +17,13 @@ export {
|
|
|
11
17
|
type HardwareDescriptor,
|
|
12
18
|
parseEds,
|
|
13
19
|
readEdsRecords,
|
|
14
|
-
} from "./hardware/eds
|
|
20
|
+
} from "./hardware/eds";
|
|
15
21
|
export {
|
|
16
22
|
generateHardwareTypes,
|
|
17
23
|
type IoTarget,
|
|
18
24
|
type ProjectTargets,
|
|
19
|
-
} from "./hardware/mapping-types
|
|
20
|
-
export type { ModbusRegister } from "./hardware/modbus
|
|
21
|
-
export { ioLayout } from "./hardware/process-image
|
|
22
|
-
export {
|
|
23
|
-
type HardwareCatalog,
|
|
24
|
-
loadHardware,
|
|
25
|
-
resolveIo,
|
|
26
|
-
type SelectedAssembly,
|
|
27
|
-
} from "./hardware.ts";
|
|
25
|
+
} from "./hardware/mapping-types";
|
|
26
|
+
export type { ModbusRegister } from "./hardware/modbus";
|
|
27
|
+
export { ioLayout } from "./hardware/process-image";
|
|
28
28
|
|
|
29
|
-
export { generatedFiles, generateProject } from "./project
|
|
29
|
+
export { generatedFiles, generateProject } from "./project";
|
package/src/project.ts
CHANGED
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
} from "@tsplc/config/project-files";
|
|
16
16
|
import { format } from "prettier";
|
|
17
17
|
import type { z } from "zod";
|
|
18
|
-
import { declarationFiles } from "./codegen/declarations
|
|
19
|
-
import { generateTypes, stFiles } from "./codegen/generate
|
|
18
|
+
import { declarationFiles } from "./codegen/declarations";
|
|
19
|
+
import { generateTypes, stFiles } from "./codegen/generate";
|
|
20
20
|
import {
|
|
21
21
|
generateHardwareTypes,
|
|
22
22
|
loadHardware,
|
|
23
23
|
type ProjectTargets,
|
|
24
24
|
resolveIo,
|
|
25
|
-
} from "./hardware
|
|
26
|
-
import type { projectSnapshotSchema } from "./project-snapshot
|
|
25
|
+
} from "./hardware";
|
|
26
|
+
import type { projectSnapshotSchema } from "./project-snapshot";
|
|
27
27
|
|
|
28
28
|
// Prettier's format() never reads a Prettier config, so generated files keep Prettier's
|
|
29
29
|
// defaults in whichever repository typegen runs.
|