Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Website for ast-grep!

License

NotificationsYou must be signed in to change notification settings

ast-grep/ast-grep.github.io

Repository files navigation

ast-grep

ast-grep(sg)

ast-grep(sg) is a lightning fast and user friendly tool for code searching, linting, rewriting at large scale.

This is the website source for ast-grep!

Setup Guide

Unfortunately wasm-pack does not support compiling C dependency with stdlib.We have to use emcc.

We have to use web-tree-sitter

To setup:

  1. Install wasm-packhttps://rustwasm.github.io/wasm-pack/, pnpm, cargo
  2. Clone the repo
  3. wasm-pack build --target web. This will build the wasm inpkg folder
  4. pnpm install
  5. pnpm dev
  6. visit localhost:5173. This will make vitepress cache the dependency.
  7. Run the following script, which is needed for dev-time wasm bundling:
    cd website/.vitepress/cache/depsln -s ../../../../pkg/ast_grep_wasm_bg.wasmcd ../../../..

Upgrate tree-sitter Guide

You need to upgrade tree-sitter to the latest version.

You also need to copy the tree-sitter.wasm to the public directory because vite's building convention.

You will usually have weird error messages liketree-sitter.wasm is not foundor having wrongLinkError of undefined methods likeexit.


emcc setup is not used any more

~~

  1. Installemcc
  2. rustup target add wasm32-unknown-emscripten
  3. cargo install -f wasm-bindgen-cli
  4. EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry" cargo build --target wasm32-unknown-emscripten
  5. wasm-bindgen --target web ../../target/wasm32-unknown-emscripten/debug/ast_grep_wasm.wasm --out-dir pkg

Reference

https://github.com/MolotovCherry/tree-sitter-wasmrustwasm/wasm-pack#741https://stackoverflow.com/questions/67474533/error-in-compiling-rust-into-webassembly-using-emscripten-on-windowshttps://github.com/rustwasm/wasm-pack/blob/master/src/command/build.rs~~

ast-grep playground

Pre-requisite

It requires tree-sitter.wasm and tree-sitter-{lang}.wasm available in public directory.

Language specific wasm must be built with the same emcc version of the tree-sitter.wasm.

Mismatching emcc version will raise RuntimeError.

Reference

About

Website for ast-grep!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors59


[8]ページ先頭

©2009-2025 Movatter.jp