-
Notifications
You must be signed in to change notification settings - Fork 0
Introduce TempoRuntime: consolidate globalThis inter-module state into a single hardened bridge #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
8c9c57e
d130cc2
83d1b2a
f4b02dc
674a754
3e10812
822bae0
ddc768e
a10aa23
1ff0d03
12fabbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { asString } from '#library/coercion.library.js'; | ||
| import { extract, ownEntries } from '#library/primitive.library.js'; | ||
| import { stringify } from '#library/serialize.library.js'; | ||
| import { isNumber, isDate, isTempo, isObject, isDefined, isUndefined, isFunction, nullToValue } from '#library/type.library.js'; | ||
| import { isNumber, isDate, isObject, isDefined, isUndefined, isFunction, nullToValue } from '#library/type.library.js'; | ||
| import type { Property } from '#library/type.library.js'; | ||
|
|
||
| // adapted from https://jsbin.com/insert/4/edit?js,output | ||
|
|
@@ -54,7 +54,7 @@ export function sortBy<T extends Property<T>>(...keys: (PropertyKey | SortBy)[]) | |
| switch (true) { | ||
| case isNumber(valueA) && isNumber(valueB): | ||
| case isDate(valueA) && isDate(valueB): | ||
| case isTempo(valueA) && isTempo(valueB): | ||
| case isObject(valueA) && isObject(valueB) && typeof valueA.valueOf() === 'number': | ||
| result = dir * (valueA - valueB); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Asymmetric The new branch only verifies 🛡️ Proposed fix- case isObject(valueA) && isObject(valueB) && typeof valueA.valueOf() === 'number':
+ case isObject(valueA) && isObject(valueB)
+ && typeof valueA.valueOf() === 'number'
+ && typeof valueB.valueOf() === 'number':
result = dir * (valueA - valueB);
break;🤖 Prompt for AI Agents |
||
| break; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,8 @@ | ||||||||||||
| import { Tempo, enums } from '#tempo/core'; | ||||||||||||
| import { stringify, objectify, enumify, getType } from '#library'; | ||||||||||||
| import { Token, Snippet } from '#tempo/tempo.default.js'; | ||||||||||||
| import { stringify, objectify, enumify, getType, Pledge } from '#library'; | ||||||||||||
|
|
||||||||||||
| // Pre-load Tempo and Token to the global scope for ease of use in the core REPL | ||||||||||||
| Object.assign(globalThis, { Tempo, Token, Snippet, getType, stringify, objectify, enumify, enums }); | ||||||||||||
| Object.assign(globalThis, { Tempo, getType, stringify, objectify, enumify, Pledge, enums }); | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale comment: mentions The line 4 comment still says "Pre-load Tempo and Token to the global scope" but ✏️ Proposed fix-// Pre-load Tempo and Token to the global scope for ease of use in the core REPL
+// Pre-load Tempo and related helpers to the global scope for ease of use in the core REPL📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
| console.log(`\n\x1b[38;2;252;194;1m\x1b[1m ⏳ Tempo (core) \x1b[0m\x1b[38;2;45;212;191mREPL initialized (core only).\x1b[0m\n`); | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,24 @@ | ||||||||||||||||||||||||||
| # 📜 Version 2.x History | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## [v2.2.5] - 2026-04-20 | ||||||||||||||||||||||||||
| ### 🏗️ Modular Hardening | ||||||||||||||||||||||||||
| - **Singleton Resilience**: Replaced `instanceof` checks in `TempoRuntime` with a cross-bundle brand check, ensuring singletons are correctly adopted across bundle boundaries and HMR reloads. | ||||||||||||||||||||||||||
| - **Unified Discovery**: Consolidated internal storage for term and extension plugins into a single, validated `pluginsDb` structure. | ||||||||||||||||||||||||||
| - **Resolved Shadowing**: Eliminated parameter shadowing in runtime hook methods to ensure reliable event emission. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### 🔍 Term Resolution Refinements | ||||||||||||||||||||||||||
| - **Chronological Stability**: Enforced chronological sorting in `resolveCycleWindow` for accurate cycle anchor identification. | ||||||||||||||||||||||||||
| - **Absolute vs Relative Years**: Normalized year handling to allow templates to mix relative offsets and absolute historical years seamlessly. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### 📚 Documentation & UX | ||||||||||||||||||||||||||
| - **Standards Mode**: Modernized all public demonstration files with proper HTML5 skeletons and metadata. | ||||||||||||||||||||||||||
| - **Contextual Guidance**: Updated architecture docs and READMEs with accurate module paths and functional importmap examples. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## [v2.2.4] - 2026-04-19 | ||||||||||||||||||||||||||
| ### 🛡️ Production Safety | ||||||||||||||||||||||||||
| - **Immutable Compatibility**: Added redefinition guards to `TickerModule` to prevent errors on already-frozen classes. | ||||||||||||||||||||||||||
| - **ESM Integrity**: Bundled `tslib` into granular ESM builds to resolve resolution failures in standard browser environments. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## [v2.2.3] - 2026-04-20 | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the v2.2.3 release date ordering. This page now lists 📝 Proposed fix-## [v2.2.3] - 2026-04-20
+## [v2.2.3] - 2026-04-19📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| ### New Features | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Tempo Bundle Test</title> | ||
| </head> | ||
| <body> | ||
| <script type="importmap"> | ||
| { | ||
| "imports": { | ||
| "@magmacomputing/tempo": "https://cdn.jsdelivr.net/npm/@magmacomputing/tempo@2/dist/tempo.bundle.esm.js", | ||
| "@js-temporal/polyfill": "https://cdn.jsdelivr.net/npm/@js-temporal/polyfill@0.5/dist/index.esm.js" | ||
| } | ||
| } | ||
| </script> | ||
| <script type="module"> | ||
| import Tempo from '@magmacomputing/tempo'; | ||
| const t = new Tempo('next friday'); | ||
| console.log(t.format('{mon} {day}')); | ||
| </script> | ||
|
|
||
| <p>Open the console to see the output.</p> | ||
| </body> | ||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reword this as an alias, not a rename.
MatchResultis shown as an alias toInternal.Match, whileMatchstill exists and the runtimeMatchexport remains public. Calling this a rename can mislead users into expectingMatchto be removed.📝 Proposed wording
📝 Committable suggestion
🤖 Prompt for AI Agents