Commit graph

185 commits

Author SHA1 Message Date
Boshen
0f3f67a05a refactor(linter): add capability of adding semantic data to module record (#7561)
closes #5814
closes #5816
2024-12-01 08:14:43 +00:00
Boshen
c2ced15dfd feat(parser,linter)!: use a different ModuleRecord for linter (#7554)
The parser returns a simple `ModuleRecord` that is allocated in the arena for performance reasons.

The linter uses a more complicated, `Send` + `Sync` `ModuleRecord` that will hold more cross-module information.

The next step is to return more esm information from the parser to eliminated the need of the `oxc_module_lexer` crate.
2024-11-30 16:02:01 +00:00
Boshen
0be5233c84 refactor(semantic)!: remove ModuleRecord from Semantic (#7548)
`ModuleRecord` will eventually be moved to be linter specific thing for cross module data sharing, which means we can add more data to it.
2024-11-29 16:30:54 +00:00
Boshen
8a788b8f4b feat(parser)!: Build ModuleRecord directly in parser (#7546)
This has the benefit of:

* expose dynamic import / import meta info from parser
* 1 less ast shallow in semantic builder
* no ast walk in oxc's module lexer
* some more benefits coming soon
2024-11-29 14:50:42 +00:00
Boshen
d942a8d41a
chore: Rust v1.83.0 changes (#7535)
This PR does not upgrade rustc. Only changes are applied.

We cannot upgrade to the lastet Rust version yet due to wasm-bindgen
breaking some generated types.

THere's also some elided lifetimes in `**/generated/**`, which requires
modification to ast tools.
2024-11-29 11:59:45 +08:00
Boshen
f955ba2fae feat(wasm): add transformer target API (#7513) 2024-11-28 03:45:59 +00:00
Boshen
3169bc61d1
ci: clean up wasm type check (#7466)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-25 17:56:17 +08:00
Boshen
846711cf41 feat(transformer)!: change API to take a &TransformOptions instead of TransformOptions (#7213)
closes #7185

`TransformOption`s has an initialization cost, it should be initialized once and shared across files.
2024-11-09 06:01:13 +00:00
Boshen
d1d187417b feat(ast)!: change comment.span to real position that contain // and /* (#7154)
closes #7150
2024-11-06 05:10:33 +00:00
Boshen
fcaba4a92a feat(transformer): add TransformerOptions::env with EnvOptions (#7037) 2024-10-31 12:30:32 +00:00
Boshen
e921df6199 refactor(transformer): rename EnvOptions to BabelEnvOptions (#7036) 2024-10-31 10:00:52 +00:00
Boshen
76947e2aec refactor(transform): refactor Babel Targets (#7026)
Found a trick from serde to get us from `BabelTargets` to `Targets`.
2024-10-30 14:08:19 +00:00
Boshen
b8daab3663 refactor(transformer)!: API to TryFrom<&EnvOptions> for TransformOptions and TryFrom<&BabelOptions> TransformOptions (#7020)
…ions` and `TryFrom<&BabelOptions> TransformOptions`
2024-10-30 09:40:09 +00:00
ottomated
7d12669d68
fix(types): move @oxc-project/types to dependencies (#6909)
Hotfix. NPM doesn't install devDependencies automatically, so types were
missing.
2024-10-26 10:26:54 +08:00
Boshen
741571f645 refactor(minifier): remove extra compress options (#6893)
Closure Compiler and ESBuild does not have these kind of granularity.
2024-10-26 01:30:13 +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
1145341a92 feat(ast_tools): output typescript to a separate package (#6755)
Part of #6347.

Moves typescript logic from derive_estree into a new ast_tools generator.
2024-10-24 13:08:57 +00:00
overlookmotel
683c3443c0 chore(semantic, wasm): re-order dependencies in Cargo.toml files (#6657)
Nit. Move `serde` dependency into more natural place in the list.
2024-10-18 13:40:37 +00:00
Boshen
591f5dd960 chore(deps): update rust crates (#6542) 2024-10-14 03:14:15 +00:00
Boshen
cb8f4210c3 refactor(prettier)!: remove source_text argument from constructor (#6448) 2024-10-11 06:27:33 +00:00
Boshen
520096030a refactor(oxc)!: remove passing Trivias around (#6446)
part of #6426
2024-10-11 06:09:25 +00:00
Boshen
2b7be08af4 feat(ast)! add source_text to Program (#6444) 2024-10-11 04:13:41 +00:00
Boshen
020bb80b65 refactor(codegen)!: change to CodegenReturn::code and CodegenReturn::map (#6310) 2024-10-06 05:05:47 +00:00
overlookmotel
4f6bc79734 refactor(transformer)!: remove source_type param from Transformer::new (#6251)
Closes #6248.
2024-10-03 00:21:01 +00:00
IWANABETHATGUY
a111bb69af feat(oxc_wasm): add verbse option to debug_dot (#5879)
1. Adding a new option to control displaying `implicit error` edge.
**verbose**
![image](https://github.com/user-attachments/assets/cef43d5f-25d0-4408-ad4a-34bc633f2821)
**disable verbose**
![image](https://github.com/user-attachments/assets/02954103-689c-422c-8ada-5805a39335b7)
2024-09-19 06:13:03 +00:00
Boshen
6dd6f7ca26 refactor(ast): change Comment struct (#5783) 2024-09-15 09:22:58 +00:00
overlookmotel
3230ae5842 feat(semantic): add SemanticBuilder::with_excess_capacity (#5762)
Add `SemanticBuilder::with_excess_capacity` method to request that `SemanticBuilder` over-allocate space in `Semantic`'s `Vec`s.

Use this method to reserve 200% extra capacity for transformer to create more scopes, symbols and references.

200% is an unscientific guess of how much extra capacity is required. Obviously it depends on what transforms are enabled and content of the source code.
2024-09-14 15:02:16 +00:00
Boshen
63a830e08c
chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
IWANABETHATGUY
08d2b7d761 feat(oxc_wasm): add controlFlowDotString to oxc_wasm (#5571) 2024-09-07 10:41:00 +00:00
Boshen
b06052501a refactor(semantic)!: remove source_type argument from SemanticBuilder::new (#5553)
Realized we can get the source type from the AST.

The next PR will introduce `unambiguous` to `SourceType` and directly set `Program::source_type` to either `script` or `module`.
2024-09-06 16:40:10 +00:00
Boshen
add146557c
feat(wasm): turn on all transform options 2024-09-01 00:24:10 +08:00
Boshen
cbd9a60194
fix(wasm): do not run symbols and scopes for .d.ts files 2024-08-30 19:57:09 +08:00
Boshen
8ab270b720
feat(wasm): add mangler 2024-08-30 18:45:56 +08:00
Boshen
3ae94b8801
refactor(semantic): change build_module_record to accept &Path instead of PathBuf 2024-08-30 12:24:49 +08:00
Boshen
7fa2fa386c
refactor(wasm): clean up code and add transform (#5299)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-28 22:14:35 +08:00
Kevin Deng 三咲智子
681bd8071a
fix(wasm): reference ast from prettier (#5268)
regression by cc3332898c
2024-08-27 22:15:26 +08:00
overlookmotel
c23104b2a2 feat(wasm): output symbol IDs in scope tree (#5266)
`oxc_wasm` include `SymbolId`s in print-out of scopes.
2024-08-27 13:49:44 +00:00
overlookmotel
6a49dc36b2 perf(wasm): generate scope text with visitor (#5264)
Follow-on after #5232. `oxc_wasm` build scopes text with a single AST traversal. Previous implementation was O($n^2$).

If we can assume scopes are listed in traversal order, then we could do it a bit more efficiently just from `ScopeTree`, but this approach of using `Visit` will handle out-of-order scope IDs (which you'd get if printing a post-transform `ScopeTree`).

Also reduce creating and discarding `String`s for indentation - reuse a single string instead.
2024-08-27 13:49:42 +00:00
overlookmotel
17d8a88415
fix(wasm): display correct scope IDs (#5263)
`ScopeId`s were printed incorrectly. `+ 1` used to be correct, but isn't
any more since `ScopeId` became a `NonMaxU32`.
2024-08-27 20:39:07 +08:00
Kevin Deng 三咲智子
cc3332898c
perf(wasm): reuse parse result for prettier (#5254) 2024-08-27 16:56:18 +08:00
Boshen
484f0d7579
fix(wasm): fix broken prettier 2024-08-27 14:25:25 +08:00
Kevin Deng 三咲智子
8b53ef9b27
feat(wasm): add option preserve_parens (#5237) 2024-08-27 12:10:08 +08:00
Boshen
a17cf33dc3 refactor(semantic): remove ScopeTree::child_ids (#5232)
closes https://github.com/oxc-project/oxc/issues/5244
2024-08-27 01:49:47 +00:00
Kevin Deng 三咲智子
1af7f04a36
feat(wasm): output panic info to console (#5238)
Playground Preview:
<img width="1769" alt="image"
src="https://github.com/user-attachments/assets/12143fb5-f6a6-48bc-8dee-cf85b6c52392">
2024-08-27 09:12:15 +08:00
Kevin Deng 三咲智子
30ecbf649b
refactor(wasm): combine into a options (#5235) 2024-08-27 09:11:30 +08:00
Kevin Deng 三咲智子
167f7e452d
fix(wasm): set both scope and symbol (#5236) 2024-08-27 09:10:41 +08:00
Kevin Deng 三咲智子
4641034710
fix(wasm): correct ir type (#5226)
Fixes type error:
https://github.com/oxc-project/playground/actions/runs/10557625323/job/29245568111?pr=22
2024-08-26 21:41:57 +08:00
Kevin Deng 三咲智子
b39c0d6122
refactor(wasm): add source_type for parser, replace class options with plain object (#5217)
- Feat: add `source_type` to `ParserOptions`
- Refactor: use plain objects for options instead of `new
OxcRunOptions()` and `new OxcParserOptions()`, allowing easier
serialization.
2024-08-26 15:08:35 +08:00
Kevin Deng 三咲智子
1cd5401ad7
fix(wasm): respect camelCase (#5213) 2024-08-26 12:51:19 +08:00
Boshen
4b49cf8ce4 feat(transformer): always pass in symbols and scopes (#5087)
We no longer need to build semantic data inside the transformer.

The caller should be responsible for handling semantic data and its
errors.

The best way to achieve this in via `CompilerInterface`.

closes #3565
2024-08-22 16:06:31 +00:00