Commit Graph

93 Commits

Author SHA1 Message Date
Jarred Sumner
ac36ea51cf possibly more reliable Bun.spawn (#1547)
* wip

* wip

* Fix bug with stdin

* zig fmt

* seems to work!

* Update streams.test.js

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-11-23 07:14:33 -08:00
Jarred Sumner
f84b2ec6d1 Handle threadsafety issue 2022-11-07 19:50:54 -08:00
Jarred Sumner
11aa17a57c Support async onLoad callbacks in Bun.plugin 2022-09-05 23:05:22 -07:00
Jarred Sumner
d034c004f9 Implement bun init subcommand 2022-08-04 21:42:49 -07:00
Jarred Sumner
ba999c9ac3 cleanup 2022-04-30 23:58:46 -07:00
Jarred Sumner
89cd35f07f [bun dev] Improve HMR reliability when filesystem is slow or reading large files 2022-03-31 04:55:47 -07:00
Jarred Sumner
5aae8726ef Switch to std.HashMap for DirEntry store 2022-03-14 23:40:17 -07:00
Jarred Sumner
701d6ec45d rename _global -> bun 2022-03-08 18:54:54 -08:00
Jarred Sumner
d43a645535 source maps optimizations 2022-03-07 00:33:49 -08:00
Jarred Sumner
7c5c6cd519 source maps work for app code in bun dev! 2022-03-06 07:35:16 -08:00
Jarred Sumner
51fbbea1d3 upgrade zig 2022-03-04 00:20:22 -08:00
Jarred Sumner
ea7d38cea7 Update fs.zig 2022-03-02 03:07:04 -08:00
Jarred Sumner
50560e169c WASM 2022-02-27 23:20:10 -08:00
Jarred Sumner
2e2521c638 [bun dev] Implement hash: namespace for file loader to improve browser cache invalidation
This appends a hash to URLs and import paths

In `bun dev`, this means:
  `/foo.woff2` => `/hash:/foo.woff2`

`bun dev` simply ignores this.
2022-02-10 01:37:23 -08:00
Jarred Sumner
f4fbf84294 Make Ref more safe 2022-01-22 16:23:14 -08:00
Jarred Sumner
d3a93d5273 fs.*Sync(), bun wiptest, and More ™ (#106)
* very very wip

* almost ready to fix the errors

* Update identity_context.zig

* Update base.zig

* [bun test] It runs successfully

* Remove unnecessary call

* [Bun.js] Improve JS <> Zig unicode string interop

This fixes longstanding unicode bugs with `console.log` & `fetch`.

I believe @evanwashere reported this first awhile ago

* [Bun.js] Implement `Object.is()` binding and a way to set a timeout for script execution

* Update PLCrashReport.zig

* [Bun.js] Make `console.log` more closely match Node.js and Deno

* [Bun.js] Implement formatting specifier for console.*

* Implement `console.clear()`

* bug fix

* Support console.clear()

* Buffer stderr

* [bun test] Begin implementing Node.js `fs`

* Update darwin_c.zig

* Implement more of `fs`

* `mkdir`, `mkdir` recursive, `mkdtemp`

* `open`, `read` (and pread)

* Move some things into more files

* Implement readdir

* `readFile`, `readLink`, and `realpath`

* `writeFile`, `symlink`, `chown`, `rename`, `stat`, `unlink`, `truncate`

* `lutimes`

* Implement `SystemError` and begin wiring up the `fs` module

* `"fs"` - Most of the arguments / validation

* `fs` - Rest of the arguments / validations

* Begin wiring up the `fs` module

* Fix all the build errors

* support printing typed arrays in console.log

* It...works?

* Support `require("fs")`, `import fs from 'fs';`, `import * as fs from 'fs'`

* Fix a couple bugs

* get rid of the crash reporter for now

* Update fs.exports.js

* [bun.js] slight improvement to startup time

* [bun.js] Improve error message printing

* [Bun.js] Add `Bun.gc()` to run the garbage collector manually and report heap size

* [Bun.js] Add Bun.generateHeapSnapshot to return what JS types are using memory

* [Bun.js] Add `Bun.shrink()` to tell JSC to shrink the VM size

* Improve encoding reader

* [bun.js] Improve callback & microtask performance

* Update node_fs.zig

* Implement `console.assert`

* simple test

* [Bun.js] Prepare for multiple globals/realms to support testing

* Create callbacks-overhead.mjs

* Update http.zig

* [Bun.js] Implement `queueMicrotask`

* Add test for queueMicrotask

* 😪

* [Bun.js] Implement `process.versions`, `process.pid`, `process.ppid`, `process.nextTick`, `process.versions`,

* Implement `process.env.toJSON()`

* [Bun.js] Improve performance of `fs.existsSync`

* 💅

* [Bun.js] Implement `process.chdir(str)` and `process.cwd()`, support up to 4 args in `process.nextTick`

* Make creating Zig::Process lazy

* Split processi nto separte file

* [Bun.js] Node.js Streams - Part 1/?

* [Bun.js] Node.js streams 2/?

* WIP streams

* fix crash

* Reduce allocations in many places

* swap

* Make `bun` start 2ms faster

* Always use an apiLock()

* libBacktrace doesn't really work yet

* Fix crash in the upgrade checker

* Clean up code for importing the runtime when not bundling

* 📷

* Update linker.zig

* 68!

* backtrace

* no, really backtrace

* Fix

* Linux fixes

* Fixes on Linux

* Update mimalloc

* [bun test] Automatically scan for {.test,_test,.spec,_spec}.{jsx,tsx,js,cts,mts,ts,cjs}
2022-01-19 02:29:07 -08:00
Jarred Sumner
4e744c057b Reduce memory usage 2022-01-05 16:42:08 -08:00
Jarred SUmner
b9555a5775 [bun install] Significant perf improvement to installing new packages and fixes 'bun install --production'. Closes #97 2022-01-03 01:40:30 -08:00
Jarred Sumner
3915e01cfb [bun install] Fix RenameAcrossMountPoints error 2022-01-02 00:06:45 -08:00
Jarred Sumner
e75c711c68 Upgrade to latest Zig, remove dependency on patched version of Zig (#96)
* Prepare to upgrade zig

* zig fmt

* AllocGate

* Update data_url.zig

* wip

* few files

* just headers now?

* I think everything works?

* Update mimalloc

* Update hash_map.zig

* Perf improvements to compensate for Allocgate

* Bump

* 📷

* Update bun.lockb

* Less branching

* [js parser] Slightly reduce memory usage

* Update js_parser.zig

* WIP remove unused

* [JS parser] WIP support for `with` keyword

* Remove more dead code

* Fix all the build errors!

* cleanup

* Move `network_thread` up

* Bump peechy

* Update README.md
2021-12-30 21:12:32 -08:00
Jarred Sumner
336a4b6ac2 Prepare to run unit tests & remove some dead code (#92)
* Remove some dead code

* 💀 code

* Fix the zig tests

* [JS Printer] Print integers faster & less scientific notation on decimals

* 💀 dead code

* skip

* Run all the unit tests
2021-12-27 18:06:31 -08:00
Jarred Sumner
5105614b83 Improve devcontainer environment errors 2021-12-24 04:49:57 +00:00
Jarred Sumner
ff99155f7d --dump-limits flag to inspect what the max file descriptor & stack size is 2021-12-21 18:48:52 -08:00
Jarred Sumner
49d8ea4886 [bun install] Fix case when lockfile exists 2021-12-16 19:18:51 -08:00
Jarred Sumner
94e469c803 [bun install] WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
a44cb9708f New subcommand: bun upgrade. It upgrades bun to the latest version. 2021-10-28 05:34:38 -07:00
Jarred SUmner
21d918921a memfd experiment did not yield perf gains on Linux
I suspect the reason why is because we were already using tmpfs. So it was already writing to an in-memory file. O_TMPFILE doesn't seem to do anything for us either here.
2021-10-04 20:01:05 -07:00
Jarred Sumner
55095edee6 Don't pass O_EXCL 2021-10-04 19:07:19 -07:00
Jarred Sumner
6a7deab74d O_TMPFILE 2021-10-04 19:00:18 -07:00
Jarred Sumner
7db27f11d0 memfd_create does not actually make it faster 2021-10-04 18:58:31 -07:00
Jarred Sumner
3ebb4feb98 Attempt to optimize bun bun on Linux by using memfd_create and copying the resulting file via sendfile() 2021-10-04 18:37:51 -07:00
Jarred Sumner
73c27a9a25 Fix various macOS-specific compile errors and run zig fmt 2021-10-03 20:26:54 -07:00
Jarred SUmner
cdabcfd9d0 Linux works now. 2021-10-02 22:54:19 -07:00
Jarred Sumner
9f1e0660dd Fix handling when file metadata store stored exceeds statically allocated count (at time of writing, 16k) 2021-09-20 17:39:39 -07:00
Jarred Sumner
359df89fe3 Fix "browser" map resolution, _almost_ fix symbol collisions, cache absolute paths for file entries 2021-09-12 23:40:12 -07:00
Jarred Sumner
350569655b Support bundling dynamically imported modules. 2021-09-12 00:39:57 -07:00
Jarred Sumner
4f7ff6db2c Fixed memory leaks, but SSR is slower. Should move cleanup & restart steps to a real idle timeout
Former-commit-id: 9499ee3109cb336deb9380f0190631a30c9da51c
2021-09-04 04:50:47 -07:00
Jarred Sumner
a90760b597 Fix logging in bun bun + bump
Former-commit-id: 19275a07342879d9b02b9d9527b762c8bfadb9e6
2021-09-03 13:01:36 -07:00
Jarred Sumner
d009e02c1d latest
Former-commit-id: 1086d4f894611c1171f57d9eaf82f9170e9de2d1
2021-09-02 15:54:07 -07:00
Jarred Sumner
2fa09f7c09 Fix UMD, fix PNPM, importing require'd modules in app code
Former-commit-id: 3d831ad95904d2123964f2ebccff48f1e9f954e9
2021-09-02 11:51:52 -07:00
Jarred Sumner
bd9f137b1b latest
Former-commit-id: 096ec1222ad723d006b0151f10cb0c1b95e2bfd3
2021-08-29 21:48:14 -07:00
Jarred Sumner
92229ac0f6 Fix unbundled imports
Former-commit-id: f221da115c1afcd136648c9683d8e9907005a128
2021-08-26 21:43:42 -07:00
Jarred Sumner
3ae0accbe3 Fix file loader, automatically support CSS imports when a framework isn't set
Former-commit-id: 94750e5987ea8f6e4c946bfc06715e09a48c0eec
2021-08-26 19:56:25 -07:00
Jarred Sumner
4541606469 latest
Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
2021-08-25 17:56:06 -07:00
Jarred Sumner
afb6684782 Fix resolve bug with mixed-case node_modules
Former-commit-id: 5bdae0ee491e28b49ceed6136f04e0c1feddc808
2021-08-23 02:30:30 -07:00
Jarred Sumner
e012efa124 Fix watcher when you move files/dirs around. It'll bust the cache and recreate it (and leak memory)
Former-commit-id: 8faf6127547411c1fdcee9e4e7440825f21ecd99
2021-08-21 22:53:25 -07:00
Jarred Sumner
e6eba3e484 Use the new Lock type
Former-commit-id: fcb04d39a1629047ab0a227c2992922725189ca7
2021-08-20 16:45:01 -07:00
Jarred Sumner
0ba399d8ed etc
Former-commit-id: 67546a63021c0b5b58841a03115fa699ae3e441f
2021-08-18 16:52:35 -07:00
Jarred Sumner
d95ffe6302 .env works
Former-commit-id: 45ee7874f2c8566c3034743161031b0859423f41
2021-08-14 21:28:13 -07:00
Jarred Sumner
4d61ce4dd7 FIx .jsb when bundling packages that have multiple nested package.json
Former-commit-id: 1567dafa8c7bbe97c34e42c86995bd193eeeb6d5
2021-08-12 02:00:25 -07:00