Commit Graph

99 Commits

Author SHA1 Message Date
Jarred Sumner
eeab75998d Update javascript.zig 2022-02-18 20:33:18 -08:00
Jarred Sumner
9cecbf42a6 Update javascript.zig 2022-02-18 14:43:12 -08:00
Jarred Sumner
cafa9cc3e4 [bun.js] Fix bug with getPublicPath when encountering URLs above the root 2022-02-18 14:42:56 -08:00
Jarred Sumner
7b8de76267 [Bun.js] Implement crypto.randomBytes() and crypto.randomUUID() 2022-02-18 02:37:18 -08:00
Jarred Sumner
475aab6cc3 Support loading multiple entry points by changing what bun:main points to 2022-02-03 21:02:15 -08:00
Jarred Sumner
68cb6130d3 "path" module from Node.js implementation 2022-02-02 18:02:06 -08:00
Jarred Sumner
9322cec8f2 WIP 2022-02-01 14:45:47 -08:00
Jarred Sumner
1489e48950 Slight tweaks to TOML parser 2022-01-29 23:52:19 -08:00
Jarred Sumner
32733210dc [bunfig] Implement config file format 2022-01-27 01:25:09 -08:00
Jarred Sumner
354ed2880c Slightly safer 2022-01-25 20:00:23 -08:00
Jarred Sumner
744f52fb27 fake segfault test 2022-01-23 20:13:35 -08:00
Jarred Sumner
04579909ff [Bun.js] Fix error printing 2022-01-21 18:08:56 -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
a09b995651 Bun.Transpiler – API for scanning imports/exports of JSX/TSX/TS/JS files 2022-01-19 23:07:03 -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
8837c3c10b [Bun.js][bun dev] Support macros inside of Bun.js
Closes #36
2022-01-04 22:12:37 -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
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
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
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
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
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
49b954462d [Bun.js] Add performance.now() 2021-10-30 01:19:10 -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
08c8ca18a7 [internal] Get source URLs in C++ 2021-10-24 16:54:37 -07:00
Jarred Sumner
1b90619890 [internal] ✂️ dead code 2021-10-23 16:15:36 -07:00
Jarred Sumner
e039ba5130 [Bun.js] Add Bun.env and support process.env for non-transpiled environment variables 2021-10-23 04:54:17 -07:00
Jarred Sumner
58b196c583 rewrote most of the router 2021-10-20 04:18:29 -07:00
Jarred Sumner
5370ea71c0 Add support for reading JSX config from tsconfig.json 2021-10-06 16:49:26 -07:00
Jarred Sumner
3b10cfae80 analytics is good enough for now 2021-10-05 23:08:06 -07:00
Jarred Sumner
5fdaad9a2f Pass macro_context when appropriate. This needs to be refactored more. 2021-09-30 22:34:54 -07:00
Jarred Sumner
fdda1078f8 Support remapping macro paths 2021-09-30 18:58:39 -07:00
Jarred Sumner
e1306be4be Update Bun.readFileAsBytes and Bun.readFile to also accept an array of filepaths to join
For example:
```
Bun.readFileAsString([Bun.main, "../pages/hi.tsx"]);
```
2021-09-26 20:06:10 -07:00
Jarred Sumner
66ed7c1f30 Basic macro impl 2021-09-26 00:14:15 -07:00
Jarred Sumner
940570af59 skeleton code 2021-09-24 16:41:45 -07:00
Jarred Sumner
22837d69b7 Remove cache_files since it's not used and causes slower Bun compilation times 2021-09-24 15:23:55 -07:00
Jarred Sumner
79c7fe0f7a [Bun.js] Add Bun.readFileBytes() to get a Uint8Array of the file's contents without copying. 2021-09-21 15:39:52 -07:00