behavior-contracts 0.8.9 → 0.8.11
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 +49 -1
- package/cli-contract.yaml +76 -0
- package/dist/cli.js +14 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/codegen.d.ts +5 -3
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +10 -3
- package/dist/commands/codegen.js.map +1 -1
- package/dist/generated/commands.d.ts.map +1 -1
- package/dist/generated/commands.js +16 -0
- package/dist/generated/commands.js.map +1 -1
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +2 -2
- package/dist/generated/contract.js.map +1 -1
- package/dist/generated/program.d.ts +8 -0
- package/dist/generated/program.d.ts.map +1 -1
- package/dist/generated/program.js +8 -0
- package/dist/generated/program.js.map +1 -1
- package/dist/generated/types.d.ts +8 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generator/core.d.ts +33 -1
- package/dist/generator/core.d.ts.map +1 -1
- package/dist/generator/core.js +1 -0
- package/dist/generator/core.js.map +1 -1
- package/dist/generator/emit-shared-go-typed.d.ts +11 -1
- package/dist/generator/emit-shared-go-typed.d.ts.map +1 -1
- package/dist/generator/emit-shared-go-typed.js +26 -3
- package/dist/generator/emit-shared-go-typed.js.map +1 -1
- package/dist/generator/emit-shared-rust-typed.d.ts +11 -1
- package/dist/generator/emit-shared-rust-typed.d.ts.map +1 -1
- package/dist/generator/emit-shared-rust-typed.js +26 -3
- package/dist/generator/emit-shared-rust-typed.js.map +1 -1
- package/dist/generator/emit-straightline-typed-typescript.d.ts.map +1 -1
- package/dist/generator/emit-straightline-typed-typescript.js +55 -7
- package/dist/generator/emit-straightline-typed-typescript.js.map +1 -1
- package/dist/generator/emit-typed-native-go.d.ts +9 -7
- package/dist/generator/emit-typed-native-go.d.ts.map +1 -1
- package/dist/generator/emit-typed-native-go.js +247 -221
- package/dist/generator/emit-typed-native-go.js.map +1 -1
- package/dist/generator/emit-typed-native-rust.d.ts +27 -22
- package/dist/generator/emit-typed-native-rust.d.ts.map +1 -1
- package/dist/generator/emit-typed-native-rust.js +261 -272
- package/dist/generator/emit-typed-native-rust.js.map +1 -1
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -69,6 +69,29 @@ console.log(mod.fingerprint); // IR fingerprint (build-time skew gate)
|
|
|
69
69
|
an unknown language, a non-portable IR, or a shape the target emitter cannot cover
|
|
70
70
|
natively throws rather than degrading silently.
|
|
71
71
|
|
|
72
|
+
### Generate from the CLI
|
|
73
|
+
|
|
74
|
+
The package installs a `bc` binary — codegen over the same public API:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# emit a module to stdout (or write it with --out <file>)
|
|
78
|
+
bc generate --lang go-typed-native --in behaviors.ir.json > behaviors.generated.go
|
|
79
|
+
bc generate --lang rust-typed-native --in behaviors.ir.json --out behaviors.generated.rs
|
|
80
|
+
|
|
81
|
+
# drift check: non-zero exit if the committed --out differs from a fresh generation
|
|
82
|
+
bc check --lang go-typed-native --in behaviors.ir.json --out behaviors.generated.go
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For `go-typed-native`, point the consumer wire seam at a shared Go package with
|
|
86
|
+
`--go-wire-import` (optionally rename the seam types with `--go-wire-value/row/list`):
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bc generate --lang go-typed-native --go-wire-import example.com/pkg/wire --in behaviors.ir.json
|
|
90
|
+
# → the module references wire.WireValue / wire.WireRow / wire.WireList (else unqualified in-package names)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Run `bc generate --help` for the full option reference (also generated at `docs/cli-reference.md`).
|
|
94
|
+
|
|
72
95
|
### Interpret the IR directly
|
|
73
96
|
|
|
74
97
|
```ts
|
|
@@ -78,6 +101,28 @@ import { runBehavior } from "behavior-contracts";
|
|
|
78
101
|
const result = runBehavior(ir, handlers, { userId: "u1" }, "UserReads");
|
|
79
102
|
```
|
|
80
103
|
|
|
104
|
+
## Consuming a typed-native module
|
|
105
|
+
|
|
106
|
+
A `*-typed-native` module is runtime-free and fully typed. bc does not own the wire
|
|
107
|
+
format, so the consumer supplies the concrete **wire seam** that the generated strict
|
|
108
|
+
de-box calls to classify each producer value against the declared type:
|
|
109
|
+
|
|
110
|
+
- **Go** — provide concrete `WireValue` / `WireRow` / `WireList` types (methods
|
|
111
|
+
`AsString`/`AsRow`/…, `ProbeString`/…, `ElemString`/… returning bc's probe structs) and
|
|
112
|
+
a concrete `Handler_<comp>` whose `Node_*` methods return your `WireValue`. Nothing is
|
|
113
|
+
dispatched dynamically (no interface, no generics). Use `--go-wire-import` so the seam
|
|
114
|
+
lives once in a shared package (`Handler_<comp>` stays your in-package type).
|
|
115
|
+
- **Rust** — implement the `WireValue` trait (with associated `WireRow` / `WireList`) on
|
|
116
|
+
your wire type; the runner is generic over your handler and monomorphizes (zero dynamic
|
|
117
|
+
dispatch, zero dictionary).
|
|
118
|
+
|
|
119
|
+
`opt` fields are key-omittable (an absent optional attribute decodes to `None`/null); an
|
|
120
|
+
integer supplied to a `float` slot is widened. A shape whose declared type the emitter
|
|
121
|
+
cannot bake — or an IR whose `outputType` is inconsistent with its node types — is a
|
|
122
|
+
generation-time error (`GeneratorFailure`), never silently-broken code. See
|
|
123
|
+
[`docs/strict-typing-and-debox.md`](../docs/strict-typing-and-debox.md) for the full
|
|
124
|
+
typing + de-box contract.
|
|
125
|
+
|
|
81
126
|
## Public primitives
|
|
82
127
|
|
|
83
128
|
The shared runtime also exposes the individual COMMON primitives piecewise:
|
|
@@ -106,7 +151,10 @@ library (semver) version:
|
|
|
106
151
|
| template | 1 |
|
|
107
152
|
| plan | 1 |
|
|
108
153
|
| canonical | 2 |
|
|
109
|
-
| behavior |
|
|
154
|
+
| behavior | 5 |
|
|
155
|
+
| guard | 3 |
|
|
156
|
+
| c2 | 1 |
|
|
157
|
+
| provenance | 1 |
|
|
110
158
|
| envelope | 1.1 |
|
|
111
159
|
|
|
112
160
|
## License
|
package/cli-contract.yaml
CHANGED
|
@@ -93,6 +93,44 @@ command_sets:
|
|
|
93
93
|
schema:
|
|
94
94
|
type: string
|
|
95
95
|
|
|
96
|
+
- name: go-wire-import
|
|
97
|
+
required: false
|
|
98
|
+
description: >-
|
|
99
|
+
(--lang go-typed-native only) Go package path the consumer's wire
|
|
100
|
+
seam types live in; when set, the covered module imports it and
|
|
101
|
+
qualifies the seam type names (e.g. WireValue → <pkg>.WireValue).
|
|
102
|
+
Ignored by other emitters.
|
|
103
|
+
value_name: spec
|
|
104
|
+
schema:
|
|
105
|
+
type: string
|
|
106
|
+
|
|
107
|
+
- name: go-wire-value
|
|
108
|
+
required: false
|
|
109
|
+
description: >-
|
|
110
|
+
(--lang go-typed-native only) Name of the consumer's WireValue seam
|
|
111
|
+
type. Default WireValue. Ignored by other emitters.
|
|
112
|
+
value_name: name
|
|
113
|
+
schema:
|
|
114
|
+
type: string
|
|
115
|
+
|
|
116
|
+
- name: go-wire-row
|
|
117
|
+
required: false
|
|
118
|
+
description: >-
|
|
119
|
+
(--lang go-typed-native only) Name of the consumer's WireRow seam
|
|
120
|
+
type. Default WireRow. Ignored by other emitters.
|
|
121
|
+
value_name: name
|
|
122
|
+
schema:
|
|
123
|
+
type: string
|
|
124
|
+
|
|
125
|
+
- name: go-wire-list
|
|
126
|
+
required: false
|
|
127
|
+
description: >-
|
|
128
|
+
(--lang go-typed-native only) Name of the consumer's WireList seam
|
|
129
|
+
type. Default WireList. Ignored by other emitters.
|
|
130
|
+
value_name: name
|
|
131
|
+
schema:
|
|
132
|
+
type: string
|
|
133
|
+
|
|
96
134
|
exits:
|
|
97
135
|
'0':
|
|
98
136
|
description: Module generated (written to --out, or printed to stdout).
|
|
@@ -166,6 +204,44 @@ command_sets:
|
|
|
166
204
|
schema:
|
|
167
205
|
type: string
|
|
168
206
|
|
|
207
|
+
- name: go-wire-import
|
|
208
|
+
required: false
|
|
209
|
+
description: >-
|
|
210
|
+
(--lang go-typed-native only) Go package path the consumer's wire
|
|
211
|
+
seam types live in; when set, the covered module imports it and
|
|
212
|
+
qualifies the seam type names (e.g. WireValue → <pkg>.WireValue).
|
|
213
|
+
Ignored by other emitters.
|
|
214
|
+
value_name: spec
|
|
215
|
+
schema:
|
|
216
|
+
type: string
|
|
217
|
+
|
|
218
|
+
- name: go-wire-value
|
|
219
|
+
required: false
|
|
220
|
+
description: >-
|
|
221
|
+
(--lang go-typed-native only) Name of the consumer's WireValue seam
|
|
222
|
+
type. Default WireValue. Ignored by other emitters.
|
|
223
|
+
value_name: name
|
|
224
|
+
schema:
|
|
225
|
+
type: string
|
|
226
|
+
|
|
227
|
+
- name: go-wire-row
|
|
228
|
+
required: false
|
|
229
|
+
description: >-
|
|
230
|
+
(--lang go-typed-native only) Name of the consumer's WireRow seam
|
|
231
|
+
type. Default WireRow. Ignored by other emitters.
|
|
232
|
+
value_name: name
|
|
233
|
+
schema:
|
|
234
|
+
type: string
|
|
235
|
+
|
|
236
|
+
- name: go-wire-list
|
|
237
|
+
required: false
|
|
238
|
+
description: >-
|
|
239
|
+
(--lang go-typed-native only) Name of the consumer's WireList seam
|
|
240
|
+
type. Default WireList. Ignored by other emitters.
|
|
241
|
+
value_name: name
|
|
242
|
+
schema:
|
|
243
|
+
type: string
|
|
244
|
+
|
|
169
245
|
exits:
|
|
170
246
|
'0':
|
|
171
247
|
description: Up to date — the committed --out matches a fresh generation.
|
package/dist/cli.js
CHANGED
|
@@ -32,8 +32,21 @@ function generateOrExit(opts) {
|
|
|
32
32
|
process.stderr.write("bc: --in <ir-doc.json> is required\n");
|
|
33
33
|
process.exit(2);
|
|
34
34
|
}
|
|
35
|
+
// Build the go-typed-native wire seam option only when a go-wire-* flag is present; absent → leave
|
|
36
|
+
// undefined so the emitter applies its in-package default names (unqualified WireValue/WireRow/WireList).
|
|
37
|
+
const goWire = opts.goWireImport !== undefined ||
|
|
38
|
+
opts.goWireValue !== undefined ||
|
|
39
|
+
opts.goWireRow !== undefined ||
|
|
40
|
+
opts.goWireList !== undefined
|
|
41
|
+
? {
|
|
42
|
+
value: opts.goWireValue ?? "WireValue",
|
|
43
|
+
row: opts.goWireRow ?? "WireRow",
|
|
44
|
+
list: opts.goWireList ?? "WireList",
|
|
45
|
+
...(opts.goWireImport !== undefined ? { import: opts.goWireImport } : {}),
|
|
46
|
+
}
|
|
47
|
+
: undefined;
|
|
35
48
|
try {
|
|
36
|
-
return generateFromDoc(readDoc(opts.in), opts.lang, opts.runtimeImport);
|
|
49
|
+
return generateFromDoc(readDoc(opts.in), opts.lang, opts.runtimeImport, goWire);
|
|
37
50
|
}
|
|
38
51
|
catch (e) {
|
|
39
52
|
process.stderr.write(`bc: ${e instanceof Error ? e.message : String(e)}\n`);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+EAA+E;AAC/E,uEAAuE;AACvE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,sCAAsC;AACtC,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,EAAE;AACF,wEAAwE;AACxE,+FAA+F;AAC/F,EAAE;AACF,gGAAgG;AAChG,8DAA8D;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAwB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,C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pB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,SAAiB,CAAC;QACtB,IAAI,CAAC;YACH,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sBAAsB,IAAI,CAAC,GAAG,+CAA+C,CAC9E,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,eAAe,IAAI,CAAC,GAAG,kDAAkD;gBACvE,sBAAsB,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,GAAG,IAAI,CACxE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;CACF,CAAC;AAEF,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type ComponentGraphIRDoc } from "../index.js";
|
|
2
|
-
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
3
|
-
|
|
1
|
+
import { type ComponentGraphIRDoc, type GenerateOptions } from "../index.js";
|
|
2
|
+
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
3
|
+
* `goWire` (go-typed-native only) is forwarded verbatim to the emitter option of the same
|
|
4
|
+
* name; other emitters ignore it. Omitted → the emitter's in-package default seam names. */
|
|
5
|
+
export declare function generateFromDoc(doc: ComponentGraphIRDoc, language: string, runtimeImport?: string, goWire?: GenerateOptions["goWire"]): string;
|
|
4
6
|
/** Read + parse a serialized ComponentGraphIRDoc from disk. */
|
|
5
7
|
export declare function readDoc(inPath: string): ComponentGraphIRDoc;
|
|
6
8
|
//# sourceMappingURL=codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB;;4FAE4F;AAC5F,wBAAgB,eAAe,CAC7B,GAAG,EAAE,mBAAmB,EACxB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,GACjC,MAAM,CAYR;AAED,+DAA+D;AAC/D,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAY3D"}
|
package/dist/commands/codegen.js
CHANGED
|
@@ -11,13 +11,20 @@
|
|
|
11
11
|
// ════════════════════════════════════════════════════════════════════════════
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
13
|
import { loadCompiledIR, generateModule, registeredLanguages, } from "../index.js";
|
|
14
|
-
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
15
|
-
|
|
14
|
+
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
15
|
+
* `goWire` (go-typed-native only) is forwarded verbatim to the emitter option of the same
|
|
16
|
+
* name; other emitters ignore it. Omitted → the emitter's in-package default seam names. */
|
|
17
|
+
export function generateFromDoc(doc, language, runtimeImport, goWire) {
|
|
16
18
|
if (!registeredLanguages().includes(language)) {
|
|
17
19
|
throw new Error(`--lang '${language}' is not a registered emitter (registered: ${registeredLanguages().join(", ")})`);
|
|
18
20
|
}
|
|
19
21
|
const compiled = loadCompiledIR(doc); // adopt the unbranded doc (recomputes + mints the provenance token)
|
|
20
|
-
const
|
|
22
|
+
const options = { language };
|
|
23
|
+
if (runtimeImport !== undefined)
|
|
24
|
+
options.runtimeImport = runtimeImport;
|
|
25
|
+
if (goWire !== undefined)
|
|
26
|
+
options.goWire = goWire;
|
|
27
|
+
const module = generateModule(compiled, options);
|
|
21
28
|
return module.code;
|
|
22
29
|
}
|
|
23
30
|
/** Read + parse a serialized ComponentGraphIRDoc from disk. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,sEAAsE;AACtE,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,
|
|
1
|
+
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,sEAAsE;AACtE,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB;;4FAE4F;AAC5F,MAAM,UAAU,eAAe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"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,GACtD,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,GACtD,OAAO,CAAC,UAAU,CAAC,CAwBrB;AAED,wBAAsB,OAAO,CAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,YAAY,CAAC,GACnD,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
|
|
@@ -13,6 +13,14 @@ export async function bcGenerate(executable, options) {
|
|
|
13
13
|
cmdArgs.push("--out", String(options.out));
|
|
14
14
|
if (options.runtimeImport !== undefined)
|
|
15
15
|
cmdArgs.push("--runtime-import", String(options.runtimeImport));
|
|
16
|
+
if (options.goWireImport !== undefined)
|
|
17
|
+
cmdArgs.push("--go-wire-import", String(options.goWireImport));
|
|
18
|
+
if (options.goWireValue !== undefined)
|
|
19
|
+
cmdArgs.push("--go-wire-value", String(options.goWireValue));
|
|
20
|
+
if (options.goWireRow !== undefined)
|
|
21
|
+
cmdArgs.push("--go-wire-row", String(options.goWireRow));
|
|
22
|
+
if (options.goWireList !== undefined)
|
|
23
|
+
cmdArgs.push("--go-wire-list", String(options.goWireList));
|
|
16
24
|
}
|
|
17
25
|
try {
|
|
18
26
|
const result = await execFileAsync(executable, cmdArgs);
|
|
@@ -38,6 +46,14 @@ export async function bcCheck(executable, options) {
|
|
|
38
46
|
cmdArgs.push("--out", String(options.out));
|
|
39
47
|
if (options.runtimeImport !== undefined)
|
|
40
48
|
cmdArgs.push("--runtime-import", String(options.runtimeImport));
|
|
49
|
+
if (options.goWireImport !== undefined)
|
|
50
|
+
cmdArgs.push("--go-wire-import", String(options.goWireImport));
|
|
51
|
+
if (options.goWireValue !== undefined)
|
|
52
|
+
cmdArgs.push("--go-wire-value", String(options.goWireValue));
|
|
53
|
+
if (options.goWireRow !== undefined)
|
|
54
|
+
cmdArgs.push("--go-wire-row", String(options.goWireRow));
|
|
55
|
+
if (options.goWireList !== undefined)
|
|
56
|
+
cmdArgs.push("--go-wire-list", String(options.goWireList));
|
|
41
57
|
}
|
|
42
58
|
try {
|
|
43
59
|
const result = await execFileAsync(executable, cmdArgs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQ1C,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,UAAkB,EAClB,OAAuD;IAEvD,MAAM,OAAO,GAAa,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7E,IAAI,OAAO,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AAU,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IACvE,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,GAA0D,CAAC;QACrE,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE;YACtB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE;SACvB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,EAAE,MAAu+R,CAAC;AAEpgS,eAAO,MAAM,iBAAiB,EAAE,MAA2yW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Auto-generated by cli-contracts. Do not edit.
|
|
2
2
|
// Embedded contract for the extract subcommand.
|
|
3
|
-
export const CONTRACT_YAML = "# yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json\ncli_contracts: 0.1.0\n\ninfo:\n title: behavior-contracts CLI\n version: 0.1.0\n description: >-\n bc — the build-time codegen CLI over behavior-contracts' public API.\n Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it\n via loadCompiledIR, and runs the same generateModule the in-process API runs\n to emit a runtime-free native module (data baked as literals). The IR doc is\n a build-time input only; nothing reads it at runtime.\n license:\n name: MIT\n contact:\n name: foo-ogawa\n url: https://github.com/foo-ogawa/behavior-contracts\n\nartifact_slots:\n ir-doc:\n direction: read\n description: Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\n generated-module:\n direction: write\n description: Generated native module source (baked-literal, runtime-free).\n\ncommand_sets:\n bc:\n summary: build-time codegen CLI over behavior-contracts' public API.\n executable: bc\n\n global_options:\n - name: version\n aliases: [V]\n description: Print version and exit.\n schema:\n type: boolean\n\n - name: help\n aliases: [h]\n description: Show help and exit.\n schema:\n type: boolean\n\n commands:\n # ── generate ─────────────────────────────────────────\n generate:\n summary: Emit a native module from a serialized IR doc.\n description: >-\n Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and\n runs generateModule for the --lang emitter. Writes the module source\n to --out if given, else to stdout. Rejects an unregistered --lang.\n usage:\n - bc generate --lang rust-typed-native --in ir-doc.json\n - bc generate --lang go-typed-native --in ir-doc.json --out gen.go\n - bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\n\n options:\n - name: lang\n required: true\n description: >-\n Target emitter (must be a registered language, e.g.\n rust-typed-native, go-typed-native, typescript-typed).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: false\n description: Write the generated module here instead of stdout.\n value_name: file\n schema:\n type: string\n file:\n mode: write\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n exits:\n '0':\n description: Module generated (written to --out, or printed to stdout).\n stdout:\n format: text\n '1':\n description: >-\n Generation failed (unreadable/invalid --in, or --lang is not a\n registered emitter).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects:\n - file_write\n sideEffectNote: >-\n Writes to the filesystem only when --out is specified; otherwise\n output goes to stdout.\n\n # ── check ────────────────────────────────────────────\n check:\n summary: Verify a committed module matches a fresh generation (drift gate).\n description: >-\n Regenerates the module from --in for --lang and byte-compares it\n against the committed --out file. Exits non-zero on drift. This is the\n build's codegen drift gate.\n usage:\n - bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\n\n options:\n - name: lang\n required: true\n description: Target emitter (must be a registered language).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: true\n description: The committed module file to diff a fresh generation against.\n value_name: file\n schema:\n type: string\n file:\n mode: read\n exists: true\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n exits:\n '0':\n description: Up to date — the committed --out matches a fresh generation.\n stdout:\n format: text\n '1':\n description: >-\n Drift detected (--out differs or does not exist), or generation\n failed (unreadable/invalid --in, or unregistered --lang).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects: []\n";
|
|
4
|
-
export const CONTRACT_JSON_STR = "{\n \"cli_contracts\": \"0.1.0\",\n \"info\": {\n \"title\": \"behavior-contracts CLI\",\n \"version\": \"0.1.0\",\n \"description\": \"bc — the build-time codegen CLI over behavior-contracts' public API. Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it via loadCompiledIR, and runs the same generateModule the in-process API runs to emit a runtime-free native module (data baked as literals). The IR doc is a build-time input only; nothing reads it at runtime.\",\n \"license\": {\n \"name\": \"MIT\"\n },\n \"contact\": {\n \"name\": \"foo-ogawa\",\n \"url\": \"https://github.com/foo-ogawa/behavior-contracts\"\n }\n },\n \"artifact_slots\": {\n \"ir-doc\": {\n \"direction\": \"read\",\n \"description\": \"Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\"\n },\n \"generated-module\": {\n \"direction\": \"write\",\n \"description\": \"Generated native module source (baked-literal, runtime-free).\"\n }\n },\n \"command_sets\": {\n \"bc\": {\n \"summary\": \"build-time codegen CLI over behavior-contracts' public API.\",\n \"executable\": \"bc\",\n \"global_options\": [\n {\n \"name\": \"version\",\n \"aliases\": [\n \"V\"\n ],\n \"description\": \"Print version and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n },\n {\n \"name\": \"help\",\n \"aliases\": [\n \"h\"\n ],\n \"description\": \"Show help and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"commands\": {\n \"generate\": {\n \"summary\": \"Emit a native module from a serialized IR doc.\",\n \"description\": \"Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and runs generateModule for the --lang emitter. Writes the module source to --out if given, else to stdout. Rejects an unregistered --lang.\",\n \"usage\": [\n \"bc generate --lang rust-typed-native --in ir-doc.json\",\n \"bc generate --lang go-typed-native --in ir-doc.json --out gen.go\",\n \"bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language, e.g. rust-typed-native, go-typed-native, typescript-typed).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": false,\n \"description\": \"Write the generated module here instead of stdout.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"write\"\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Module generated (written to --out, or printed to stdout).\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Generation failed (unreadable/invalid --in, or --lang is not a registered emitter).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": [\n \"file_write\"\n ],\n \"sideEffectNote\": \"Writes to the filesystem only when --out is specified; otherwise output goes to stdout.\"\n }\n },\n \"check\": {\n \"summary\": \"Verify a committed module matches a fresh generation (drift gate).\",\n \"description\": \"Regenerates the module from --in for --lang and byte-compares it against the committed --out file. Exits non-zero on drift. This is the build's codegen drift gate.\",\n \"usage\": [\n \"bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": true,\n \"description\": \"The committed module file to diff a fresh generation against.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Up to date — the committed --out matches a fresh generation.\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Drift detected (--out differs or does not exist), or generation failed (unreadable/invalid --in, or unregistered --lang).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": []\n }\n }\n }\n }\n }\n}";
|
|
3
|
+
export const CONTRACT_YAML = "# yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json\ncli_contracts: 0.1.0\n\ninfo:\n title: behavior-contracts CLI\n version: 0.1.0\n description: >-\n bc — the build-time codegen CLI over behavior-contracts' public API.\n Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it\n via loadCompiledIR, and runs the same generateModule the in-process API runs\n to emit a runtime-free native module (data baked as literals). The IR doc is\n a build-time input only; nothing reads it at runtime.\n license:\n name: MIT\n contact:\n name: foo-ogawa\n url: https://github.com/foo-ogawa/behavior-contracts\n\nartifact_slots:\n ir-doc:\n direction: read\n description: Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\n generated-module:\n direction: write\n description: Generated native module source (baked-literal, runtime-free).\n\ncommand_sets:\n bc:\n summary: build-time codegen CLI over behavior-contracts' public API.\n executable: bc\n\n global_options:\n - name: version\n aliases: [V]\n description: Print version and exit.\n schema:\n type: boolean\n\n - name: help\n aliases: [h]\n description: Show help and exit.\n schema:\n type: boolean\n\n commands:\n # ── generate ─────────────────────────────────────────\n generate:\n summary: Emit a native module from a serialized IR doc.\n description: >-\n Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and\n runs generateModule for the --lang emitter. Writes the module source\n to --out if given, else to stdout. Rejects an unregistered --lang.\n usage:\n - bc generate --lang rust-typed-native --in ir-doc.json\n - bc generate --lang go-typed-native --in ir-doc.json --out gen.go\n - bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\n\n options:\n - name: lang\n required: true\n description: >-\n Target emitter (must be a registered language, e.g.\n rust-typed-native, go-typed-native, typescript-typed).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: false\n description: Write the generated module here instead of stdout.\n value_name: file\n schema:\n type: string\n file:\n mode: write\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n - name: go-wire-import\n required: false\n description: >-\n (--lang go-typed-native only) Go package path the consumer's wire\n seam types live in; when set, the covered module imports it and\n qualifies the seam type names (e.g. WireValue → <pkg>.WireValue).\n Ignored by other emitters.\n value_name: spec\n schema:\n type: string\n\n - name: go-wire-value\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireValue seam\n type. Default WireValue. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n - name: go-wire-row\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireRow seam\n type. Default WireRow. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n - name: go-wire-list\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireList seam\n type. Default WireList. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n exits:\n '0':\n description: Module generated (written to --out, or printed to stdout).\n stdout:\n format: text\n '1':\n description: >-\n Generation failed (unreadable/invalid --in, or --lang is not a\n registered emitter).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects:\n - file_write\n sideEffectNote: >-\n Writes to the filesystem only when --out is specified; otherwise\n output goes to stdout.\n\n # ── check ────────────────────────────────────────────\n check:\n summary: Verify a committed module matches a fresh generation (drift gate).\n description: >-\n Regenerates the module from --in for --lang and byte-compares it\n against the committed --out file. Exits non-zero on drift. This is the\n build's codegen drift gate.\n usage:\n - bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\n\n options:\n - name: lang\n required: true\n description: Target emitter (must be a registered language).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: true\n description: The committed module file to diff a fresh generation against.\n value_name: file\n schema:\n type: string\n file:\n mode: read\n exists: true\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n - name: go-wire-import\n required: false\n description: >-\n (--lang go-typed-native only) Go package path the consumer's wire\n seam types live in; when set, the covered module imports it and\n qualifies the seam type names (e.g. WireValue → <pkg>.WireValue).\n Ignored by other emitters.\n value_name: spec\n schema:\n type: string\n\n - name: go-wire-value\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireValue seam\n type. Default WireValue. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n - name: go-wire-row\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireRow seam\n type. Default WireRow. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n - name: go-wire-list\n required: false\n description: >-\n (--lang go-typed-native only) Name of the consumer's WireList seam\n type. Default WireList. Ignored by other emitters.\n value_name: name\n schema:\n type: string\n\n exits:\n '0':\n description: Up to date — the committed --out matches a fresh generation.\n stdout:\n format: text\n '1':\n description: >-\n Drift detected (--out differs or does not exist), or generation\n failed (unreadable/invalid --in, or unregistered --lang).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects: []\n";
|
|
4
|
+
export const CONTRACT_JSON_STR = "{\n \"cli_contracts\": \"0.1.0\",\n \"info\": {\n \"title\": \"behavior-contracts CLI\",\n \"version\": \"0.1.0\",\n \"description\": \"bc — the build-time codegen CLI over behavior-contracts' public API. Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it via loadCompiledIR, and runs the same generateModule the in-process API runs to emit a runtime-free native module (data baked as literals). The IR doc is a build-time input only; nothing reads it at runtime.\",\n \"license\": {\n \"name\": \"MIT\"\n },\n \"contact\": {\n \"name\": \"foo-ogawa\",\n \"url\": \"https://github.com/foo-ogawa/behavior-contracts\"\n }\n },\n \"artifact_slots\": {\n \"ir-doc\": {\n \"direction\": \"read\",\n \"description\": \"Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\"\n },\n \"generated-module\": {\n \"direction\": \"write\",\n \"description\": \"Generated native module source (baked-literal, runtime-free).\"\n }\n },\n \"command_sets\": {\n \"bc\": {\n \"summary\": \"build-time codegen CLI over behavior-contracts' public API.\",\n \"executable\": \"bc\",\n \"global_options\": [\n {\n \"name\": \"version\",\n \"aliases\": [\n \"V\"\n ],\n \"description\": \"Print version and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n },\n {\n \"name\": \"help\",\n \"aliases\": [\n \"h\"\n ],\n \"description\": \"Show help and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"commands\": {\n \"generate\": {\n \"summary\": \"Emit a native module from a serialized IR doc.\",\n \"description\": \"Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and runs generateModule for the --lang emitter. Writes the module source to --out if given, else to stdout. Rejects an unregistered --lang.\",\n \"usage\": [\n \"bc generate --lang rust-typed-native --in ir-doc.json\",\n \"bc generate --lang go-typed-native --in ir-doc.json --out gen.go\",\n \"bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language, e.g. rust-typed-native, go-typed-native, typescript-typed).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": false,\n \"description\": \"Write the generated module here instead of stdout.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"write\"\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-value\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-row\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-list\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Module generated (written to --out, or printed to stdout).\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Generation failed (unreadable/invalid --in, or --lang is not a registered emitter).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": [\n \"file_write\"\n ],\n \"sideEffectNote\": \"Writes to the filesystem only when --out is specified; otherwise output goes to stdout.\"\n }\n },\n \"check\": {\n \"summary\": \"Verify a committed module matches a fresh generation (drift gate).\",\n \"description\": \"Regenerates the module from --in for --lang and byte-compares it against the committed --out file. Exits non-zero on drift. This is the build's codegen drift gate.\",\n \"usage\": [\n \"bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": true,\n \"description\": \"The committed module file to diff a fresh generation against.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-value\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-row\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-list\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Up to date — the committed --out matches a fresh generation.\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Drift detected (--out differs or does not exist), or generation failed (unreadable/invalid --in, or unregistered --lang).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": []\n }\n }\n }\n }\n }\n}";
|
|
5
5
|
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,gDAAgD;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAW,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,gDAAgD;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAW,89RAA89R,CAAC;AAEpgS,MAAM,CAAC,MAAM,iBAAiB,GAAW,kyWAAkyW,CAAC"}
|
|
@@ -5,12 +5,20 @@ export interface CommandHandlers {
|
|
|
5
5
|
in?: string;
|
|
6
6
|
out?: string;
|
|
7
7
|
runtimeImport?: string;
|
|
8
|
+
goWireImport?: string;
|
|
9
|
+
goWireValue?: string;
|
|
10
|
+
goWireRow?: string;
|
|
11
|
+
goWireList?: string;
|
|
8
12
|
}, parentOpts: Record<string, unknown>) => Promise<void>;
|
|
9
13
|
check: (options: {
|
|
10
14
|
lang?: string;
|
|
11
15
|
in?: string;
|
|
12
16
|
out?: string;
|
|
13
17
|
runtimeImport?: string;
|
|
18
|
+
goWireImport?: string;
|
|
19
|
+
goWireValue?: string;
|
|
20
|
+
goWireRow?: string;
|
|
21
|
+
goWireList?: string;
|
|
14
22
|
}, parentOpts: Record<string, unknown>) => Promise<void>;
|
|
15
23
|
}
|
|
16
24
|
export declare function createProgram(handlers: CommandHandlers, version: string): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/generated/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/generated/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtO,KAAK,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpO;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,OAAO,CA2HT"}
|
|
@@ -14,6 +14,10 @@ export function createProgram(handlers, version) {
|
|
|
14
14
|
.option("--in <ir-doc.json>", "Path to the serialized ComponentGraphIRDoc JSON file.")
|
|
15
15
|
.option("--out <file>", "Write the generated module here instead of stdout.")
|
|
16
16
|
.option("--runtime-import <spec>", "Override the runtime import specifier baked into the module.")
|
|
17
|
+
.option("--go-wire-import <spec>", "(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.")
|
|
18
|
+
.option("--go-wire-value <name>", "(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.")
|
|
19
|
+
.option("--go-wire-row <name>", "(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.")
|
|
20
|
+
.option("--go-wire-list <name>", "(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.")
|
|
17
21
|
.action(async (opts, cmd) => {
|
|
18
22
|
await handlers.generate(opts, cmd.optsWithGlobals());
|
|
19
23
|
});
|
|
@@ -24,6 +28,10 @@ export function createProgram(handlers, version) {
|
|
|
24
28
|
.option("--in <ir-doc.json>", "Path to the serialized ComponentGraphIRDoc JSON file.")
|
|
25
29
|
.option("--out <file>", "The committed module file to diff a fresh generation against.")
|
|
26
30
|
.option("--runtime-import <spec>", "Override the runtime import specifier baked into the module.")
|
|
31
|
+
.option("--go-wire-import <spec>", "(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.")
|
|
32
|
+
.option("--go-wire-value <name>", "(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.")
|
|
33
|
+
.option("--go-wire-row <name>", "(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.")
|
|
34
|
+
.option("--go-wire-list <name>", "(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.")
|
|
27
35
|
.action(async (opts, cmd) => {
|
|
28
36
|
await handlers.check(opts, cmd.optsWithGlobals());
|
|
29
37
|
});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O,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -3,6 +3,10 @@ export interface GenerateOptions {
|
|
|
3
3
|
in: string;
|
|
4
4
|
out?: string;
|
|
5
5
|
runtimeImport?: string;
|
|
6
|
+
goWireImport?: string;
|
|
7
|
+
goWireValue?: string;
|
|
8
|
+
goWireRow?: string;
|
|
9
|
+
goWireList?: string;
|
|
6
10
|
}
|
|
7
11
|
export type GenerateExitCode = 0 | 1 | 2;
|
|
8
12
|
export type GenerateExitResult = {
|
|
@@ -20,6 +24,10 @@ export interface CheckOptions {
|
|
|
20
24
|
in: string;
|
|
21
25
|
out: string;
|
|
22
26
|
runtimeImport?: string;
|
|
27
|
+
goWireImport?: string;
|
|
28
|
+
goWireValue?: string;
|
|
29
|
+
goWireRow?: string;
|
|
30
|
+
goWireList?: string;
|
|
23
31
|
}
|
|
24
32
|
export type CheckExitCode = 0 | 1 | 2;
|
|
25
33
|
export type CheckExitResult = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/generated/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/generated/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAC5B;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC9B;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAChC;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtC,MAAM,MAAM,eAAe,GACzB;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC9B;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAChC;IAAE,QAAQ,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
package/dist/generator/core.d.ts
CHANGED
|
@@ -31,7 +31,28 @@ export interface GoWireOptions {
|
|
|
31
31
|
list: string;
|
|
32
32
|
import?: string;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* LeafTransportOptions (native codegen) — the op-agnostic leaf TRANSPORT the covered runner calls DIRECTLY
|
|
36
|
+
* at each covered node's execution point. bc no longer generates a per-node handler trait (the spurious
|
|
37
|
+
* indirection whose method count grew with the number of authored behaviors); it resolves each covered
|
|
38
|
+
* leaf (= catalog component) to ONE transport symbol and calls it with the node's port fields spread. The
|
|
39
|
+
* consumer supplies these symbols (litedbmodel = a single `execute_sql`; graphddb = `get_item` / `query` /
|
|
40
|
+
* `batch_get_item`), so consumer transport code is a fixed set of ops, not one method per behavior node.
|
|
41
|
+
* - `symbols` — leaf(=catalog component) name → runtime transport symbol name. A leaf absent from the
|
|
42
|
+
* table resolves to the in-package DEFAULT convention (rust `leaf_<sanitizedComponent>`, go
|
|
43
|
+
* `Leaf_<sanitizedComponent>`).
|
|
44
|
+
* - `import` — the module specifier the transport symbols live in (added to the covered module's import
|
|
45
|
+
* block + used to bring the distinct resolved symbols into scope). Omit → in-package / crate-scope
|
|
46
|
+
* resolution (the covered module emits no `use`/import and the symbols resolve where the module is used).
|
|
47
|
+
* Other emitters (ts / py / php) ignore it.
|
|
48
|
+
*/
|
|
49
|
+
export interface LeafTransportOptions {
|
|
50
|
+
/** leaf(=catalog component)名 → 直呼びする runtime transport シンボル名の表。 */
|
|
51
|
+
symbols: Record<string, string>;
|
|
52
|
+
/** transport シンボルの import 元モジュール指定子(未指定=in-package/crate-scope 既定名を使う)。 */
|
|
53
|
+
import?: string;
|
|
54
|
+
}
|
|
55
|
+
export type GeneratorFailureCode = "INPUT_NOT_PORTABLE_IR" | "UNSUPPORTED_IR_VERSION" | "UNSUPPORTED_EXPR_VERSION" | "EMPTY_IR" | "DUPLICATE_COMPONENT" | "UNKNOWN_LANGUAGE" | "OUTPUT_TYPE_INCONSISTENT" | "UNSUPPORTED_NODE_STRAIGHTLINE";
|
|
35
56
|
export declare class GeneratorFailure extends Error {
|
|
36
57
|
code: GeneratorFailureCode;
|
|
37
58
|
constructor(code: GeneratorFailureCode, message: string);
|
|
@@ -70,6 +91,12 @@ export interface EmitContext {
|
|
|
70
91
|
* 既定名 `WireValue`/`WireRow`/`WireList`。他言語 emitter(ts/py/php/rust)は無視。
|
|
71
92
|
*/
|
|
72
93
|
goWire?: GoWireOptions;
|
|
94
|
+
/**
|
|
95
|
+
* native codegen の op-agnostic leaf transport シンボル表({@link LeafTransportOptions})。covered runner
|
|
96
|
+
* が各 covered node の実行点で直呼びする。未指定なら in-package 既定名(rust `leaf_<comp>` / go
|
|
97
|
+
* `Leaf_<comp>`)。native emitter(rust/go)のみ消費、他(ts/py/php)は無視。
|
|
98
|
+
*/
|
|
99
|
+
leafTransport?: LeafTransportOptions;
|
|
73
100
|
}
|
|
74
101
|
/**
|
|
75
102
|
* emitter ターゲット分類(consumer-interface.md §0/§1・#128/A6)。BC の実行モデルは根本 2 つ:
|
|
@@ -131,6 +158,11 @@ export interface GenerateOptions {
|
|
|
131
158
|
* 既定名 `WireValue`/`WireRow`/`WireList`。他言語 emitter は無視(no-op)。
|
|
132
159
|
*/
|
|
133
160
|
goWire?: GoWireOptions;
|
|
161
|
+
/**
|
|
162
|
+
* native codegen の op-agnostic leaf transport シンボル表({@link LeafTransportOptions})。未指定なら
|
|
163
|
+
* in-package 既定名(rust `leaf_<comp>` / go `Leaf_<comp>`)。native emitter(rust/go)のみ消費。
|
|
164
|
+
*/
|
|
165
|
+
leafTransport?: LeafTransportOptions;
|
|
134
166
|
}
|
|
135
167
|
export interface GeneratedModule {
|
|
136
168
|
/** 生成言語。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/generator/core.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEzF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM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ir, options) {
|
|
|
121
121
|
runtimeImport: options.runtimeImport ?? plugin.defaultRuntimeImport,
|
|
122
122
|
ioModel: options.ioModel ?? "sync",
|
|
123
123
|
goWire: options.goWire,
|
|
124
|
+
leafTransport: options.leafTransport,
|
|
124
125
|
};
|
|
125
126
|
return {
|
|
126
127
|
language: plugin.language,
|