Commit Graph

186 Commits

Author SHA1 Message Date
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
Jarred Sumner
db24a27e61 Fix potential infinite loop on calling macros 2021-09-30 22:33:36 -07:00
Jarred Sumner
f8297aee4d Fix jsxDEV transform bug that occurred when not including source and the component rendered an exception 2021-09-30 22:32:03 -07:00
Jarred Sumner
b267aace71 Fix dead-code elimination edgecase with call expressions 2021-09-30 22:30:32 -07:00
Jarred Sumner
fdda1078f8 Support remapping macro paths 2021-09-30 18:58:39 -07:00
Jarred Sumner
88e7e12a50 Fix all the compile errors 2021-09-30 14:20:45 -07:00
Jarred Sumner
4cdc8939ab Wire up macro-injected imports and move some structs above the gigantic parser type to reduce bun compile time a little 2021-09-30 13:49:46 -07:00
Jarred Sumner
74db7809eb Most of the code & API changes necessary for supporting Relay (GraphQL) 2021-09-29 23:28:54 -07:00
Jarred Sumner
4f9558dd71 Bundling ignores macros 2021-09-27 01:33:23 -07:00
Jarred Sumner
b3894994c0 Fix getting object properties 2021-09-26 21:21:51 -07:00
Jarred Sumner
018ba2c83b Most of macro implementation 2021-09-26 20:03:49 -07:00
Jarred Sumner
66ed7c1f30 Basic macro impl 2021-09-26 00:14:15 -07:00
Jarred Sumner
5fb38b92d9 Fix crashing edgecase when both JSX automatic and JSX classic imports are necessary and unbundled 2021-09-25 02:03:27 -07:00
Jarred Sumner
66b29654c0 Fix visiting bug when using JSX with a spread prop and a key and one of the props is an anonymous function
More specifically, Bun shouldn't be visiting the same properties more than once. That was the cause.
2021-09-25 00:33:45 -07:00
Jarred Sumner
940570af59 skeleton code 2021-09-24 16:41:45 -07:00