Commit Graph

181 Commits

Author SHA1 Message Date
Jarred Sumner
114c560912 Don't do isolated copy when we don't need to 2022-01-22 18:32:06 -08:00
Jarred Sumner
56ae4bcb55 Ensure we allocate the correct number of argv 2022-01-22 16:21:45 -08:00
Jarred Sumner
22c01ca14c FIx macros remap in Transpiler 2022-01-21 18:10:38 -08:00
Jarred Sumner
8c515c7077 Update exports.zig 2022-01-21 18:09:13 -08:00
Jarred Sumner
04579909ff [Bun.js] Fix error printing 2022-01-21 18:08:56 -08:00
Jarred Sumner
40ff3e4618 memory 2022-01-21 16:28:46 -08:00
Jarred SUmner
c0a446df02 Tags on pointers need to be cleared on Linux 2022-01-21 15:19:50 -08:00
Jarred Sumner
9a5aa95893 [Bun.js] Bun.Transpiler.transform & Bun.Transpiler.transformSync APIs 2022-01-21 03:39:27 -08:00
Jarred Sumner
8d623e21b6 [Bun.js] Add a threadpool for doing CPU-bound work 2022-01-21 03:37:05 -08:00
Jarred Sumner
97f0cef391 [Bun.js] Fix TypedArray/ArrayBuffer <> Zig interop 2022-01-20 16:19:07 -08:00
Jarred Sumner
85084c6db9 Fix segfault 2022-01-20 01:42:23 -08:00
Jarred Sumner
a09b995651 Bun.Transpiler – API for scanning imports/exports of JSX/TSX/TS/JS files 2022-01-19 23:07:03 -08:00
Jarred Sumner
f6c05ef7a1 small bugfix 2022-01-19 13:26:24 -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
5930ac09b7 noramlize some errors 2022-01-04 22:19:31 -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
5311219de7 dead code 2022-01-03 22:26:24 -08:00
Jarred Sumner
963c89cab2 LLVM 13 for WebKit 2022-01-02 17:33:21 -08:00
Jarred Sumner
d7ef6efd04 Update WebKit 2022-01-02 17:30:53 -08:00
luke miles
7f33846005 copy: replace Bun with bun (#99)
Most CLI tools have the style convention of referring to themselves in
lowercase. It is, after all, the name that users type in when using
the tool. This PR maintains that convention in bun.

"Drop the uppercase B, it's cleaner"
2022-01-02 03:09:51 -08:00
Jarred Sumner
6a28cfd2ba [bun dev] Automatically set origin - improve support for proxying Bun
Previously, when running Bun behind a reverse proxy, you had to pass an explicit `--origin` arg and it could only run behind one proxy at a time.

Now, Bun automatically determines the origin from the request if possible. It reads `Forwarded`, `X-Forwarded-Proto`, `X-Forwarded-Host`, `Origin`, and lastly `Host`. If none are available, it falls back to the `--origin` CLI arg.

This change is important for usecases like Replit which shows multiple iframes in different origins.
2022-01-01 18:12:57 -08:00
Jarred Sumner
d068d80ab9 Attempt to fix watcher issue with repl.it 2021-12-31 17:52:38 -08:00
Jarred Sumner
2a7d8df4c5 Fix issue with headers 2021-12-30 23:20:19 -08:00
Jarred Sumner
8128c79e81 linux 2021-12-30 22:28:22 -08:00
Jarred Sumner
b1c3fce49b [internal] Move network_thread into http package 2021-12-30 21:27:27 -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
b5beb20e08 dead code 2021-12-28 02:44:32 -08:00
Jarred Sumner
8ccb833421 [Bun.js] Add Bun.argv api, so you can get the arguments that started a script 2021-12-28 01:09:46 -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
6ae433249d musl 2021-12-24 03:53:16 -08:00
Jarred Sumner
2047140dda Workaround miscompilation so JavaScriptCore runs on Linux AARCH64 2021-12-23 23:47:12 +00:00
Jarred Sumner
a34792ce16 [Bun.js] Fix SSR when using fetch 2021-12-22 21:39:05 -08:00
Jarred SUmner
ceae7ef672 Slightly less pointer chasing 2021-12-21 19:44:09 -08:00
Jarred Sumner
ab496e9e34 Remove duplicate code 2021-12-19 17:31:10 -08:00
Jarred Sumner
e2d6c692c4 Use new http in bun upgrade 2021-12-18 20:03:00 -08:00
Jarred Sumner
2d48674c5b bindings 2021-12-17 02:44:55 -08:00
Jarred Sumner
42c7d887d3 👶event loop 2021-12-17 02:44:35 -08:00
Jarred Sumner
bcd68b937d wip 2021-12-16 19:18:51 -08:00
Jarred Sumner
39218ec0f7 [macros] Do not automatically load node_modules.bun in macros 2021-12-16 01:30:54 -08:00
Jarred Sumner
08b3bab2ec [internal] Generated files 2021-11-06 19:25:12 -07:00
Jarred Sumner
5c38b6c355 [internal] fmt 2021-11-04 18:33:14 -07:00
Jarred Sumner
92a7849e98 [Bun.js] Rename Bun.sleep -> Bun.sleepSync 2021-11-03 02:04:21 -07:00
Jarred Sumner
fb2aa186b7 [Bun.js] Bun.sleep() lets you synchronously sleep. Thanks @evanwashere 2021-10-31 00:39:37 -07:00
Jarred Sumner
9cf2771549 Update javascript.zig 2021-10-30 23:14:58 -07:00
Jarred Sumner
daf583e4cb [Bun.js] Lazily add FORCE_COLOR environment variable for better compatibility with Node.js modules that detect whether the terminal supports colors 2021-10-30 23:14:48 -07:00
Jarred Sumner
51e55f4b6e [Bun.js] Partially fix loading Node.js fallback modules 2021-10-30 23:14:14 -07:00
Jarred Sumner
f30527b6d9 [Bun.js] Add API for detecting if ANSI colors are enabled 2021-10-30 23:13:17 -07:00
Jarred Sumner
a68b5eef86 [Bun.js] Enable SharedArrayBuffer 2021-10-30 04:52:15 -07:00
Jarred Sumner
49b954462d [Bun.js] Add performance.now() 2021-10-30 01:19:10 -07:00
Jarred Sumner
1d03e90b5c [internal] This is no longer a feature flag in JSC 2021-10-29 23:37:29 -07:00