Skip to content

Commit 632f495

Browse files
committed
feat(wasm): Add ast-grep-wasm with an API almost identical to napi with libc shim
1 parent c7bba90 commit 632f495

30 files changed

+2251
-45
lines changed

Cargo.lock

Lines changed: 120 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/src/utils/worker.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ pub struct Items<T>(mpsc::Receiver<T>);
6969
impl<T> Iterator for Items<T> {
7070
type Item = T;
7171
fn next(&mut self) -> Option<Self::Item> {
72-
if let Ok(match_result) = self.0.recv() {
73-
Some(match_result)
74-
} else {
75-
None
76-
}
72+
self.0.recv().ok()
7773
}
7874
}
7975
impl<T> Items<T> {

crates/language/src/parsers/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@ mod parsers_none;
2424
// Re-export language functions based on enabled features
2525
// Use mutually exclusive conditions to avoid ambiguity
2626
#[cfg(any(feature = "builtin-parser", feature = "wasm-exhaustive-lang"))]
27-
pub use parsers_builtin::parsers_builtin::*;
27+
pub use parsers_builtin::parsers::*;
2828

2929
#[cfg(all(
3030
feature = "napi-lang",
3131
not(feature = "builtin-parser"),
3232
not(feature = "wasm-exhaustive-lang")
3333
))]
34-
pub use parsers_napi::parsers_napi::*;
34+
pub use parsers_napi::parsers::*;
3535

3636
#[cfg(all(
3737
feature = "wasm-lang",
3838
not(feature = "builtin-parser"),
3939
not(feature = "napi-lang"),
4040
not(feature = "wasm-exhaustive-lang")
4141
))]
42-
pub use parsers_wasm::parsers_wasm::*;
42+
pub use parsers_wasm::parsers::*;
4343

4444
#[cfg(all(
4545
not(feature = "builtin-parser"),
4646
not(feature = "napi-lang"),
4747
not(feature = "wasm-lang"),
4848
not(feature = "wasm-exhaustive-lang")
4949
))]
50-
pub use parsers_none::parsers_none::*;
50+
pub use parsers_none::parsers::*;

crates/language/src/parsers/parsers_builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ macro_rules! into_lang {
77
};
88
}
99

10-
pub mod parsers_builtin {
10+
pub mod parsers {
1111
use ast_grep_core::language::TSLanguage;
1212

1313
pub fn language_bash() -> TSLanguage {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy