Repository navigation
feat(core): move GMT onto temporal-polyfill (CORE-108, #460) #464
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
Open
craig-o-curtis
wants to merge
44
commits into
main
Choose a base branch
from
460-core-108-move-gmt-onto-temporal-polyfill
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,263
−13,031
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
b50a60d
fix(dox): put the Changelog group last in the sidebar
craig-o-curtis adec4de
fix(dox): slide the sidebar in and out on the way to and from the lan…
craig-o-curtis bab0a14
feat(dox): give /why-gmt the sidebars and a row of headline figures
craig-o-curtis bc21e17
feat(dox): colour code blocks from the site's palette
craig-o-curtis a4d9c6b
fix(dox): put install and core-rules first in Start here
craig-o-curtis d25b042
feat(core): run on temporal-polyfill 1.0.8 (CORE-108, #460)
craig-o-curtis ed814ef
chore(lint): name both polyfill packages in the import restrictions (…
craig-o-curtis 23b16a9
feat(canary): the weekly swap job checks the newest temporal-polyfill…
craig-o-curtis 52164cc
feat(build): measure GMT on both polyfills (CORE-108, #460)
craig-o-curtis 0a174d1
refactor(dox): take Temporal from @northguild/gmt (CORE-108, #460)
craig-o-curtis 882ded2
test(core): label the Coptic totalDuration row by its month (CORE-108…
craig-o-curtis 5f70f09
docs(dox): end the install page with a first call
craig-o-curtis adfdf9b
feat(dox): compare GMT on both polyfills on /bundle-size (CORE-108, #…
craig-o-curtis caaff1e
docs(dox): name temporal-polyfill in the guides (CORE-108, #460)
craig-o-curtis c6a28e4
docs(context): GMT runs on temporal-polyfill (CORE-108, #460)
craig-o-curtis f66ba7a
fix(dox): GitHub and Discord shine in from northguild.dev's grey
craig-o-curtis b4f1dce
fix(dox): shorten the sidebar labels under Migrate, Start here and Ch…
craig-o-curtis 5cfd1f2
test(dox): check the chart key opt-out beside the prose bullet rule (…
craig-o-curtis 7bfec9b
fix(dox): lock the hero sky to the globe's zoom
craig-o-curtis c7c38c1
fix(dox): leave out a Sun or Moon behind the camera
craig-o-curtis c35fe1a
revert(dox): move the hero Sun fixes to CORE-109
craig-o-curtis 4f53f8c
fix(dox): stop a failed widget mount leaving its listener recorder on…
craig-o-curtis ab4227d
chore(dox): sync the published test figures (CORE-108, #460)
craig-o-curtis 6341dfd
fix(dox): expect the Changelog section last in llms.txt (CORE-108, #460)
craig-o-curtis a21adf3
Put cut after space fixes
craig-o-curtis 36cb3cf
docs(context): the release after CORE-108 ends with CORE-109 (CORE-10…
craig-o-curtis 36b09ac
docs(changeset): add the Breaking changes section and the renamed Tem…
craig-o-curtis 09c2aaa
fix(dox): read the syntax palette the same from a CRLF checkout (CORE…
craig-o-curtis 548e9f9
test(dox): guard that the polyfill ban is the only no-restricted-impo…
craig-o-curtis 4c4e84b
fix(canary): never ask to raise the pin to an older temporal-polyfill…
craig-o-curtis 015405b
docs(dox): name 1.0.7 and 1.0.8 as the releases that fixed our report…
craig-o-curtis 1363733
fix(dox): let the package names in the polyfill comparison headers wr…
craig-o-curtis 11dbf6b
fix(dox): say each fix shipped in the next release, with no typed ver…
craig-o-curtis cd76c8d
chore(dox): track the Persian leap-year report, fullcalendar/temporal…
craig-o-curtis fb9c7cd
fix(dox): run the import-ban guard without building gmt-oxlint (CORE-…
craig-o-curtis 5e213e9
Merge remote-tracking branch 'origin/main' into 460-core-108-move-gmt…
craig-o-curtis 4b864c3
fix(dox): one chart render helper, and the PTP readout test follows t…
craig-o-curtis 3cf7da7
fix(core): compare durations from a plain relativeTo past the range, …
craig-o-curtis 02c8bc1
Merge remote-tracking branch 'origin/main' into 460-core-108-move-gmt…
craig-o-curtis 586381d
Merge branch 'main' into 460-core-108-move-gmt-onto-temporal-polyfill
craig-o-curtis bf98c65
feat(gmt): run on temporal-polyfill 1.0.9 and retire D35 (CORE-108, #…
craig-o-curtis 7d7b722
Merge remote-tracking branch 'origin/460-core-108-move-gmt-onto-tempo…
craig-o-curtis 829f8f3
test(gmt): Nowruz after each of the 78 corrected Persian years (CORE-…
craig-o-curtis fb5d309
chore: drop the release-age exclusion for temporal-polyfill 1.0.9 (CO…
craig-o-curtis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| "@northguild/gmt": minor | ||
| --- | ||
|
|
||
| GMT runs on `temporal-polyfill` in place of `@js-temporal/polyfill`. Every import is smaller, month arithmetic takes bounded time for any amount, and `Temporal`, `Intl` and `toTemporalInstant` are re-exported from `temporal-polyfill`. Two results and some type names change, and **Breaking changes** covers each. | ||
|
|
||
| | Measured with esbuild, minified ES modules | `@js-temporal/polyfill` 0.5.1 | `temporal-polyfill` 1.0.9 | | ||
| | --- | --- | --- | | ||
| | The polyfill alone, the floor of every import | 152.5 kB minified, 44.2 kB gzipped | 65.4 kB minified, 23.3 kB gzipped | | ||
| | The whole package (`import * from "@northguild/gmt"`) | 567.8 kB minified, 154.9 kB gzipped | 528.2 kB minified, 151.9 kB gzipped | | ||
|
|
||
| ### Breaking changes | ||
|
|
||
| **1. `compareDurations` returns `0` for two durations with the same fields, even when adding them to `relativeTo` would go past Temporal's date range.** Temporal's `Duration.compare` answers `0` for these before any arithmetic. 1.21 returned `null` when `relativeTo` was in a calendar other than ISO 8601. Equal durations that stay in range gave `0` before and still do: | ||
|
|
||
| ```typescript | ||
| import { compareDurations } from "@northguild/gmt"; | ||
|
|
||
| compareDurations("P4294967295M", "P4294967295M", { relativeTo: "2024-01-15[u-ca=hebrew]" }); // 1.21: null. Now: 0 | ||
| compareDurations("P1Y", "P1Y"); // 0 in both | ||
| ``` | ||
|
|
||
| Code that treated `null` from such a call as "equal" now checks for `0`: | ||
|
|
||
| ```typescript | ||
| const same = compareDurations(a, b, { relativeTo }) === 0; | ||
| ``` | ||
|
|
||
| **2. `smallestUnit` no longer accepts `"minute"` or `"minutes"` at the type level** in `parseDuration`, and neither does `toStringSmallestUnit` in `DurationStringOptions`. The Temporal specification's `Duration#toString` takes `"second"` and smaller only. What these do at run time is unchanged, so only the type check fails: | ||
|
|
||
| ```typescript | ||
| import { parseDuration } from "@northguild/gmt"; | ||
|
|
||
| parseDuration("PT1M30.5S", { smallestUnit: "minute" }); // now a type error | ||
| parseDuration("PT1M30.5S", { smallestUnit: "second", roundingMode: "trunc" }); // "PT1M30S" | ||
| ``` | ||
|
|
||
| **3. Some `Temporal.*` type names change.** `Temporal` is re-exported from `temporal-polyfill`, whose types follow `temporal-spec`. GMT's own types (`DateTimeDurationUnit`, `RoundingOptions`, `Overflow`, `Disambiguation`, `Offset`, `NowUnit`, `UtcNowUnit` and the rest) keep their names and accept the same values. Code that names a `Temporal.*` type through `@northguild/gmt` changes as follows: | ||
|
|
||
| | 1.21 name | Now | | ||
| | --- | --- | | ||
| | `Temporal.DurationLike` (the fields object) | `Temporal.DurationLikeObject`. `Temporal.DurationLike` still exists but means `Duration \| DurationLikeObject \| string`, so `keyof Temporal.DurationLike` is no longer the unit names. | | ||
| | `Temporal.PlainDateLike`, `Temporal.PlainDateTimeLike`, `Temporal.PlainTimeLike`, `Temporal.ZonedDateTimeLike` (the fields objects) | `Temporal.DateLikeObject`, `Temporal.DateTimeLikeObject`, `Temporal.TimeLikeObject`, `Temporal.ZonedDateTimeLikeObject`. The old names still exist but now also take a Temporal object or a string. | | ||
| | `Temporal.SmallestUnit<U>`, `Temporal.LargestUnit<U>`, `Temporal.TotalUnit<U>` | `Temporal.PluralizeUnit<U>` (add `"auto"` for a largest unit) | | ||
| | `Temporal.PluralUnit<U>` | `Exclude<Temporal.PluralizeUnit<U>, U>` | | ||
| | `Temporal.DateTimeUnit` | `Temporal.DateUnit \| Temporal.TimeUnit` | | ||
| | `Temporal.RoundingMode` | `NonNullable<Temporal.RoundingOptions<Temporal.DateUnit \| Temporal.TimeUnit>["roundingMode"]>` | | ||
| | `Temporal.ArithmeticOptions`, `Temporal.ToInstantOptions`, `Temporal.ZonedDateTimeAssignmentOptions` | `Temporal.OverflowOptions`, `Temporal.DisambiguationOptions`, `Temporal.ZonedDateTimeFromOptions` | | ||
| | `Temporal.DifferenceOptions<U>`, `Temporal.RoundTo<U>`, `Temporal.DurationRoundTo`, `Temporal.DurationTotalOf` | `Temporal.RoundingOptionsWithLargestUnit<U>`, `Temporal.RoundingOptions<U>`, `Temporal.DurationRoundingOptions`, `Temporal.DurationTotalOptions` | | ||
| | `Temporal.ToStringPrecisionOptions` | `Temporal.DurationToStringOptions` (a duration) or `Temporal.ToStringRoundingOptionsWithFractionalSeconds<U>` | | ||
| | `Temporal.ComparisonResult` | `-1 \| 0 \| 1` | | ||
|
|
||
| The parameter types of these functions are printed with the new names. Each accepts the same values as before: | ||
|
|
||
| - `durationFromUnits`, `ttlFromNow`, `totalUnitsFromNow`, `formatHttpDateFromNow`, and the `add*`, `subtract*`, `get*Ago` and `get*In` functions of `datetime/`, `unix/`, `utc/` and `zoned/`: `Record<keyof Temporal.DurationLikeObject, number>`. | ||
| - `getDurationUnit`, `totalDuration`, `getLargestDateTimeDurationUnit`, `isValidDateTimeDurationUnit`, and the `diff*` and `diff*AsDuration` functions of `datetime/`, `unix/`, `utc/` and `zoned/`: `keyof Temporal.DurationLikeObject`. | ||
| - `setDate`, `setDateTime`, `setTime`, `setUnix`, `setUtc` and `setZoned`: the fields they take, every one optional, era fields left out as before. | ||
| - `parseDuration`: `roundingMode` lists the nine rounding modes. | ||
| - `convertPlainDateTimeToZoned` and `getZonedNow`: `smallestUnit` is `"minute"` through `"nanosecond"`, singular or plural. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import config from "../oxlint.config.mts"; | ||
|
|
||
| // The config spreads the plugin's recommended rules, which come from its build. The Tests job does | ||
| // not build `@northguild/gmt-oxlint`, and this test reads only the import ban, so the rules are empty. | ||
| vi.mock("@northguild/gmt-oxlint", () => ({ recommendedRules: {} })); | ||
|
|
||
| type Override = { files: string[]; rules?: Record<string, unknown> }; | ||
|
|
||
| const RULE = "no-restricted-imports"; | ||
| const overrides = (config.overrides ?? []) as Override[]; | ||
| const setters = overrides.filter((o) => o.rules && RULE in o.rules); | ||
|
|
||
| // In oxlint, as in ESLint flat config, a later override that sets a rule replaces its options for | ||
| // the files it matches. The polyfill ban holds for every Dox file only while it is the one place | ||
| // that sets the rule. | ||
| describe("the polyfill import ban", () => { | ||
| it("is the only setting of no-restricted-imports", () => { | ||
| expect(config.rules ?? {}).not.toHaveProperty(RULE); | ||
| expect(setters).toHaveLength(1); | ||
| expect(setters[0]!.files).toEqual(["src/**", "scripts/**", "tests/**"]); | ||
| }); | ||
|
|
||
| it("bans both polyfills and their subpaths", () => { | ||
| const [, options] = setters[0]!.rules![RULE] as [ | ||
| string, | ||
| { paths: { name: string }[]; patterns: { group: string[] }[] }, | ||
| ]; | ||
| expect(options.paths.map((p) => p.name)).toEqual(["@js-temporal/polyfill"]); | ||
| expect(options.patterns.flatMap((p) => p.group)).toEqual([ | ||
| "@js-temporal/polyfill/**", | ||
| "temporal-polyfill", | ||
| "temporal-polyfill/**", | ||
| ]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.