Commit graph

19 commits

Author SHA1 Message Date
Boshen
cbc2f5ff97
refactor: remove unused dependencies (#2718) 2024-03-14 17:50:31 +08:00
Boshen
697b6b70c0
feat: merge features serde and wasm to serialize (#2716)
This PR merges the previous confusing features `serde` and `wasm` into a
single `serialize` feature.

We'll eventually do serialize + type information for both wasm and napi
targets.

`oxc_macros` is removed from `oxc_ast`'s dependency because it requires
`syn` and friends, which goes against our policy ["Third-party
dependencies should be
minimal."](https://oxc-project.github.io/docs/contribute/rules.html#development-policy)
2024-03-14 17:13:12 +08:00
Boshen
1facc8d35d
chore: add clippy::cargo rules 2024-03-13 15:01:08 +08:00
Boshen
0f86333437
refactor(ast): refactor Trivias API - have less noise around it (#2692) 2024-03-12 20:16:36 +08:00
Boshen
32303b20fb
New tool: oxc_module_lexer (#2650)
# Oxc Module Lexer

This is not a lexer. The name "lexer" is used for easier recognition.

## [es-module-lexer](https://github.com/guybedford/es-module-lexer)

Outputs the list of exports and locations of import specifiers,
including dynamic import and import meta handling.

Does not have any
[limitations](https://github.com/guybedford/es-module-lexer?tab=readme-ov-file#limitations)
mentioned in `es-module-lexer`.

I'll also work on the following cases to make this feature complete.

- [ ] get imported variables
https://github.com/guybedford/es-module-lexer/issues/163
- [ ] track star exports as imports as well
https://github.com/guybedford/es-module-lexer/issues/76
- [ ] TypeScript specific syntax
- [ ] TypeScript `type` import / export keyword

## [cjs-module-lexer](https://github.com/nodejs/cjs-module-lexer)

- [ ] TODO

## Benchmark

This is 2 times slower than `es-module-lexer`, but will be significantly
faster when TypeScript is processed.

The difference is around 10ms vs 20ms on a large file (700k).
2024-03-09 23:23:55 +08:00
Arnaud Barré
9d4e255a73
feat(playground): support TS codegen (#2587) 2024-03-04 11:33:48 +08:00
Boshen
9479865d9b
feat(napi/parser): expose preserveParans option (#2582)
closes #2576
2024-03-03 15:18:47 +08:00
Arnaud Barré
b8764a8eb8
Fix few serialization issues (#2506)
Re: #2463
2024-02-26 12:25:17 +08:00
Boshen
6c6b542036
feat(napi): return comments (#2469) 2024-02-21 22:43:40 +08:00
Boshen
839e7c5c22
feat(napi/parser): add more linux-musl targets 2024-02-06 00:04:25 +08:00
Boshen
5ac61f09a0
feat: setup wasm parser for npm (#2221) 2024-01-30 21:40:10 +08:00
Boshen
87b9978859
refactor: move all miette usages to oxc_diagnostics 2024-01-28 16:52:16 +08:00
msdlisper
8f296dfb7a
refactor(linter): use fxHashMap in jsx-a11y settings (#1707)
Continue to refine #1668
2023-12-17 20:05:21 +08:00
Herrington Darkholme
c63f5123b3
feat(parser/napi): add flexbuffer to AST transfer (2x speedup) (#1680)
Hi! I have created a proof of concept of improving using oxc in
JavaScript. The method is not polished but it provides valuable insights
for future direction!

Feel free to close~ It is for reference only :)

# Context 

This is a proof of concept implementation of passing binary AST to
JavaScript. JavaScript can selectively read flexbuffers-based AST nodes
on demand to avoid the deserialization toll. More context
[here](https://dev.to/herrington_darkholme/benchmark-typescript-parsers-demystify-rust-tooling-performance-2go8).

# Changes

* Add a `parseSyncBuffer` napi method to return a binary AST from Rust
to JavaScript. The AST is in flexbuffer format.
* Add a `test_buffer.js` to test usage of flexbuffers in JavaScript. It
is in cjs format because flexbuffers does not support ESM :/

# Result
Some preliminary results, for reference only.

```
~ node test_buffer.js
testJSON: 4.043s
testBuffer: 2.395s
```

Buffer based API is 100% faster than JSON.

# Future Ideas
* Flexbuffers itself is slow. A better binary protocol is desired!
* Using binary reader to traverse AST is undesirable. A proxy-based API
to emulate object behavior will be nice.
2023-12-15 02:52:33 +00:00
Boshen
1a576f60a8
refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
Boshen
9780621925
chore: run fmt 2023-11-16 13:36:42 +08:00
Boshen
73d6d40778
rust: do not compile libs and bins that do not have tests (#1342) 2023-11-16 13:35:24 +08:00
Boshen
c202bc9dcb
feat: Release resolver with NAPI (#1212) 2023-11-10 15:25:17 +00:00
Boshen
90ff0ddbe0
refactor: change @oxidation-compiler/napi to oxc-parser (#1209) 2023-11-10 06:17:05 +00:00