Commit Graph

200 Commits

Author SHA1 Message Date
Jarred Sumner
5a80a2e216 [bun.js] Fix segfault when running many bun.js instances 2022-02-16 04:01:13 -08:00
Jarred Sumner
3ab56cee8a symbol pool remnants 2022-02-16 03:45:48 -08:00
Jarred Sumner
08e8eabc6f Revert "Remove usage of packed struct in Ref because packed is buggy in zig"
This reverts commit 2578f426b6.
2022-02-15 20:08:35 -08:00
Jarred Sumner
2578f426b6 Remove usage of packed struct in Ref because packed is buggy in zig 2022-02-15 13:47:18 -08:00
Jarred Sumner
6e735b710a move import processing into a separate function 2022-02-14 20:21:01 -08:00
Jarred Sumner
423d208790 [bun.js] Handle recursive macros and handle stack overflow 2022-02-14 19:03:25 -08:00
Jarred Sumner
106979876e [bun.js] Auto type coerction for macros! 2022-02-14 04:27:27 -08:00
Jarred Sumner
b9d82ee402 [JS parser] Slightly better dead code elimination & optimize AST string comparison 2022-02-13 20:44:55 -08:00
Jarred Sumner
776909a72d [js parser] Fix test failure with import {type foo} 2022-02-13 20:43:23 -08:00
Jarred Sumner
bcdd2cf220 [tree shaking] Trim unused values in var when possible 2022-02-10 01:28:41 -08:00
Jarred Sumner
e8394905d4 [tree shaking] Fix bug with removing unused const / let 2022-02-10 01:28:29 -08:00
Jarred Sumner
d4afa5477d Move __exportDefault transform to parser 2022-02-08 01:00:46 -08:00
Jarred Sumner
1430cb5e34 Don't import __FastRefreshRuntime if it's a CJS transform 2022-02-07 23:32:48 -08:00
Jarred Sumner
71fcb7b86c Reduce debug build memory usage 2022-02-07 23:10:55 -08:00
Jarred Sumner
3a48954586 [JS Parser] Fix bug with export default Foo when Foo was a bundled import 2022-02-07 23:10:42 -08:00
Jarred Sumner
a571c56b4c [TS] Implement import {type foo} from 'bar'; (type inside clause) 2022-02-07 22:02:54 -08:00
Jarred Sumner
213960a04a Limit the number of pooled objects 2022-02-01 20:47:35 -08:00
Jarred Sumner
857e9bee00 Embed React Fast Refresh in Bun
Fixes https://github.com/Jarred-Sumner/bun/issues/62

If the project has it's own copy of react fast refresh and is bundling, it will use that instead.
2022-01-29 23:48:39 -08:00
Jarred Sumner
4aabccfc79 Fix bug introduced in 97d17904 2022-01-29 20:01:34 -08:00
Jarred Sumner
1e2a61c6a0 Slice once 2022-01-29 19:52:12 -08:00
Jarred Sumner
844fae826f Tag imports 2022-01-29 19:51:47 -08:00
Jarred Sumner
97d17904d3 Update AST layout to store capacity for items
We want to be able to push to the list
2022-01-28 19:26:03 -08:00
Jarred Sumner
f4fbf84294 Make Ref more safe 2022-01-22 16:23:14 -08:00
Jarred Sumner
834ff71157 Use newer hash table 2022-01-22 15:10:21 -08:00
Jarred Sumner
39a187d32e Update js_parser.zig 2022-01-22 15:09:37 -08:00
Jarred Sumner
146d2cc231 Sort imports 2022-01-22 15:09:28 -08:00
Jarred Sumner
111f0921f5 [macros] Always remove imports to macros 2022-01-21 18:09:43 -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
3cd129544e [JS Parser] Reduce memory usage by ~8% 2022-01-05 13:12:11 -08:00
Jarred Sumner
8837c3c10b [Bun.js][bun dev] Support macros inside of Bun.js
Closes #36
2022-01-04 22:12:37 -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
134748a238 [transpiler] Partially support top-level await in HMR 2021-12-16 18:14:06 -08:00
Jarred Sumner
fde4cd4d17 Enable top-level await in browsers 2021-12-16 17:57:13 -08:00
Jarred Sumner
b6e164355b [JS parser] Track import records that were converted to star imports due to require 2021-12-16 17:57:03 -08:00
Jarred Sumner
92f3efeac2 [bundler][JS transpiler] Improve reliability of ESM <> CommonJS interop
This fixes a number of issues caused by not using live bindings when referencing bundled code. This also fixes an issue with libraries looping over `Object.keys(moduleNamespace)`
2021-12-16 01:29:45 -08:00
Jarred Sumner
8af6ad7278 wip fix live bindings 2021-12-15 17:08:04 -08:00
Jarred Sumner
0a916543b3 [JS Parser] Fix bug with template literals that create new scopes in the tag and the template literal value 2021-12-15 16:52:38 -08:00
Jarred Sumner
b61cbb1df8 [internal] const is faster than var (in Zig! not javascript) 2021-11-15 15:39:13 -08:00
Jarred Sumner
89a7e3bf2f slightly reduce reallocations 2021-11-11 15:52:50 -08:00
Jarred Sumner
5537c03569 Fixes https://github.com/Jarred-Sumner/bun/issues/28 2021-11-02 22:53:26 -07:00
Jarred Sumner
bc5f99dc43 [internal] Tiny changes that will eventually make it easier to update zig 2021-11-01 04:04:18 -07:00
Jarred Sumner
6854d83842 [internal] Fix missing symbol errors when building JavaScriptCore bindings without already having the object files 2021-10-29 23:34:19 -07:00
Jarred Sumner
fe6564b533 finish Expr.alloc -> Expr.init 2021-10-24 17:12:30 -07:00
Jarred Sumner
c93655c717 Fix build error 2021-10-24 16:11:06 -07:00
Jarred Sumner
3582941791 [internal] Use isPresent() instead of checking slice len 2021-10-24 15:53:27 -07:00
Jarred Sumner
bd2d284c53 [internal] some inlining 2021-10-24 06:07:39 -07:00
Jarred Sumner
e88e9401f1 Fix bug where occasionally unary expressions would simplify incorrectly due to an undefined memory issue 2021-10-08 17:24:03 -07:00
Jarred Sumner
c2e9d49f69 oops 2021-10-06 19:29:50 -07:00
Jarred Sumner
a493c18193 Fix JSX transform edgecase with static children 2021-10-06 19:21:26 -07:00
Jarred Sumner
0eb3c1d393 Improve Bun's performance by 5%
By making E.Identifier not a pointer, we improve performance by 5%. Heap allocations are bad
2021-10-04 03:28:55 -07:00