Skip to content

Instantly share code, notes, and snippets.

@ghostdevv
Created March 21, 2022 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghostdevv/a81444ae248329cb53574a23eedbd4b1 to your computer and use it in GitHub Desktop.
Save ghostdevv/a81444ae248329cb53574a23eedbd4b1 to your computer and use it in GitHub Desktop.
Convert any js project to rust in 0.1ms

The following command will change 'use strict' to 'use rust'!

find . -name "*.js" -type f ! -path "*/node_modules/*" -exec sed -i "s/'use strict'/'use rust'/g" {} +

Example

Before we have a slow, legacy js project

'use strict';

function slow() {
  // ...

After the command it's fixed!

'use rust';

fn fast() {
  // ...
@FractalHQ
Copy link

Does this support WASM?

@ghostdevv
Copy link
Author

@FractalHQ I don't see any WASM prs

@FractalHQ
Copy link

Pretty swamped rn but I'll take a look when I get some time next week

@ghostdevv
Copy link
Author

sweet, though this might be legacy by then so keep that in mind

@ghostdevv
Copy link
Author

nvm the CD wasn't fast enough and we got beaten by js2rust4wasm

@FractalHQ
Copy link

throwing-papers-im-done.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment