Repository navigation
0.9.70
temporal-fmt v0.9.70
Added
ctx.registerFormatToken(token)adds a custom token into the actual
shared tableformat()/parse()read from, everywhere in the process —
createFormatter()'s ownoptions.tokensonly ever reached the one
Formatterobject it returned, never the library's top-levelformat().
Last-write-wins by name, same rule asregisterLocale, including against
a built-in token name;Mod.priorityis the tiebreak. Custom handlers
still run host-side under the sandbox, same treatmentcreateFormatter'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?)andctx.reportIssue(issue)give a
mod a way to actually surface something to the person running the CLI.
Sandboxed mods' ownconsole.loggoes 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
consolemethod when used outside a load report entirely."minApiLevel"inmod.jsonlets a.tfmoddeclare the lowest mod API
level it needs. A mod that needs more than the host provides now fails
cleanly at load time, beforeregister()runs, naming both numbers —
previously it would run right up to the first missingctxfunction 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 barestring. A typo like
'fs:reed'is a compile-time error in a TypeScript-authored mod now,
not a capability that silently and permanently readfalse. No runtime
behavior change.
Fixed
registerFormatTokendidn't do anything.tokens.tshad the full
mod-registration and rebuild-listener mechanism in place, but neither
tokenize.ts's token-matching table norformat.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 everyformat()call. Both
tables now rebuild on registration, andformat.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.