@promptctl/go-template-js 0.1.1 → 0.4.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
@@ -89,7 +89,8 @@ Every entry in `argTypes` is one of:
89
89
  | Kind | Accepts at runtime | Used by (examples) |
90
90
  | --- | --- | --- |
91
91
  | `"string"` | JS `string` | `upper`, `lower`, `trim`, `printf` format string |
92
- | `"number"` | `typeof === "number"` or `bigint` (interchangeable) | `add`, `sub`, `mul`, `mod` |
92
+ | `"int"` | finite `number` or safe-integer-range `bigint`; gate normalizes to `number` via `Math.trunc(Number(v))` so the body sees `number` | `add`, `sub`, `mul`, `mod`, `max`, `min`, `slice` indices, `chunk`, `splitn`, `repeat` |
93
+ | `"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` |
93
94
  | `"bool"` | `typeof === "boolean"` | (rare; most boolean slots use `"truthy"`) |
94
95
  | `"T"` | Any non-primitive (consumer-defined fragment) | consumer-defined typed funcs returning `T` |
95
96
  | `"ordered"` | `string`, `number`, `bigint`, or `boolean` | `lt`, `le`, `gt`, `ge` — additionally requires both slots share a kind |
@@ -125,6 +126,7 @@ Supported:
125
126
 
126
127
  - All actions: `{{ pipeline }}`, `{{- ... -}}` trim markers, `{{/* comments */}}`.
127
128
  - All control flow: `if/else if/else/end`, `range/else/end` (with index/value forms `range $i, $v := …`), `with/else/end`.
