overlookmotel
cc5be633f2
fix(ast): fix serializing rest elements ( #2652 )
...
Fix a mistake I made in #2567 . Length that `serialize_seq` is called
with should only be `+1` if there is a rest element being added on the
end.
Makes no difference for serializing to JSON, as JSON serializer doesn't
use the `len` value, but still better to get it right.
2024-03-10 02:03:05 +00: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
Cameron
66a64dfc48
feat(linter) eslint: no-useless-rename ( #2648 )
2024-03-09 21:37:48 +08:00
Boshen
8b3de7748b
feat(span): impl<'a> PartialEq<str> for Atom<'a> ( #2649 )
2024-03-09 09:30:14 +00:00
Boshen
c72675e89e
chore: Rust v1.76.0 ( #2643 )
2024-03-08 20:54:36 +08:00
Boshen
265b2fb640
feat: miette v7 ( #2465 )
2024-03-08 15:50:00 +08:00
overlookmotel
88f94bb6f6
fix(ast): add RestElements in serialized AST to elements array ( #2567 )
...
A step towards #2463 .
This PR adds `rest` onto end of `elements` / `properties` array in JSON
AST for `ObjectPattern`, `ArrayPattern`, `ObjectAssignmentTarget`,
`ArrayAssignmentTarget` and `FormalParameters`.
2024-03-08 02:56:12 +00:00
Yuji Sugiura
2609e9021b
fix(semantic/jsdoc): Fix up builder ( #2623 )
...
- [x] Update `should_attach_jsdoc` definition
- [x] Update ~poem~ architecture decision comments
- [x] Refine tests
2024-03-08 10:49:51 +08:00
overlookmotel
d76ee6b2db
refactor: "wasm" feature enable "serde" feature ( #2639 )
...
Make `wasm` feature also enable `serde` feature. This allows shortening
a lot of `#[cfg_attr]`s.
As discussed in
https://github.com/oxc-project/oxc/pull/2638#issuecomment-1984066757 .
2024-03-08 10:06:49 +08:00
overlookmotel
6b5723cdbe
refactor(ast): shorten manual TS defs ( #2638 )
...
Does the same thing, just (in my opinion) a little bit more readable.
2024-03-08 00:53:51 +08:00
Dunqing
308b780ff6
feat(transformer/decorators): handling the coexistence of class decorators and member decorators ( #2636 )
...
No snapshots have been updated. Because our output is a bit different
from babel's
<img width="961" alt="image"
src="https://github.com/oxc-project/oxc/assets/29533304/9926766c-b1ec-46c3-8c8f-53f053b14f84 ">
2024-03-07 16:52:30 +08:00
magic-akari
8e3e4043bc
feat(prettier): print with_clause in reexport declaration ( #2635 )
2024-03-07 14:24:16 +08:00
magic-akari
2a235d3b8c
fix(ast): parse with_clause in re-export declaration ( #2634 )
2024-03-07 14:09:31 +08:00
magic-akari
17bc711bf0
fix(prettier): print bare import ( #2633 )
2024-03-07 14:03:20 +08:00
magic-akari
61afa70bb8
feat(prettier): print with_clause ( #2632 )
2024-03-07 12:22:30 +08:00
Dunqing
9b56134ba2
feat(linter): support check ImportNamespaceSpecifier in no_import_assign ( #2617 )
2024-03-07 10:56:34 +08:00
Dunqing
47e735a9d6
refactor(linter): improve the implementation of no_shadow_restricted_names based on symbols ( #2615 )
2024-03-07 10:51:31 +08:00
overlookmotel
b2de57a0e3
refactor(span): simplify Atom ( #2630 )
2024-03-06 13:10:45 +00:00
Boshen
cb4e054eb9
refactor(span): remove Atom::Compact variant ( #2629 )
2024-03-06 20:47:35 +08:00
Boshen
4f9dd98a97
feat(span): remove From<String> and From<Cow> API because they create memory leak ( #2628 )
...
closes #2621
2024-03-06 20:38:21 +08:00
Boshen
240ff19675
refactor(parser): improve parsing of BindingPattern in TypeScript ( #2624 )
...
closes #2622
2024-03-06 16:16:03 +08:00
Dunqing
57ce737b09
feat(semantic): move redeclare varaibles to symbol table ( #2614 )
...
close : #2219
2024-03-06 15:34:12 +08:00
Boshen
798a6dfe46
refactor(span): disallow struct expression constructor for Span ( #2625 )
2024-03-06 15:28:59 +08:00
Boshen
7605cd3ecf
feat(linter): change ban-ts-comment to pedantic
2024-03-06 12:33:47 +08:00
overlookmotel
8001b2f796
refactor: make CompactStr immutable ( #2620 )
...
First step towards #2516 .
This replaces `compact_str::CompactString` with an immutable interface `CompactStr`.
Currently just implemented as a wrapper around `CompactString` which hides all its mutation methods. A more optimized implementation to follow, which shrinks size of `CompactStr` to 16 bytes by removing the `capacity` field.
The rationale for the change of name is: `CompactString` is like `String` in that it's mutable. `CompactStr` is more like `str` - immutable - so its name mirrors `str`.
2024-03-06 12:29:32 +08:00
overlookmotel
0646bf34fa
refactor: rename CompactString to CompactStr ( #2619 )
...
Preparatory step for #2620 .
This PR purely changes names of types and methods:
* `CompactString` -> `CompactStr`
* `Atom::to_compact_string` -> `to_compact_str`
* `Atom::into_compact_string` -> `into_compact_str`
Have split this into a separate PR as the diff is large, but it does absolutely nothing but renaming (I've checked the whole diff twice, so feel free not to check it again!). This should make it easier to see the content of the substantive change in #2620 .
2024-03-06 12:24:23 +08:00
overlookmotel
09d4c7d649
fix(linter): correct example for no-obj-calls rule ( #2618 )
...
I think someone used find-and-replace! 🥲
2024-03-06 11:09:45 +08:00
Boshen
1f14d946aa
chore: update Cargo.toml and deny.yaml
2024-03-05 16:31:05 +08:00
Boshen
32ab1ac89d
wip
2024-03-05 16:25:14 +08:00
Boshen
cca6eb073c
Release crates v0.9.0
2024-03-05 15:57:31 +08:00
Boshen
9c92ecaf07
Release napi oxc-parser@v0.8.0
2024-03-05 15:54:59 +08:00
Boshen
f94c9596e9
Release oxlint and vscode extension v0.2.13
2024-03-05 15:54:25 +08:00
Boshen
fbb7a5a75c
fix: revert Cargo.toml change
2024-03-05 15:51:15 +08:00
Boshen
bf42158ad7
perf(parser): inline end_span and parse_identifier_kind which are on the hot path ( #2612 )
2024-03-05 15:39:53 +08:00
Boshen
49778abb80
fix(ast): temporary fix tsify not generating some typings ( #2611 )
...
seems like a bug in tsify
2024-03-05 14:13:28 +08:00
Boshen
1db307abbf
feat(ast): serialize BindingPattern to estree ( #2610 )
2024-03-05 13:48:43 +08:00
Arnaud Barré
97aa9cfd54
fix(parser): fix span end for TSEmptyBodyFunctionExpression ( #2606 )
...
https://oxc-project.github.io/oxc/playground/?code=3YCAAICXgICAgICAgICxG4jI43W9aqTWr3WzyAs1pNu4fnf%2FXXEB3Yt%2FfiBIgA%3D%3D
The conformance test are going back to initial state. I think the `.asi`
should be smarter, i can rethink that later
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-05 12:45:11 +08:00
Dunqing
7a12514151
fix(transformer/decorators): missing check private function ( #2607 )
2024-03-05 11:37:00 +08:00
cinchen
35ce3ccdc0
feat(linter): eslint-plugin-jest: prefer-to-have-length ( #2580 )
...
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-to-have-length.ts )
2024-03-05 09:15:19 +08:00
Wenzhe Wang
951297ee59
fix(linter): avoid crash if no members in TSTypeLiteral in typescript/prefer-function-type ( #2604 )
2024-03-04 22:57:02 +08:00
Arnaud Barré
f6709e4737
feat(ast): serialize identifiers to ESTree ( #2521 )
2024-03-04 14:53:33 +00:00
Boshen
e2d2ce3369
feat(parser): parse decorators properly ( #2603 )
...
closes #2562
2024-03-04 19:30:41 +08:00
Boshen
7cc90134d3
fix: broken build from codegen API change
2024-03-04 19:24:06 +08:00
cinchen
212f128b33
feat(linter): eslint-plugin-jest: prefer-strict-equal ( #2581 )
...
Rule detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-strict-equal.ts )
2024-03-04 16:36:08 +08:00
Boshen
ef932a3c27
refactor(codegen): clean up API around building sourcemaps ( #2602 )
...
closes #2564
2024-03-04 16:03:33 +08:00
Boshen
20c7bf7835
feat(ast): add AssignmentTargetRest ( #2601 )
...
closes #2598
2024-03-04 14:31:22 +08:00
Boshen
9cc960e591
fix(parser): fix duplicated comments during parser rewind ( #2600 )
...
closes #2592
2024-03-04 14:07:33 +08:00
Boshen
6b42233628
feat(playground): display comments ( #2599 )
2024-03-04 14:02:22 +08:00
overlookmotel
b7f5c63833
perf(codegen): speed up generating sourcemap mappings ( #2597 )
...
This PR optimizes the `update_generated_line_and_column` function used in generating source maps.
The main change is that `generated_column` only depends on the last line, so just spin through bytes to find the last line break, and then only convert last line UTF-8 to UTF-16. There's also a fast path for when last line is ASCII, to avoid iterating over the last line twice in that common case.
2024-03-04 12:46:32 +08:00
overlookmotel
42fa8ebbc2
perf(codegen): speed up building sourcemap line tables ( #2591 )
...
Speed up building the line tables for source maps, using same kind of techniques as have been using in the lexer:
* Iterate byte-by-byte not char-by-char (`chars` iterator is slow).
* Fast path for ASCII (common case).
2024-03-04 12:40:39 +08:00