@promptctl/go-template-js 0.10.0 → 0.12.0

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 CHANGED
@@ -24,6 +24,7 @@ Go template syntax + Sprig subset, generic over output type, in TypeScript.
24
24
  - [Syntax and built-ins](#syntax-and-built-ins)
25
25
  - [Sprig subset](#sprig-subset)
26
26
  - [Composing funcs from multiple sources](#composing-funcs-from-multiple-sources)
27
+ - [Rendering a define as a value: `include`](#rendering-a-define-as-a-value-include)
27
28
  - [Divergences from Go](#divergences-from-go)
28
29
  - [Errors](#errors)
29
30
  - [Versioning policy](#versioning-policy)
@@ -84,6 +85,7 @@ interface Frag { color: string; text: string }
84
85
 
85
86
  const engine = createEngine<Frag>({
86
87
  fromString: (s) => ({ color: "default", text: s }),
88
+ isT: (v): v is Frag => typeof v === "object" && v !== null && "color" in v,
87
89
  funcs: {
88
90
  red: {
89
91
  fn: (s: unknown) => ({ color: "red", text: String(s) }),
@@ -103,6 +105,8 @@ tpl.evaluate({ label: "warn", value: "ALERT" });
103
105
  // ]
104
106
  ```
105
107
 
108
+ `isT` tells the engine which values are fragments: an action that yields a T emits it as itself, and an action that yields anything else emits it as Go's `%v` prints it (`map[k:v]`, `[a b]`). It defaults to "is a string", so an engine whose `T` is not a string must declare it, and the `EngineConfig` type requires it.
109
+
106
110
  Functions declare `argTypes` and `arity`, both required. The engine uses `argTypes` to enforce one architectural commitment: **a non-string `T` value will never silently flatten into a `string` parameter**. If you try to pipe a styled fragment into a function declared with `argTypes: ["string"]`, you get a `TypeMismatchError` naming the function, the argument index, and a suggestion to call your `unstyled` (or equivalent) flatten helper.
107
111
 
108
112
  ### Lifting and stringification: the boundary bridges
@@ -112,11 +116,12 @@ Functions declare `argTypes` and `arity`, both required. The engine uses `argTyp
112
116
  | Direction | Bridge | ArgType | Where it runs |
113
117
  | --- | --- | --- | --- |
114
118
  | `string` → `T` | `fromString` (required) | `"liftable"` | a string at a `"liftable"` slot is replaced with `fromString(s)` before the body sees it |
115
- | `T` → `string` | `toString` (optional) | `"stringifiable"` | a non-string at a `"stringifiable"` slot is flattened via `toString` (e.g. `print`, `printf "%s"`) |
119
+ | `T` → `string` | `toString` (optional) | `"stringifiable"` | a T at a `"stringifiable"` slot, at any depth, is flattened via `toString` (e.g. `print`, `printf "%s"`); any other value prints as Go's `%v` |
116
120
 
117
121
  ```ts
118
122
  const engine = createEngine<Frag>({
119
123
  fromString: (s) => ({ color: "default", text: s }),
124
+ isT: (v): v is Frag => typeof v === "object" && v !== null && "color" in v,
120
125
  toString: (frag) => frag.text,
121
126
  });
122
127
  ```
@@ -125,6 +130,34 @@ const engine = createEngine<Frag>({
125
130
 
126
131
  Use `"liftable"` for any consumer-defined function whose slot should accept either a `T` value or a string literal. The body, by contract, only ever receives `T` — the gate owns the lift, so the body has no string-vs-`T` discrimination to do.
127
132
 
133
+ ### Provenance: `marked`, `emitted` and `decided`
134
+
135
+ Some funcs return values that change on their own, such as an animation's `tween` or a clock. The host then needs to know which output depends on them. A number or a string cannot carry that fact, so the engine carries it beside the value. A func marks its call by returning `marked(value, ...tokens)`. The template sees `value` exactly as if it had been returned directly, and the arity is unchanged. Two optional `EngineConfig` hooks then report each token wherever the output depends on it:
136
+
137
+ ```ts
138
+ import { createEngine, marked } from "@promptctl/go-template-js";
139
+
140
+ const engine = createEngine<Frag>({
141
+ fromString: (s) => ({ color: "default", text: s }),
142
+ isT: (v): v is Frag => typeof v === "object" && v !== null && "color" in v,
143
+ funcs: {
144
+ pulse: {
145
+ fn: () => marked(frame.t < 0.5 ? "red" : "blue", { changesAt: 0.5 }),
146
+ argTypes: [],
147
+ arity: { kind: "exact" },
148
+ },
149
+ },
150
+ // Every emitted T, with the marks it depends on; the return is what is output.
151
+ emitted: (frag, marks) => (marks.size === 0 ? frag : { ...frag, holds: [...marks] }),
152
+ // Every if/with/range pipe, with the marks it read, whichever arm runs.
153
+ decided: (marks) => marks.forEach((m) => host.redrawAt(m)),
154
+ });
155
+ ```
156
+
157
+ A mark follows the value into every scope it is bound into: a variable, the dot that `with` and `range` push, the dot a `template` or `block` invocation pushes, and the dot `include` hands its body. Every mark the body reads reaches the result of the `include` call. It then reaches every action that reads any of these. `eq`, `printf`, `default`, sprig maths and every other func pass it through simply by being called on the value. A func that stores anything it was handed, whether in place in an argument (sprig `set` and `unset`) or in a closure or module variable that a later call returns, says so with `writes: true` on its registration. So does a func that runs code it was handed, since that code may store. Where such a write lands is beyond what the engine can follow: an object read later, a fragment already emitted, or your data for the next evaluation. So each call of such a func reports the marks of all its inputs (target and key included, since a marked value can choose where the write goes) through `decided` as it runs. The builtin `call` declares it too, because the function it runs comes from your data and has no registration to say whether it writes. An `if`/`with`/`range` pipe's marks also go to `decided`, including when the arm taken is empty. They also reach every emission inside the arm, and every variable an arm could assign with `=`, whichever arm runs, because that variable's value afterwards depends on the decision. Every report to `decided` also carries the marks of the arms it sits in. The rule is that a mark may be reported early but never late. Tracking is per action, so an emission can carry a mark it did not strictly need. A mark bound somewhere nobody reads, as in `{{ $t := pulse }}still`, is reported nowhere.
158
+
159
+ The engine sees only what flows through arguments and returns, so a store the func does not declare is reported late. Code in your data that runs on a read must not write state the output later reads: getters, Proxy traps, `toJSON` and `toString`. As in Go, a read is a read. Among the builtins, only `call` runs data code as a call; a registered func that does so declares `writes`, as above. An action or control pipe that throws, whether in its pipe, in `fromString`, or in `emitted`, reports what it had read through `decided` before the error propagates, because the error may clear when a mark changes. `marked(...)` must be the func's return value itself. One nested inside a returned object or list is not read where it is returned: there it is opaque, an object with no fields that prints and compares the same at every frame, so the output never varies with it. A func that later returns it on its own, as `index` or `get` does, reads it with its marks, so its value never reaches the output without them. A template operand that is one (`(box).c`) raises an error naming the likely mistake. To build on a marking func from JS, `unmarked(result)` gives back `{ value, marks }` to compute with. Re-mark what you derive from it with `marked(f(value), ...marks)`; a result that drops them reports late. A func whose failure depends on a value that changes throws `marked(error, ...tokens)`, and the throw reports those tokens through `decided`. With neither hook configured, output is unchanged, and so are `referencedCalls()` and the other static facts.
160
+
128
161
  ## `ArgType` reference
129
162
 
130
163
  Every entry in `argTypes` is one of:
@@ -136,13 +169,13 @@ Every entry in `argTypes` is one of:
136
169
  | `"truncating-int"` | finite `number` or safe-integer-range `bigint` — the numeric half of sprig's `cast.ToInt64` read of an `interface{}` parameter (the cast's string/bool/nil conversions are refused); gate truncates toward zero (`max 1.5 2.5` → `2`, as in Go) | `add`, `add1`, `sub`, `mul`, `div`, `mod`, `max`, `min`, sprig's list `slice` |
137
170
  | `"float"` | any `number` (including `NaN`/`±Infinity` — legitimate IEEE-754 floats) or `bigint` whose `Number()` is finite; gate normalizes to `number` via `Number(v)` | `addf`, `subf`, `mulf`, `divf`, `maxf`, `minf` |
138
171
  | `"bool"` | `typeof === "boolean"` | (rare; most boolean slots use `"truthy"`) |
139
- | `"T"` | Any non-primitive (consumer-defined fragment) | consumer-defined typed funcs returning `T` |
172
+ | `"T"` | A value the engine's `isT` accepts (default: a string) | consumer-defined typed funcs returning `T` |
140
173
  | `"ordered"` | `string`, `number`, `bigint`, or `boolean` | `lt`, `le`, `gt`, `ge` — additionally requires both slots share a kind |
141
174
  | `"comparable"` | `"ordered"` ∪ nil ∪ arrays / Maps / Sets / plain objects (deep-equal) | `eq`, `ne` |
142
175
  | `"list"` | `Array.isArray` | `first`, `last`, `rest`, `uniq`, `concat`, `chunk` |
143
176
  | `"dict"` | plain object only (not `Map`, not class instance) | `get`, `keys`, `values`, `pluck`, `merge` |
144
177
  | `"sized"` | `string` ∪ array ∪ `Map` ∪ `Set` ∪ plain object | `len` |
145
- | `"stringifiable"` | `string`, or any value the engine's `toString` can flatten | `print`, `println`, `printf "%s"`, `printf "%q"` |
178
+ | `"stringifiable"` | a value Go's `%v` can print: `string`, nil, a scalar, a T the engine's `toString` flattens, an object with its own `toString`, a class instance (printed as a Go struct, `{alice 30}`), or a list/map of those (a `Set`, a function or a symbol is refused) | `print`, `println`, `printf`, `html`, `js`, `urlquery` |
146
179
  | `"liftable"` | `T`, or `string` (lifted to `T` via the engine's `fromString` before the body runs) | consumer-defined funcs that accept either a `T` fragment or a bare text literal at a slot |
147
180
  | `"callable"` | `typeof === "function"` | `call` (first slot) |
148
181
  | `"collection"` | `string` ∪ array ∪ `Map` ∪ plain object | `index` (receiver slot) |
@@ -244,14 +277,62 @@ const engine = createEngine<string>({
244
277
 
245
278
  Go template's runtime built-ins (the names listed under "Built-in functions" above) are always merged in by `createEngine` itself; you do not register them. A consumer-supplied entry with the same name overrides the built-in.
246
279
 
280
+ ## Rendering a define as a value: `include`
281
+
282
+ `{{ template "name" . }}` writes a define's output straight into the result, where nothing can touch it. `include` is Helm's answer: it renders the define and returns the text as a string, so the output can be piped, tested, defaulted or stored like any other value.
283
+
284
+ ```gotemplate
285
+ {{ define "user" }}{{ .first }} {{ .last }}{{ end }}
286
+ {{ define "badge" }}{{ if .admin }}admin{{ end }}{{ end }}
287
+ {{ define "list" }}{{ range . }}- {{ . }}
288
+ {{ end }}{{ end }}
289
+
290
+ {{ include "user" .owner | upper }}
291
+ {{ include "list" .items | indent 4 }}
292
+ {{ if include "badge" .owner }}<span>{{ include "badge" .owner }}</span>{{ end }}
293
+ {{ include "badge" .owner | default "guest" }}
294
+ {{ $name := include "user" .owner }}
295
+ ```
296
+
297
+ Go's `text/template` has no `include`, so it is not a built-in. Register it like a sprig category, under whatever name you like:
298
+
299
+ ```ts
300
+ import { createEngine, include, sprigDefaults, sprigStrings } from "@promptctl/go-template-js";
301
+
302
+ const engine = createEngine<string>({
303
+ fromString: (s) => s,
304
+ funcs: { ...sprigStrings(), ...sprigDefaults(), include }, // or { partial: include }
305
+ });
306
+ ```
307
+
308
+ It behaves as Helm's `include` does, and the conformance corpus checks it against that implementation in Go (`conformance/fixtures/include-helm-uses`). The one exception is recursion depth: Helm stops a define recursing past 1000 levels, and here the JS host's stack runs out first (see [Divergences from Go](#divergences-from-go)).
309
+
310
+ - The body sees its data argument as both `.` and `$`, never the caller's variables, the same as with `{{ template }}`. With no data to pass, pass `.` or `nil` explicitly.
311
+ - It renders any define it can see, inherited ones included (`engine.parse(src, helpers.defines())`).
312
+ - An undefined name fails at the call with `template "name" is not defined`. An error inside the body fails at the call as `error calling include "name": <what went wrong>`. Its `cause` is the body's own error, with its class and its position in the source that declared the define. A `fail` in the body stays a `FailError`.
313
+ - With a non-string `T`, the body's fragments are flattened through the engine's `toString` and the result is one string. An engine with a non-string `T` and no `toString` fails loudly the first time `include` runs.
314
+ - Provenance carries through: every mark the body read, including those of a decision whose arm emitted nothing, and every mark on the data argument, reach the emission that uses the result.
315
+
316
+ ### Rendering a define by name
317
+
318
+ `template.evaluateDefine(name, scope)` renders one define from a parsed template, as Go's `ExecuteTemplate` does. `scope` is the define's `.` and `$`. Inherited defines can be rendered too. The result is the same `T[]` that `evaluate` returns, and it goes through the same `emitted` and `decided` hooks:
319
+
320
+ ```ts
321
+ const tpl = engine.parse('{{ define "card" }}[{{ .title }}]{{ end }}');
322
+ tpl.evaluateDefine("card", { title: "hi" }).join(""); // "[hi]"
323
+ ```
324
+
325
+ An undefined name is the host's mistake, not the template's: it throws a plain `Error` (not a `TemplateError`) reading `template "name" is not defined`, where Go returns `no template "name" associated with template "..."`. `template.defines().names()` lists, sorted, every name the template can render, inherited ones included. Errors inside the define, a stack overflow included, point into the source that declared it.
326
+
247
327
  ## Divergences from Go
248
328
 
249
329
  The engine matches Go's `text/template` semantics aggressively. The remaining divergences are host-imposed — JavaScript cannot represent the relevant Go type, or the standard libraries differ:
250
330
 
251
331
  - **Numeric typing.** Go has `int`, `float64`, and friends as distinct runtime types; JavaScript has one `number`. The numeric-verb type label reflects JS's view: integer JS numbers report as `int`, fractional as `float64`, `bigint` as `int64`. Non-numeric values into `%d`/`%f`/`%x` produce a Go-style `%!<verb>(<type>=<value>)` diagnostic — e.g. `printf "%d" "foo"` → `%!d(string=foo)`.
332
+ - **Recursion depth.** Go stops a recursive define at 100000 nested levels. Here the JS host's stack runs out first, a few hundred levels down on Node, depending on the body. The overflow surfaces as one `EvalError` naming the define, `template "name": nesting depth N exceeds the host's stack`, not as a raw stack error.
252
333
  - **Regex semantics.** `sprigRegex()` uses ECMAScript regex, not Go's RE2. Lookbehind syntax, Unicode property escapes, and certain catastrophic-backtracking patterns differ.
253
334
  - **String length.** Go strings are UTF-8 byte sequences; `len("é")` is `2` in Go. JS strings are UTF-16 code units; `len("é")` is `1` here. Choose grapheme libraries on the JS side if you need byte/grapheme counts.
254
- - **String slicing.** `trunc`, `substr`, `abbrev`, and `abbrevboth` count code points where Go counts bytes, so the same `n` keeps a different amount of text in each engine: `substr 0 2 "éx"` → `é` in Go, `éx` here. The divergence starts at any two-byte character, not only astral ones, and Go's answer is frequently not valid UTF-8 at all: `trunc 1 "éx"` → the single byte `0xC3` in Go, `é` here; `trunc 1 "𐍈x"` → the single byte `0xF0` in Go, `𐍈` here. Each of those Go results is the first fragment of the character's UTF-8 encoding, and is not a well-formed string on its own. Counting code points is deliberate: it keeps them from splitting a character and returning a lone surrogate. Separately, `abbrevboth` disagrees with Go on plain ASCII whenever the offset is 4 or less — a defect rather than an intended residual, and one that will be fixed.
335
+ - **String slicing.** `trunc`, `substr`, `abbrev`, and `abbrevboth` count code points where Go counts bytes, so the same `n` keeps a different amount of text in each engine: `substr 0 2 "éx"` → `é` in Go, `éx` here. The divergence starts at any two-byte character, not only astral ones, and Go's answer is frequently not valid UTF-8 at all: `trunc 1 "éx"` → the single byte `0xC3` in Go, `é` here; `trunc 1 "𐍈x"` → the single byte `0xF0` in Go, `𐍈` here. Each of those Go results is the first fragment of the character's UTF-8 encoding, and is not a well-formed string on its own. Counting code points is deliberate: it keeps them from splitting a character and returning a lone surrogate.
255
336
  - **Width counting.** `wrap` and `wrapWith` measure width in UTF-16 code units where Go measures bytes: `wrap 5 "éé éé"` → `éé\néé` in Go, unwrapped `éé éé` here. `printf`'s width flags diverge on a different axis — Go pads to a rune count and this engine to a UTF-16 unit count, so the two agree on BMP text and differ only on astral: `printf "%-5s|" "𐍈𐍈"` → `𐍈𐍈 |` in Go, `𐍈𐍈 |` here. Neither is converted to code points: they never cut inside a character, so they cannot emit a lone surrogate, and counting runes in `wrap` would move it further from Go's bytes rather than closer.
256
337
  - **Field access.** Walks JS objects, Maps, and arrays using JS property semantics, not Go reflection. Named-field access on an array is a missing field — silently `<no value>` under the default `missingKey: "default"` policy, or a `MissingFieldError` under `missingKey: "error"`. There is no `length` / `[N]` magic; use the `index` and `len` built-ins.
257
338
  - **`missingkey=zero`.** Accepted as a config value (`missingKey: "zero"`) for API parity with Go's `Option("missingkey=zero")`, but JavaScript erases value-types at runtime — there is no `reflect.New(elemType).Elem()` analogue, so `"zero"` produces the same observable behavior as `"default"` (silent `<no value>`). To force a typed-zero substitute at the use site, use sprig: `{{ .missing | default "" }}`.
@@ -302,6 +383,8 @@ Every error carries `pos`, `source`, and a `kind` discriminator. `.toString()` p
302
383
  The package exports exactly the following from `"@promptctl/go-template-js"` — anything else is internal and may change at any time:
303
384
 
304
385
  - Engine: `createEngine`, `Engine`, `Template`, `EngineConfig`, `FuncMap`, `TemplateFunc`, `ArgType`, `Arity`, `MissingKeyOption`, `Delims`.
386
+ - Provenance: `marked`, `unmarked`, `Marked`.
387
+ - Sub-templates: `include`.
305
388
  - Errors: `TemplateError`, `ParseError`, `EvalError`, `FuncNotFoundError`, `ArgCountError`, `ArgCount`, `TypeMismatchError`, `MissingFieldError`, `FailError`, `ErrorKind`.
306
389
  - Sprig categories: `sprigDefaults`, `sprigStrings`, `sprigMath`, `sprigLists`, `sprigDicts`, `sprigRegex`, `sprigTypes`, `sprigConversions`, `sprigSemver`, `sprigFlow`, `sprigRandom`, `sprigHash`, `sprigDatetime`.
307
390
 
@@ -309,6 +392,8 @@ Reaching into `dist/` subpaths or `src/` deep imports is unsupported.
309
392
 
310
393
  ## Development
311
394
 
395
+ The toolchain needs Node 22.12+ (vitest 5's range), above the package's 20.19 runtime floor.
396
+
312
397
  ```bash
313
398
  pnpm install
314
399
  pnpm build # tsdown → dist/
package/dist/index.d.ts CHANGED
@@ -158,6 +158,13 @@ declare class Defines {
158
158
  static readonly EMPTY: Defines;
159
159
  private constructor();
160
160
  has(name: string): boolean;
161
+ /**
162
+ * Every name this set can render, own and inherited, sorted — what a
163
+ * consumer reads after `evaluateDefine` reports a name as not defined.
164
+ * The parser forbids redeclaring an inherited name, so the chain repeats
165
+ * none; the Set keeps the listing duplicate-free without leaning on that.
166
+ */
167
+ names(): string[];
161
168
  }
162
169
  //#endregion
163
170
  //#region src/evaluator/evaluator.d.ts
@@ -222,9 +229,11 @@ declare const ARG_TYPES: readonly ["string", "int", "truncating-int", "float", "
222
229
  * slots appear in the same call, all of them must share a kind, with
223
230
  * `number`↔`bigint` bridged and `nil` acting as a wildcard. Object
224
231
  * equality routes through `deepEqual` in `eq`/`ne` bodies.
225
- * - "stringifiable" — string directly OR a value the engine's
226
- * `toString` can flatten. The matcher *probes* the conversion;
227
- * downstream func bodies call `engine.toString` to actually flatten.
232
+ * - "stringifiable" — a value Go's `%v` can print: a string, nil, a
233
+ * scalar, a T the engine's `toString` flattens, an object with its own
234
+ * toString, a class instance (Go's struct), or a list/map of those; a
235
+ * Set, function or symbol has no text form. The matcher *probes* `formatV`;
236
+ * downstream func bodies call it again to actually print.
228
237
  * - "callable" — `typeof v === "function"`.
229
238
  * - "collection" — string | array | Map | plain object. The receiver
230
239
  * shape `index` accepts. Sets and primitives are rejected. Nil is
@@ -339,6 +348,10 @@ interface TemplateFunc {
339
348
  * first rest parameter and lies about several registrations (`min`,
340
349
  * `max`, `mul` and friends report 0 while Go requires 1). Arity comes
341
350
  * from `arity`, never from here.
351
+ *
352
+ * Return `marked(value, ...tokens)` to mark the call; the template sees
353
+ * `value`, and the tokens reach `EngineConfig.emitted` / `decided`
354
+ * wherever the output depends on it.
342
355
  */
343
356
  readonly fn: (...args: never[]) => unknown;
344
357
  /**
@@ -365,6 +378,22 @@ interface TemplateFunc {
365
378
  * the function body's own requirement; see `eq` and `dig`.
366
379
  */
367
380
  readonly arity: Arity;
381
+ /**
382
+ * `true` when the body stores anything it was handed — in place in an
383
+ * argument, as sprig `set` and `unset` do, or in a closure or module
384
+ * variable a later call returns — or runs code it was handed, which may
385
+ * store (`call`). Omitted: it does neither, which is true of nearly
386
+ * every func.
387
+ *
388
+ * [LAW:types-are-the-program] Whether a call writes is a fact about the
389
+ * func, so it is declared rather than assumed of every call. Where a
390
+ * write lands is beyond what the engine can follow (an object read
391
+ * later, a fragment already emitted, the host's data for the next
392
+ * evaluation), so each call of a writing func reports its inputs'
393
+ * marks through `EngineConfig.decided` as it runs. A body that writes
394
+ * without declaring it reports late.
395
+ */
396
+ readonly writes?: true;
368
397
  }
369
398
  type FuncMap = Record<string, TemplateFunc>;
370
399
  /**
@@ -385,7 +414,10 @@ type FuncMap = Record<string, TemplateFunc>;
385
414
  * indicates a scope-construction bug that should fail loud.
386
415
  */
387
416
  type MissingKeyOption = "default" | "zero" | "error";
388
- interface EngineConfig<T> {
417
+ type EngineConfig<T> = EngineConfigFields<T> & ([T] extends [string] ? unknown : {
418
+ readonly isT: (value: unknown) => value is T;
419
+ });
420
+ interface EngineConfigFields<T> {
389
421
  /** Convert a text literal (or string-returning function result) into T. */
390
422
  readonly fromString: (s: string) => T;
391
423
  /**
@@ -393,9 +425,9 @@ interface EngineConfig<T> {
393
425
  *
394
426
  * [LAW:single-enforcer] Dual of `fromString`: one place owns the
395
427
  * string→T direction, this owns the T→string direction. Built-ins
396
- * registered against the `"stringifiable"` ArgType call this when
397
- * they need to format a non-string value (the matcher probes via
398
- * `toString` to validate; the body re-uses it to flatten).
428
+ * registered against the `"stringifiable"` ArgType call this for each
429
+ * T they print, nested ones included; every non-T value prints as Go's
430
+ * `%v` and never reaches it.
399
431
  *
400
432
  * Default behaviour: passes through any value that is already a
401
433
  * `typeof "string"` and throws `TypeMismatchError` for everything
@@ -411,12 +443,13 @@ interface EngineConfig<T> {
411
443
  * Date's own String); at a call, a `"T"` ArgType slot accepts exactly
412
444
  * what this says.
413
445
  *
414
- * [LAW:single-enforcer] The one predicate, consulted first and alone.
415
- * Default: a non-null object other than an array or a Map — so without
416
- * it a consumer whose scope carries JSON documents sees a bare
417
- * `{{ .doc }}` leak the document into its fragments; with
418
- * `isT: (v) => v instanceof RichText` that `{{ .doc }}` prints
419
- * `map[k:v …]`, and a consumer whose T is array-shaped says so here.
446
+ * [LAW:single-enforcer] The one predicate for what is a T. At the output
447
+ * stream a string, number, boolean or nil is lifted through `fromString`
448
+ * before it is asked, so it decides only for structured values.
449
+ * Default: a string — the T the default `fromString`/`toString` pair
450
+ * supports — so a plain object prints `map[k:v …]` as Go's `%v` does.
451
+ * Required by the type whenever T is not a string, e.g.
452
+ * `isT: (v) => v instanceof RichText`.
420
453
  */
421
454
  readonly isT?: (value: unknown) => value is T;
422
455
  /**
@@ -464,6 +497,27 @@ interface EngineConfig<T> {
464
497
  readonly delims?: Delims;
465
498
  /** Optional registry of named functions usable in pipelines. */
466
499
  readonly funcs?: FuncMap;
500
+ /**
501
+ * Every `T` the template emits passes through here with the marks it
502
+ * depends on (see `marked`), and the return is what reaches the output.
503
+ * The marks are those of every value the emitting action read and of
504
+ * every `if`/`with`/`range` arm it sits in; a mark is reported early,
505
+ * never late, and a mark bound somewhere nobody reads is not reported.
506
+ * Called for every emission, an empty set included. Default: returns
507
+ * `value` unchanged.
508
+ */
509
+ readonly emitted?: (value: T, marks: ReadonlySet<unknown>) => T;
510
+ /**
511
+ * Called once each time an `if`/`with`/`range` pipe is evaluated,
512
+ * before either arm runs — so a decision whose taken arm emits nothing
513
+ * (or which has no arm to take) still says what it depended on. Also
514
+ * called for each call of a func that declares `writes` (the output may
515
+ * show that write later with no cell to say it on), and for each action
516
+ * or control pipe that throws. Every call carries the marks of the
517
+ * values read and of every `if`/`with`/`range` arm it sits in.
518
+ * Default: does nothing.
519
+ */
520
+ readonly decided?: (marks: ReadonlySet<unknown>) => void;
467
521
  }
468
522
  interface ReferencedCall {
469
523
  /** The function name at the head of the command. */
@@ -506,6 +560,7 @@ type ReferencedArg = {
506
560
  declare class Template<T> {
507
561
  readonly source: string;
508
562
  private readonly _evaluate;
563
+ private readonly _evaluateDefine;
509
564
  private readonly _defines;
510
565
  private readonly _referencedFunctions;
511
566
  private readonly _referencedCalls;
@@ -521,6 +576,13 @@ declare class Template<T> {
521
576
  */
522
577
  defines(): Defines;
523
578
  evaluate(scope: unknown): T[];
579
+ /**
580
+ * Render one named sub-template — any `{{ define }}` in {@link defines}, its
581
+ * own or inherited — with `scope` as its dot and `$`, as Go's
582
+ * `ExecuteTemplate` does. The output is the same `T[]` a whole-template
583
+ * {@link evaluate} produces, through the same `emitted` / `decided` hooks.
584
+ */
585
+ evaluateDefine(name: string, scope: unknown): T[];
524
586
  /**
525
587
  * The FuncMap function names this template references — every identifier that
526
588
  * names a function in this parse: the template body and its own `{{ define }}`
@@ -566,6 +628,8 @@ declare class Engine<T> {
566
628
  private readonly funcs;
567
629
  private readonly missingKey;
568
630
  private readonly delims;
631
+ private readonly emitted;
632
+ private readonly decided;
569
633
  constructor(config: EngineConfig<T>);
570
634
  /**
571
635
  * Parse a template source into a reusable Template handle.
@@ -596,19 +660,60 @@ declare class Engine<T> {
596
660
  private evalWith;
597
661
  private evalRange;
598
662
  private evalTemplateInvoke;
663
+ private definedEntry;
664
+ private renderDefine;
665
+ private include;
599
666
  private evalBlock;
600
- private evalAction;
667
+ private decide;
668
+ private readonly assigned;
669
+ private assignedIn;
670
+ private invocationDot;
671
+ private read;
601
672
  private evalPipe;
602
- private evalPipeWithoutDecls;
673
+ private bind;
603
674
  private evalCommand;
604
675
  private invoke;
605
676
  private evalPrimary;
677
+ private evalOperand;
606
678
  private resolveFieldChain;
607
679
  private resolveVariable;
608
- private emitFromValue;
680
+ private readDot;
681
+ private lift;
609
682
  }
610
683
  declare function createEngine<T>(config: EngineConfig<T>): Engine<T>;
611
684
  //#endregion
685
+ //#region src/evaluator/include.d.ts
686
+ /** Helm's `include(name string, data interface{}) (string, error)`. */
687
+ declare const include: TemplateFunc;
688
+ //#endregion
689
+ //#region src/evaluator/marks.d.ts
690
+ /**
691
+ * A func's return value together with the marks of the call that
692
+ * produced it. Opaque: build one with {@link marked}; only the engine
693
+ * reads it.
694
+ */
695
+ declare class Marked {
696
+ #private;
697
+ private constructor();
698
+ }
699
+ /**
700
+ * Return this from a registered func to mark the call: every emission
701
+ * and control decision that depends on the call's result reports
702
+ * `marks`. The template sees `value`, exactly as if it had been returned
703
+ * directly.
704
+ */
705
+ declare function marked(value: unknown, ...marks: unknown[]): Marked;
706
+ /**
707
+ * A func's return read apart: its value and the marks it carries (none
708
+ * for a plain value). For JS code that builds on a marking func outside a
709
+ * template — `const { value, marks } = unmarked(tween.fn(...))`, then
710
+ * `return marked(Math.min(1, value as number), ...marks)`.
711
+ */
712
+ declare function unmarked(result: unknown): {
713
+ readonly value: unknown;
714
+ readonly marks: readonly unknown[];
715
+ };
716
+ //#endregion
612
717
  //#region src/sprig/conversions/index.d.ts
613
718
  declare function sprigConversions(): FuncMap;
614
719
  //#endregion
@@ -691,5 +796,5 @@ declare function sprigStrings(): FuncMap;
691
796
  //#region src/sprig/types/index.d.ts
692
797
  declare function sprigTypes(): FuncMap;
693
798
  //#endregion
694
- export { type ArgCount, ArgCountError, type ArgType, type Arity, Defines, type Delims, Engine, type EngineConfig, type ErrorKind, EvalError, FailError, type FuncMap, FuncNotFoundError, MissingFieldError, type MissingKeyOption, NotIntegerError, ParseError, type ReferencedArg, type ReferencedCall, type ReferencedLiteral, Template, TemplateError, type TemplateFunc, TypeMismatchError, createEngine, sprigConversions, sprigDatetime, sprigDefaults, sprigDicts, sprigFlow, sprigHash, sprigLists, sprigMath, sprigRandom, sprigRegex, sprigSemver, sprigStrings, sprigTypes, staticDictEntries };
799
+ export { type ArgCount, ArgCountError, type ArgType, type Arity, Defines, type Delims, Engine, type EngineConfig, type ErrorKind, EvalError, FailError, type FuncMap, FuncNotFoundError, type Marked, MissingFieldError, type MissingKeyOption, NotIntegerError, ParseError, type ReferencedArg, type ReferencedCall, type ReferencedLiteral, Template, TemplateError, type TemplateFunc, TypeMismatchError, createEngine, include, marked, sprigConversions, sprigDatetime, sprigDefaults, sprigDicts, sprigFlow, sprigHash, sprigLists, sprigMath, sprigRandom, sprigRegex, sprigSemver, sprigStrings, sprigTypes, staticDictEntries, unmarked };
695
800
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/parser/pos.ts","../src/errors.ts","../src/parser/lexer.ts","../src/parser/parser.ts","../src/evaluator/evaluator.ts","../src/sprig/conversions/index.ts","../src/sprig/datetime/_clock.ts","../src/sprig/datetime/index.ts","../src/sprig/defaults/index.ts","../src/sprig/dicts/dict.ts","../src/sprig/dicts/index.ts","../src/sprig/flow/index.ts","../src/sprig/hash/index.ts","../src/sprig/lists/index.ts","../src/sprig/math/index.ts","../src/sprig/random/index.ts","../src/sprig/regex/index.ts","../src/sprig/semver/index.ts","../src/sprig/strings/index.ts","../src/sprig/types/index.ts"],"mappings":";;AAUA;;;;;;;;;UAAiB,GAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA;EAAA,SACA,MAAA;AAAA;;;KCUC,SAAA;AAAA,UASK,oBAAA;EAAA,SACN,MAAA;EASgB;EAAA,SAPhB,KAAA;AAAA;AAAA,cAOE,aAAA,SAAsB,KAAA;EAAA,SACf,IAAA;EAAA,SACT,IAAA,EAAM,SAAA;EAAA,SACN,GAAA,EAAK,GAAA;EAAA,SACL,MAAA;cAEG,OAAA,UAAiB,GAAA,EAAK,GAAA,EAAK,GAAA,GAAK,oBAAA;EANX;EAAA,IAa7B,aAAA,CAAA;EAIK,QAAA,CAAA;AAAA;AAAA,UAWM,iBAAA,SAA0B,oBAAA;EAAA,SAChC,QAAA;EAAA,SACA,KAAA;AAAA;AAAA,cAGE,UAAA,SAAmB,aAAA;EAAA,SACZ,IAAA;EAAA,SACA,IAAA,EAAM,SAAA;EAAA,SACf,QAAA;EAAA,SACA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AA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/parser/pos.ts","../src/errors.ts","../src/parser/lexer.ts","../src/parser/parser.ts","../src/evaluator/evaluator.ts","../src/evaluator/include.ts","../src/evaluator/marks.ts","../src/sprig/conversions/index.ts","../src/sprig/datetime/_clock.ts","../src/sprig/datetime/index.ts","../src/sprig/defaults/index.ts","../src/sprig/dicts/dict.ts","../src/sprig/dicts/index.ts","../src/sprig/flow/index.ts","../src/sprig/hash/index.ts","../src/sprig/lists/index.ts","../src/sprig/math/index.ts","../src/sprig/random/index.ts","../src/sprig/regex/index.ts","../src/sprig/semver/index.ts","../src/sprig/strings/index.ts","../src/sprig/types/index.ts"],"mappings":";;AAUA;;;;;;;;;UAAiB,GAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA;EAAA,SACA,MAAA;AAAA;;;KCUC,SAAA;AAAA,UASK,oBAAA;EAAA,SACN,MAAA;EASgB;EAAA,SAPhB,KAAA;AAAA;AAAA,cAOE,aAAA,SAAsB,KAAA;EAAA,SACf,IAAA;EAAA,SACT,IAAA,EAAM,SAAA;EAAA,SACN,GAAA,EAAK,GAAA;EAAA,SACL,MAAA;cAEG,OAAA,UAAiB,GAAA,EAAK,GAAA,EAAK,GAAA,GAAK,oBAAA;EANX;EAAA,IAa7B,aAAA,CAAA;EAIK,QAAA,CAAA;AAAA;AAAA,UAWM,iBAAA,SAA0B,oBAAA;EAAA,SAChC,QAAA;EAAA,SACA,KAAA;AAAA;AAAA,cAGE,UAAA,SAAmB,aAAA;EAAA,SACZ,IAAA;EAAA,SACA,IAAA,EAAM,SAAA;EAAA,SACf,QAAA;EAAA,SACA,KAAA;cAEG,OAAA,UAAiB,GAAA,EAAK,GAAA,EAAK,GAAA,GAAK,iBAAA;AAAA;AAAA,cAWjC,SAAA,SAAkB,aAAA;EAAA,SACX,IAAA;EAAA,SACA,IAAA,EAAM,SAAA;AAAA;;;;;;cAQb,iBAAA,SAA0B,SAAA;EAAA,SACnB,IAAA;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