Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4dc837e
fix: return ElysiaFile instead of Response to get content-type headers
cirex-web Apr 29, 2026
b41bed8
Add cached response behavior tests
yuriiShmal Apr 29, 2026
4b7d489
Merge branch 'main' into fix/content-type-headers
cirex-web Apr 29, 2026
774107e
fix: bun.lock merge conflicts
cirex-web Apr 29, 2026
8d1ebdf
fix: vitest should be a devDependency
cirex-web Apr 29, 2026
011e56d
Fix Elysia cookie type import
yuriiShmal Apr 29, 2026
95bea1f
Run build before tests
yuriiShmal Apr 29, 2026
cb0c53e
fix: pre-bundle html files if bunFullstack is true
cirex-web Apr 29, 2026
898bb1d
test: add cached-path coverage for image content-type and etag suppre…
Aidanpgh Apr 29, 2026
ab2b092
chore: upd example/index.html with bunFullstack option
cirex-web Apr 29, 2026
c60864b
chore: fix accidental package.json test script reversion
cirex-web Apr 29, 2026
670ff6d
fix: some more cleanup, performance benchmarking, mount root route be…
cirex-web May 7, 2026
106cec0
chore: cleanup
cirex-web May 7, 2026
138b506
test: add range request header test
cirex-web May 7, 2026
a564720
chore: cleanup test
cirex-web May 7, 2026
ebae90f
fix: refuse file requests outside of asset directory
cirex-web May 8, 2026
310f90f
chore: minor tweaks for filepath normalization
cirex-web May 8, 2026
3e543f8
fix: video and img assets on node
cirex-web May 10, 2026
b48fe33
chore: add audio for testing
cirex-web May 10, 2026
2d938f7
test: add ci test workflow
cirex-web May 10, 2026
de0545a
chore: rename workflow
cirex-web May 10, 2026
483fc41
chore: cleanup
cirex-web May 10, 2026
f6fd9dd
chore: some more cleanup
cirex-web May 10, 2026
c7f1d43
fix: url prefix arg should always use forward slash
cirex-web May 10, 2026
da80c86
chore: move devdeps below exports
cirex-web May 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on:
push:
pull_request:

jobs:
test:
name: Test code
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
Comment on lines +16 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest stable version of Bun as of May 2026?

💡 Result:

The latest stable Bun version as of May 10, 2026 is Bun v1.3.13.[1][2] Evidence: Bun’s official release landing page and the GitHub “Releases” page show v1.3.13 as the most recent release, dated 2026-04-20 (after which no newer stable release is shown in the results retrieved). [3][4]

Citations:


Pin Bun to a specific version instead of latest for deterministic CI builds~

Using latest means your CI runs are non-deterministic and could break randomly when a new Bun version drops♡ How reckless~ (¬‿¬) That's gonna cause all kinds of fun debugging when tests suddenly fail for no reason at all, ne~

The current stable version as of May 2026 is v1.3.13 - pin to that instead of flying blind with latest~

🔧 Proposed fix to pin Bun version
             - name: Setup bun
               uses: oven-sh/setup-bun@v1
               with:
-                  bun-version: latest
+                  bun-version: 1.3.13
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.13
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test.yml around lines 16 - 19, The workflow uses
oven-sh/setup-bun with bun-version set to "latest", which makes CI
non-deterministic; update the action input for bun-version in the GitHub Actions
job (the uses: oven-sh/setup-bun@v1 block) to pin a specific, stable Bun release
(e.g., "v1.3.13") instead of "latest" so builds are reproducible.


- name: Install packages
run: bun install

- name: Test
run: bun run test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules
.pnpm-debug.log
dist

build
build
cmueats-build
1 change: 1 addition & 0 deletions bench/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
33 changes: 33 additions & 0 deletions bench/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Bench } from 'tinybench'
import { Elysia } from 'elysia'
import { staticPlugin } from '../src'
import { req } from '../test/utils'

const bench = new Bench({ time: 10000 })

const app = new Elysia().use(
staticPlugin({
assets: 'public',
prefix: 'public',
indexHTML: true,
bunFullstack: false,
alwaysStatic: true
})
)
await app.modules
console.log(app.routes)
bench.add('route caching', async () => {
const htmlPaths = [
'/public/html',
'/public/html/',
'/public/html/index.html',
'/public/html/index.html/'
]
for (const path of htmlPaths) {
const res = await app.handle(req(path))
await (await res.blob()).text()
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
})

await bench.run()
console.table(bench.table())
159 changes: 157 additions & 2 deletions bun.lock

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { Elysia } from 'elysia'
import { staticPlugin } from '../src/index'

const app = new Elysia()
.use(
await staticPlugin({
prefix: '/',
bundleHTML: false
})
)
.listen(3000)

console.log(app.routes)

await app.modules
import { node } from '@elysiajs/node'
import { isBun } from '../src/utils'
;(async () => {
const app = new Elysia(isBun ? {} : { adapter: node() })
.use(
await staticPlugin({
prefix: 'hi',
assets: 'public',
alwaysStatic: true,
bunFullstack: true,
decodeURI: false,
etag: false
// staticLimit: 1
})
)
.listen(3005)
await app.modules
console.log(app.routes)
})() // no top-level awaits allowed for cjs (error triggered by `bun dev:node`) (idk how to fix this)
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"license": "MIT",
"scripts": {
"dev": "bun run --watch example/index.ts",
"test": "bun test && npm run test:node",
"dev:node": "tsx watch example/index.ts",
"bench": "bun run bench/index.ts",
"test": "bun run build && bun test && vitest run && npm run test:node",
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js",
"build": "bun build.ts",
"release": "npm run build && npm run test && npm publish --access public"
Expand Down Expand Up @@ -48,6 +50,7 @@
}
},
"devDependencies": {
"@elysiajs/node": "^1.4.5",
"@types/bun": "^1.3.13",
"@types/fast-decode-uri-component": "^1.0.0",
"@types/node": "^24.12.2",
Expand All @@ -56,10 +59,13 @@
"esbuild-fix-imports-plugin": "^1.0.23",
"eslint": "9.6.0",
"fast-decode-uri-component": "^1.0.1",
"tinybench": "^6.0.1",
"tsup": "^8.5.1",
"typescript": "^5.9.3"
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"vitest": "^4.1.5"
},
"peerDependencies": {
"elysia": ">= 1.4.0"
}
}
}
Binary file added public/MGICALCURE_LOVE_SHOT.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion public/html/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Home!</title>
Expand Down
1 change: 1 addition & 0 deletions public/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("hi")
Binary file added public/kyuukurarin.mp4
Binary file not shown.
Loading
Loading