Commit graph

2852 commits

Author SHA1 Message Date
overlookmotel
18cff6aab8
refactor(parser): remove start params for byte_search macro arms (#2553)
Simplify `byte_search` macro a bit more.
2024-03-01 21:15:27 +08:00
Dunqing
6d43e851e8
feat(transformer/typescript): support transform constructor method (#2551) 2024-03-01 21:12:30 +08:00
Dunqing
37de80d9c9
fix(semantic): jsx reference with an incorrect node id (#2546)
The get kind from the node id should be `JSXIdentifier`, but now it's `JSXOpeningElement`.
2024-03-01 21:07:57 +08:00
overlookmotel
34ecdd58d8
refactor(parser): simplify byte_search macro (#2552)
This PR greatly simplifies the `byte_search!` macro.

Mainly removing `cold_branch()` from the "not enough bytes remaining for a batch" branch, which allows refactoring so that `handle_match` and `continue_if` don't need to be repeated twice.

Result for performance is inconsistent - a little better on some benchmarks, a little worse on others. But not by significant amounts either way. In my view, the benefit of making the macro simpler outweighs a small speed loss anyway.
2024-03-01 21:07:39 +08:00
Dunqing
25e03cb0ef
feat(tasks/transformer): enable typescript when the typescript plugin is provided (#2548)
Babel has many test cases that are js files, but in ts syntax.
2024-03-01 21:04:55 +08:00
Dunqing
fd8f735ed2
fix(ast): missing visit JSXElementName enum (#2547) 2024-03-01 21:03:14 +08:00
overlookmotel
ddccaa1af9
refactor(parser): remove unsafe code in lexer (#2549)
Same as #2527. Just remove some unnecessary unsafe code, no substantive
changes.
2024-02-29 15:00:08 +00:00
Yuji Sugiura
1391e4a86b
refactor(semantic/jsdoc): Misc fixes for JSDoc related things (#2531)
Sorry for the rather large size of PR. 😓 But essentially, not changed so
much.

#### 1. Reorganize directories and namings

```
src/jsdoc
├── builder.rs 👈🏻 for SemanticBuilder
├── finder.rs  👈🏻 `semantic.jsdoc()`
├── mod.rs
└── parser
   ├── jsdoc.rs     👈🏻 `JSDoc` struct which has `comment` and `tags`
   ├── jsdoc_tag.rs 👈🏻 `JSDocTag` struct
   ├── mod.rs
   ├── parse.rs     👈🏻 parsing logic by `JSDocParser`
   └── utils.rs
```

Now `mod.rs` has only export things.

#### 2. Introduce `JSDocTagKind::Unknown(name)`

We need to keep their name as-is to check valid tag names are used.(e.g.
`jsdoc/check-tag-names` rule)

#### 3. Support multiline description

- Comment for JSDoc
- Comment for each JSDocTag

```js
/**
 * @foo this comment continues
 * here but leading * should be ignored!!
 */
```

- - -

Please correct me if I am doing something wrong... 🐰
2024-02-29 17:28:14 +08:00
Dunqing
fe777f330f
feat(linter/import): partial support namespace check (#2538) 2024-02-29 15:40:53 +08:00
overlookmotel
5a13714a18
perf(parser): faster lexing template strings (#2541)
Speed up lexing template strings.

This was the last use of `AutoCow` remaining in the lexer, and it's now removed.

Implementation is quite complex, to avoid repeatedly branching on whether an unescaped string is required or not (the way `AutoCow` did). I tried to simplify it down to a single function, but this hurt performance significantly.

Benchmarks do not show much movement, but I believe that's because there aren't many template strings in the benchmarks. Where there are template strings, I believe this speeds up lexing them significantly.
2024-02-29 13:28:30 +08:00
overlookmotel
9d7ea6b3f0
refactor(parser): single function for all string slicing (#2540)
Pure refactor. Move all string-slicing in `lexer::Source` into a single function.
2024-02-29 13:22:55 +08:00
Boshen
32e5a3aae7
Release napi oxc-parser@v0.7.0 2024-02-28 18:41:14 +08:00
Boshen
ab13504612
Release oxlint and vscode extension v0.2.12 2024-02-28 18:39:55 +08:00
Boshen
d41dcc316e
feat(linter): remove all commonjs logic for import plugin (#2537) 2024-02-28 18:13:44 +08:00
Boshen
3efbbb2e1f
feat(ast): add "abstract" type to MethodDefinition and PropertyDefinition (#2536)
closes #2532

```
pub enum PropertyDefinitionType {
    PropertyDefinition,
    TSAbstractPropertyDefinition,
}

pub enum MethodDefinitionType {
    MethodDefinition,
    TSAbstractMethodDefinition,
}
```
2024-02-28 17:33:11 +08:00
Dunqing
3807d83767
feat(wasm): call build module record when symbol is true (#2533)
symbols depend on module record
2024-02-28 14:47:34 +08:00
Dunqing
2c2256a82f
refactor(transformer/typescript): improve implementation of remove import/export (#2530) 2024-02-28 14:41:43 +08:00
Arnaud Barré
d181209759
fix(ast): add Function to generated TS types and fix ModifierKind serialization (#2534) 2024-02-28 14:40:14 +08:00
overlookmotel
24ded3cb15
perf(parser): lex JSX strings with memchr (#2528)
Simplify lexing JSX string attributes. As the search is purely for 1
byte value (the closing quote), and so doesn't require a byte table, use
`memchr`.

This change doesn't really register on benchmarks, but it's one step
closer to removing `AutoCow`, and transitioning all the searches in the
lexer to byte-by-byte.
2024-02-28 14:39:23 +08:00
Dunqing
f760108094
feat(transformer): call build module record (#2529) 2024-02-28 14:35:35 +08:00
overlookmotel
0ddfc856d2
refactor(parser): remove unsafe code (#2527)
Remove some unnecessary unsafe code.
2024-02-27 20:28:21 +08:00
Boshen
02c82c3f78
feat(cli,linter): provide tsconfig path from the cli (#2526)
closes #891
2024-02-27 20:00:11 +08:00
Boshen
27052ebfed
refactor(span): remove AtomImpl (#2525) 2024-02-27 13:45:58 +08:00
Boshen
903f17c0df
refactor(span): move base54 method to mangler (#2523) 2024-02-27 13:34:33 +08:00
Arnaud Barré
6d5ec6dedd
fix(ast): few serialization issues (#2522)
A few more I missed in #2506. Re #2463.

Only remaining snake_case in the current types of the AST:
`trailing_comma` in ArrayExpression, ObjectExpression &
ArrayAssignmentTarget.
2024-02-27 13:04:13 +08:00
Arnaud Barré
76add55031
Support file type in playground (#2520)
<img width="1514" alt="Screenshot 2024-02-27 at 00 16 21"
src="https://github.com/oxc-project/oxc/assets/14235743/32fee380-a2c1-41b3-a564-351597d4a60e">

Not sure about the bindgen thing.

I made the filename optional but given the impact on parsing I think it
could be great for external users to not depend on the tsx default in
the future
2024-02-27 12:54:38 +08:00
Boshen
46e779194a
chore: fix clippy warnings (#2519) 2024-02-26 23:55:18 +08:00
Boshen
570ca68b1e
chore: bump Minimum Supported Rust Version to 1.74
closes #2514
2024-02-26 23:25:03 +08:00
Boshen
351a0572be
chore(parser): print both AST and errors in examples/parser 2024-02-26 23:20:46 +08:00
Boshen
c56b6cb643
refactor: replace InlinableString with CompactString for Atom (#2517)
relates #2516
2024-02-26 23:11:46 +08:00
Dunqing
1519b9000b
fix(semantic): incorrect scope for switch statement (#2513)
close: #2501
2024-02-26 22:54:19 +08:00
Boshen
be6b8b7ce6
[BREAKING CHANGE] Change Atom to Atom<'a> to make it safe (#2497)
Part of #2295

This PR splits the `Atom` type into `Atom<'a>` and `CompactString`.

All the AST node strings now use `Atom<'a>` instead of `Atom` to signify
it belongs to the arena.

It is now up to the user to select which form of the string to use.

This PR essentially removes the really unsafe code 


93742f89e9/crates/oxc_span/src/atom.rs (L98-L107)

which can lead to 

![image](https://github.com/oxc-project/oxc/assets/1430279/8c513c4f-19b0-4b63-b61c-e07c187c95b5)
2024-02-26 19:34:40 +08:00
Boshen
4fabe66621
Publish crates v0.8.0 2024-02-26 19:01:51 +08:00
Boshen
a0f23baea7
Release oxlint and vscode extension v0.2.11 2024-02-26 18:41:04 +08:00
Boshen
d980b0bef2
Release napi oxc-parser@v0.6.0 2024-02-26 18:40:26 +08:00
keita hino
93742f89e9
fix(linter): Correct configuration file parsing for jsx-no-useless-fragment (#2512)
fix: #2484 

I fixed the configuration parsing for jsx-no-useless-fragment.
2024-02-26 15:49:50 +08:00
Dunqing
cd75c1ca59
feat(transformer/decorators): insert only one private in expression (#2486) 2024-02-26 15:48:47 +08:00
Dunqing
4c2e2bdf61
fix(semantic): add export symbol flag to identifiers in export declarations (#2508)
Related PR: #2335
2024-02-26 15:48:05 +08:00
Dunqing
432791679f
fix(codegen): remove redundant semicolon in PropertyDefinition (#2511) 2024-02-26 15:15:19 +08:00
Yuji Sugiura
f66fb886b3
fix(tasks/rulegen): Parse 'export default' test file for plugin-jsdoc (#2510) 2024-02-26 14:31:51 +08:00
Boshen
540f917f3a
refactor(ast): remove TSEnumBody (#2509) 2024-02-26 12:44:38 +08:00
Arnaud Barré
b8764a8eb8
Fix few serialization issues (#2506)
Re: #2463
2024-02-26 12:25:17 +08:00
renovate[bot]
0bdace187a
chore(deps): update website npm packages (#2505) 2024-02-26 10:38:26 +08:00
renovate[bot]
29b213eac7
chore(deps): update rust crates (#2503) 2024-02-26 10:38:11 +08:00
renovate[bot]
77f3ab0496
chore(deps): update vscode npm packages (#2504) 2024-02-26 10:37:25 +08:00
Dunqing
70295a5552
feat(ast): update arrow_expression to arrow_function_expression (#2496) 2024-02-25 14:39:34 +00:00
Boshen
fba66dcc75
fix(linter): improve import/no-named-as-default (#2494) 2024-02-25 21:24:08 +08:00
Boshen
f5aadc767f
feat(linter): handle cjs `module.exports = {} as default export (#2493) 2024-02-25 00:11:48 +08:00
Boshen
f64c7e04a3
feat(linter): handle cjs module.exports.foo = bar and exports.foo = bar (#2492) 2024-02-24 23:54:43 +08:00
Boshen
d0a9c465f7
feat(linter): handle top-level require for import plugin (#2491) 2024-02-24 21:48:23 +08:00