From 1fedcc75ce367578f63eefe5db88323cabb0bce8 Mon Sep 17 00:00:00 2001 From: Michael McRae Date: Tue, 14 Jul 2026 10:06:00 +1000 Subject: [PATCH 01/11] era, dots --- package-lock.json | 79 ++--------------- package.json | 2 +- packages/library/package.json | 2 +- packages/tempo-fns/src/scheduling/README.md | 10 +-- packages/tempo/.vitepress/config.ts | 1 + packages/tempo/CHANGELOG.md | 85 +++---------------- .../tempo/doc/2-core-concepts/tempo.config.md | 6 +- .../tempo/doc/2-core-concepts/tempo.format.md | 7 +- .../doc/2-core-concepts/tempo.getters.md | 71 ++++++++++++++++ .../8-project-and-support/releases/v3.x.md | 16 ++++ packages/tempo/package.json | 2 +- packages/tempo/src/module/module.format.ts | 24 +++++- packages/tempo/src/tempo.class.ts | 2 + packages/tempo/test/discrete/format.test.ts | 34 ++++++++ 14 files changed, 179 insertions(+), 162 deletions(-) create mode 100644 packages/tempo/doc/2-core-concepts/tempo.getters.md diff --git a/package-lock.json b/package-lock.json index fd2bcda8..ac7f138a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tempo-monorepo", - "version": "3.8.0", + "version": "3.9.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tempo-monorepo", - "version": "3.8.0", + "version": "3.9.0", "workspaces": [ "packages/*" ], @@ -1094,7 +1094,6 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/@js-temporal/polyfill/-/polyfill-0.5.1.tgz", "integrity": "sha512-hloP58zRVCRSpgDxmqCWJNlizAlUgJFqG2ypq79DCvyv9tHjRYMDOcPFjzfl/A1/YxDvRCZz8wvZvmapQnKwFQ==", - "devOptional": true, "license": "ISC", "dependencies": { "jsbi": "^4.3.0" @@ -5566,19 +5565,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-tsconfig": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.0.tgz", - "integrity": "sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-pkg-maps": "^1.0.0" - }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" - } - }, "node_modules/get-uri": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", @@ -6266,7 +6252,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.2.tgz", "integrity": "sha512-9fqMSQbhJykSeii05nxKl4m6Eqn2P6rOlYiS+C5Dr/HPIU/7yZxu5qzbs40tgaFORiw2Amd0mirjxatXYMkIew==", - "devOptional": true, "license": "Apache-2.0" }, "node_modules/jszip": { @@ -7754,16 +7739,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" - } - }, "node_modules/resq": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", @@ -7887,33 +7862,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/rollup-plugin-esbuild": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-6.2.1.tgz", - "integrity": "sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.4.0", - "es-module-lexer": "^1.6.0", - "get-tsconfig": "^4.10.0", - "unplugin-utils": "^0.2.4" - }, - "engines": { - "node": ">=14.18.0" - }, - "peerDependencies": { - "esbuild": ">=0.18.0", - "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" - } - }, - "node_modules/rollup-plugin-esbuild/node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", - "dev": true, - "license": "MIT" - }, "node_modules/safaridriver": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/safaridriver/-/safaridriver-1.0.1.tgz", @@ -9033,23 +8981,6 @@ "@swc/core": "^1.2.108" } }, - "node_modules/unplugin-utils": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/unplugin-utils/-/unplugin-utils-0.2.5.tgz", - "integrity": "sha512-gwXJnPRewT4rT7sBi/IvxKTjsms7jX7QIDLOClApuZwR49SXbrB1z2NLUZ+vDHyqCj/n58OzRRqaW+B8OZi8vg==", - "dev": true, - "license": "MIT", - "dependencies": { - "pathe": "^2.0.3", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=18.12.0" - }, - "funding": { - "url": "https://github.com/sponsors/sxzz" - } - }, "node_modules/urlpattern-polyfill": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.1.0.tgz", @@ -10219,7 +10150,7 @@ }, "packages/library": { "name": "@magmacomputing/library", - "version": "3.8.0", + "version": "3.9.0", "license": "MIT", "dependencies": { "tslib": "^2.8.1" @@ -10230,7 +10161,7 @@ }, "packages/tempo": { "name": "@magmacomputing/tempo", - "version": "3.8.0", + "version": "3.9.0", "license": "MIT", "dependencies": { "tslib": "^2.8.1" @@ -10246,7 +10177,6 @@ "@rollup/plugin-typescript": "^12.3.0", "javascript-obfuscator": "^5.4.3", "magic-string": "^0.30.21", - "rollup-plugin-esbuild": "^6.2.1", "typedoc": "^0.28.19", "typedoc-plugin-markdown": "^4.11.0", "typedoc-vitepress-theme": "^1.1.2", @@ -10267,6 +10197,7 @@ "vue": "^3.5.39" }, "peerDependencies": { + "@js-temporal/polyfill": "^0.5.1", "@magmacomputing/tempo": "^3.7.0" }, "peerDependenciesMeta": { diff --git a/package.json b/package.json index b796ad02..5029632a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tempo-monorepo", - "version": "3.8.0", + "version": "3.9.0", "private": true, "engines": { "node": ">=20.0.0" diff --git a/packages/library/package.json b/packages/library/package.json index 66ff16b1..1e7172d7 100644 --- a/packages/library/package.json +++ b/packages/library/package.json @@ -1,6 +1,6 @@ { "name": "@magmacomputing/library", - "version": "3.8.0", + "version": "3.9.0", "description": "Shared utility library for Tempo", "author": "Magma Computing Solutions", "license": "MIT", diff --git a/packages/tempo-fns/src/scheduling/README.md b/packages/tempo-fns/src/scheduling/README.md index 5712b701..21d22362 100644 --- a/packages/tempo-fns/src/scheduling/README.md +++ b/packages/tempo-fns/src/scheduling/README.md @@ -36,14 +36,14 @@ class Interval { **Example:** ```typescript import { Interval } from '@magmacomputing/tempo-fns/scheduling'; -import { Tempo } from '@magmacomputing/tempo'; +import { Temporal } from '@js-temporal/polyfill'; -const start = new Tempo('2026-01-01T08:00'); -const end = new Tempo('2026-01-01T17:00'); +const start = Temporal.Instant.from('2026-01-01T08:00:00Z'); +const end = Temporal.Instant.from('2026-01-01T17:00:00Z'); const shift = new Interval(start, end); -const meetingStart = new Tempo('2026-01-01T14:00'); -const meetingEnd = new Tempo('2026-01-01T15:00'); +const meetingStart = Temporal.Instant.from('2026-01-01T14:00:00Z'); +const meetingEnd = Temporal.Instant.from('2026-01-01T15:00:00Z'); const meeting = new Interval(meetingStart, meetingEnd); console.log(shift.contains(meetingStart)); // true diff --git a/packages/tempo/.vitepress/config.ts b/packages/tempo/.vitepress/config.ts index 32103178..785e9baa 100644 --- a/packages/tempo/.vitepress/config.ts +++ b/packages/tempo/.vitepress/config.ts @@ -47,6 +47,7 @@ export default defineConfig({ items: [ { text: 'Configuration', link: '/doc/2-core-concepts/tempo.config' }, { text: 'Registries', link: '/doc/2-core-concepts/tempo.registry' }, + { text: 'Core Getters', link: '/doc/2-core-concepts/tempo.getters' }, { text: 'Smart Parsing', link: '/doc/2-core-concepts/tempo.parse' }, { text: 'Smart Formatting', link: '/doc/2-core-concepts/tempo.format' }, { text: 'Layout Patterns', link: '/doc/2-core-concepts/tempo.layout' }, diff --git a/packages/tempo/CHANGELOG.md b/packages/tempo/CHANGELOG.md index f67156d1..7e42a9ec 100644 --- a/packages/tempo/CHANGELOG.md +++ b/packages/tempo/CHANGELOG.md @@ -6,10 +6,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.9.0] - 2026-07-14 + +### Added +- **Era Formatting & Getters**: Added native support for the `{era}` formatting token (resolves to localized BC/AD or BCE/CE). Introduced `.era` and `.eraYear` getters on the core `Tempo` class for zero-cost access to historical date components. +- **Auto-Meridiem Spacing**: Implemented the `:space` modifier for the `{h12}` formatting token (e.g., `{h12:space:dots}`). This enables typographically correct spacing before automatically injected meridiems (e.g., `"10:30 a.m."`). + +### Changed +- **Documentation Alignment**: Cleaned up `tempo.config.md` to remove deprecated module references, perfectly aligning examples with the `tempo-workspace` ecosystem (`FinancePlugin` and `AstroTerm`). +- **Getter Documentation**: Created `tempo.getters.md` as the definitive, educational conceptual guide for utilizing Tempo's zero-cost evaluation getters. + ## [3.8.0] - 2026-07-11 ### Fixed -- **Plugin Argument Parsing**: Hardened `Tempo.extend` parsing logic to ensure single-argument discovery objects are not falsely popped as `options`, and fixed a bug where `options` were dropped during the Namespace Plugin `.install()` lifecycle. +- **Plugin Argument Parsing**: Hardened `Tempo.extend` parsing logic to ensure single-argument discovery objects are not falsely popped as `options`. - **Registry Merge Contracts**: Corrected documentation in `tempo.registry.md` to accurately define `registryUpdate()` as additive-only, clarifying that `Tempo.extend()` only shadows explicitly wrapped proxy dictionaries (like `formats`). ### Added @@ -20,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - **Build Pipeline Optimization**: Completely removed `esbuild` from the core transpilation pipeline in favor of a pure `tsc` + `Rollup` + `terser` architecture. This eliminates double-transpilation penalties, resulting in a cleaner, more efficient `dist/` build. -- **TypeScript 7.0 Decorator Mitigations**: Uncovered a significant bug in TS 7.0's ES2022 `__esDecorate` down-leveling where transpiled class expressions drop decorator replacements. Maintained the `Object.freeze` constructor workarounds across the ecosystem to ensure full immutability compliance while tracking upstream compiler patches. +- **ESBuild Decorator Mitigations**: Uncovered a significant bug in `esbuild`'s handling of TS 7.0's new, spec-compliant `__esDecorate` down-leveling where transpiled class expressions drop decorator replacements. Maintained the `Object.freeze` constructor workarounds across the ecosystem to ensure full immutability compliance while tracking upstream bundler patches. - **Documentation Architecture**: Completely overhauled the documentation repository to utilize a strictly-numbered directory structure (`1-getting-started`, `2-core-concepts`, etc.) that mirrors the VitePress UI 1:1, drastically reducing maintenance overhead and eliminating orphaned files. ## [3.7.1] - 2026-07-08 @@ -30,8 +40,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.7.0] - 2026-07-08 -### Fixed - ### Added - **Runtime Versioning Registry**: Introduced a secure, static `Tempo.versions` registry. This provides zero-burden runtime observability of all loaded core modules and community plugins. - **Automated Plugin Versioning**: Community plugins now automatically inject their version via a custom ESBuild virtual module pipeline, eliminating the need for magic strings. Internal bundled terms (like `QuarterTerm`) seamlessly inherit the core `TEMPO_VERSION`. @@ -46,8 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.6.0] - 2026-07-05 -### Fixed - ### Added - **Shorthand Mutation Keys**: Added native support for Tempo's shorthand format tokens (e.g., `mi`, `ss`, `yy`, `ww`) across both `.add()` and `.set()` mutations, streamlining developer experience and aligning TypeScript definitions with the underlying runtime engine. - **Shorthand Duration Keys**: Expanded shorthand token support directly into the `DurationModule`. You can now seamlessly use shorthand keys for duration instantiation (`Tempo.duration({ mi: 5 })`), comparisons (`t.until(other, 'mi')`), and strict balancing (`t.until(other).balance({ largestUnit: 'mi' })`), bringing total API consistency across the core library. @@ -60,8 +66,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.5.3] - 2026-07-05 -### Fixed - ### Added - **Flexible Epoch Getters**: Added a static `Tempo.epoch` getter that perfectly mirrors the instance `.epoch` property, enabling direct retrieval of current Unix timestamps (e.g. `Tempo.epoch.ss`). - **Static Now Modifiers**: Extended the static `Tempo.now(unit)` method to accept optional string units (`'ns'`, `'us'`, `'ms'`, `'ss'`), defaulting to nanosecond precision for strict backwards compatibility. @@ -71,8 +75,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.5.2] - 2026-07-04 -### Fixed - ### Added - **Minified Global Bundles**: The build pipeline now natively produces highly optimized, minified IIFE bundles (`*.min.js`) for both Tempo Core and all Community Plugins, significantly reducing payload size for developers using CDN ` @@ -65,7 +66,7 @@ const copyInstall = (pkgName: string) => { - + @@ -74,14 +75,28 @@ const copyInstall = (pkgName: string) => {

Premium Plugins

Enterprise-grade extensions. A cryptographic license token is required.

+ +
+ + Tempo License Registry + +
+ 👉 Go to the Tempo License Registry 👈
+ Manage your subscriptions and retrieve your license key. +
+
+
Premium

{{ plugin.name }}

{{ plugin.description }}

diff --git a/packages/tempo/README.md b/packages/tempo/README.md index 0af990c5..cb621ed7 100644 --- a/packages/tempo/README.md +++ b/packages/tempo/README.md @@ -17,26 +17,16 @@ - - - - - - - - - - -
License: MITTemporalTypeScript ReadyNative ESMDocumentation
- - - -
- - Open in StackBlitz - +
+ License: MIT + Temporal + TypeScript Ready + Native ESM + Documentation + Open in StackBlitz
+ --- ## ⚡ Quick Start diff --git a/packages/tempo/archive/tempo.api.md b/packages/tempo/archive/tempo.api.md deleted file mode 100644 index 8a697dd1..00000000 --- a/packages/tempo/archive/tempo.api.md +++ /dev/null @@ -1,205 +0,0 @@ -# Tempo API Reference - -This document provides a comprehensive technical reference for the `Tempo` class, including static methods, properties, and instance API. - ---- - -- [TypeScript Types Reference](./tempo.types.md) -- [Tempo Cookbook](../doc/tempo.cookbook.md) - ---- - -## 🏗️ Constructor - -You can instantiate `Tempo` in several ways: - -- **`new Tempo()`**: Defaults to current time ("now"). -- **`new Tempo(dateTime)`**: Parses a date-time value. -- **`new Tempo(dateTime, options)`**: Parses with specific configuration. -- **`new Tempo(options)`**: Defaults to "now" with specific configuration. - -### Valid `dateTime` Types: -- **`string`**: ISO 8601, natural language ("tomorrow", "next Friday"), or custom patterns. -- **`number`**: Unix timestamps in milliseconds (default) or microseconds. -- **`BigInt`**: Unix timestamps in nanoseconds. -- **`Date`**: Standard JavaScript `Date` object. -- **`Tempo`**: Clones another Tempo instance. -- **`Temporal.*`**: Any native Temporal object (ZonedDateTime, PlainDate, etc.). - ---- - -## 🏗️ Static Methods - -### `Tempo.init(options?: Tempo.Options)` -Initializes the global default configuration for all subsequent `Tempo` instances. -- **Returns:** `Tempo.Config` (The resolved global config). -- **Note:** Settings are inherited from library defaults, persistent storage, and provided options. Use `silent: true` to suppress `console.error` output for expected failures. - -### `Tempo.extend(arg, options?)` -Unified extender for library functionality. -- **Plugin:** `Tempo.extend(TickerPlugin)` — Adds functional extensions. -- **Term:** `Tempo.extend(MyTerm)` — Registers grammar/parsing terms. -- **Discovery:** `Tempo.extend(config)` — Bootstraps global configuration. - **Formats:** `Tempo.extend(MyFormat)` — Registers custom format strings. - -- **Returns:** `typeof Tempo` (for chaining). -- **Note:** Plugins are installed only once; existing core members are protected. - -### `Tempo.from(tempo?: Tempo.DateTime | Tempo.Options, options?: Tempo.Options)` -Creates a new `Tempo` instance. A static alternative to `new Tempo()`. -- **Returns:** `Tempo` - -### `Tempo.compare(tempo1, tempo2?)` -Compares two `Tempo` instances or date-time values for sorting. -- **Returns:** `-1` (smaller), `0` (equal), or `1` (larger). - -### `Tempo.duration(input)` -(Plugin required) Creates a full Tempo Duration object (EDO) from an ISO string or DurationLike object. -- **Returns:** `Tempo.Duration` -- **Example:** `Tempo.duration('P1Y')` or `Tempo.duration({ months: 2 })` - -### `Tempo.now()` -Returns the current Unix epoch in nanoseconds as a `BigInt`. - -### `Tempo.getSymbol(key?: string | symbol)` -Retrieves or registers a `Symbol` for internal token mapping. - -### `Tempo.ticker(arg1?, arg2?)` -(Plugin required) Creates a reactive stream of `Tempo` instances at regular intervals. -- **Returns:** An `AsyncGenerator` (if no callback) or a `stop` function (if callback provided). -- **See:** [Tempo Ticker Guide](../doc/tempo.ticker.md) for the full polymorphic signature and usage patterns. - -### `Tempo.regexp(layout, snippet?)` -Translates a Tempo layout string into a compiled `RegExp`. - -### `Tempo[Symbol.dispose]()` -Releases the global configuration and resets the library to its initial defaults. Equivalent to calling `Tempo.init()`. - ---- - -## ⚙️ Static Properties - -### `Tempo.config` -Returns the current *global* configuration settings. - -### `Tempo.default` -Returns the *initial* out-of-the-box library defaults. - -### `Tempo.terms` -Returns an array of all currently registered term plugins. - -### `Tempo.parse` -Returns the global parsing rules registry (snippets, layouts, events, etc.). - -### `Tempo.properties` -Returns a list of all public static accessor names on the `Tempo` class. - -### 🔢 Static Enumerators -Access to the internal dictionaries used by Tempo: -- `WEEKDAY` | `WEEKDAYS` -- `MONTH` | `MONTHS` -- `SEASON` | `COMPASS` -- `DURATION` | `DURATIONS` -- `ELEMENT` (Units map) -- `FORMAT` (Registry of pre-defined formats) -- `LIMIT` (Useful boundary dates) - ---- - -## 🚀 Instance Methods - -### `tempo.add(payload: Tempo.DateTime | Tempo.Add, options?: Tempo.Options)` -Returns a **new** `Tempo` instance with the specified duration or date-time payload added. -- **Example:** `t.add({ days: 2 })` or `t.add('tomorrow')` - -### `tempo.set(payload: Tempo.DateTime | Tempo.Set, options?: Tempo.Options)` -Returns a **new** `Tempo` instance with specific values or relative alignments. -- **Example:** `t.set({ month: 5, hh: 12 })` or `t.set({ start: 'month' })` landing on `01-May 00:00:00`. -- **Note (End):** Using `end` with an anchor (e.g., `set({ end: '#qtr' })`) lands on the **Inclusive End** of the period (e.g., `30-Sep 23:59:59.999...`). This follows industry UX expectations for "end-of-period" navigation. -- **Note (Mid):** Using `mid` with an anchor lands on the **Arithmetic Mid-point** (exact nanosecond center) of the period. - -### `tempo.clone()` -Returns a **new**, lean `Tempo` instance based on the current one. It preserves all local configuration but starts a fresh "parse history" (length 1). This is ideal for minimizing memory footprint in long chains or live tickers. - -### `tempo.format(fmt: string)` -Returns a formatted string or number based on the provided token or named format. - -### `tempo.until(until, opts?)` -Calculates the duration until another date-time. -- **Returns:** `number` (if a unit is provided) or a `Tempo.Duration` object. - -### `tempo.since(since?: Tempo.DateTime | Tempo.Options, opts?: Tempo.Options)` -Returns a human-readable relative time string (e.g., "3 days ago"). -- **Returns:** `string` -- **Options:** - - `rtfStyle`: `'long' | 'short' | 'narrow'` (default: `'narrow'`). See `Intl.RelativeTimeFormatStyle`. - - `rtfFormat`: A pre-configured `Intl.RelativeTimeFormat` instance. -- **Example:** - - `t.since('yesterday')` -> `"1d ago"` - - `t.since('yesterday', { rtfStyle: 'long' })` -> `"1 day ago"` - - `t.since(t2, { rtfFormat: new Intl.RelativeTimeFormat('fr') })` -> `"il y a 2 heures"` -- **Performance:** Tempo memoizes `Intl` object creation internally. For maximum performance in high-volume loops, you can pass a pre-allocated `rtfFormat` instance. - -### `tempo.isValid` -Returns `true` if the instance represents a valid date-time. - -### `tempo.toString()` -Returns the ISO 8601 string representation. - -### `tempo.toDate()` -Returns a standard JavaScript `Date` object. - -### `tempo.toDateTime()` -Returns the underlying `Temporal.ZonedDateTime` object. - -### `tempo.toInstant()` -Returns the underlying `Temporal.Instant` object. - -### `tempo.toPlainDate()` -Returns a `Temporal.PlainDate` representation. - -### `tempo.toPlainTime()` -Returns a `Temporal.PlainTime` representation. - -### `tempo.toPlainDateTime()` -Returns a `Temporal.PlainDateTime` representation. - ---- - -## 🔍 Instance Properties - -### Date & Time Accessors -- `yy`: 4-digit year. -- `yw`: 4-digit ISO week-numbering year. -- `mm`: Month (1-12). -- `dd`: Day of month (1-31). -- `ww`: ISO week number (1-53). -- `hh`: Hour (0-23). -- `mi`: Minutes (0-59). -- `ss`: Seconds (0-59). -- `ms`: Milliseconds (0-999). -- `us`: Microseconds (0-999). -- `ns`: Nanoseconds (0-999). -- `ff`: Fractional seconds (decimal). - -### Localization & Context -- `tz`: IANA Time Zone ID. -- `ts`: Unix timestamp (based on `config.timeStamp`). -- `mmm` / `mon`: Short/Full Month name. -- `www` / `wkd`: Short/Full Weekday name. -- `dow`: Day of week number (Mon=1, Sun=7). - -### Lineage & Metadata -- `nano`: Epoch nanoseconds (`BigInt`). -- `epoch`: Object containing `ss`, `ms`, `us`, `ns` epoch values. -- `term`: Object containing results from all active term plugins. (Note: These are enumerable for easy discovery). -- `fmt`: Registry of pre-calculated strings for all standard formats. (Note: These are enumerable for easy discovery). -- `config`: The effective configuration for this specific instance (Note: `scope`, `anchor`, and `value` are excluded from the public object). -- `parse`: The parsing rules and lineage for this instance. - ---- - -::: tip -**Looking for the full technical details?** -For an exhaustive, auto-generated reference of every property, internal type, and class member, see our [Full Technical API Reference](../doc/api/index.md). -::: diff --git a/packages/tempo/archive/tempo.types.md b/packages/tempo/archive/tempo.types.md deleted file mode 100644 index d9437cee..00000000 --- a/packages/tempo/archive/tempo.types.md +++ /dev/null @@ -1,126 +0,0 @@ -# TypeScript Types Reference - -This document provides a reference for the core TypeScript types and interfaces used within the `Tempo` namespace. These types define the valid inputs, configuration options, and manipulation arguments for the library. - -## `Tempo.DateTime` -The primary type used for arguments representing a point in time. `Tempo` is extremely flexible and can interpret a wide range of formats. It also provides methods to extract these back as `Temporal` objects (e.g., `toPlainDate()`, `toInstant()`, etc.). - -```typescript -type DateTime = - | string // ISO strings, relative strings ('next Friday'), etc. - | number // Unix timestamp in milliseconds - | bigint // Unix timestamp in nanoseconds - | Date // Standard JavaScript Date object - | Tempo // Another Tempo instance (cloning) - | Function // Dynamic resolution (max depth 5) - | Temporal.ZonedDateTimeLike // Temporal ZonedDateTime object or property bag - | undefined | null // Interpreted as "now" -``` - -## `Tempo.Options` -Configuration options that can be passed to `Tempo.init()` or the `Tempo` constructor. - -```typescript -interface Options { - timeZone?: string; // IANA zone (e.g., 'UTC', 'America/New_York') or alias - locale?: string; // BCP 47 language tag (e.g., 'en-US', 'en-AU') - calendar?: string; // Calendar system (default: 'iso8601') - pivot?: number; // Cutoff for 2-digit years (default: 75) - debug?: boolean; // Enable internal log tracking - catch?: boolean; // If true, invalid inputs return a Void instance - store?: string; // Key for persistent storage (e.g., localStorage) - sphere?: 'north' | 'south'; // Hemisphere for seasonal plugins - relativeTime?: { format?: Intl.RelativeTimeFormat, style?: 'long' | 'short' | 'narrow' }; - monthDay?: boolean | { active?: boolean, locales?: string[], layouts?: [string, string][], timezones?: Record }; - timeStamp?: 'ms' | 'ns'; // Precision for numeric timestamps - [key: string]: any; // Allows custom configurations shared with plugins -} -``` - -## `Tempo.Add` -Used by the `.add()` method to specify a duration to add or subtract. - -```typescript -type Add = Partial>; - -// Example: -t.add({ days: 5, hours: -2 }); -``` - -## `Tempo.Set` -Used by the `.set()` method to move to a specific unit boundary or date-time alias. - -```typescript -type Set = Partial< - Record<'start' | 'mid' | 'end', Tempo.Unit> & - Record<'date' | 'time' | 'event' | 'period', string> ->; - -// Examples: -t.set({ start: 'month' }); // Start of the month -t.set({ event: 'xmas' }); // Relative or absolute event alias -t.set({ time: '14:30' }); // Specific time string -``` - -## `Tempo.Unit` -Valid date and time unit strings used throughout the API. - -```typescript -type Unit = - | 'year' | 'month' | 'week' | 'day' - | 'hour' | 'minute' | 'second' - | 'millisecond' | 'microsecond' | 'nanosecond' - | 'years' | 'months' | 'weeks' | 'days' // Plurals are also supported - // ... etc. -``` - -## `Tempo.Until` -The argument passed to `.until()` and `.since()`. - -```typescript -type Until = - | (Tempo.Options & { unit?: Tempo.Unit }) - | Tempo.Unit; - -// Examples: -t.until('2025-01-01', 'days'); -t.since('yesterday', { timeZone: 'UTC' }); -``` - -## `Tempo.Discovery` -The contract for global discovery via `Symbol.for($Tempo)`. - -```typescript -interface Discovery { - options?: Options | (() => Options); - timeZones?: Record; - terms?: TermPlugin | TermPlugin[]; - plugin?: Plugin | Plugin[]; - numbers?: Record; - formats?: Record; -} -``` - -## `Tempo.TermPlugin` -The interface for defining custom business-logic plugins. - -```typescript -type TermPlugin = { - key: string; // Short name on t.term (e.g., 'qtr') - scope?: string; // Full name for range object (e.g., 'quarter') - description: string; // Human-readable description - define: (this: Tempo, keyOnly?: boolean) => any; -} -``` - -## `Tempo.TickerOptions` -Advanced configuration for `Tempo.ticker()`. Extends `Temporal.DurationLike` (plural keys only). - -```typescript -type TickerOptions = Partial & { - interval?: number | string | bigint; // Scalar interval (seconds if number) - limit?: number; // Total number of ticks to emit - until?: Tempo.DateTime; // Virtual deadline (inclusive) - seed?: Tempo.DateTime | Tempo.Options; // Starting point for virtual clock -} -``` diff --git a/packages/tempo/doc/1-getting-started/tempo.cookbook.md b/packages/tempo/doc/1-getting-started/tempo.cookbook.md index 4e2117cb..f01fe452 100644 --- a/packages/tempo/doc/1-getting-started/tempo.cookbook.md +++ b/packages/tempo/doc/1-getting-started/tempo.cookbook.md @@ -307,7 +307,7 @@ The examples below use the `using` and `await using` syntax, which require **Typ ### Ticker Plugin The Ticker engine is a premium feature. -👉 **Learn More:** [Ticker Plugin Documentation](https://magmacomputing.github.io/tempo-plugin-docs/ticker/) +👉 **Learn More:** [Ticker Plugin Documentation](../9-plugins/ticker.md) ### Interval-Based Ticker (Recurring Billing) diff --git a/packages/tempo/doc/4-advanced-reference/tempo.ticker.md b/packages/tempo/doc/4-advanced-reference/tempo.ticker.md deleted file mode 100644 index e6055e1a..00000000 --- a/packages/tempo/doc/4-advanced-reference/tempo.ticker.md +++ /dev/null @@ -1,11 +0,0 @@ -# Ticker Plugin - -The **Ticker Plugin** is a high-performance, asynchronous generator extension for Tempo that allows you to schedule, pause, and iterate over temporal intervals (e.g., polling every 5 minutes, or triggering an event every quarter). - -Because it uses advanced JavaScript `AsyncGenerator` patterns and is designed for enterprise-grade scheduling, it has been moved to our **Premium Plugin Registry**. - -## Accessing the Ticker Plugin - -To view the documentation, install the plugin, and generate a license token, please visit the official Tempo Registry: - -**[Explore the Tempo Ticker Plugin ↗](https://registry.magmacomputing.com.au)** diff --git a/packages/tempo/doc/9-plugins/astro.md b/packages/tempo/doc/9-plugins/astro.md index 59b422a8..6278efd6 100644 --- a/packages/tempo/doc/9-plugins/astro.md +++ b/packages/tempo/doc/9-plugins/astro.md @@ -2,9 +2,12 @@ # @magmacomputing/tempo-plugin-astro -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-astro?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-astro/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-astro?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that calculates the exact astronomical season (Equinoxes and Solstices) for any date using the **Jean Meeus polynomial algorithm**. diff --git a/packages/tempo/doc/9-plugins/batch.md b/packages/tempo/doc/9-plugins/batch.md index 6ea8626d..66fbc26f 100644 --- a/packages/tempo/doc/9-plugins/batch.md +++ b/packages/tempo/doc/9-plugins/batch.md @@ -2,9 +2,12 @@ # @magmacomputing/tempo-plugin-batch -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-batch?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-batch) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-batch/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-batch?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-batch) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that parallelizes massive epoch mutation tasks across worker threads utilizing lock-free `SharedArrayBuffer` architecture for extreme throughput. diff --git a/packages/tempo/doc/9-plugins/finance.md b/packages/tempo/doc/9-plugins/finance.md index 10016303..eef53645 100644 --- a/packages/tempo/doc/9-plugins/finance.md +++ b/packages/tempo/doc/9-plugins/finance.md @@ -1,8 +1,11 @@ # @magmacomputing/tempo-plugin-finance -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-finance?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-finance) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-finance/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-finance?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-finance) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
A specialized namespace plugin for Tempo that provides fiscal year and financial date utilities. diff --git a/packages/tempo/doc/9-plugins/snap.md b/packages/tempo/doc/9-plugins/snap.md index 0ba21c70..38988ef9 100644 --- a/packages/tempo/doc/9-plugins/snap.md +++ b/packages/tempo/doc/9-plugins/snap.md @@ -2,9 +2,12 @@ # @magmacomputing/tempo-plugin-snap -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-snap?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-snap) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-snap/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-snap?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-snap) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides robust time rounding and snapping functionality (e.g., snapping to the nearest 15 minutes or 1 hour block) for calendar and scheduling applications. diff --git a/packages/tempo/doc/9-plugins/sync.md b/packages/tempo/doc/9-plugins/sync.md index 4c5865d5..3c097f5e 100644 --- a/packages/tempo/doc/9-plugins/sync.md +++ b/packages/tempo/doc/9-plugins/sync.md @@ -2,9 +2,12 @@ # @magmacomputing/tempo-plugin-sync -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-sync?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-sync) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-sync/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-sync?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-sync) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides lock-free, nanosecond-accurate cross-thread time synchronization using `SharedArrayBuffer` and `Atomics`. diff --git a/packages/tempo/doc/9-plugins/ticker.md b/packages/tempo/doc/9-plugins/ticker.md index 391e0951..bf82ca6b 100644 --- a/packages/tempo/doc/9-plugins/ticker.md +++ b/packages/tempo/doc/9-plugins/ticker.md @@ -2,9 +2,12 @@ # @magmacomputing/tempo-plugin-ticker -[![npm version](https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-ticker?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-ticker) -[![npm peer dependency version](https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-ticker/peer/@magmacomputing/tempo?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo) -[![License](https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-ticker?style=flat-square)](https://www.npmjs.com/package/@magmacomputing/tempo-plugin-ticker) +
+ npm version + npm peer dependency version + License + TypeScript Ready +
This is a premium plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides a high-performance continuous execution loop (Ticker) based on temporal mathematics. diff --git a/packages/tempo/rollup.config.js b/packages/tempo/rollup.config.js index 74805fff..3489bd92 100644 --- a/packages/tempo/rollup.config.js +++ b/packages/tempo/rollup.config.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url'; import alias from '@rollup/plugin-alias'; import resolve from '@rollup/plugin-node-resolve'; -import ts from 'typescript'; +import { transformSync } from 'esbuild'; import terser from '@rollup/plugin-terser'; import JavaScriptObfuscator from 'javascript-obfuscator'; import MagicString from 'magic-string'; @@ -101,29 +101,22 @@ export default [ name: 'manual-typescript', transform(code, id) { if (!id.endsWith('.ts')) return null; - const result = ts.transpileModule(code, { - compilerOptions: { - target: ts.ScriptTarget.ESNext, - module: ts.ModuleKind.ESNext, - moduleResolution: ts.ModuleResolutionKind.NodeJs, - sourceMap: false, - declaration: false - } - }); - - if (result.diagnostics && result.diagnostics.length > 0) { - const formatted = ts.formatDiagnosticsWithColorAndContext(result.diagnostics, { - getCurrentDirectory: () => process.cwd(), - getCanonicalFileName: (fileName) => fileName, - getNewLine: () => ts.sys ? ts.sys.newLine : '\n' + + try { + const result = transformSync(code, { + loader: 'ts', + target: 'esnext', + format: 'esm', + sourcemap: false }); - this.error(`TypeScript compilation failed in ${id}:\n${formatted}`); - } - return { - code: result.outputText, - map: null - }; + return { + code: result.code, + map: null + }; + } catch (err) { + this.error(`esbuild compilation failed in ${id}:\n${err.message}`); + } } }, resolve({ extensions: ['.js', '.ts'], moduleDirectories: ['node_modules'] }), From 74dce33f6902083770df2784874eb282380578f0 Mon Sep 17 00:00:00 2001 From: Michael McRae Date: Wed, 15 Jul 2026 16:50:13 +1000 Subject: [PATCH 09/11] PR final review --- packages/magma-cli/index.js | 1 + packages/plugins/astro/CHANGELOG.md | 5 ++ packages/plugins/astro/README.md | 10 ++-- packages/plugins/astro/doc/index.md | 13 ++--- packages/plugins/astro/package.json | 2 +- packages/plugins/astro/src/index.ts | 9 +++- packages/plugins/astro/test/astro.test.ts | 28 +++++++++- packages/plugins/batch/.turbo/turbo-build.log | 15 ------ packages/plugins/batch/.turbo/turbo-test.log | 53 ------------------- packages/plugins/batch/README.md | 10 ++-- packages/plugins/batch/doc/index.md | 9 ++-- .../plugins/batch/src/BatchOrchestrator.ts | 2 +- packages/plugins/batch/test/batch.test.ts | 2 +- .../plugins/finance/.turbo/turbo-build.log | 17 ------ .../plugins/finance/.turbo/turbo-test.log | 43 --------------- packages/plugins/finance/README.md | 10 ++-- packages/plugins/finance/doc/index.md | 9 ++-- packages/plugins/snap/.turbo/turbo-build.log | 17 ------ packages/plugins/snap/.turbo/turbo-test.log | 48 ----------------- packages/plugins/snap/CHANGELOG.md | 6 +++ packages/plugins/snap/README.md | 10 ++-- packages/plugins/snap/doc/index.md | 9 ++-- packages/plugins/snap/package.json | 2 +- packages/plugins/sync/.turbo/turbo-build.log | 17 ------ packages/plugins/sync/.turbo/turbo-test.log | 36 ------------- packages/plugins/sync/README.md | 10 ++-- packages/plugins/sync/doc/index.md | 9 ++-- packages/plugins/ticker/README.md | 2 +- packages/plugins/ticker/doc/index.md | 9 ++-- packages/tempo/README.md | 12 ++--- packages/tempo/doc/9-plugins/astro.md | 13 ++--- packages/tempo/doc/9-plugins/batch.md | 9 ++-- packages/tempo/doc/9-plugins/finance.md | 9 ++-- packages/tempo/doc/9-plugins/snap.md | 9 ++-- packages/tempo/doc/9-plugins/sync.md | 9 ++-- packages/tempo/doc/9-plugins/ticker.md | 9 ++-- packages/tempo/rollup.config.js | 6 +-- packages/tempo/src/tempo.class.ts | 17 ++++-- 38 files changed, 129 insertions(+), 377 deletions(-) delete mode 100644 packages/plugins/batch/.turbo/turbo-build.log delete mode 100644 packages/plugins/batch/.turbo/turbo-test.log delete mode 100644 packages/plugins/finance/.turbo/turbo-build.log delete mode 100644 packages/plugins/finance/.turbo/turbo-test.log delete mode 100644 packages/plugins/snap/.turbo/turbo-build.log delete mode 100644 packages/plugins/snap/.turbo/turbo-test.log delete mode 100644 packages/plugins/sync/.turbo/turbo-build.log delete mode 100644 packages/plugins/sync/.turbo/turbo-test.log diff --git a/packages/magma-cli/index.js b/packages/magma-cli/index.js index ad5feab6..79ef0824 100755 --- a/packages/magma-cli/index.js +++ b/packages/magma-cli/index.js @@ -12,6 +12,7 @@ if (command === 'rm') { fs.rmSync(fullPath, { recursive: true, force: true }); } catch (err) { console.error(`Failed to remove ${fullPath}:`, err.message); + process.exitCode = 1; } } } else { diff --git a/packages/plugins/astro/CHANGELOG.md b/packages/plugins/astro/CHANGELOG.md index a3991c8e..64544bda 100644 --- a/packages/plugins/astro/CHANGELOG.md +++ b/packages/plugins/astro/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the `@magmacomputing/tempo-plugin-astro` project will be documented in this file. +## [2.1.2] - 2026-07-15 + +### Fixed +- Fixed an issue where the polynomial algorithm could return mathematical garbage for years outside the Jean Meeus limit. It now strictly enforces the `-1000` to `+3000` year bounds by throwing a `RangeError`. + ## [2.1.0] - 2026-07-02 ### Changed diff --git a/packages/plugins/astro/README.md b/packages/plugins/astro/README.md index b968e58c..b8da6d91 100644 --- a/packages/plugins/astro/README.md +++ b/packages/plugins/astro/README.md @@ -2,13 +2,9 @@ # @magmacomputing/tempo-plugin-astro -
- npm version - npm peer dependency version - License - TypeScript Ready - Documentation -
+

+ npm version npm peer dependency version License TypeScript Ready Documentation +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides precise astronomical events (Equinoxes and Solstices) and maps them to traditional season names based on hemisphere. diff --git a/packages/plugins/astro/doc/index.md b/packages/plugins/astro/doc/index.md index 6278efd6..d8371908 100644 --- a/packages/plugins/astro/doc/index.md +++ b/packages/plugins/astro/doc/index.md @@ -2,15 +2,16 @@ # @magmacomputing/tempo-plugin-astro -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that calculates the exact astronomical season (Equinoxes and Solstices) for any date using the **Jean Meeus polynomial algorithm**. +> [!NOTE] +> **Mean-Polynomial Approximation (Ch. 27)** +> This plugin specifically implements the mean-polynomial calculation from Chapter 27 of Meeus' *Astronomical Algorithms*. To keep the library extremely lightweight, it omits the massive periodic correction tables required for exact apparent calculations. It is strictly enforced to support the mathematical range of **-1000 to +3000 AD**. + Because it is a true astronomical calculation rather than a fixed calendar date, it precisely determines the exact minute the sun crosses the celestial equator. It is also **hemisphere-aware**: by configuring your Tempo instance with a `sphere` (e.g., `sphere: 'south'`), the plugin accurately flips the Vernal Equinox from Spring to Autumn. ::: info Meteorological vs Astronomical diff --git a/packages/plugins/astro/package.json b/packages/plugins/astro/package.json index e0f90f9b..0fb82d0c 100644 --- a/packages/plugins/astro/package.json +++ b/packages/plugins/astro/package.json @@ -1,6 +1,6 @@ { "name": "@magmacomputing/tempo-plugin-astro", - "version": "2.1.1", + "version": "2.1.2", "description": "Tempo plugin that calculates precise astronomical seasons (solstices & equinoxes) using the Jean Meeus algorithm — hemisphere-aware, sub-minute accuracy", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/plugins/astro/src/index.ts b/packages/plugins/astro/src/index.ts index 9a8cce00..240fc651 100644 --- a/packages/plugins/astro/src/index.ts +++ b/packages/plugins/astro/src/index.ts @@ -35,9 +35,16 @@ const scope = 'astronomy'; /** * ## calculateAstroMoment - * Polynomial approximation for Equinoxes and Solstices (Jean Meeus algorithm). + * Polynomial approximation for Equinoxes and Solstices (Jean Meeus algorithm, Ch 27). + * Supported year range: -1000 to +3000. + * + * NOTE: This is a mean-polynomial approximation that does not include the + * periodic higher-order terms for exact apparent calculations. */ function calculateAstroMoment(year: number, quarter: ASTRO, timeZone: string) { + if (year < -1000 || year > 3000) + throw new RangeError(`AstroTerm: Year ${year} is outside the supported Meeus calculation range (-1000 to +3000).`); + const y = (year - 2_000) / 1_000; let jde: number; diff --git a/packages/plugins/astro/test/astro.test.ts b/packages/plugins/astro/test/astro.test.ts index ea216cd7..871b9f0d 100644 --- a/packages/plugins/astro/test/astro.test.ts +++ b/packages/plugins/astro/test/astro.test.ts @@ -1,11 +1,12 @@ -import { Tempo } from '@magmacomputing/tempo/core'; +import { Tempo } from '@magmacomputing/tempo'; import { ParseModule } from '@magmacomputing/tempo/parse'; import { AstroTerm } from '../src/index.js'; describe('Astro Plugin (Term Implementation)', () => { beforeEach(() => { - Tempo.init({ plugins: [ParseModule, AstroTerm] }); + // Bypass monorepo dual-package (src vs dist) type hazard for test plugins + Tempo.init({ plugins: [ParseModule as any, AstroTerm as any] }); }); it('should register "astro" and "astronomy" terms', () => { @@ -61,4 +62,27 @@ describe('Astro Plugin (Term Implementation)', () => { expect(tempo.term.astro).toBe('Winter'); }); }); + + describe('Meeus Range Enforcement', () => { + + it('should succeed for boundary year -999 (which evaluates -1000)', () => { + const tempo = new Tempo(undefined, { timeZone: 'UTC', sphere: 'north' }).set({ yy: -999, mm: 1, dd: 1 }); + expect(() => tempo.term.astro).not.toThrow(); + }); + + it('should succeed for boundary year 2999 (which evaluates 3000)', () => { + const tempo = new Tempo(undefined, { timeZone: 'UTC', sphere: 'north' }).set({ yy: 2999, mm: 1, dd: 1 }); + expect(() => tempo.term.astro).not.toThrow(); + }); + + it('should throw RangeError for year outside the lower bounds (-1000 evaluates -1001)', () => { + const tempo = new Tempo(undefined, { timeZone: 'UTC', sphere: 'north' }).set({ yy: -1000, mm: 1, dd: 1 }); + expect(() => tempo.term.astro).toThrow(/supported Meeus calculation range/); + }); + + it('should throw RangeError for year outside the upper bounds (3000 evaluates 3001)', () => { + const tempo = new Tempo(undefined, { timeZone: 'UTC', sphere: 'north' }).set({ yy: 3000, mm: 1, dd: 1 }); + expect(() => tempo.term.astro).toThrow(/supported Meeus calculation range/); + }); + }); }); diff --git a/packages/plugins/batch/.turbo/turbo-build.log b/packages/plugins/batch/.turbo/turbo-build.log deleted file mode 100644 index 49a511b6..00000000 --- a/packages/plugins/batch/.turbo/turbo-build.log +++ /dev/null @@ -1,15 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 build -npm notice run tsup && tsc -CLI Building entry: src/index.ts, src/worker.ts -CLI Using tsconfig: tsconfig.json -CLI tsup v8.5.1 -CLI Using tsup config: /mnt/data/michael/Project/tempo-workspace/packages/batch/tsup.config.ts -CLI Target: esnext -CLI Cleaning output folder -ESM Build start -ESM dist/index.js 5.59 KB -ESM dist/worker.js 1.13 KB -ESM ⚡️ Build success in 37ms -⠙npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 postbuild -⠙npm notice run rm -rf dist/src -⠙⠙ diff --git a/packages/plugins/batch/.turbo/turbo-test.log b/packages/plugins/batch/.turbo/turbo-test.log deleted file mode 100644 index 4b7a5e13..00000000 --- a/packages/plugins/batch/.turbo/turbo-test.log +++ /dev/null @@ -1,53 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 pretest -npm notice run npm run build -npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 build -npm notice run tsup && tsc -CLI Building entry: src/index.ts, src/worker.ts -CLI Using tsconfig: tsconfig.json -CLI tsup v8.5.1 -CLI Using tsup config: /mnt/data/michael/Project/tempo-workspace/packages/batch/tsup.config.ts -CLI Target: esnext -CLI Cleaning output folder -ESM Build start -ESM dist/index.js 5.59 KB -ESM dist/worker.js 1.13 KB -ESM ⚡️ Build success in 50ms -⠙npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 postbuild -⠙npm notice run rm -rf dist/src -⠙⠙⠙npm notice run @magmacomputing/tempo-plugin-batch@1.0.0 test -⠙npm notice run vitest run -c ../../test/vitest.community.ts -⠙[?25l - RUN  v4.1.10 /mnt/data/michael/Project/tempo-workspace/packages/batch - -[?2026h - ❯  Community Edition  test/batch.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:58 - Duration 101ms -[?2026l[?2026h - ❯  Community Edition  test/batch.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:58 - Duration 902ms -[?2026l[?2026h - ❯  Community Edition  test/batch.test.ts 1/2 - - Test Files 0 passed (1) - Tests 1 passed (2) - Start at 11:55:58 - Duration 1.10s -[?2026l ✓  Community Edition  test/batch.test.ts (2 tests | 1 todo) 8ms - ✓ Batch Plugin (2) - ✓ should successfully register the Tempo.batch namespace 4ms - □ should successfully orchestrate a batch mutation (Requires Node 26+ native Temporal) - - Test Files  1 passed (1) - Tests  1 passed | 1 todo (2) - Start at  11:55:58 - Duration  1.11s (transform 626ms, setup 91ms, import 844ms, tests 8ms, environment 0ms) - -[?25h⠙ diff --git a/packages/plugins/batch/README.md b/packages/plugins/batch/README.md index f10edc3c..bfd5bca0 100644 --- a/packages/plugins/batch/README.md +++ b/packages/plugins/batch/README.md @@ -2,13 +2,9 @@ # @magmacomputing/tempo-plugin-batch -
- npm version - npm peer dependency version - License - TypeScript Ready - Documentation -
+

+ npm version npm peer dependency version License TypeScript Ready Documentation +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that parallelizes massive epoch mutation tasks across worker threads utilizing lock-free `SharedArrayBuffer` architecture for extreme throughput. diff --git a/packages/plugins/batch/doc/index.md b/packages/plugins/batch/doc/index.md index 66fbc26f..628f2c69 100644 --- a/packages/plugins/batch/doc/index.md +++ b/packages/plugins/batch/doc/index.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-batch -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that parallelizes massive epoch mutation tasks across worker threads utilizing lock-free `SharedArrayBuffer` architecture for extreme throughput. diff --git a/packages/plugins/batch/src/BatchOrchestrator.ts b/packages/plugins/batch/src/BatchOrchestrator.ts index 4a0bb049..c06d8743 100644 --- a/packages/plugins/batch/src/BatchOrchestrator.ts +++ b/packages/plugins/batch/src/BatchOrchestrator.ts @@ -14,6 +14,7 @@ export interface BatchOptions { * Number of threads to use. Defaults to the number of logical CPUs. */ threads?: number; + rehydrate?: boolean; } /** @@ -100,7 +101,6 @@ export class BatchOrchestrator { result[i] = outputView[i]; } - // (Optional) Rehydrate logic would go here if options.rehydrate === true return result; } diff --git a/packages/plugins/batch/test/batch.test.ts b/packages/plugins/batch/test/batch.test.ts index deecbe16..c20cd363 100644 --- a/packages/plugins/batch/test/batch.test.ts +++ b/packages/plugins/batch/test/batch.test.ts @@ -13,7 +13,7 @@ describe('Batch Plugin', () => { const epochs = [startEpoch, startEpoch + 1000]; // This will crash on Node 24 because the spawned worker isolate lacks the JS polyfill - const result = await (Tempo as any).batch(epochs, 'add', { weeks: 1 }); + const result = await (Tempo as any).batch(epochs, '+1w', { weeks: 1 }); expect(result).toHaveLength(2); }); diff --git a/packages/plugins/finance/.turbo/turbo-build.log b/packages/plugins/finance/.turbo/turbo-build.log deleted file mode 100644 index 017f1c32..00000000 --- a/packages/plugins/finance/.turbo/turbo-build.log +++ /dev/null @@ -1,17 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-finance@1.0.0 build -npm notice run tsup && tsc -CLI Building entry: src/index.ts -CLI Using tsconfig: tsconfig.json -CLI tsup v8.5.1 -CLI Using tsup config: /mnt/data/michael/Project/tempo-workspace/packages/finance/tsup.config.ts -CLI Target: esnext -CLI Cleaning output folder -ESM Build start -IIFE Build start -ESM dist/index.js 1.53 KB -ESM ⚡️ Build success in 52ms -IIFE dist/index.global.min.js 1.13 KB -IIFE ⚡️ Build success in 64ms -⠙npm notice run @magmacomputing/tempo-plugin-finance@1.0.0 postbuild -⠙npm notice run rm -rf dist/src -⠙⠙ diff --git a/packages/plugins/finance/.turbo/turbo-test.log b/packages/plugins/finance/.turbo/turbo-test.log deleted file mode 100644 index 44583a2d..00000000 --- a/packages/plugins/finance/.turbo/turbo-test.log +++ /dev/null @@ -1,43 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-finance@1.0.0 test -npm notice run vitest run -c ../../test/vitest.community.ts -[?25l - RUN  v4.1.10 /mnt/data/michael/Project/tempo-workspace/packages/finance - -[?2026h - ❯  Community Edition  test/finance.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 403ms -[?2026l[?2026h - ❯  Community Edition  test/finance.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 972ms -[?2026l[?2026h - ❯  Community Edition  test/finance.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 1.99s -[?2026l[?2026h - ❯  Community Edition  test/finance.test.ts 1/1 - - Test Files 0 passed (1) - Tests 1 passed (1) - Start at 11:55:53 - Duration 2.09s -[?2026l ✓  Community Edition  test/finance.test.ts (1 test) 83ms - ✓ Finance Namespace (1) - ✓ should lazy load the finance properties 77ms - - Test Files  1 passed (1) - Tests  1 passed (1) - Start at  11:55:53 - Duration  2.20s (transform 1.13s, setup 151ms, import 1.53s, tests 83ms, environment 0ms) - -[?25h⠙ diff --git a/packages/plugins/finance/README.md b/packages/plugins/finance/README.md index 5fb4b49d..097e2b5e 100644 --- a/packages/plugins/finance/README.md +++ b/packages/plugins/finance/README.md @@ -1,12 +1,8 @@ # @magmacomputing/tempo-plugin-finance -
- npm version - npm peer dependency version - License - TypeScript Ready - Documentation -
+

+ npm version npm peer dependency version License TypeScript Ready Documentation +

A specialized namespace plugin for Tempo that provides fiscal year and financial date utilities. diff --git a/packages/plugins/finance/doc/index.md b/packages/plugins/finance/doc/index.md index eef53645..067a7f14 100644 --- a/packages/plugins/finance/doc/index.md +++ b/packages/plugins/finance/doc/index.md @@ -1,11 +1,8 @@ # @magmacomputing/tempo-plugin-finance -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

A specialized namespace plugin for Tempo that provides fiscal year and financial date utilities. diff --git a/packages/plugins/snap/.turbo/turbo-build.log b/packages/plugins/snap/.turbo/turbo-build.log deleted file mode 100644 index 280fc181..00000000 --- a/packages/plugins/snap/.turbo/turbo-build.log +++ /dev/null @@ -1,17 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-snap@1.3.0 build -npm notice run tsup && tsc -CLI Building entry: src/index.ts -CLI Using tsconfig: tsconfig.json -CLI tsup v8.5.1 -CLI Using tsup config: /mnt/data/michael/Project/tempo-workspace/packages/snap/tsup.config.ts -CLI Target: esnext -CLI Cleaning output folder -ESM Build start -IIFE Build start -IIFE dist/index.global.min.js 2.77 KB -IIFE ⚡️ Build success in 16ms -ESM dist/index.js 5.40 KB -ESM ⚡️ Build success in 16ms -⠙npm notice run @magmacomputing/tempo-plugin-snap@1.3.0 postbuild -⠙npm notice run rm -rf dist/src -⠙⠙ diff --git a/packages/plugins/snap/.turbo/turbo-test.log b/packages/plugins/snap/.turbo/turbo-test.log deleted file mode 100644 index 5af92b63..00000000 --- a/packages/plugins/snap/.turbo/turbo-test.log +++ /dev/null @@ -1,48 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-snap@1.3.0 test -npm notice run vitest run -c ../../test/vitest.community.ts -[?25l - RUN  v4.1.10 /mnt/data/michael/Project/tempo-workspace/packages/snap - -[?2026h - ❯  Community Edition  test/snap.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 402ms -[?2026l[?2026h - ❯  Community Edition  test/snap.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 984ms -[?2026l[?2026h - ❯  Community Edition  test/snap.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 1.99s -[?2026l[?2026h - ❯  Community Edition  test/snap.test.ts 1/6 - - Test Files 0 passed (1) - Tests 1 passed (6) - Start at 11:55:53 - Duration 2.19s -[?2026l ✓  Community Edition  test/snap.test.ts (6 tests) 130ms - ✓ Snap Plugin (6) - ✓ should snap to the nearest 15 minutes 51ms - ✓ should support long-form aliases (e.g. minutes) 16ms - ✓ should support directional snapping (up and down) 29ms - ✓ should support sub-second snapping (milliseconds) 20ms - ✓ should throw an error if multiple time components are provided 3ms - ✓ should throw an error if date components or invalid keys are provided 2ms - - Test Files  1 passed (1) - Tests  6 passed (6) - Start at  11:55:53 - Duration  2.24s (transform 1.10s, setup 148ms, import 1.47s, tests 130ms, environment 2ms) - -[?25h⠙ diff --git a/packages/plugins/snap/CHANGELOG.md b/packages/plugins/snap/CHANGELOG.md index dc4d9c2b..03ae0863 100644 --- a/packages/plugins/snap/CHANGELOG.md +++ b/packages/plugins/snap/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2026-07-15 + +### Fixed +- **Sub-Second Precision Math**: The fractional rounding algorithm now accurately factors in all lower-level active components (e.g., nanoseconds now properly drift into milliseconds) for perfect precision. +- **Safety Enforcer**: Added strict checks against `NaN` and `Infinity` inputs via `Number.isFinite()` to prevent infinite loops and math corruption. + ## [1.3.0] - 2026-07-08 ### Added diff --git a/packages/plugins/snap/README.md b/packages/plugins/snap/README.md index 07e49ea4..fef6579f 100644 --- a/packages/plugins/snap/README.md +++ b/packages/plugins/snap/README.md @@ -2,13 +2,9 @@ # @magmacomputing/tempo-plugin-snap -
- npm version - npm peer dependency version - License - TypeScript Ready - Documentation -
+

+ npm version npm peer dependency version License TypeScript Ready Documentation +

A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides robust time rounding and snapping functionality (e.g. snapping to the nearest 15 minutes or 1 hour block) for calendar and scheduling applications. diff --git a/packages/plugins/snap/doc/index.md b/packages/plugins/snap/doc/index.md index 38988ef9..d167810a 100644 --- a/packages/plugins/snap/doc/index.md +++ b/packages/plugins/snap/doc/index.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-snap -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides robust time rounding and snapping functionality (e.g., snapping to the nearest 15 minutes or 1 hour block) for calendar and scheduling applications. diff --git a/packages/plugins/snap/package.json b/packages/plugins/snap/package.json index 28b91c12..7d60cac4 100644 --- a/packages/plugins/snap/package.json +++ b/packages/plugins/snap/package.json @@ -1,6 +1,6 @@ { "name": "@magmacomputing/tempo-plugin-snap", - "version": "1.3.0", + "version": "1.3.1", "description": "Snap time to blocks", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/plugins/sync/.turbo/turbo-build.log b/packages/plugins/sync/.turbo/turbo-build.log deleted file mode 100644 index 680a5e8b..00000000 --- a/packages/plugins/sync/.turbo/turbo-build.log +++ /dev/null @@ -1,17 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-sync@1.0.0 build -npm notice run tsup && tsc -CLI Building entry: src/index.ts -CLI Using tsconfig: tsconfig.json -CLI tsup v8.5.1 -CLI Using tsup config: /mnt/data/michael/Project/tempo-workspace/packages/sync/tsup.config.ts -CLI Target: esnext -CLI Cleaning output folder -ESM Build start -IIFE Build start -IIFE dist/index.global.min.js 2.69 KB -IIFE ⚡️ Build success in 36ms -ESM dist/index.js 5.11 KB -ESM ⚡️ Build success in 37ms -⠙npm notice run @magmacomputing/tempo-plugin-sync@1.0.0 postbuild -⠙npm notice run rm -rf dist/src -⠙⠙ diff --git a/packages/plugins/sync/.turbo/turbo-test.log b/packages/plugins/sync/.turbo/turbo-test.log deleted file mode 100644 index 7105486a..00000000 --- a/packages/plugins/sync/.turbo/turbo-test.log +++ /dev/null @@ -1,36 +0,0 @@ -npm notice run @magmacomputing/tempo-plugin-sync@1.0.0 test -npm notice run vitest run -c ../../test/vitest.community.ts -[?25l - RUN  v4.1.10 /mnt/data/michael/Project/tempo-workspace/packages/sync - -[?2026h - ❯  Community Edition  test/sync.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 400ms -[?2026l[?2026h - ❯  Community Edition  test/sync.test.ts [queued] - - Test Files 0 passed (1) - Tests 0 passed (0) - Start at 11:55:53 - Duration 974ms -[?2026l[?2026h - ❯  Community Edition  test/sync.test.ts 0/1 - - Test Files 0 passed (1) - Tests 0 passed (1) - Start at 11:55:53 - Duration 1.92s -[?2026l ✓  Community Edition  test/sync.test.ts (1 test) 62ms - ✓ Atomic Sync Plugin (1) - ✓ should synchronize time across SAB via AtomicReader 52ms - - Test Files  1 passed (1) - Tests  1 passed (1) - Start at  11:55:53 - Duration  2.05s (transform 1.09s, setup 179ms, import 1.38s, tests 62ms, environment 0ms) - -[?25h⠙ diff --git a/packages/plugins/sync/README.md b/packages/plugins/sync/README.md index a8f6de8d..c5df326e 100644 --- a/packages/plugins/sync/README.md +++ b/packages/plugins/sync/README.md @@ -2,13 +2,9 @@ # @magmacomputing/tempo-plugin-sync -
- npm version - npm peer dependency version - License - TypeScript Ready - Documentation -
+

+ npm version npm peer dependency version License TypeScript Ready Documentation +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides lock-free, nanosecond-accurate cross-thread time synchronization using `SharedArrayBuffer` and `Atomics`. diff --git a/packages/plugins/sync/doc/index.md b/packages/plugins/sync/doc/index.md index 3c097f5e..7cea6e96 100644 --- a/packages/plugins/sync/doc/index.md +++ b/packages/plugins/sync/doc/index.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-sync -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides lock-free, nanosecond-accurate cross-thread time synchronization using `SharedArrayBuffer` and `Atomics`. diff --git a/packages/plugins/ticker/README.md b/packages/plugins/ticker/README.md index 9268b6ad..039021a4 100644 --- a/packages/plugins/ticker/README.md +++ b/packages/plugins/ticker/README.md @@ -20,5 +20,5 @@ This directory exists solely so that the monorepo's documentation generation pip
👉 Go to the Tempo License Registry 👈
Manage your subscriptions and retrieve your license key. -
+
diff --git a/packages/plugins/ticker/doc/index.md b/packages/plugins/ticker/doc/index.md index bf82ca6b..daf5c54a 100644 --- a/packages/plugins/ticker/doc/index.md +++ b/packages/plugins/ticker/doc/index.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-ticker -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a premium plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides a high-performance continuous execution loop (Ticker) based on temporal mathematics. diff --git a/packages/tempo/README.md b/packages/tempo/README.md index cb621ed7..16363c07 100644 --- a/packages/tempo/README.md +++ b/packages/tempo/README.md @@ -16,15 +16,9 @@ **Tempo** is a premium, high-performance wrapper for the ECMAScript `Temporal` API. Designed for professionals, it combines **immutable** state-management with a **fluent**, natural-language engine. It is the modern, type-safe successor to legacy libraries like Moment.js and Luxon. - -
- License: MIT - Temporal - TypeScript Ready - Native ESM - Documentation - Open in StackBlitz -
+

+ License: MIT Temporal TypeScript Ready Native ESM Documentation Open in StackBlitz +

--- diff --git a/packages/tempo/doc/9-plugins/astro.md b/packages/tempo/doc/9-plugins/astro.md index 6278efd6..d8371908 100644 --- a/packages/tempo/doc/9-plugins/astro.md +++ b/packages/tempo/doc/9-plugins/astro.md @@ -2,15 +2,16 @@ # @magmacomputing/tempo-plugin-astro -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that calculates the exact astronomical season (Equinoxes and Solstices) for any date using the **Jean Meeus polynomial algorithm**. +> [!NOTE] +> **Mean-Polynomial Approximation (Ch. 27)** +> This plugin specifically implements the mean-polynomial calculation from Chapter 27 of Meeus' *Astronomical Algorithms*. To keep the library extremely lightweight, it omits the massive periodic correction tables required for exact apparent calculations. It is strictly enforced to support the mathematical range of **-1000 to +3000 AD**. + Because it is a true astronomical calculation rather than a fixed calendar date, it precisely determines the exact minute the sun crosses the celestial equator. It is also **hemisphere-aware**: by configuring your Tempo instance with a `sphere` (e.g., `sphere: 'south'`), the plugin accurately flips the Vernal Equinox from Spring to Autumn. ::: info Meteorological vs Astronomical diff --git a/packages/tempo/doc/9-plugins/batch.md b/packages/tempo/doc/9-plugins/batch.md index 66fbc26f..628f2c69 100644 --- a/packages/tempo/doc/9-plugins/batch.md +++ b/packages/tempo/doc/9-plugins/batch.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-batch -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that parallelizes massive epoch mutation tasks across worker threads utilizing lock-free `SharedArrayBuffer` architecture for extreme throughput. diff --git a/packages/tempo/doc/9-plugins/finance.md b/packages/tempo/doc/9-plugins/finance.md index eef53645..067a7f14 100644 --- a/packages/tempo/doc/9-plugins/finance.md +++ b/packages/tempo/doc/9-plugins/finance.md @@ -1,11 +1,8 @@ # @magmacomputing/tempo-plugin-finance -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

A specialized namespace plugin for Tempo that provides fiscal year and financial date utilities. diff --git a/packages/tempo/doc/9-plugins/snap.md b/packages/tempo/doc/9-plugins/snap.md index 38988ef9..d167810a 100644 --- a/packages/tempo/doc/9-plugins/snap.md +++ b/packages/tempo/doc/9-plugins/snap.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-snap -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides robust time rounding and snapping functionality (e.g., snapping to the nearest 15 minutes or 1 hour block) for calendar and scheduling applications. diff --git a/packages/tempo/doc/9-plugins/sync.md b/packages/tempo/doc/9-plugins/sync.md index 3c097f5e..7cea6e96 100644 --- a/packages/tempo/doc/9-plugins/sync.md +++ b/packages/tempo/doc/9-plugins/sync.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-sync -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides lock-free, nanosecond-accurate cross-thread time synchronization using `SharedArrayBuffer` and `Atomics`. diff --git a/packages/tempo/doc/9-plugins/ticker.md b/packages/tempo/doc/9-plugins/ticker.md index bf82ca6b..daf5c54a 100644 --- a/packages/tempo/doc/9-plugins/ticker.md +++ b/packages/tempo/doc/9-plugins/ticker.md @@ -2,12 +2,9 @@ # @magmacomputing/tempo-plugin-ticker -
- npm version - npm peer dependency version - License - TypeScript Ready -
+

+ npm version npm peer dependency version License TypeScript Ready +

This is a premium plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides a high-performance continuous execution loop (Ticker) based on temporal mathematics. diff --git a/packages/tempo/rollup.config.js b/packages/tempo/rollup.config.js index 3489bd92..8e302fec 100644 --- a/packages/tempo/rollup.config.js +++ b/packages/tempo/rollup.config.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url'; import alias from '@rollup/plugin-alias'; import resolve from '@rollup/plugin-node-resolve'; -import { transformSync } from 'esbuild'; +import { transform } from 'esbuild'; import terser from '@rollup/plugin-terser'; import JavaScriptObfuscator from 'javascript-obfuscator'; import MagicString from 'magic-string'; @@ -99,11 +99,11 @@ export default [ plugins: [ { name: 'manual-typescript', - transform(code, id) { + async transform(code, id) { if (!id.endsWith('.ts')) return null; try { - const result = transformSync(code, { + const result = await transform(code, { loader: 'ts', target: 'esnext', format: 'esm', diff --git a/packages/tempo/src/tempo.class.ts b/packages/tempo/src/tempo.class.ts index 90ede4f8..bfb9f7ad 100644 --- a/packages/tempo/src/tempo.class.ts +++ b/packages/tempo/src/tempo.class.ts @@ -1625,10 +1625,19 @@ export class Tempo { */ /** @internal */ get #Tempo() { return this.constructor as typeof Tempo; } - /** apply a custom format. */ format(fmt: K, options?: any) { return this.#resolve(() => interpret(this, 'FormatModule', () => `{${String(fmt)}}`, false, fmt, options)); } - - /** time duration until another date-time */ until(arg0?: any, arg1?: any): any { return this.#resolve(() => interpret(this, 'DurationModule', undefined, false, 'until', arg0, arg1) ?? this); } - /** time elapsed since another date-time */ since(arg0?: any, arg1?: any): any { return this.#resolve(() => interpret(this, 'DurationModule', undefined, false, 'since', arg0, arg1) ?? this); } + /** apply a custom format. */ format(fmt?: any, options?: any): any { return this.#resolve(() => interpret(this, 'FormatModule', () => `{${String(fmt)}}`, false, fmt, options)); } + + /** time duration until another date-time */ + until(dateTimeOrOpts?: t.DateTime | t.Options, opts?: t.Options): t.Duration; + until(unit: t.Unit, opts?: t.Options): number; + until(dateTimeOrOpts: t.DateTime | t.Options, unit: t.Unit): number; + until(arg0?: any, arg1?: any): any { return this.#resolve(() => interpret(this, 'DurationModule', undefined, false, 'until', arg0, arg1) ?? this); } + + /** time elapsed since another date-time */ + since(dateTimeOrOpts?: t.DateTime | t.Options, opts?: t.Options): t.Duration; + since(unit: t.Unit, opts?: t.Options): number; + since(dateTimeOrOpts: t.DateTime | t.Options, unit: t.Unit): number; + since(arg0?: any, arg1?: any): any { return this.#resolve(() => interpret(this, 'DurationModule', undefined, false, 'since', arg0, arg1) ?? this); } /** returns a new `Tempo` with specific duration added. */add(tempo?: t.MutateAdd, options?: t.Options): Tempo { return this.#resolve(() => interpret(this, 'MutateModule', 'add', false, tempo, options) ?? this); } /** returns a new `Tempo` with specific offsets. */ set(tempo?: t.MutateSet, options?: t.Options): Tempo { return this.#resolve(() => interpret(this, 'MutateModule', 'set', false, tempo, options) ?? this); } From e47574aebe49f61121165e55ccddab95154bf90b Mon Sep 17 00:00:00 2001 From: Michael McRae Date: Wed, 15 Jul 2026 17:02:31 +1000 Subject: [PATCH 10/11] README badges --- packages/tempo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tempo/README.md b/packages/tempo/README.md index 16363c07..23603de7 100644 --- a/packages/tempo/README.md +++ b/packages/tempo/README.md @@ -17,7 +17,7 @@

- License: MIT Temporal TypeScript Ready Native ESM Documentation Open in StackBlitz + npm version License: MIT Temporal TypeScript Ready Native ESM Documentation Open in StackBlitz

From 748c03eba8179bc2157cedd9967a3d8c4a371a28 Mon Sep 17 00:00:00 2001 From: Michael McRae Date: Thu, 16 Jul 2026 07:05:19 +1000 Subject: [PATCH 11/11] CHANGELOG --- CHANGELOG.md | 4 ++++ packages/tempo/CHANGELOG.md | 6 ++++++ packages/tempo/doc/8-project-and-support/releases/v3.x.md | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89e245b6..a32dbe01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Documentation Alignment**: Cleaned up `tempo.config.md` to remove deprecated module references, perfectly aligning examples with the `tempo-workspace` ecosystem (`FinancePlugin` and `AstroTerm`). - **Getter Documentation**: Created `tempo.getters.md` as the definitive, educational conceptual guide for utilizing Tempo's zero-cost evaluation getters. +### Fixed +- **Core Typings**: Resolved `any` leakage in `Tempo` core methods by injecting strict overloads for `until()` and `since()` directly into `tempo.class.ts`, ensuring full IDE type-inference flows through to `.format()`. +- **Documentation Badges**: Standardized the Shields.io badge layout across the monorepo to use `

` tags with `inline-block` styling, fixing horizontal alignment issues caused by VitePress CSS overrides and eliminating malformed HTML `` hydration errors. + ## [3.8.0] - 2026-07-11 ### Fixed diff --git a/packages/tempo/CHANGELOG.md b/packages/tempo/CHANGELOG.md index 89e245b6..28ad2857 100644 --- a/packages/tempo/CHANGELOG.md +++ b/packages/tempo/CHANGELOG.md @@ -17,6 +17,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Documentation Alignment**: Cleaned up `tempo.config.md` to remove deprecated module references, perfectly aligning examples with the `tempo-workspace` ecosystem (`FinancePlugin` and `AstroTerm`). - **Getter Documentation**: Created `tempo.getters.md` as the definitive, educational conceptual guide for utilizing Tempo's zero-cost evaluation getters. +### Fixed +- **Core Typings**: Resolved `any` leakage in `Tempo` core methods by injecting strict overloads for `until()` and `since()` directly into `tempo.class.ts`, ensuring full IDE type-inference flows through to `.format()`. +- **Documentation Badges**: Standardized the Shields.io badge layout across the monorepo to use `

` tags with `inline-block` styling, fixing horizontal alignment issues caused by VitePress CSS overrides and eliminating malformed HTML `

` hydration errors. +- **Vue Compiler Hydration**: Fixed a rogue unclosed `

` tag in the Ticker plugin documentation that was silently causing downstream Vue SFC parsing errors during VitePress compilation. +- **CLI Pipeline**: Validated the `magma-cli` build pipeline to correctly propagate non-zero exit codes during workspace orchestration operations, preventing silent failures. + ## [3.8.0] - 2026-07-11 ### Fixed diff --git a/packages/tempo/doc/8-project-and-support/releases/v3.x.md b/packages/tempo/doc/8-project-and-support/releases/v3.x.md index 86a16fea..a70214ee 100644 --- a/packages/tempo/doc/8-project-and-support/releases/v3.x.md +++ b/packages/tempo/doc/8-project-and-support/releases/v3.x.md @@ -14,6 +14,12 @@ Expanded the `{h12}` token modifiers with a new `:space` option. When chaining m - **Educational Guides**: Created a brand new `tempo.getters.md` document in the Core Concepts section, serving as the definitive guide to Tempo's zero-cost lazy-evaluation properties. - **Ecosystem Alignment**: Updated `tempo.config.md` to remove deprecated plugin references, replacing them with accurate examples from the current `tempo-workspace` (`FinancePlugin` and `AstroTerm`). +### 🪲 Bug Fixes & Stability +- **Core Typings**: Resolved `any` leakage in `Tempo` core methods by injecting strict overloads for `until()` and `since()` directly into `tempo.class.ts`, ensuring full IDE type-inference flows through to `.format()`. +- **Documentation Badges**: Standardized the Shields.io badge layout across the monorepo to use `

` tags with `inline-block` styling, fixing horizontal alignment issues caused by VitePress CSS overrides and eliminating malformed HTML `

` hydration errors. +- **Vue Compiler Hydration**: Fixed a rogue unclosed `

` tag in the Ticker plugin documentation that was silently causing downstream Vue SFC parsing errors during VitePress compilation. +- **CLI Pipeline**: Validated the `magma-cli` build pipeline to correctly propagate non-zero exit codes during workspace orchestration operations, preventing silent failures. + --- ## [v3.8.0] - 2026-07-11