robobun
584946b0ce
Fix comma operator optimization to preserve 'this' binding semantics ( #21653 )
...
## Summary
- Fix transpiler bug where comma expressions like `(0, obj.method)()`
were incorrectly optimized to `obj.method()`
- This preserved the `this` binding instead of stripping it as per
JavaScript semantics
- Add comprehensive regression test to prevent future issues
## Root Cause
The comma operator optimization in `src/js_parser.zig:7281` was directly
returning the right operand when the left operand had no side effects,
without checking if the expression was being used as a call target.
## Solution
- Added the same `is_call_target` check that other operators (nullish
coalescing, logical OR/AND) use
- When a comma expression is used as a call target AND the right operand
has a value for `this`, preserve the comma expression to strip the
`this` binding
- Follows existing patterns in the codebase for consistent behavior
## Test Plan
- [x] Reproduce the original bug: `(0, obj.method)()` incorrectly
preserved `this`
- [x] Verify fix: comma expressions now correctly strip `this` binding
in function calls
- [x] All existing transpiler tests continue to pass
- [x] Added regression test covering various comma expression scenarios
- [x] Tested edge cases: nested comma expressions, side effects,
different operand types
🤖 Generated with [Claude Code](https://claude.ai/code )
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-09 05:11:50 -07:00
Jarred Sumner
19fac68e81
Reduce stack space usage of parseSuffix ( #21662 )
...
### What does this PR do?
Reduce stack space usage of parseSuffix
### How did you verify your code works?
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-09 00:20:17 -07:00
Meghan Denny
2a6d018d73
node-fallbacks:buffer: fix numberIsNaN ReferenceError ( #21527 )
...
fixes https://github.com/oven-sh/bun/issues/21522
2025-07-31 22:07:17 -07:00
pfg
fe94a36dbc
Make execArgv empty when in compiled executable ( #21298 )
...
```ts
// a.js
console.log({
argv: process.argv,
execArgv: process.execArgv,
});
```
```diff
$> node a.js -a --b
{
argv: [
'/opt/homebrew/Cellar/node/24.2.0/bin/node',
'/tmp/a.js',
'-a',
'--b'
],
execArgv: []
}
$> bun a.js -a --b
{
argv: [ "/Users/pfg/.bun/bin/bun", "/tmp/a.js",
"-a", "--b"
],
execArgv: [],
}
$> bun build --compile a.js --outfile=a
[5ms] bundle 1 modules
[87ms] compile
$> ./a -a --b
{
argv: [ "bun", "/$bunfs/root/a", "-a", "--b" ],
- execArgv: [ "-a", "--b" ],
+ execArgv: [],
}
```
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-25 12:47:10 -07:00
Zack Radisic
39dd5002c3
Fix CSS error with printing :is(...) pseudo class ( #21249 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-07-21 00:21:33 -07:00
Michael H
f4444c0e4d
fix --tsconfig-override ( #21045 )
2025-07-15 22:00:17 -07:00
Michael H
3ba9b5710e
fix Bun.build with { sourcemap: true } ( #21029 )
2025-07-14 03:52:26 -07:00
Jarred Sumner
2e02d9de28
Use ReadableStream.prototype.* in tests instead of new Response(...).* ( #20937 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Alistair Smith <hi@alistair.sh >
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
2025-07-14 00:47:53 -07:00
Meghan Denny
c106f31345
test: delete bundler test temp folders upon success ( #20990 )
2025-07-12 10:59:50 -07:00
Jarred Sumner
9e4700ee2d
Remove unused Symbol.for(primitive) calls in bundler ( #20888 )
...
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <Jarred-Sumner@users.noreply.github.com >
2025-07-12 00:52:07 -07:00
Jarred Sumner
9e4f460d17
Improve tree-shaking of try statements in dead code ( #20934 )
2025-07-11 15:47:04 -07:00
Meghan Denny
36bedb0bbc
js: fix async macros on windows ( #20903 )
2025-07-08 21:23:25 -07:00
Zack Radisic
dacb75dc1f
Fix crash in bundler related to onLoad plugins that return file loader for HTML imports ( #20849 )
2025-07-07 01:07:03 -07:00
Adam
7ba4b1d01e
Fix: deprecated goo.gl links in snapshots raised in issue #20086 ( #20424 )
2025-07-05 00:58:42 -07:00
Jarred Sumner
8bb835bf63
Fix: Dynamic imports incorrectly resolve to CSS files when code splitting is enabled ( #20784 )
...
Co-authored-by: Meghan Denny <meghan@bun.sh >
2025-07-02 22:31:02 -07:00
190n
172aecb02e
[publish images] Upgrade self-reported Node.js version from 22.6.0 to 24.3.0 (v2) ( #20772 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Meghan Denny <meghan@bun.sh >
Co-authored-by: Ashcon Partovi <ashcon@partovi.net >
Co-authored-by: pfg <pfg@pfg.pw >
Co-authored-by: pfgithub <6010774+pfgithub@users.noreply.github.com >
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com >
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-07-02 12:06:08 -07:00
Ben Grant
ea57037567
Revert "Upgrade self-reported Node.js version from 22.6.0 to 24.3.0 ( #20659 ) [publish images]"
...
This reverts commit 80309e4d59 . It breaks the Windows CI.
2025-07-02 09:40:32 -07:00
Jarred Sumner
80309e4d59
Upgrade self-reported Node.js version from 22.6.0 to 24.3.0 ( #20659 ) [publish images]
...
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Meghan Denny <meghan@bun.sh >
Co-authored-by: Ashcon Partovi <ashcon@partovi.net >
Co-authored-by: pfg <pfg@pfg.pw >
Co-authored-by: pfgithub <6010774+pfgithub@users.noreply.github.com >
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com >
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Ben Grant <ben@bun.sh >
2025-07-02 00:03:05 -07:00
Jarred Sumner
72d43590a1
Add export default to more node polyfills ( #20747 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2025-06-30 23:02:52 -07:00
Jarred Sumner
9049b732db
Fix regression from referencing global inside of node fallbacks without making it === globalThis ( #20739 )
2025-06-30 18:57:58 -07:00
Jarred Sumner
4cc61a1b8c
Fix NODE_PATH for bun build ( #20576 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2025-06-22 20:51:45 -07:00
Jarred Sumner
633f4f593d
Ahead-of-time frontend bundling support for HTML imports & bun build ( #20511 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-06-20 19:55:52 -07:00
Meghan Denny
bb55b2596d
fix passing nested object to macro" ( #20497 )
...
Co-authored-by: nektro <5464072+nektro@users.noreply.github.com >
2025-06-19 17:13:27 -07:00
Dylan Conway
197443b2db
fix(bundler): correct import_records for TLA detection ( #20358 )
2025-06-19 15:04:27 -07:00
Meghan Denny
d4ccba67f2
Revert "fix passing nested object to macro" ( #20495 )
2025-06-19 13:14:46 -07:00
Meghan Denny
43777cffee
fix passing nested object to macro ( #20467 )
...
Co-authored-by: nektro <5464072+nektro@users.noreply.github.com >
2025-06-19 12:56:27 -07:00
Michael H
a473657adb
[bun build] in cjs node, dont convert module to require.module ( #20343 )
2025-06-16 16:56:54 -07:00
Dylan Conway
f53aff0935
Fix TypeScript non-null assertion with new operator ( #20363 )
...
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan-conway@users.noreply.github.com >
2025-06-13 19:30:52 +02:00
Jarred Sumner
6ebad50543
Introduce ahead of time bundling for HTML imports with bun build ( #20265 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
Co-authored-by: dylan-conway <35280289+dylan-conway@users.noreply.github.com >
2025-06-10 21:26:00 -07:00
Dax
02a7d71b70
Add BUN_BE_BUN environment variable flag ( #20251 )
2025-06-07 20:17:47 -07:00
Roman A
13ea970852
A couple grammar fixes ( #20096 )
2025-05-31 19:14:51 -07:00
190n
f1226c9767
ci: fix machine.mjs for Windows instances ( #20021 )
...
Co-authored-by: 190n <7763597+190n@users.noreply.github.com >
2025-05-29 12:04:10 -07:00
wldfngrs
c42539b0bf
Fix parse segfault #18888 ( #19817 )
...
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-05-29 08:44:19 -07:00
Jarred Sumner
7b164ee9de
Fix async explicit resource management in browser builds ( #19896 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-05-27 16:45:54 -07:00
Jarred Sumner
7b127c946d
Fix regression from #19783 ( #19837 )
2025-05-23 17:49:36 -07:00
Dylan Conway
a844957eb3
Use operationMathPow for parser constant folding ( #19853 )
2025-05-22 20:16:37 -07:00
Jarred Sumner
8aae534270
Fix Node browser fallbacks to have util.inherit and other size improvements ( #19783 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2025-05-20 23:25:52 -07:00
Jarred Sumner
95af099a0c
Fixes #19695 ( #19712 )
2025-05-16 22:29:28 -07:00
pfg
8686361f4f
fix constant folding bug ( #19707 )
2025-05-16 20:32:29 -07:00
190n
270c09bd90
Fix bundler_compile.test.ts ( #19633 )
2025-05-13 16:51:19 -07:00
Dylan Conway
d900309354
add missing snapshot from esbuild/css.test.ts ( #19605 )
2025-05-12 14:13:12 -07:00
Jarred Sumner
14b439a115
Fix formatters not running in CI + delete unnecessary files ( #19433 )
2025-05-08 23:22:16 -07:00
Meghan Denny
147fb975e1
test: fix bundler_compile.test.ts ( #19296 )
2025-04-25 23:43:07 -07:00
Christoph
b7c5bd0922
Fix crash on empty text file import ( #19165 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-04-25 23:42:41 -07:00
chloe caruso
5cc34b667c
fix dce on unused call in comma ( #19233 )
2025-04-23 17:52:52 -07:00
Jarred Sumner
0471254e4e
Use Highway SIMD ( #19134 )
...
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2025-04-21 23:28:03 -07:00
Alistair Smith
74ab6d9fe3
some updates to types ( #18911 )
2025-04-14 14:41:01 -07:00
Jarred Sumner
f575d3ff24
Fixes #18899 ( #18920 )
2025-04-10 14:58:46 -07:00
chloe caruso
378c68a024
fix build log missing spacee ( #18785 )
2025-04-04 15:14:33 -07:00
chloe caruso
976330f4e2
fix bundling regression with builtin modules ( #18735 )
2025-04-02 22:29:31 -07:00