Skip to content

Commit b6cc244

Browse files
top-level await (#261)
* update based on the changes in the main (minus ts executor) * small type fix * fix some integration tests * Update packages/sandbox-container/tests/runtime/thenable.test.ts Co-authored-by: Naresh <[email protected]> * add variable hoisting for const, let, and var; timeout handling for async; update tests * small nits to tests and some checks --------- Co-authored-by: Naresh <[email protected]>
1 parent 392f1ba commit b6cc244

File tree

9 files changed

+1077
-20
lines changed

9 files changed

+1077
-20
lines changed

.changeset/top-level-await.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@cloudflare/sandbox': patch
3+
---
4+
5+
Add top-level await support for JavaScript code execution
6+
7+
JavaScript code can now use `await` at the top level without wrapping in an async IIFE. Variables declared with `const`, `let`, or `var` persist across executions, enabling multi-step workflows like:
8+
9+
```javascript
10+
// Execution 1
11+
const data = await fetch('https://api.example.com').then((r) => r.json());
12+
13+
// Execution 2
14+
console.log(data); // Works - data persists
15+
```

package-lock.json

Lines changed: 43 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)