cli: Compile parsers to wasm using wasi-sdk, not emscripten (#4393)

* Build wasm modules using wasi-sdk, not emscripten

* Log a warning if --docker is passed
This commit is contained in:
Max Brunsfeld 2025-04-24 16:00:09 -07:00 committed by GitHub
parent 635c49909c
commit d4d8ed32b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 141 additions and 120 deletions

View file

@ -138,8 +138,7 @@ struct Build {
/// Build a WASM module instead of a dynamic library
#[arg(short, long)]
pub wasm: bool,
/// Run emscripten via docker even if it is installed locally (only if building a WASM module
/// with --wasm)
/// No longer used.
#[arg(short, long)]
pub docker: bool,
/// The path to output the compiled file
@ -792,6 +791,10 @@ impl Build {
fn run(self, mut loader: loader::Loader, current_dir: &Path) -> Result<()> {
let grammar_path = current_dir.join(self.path.as_deref().unwrap_or_default());
if self.docker {
eprintln!("Warning: --docker flag is no longer used, and will be removed in a future release.");
}
if self.wasm {
let output_path = self.output.map(|path| current_dir.join(path));
let root_path = get_root_path(&grammar_path.join("tree-sitter.json"))?;
@ -801,7 +804,6 @@ impl Build {
&grammar_path,
current_dir,
output_path,
self.docker,
)?;
} else {
let output_path = if let Some(ref path) = self.output {

View file

@ -44,7 +44,6 @@ pub fn compile_language_to_wasm(
language_dir: &Path,
output_dir: &Path,
output_file: Option<PathBuf>,
force_docker: bool,
) -> Result<()> {
let grammar_name = get_grammar_name(language_dir)?;
let output_filename =
@ -59,7 +58,6 @@ pub fn compile_language_to_wasm(
.as_ref()
.and_then(|p| Some(Path::new(p.file_name()?))),
&output_filename,
force_docker,
)?;
// Exit with an error if the external scanner uses symbols from the