Skip to content

Commit e9b020d

Browse files
authored
feat: move script parsing to vite_shell and add source spans (#55)
### TL;DR Migrate shell parsing functionality from `vite_task` to a dedicated `vite_shell` crate, improving shell command parsing with better location tracking. ### What changed? - Moved `TaskParsedCommand` and shell parsing logic from `vite_task/cmd.rs` to the `vite_shell` crate - Enhanced the shell parser to track source locations of commands in addition to parsing them - Updated `try_parse_as_and_list` to return both parsed commands and their source ranges - Updated the workspace to use the new shell parsing functionality - Pinned to a specific git revision of `brush-parser` to fix a bug with AST node locations
1 parent 8f14a91 commit e9b020d

File tree

11 files changed

+304
-604
lines changed

11 files changed

+304
-604
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ allocator-api2 = { version = "0.2.21", default-features = false, features = ["al
3636
anyhow = "1.0.98"
3737
assert2 = "0.3.16"
3838
assertables = "9.8.1"
39-
ast-grep-core = "0.32.2"
4039
base64 = "0.22.1"
4140
bincode = "2.0.1"
4241
bindgen = "0.72.1"
4342
bitflags = "2.10.0"
44-
brush-parser = "0.2.18"
43+
# The newest released version (0.3.0) of brush-parser has a bug that reports incorrect locations for some ast nodes.
44+
# The latest commit has fixed it. TODO: switch back to released version when a new version is published.
45+
brush-parser = { git = "https://github.com/reubeno/brush", rev = "dcb760933b10ee0433d7b740a5709b06f5c67c6b" }
4546
bstr = { version = "1.12.0", default-features = false, features = ["alloc", "std"] }
4647
bumpalo = { version = "3.17.0", features = ["allocator-api2"] }
4748
bytemuck = { version = "1.23.0", features = ["extern_crate_alloc", "must_cast"] }
@@ -109,16 +110,16 @@ thiserror = "2"
109110
tokio = "1.48.0"
110111
tokio-util = "0.7.17"
111112
toml = "0.9.5"
112-
tracing = "0.1.41"
113+
tracing = "0.1.43"
113114
tracing-error = "0.2.1"
114115
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "serde"] }
115-
tree-sitter-bash = "0.23.1"
116116
tui-term = "0.2.0"
117117
twox-hash = "2.1.1"
118118
uuid = "1.18.1"
119119
vec1 = "1.12.1"
120120
vite_glob = { path = "crates/vite_glob" }
121121
vite_path = { path = "crates/vite_path" }
122+
vite_shell = { path = "crates/vite_shell" }
122123
vite_str = { path = "crates/vite_str" }
123124
vite_workspace = { path = "crates/vite_workspace" }
124125
wax = "0.6.0"

0 commit comments

Comments
 (0)