Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
1677987
bring in shell impl
zackradisic Nov 17, 2023
04522b8
add `$` to global bun scope
zackradisic Nov 18, 2023
6285460
Expose shell parse func on debug mode
zackradisic Nov 18, 2023
f6cb5fc
Expose lex tokens and add tests
zackradisic Nov 18, 2023
7e4bfde
refactor parser to have better ast
zackradisic Nov 18, 2023
b86ccb6
assigns and export
zackradisic Nov 18, 2023
b29565a
pipeline kinda working
zackradisic Nov 18, 2023
b97edba
Decouple Subprocess spawning code from JS stuff
zackradisic Nov 19, 2023
3dce67f
Subprocess works!
zackradisic Nov 19, 2023
6087e29
Conditional execution
zackradisic Nov 19, 2023
59c910b
Support JS objects in template expression
zackradisic Nov 20, 2023
e22fab3
More complete redirection
zackradisic Nov 20, 2023
c708557
Properly drain stdin/stdout/stderr and fix crash from deallocating JS…
zackradisic Nov 20, 2023
9a237e8
Return errors in parser
zackradisic Nov 20, 2023
5686894
Support command substitution
zackradisic Nov 21, 2023
5043df7
wip brace expansion stuff
zackradisic Nov 21, 2023
7677694
Rearrange some files
zackradisic Nov 21, 2023
5da29a2
expansion wip
zackradisic Nov 22, 2023
463ef5d
Brace expansion working
zackradisic Nov 22, 2023
0c1ec4f
wip brace expansion
zackradisic Nov 22, 2023
12ad088
refactor brace algorithm
zackradisic Nov 22, 2023
1b15dc6
wip brace expansion on shell
zackradisic Nov 22, 2023
9fce56c
fix brace expansion
zackradisic Nov 23, 2023
b8f12cb
Working nested brace expansion!
zackradisic Nov 23, 2023
bf52ce9
Merge branch 'main' into bun-shell
zackradisic Nov 23, 2023
63d6ecc
brace expansion in shell variable assignment only set the last expanded
zackradisic Nov 23, 2023
a7cb5e7
stuff
zackradisic Nov 23, 2023
feca68d
Small little perf things
zackradisic Nov 23, 2023
a9e3184
benchmark and test and stuff
zackradisic Nov 23, 2023
f54f7c6
stuff
zackradisic Nov 23, 2023
9396fb5
fix nested braces but its also kinda broken
zackradisic Nov 23, 2023
cd2e924
attempt to fix complicated nested braces
zackradisic Nov 24, 2023
47f5c15
test
zackradisic Nov 24, 2023
2edc40f
Use fast tokenized algorithm for non nested braces, use parsed algori…
zackradisic Nov 24, 2023
efc0609
fix nested braces one and for all
zackradisic Nov 24, 2023
27922fe
small stuff
zackradisic Nov 24, 2023
5ac3ddf
Not sure if that made a difference
zackradisic Nov 25, 2023
e679878
revert that
zackradisic Nov 25, 2023
f48a113
good speed optimization
zackradisic Nov 25, 2023
79aeab8
rip
zackradisic Nov 25, 2023
c0f347c
Environment variables, builtin/native shell cmds
zackradisic Nov 27, 2023
dddf4f5
Fix tests
zackradisic Nov 27, 2023
d89ecc6
Support `cd`, `pwd`, add boilerplate for glob expansion
zackradisic Nov 27, 2023
de3e581
Support `which`
zackradisic Nov 27, 2023
728bf58
Support `rm`
zackradisic Nov 28, 2023
89ad1f2
Merge branch 'main' into bun-shell
zackradisic Nov 28, 2023
da09912
wip
zackradisic Nov 28, 2023
410e43f
wip
zackradisic Nov 28, 2023
ae070d6
escaping and abstract shell char iterator
zackradisic Nov 28, 2023
27b2ceb
strpool unicode
zackradisic Nov 28, 2023
4962036
Brace expansion support unicode, disallow invalid surrogates in shell…
zackradisic Nov 28, 2023
ab0f3f1
shell choose ascii or unicode lexer depending on input
zackradisic Nov 28, 2023
22de21f
fix bugs write tests
zackradisic Nov 29, 2023
dadffbf
kinda start async stuff
zackradisic Nov 30, 2023
653db2f
HOLY SHIT big refactor of Subprocess
zackradisic Nov 30, 2023
da671d7
HOLY MOLY it works
zackradisic Nov 30, 2023
38b9735
Refactor some stuff, start eval word expansion
zackradisic Dec 1, 2023
7c0294c
interpret all the nodes
zackradisic Dec 1, 2023
0328320
stuff
zackradisic Dec 3, 2023
873b214
stuff
zackradisic Dec 7, 2023
e2527c5
stuff
zackradisic Dec 7, 2023
1ee9b7d
kind of works but doesnt
zackradisic Dec 8, 2023
6465fd9
Buffered output works
zackradisic Dec 9, 2023
a879427
no need to heap allocate autosizer
zackradisic Dec 9, 2023
2f8647d
Fix bug
zackradisic Dec 9, 2023
119a9ec
Fix some stuff
zackradisic Dec 9, 2023
fa3ff60
unprotect
zackradisic Dec 9, 2023
ad258f3
move out dummy shell thing
zackradisic Dec 9, 2023
780a1ac
Bring back assignments
zackradisic Dec 10, 2023
e1419fc
create expansion state so it can be non blocking for expansions that …
zackradisic Dec 10, 2023
2d45f6c
glob back in action
zackradisic Dec 11, 2023
7421793
Setup builtin non blocking IO commands and implement export
zackradisic Dec 12, 2023
bd9bb6d
make Cmd state machine use a loop so control flow is a bit more clear
zackradisic Dec 12, 2023
cb6f179
rename stuff
zackradisic Dec 12, 2023
bb1fa8d
Merge branch 'main' into bun-shell
zackradisic Dec 12, 2023
91263ba
move that
zackradisic Dec 12, 2023
4ccab0c
Implement the echo builtin again
zackradisic Dec 12, 2023
177ae65
implement cd again but non blocking io
zackradisic Dec 13, 2023
b8231c1
Fix ls and use proper write function to prevent blockign writes
zackradisic Dec 13, 2023
da611aa
Implement which
zackradisic Dec 13, 2023
1af0e1d
holy moly big port std.fs.deleteTree
zackradisic Dec 13, 2023
297b2f4
fix compile errors
zackradisic Dec 14, 2023
776306c
Okay that works
zackradisic Dec 15, 2023
0d912c6
rm works thatsnice
zackradisic Dec 15, 2023
66e94d8
damn
zackradisic Dec 15, 2023
8a38196
split it out
zackradisic Dec 15, 2023
994af2d
rm async implementation
zackradisic Dec 17, 2023
1a97649
fix rm bug for nested
zackradisic Dec 17, 2023
64af66b
Work on files as well
zackradisic Dec 17, 2023
e4c60bb
prevent root from being deleted
zackradisic Dec 17, 2023
8b236f2
rm error handling
zackradisic Dec 17, 2023
9dd7016
oops
zackradisic Dec 18, 2023
07349fe
pwd and fix some script exec bug
zackradisic Dec 18, 2023
c2e4015
Implement `mv`
zackradisic Dec 18, 2023
1a9eea6
stub out mv to work accross filesystems
zackradisic Dec 18, 2023
9112642
move it around
zackradisic Dec 18, 2023
89ed537
woops
zackradisic Dec 18, 2023
2326c16
boilerplate for ls and options
zackradisic Dec 18, 2023
b3e4b6c
more boilerplate
zackradisic Dec 18, 2023
6eef5d3
stuff
zackradisic Dec 18, 2023
3170f6e
Merge branch 'main' into bun-shell
zackradisic Dec 18, 2023
1a8c90d
that got lost in merge
zackradisic Dec 18, 2023
b54913d
upgrade shell stuff zig 0.12.0-dev.1828+225fe6ddb
zackradisic Dec 18, 2023
6dbd984
Implement basic ls
zackradisic Dec 19, 2023
98c7d2c
Merge branch 'main' into bun-shell
zackradisic Dec 25, 2023
3ad0a80
smol cleanup
zackradisic Dec 26, 2023
5467b18
Fix stream, response redirect stdin
zackradisic Dec 26, 2023
f5d76b7
No longer need spawn to be abstract
zackradisic Dec 26, 2023
a1ebec6
Custom promise
zackradisic Dec 27, 2023
30b0431
move around some stuff
zackradisic Dec 27, 2023
8228134
shell promise returns shell output
zackradisic Dec 28, 2023
f8a8a80
make tht work for builtins
zackradisic Dec 28, 2023
eb9d4ba
refactor IO abstractions to work with JS or mini event loop
zackradisic Dec 29, 2023
6821386
woops
zackradisic Dec 29, 2023
7f44b58
scaffolding for refactor
zackradisic Dec 30, 2023
6b63de0
refactor builtins to make event loop refactor easier
zackradisic Dec 30, 2023
d66b257
Fix parsing edge case on assignments, fix expansion on cmd assignments
zackradisic Dec 30, 2023
23b7190
change subproc to work with any event loop
zackradisic Jan 2, 2024
73389c8
Finish refactoring subproc
zackradisic Jan 2, 2024
ee03a36
move global abstraction out
zackradisic Jan 2, 2024
9bf5c7f
big refactor boys
zackradisic Jan 2, 2024
8598676
holy moly: integrate into cli and fix allll the compile errors
zackradisic Jan 4, 2024
1cd8dbd
okay works in bun run now
zackradisic Jan 4, 2024
d708fc9
actually tick the event loop lol
zackradisic Jan 4, 2024
f2c683c
Fix more stuff
zackradisic Jan 4, 2024
b9a3b03
Support comments
zackradisic Jan 4, 2024
a8d96d2
Fix some tests
zackradisic Jan 9, 2024
f4cbfbe
delete that
zackradisic Jan 9, 2024
8983b1d
Properly report errors when failing to spawn command
zackradisic Jan 9, 2024
8b54b65
fix a whole bunch of tests
zackradisic Jan 9, 2024
f57c1b3
fix a whole bunch of tests again
zackradisic Jan 10, 2024
5faabf0
.
zackradisic Jan 10, 2024
0738b52
Fix rm
zackradisic Jan 10, 2024
0b7bfce
Fix some exit code bugs, write force rm from deno, fix ls stderr
zackradisic Jan 11, 2024
1be8b93
fix `rm -d`
zackradisic Jan 11, 2024
5383402
fix `rm -d`
zackradisic Jan 11, 2024
48fd58d
Fix boolean logic
zackradisic Jan 12, 2024
efd1a4f
error on subshells (e.g. `true && (echo hi && echo lol)`)
zackradisic Jan 12, 2024
d6f49a3
Move out shell state from interpreter struct
zackradisic Jan 12, 2024
5054d91
Cmd substitution supports arbitrary script, not just a single cmd
zackradisic Jan 13, 2024
cb6ba75
Some escaping/quotation tests
zackradisic Jan 13, 2024
1d8f9d5
Fix stuff add more tests:
zackradisic Jan 13, 2024
1fc268b
ALOT of stuff:
zackradisic Jan 13, 2024
428c73c
Fix subtle bugs
zackradisic Jan 14, 2024
6b47a4d
Fix crazy redirect to arraybuffer bug
zackradisic Jan 14, 2024
b4f8d85
more crazy echo edgecases
zackradisic Jan 14, 2024
03508ef
Proper lexer errors instead of just panicking lol
zackradisic Jan 14, 2024
e8f9033
yoops
zackradisic Jan 14, 2024
3ec7cf3
Proper parsing errors
zackradisic Jan 14, 2024
95094b0
Errors for bun run shell script
zackradisic Jan 14, 2024
22c1b38
Fix redirecting to file
zackradisic Jan 14, 2024
d3462d1
More test fix bugs yay
zackradisic Jan 14, 2024
562f998
Fix redirect on builtins
zackradisic Jan 14, 2024
98141f3
Open redirection fds with O_TRUNC
zackradisic Jan 14, 2024
f4449eb
Fix lexing invalid variables and add ability to change cwd from JS api
zackradisic Jan 14, 2024
265cfd6
yoops
zackradisic Jan 14, 2024
e458417
Fix `.cwd()`
zackradisic Jan 14, 2024
030a653
`$PWD` and fix redirection bugs
zackradisic Jan 14, 2024
1698492
`$PWD` and fix redirection bugs
zackradisic Jan 14, 2024
c36f392
Get rid of some `FIXME`s
zackradisic Jan 14, 2024
4bb553a
throw errors in some places instead of panicking
zackradisic Jan 15, 2024
5edb7a9
Print some errors to stderr
zackradisic Jan 15, 2024
392af75
Get rid of some more panics again
zackradisic Jan 15, 2024
cd26a49
Handle errors on glob
zackradisic Jan 15, 2024
7229802
pwd test
zackradisic Jan 15, 2024
0aad11e
`.env()`
zackradisic Jan 15, 2024
3aebc9f
copy-on-write abstraction
zackradisic Jan 17, 2024
36e90b1
Reference counted env strings + fix some tests
zackradisic Jan 17, 2024
9dee374
deinit cwd
zackradisic Jan 17, 2024
f599742
Put commands into a pipeline properly
zackradisic Jan 18, 2024
76c1adf
deinit Expansion and Assigns properly
zackradisic Jan 18, 2024
c463a57
comments
zackradisic Jan 18, 2024
416f1f7
Comments
zackradisic Jan 18, 2024
ca73ca6
Merge branch 'main' into bun-shell
Jarred-Sumner Jan 18, 2024
b813130
Make it compile
Jarred-Sumner Jan 18, 2024
052e478
Update types
Jarred-Sumner Jan 18, 2024
4de18ec
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 18, 2024
fb190a1
Only one WaiterThread
Jarred-Sumner Jan 18, 2024
72424f9
Fix lifetimes and clean up interface
Jarred-Sumner Jan 18, 2024
8eac5fc
Update shell.ts
Jarred-Sumner Jan 18, 2024
36a34be
Add lazy test
Jarred-Sumner Jan 18, 2024
82fcd98
Remove some dead code
Jarred-Sumner Jan 18, 2024
c7f44f6
Update shell.zig
Jarred-Sumner Jan 18, 2024
f412750
Fix memory leak
Jarred-Sumner Jan 18, 2024
bd1a9c2
Fix crash with empty braces
Jarred-Sumner Jan 18, 2024
6f80c3c
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 18, 2024
0f32b40
Linux build + bun.sh
Jarred-Sumner Jan 18, 2024
25e72b9
Update subproc.zig
Jarred-Sumner Jan 18, 2024
bebe3a6
Update interpreter.zig
Jarred-Sumner Jan 18, 2024
8b210bf
Update interpreter.zig
Jarred-Sumner Jan 18, 2024
4afdf9e
Fix some stuff that broke
zackradisic Jan 18, 2024
0a2f7e2
Fix Windows compile errors
zackradisic Jan 18, 2024
5734c12
Fix some fd leaks
zackradisic Jan 18, 2024
3292f5a
Fix ls
zackradisic Jan 18, 2024
302f4b3
Fix a bunch of stuff
zackradisic Jan 18, 2024
db72883
Fix quiet
zackradisic Jan 18, 2024
ed73c75
Update leak tests fix rm bug
zackradisic Jan 18, 2024
2e2c822
More reproducible tests
Jarred-Sumner Jan 19, 2024
e12114c
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2024
308521a
more mem leak tests
zackradisic Jan 19, 2024
3f39cf3
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
a0ebfe9
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2024
da8f080
Fix merge conflict
Jarred-Sumner Jan 19, 2024
159a17b
Fix test not actually using temp directory
Jarred-Sumner Jan 19, 2024
b763fb2
Update bunshell.test.ts
Jarred-Sumner Jan 19, 2024
56e819a
Shell instance
Jarred-Sumner Jan 19, 2024
1c4c265
Capture async context
Jarred-Sumner Jan 19, 2024
6ac49b6
Increase test timeouts
Jarred-Sumner Jan 19, 2024
0cc5528
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2024
1dc5689
Escape
zackradisic Jan 19, 2024
a5e58f5
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
d2fac66
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2024
91ab5f7
Fix crash
zackradisic Jan 19, 2024
64f9dc9
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
01ab8e1
Add more methods
Jarred-Sumner Jan 19, 2024
9230418
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2024
85ecf2d
Fix leak
Jarred-Sumner Jan 19, 2024
f5e8c79
Treat file(path) blobs as a file path string
Jarred-Sumner Jan 19, 2024
ee38298
Create bunshell-file.test.ts
Jarred-Sumner Jan 19, 2024
bf41876
Support Blob input
Jarred-Sumner Jan 19, 2024
c298e51
Fix leak + organize imports
Jarred-Sumner Jan 19, 2024
787df9c
doc
Jarred-Sumner Jan 19, 2024
bbf7208
Update shell.md
Jarred-Sumner Jan 19, 2024
4d3d33a
Update shell.md
Jarred-Sumner Jan 19, 2024
70d320e
Update shell.md
Jarred-Sumner Jan 19, 2024
f5d1419
Update shell.md
Jarred-Sumner Jan 19, 2024
2f5a154
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
e8519fe
Update CMakeLists.txt
Jarred-Sumner Jan 19, 2024
86c8732
Fix segfault by cloning error path so it's not freed by arena
zackradisic Jan 19, 2024
d21a0c3
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
d8d9411
deinit ShellErr
zackradisic Jan 19, 2024
66fe072
Delete dead code
Jarred-Sumner Jan 19, 2024
c6e01ca
fix really stupid segfault
zackradisic Jan 19, 2024
a8e3405
Merge branch 'bun-shell' of github.com:zackradisic/bun into bun-shell
zackradisic Jan 19, 2024
b1009fc
don't deinit shell ls task in event loop
zackradisic Jan 19, 2024
0c8a336
Fix ls bug
zackradisic Jan 19, 2024
6dbb3a4
Fix tests
zackradisic Jan 19, 2024
fc5b0d6
make truly lazy
zackradisic Jan 19, 2024
26a3024
allow more things in the shell substitution and escape whitespace
zackradisic Jan 19, 2024
94f9816
Fix newline and exit when finishing shell in `bun run`
zackradisic Jan 19, 2024
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
20 changes: 20 additions & 0 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0067 NEW)

