pfg
d8ee26509c
Fix progress showing kb for downloading packages instead of count ( #24700 )
...
- show bytes for upgrading bun
- show no unit for other progress bars
Fix for issue introduced in #24266
2025-11-13 19:29:16 -08:00
pfg
05d0475c6c
Update to zig 0.15.2 ( #24204 )
...
Fixes ENG-21287
Build times, from `bun run build && echo '//' >> src/main.zig && time
bun run build`
|Platform|0.14.1|0.15.2|Speedup|
|-|-|-|-|
|macos debug asan|126.90s|106.27s|1.19x|
|macos debug noasan|60.62s|50.85s|1.19x|
|linux debug asan|292.77s|241.45s|1.21x|
|linux debug noasan|146.58s|130.94s|1.12x|
|linux debug use_llvm=false|n/a|78.27s|1.87x|
|windows debug asan|177.13s|142.55s|1.24x|
Runtime performance:
- next build memory usage may have gone up by 5%. Otherwise seems the
same. Some code with writers may have gotten slower, especially one
instance of a counting writer and a few instances of unbuffered writers
that now have vtable overhead.
- File size reduced by 800kb (from 100.2mb to 99.4mb)
Improvements:
- `@export` hack is no longer needed for watch
- native x86_64 backend for linux builds faster. to use it, set use_llvm
false and no_link_obj false. also set `ASAN_OPTIONS=detect_leaks=0`
otherwise it will spam the output with tens of thousands of lines of
debug info errors. may need to use the zig lldb fork for debugging.
- zig test-obj, which we will be able to use for zig unit tests
Still an issue:
- false 'dependency loop' errors remain in watch mode
- watch mode crashes observed
Follow-up:
- [ ] search `comptime Writer: type` and `comptime W: type` and remove
- [ ] remove format_mode in our zig fork
- [ ] remove deprecated.zig autoFormatLabelFallback
- [ ] remove deprecated.zig autoFormatLabel
- [ ] remove deprecated.BufferedWriter and BufferedReader
- [ ] remove override_no_export_cpp_apis as it is no longer needed
- [ ] css Parser(W) -> Parser, and remove all the comptime writer: type
params
- [ ] remove deprecated writer fully
Files that add lines:
```
649 src/deprecated.zig
167 scripts/pack-codegen-for-zig-team.ts
54 scripts/cleartrace-impl.js
46 scripts/cleartrace.ts
43 src/windows.zig
18 src/fs.zig
17 src/bun.js/ConsoleObject.zig
16 src/output.zig
12 src/bun.js/test/debug.zig
12 src/bun.js/node/node_fs.zig
8 src/env_loader.zig
7 src/css/printer.zig
7 src/cli/init_command.zig
7 src/bun.js/node.zig
6 src/string/escapeRegExp.zig
6 src/install/PnpmMatcher.zig
5 src/bun.js/webcore/Blob.zig
4 src/crash_handler.zig
4 src/bun.zig
3 src/install/lockfile/bun.lock.zig
3 src/cli/update_interactive_command.zig
3 src/cli/pack_command.zig
3 build.zig
2 src/Progress.zig
2 src/install/lockfile/lockfile_json_stringify_for_debugging.zig
2 src/css/small_list.zig
2 src/bun.js/webcore/prompt.zig
1 test/internal/ban-words.test.ts
1 test/internal/ban-limits.json
1 src/watcher/WatcherTrace.zig
1 src/transpiler.zig
1 src/shell/builtin/cp.zig
1 src/js_printer.zig
1 src/io/PipeReader.zig
1 src/install/bin.zig
1 src/css/selectors/selector.zig
1 src/cli/run_command.zig
1 src/bun.js/RuntimeTranspilerStore.zig
1 src/bun.js/bindings/JSRef.zig
1 src/bake/DevServer.zig
```
Files that remove lines:
```
-1 src/test/recover.zig
-1 src/sql/postgres/SocketMonitor.zig
-1 src/sql/mysql/MySQLRequestQueue.zig
-1 src/sourcemap/CodeCoverage.zig
-1 src/css/values/color_js.zig
-1 src/compile_target.zig
-1 src/bundler/linker_context/convertStmtsForChunk.zig
-1 src/bundler/bundle_v2.zig
-1 src/bun.js/webcore/blob/read_file.zig
-1 src/ast/base.zig
-2 src/sql/postgres/protocol/ArrayList.zig
-2 src/shell/builtin/mkdir.zig
-2 src/install/PackageManager/patchPackage.zig
-2 src/install/PackageManager/PackageManagerDirectories.zig
-2 src/fmt.zig
-2 src/css/declaration.zig
-2 src/css/css_parser.zig
-2 src/collections/baby_list.zig
-2 src/bun.js/bindings/ZigStackFrame.zig
-2 src/ast/E.zig
-3 src/StandaloneModuleGraph.zig
-3 src/deps/picohttp.zig
-3 src/deps/libuv.zig
-3 src/btjs.zig
-4 src/threading/Futex.zig
-4 src/shell/builtin/touch.zig
-4 src/meta.zig
-4 src/install/lockfile.zig
-4 src/css/selectors/parser.zig
-5 src/shell/interpreter.zig
-5 src/css/error.zig
-5 src/bun.js/web_worker.zig
-5 src/bun.js.zig
-6 src/cli/test_command.zig
-6 src/bun.js/VirtualMachine.zig
-6 src/bun.js/uuid.zig
-6 src/bun.js/bindings/JSValue.zig
-9 src/bun.js/test/pretty_format.zig
-9 src/bun.js/api/BunObject.zig
-14 src/install/install_binding.zig
-14 src/fd.zig
-14 src/bun.js/node/path.zig
-14 scripts/pack-codegen-for-zig-team.sh
-17 src/bun.js/test/diff_format.zig
```
`git diff --numstat origin/main...HEAD | awk '{ print ($1-$2)"\t"$3 }' |
sort -rn`
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
Co-authored-by: Meghan Denny <meghan@bun.com >
Co-authored-by: tayor.fish <contact@taylor.fish >
2025-11-10 14:38:26 -08:00
robobun
c5def80191
Fix Output.enable_ansi_colors usage to check stdout vs stderr ( #24212 )
...
## Summary
Updated all 49 usages of `Output.enable_ansi_colors` to properly check
either `Output.enable_ansi_colors_stdout` or
`Output.enable_ansi_colors_stderr` based on their output destination.
This prevents bugs where ANSI colors are checked against the wrong
stream (e.g., checking stdout colors when writing to stderr).
## Changes
### Added
- `Output.enable_ansi_colors` now a `@compileError` to prevent future
misuse with helpful error message directing to correct variants
### Deleted
- `Output.isEmojiEnabled()` - replaced all usages with
`enable_ansi_colors_stderr` (all were error/progress output)
- `Output.prettyWithPrinterFn()` - removed unused dead code
### Updated by Output Destination
**Stderr (error/diagnostic output):**
- logger.zig: Log messages and errors
- crash_handler.zig: Crash reports and stack traces (10 instances)
- PackageInstaller.zig: Error messages from lifecycle scripts (3
instances)
- JSValue.zig: Test expectation error messages
- JSGlobalObject.zig: Exception throwing
- pack_command.zig: Progress indicators
- VirtualMachine.zig: Exception printing (2 instances)
- Test expect files: Test failure messages and diffs (10 instances)
- diff_format.zig: Test diff output
- ProgressStrings.zig: Package manager progress emojis (6 functions)
- security_scanner.zig: Security scan progress emoji
- output.zig: panic(), resetTerminal()
**Stdout (primary output/interactive UI):**
- hot_reloader.zig: Terminal clearing on reload
- Version.zig: Version diff formatting
- install_with_manager.zig: Package installation tree
- update_interactive_command.zig: Interactive update UI (2 instances)
- init_command.zig: Interactive radio buttons
- create_command.zig: Template creation output (2 instances)
- outdated_command.zig: Outdated packages table
- publish_command.zig: Box drawing characters (6 instances)
**Backward Compatible:**
- BunObject.zig: `Bun.enableANSIColors` property returns `(stdout ||
stderr)` to maintain compatibility
- fmt.zig: Removed unused `.default` field from Options struct
## Test Plan
- ✅ All changes compile successfully with `bun run zig:check`
- ✅ Verified all 49 usages have been updated to appropriate variant
- ✅ Verified no remaining references to deprecated functions/variables
- ✅ Compile error triggers if someone tries to use
`Output.enable_ansi_colors`
## Stats
- 24 files changed
- 58 insertions, 77 deletions (net -19 lines)
- 49 usages correctly updated
- 3 items deleted/deprecated
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
2025-10-31 19:08:41 -07:00
Dylan Conway
fb2bf3fe83
fix(pack): always include bin even if not included by files ( #23606 )
...
### What does this PR do?
Fixes #23521
### How did you verify your code works?
Added 3 previously failing tests for `"bin"`, `"directories.bin"`, and
deduplicating entry in both `"bin.directories"` and `"files"`
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-19 23:28:59 -07:00
Dylan Conway
312a86fd43
fix writing UTF-16 with a trailing unpaired surrogate to process.stdout/stderr ( #23444 )
...
### What does this PR do?
Fixes `bun -p "process.stderr.write('Hello' +
String.fromCharCode(0xd800))"`.
Also fixes potential index out of bounds if there are many invalid
sequences.
This also affects `TextEncoder`.
### How did you verify your code works?
Added tests for edgecases
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-10-10 03:48:04 -07:00
Dylan Conway
8d28289407
fix(install): make negative workspace patterns work ( #23229 )
...
### What does this PR do?
It's common for monorepos to exclude portions of a large glob
```json
"workspaces": [
"packages/**",
"!packages/**/test/**",
"!packages/**/template/**"
],
```
closes #4621 (note: patterns like `"packages/!(*-standalone)"` will need
to be written `"!packages/*-standalone"`)
### How did you verify your code works?
Manually tested https://github.com/opentiny/tiny-engine , and added a new
workspace test.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-04 00:31:47 -07:00
Meghan Denny
45760cd53c
ci: instrument being able to run leaksanitizer ( #21142 )
...
tests not in `test/no-validate-leaksan.txt` will run with leaksanitizer
in CI
leaks documented in `test/leaksan.supp` will not cause a test failure
-- notes about leaksanitizer
- will not catch garbage collected objects accumulated during
long-running processes
- will not catch js objects (eg a strong held to a promise)
- will catch native calls to `malloc` not `free`d
- will catch allocations made in C, Zig, C++, libc, dependencies,
dlopen'd
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-09-19 02:06:02 -07:00
taylor.fish
437e15bae5
Replace catch bun.outOfMemory() with safer alternatives ( #22141 )
...
Replace `catch bun.outOfMemory()`, which can accidentally catch
non-OOM-related errors, with either `bun.handleOom` or a manual `catch
|err| switch (err)`.
(For internal tracking: fixes STAB-1070)
---------
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-08-26 12:50:25 -07:00
taylor.fish
07cd45deae
Refactor Zig imports and file structure (part 1) ( #21270 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-22 17:51:38 -07:00
robobun
718e7cdc43
Upgrade libarchive to v3.8.1 ( #21250 )
...
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: Zack Radisic <zack@theradisic.com >
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-21 20:08:00 -07:00
pfg
83760fc446
Sort imports in all files ( #21119 )
...
Co-authored-by: taylor.fish <contact@taylor.fish >
2025-07-21 13:26:47 -07:00
jarred-sumner-bot
803181ae7c
Add --quiet flag to bun pm pack command ( #21053 )
...
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: jarred-sumner-bot <220441119+jarred-sumner-bot@users.noreply.github.com >
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-07-15 01:14:58 -07:00
Zack Radisic
ac61b1d471
Use better function names for bun.String ( #20999 )
2025-07-12 18:19:16 -07:00
Dylan Conway
f24e8cb98a
implement "nodeLinker": "isolated" in bun install ( #20440 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-07-09 00:19:57 -07:00
Meghan Denny
068997b529
make node:dns,net,cluster,tls exception checker clear ( #20658 )
...
Co-authored-by: nektro <5464072+nektro@users.noreply.github.com >
2025-07-03 18:28:38 -07:00
Jarred Sumner
498186764a
Remove a memcpy ( #20261 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
2025-06-08 05:07:09 -07:00
Jarred Sumner
407c4e800a
Revert "add support for "workspaces.nohoist" and "workspaces.hoistingLimits" ( #20124 )"
...
This reverts commit 11070b8e16 .
2025-06-03 23:51:03 -07:00
Dylan Conway
11070b8e16
add support for "workspaces.nohoist" and "workspaces.hoistingLimits" ( #20124 )
2025-06-03 23:44:09 -07:00
Jarred Sumner
390798c172
Fix memory leak in Bun.spawn ( #20095 )
...
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-05-31 20:06:22 -07:00
Meghan Denny
284de53f26
safety: audit and add missing exception checks to JSC::constructArray+constructEmptyArray ( #20119 )
2025-05-31 20:05:02 -07:00
Jarred Sumner
3ea6133c46
CI: Remove unused top-level decls in formatter in zig ( #19879 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-05-23 22:49:48 -07:00
Dylan Conway
98ee30eccf
Implement catalogs in bun install ( #19809 )
...
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com >
2025-05-20 23:03:21 -07:00
Dylan Conway
acf36d958a
fix(npmrc): handle BOM conversion ( #18878 )
2025-05-06 22:16:56 -07:00
chloe caruso
3349c995b5
no usingnamespace, organize jsc namespace, enable -fincremental ( #19122 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
2025-04-22 16:34:15 -07:00
chloe caruso
4ec410e0d7
internal: make @import("bun") work in zig ( #19096 )
2025-04-17 12:32:47 -07:00
chloe caruso
903706dccf
file descriptor rewrite ( #18790 )
2025-04-15 09:37:11 -07:00
Don Isaac
f730a355bf
fix: BufferWriter never returns an error ( #18981 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-04-13 08:57:41 -07:00
Jarred Sumner
879fdd7ef6
Bump Zig again ( #18948 )
2025-04-11 19:13:20 -07:00
Don Isaac
f0dfa109bb
fix(cli/pack): excluded entries nested within included dirs ( #18509 )
...
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-03-28 19:05:37 -07:00
Jarred Sumner
e39305dd91
Remove deprecated shim wrapper for zig <> c++ fns ( #18269 )
...
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-03-19 15:40:08 -07:00
190n
de4182f305
chore: upgrade zig to 0.14.0 ( #17820 )
...
Co-authored-by: 190n <7763597+190n@users.noreply.github.com >
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com >
Co-authored-by: pfg <pfg@pfg.pw >
Co-authored-by: pfgithub <6010774+pfgithub@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-03-14 22:13:31 -07:00
Zack Radisic
e6cb0de539
CSS modules ( #17958 )
2025-03-06 23:35:06 -08:00
versecafe
39fdabc364
Add bun pm pack --filename for Yarn compatibility ( #17628 )
2025-02-25 21:17:04 -08:00
Meghan Denny
1574df835e
zig: make JSValue.toBunString use JSError ( #17648 )
2025-02-25 13:04:44 -08:00
Ben Kunkle
b44769c751
Glob Match Rewrite ( #16824 )
...
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com >
2025-02-14 06:32:57 -08:00
chloe caruso
2b97d61deb
chore: remove some trivial usage of usingnamespace ( #17268 )
2025-02-11 19:38:52 -08:00
Michael H
584db03a74
bun pm pack support "files" starting with ./ (#17135 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
2025-02-08 01:27:15 -08:00
Jarred Sumner
aac951bd47
Move semver-related structs into their own files ( #16987 )
2025-02-02 00:20:45 -08:00
Dylan Conway
8e2cf8665a
fix(publish): "tarball" and "_attachment" path fix ( #16630 )
2025-01-24 18:48:42 -08:00
Michael H
c297fc8070
bun pm pack + bundleDependencies with scoped packages (#16407 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com >
2025-01-15 16:14:15 -08:00
Michael H
5c5793050c
allow bundledDependencies: true in bun pm pack ( #16382 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
2025-01-14 02:43:18 +00:00
Dylan Conway
5058bd3913
handle bundle(d)Dependencies in bun install ( #16055 )
2024-12-31 13:40:55 -08:00
Jarred Sumner
d6b9c444c1
Rename src/bundler.zig to src/transpiler.zig ( #15921 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
2024-12-21 00:59:37 -08:00
Don Isaac
acb9fdfcf5
refactor: organize native glob code ( #15914 )
...
Co-authored-by: DonIsaac <DonIsaac@users.noreply.github.com >
2024-12-20 20:59:07 -08:00
Dylan Conway
b55ca429c7
Implement text-based lockfile ( #15705 )
2024-12-11 05:05:49 -08:00
Meghan Denny
2d441d868b
zig: make throw use JSError ( #15444 )
2024-12-02 14:19:18 -08:00
Meghan Denny
82cb82d828
pm: add some missing npm_ env vars ( #14786 )
...
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com >
2024-11-22 15:13:32 -08:00
Meghan Denny
0e3e33072b
zig: rename CallFrame.arguments to .arguments_old to free up decl name ( #15296 )
2024-11-20 16:18:56 -08:00
Meghan Denny
fdd8d35845
allow zig js host functions to return JSError ( #15120 )
2024-11-13 21:11:56 -08:00
Dylan Conway
62881ee36b
Redact secrets in bunfig.toml and npmrc logs ( #14919 )
2024-10-31 18:44:24 -07:00