Skip to content

breaking: require Bun 1.4 - #16880

Merged
elliott-with-the-longest-name-on-github merged 8 commits into
bun-adapter-instrumented-buildfrom
bun-adapter-1.4
Aug 25, 2026
Merged

breaking: require Bun 1.4#16880
elliott-with-the-longest-name-on-github merged 8 commits into
bun-adapter-instrumented-buildfrom
bun-adapter-1.4

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Stacked on #16898

Follow-ups to the Bun 1.4 release. HEAD now reaches GET handlers and stop() settles after a force close, so routes stop registering both methods and shutdown stops racing a timer. That makes 1.4 the floor.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 21, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from d1dc558:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/d1dc5581dbbc5d4a2bd5c55feeeccee4e91fb32d

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16880

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d1dc558

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-bun Major

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

@svelte-docs-bot

Copy link
Copy Markdown

Comment thread packages/adapter-bun/package.json
Comment thread documentation/docs/25-build-and-deploy/45-adapter-bun.md Outdated
Comment thread documentation/docs/25-build-and-deploy/45-adapter-bun.md
Comment thread .changeset/bun-adapter-requires-1-4.md Outdated
Comment thread documentation/docs/25-build-and-deploy/45-adapter-bun.md
Comment thread packages/adapter-bun/test/start.spec.ts
@svelte-triage-bot

Copy link
Copy Markdown
Contributor

I investigated this failed test run and found that [chromium-dev] packages/kit/test/apps/basics/test/cross-platform/client.test.js:208:2 › Navigation lifecycle functions › beforeNavigate is not triggered on redirect is flaky.

This is a pre-existing test synchronization race, not a regression caused by the adapter-bun PR. waitForLoadState('networkidle') can return after an already-fired idle state and does not wait for the SvelteKit client-side redirect or reactive DOM update, so a raw DOM read can observe initial state. CI traces and the trusted-base four-worker reproduction confirm the ordering. A web-first toHaveText assertion deterministically waits for the intended observable state. I opened #16891 with a proposed fix.

@Nic-Polumeyv
Nic-Polumeyv changed the base branch from version-3 to bun-adapter-instrumented-build August 22, 2026 06:44
@Nic-Polumeyv Nic-Polumeyv changed the title fix: instrumented Bun builds, and require Bun 1.4 chore: require Bun 1.4 Aug 22, 2026
@teemingc teemingc changed the title chore: require Bun 1.4 breaking: require Bun 1.4 Aug 22, 2026
Nic-Polumeyv and others added 8 commits August 22, 2026 02:53
Bun 1.4 routes HEAD to a GET handler, so routes no longer register both
methods, and its stop() promise settles after a force close, so the timer
that bounded that wait is gone. Both make 1.4 the floor: CI, the docs and
engines now say so.
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
@ottomated ottomated added the needs-platform-tests This PR needs to run platform tests in order to merge. label Aug 22, 2026
@Nic-Polumeyv Nic-Polumeyv removed the needs-platform-tests This PR needs to run platform tests in order to merge. label Aug 23, 2026
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github merged commit 9a73d3b into version-3 Aug 25, 2026
72 of 73 checks passed
elliott-with-the-longest-name-on-github added a commit that referenced this pull request Aug 25, 2026
The side-effect chunk workaround in `packages/adapter-bun/index.js`
registers `build.onResolve({ filter: /\.js$/ })` and returns undefined
for anything outside `server/chunks/`. A `Bun.build` hook that matches
without resolving sends Bun to the filesystem, past the `files` virtual
entries. An app with `src/instrumentation.server.js` gets a virtual
`src/start.js` entrypoint that exists nowhere on disk, so its build
fails with `ModuleNotFound resolving ".../adapter-bun/src/start.js"
(entry point)`.

The plugin now reads `server/chunks/` once up front, keeps the stubs it
matches in `side_effect_sources`, and builds `side_effect_filter` from
their basenames, so no other specifier reaches the hook. A path that
still matches without being a stub resolves to its virtual entry when
there is one.

