mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
BREAKING(temporal/unstable): Remove obsoleted Temporal APIs (#24836)
This commit is contained in:
parent
930ccf928a
commit
d2b66e50fd
2 changed files with 78 additions and 129 deletions
|
@ -849,6 +849,30 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
// Removes the `Temporal` API.
|
||||
delete globalThis.Temporal;
|
||||
delete globalThis.Date.prototype.toTemporalInstant;
|
||||
} else {
|
||||
// Removes the obsoleted `Temporal` API.
|
||||
// https://github.com/tc39/proposal-temporal/pull/2895
|
||||
// https://github.com/tc39/proposal-temporal/pull/2914
|
||||
if (typeof Temporal.Instant.fromEpochSeconds === "undefined") {
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them!";
|
||||
}
|
||||
delete Temporal.Instant.fromEpochSeconds;
|
||||
delete Temporal.Instant.fromEpochMicroseconds;
|
||||
delete Temporal.Instant.prototype.epochSeconds;
|
||||
delete Temporal.Instant.prototype.epochMicroseconds;
|
||||
delete Temporal.PlainDateTime.prototype.withPlainDate;
|
||||
delete Temporal.PlainDateTime.prototype.toPlainYearMonth;
|
||||
delete Temporal.PlainDateTime.prototype.toPlainMonthDay;
|
||||
delete Temporal.PlainTime.prototype.toPlainDateTime;
|
||||
delete Temporal.PlainTime.prototype.toZonedDateTime;
|
||||
delete Temporal.TimeZone.prototype.getNextTransition;
|
||||
delete Temporal.TimeZone.prototype.getPreviousTransition;
|
||||
delete Temporal.ZonedDateTime.prototype.withPlainDate;
|
||||
delete Temporal.ZonedDateTime.prototype.toPlainYearMonth;
|
||||
delete Temporal.ZonedDateTime.prototype.toPlainMonthDay;
|
||||
delete Temporal.Now.zonedDateTime;
|
||||
delete Temporal.Now.plainDateTime;
|
||||
delete Temporal.Now.plainDate;
|
||||
}
|
||||
|
||||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
|
@ -1008,6 +1032,30 @@ function bootstrapWorkerRuntime(
|
|||
// Removes the `Temporal` API.
|
||||
delete globalThis.Temporal;
|
||||
delete globalThis.Date.prototype.toTemporalInstant;
|
||||
} else {
|
||||
// Removes the obsoleted `Temporal` API.
|
||||
// https://github.com/tc39/proposal-temporal/pull/2895
|
||||
// https://github.com/tc39/proposal-temporal/pull/2914
|
||||
if (typeof Temporal.Instant.fromEpochSeconds === "undefined") {
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them!";
|
||||
}
|
||||
delete Temporal.Instant.fromEpochSeconds;
|
||||
delete Temporal.Instant.fromEpochMicroseconds;
|
||||
delete Temporal.Instant.prototype.epochSeconds;
|
||||
delete Temporal.Instant.prototype.epochMicroseconds;
|
||||
delete Temporal.PlainDateTime.prototype.withPlainDate;
|
||||
delete Temporal.PlainDateTime.prototype.toPlainYearMonth;
|
||||
delete Temporal.PlainDateTime.prototype.toPlainMonthDay;
|
||||
delete Temporal.PlainTime.prototype.toPlainDateTime;
|
||||
delete Temporal.PlainTime.prototype.toZonedDateTime;
|
||||
delete Temporal.TimeZone.prototype.getNextTransition;
|
||||
delete Temporal.TimeZone.prototype.getPreviousTransition;
|
||||
delete Temporal.ZonedDateTime.prototype.withPlainDate;
|
||||
delete Temporal.ZonedDateTime.prototype.toPlainYearMonth;
|
||||
delete Temporal.ZonedDateTime.prototype.toPlainMonthDay;
|
||||
delete Temporal.Now.zonedDateTime;
|
||||
delete Temporal.Now.plainDateTime;
|
||||
delete Temporal.Now.plainDate;
|
||||
}
|
||||
|
||||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue