Boshen
ee8ee55cda
feat(napi/parser): add .hasChanged() to MagicString ( #8586 )
2025-01-18 15:29:17 +00:00
Boshen
1bef911e59
feat(napi/parser): add source map API ( #8584 )
2025-01-18 23:06:42 +08:00
Boshen
c479a58718
feat(napi/parser): expose dynamic import expressions ( #8540 )
...
closes #8369
2025-01-16 22:25:22 +08:00
Boshen
aa9d7e47ea
build(napi): napi build --no-dts-cache ( #8499 )
2025-01-15 07:02:29 +00:00
Boshen
18d0ce3c06
fix(napi): rename Error to OxcError to avoid name collision ( #7780 )
2024-12-11 00:30:07 +08:00
Boshen
9157a0ed0f
feat(napi/parser): add getUtf16ByteOffset API; update README ( #7772 )
2024-12-10 14:15:39 +00:00
Boshen
f3cfa7f3dd
feat(napi/parser): add get_line_column_number API ( #7765 )
2024-12-10 12:49:11 +00:00
Boshen
4bd3d103d3
feat(napi/parser): introduce experimental MagicString ( #7529 )
...
Hold magic string instance on the Rust side for utf8 string manipulation.
2024-12-10 08:33:47 +00:00
Boshen
85eec3c82e
feat(napi/transform,napi/parser): return structured error object ( #7724 )
...
closes #7261
2024-12-08 14:11:56 +00:00
Boshen
00fea9285b
feat(napi/parser): expose span positions of import.meta ( #7677 )
2024-12-05 11:03:52 +00:00
Boshen
1de2842f8e
feat(napi/parser): return EcmaScriptModule::hasModuleSyntax ( #7647 )
2024-12-04 13:00:47 +00:00
Boshen
771c698a81
feat(oxc): remove oxc_napi crate ( #7634 )
...
napi has a limitation, it cannot feature gate type exposure.
closes #7623
2024-12-04 10:07:32 +08:00
Boshen
40792b4440
feat(napi/parser): change parse API to accept mandatory filename and optional lang ( #7605 )
2024-12-03 12:09:48 +00:00
Boshen
7c62a33a06
feat(napi/parser): return esm info ( #7602 )
...
The parser now returns import / export statement information, which can be used for parser plugins.
2024-12-03 11:21:54 +00:00
Boshen
943462f22c
feat(module_lexer)!: remove oxc_module_lexer ( #7595 )
...
This crate will no longer be relevant after we export esm information
directly from the parser.
Besides, `ex-module-lexer`'s output data is too limited for plugin
authors to use.
2024-12-03 04:22:51 +00:00
Song Gao
cf3415b0e4
chore(doc): replace main/master to tag/commit to make the url always accessible ( #7298 )
2024-11-16 21:00:30 +08:00
Boshen
24c585a20a
feat(napi/parser): reexport @oxc-project/types ( #7214 )
...
closes #7207
2024-11-09 17:24:07 +08:00
Boshen
9ed9501bcd
fix(module_lexer): add missing export * from 'foo'; case ( #7103 )
...
fixes #7039
2024-11-03 16:31:19 +00:00
ottomated
b075982eaa
fix(types): Change @oxc/types package name ( #6874 )
...
Closes #6862 .
Possible options:
- `oxc-types`
- `@oxc-project/types`
- `@oxc-ast/types`
- `oxc-ast-types`
2024-10-24 20:04:09 +00:00
ottomated
67a7bde4c6
feat(napi/parser)!: add typings to napi/parser ( #6796 )
...
- Added TypeScript annotation for `ParseResult.program`
- Modified the entrypoint for `oxc-parser` to allow wrapping the napi functions
- Updated `index.js` to parse the `program` string into a JSON object
- Updated tests
- Added a dependency on `@oxc/types`
2024-10-24 13:08:59 +00:00
Boshen
dc741e471f
chore: do not format napi generated files
2024-09-08 13:42:15 +08:00
Boshen
d00a1f6511
chore: use dprint to format js, json and markdown
2024-09-08 13:24:58 +08:00
Boshen
27cbd551fb
chore: bump napi to v3 ( #4365 )
2024-07-19 14:06:33 +00:00
Rihards Gravis
dbf7c3aaa2
fix(napi/parser): typescript types for Comment is out of order ( #3646 )
...
Fix `oxc-parser` Typescript type definition for `Comment` type where the
`type` and `value` have reversed types in place.
2024-06-13 00:20:26 +08:00
Boshen
b15bf2826b
feat(napi/parser): remove experimental flexbuffer api ( #2957 )
2024-04-13 14:59:31 +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
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
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
90ff0ddbe0
refactor: change @oxidation-compiler/napi to oxc-parser ( #1209 )
2023-11-10 06:17:05 +00:00