-
-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(oxc): add
napi
feature, change napi parser to use oxc
crate
- Loading branch information
Showing
8 changed files
with
62 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod parse; | ||
|
||
pub use parse::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use napi_derive::napi; | ||
|
||
/// Babel Parser Options | ||
/// | ||
/// <https://github.com/babel/babel/blob/main/packages/babel-parser/typings/babel-parser.d.ts> | ||
#[napi(object)] | ||
#[derive(Default)] | ||
pub struct ParserOptions { | ||
#[napi(ts_type = "'script' | 'module' | 'unambiguous' | undefined")] | ||
pub source_type: Option<String>, | ||
pub source_filename: Option<String>, | ||
/// Emit `ParenthesizedExpression` in AST. | ||
/// | ||
/// If this option is true, parenthesized expressions are represented by | ||
/// (non-standard) `ParenthesizedExpression` nodes that have a single `expression` property | ||
/// containing the expression inside parentheses. | ||
/// | ||
/// Default: true | ||
pub preserve_parens: Option<bool>, | ||
} | ||
|
||
#[napi(object)] | ||
pub struct ParseResult { | ||
pub program: String, | ||
pub comments: Vec<Comment>, | ||
pub errors: Vec<String>, | ||
} | ||
|
||
#[napi(object)] | ||
pub struct Comment { | ||
#[napi(ts_type = "'Line' | 'Block'")] | ||
pub r#type: &'static str, | ||
pub value: String, | ||
pub start: u32, | ||
pub end: u32, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters