Class CompatibilityDate
Three checks, in increasing authority. Format and calendar are decided here, because they are
decidable here. Redundant flags are a warning, matching Cloudflare's own position that a flag
already default-on is ignored. Whether the installed runtime knows a date is not decidable here at
all — the set of valid dates is a property of the installed Wrangler and moves — so that one is
left to wrangler deploy --dry-run.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleannodeCompatByDefault(LocalDate date) Whether a date has Node compatibility on by default.static LocalDateReads a date, refusing anything Wrangler would refuse for a reason decidable here.Flags that are already the default for a date, and so do nothing.
-
Method Details
-
parse
Reads a date, refusing anything Wrangler would refuse for a reason decidable here.- Parameters:
text- the date, asyyyy-mm-dd- Returns:
- the parsed date
-
redundant
Flags that are already the default for a date, and so do nothing.Reported rather than refused, because Cloudflare ignores a redundant flag and refusing one would break a configuration that works.
- Parameters:
date- the compatibility dateflags- the declared flags- Returns:
- the redundant ones, with the date each became the default
-
nodeCompatByDefault
Whether a date has Node compatibility on by default.Which decides whether the generated configuration has to turn it off. Java needs no Node polyfills, the v2 flag is documented as increasing bundle size, and the compiler's runtime treats a
processglobal as proof it is running under Node.- Parameters:
date- the compatibility date- Returns:
- whether the flags have to be disabled explicitly
-