Commit Graph

236 Commits

Author SHA1 Message Date
Jarred Sumner
ea241fcec7 [JS Parser] Fix overly-eager CJS -> ESM transform 2022-04-23 03:15:13 -07:00
Jarred Sumner
42414d5667 [JS Parser] API for removing & replacing exports 2022-04-16 04:36:00 -07:00
Jarred Sumner
4de7978b27 [JS Parser] Fix code simplification bug with ! and unary expressions 2022-04-09 20:23:36 -07:00
Jarred Sumner
7e58c7e89a Make Bun.activate run earlier so we catch errors sooner 2022-04-06 23:36:26 -07:00
Jarred Sumner
7539e5b72c remove empty files 2022-03-30 18:56:18 -07:00
Jarred Sumner
44b0c8153a Source Maps for client-side errors & columns 2022-03-11 00:03:09 -08:00
Jarred Sumner
701d6ec45d rename _global -> bun 2022-03-08 18:54:54 -08:00
Jarred Sumner
50c8747c97 [JS Parser] Add optimization for JSX spread 2022-03-07 00:29:50 -08:00
Jarred Sumner
093807391a [JS Parser] dot property shorthand for JSX
This is a non-standard backwards-compatible feature that I suspect other tooling will soon adopt (and expect to help other tooling adopt it)

```jsx
var hello = {hi: 'yo'};
export const Foo = () => <Bar {hello.hi} />
```

Desugars into:
```jsx
var hello = {hi: 'yo'};
export const Foo = () => <Bar hi={hello.hi} />
```

This works with defines and macros too.

```jsx
export const Foo = () => <Bar {process.env.NODE_ENV} />
```

```jsx
export const Foo = () => <Bar NODE_ENV="development" />
```
2022-03-05 19:33:25 -08:00
Jarred Sumner
4f5aa438d6 [JS Parser] Support JSX prop punning 2022-03-04 17:51:22 -08:00
Jarred Sumner
51fbbea1d3 upgrade zig 2022-03-04 00:20:22 -08:00
Jarred Sumner
7b4f239d33 [JS Parser] Fix bug with super from adding class static blocks 2022-03-01 22:18:16 -08:00
Jarred Sumner
2ccb063d20 [bun.js] Allow disabling runtime imports so bun can build for node 2022-03-01 22:16:09 -08:00
Jarred Sumner
710303be7a [JS Parser] Make auto importing JSX a flag so the API is easier 2022-03-01 22:14:04 -08:00
Jarred Sumner
fb3a262f4b [TS] Make export {type foo} output consistent with TS parser 2022-02-27 23:20:38 -08:00
Jarred Sumner
d91e897413 [TS Parser] Implement constructor(private foo)
Input:
```
class Foo {
  constructor(public bar: string = "baz") {}
  bar: number;
}
```

Output:
```
class Foo {
  bar;
  constructor(bar = "baz") {
    this.bar = bar;
  }
  baz;
}
```
2022-02-27 03:37:31 -08:00
Jarred Sumner
c5804cd6ff [JS Parser] Fix bug with unicode identifiers 2022-02-27 01:49:56 -08:00
Jarred Sumner
5e4b50dc6c [JS Parser] #privateIdentifiers 2022-02-27 01:49:30 -08:00
Jarred Sumner
152f63b019 [JS Parser] Class Static Initialization Blocks
https://github.com/tc39/proposal-class-static-block
2022-02-27 01:48:10 -08:00
Jarred Sumner
1958f7adb5 [TS Parser] Support export {type Foo} 2022-02-27 01:46:51 -08:00
Jarred Sumner
5c9859e7f2 [JS Parser] ensure assertions are never run at runtime 2022-02-24 00:13:04 -08:00
Jarred Sumner
931670b7cb Wrap some usages of assert in a conditional
See https://github.com/ziglang/zig/issues/10942
2022-02-21 16:27:44 -08:00
Jarred Sumner
3a0577ba96 Use an enum for Ref instead of a buggy packed struct
Fixes a printing bug with `Symbol`
2022-02-18 20:33:04 -08:00
Jarred Sumner
a0717e6fa7 Simple dead code elimination 2022-02-18 15:24:09 -08:00
Jarred Sumner
37e63eff22 [JS Parser] fix bugs found from tests 2022-02-18 02:43:45 -08:00
Jarred Sumner
24dd80e69a [JS Parser] Strip import assertions
Closes #4
2022-02-18 02:42:20 -08:00
Jarred Sumner
7637cfb0a6 [JS Parser] Fix several bugs with bindings and improve some errors 2022-02-16 17:02:39 -08:00
Jarred Sumner
f5c7c81780 Update js_parser.zig 2022-02-16 04:05:44 -08:00
Jarred Sumner
44bad4b8e6 [js parser] pool allocated names (perf) 2022-02-16 04:05:30 -08:00
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