set(Bun_VERSION "1.0.23")
set(Bun_VERSION "1.0.24")
set(WEBKIT_TAG 9c501b9aa712b7959f80dc99491e8758c151c20e)

set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}")
Expand Down
Binary file modified bench/bun.lockb
Binary file not shown.
36 changes: 36 additions & 0 deletions bench/glob/braces.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import braces from "braces";
import { group, bench, run } from "mitata";

// const iterations = 1000;
const iterations = 100;

const simplePattern = "foo.{js,jsx,ts,tsx}";
const complexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}} wow {a,b}";
const veryComplexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}}{1,2,{3,4},5}";

console.log(braces(complexPattern, { expand: true }));
function benchPattern(pattern, name) {
group({ name: `${name} pattern: "${pattern}"`, summary: true }, () => {
bench("Bun", () => {
for (let i = 0; i < iterations; i++) {
Bun.$.braces(pattern);
}
});

bench("micromatch/braces", () => {
for (let i = 0; i < iterations; i++) {
braces(pattern, { expand: true });
}
});
});
}

benchPattern(simplePattern, "simple");
benchPattern(complexPattern, "complex");
benchPattern(veryComplexPattern, "very complex pattern");

await run({
avg: true,
min_max: true,
percentiles: true,
});
1 change: 1 addition & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"@babel/preset-react": "^7.16.7",
"@swc/core": "^1.2.133",
"benchmark": "^2.1.4",
"braces": "^3.0.2",
"esbuild": "^0.14.12",
"eventemitter3": "^5.0.0",
"fast-glob": "3.3.1",
Expand Down
Loading