Update dependency js-toml to v2 #36
Loading…
Reference in a new issue
No description provided.
Delete branch "renovate/js-toml-2.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^1.0.2→^2.0.0Release Notes
sunnyadn/js-toml (js-toml)
v2.0.1Compare Source
Note on versioning: 2.0.1 is breaking relative to 2.0.0.
TomlTimechanged from aStringsubclass to aDatesubclass. 2.0.0 was published two hours earlier, its serialization defect was found immediately, and npm does not allow unpublishing any version of a package that has dependents. 2.0.0 is deprecated with a pointer here. If you installed 2.0.0 during that window,t.split()andt.lengthno longer work; useString(t)ort.toISOString().Three coordinated breaks, one migration. Before this release, js-toml added
timezone information that documents did not contain and lost the type of every
date and time on a round trip. A major is the consent mechanism: the date
reading changes silently rather than throwing, so it should not arrive through
npm updateunannounced.Changed
1979-05-27T07:32:00) now read their wall clock as UTC instead of as the host machine's local time. Previously the same document parsed to different instants on servers in different timezones, and the reading was ambiguous even on a single machine: a wall clock inside a daylight-saving gap does not exist, and one inside a fall-back hour occurs twice. The new value matches whatsmol-tomland@iarna/tomlreturn, to the millisecond. Migration: read local date-times with thegetUTC*accessors (start.getUTCHours()) rather than the local ones (start.getHours()). Hosts running in UTC, which includes most servers and CI, see no change. Offset date-times, local dates, and local times are unaffected.dump()writes each TOML date/time type back in its own form. A local date-time was previously re-emitted as1979-05-27T07:32:00.000Zand a local date as a full offset date-time, so a round trip through this library silently added a timezone claim the document never made. TOML defines a local date-time as carrying no relation to an offset or timezone at all. A local time was re-emitted as a quoted string, degrading it to a different TOML type. A plainDatesupplied by a caller is still written as an offset date-time, since one instant is all it carries. Note that a time written without seconds still normalizes on load, so07:32round-trips as07:32:00: valid TOML, different bytes.Added
TomlTime, exported, is whatload()now returns for a local time, replacing a barestring. It extendsDate, which is what the ecosystem's parsers do and what generic value walkers expect: such code dispatches ontypeoffor primitives andinstanceof Datefor everything time-shaped, and has no branch for anything else.toISOString()andtoString()return the time of day (07:32:00.123456789), not the anchor day, so the sentinel never leaks and the source precision is kept exactly, which a millisecond-based encoding rounds away. Read the fields withgetUTCHours()or the addedhour,minute,secondandfraction. Its constructor validates:new TomlTime(x)throwsSyntaxParseErrorunlessxis a TOML local time, and fills omitted seconds so the stored form is alwaysHH:MM:SS[.frac]. Migration:typeof t === 'string'is now false andt === '07:32:00'is false; useinstanceof Dateor compareString(t). Note the anchor day is fiction: read the time withtoISOString(),String(t)or the added accessors, not withgetHours()or thetoLocale*family, and a parsed local time retains about 72 bytes more than the bare string it replaces.TomlDate, exported, is whatload()now returns for every TOML date/time value. It extendsDateand addskind, one of'offset-date-time','local-date-time'or'local-date'.toISOString()returns the form the document wrote, so a local date-time no longer serializes as...ZthroughJSON.stringifyor any consumer that reads aDate, not only through this library'sdump().kindis an accessor rather than an own property, so deep-equality,Object.keysand object spread treat an instance exactly like theDateit extends; existing assertions comparing against a plainDatekeep passing.constructor === Dateis false, so test withinstanceof, andstructuredClonereturns a plainDate, keeping the instant but dropping the type.Dates by instant alone, which is why a local date-time re-emitted as...Zwent unnoticed: the implementation and the test oracle shared the same blind spot.Fixed
Datebuilt from local components. The check is an hour/minute/second range test and now says so directly, which removes the clock, and with it the timezone surface, from a function that had no use for either. Behaviour is unchanged: the two forms agree on every input the grammar can produce, and leap seconds stay rejected.v2.0.0Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.