Skip to content

0.9.70

Choose a tag to compare

@DirazCoder DirazCoder released this 14 Sep 19:27
· 3 commits to main since this release

temporal-fmt v0.9.70

Added

  • ctx.registerFormatToken(token) adds a custom token into the actual
    shared table format()/parse() read from, everywhere in the process —
    createFormatter()'s own options.tokens only ever reached the one
    Formatter object it returned, never the library's top-level format().
    Last-write-wins by name, same rule as registerLocale, including against
    a built-in token name; Mod.priority is the tiebreak. Custom handlers
    still run host-side under the sandbox, same treatment createFormatter's
    tokens already got: source text crosses the boundary, gets revived with
    new Function, and is checked against the original before the mod's load
    is accepted.
  • ctx.log(level, message, meta?) and ctx.reportIssue(issue) give a
    mod a way to actually surface something to the person running the CLI.
    Sandboxed mods' own console.log goes to the worker's stderr, which
    isn't the terminal's stderr, so without these two a mod had no way to
    say "here's what I did" or "here's what I couldn't do" that anyone would
    see. Both show up in the load report; both fall back to the matching
    console method when used outside a load report entirely.
  • "minApiLevel" in mod.json lets a .tfmod declare the lowest mod API
    level it needs. A mod that needs more than the host provides now fails
    cleanly at load time, before register() runs, naming both numbers —
    previously it would run right up to the first missing ctx function and
    fail with a raw "is not a function."

Changed

  • ctx.hasPermission(capability) is now typed as the literal union of
    the four real capabilities instead of a bare string. A typo like
    'fs:reed' is a compile-time error in a TypeScript-authored mod now,
    not a capability that silently and permanently read false. No runtime
    behavior change.

Fixed

  • registerFormatToken didn't do anything. tokens.ts had the full
    mod-registration and rebuild-listener mechanism in place, but neither
    tokenize.ts's token-matching table nor format.ts's handler lookup
    ever subscribed to it — both were built once from the static built-in
    token list at module load and never touched again. A mod's registration
    was accepted and then quietly ignored by every format() call. Both
    tables now rebuild on registration, and format.ts's tokenize cache is
    cleared at the same time, since a format string already tokenized as
    literal text before a token was registered would otherwise never
    re-tokenize for the rest of the process.