Git Product home page Git Product logo

ast-grep.github.io's Introduction

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-pack https://rustwasm.github.io/wasm-pack/, pnpm, cargo
  2. Clone the repo
  3. wasm-pack build --target web. This will build the wasm in pkg 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/deps
    ln -s ../../../../pkg/ast_grep_wasm_bg.wasm
    cd ../../../..

emcc setup is not used any more

~~

  1. Install emcc
  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-wasm rustwasm/wasm-pack#741 https://stackoverflow.com/questions/67474533/error-in-compiling-rust-into-webassembly-using-emscripten-on-windows https://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

ast-grep.github.io's People

Contributors

herringtondarkholme avatar renovate[bot] avatar siguremo avatar ssshuai1999 avatar q0w avatar stevenlove avatar pd4d10 avatar fvictorio avatar junyi avatar pionxzh avatar boidolr avatar makotot avatar suyanhanx avatar lotwt avatar tducret avatar baseballyama avatar bughou avatar hioz avatar luismeyer95 avatar yyytbd avatar sxzz avatar idestin avatar hobofan avatar mbertheau avatar tgohn avatar jack-michaud avatar dimitarvp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.