Skip to content

Support using keyword in miniflare when parsing scripts#13864

Merged
petebacondarwin merged 1 commit into
cloudflare:mainfrom
benjamincburns:miniflare/bump-acorn
May 18, 2026
Merged

Support using keyword in miniflare when parsing scripts#13864
petebacondarwin merged 1 commit into
cloudflare:mainfrom
benjamincburns:miniflare/bump-acorn

Conversation

@benjamincburns
Copy link
Copy Markdown
Contributor

@benjamincburns benjamincburns commented May 8, 2026

Fixes #12929

Updates miniflare's acorn dep from acorn@8.14.0 to acorn@8.16.0, and miniflare's acorn-walk dep from acorn-walk@8.3.2 to acorn-walk@8.3.5.

The acorn bump was necessary because acorn@8.14.0 didn't support the await and await using keywords. Support for these was added in acorn@8.15.0 and then improved in acorn@8.16.0.

Also bumped acorn-walk because the two are used together and it seemed sensible to get the bug fixes in at the same time.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: dependency version bump w/o any logic changes

A picture of a cute animal (not mandatory, but encouraged)

image

Image credit/details

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

🦋 Changeset detected

Latest commit: 08c6a1a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
miniflare Minor
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod workers-devprod requested review from a team and removed request for a team May 8, 2026 02:36
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented May 8, 2026

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/silly-boxes-shine.md: [@cloudflare/wrangler]
  • packages/miniflare/package.json: [@cloudflare/wrangler]
  • pnpm-lock.yaml: [@cloudflare/wrangler]

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13864

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13864

miniflare

npm i https://pkg.pr.new/miniflare@13864

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13864

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13864

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13864

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13864

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13864

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13864

wrangler

npm i https://pkg.pr.new/wrangler@13864

commit: 08c6a1a

@benjamincburns
Copy link
Copy Markdown
Contributor Author

@penalosa lmk if you want me to add a happy path test to this that shows this can handle using and await using now.

I opted not to as it felt more like it'd be testing acorn via miniflare instead of testing miniflare itself, but I can also see it being useful as a regression test and/or for proving the utility of this PR.

@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented May 15, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk May 17, 2026
@petebacondarwin
Copy link
Copy Markdown
Contributor

@penalosa lmk if you want me to add a happy path test to this that shows this can handle using and await using now.

I opted not to as it felt more like it'd be testing acorn via miniflare instead of testing miniflare itself, but I can also see it being useful as a regression test and/or for proving the utility of this PR.

If you have time to add a test, I think it would help for both of the reasons you give. Thanks!

Updates miniflare's `acorn` dep from `acorn@8.14.0` to `acorn@8.16.0`,
and miniflare's `acorn-walk` dep from `acorn-walk@8.3.2` to
`acorn-walk@8.3.5`.

The `acorn` bump was necessary because `acorn@8.14.0` didn't support the
`await` and `await using` keywords. Support for these was added in
`acorn@8.15.0` and then improved in `acorn@8.16.0`.

Also bumped `acorn-walk` because the two are used together and it seemed
sensible to get the bug fixes in at the same time.

Fixes cloudflare#12929
@benjamincburns benjamincburns force-pushed the miniflare/bump-acorn branch from 5b6bcde to 08c6a1a Compare May 18, 2026 10:03
@benjamincburns
Copy link
Copy Markdown
Contributor Author

benjamincburns commented May 18, 2026

@petebacondarwin no problem! Just pushed an updated commit that also adds two new tests (one for using, one for await using).

@benjamincburns
Copy link
Copy Markdown
Contributor Author

Should've probably also mentioned that I did validate that the added tests fail when miniflare is built against acorn@8.14.0 and acorn-walk@8.3.2, and pass when miniflare is built against acorn@8.16.0 and acorn-walk@8.3.5.

Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic!

@petebacondarwin petebacondarwin merged commit b27eb18 into cloudflare:main May 18, 2026
66 of 70 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Miniflare fails to parse worker scripts containing the using keyword

3 participants