The non-GET e2e test posted an `http` origin, which fails the CSRF check
against the `https` origin the adapter computes.
`platform-tests-bun.yml` runs on `workflow_dispatch` only, so neither of
these showed up in CI.

#16880 is stacked on this.
elliott-with-the-longest-name-on-github added a commit that referenced this pull request Aug 25, 2026
The specs now run under `bun test`, with real `Bun.semver`, `Bun.file`,
and `Bun.env`, and `spyOn` recording calls where assertions need them.
`Bun.serve` and the `Bun.build` pipeline stay test doubles so the tests
don't bind sockets or bundle. The build-generated modules (`MANIFEST`,
`ROUTES`, `SERVER`, `SERVER_OPTIONS`) are still mocked, and since
`mock.module` fixes a module's export names on first registration,
`test/mocks.ts` registers each with the union of exports its consumers
use. Loads that need a fresh evaluation import with a unique query
string, as there is no `vi.resetModules`.

`Bun.version` and the `Bun` global are frozen inside Bun, so the
1.4-floor guard is tested by spying `Bun.semver.order` plus assertions
pinning the real comparator's verdicts, canaries being the reason it
uses `order()`. The build-must-run-in-Bun error comes from running the
adapter under a Node subprocess. CI installs Bun 1.4.0 in the
`test:others` legs.

Stacked on #16880.
Rich-Harris pushed a commit that referenced this pull request Aug 26, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to version-3, this PR
will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-3` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `version-3`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @sveltejs/adapter-bun@1.0.0-next.2

### Major Changes

- breaking: require Bun 1.4, which routes `HEAD` to `GET` handlers and
settles `stop()` after a force close
([#16880](#16880))

### Patch Changes

- fix: build apps that use server instrumentation
([#16898](#16898))
- Updated dependencies
[[`ff8cdd4`](ff8cdd4),
[`723572c`](723572c),
[`3b8e034`](3b8e034),
[`f2c5102`](f2c5102),
[`c66a6ed`](c66a6ed),
[`428e5ef`](428e5ef)]:
  - @sveltejs/kit@3.0.0-next.26
## @sveltejs/adapter-node@6.0.0-next.11

### Patch Changes

- chore: remove polka, attach the handler to the http server directly
([#16907](#16907))
- Updated dependencies
[[`ff8cdd4`](ff8cdd4),
[`723572c`](723572c),
[`3b8e034`](3b8e034),
[`f2c5102`](f2c5102),
[`c66a6ed`](c66a6ed),
[`428e5ef`](428e5ef)]:
  - @sveltejs/kit@3.0.0-next.26
## @sveltejs/kit@3.0.0-next.26

### Patch Changes

- fix: only require the `svelte-trusted-html` trusted-types policy when
client-side code is shipped, allowing builds where all pages have `csr:
false` ([#16928](#16928))

- chore: stop externalizing `cookie` dependency during build
([#16936](#16936))

- fix: preserve metadata on streamed page responses
([#16935](#16935))

- fix: error on server-only imports reachable from hooks or service
worker files outside the project root
([#16912](#16912))

- fix: copy worker files emitted by the server build to the client
output directory ([#16929](#16929))

- fix: Reject all pending query promises when a query fails before
resolving with a value for the first time
([#16890](#16890))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Rich-Harris pushed a commit that referenced this pull request Aug 26, 2026
Fixes a pre-existing Playwright synchronization race found while
investigating
[#16880](#16880) and its
[failed workflow
run](https://github.com/sveltejs/kit/actions/runs/32514227006).

`page.waitForLoadState('networkidle')` could return immediately because
network idle had already been reached before the client-side redirect
navigation. The following raw DOM read could then observe stale state.
Replace it with a web-first `toHaveText` assertion that waits for the
expected navigation callback state.

Verification included 100 repetitions with four workers, the complete
client spec, the original 4-worker shard, and server/client
route-resolution variants. This is test-only, so no changeset is
included.

Co-authored-by: svelte-triage-bot <team@svelte.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants