Skip to content

Commit 12a8463

Browse files
jasnellToriLindsay
andauthored
Document several missing compat flags (#19129)
Co-authored-by: ToriLindsay <[email protected]>
1 parent f72b3b9 commit 12a8463

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
_build:
3+
publishResources: false
4+
render: never
5+
list: never
6+
7+
name: "Disable top-level await in require(...)"
8+
sort_date: "2024-12-02"
9+
enable_date: "2024-12-02"
10+
enable_flag: "disable_top_level_await_in_require"
11+
disable_flag: "enable_top_level_await_in_require"
12+
---
13+
14+
Workers implements the ability to use the Node.js style `require(...)` method
15+
to import modules in the Worker bundle. Historically, this mechanism allowed
16+
required modules to use top-level await. This, however, is not Node.js
17+
compatible.
18+
19+
The `disable_top_level_await_in_require` compat flag will cause `require()`
20+
to fail if the module uses a top-level await. This flag is default enabled
21+
with a compatibility date of 2024-12-02 or later.
22+
23+
To restore the original behavior allowing top-level await, use the
24+
`enable_top_level_await_in_require` compatibility flag.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
_build:
3+
publishResources: false
4+
render: never
5+
list: never
6+
7+
name: "Apply TransformStream backpressure fix"
8+
sort_date: "2024-12-16"
9+
enable_date: "2024-12-16"
10+
enable_flag: "fixup-transform-stream-backpressure"
11+
disable_flag: "original-transform-stream-backpressure"
12+
---
13+
14+
The original implementation of `TransformStream` included a bug that would
15+
cause backpressure signaling to fail after the first write to the transform.
16+
Unfortunately, the fix can cause existing code written to address the bug to
17+
fail. Therefore, the `fixup-transform-stream-backpressure` compat flag is
18+
provided to enable the fix.
19+
20+
The fix is enabled by default with compatibility dates of 2024-12-16 or later.
21+
22+
To restore the original backpressure logic, disable the fix using the
23+
`original-transform-stream-backpressure` flag.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
_build:
3+
publishResources: false
4+
render: never
5+
list: never
6+
7+
name: "Automatically set the Symbol.toStringTag for Workers API objects"
8+
sort_date: "2024-09-26"
9+
enable_date: "2024-09-26"
10+
enable_flag: "set_tostring_tag"
11+
disable_flag: "do_not_set_tostring_tag"
12+
---
13+
14+
A change was made to set the Symbol.toStringTag on all Workers API objects
15+
in order to fix several spec compliance bugs. Unfortunately,
16+
this change was more breaking than anticipated. The `do_not_set_tostring_tag` compat
17+
flag restores the original behavior with compatibility dates of 2024-09-26 or earlier.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
_build:
3+
publishResources: false
4+
render: never
5+
list: never
6+
7+
name: "Upper-case HTTP methods"
8+
sort_date: "2024-10-14"
9+
enable_date: "2024-10-14"
10+
enable_flag: "upper_case_all_http_methods"
11+
disable_flag: "no_upper_case_all_http_methods"
12+
---
13+
14+
HTTP methods are expected to be upper-cased. Per the fetch spec, if the
15+
method is specified as `get`, `post`, `put`, `delete`, `head`, or `options`,
16+
implementations are expected to uppercase the method. All other method names
17+
would generally be expected to throw as unrecognized (e.g. `patch` would be
18+
an error while `PATCH` is accepted). This is a bit restrictive, even if it
19+
is in the spec. This flag modifies the behavior to uppercase all methods
20+
prior to parsing so that the method is always recognized if it is a known
21+
method.
22+
23+
To restore the standard behavior, use the `no_upper_case_all_http_methods`
24+
compatibility flag.

0 commit comments

Comments
 (0)