129
+ - Range-body control: `{{break}}` exits the innermost `{{range}}`; `{{continue}}` skips to its next iteration. Both are parse errors outside a lexically-enclosing `{{range}}` (including inside a `{{define}}` or `{{block}}` body, even if those are nested in a range — sub-template bodies are independent parse contexts, matching Go's `text/template`).
128
130
  - All sub-template forms: `define`, `template`, `block`.
129
131
  - Variable assignment: `$x := pipe` and `$x = pipe`.
130
132
  - All literals: strings (interpreted + raw backtick), runes, integers (decimal/hex/octal/binary), floats (with exponents and hex-float `p` exponents), booleans, `nil`.
@@ -135,9 +137,9 @@ Supported:
135
137
 
136
138
  All of Go template's runtime built-ins:
137
139
 
138
- `and` `or` `not` · `eq` `ne` `lt` `le` `gt` `ge` · `len` `index` `slice` · `print` `println` `printf` · `call`
140
+ `and` `or` `not` · `eq` `ne` `lt` `le` `gt` `ge` · `len` `index` `slice` · `print` `println` `printf` · `call` · `html` · `js` · `urlquery`
139
141
 
140
- `and`/`or` short-circuit (the engine passes thunks for those). `printf` supports `%s`, `%d`, `%v`, `%q`, `%f` (precision-aware), `%t`, `%x`, plus width and `-` left-align flags.
142
+ `and`/`or` short-circuit (the engine passes thunks for those). `printf` supports `%s`, `%d`, `%v`, `%q`, `%f` (precision-aware), `%t`, `%x`, plus width and `-` left-align flags. `html` flattens its arguments like `print` (via the engine's `toString`) and then escapes the six HTML-significant characters (`\0` → `�`, `"` → `&#34;`, `'` → `&#39;`, `&` → `&amp;`, `<` → `&lt;`, `>` → `&gt;`) — matching Go's `text/template.HTMLEscaper` byte-for-byte. `js` shares the same flatten pipeline and emits JavaScript-literal-safe output: `\` → `\\`, `'` → `\'`, `"` → `\"`, `<` → `\u003C`, `>` → `\u003E`, `&` → `\u0026`, `=` → `\u003D`, ASCII control chars (< 0x20) and non-printable runes (incl. U+2028/U+2029) → `\u%04X` uppercase — matching Go's `text/template.JSEscaper`. `urlquery` shares the same flatten pipeline and percent-encodes the UTF-8 byte stream per Go's `net/url.QueryEscape`: the unreserved set `[A-Za-z0-9-._~]` passes through, space becomes `+`, every other byte becomes `%XX` uppercase hex (so a literal `+` round-trips as `%2B`, and `α` encodes to `%CE%B1`).
141
143
 
142
144
  ### Sprig subset
143
145
 
@@ -147,12 +149,21 @@ Imported from `@promptctl/go-template-js` as category-scoped `FuncMap` factories
147
149
  | --- | --- | --- |
148
150
  | Defaults | `sprigDefaults()` | default, empty, coalesce, ternary, fromJson, toJson, toPrettyJson |
149
151
  | Strings | `sprigStrings()` | trim, trimAll, trimPrefix, trimSuffix, upper, lower, title, untitle, repeat, substr, trunc, contains, hasPrefix, hasSuffix, replace, split, splitList, splitn, join, quote, squote, cat, indent, nindent, wrap, wrapWith, abbrev, abbrevboth, initials, nospace, snakecase, camelcase, kebabcase, swapcase, plural, regexQuoteMeta |
150
- | Math | `sprigMath()` | add, sub, mul, div, mod, min, max, floor, ceil, round, addf, subf, mulf, divf |
151
- | Lists | `sprigLists()` | list, first, last, rest, initial, len, reverse, uniq, without, has, compact, slice, concat, chunk, prepend, append |
152
+ | Math | `sprigMath()` | add, sub, mul, div, mod, min, max, floor, ceil, round, addf, subf, mulf, divf, add1, add1f, maxf, minf, biggest, seq, until, untilStep |
153
+ | Lists | `sprigLists()` | list, first, last, rest, initial, len, reverse, uniq, without, has, compact, slice, concat, chunk, prepend, append, sortAlpha, push, tuple, dig, all, any |
152
154
  | Dicts | `sprigDicts()` | dict, get, set, unset, keys, values, pluck, pick, omit, hasKey, merge, mergeOverwrite |
153
155
  | Regex | `sprigRegex()` | regexMatch, regexFind, regexFindAll, regexReplaceAll, regexReplaceAllLiteral, regexSplit |
154
156
  | Types | `sprigTypes()` | kindOf, kindIs, typeOf, typeIs, typeIsLike, deepEqual, deepCopy |
155
157
  | Conversions | `sprigConversions()` | atoi, int, int64, float64, toString, toStrings, toDecimal, toRawJson |
158
+ | Semver | `sprigSemver()` | semver, semverCompare |
159
+ | Flow | `sprigFlow()` | fail |
160
+ | Random | `sprigRandom(random?)` | randInt, randAlpha, randAlphaNum, randNumeric, randAscii, shuffle |
161
+ | Hash / Encoding | `sprigHash()` | b64enc, b64dec, b32enc, b32dec, sha1sum, sha256sum, sha512sum, adler32sum, uuidv4 |
162
+ | Date / Time | `sprigDatetime(clock?)` | now, date, dateInZone, dateModify, htmlDate, htmlDateInZone, duration, durationRound, toDate, ago, unixEpoch |
163
+
164
+ **Runtime floor for `sprigHash()`:** This package requires Node ≥ 20.19.0 (per `engines.node`). `uuidv4` requires `globalThis.crypto.randomUUID`, guaranteed in that environment. SHA-* use [`@noble/hashes`](https://github.com/paulmillr/noble-hashes) — audited, zero-dep, sync, pure JS.
165
+
166
+ **`sprigDatetime(clock?)`:** All date/time functions accept Go's reference-time format strings (`Mon Jan 2 15:04:05 MST 2006`). Pass `clock: () => Date` to freeze "now" for deterministic templates. The `date` and `dateInZone` functions accept `Date`, number (Unix seconds), or string as the time value. Go template integer literals hit sprig's type-switch default branch (returning `"0s"` from `duration`) — prefer string literals or scope-injected values for portable templates.
156
167
 
157
168
  ## Composing funcs from multiple sources
158
169
 
@@ -178,13 +189,16 @@ The engine matches Go's `text/template` semantics aggressively. The remaining di
178
189
  - **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)`.
179
190
  - **Regex semantics.** `sprigRegex()` uses ECMAScript regex, not Go's RE2. Lookbehind syntax, Unicode property escapes, and certain catastrophic-backtracking patterns differ.
180
191
  - **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.
181
- - **Field access.** Walks JS objects, Maps, and arrays using JS property semantics, not Go reflection. Named-field access on an array is a `MissingFieldError` (no `length` / `[N]` magic — use the `index` and `len` built-ins).
192
+ - **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.
193
+ - **`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 "" }}`.
182
194
  - **Type mismatches at function boundaries are runtime errors, not compile errors.** By design: the engine does not know your `T` shape statically, so it surfaces the architectural commitment when the bad flow happens. See `TypeMismatchError`.
183
195
  - **printf verbs** beyond `%s %d %v %q %f %t %x` are rendered as `%!<verb>(<type>=<value>)`. If you need more, register your own formatter via the `funcs` registry.
184
196
 
185
197
  Notable parity statements (places where users sometimes expect divergence and there isn't one):
186
198
 
187
199
  - A nil/undefined pipeline emits the literal `<no value>` string, matching Go's `text/template`.
200
+ - **Missing field/map-key access** follows Go's `Option("missingkey=...")`. Defaults to `"default"` (silent `<no value>`); set `missingKey: "error"` in `EngineConfig` to throw `MissingFieldError` instead. The `"zero"` value is accepted; see the divergence note above.
201
+ - **Custom delimiters** are supported via `EngineConfig.delims`, mirroring Go's `Template.Delims(left, right)`. Pass `{ left: "<%", right: "%>" }` to make the engine recognise `<% ... %>` actions instead of `{{ ... }}`. Trim markers follow Go: with `<%`/`%>` they become `<%-` and `-%>`. Both sides are required if you set the field — neither may be empty. Default `{{` / `}}` are used when the field is omitted.
188
202
  - Range over a Map / plain object iterates in **sorted-by-key order** in both engines (Go's `internal/fmtsort`; ours mirrors it).
189
203
  - Sprig `set` and `unset` mutate the receiver and return it — same as Go sprig.
190
204
  - `{{ "key" | get .dict }}` composes correctly: last-arg piping puts the key in the trailing slot, which is `get(d, key)`'s second parameter. The form `{{ .dict | get "key" }}` does *not* work in either engine — the dict ends up in the key slot.
@@ -219,9 +233,9 @@ Every error carries `pos`, `source`, and a `kind` discriminator. `.toString()` p
219
233
 
220
234
  The package exports exactly the following from `"@promptctl/go-template-js"` — anything else is internal and may change at any time:
221
235
 
222
- - Engine: `createEngine`, `Engine`, `Template`, `EngineConfig`, `FuncMap`, `TemplateFunc`, `ArgType`.
223
- - Errors: `TemplateError`, `ParseError`, `EvalError`, `FuncNotFoundError`, `TypeMismatchError`, `MissingFieldError`, `ErrorKind`.
224
- - Sprig categories: `sprigDefaults`, `sprigStrings`, `sprigMath`, `sprigLists`, `sprigDicts`, `sprigRegex`, `sprigTypes`, `sprigConversions`.
236
+ - Engine: `createEngine`, `Engine`, `Template`, `EngineConfig`, `FuncMap`, `TemplateFunc`, `ArgType`, `MissingKeyOption`, `Delims`.
237
+ - Errors: `TemplateError`, `ParseError`, `EvalError`, `FuncNotFoundError`, `TypeMismatchError`, `MissingFieldError`, `FailError`, `ErrorKind`.
238
+ - Sprig categories: `sprigDefaults`, `sprigStrings`, `sprigMath`, `sprigLists`, `sprigDicts`, `sprigRegex`, `sprigTypes`, `sprigConversions`, `sprigSemver`, `sprigFlow`, `sprigRandom`, `sprigHash`, `sprigDatetime`.
225
239
 
226
240
  Reaching into `dist/` subpaths or `src/` deep imports is unsupported.
227
241
 
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ interface Pos {
16
16
  }
17
17
  //#endregion
18
18
  //#region src/errors.d.ts
19
- type ErrorKind = "ParseError" | "EvalError" | "FuncNotFoundError" | "TypeMismatchError" | "MissingFieldError";
19
+ type ErrorKind = "ParseError" | "EvalError" | "FuncNotFoundError" | "TypeMismatchError" | "MissingFieldError" | "FailError";
20
20
  interface TemplateErrorContext {
21
21
  readonly source?: string | undefined;
22
22
  }
@@ -75,6 +75,37 @@ declare class MissingFieldError extends EvalError {
75
75
  readonly path: readonly string[];
76
76
  constructor(path: readonly string[], pos: Pos, ctx?: TemplateErrorContext);
77
77
  }
78
+ /**
79
+ * Thrown when a template calls `fail "message"`. Consumers can catch
80
+ * this specifically to distinguish intentional template failures from
81
+ * engine bugs. The message comes from the template author.
82
+ *
83
+ * [LAW:single-enforcer] One class, one place. The `fail` sprig function
84
+ * is the only producer; catch `FailError` to handle it distinctly from
85
+ * TypeMismatchError or other eval errors.
86
+ */
87
+ declare class FailError extends EvalError {
88
+ readonly name = "FailError";
89
+ readonly kind: ErrorKind;
90
+ constructor(message: string, pos?: Pos, ctx?: TemplateErrorContext);
91
+ }
92
+ //#endregion
93
+ //#region src/parser/lexer.d.ts
94
+ /**
95
+ * Action delimiters. Default is Go's `{{` / `}}`. Trim-marker forms are
96
+ * derived mechanically: `<left>-` opens with-trim and `-<right>` closes
97
+ * with-trim, matching Go's `text/template`.
98
+ *
99
+ * [LAW:types-are-the-program] Both sides are required if specified —
100
+ * neither may be empty. This is a stronger theorem than Go's API
101
+ * (which lets one side default while the other is set) and forbids
102
+ * the half-configured state that would otherwise have to be defended
103
+ * against at every internal use site.
104
+ */
105
+ interface Delims {
106
+ readonly left: string;
107
+ readonly right: string;
108
+ }
78
109
  //#endregion
79
110
  //#region src/evaluator/evaluator.d.ts
80
111
  /**
@@ -84,7 +115,19 @@ declare class MissingFieldError extends EvalError {
84
115
  * - "string" — must be a JS string. Non-string values raise
85
116
  * TypeMismatchError. This is the **architectural commitment**: T
86
117
  * never silently flattens into a string parameter.
87
- * - "number" — must be `typeof "number"` or `bigint`.
118
+ * - "int" — validate-AND-parse integer carrier. Accepts any finite
119
+ * `number` and any `bigint` whose `Number()` is safe-integer-
120
+ * representable; rejects `NaN`, `±Infinity`, and precision-losing
121
+ * bigints. The gate normalizes `values[i]` to `Math.trunc(Number(v))`
122
+ * so bodies see `number`. Used by `add`, `sub`, `mul`, `mod`, `max`,
123
+ * `min`, the built-in `slice`'s index slots, `chunk`, `splitn`,
124
+ * `repeat`. Added by epic template-variance-num-carrier-hfv.
125
+ * - "float" — validate-AND-parse float carrier. Accepts any `number`
126
+ * (including `NaN`/`±Infinity` — legitimate IEEE-754 floats) and any
127
+ * `bigint` whose `Number()` is finite (overflow-to-Infinity rejected
128
+ * as a magnitude failure). The gate normalizes to `Number(v)` so
129
+ * bodies see `number`. Used by `addf`, `subf`, `mulf`, `divf`,
130
+ * `maxf`, `minf`. Added by epic template-variance-num-carrier-hfv.
88
131
  * - "bool" — must be `typeof "boolean"`.
89
132
  * - "T" — opaque caller-defined T; treated as "anything that is
90
133
  * not a string". The guard does no further checking.
@@ -136,7 +179,7 @@ declare class MissingFieldError extends EvalError {
136
179
  * `"callable"`). The history for this decision lives in epic
137
180
  * template-laws-3gt.
138
181
  */
139
- type ArgType = "string" | "number" | "bool" | "T" | "ordered" | "list" | "dict" | "sized" | "comparable" | "stringifiable" | "liftable" | "callable" | "collection" | "index-key" | "sliceable" | "truthy" | "reflective" | "value" | "serializable";
182
+ type ArgType = "string" | "int" | "float" | "bool" | "T" | "ordered" | "list" | "dict" | "sized" | "comparable" | "stringifiable" | "liftable" | "callable" | "collection" | "index-key" | "sliceable" | "truthy" | "reflective" | "value" | "serializable";
140
183
  interface TemplateFunc {
141
184
  /**
142
185
  * The function body. Parameter types are *contravariant-bottom*
@@ -182,6 +225,24 @@ interface TemplateFunc {
182
225
  readonly argTypePattern?: "alternating";
183
226
  }
184
227
  type FuncMap = Record<string, TemplateFunc>;
228
+ /**
229
+ * Policy for missing field/map-key access — mirrors Go's
230
+ * `text/template` `Option("missingkey=...")`:
231
+ *
232
+ * - `"default"` (Go's `missingkey=default` / `missingkey=invalid`):
233
+ * missing access yields `undefined`; emitted output is `<no value>`.
234
+ * This is the engine default, matching Go's `text/template` default.
235
+ * - `"zero"` (Go's `missingkey=zero`): in Go, returns the zero value of
236
+ * the map's element type. JavaScript has no static value-type info,
237
+ * so the runtime cannot synthesize a typed zero — the option is
238
+ * accepted for API parity and behaves identically to `"default"`.
239
+ * Use sprig `default` (`{{ .x | default "" }}`) when you want a
240
+ * typed-zero substitute at the use site.
241
+ * - `"error"` (Go's `missingkey=error`): missing access throws
242
+ * `MissingFieldError`. Use this in environments where a missing key
243
+ * indicates a scope-construction bug that should fail loud.
244
+ */
245
+ type MissingKeyOption = "default" | "zero" | "error";
185
246
  interface EngineConfig<T> {
186
247
  /** Convert a text literal (or string-returning function result) into T. */
187
248
  readonly fromString: (s: string) => T;
@@ -202,6 +263,49 @@ interface EngineConfig<T> {
202
263
  * `"stringifiable"` slot encounters a T value — never silently.
203
264
  */
204
265
  readonly toString?: (value: T) => string;
266
+ /**
267
+ * PRNG source for `sprigRandom` functions. Defaults to `Math.random`.
268
+ * Supply a seeded generator for reproducible templates.
269
+ *
270
+ * [LAW:single-enforcer] One config field owns the randomness source;
271
+ * pass this to `sprigRandom(config.random)` when composing a full
272
+ * sprig engine so the seam is wired once, not per-function.
273
+ */
274
+ readonly random?: () => number;
275
+ /**
276
+ * Clock source for `sprigDatetime` functions. Defaults to
277
+ * `() => new Date()`. Supply a frozen clock for deterministic test
278
+ * output.
279
+ *
280
+ * [LAW:single-enforcer] One config field owns the time source; pass
281
+ * this to `sprigDatetime(config.clock)` when composing a full sprig
282
+ * engine so the seam is wired once, not per-function.
283
+ */
284
+ readonly clock?: () => Date;
285
+ /**
286
+ * Policy for missing field / map-key access. Defaults to `"default"`
287
+ * (matching Go's `text/template` default — silent `<no value>`). See
288
+ * `MissingKeyOption` for the full enum semantics.
289
+ *
290
+ * [LAW:single-enforcer] One config field owns the policy; the
291
+ * `resolveFieldChain` gate is the only site that consults it.
292
+ * [LAW:dataflow-not-control-flow] The policy is data flowing into a
293
+ * fixed gate, not a branch sprinkled across accessors.
294
+ */
295
+ readonly missingKey?: MissingKeyOption;
296
+ /**
297
+ * Optional override for the template action delimiters. Mirrors
298
+ * Go's `text/template.Template.Delims(left, right)`. Both sides
299
+ * are required if specified — neither may be empty.
300
+ *
301
+ * [LAW:single-enforcer] Validated once at construct time and
302
+ * threaded into the parser as immutable data; no re-validation
303
+ * along the call chain.
304
+ * [LAW:dataflow-not-control-flow] The delim pair is data flowing
305
+ * into the fixed lexer state machine — no new modes, no new
306
+ * branches, just different constant values seeded at construction.
307
+ */
308
+ readonly delims?: Delims;
205
309
  /** Optional registry of named functions usable in pipelines. */
206
310
  readonly funcs?: FuncMap;
207
311
  }
@@ -215,6 +319,8 @@ declare class Engine<T> {
215
319
  private readonly fromString;
216
320
  private readonly toString;
217
321
  private readonly funcs;
322
+ private readonly missingKey;
323
+ private readonly delims;
218
324
  constructor(config: EngineConfig<T>);
219
325
  /**
220
326
  * Parse a template source into a reusable Template handle.
@@ -260,26 +366,65 @@ declare function createEngine<T>(config: EngineConfig<T>): Engine<T>;
260
366
  //#region src/sprig/conversions/index.d.ts
261
367
  declare function sprigConversions(): FuncMap;
262
368
  //#endregion
369
+ //#region src/sprig/datetime/_clock.d.ts
370
+ /**
371
+ * Clock seam for all date/time functions.
372
+ *
373
+ * [LAW:single-enforcer] Every function that reads "now" accepts a Clock
374
+ * parameter injected by the factory closure — never calls `new Date()`
375
+ * directly. One seam, not eleven.
376
+ */
377
+ type Clock = () => Date;
378
+ //#endregion
379
+ //#region src/sprig/datetime/index.d.ts
380
+ /**
381
+ * Build the sprig date/time FuncMap.
382
+ *
383
+ * @param clock - Source of "current time". Defaults to `() => new Date()`.
384
+ * Pass a frozen clock for deterministic test output (mirrors
385
+ * `EngineConfig.clock`).
386
+ */
387
+ declare function sprigDatetime(clock?: Clock): FuncMap;
388
+ //#endregion
263
389
  //#region src/sprig/defaults/index.d.ts
264
390
  declare function sprigDefaults(): FuncMap;
265
391
  //#endregion
266
392
  //#region src/sprig/dicts/index.d.ts
267
393
  declare function sprigDicts(): FuncMap;
268
394
  //#endregion
395
+ //#region src/sprig/flow/index.d.ts
396
+ declare function sprigFlow(): FuncMap;
397
+ //#endregion
398
+ //#region src/sprig/hash/index.d.ts
399
+ /** Build the sprig hash/encoding FuncMap. */
400
+ declare function sprigHash(): FuncMap;
401
+ //#endregion
269
402
  //#region src/sprig/lists/index.d.ts
270
403
  declare function sprigLists(): FuncMap;
271
404
  //#endregion
272
405
  //#region src/sprig/math/index.d.ts
273
406
  declare function sprigMath(): FuncMap;
274
407
  //#endregion
408
+ //#region src/sprig/random/index.d.ts
409
+ /**
410
+ * Build the sprig random FuncMap.
411
+ *
412
+ * @param random - PRNG source. Defaults to `Math.random`. Pass a seeded
413
+ * generator for reproducible templates (matches `EngineConfig.random`).
414
+ */
415
+ declare function sprigRandom(random?: () => number): FuncMap;
416
+ //#endregion
275
417
  //#region src/sprig/regex/index.d.ts
276
418
  declare function sprigRegex(): FuncMap;
277
419
  //#endregion
420
+ //#region src/sprig/semver/index.d.ts
421
+ declare function sprigSemver(): FuncMap;
422
+ //#endregion
278
423
  //#region src/sprig/strings/index.d.ts
279
424
  declare function sprigStrings(): FuncMap;
280
425
  //#endregion
281
426
  //#region src/sprig/types/index.d.ts
282
427
  declare function sprigTypes(): FuncMap;
283
428
  //#endregion
284
- export { type ArgType, Engine, type EngineConfig, type ErrorKind, EvalError, type FuncMap, FuncNotFoundError, MissingFieldError, ParseError, Template, TemplateError, type TemplateFunc, TypeMismatchError, createEngine, sprigConversions, sprigDefaults, sprigDicts, sprigLists, sprigMath, sprigRegex, sprigStrings, sprigTypes };
429
+ export { type ArgType, type Delims, Engine, type EngineConfig, type ErrorKind, EvalError, FailError, type FuncMap, FuncNotFoundError, MissingFieldError, type MissingKeyOption, ParseError, Template, TemplateError, type TemplateFunc, TypeMismatchError, createEngine, sprigConversions, sprigDatetime, sprigDefaults, sprigDicts, sprigFlow, sprigHash, sprigLists, sprigMath, sprigRandom, sprigRegex, sprigSemver, sprigStrings, sprigTypes };
285
430
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/parser/pos.ts","../src/errors.ts","../src/evaluator/evaluator.ts","../src/sprig/conversions/index.ts","../src/sprig/defaults/index.ts","../src/sprig/dicts/index.ts","../src/sprig/lists/index.ts","../src/sprig/math/index.ts","../src/sprig/regex/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;;;KCSC,SAAA;AAAA,UAOK,oBAAA;EAAA,SACN,MAAA;AAAA;AAAA,cAOE,aAAA,SAAsB,KAAA;EAAA,SACf,IAAA;EAAA,SACT,IAAA,EAAM,SAAA;EAAA,SACN,GAAA,EAAK,GAAA;EAAA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AwDM,YAAA,GAAA,CAAgB,MAAA,EAAQ,YAAA,CAAa,CAAA,IAAK,MAAA,CAAO,CAAA;;;iBCpsBjD,gBAAA,CAAA,GAAoB,OAAA;;;iBChBpB,aAAA,CAAA,GAAiB,OAAA;;;iBCDjB,UAAA,CAAA,GAAc,OAAA;;;iBCqBd,UAAA,CAAA,GAAc,OAAA;;;iBCnBd,SAAA,CAAA,GAAa,OAAA;;;iBCDb,UAAA,CAAA,GAAc,OAAA;;;iBCkEd,YAAA,CAAA,GAAgB,OAAA;;;iBCxEhB,UAAA,CAAA,GAAc,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/parser/pos.ts","../src/errors.ts","../src/parser/lexer.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/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;;;KCSC,SAAA;AAAA,UAQK,oBAAA;EAAA,SACN,MAAA;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,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