Skip to content

A simple JavaScript pre-processor to help get your project started.

License

Notifications You must be signed in to change notification settings

scripting/jsPreprocessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsPreprocessor

A simple JavaScript pre-processor to help get your project started.

What it does

We scan the source text of a JavaScript program in the file test.js looking for calls to a one of our special functions, indicated by its name appearing in the specialFunctionNames object, adding the keyword await in front of the call. Any calls to functions not in this list are left alone.

We use the acorn parser to turn the original code into an AST. Then we do a depth-first traversal of the tree, looking for function calls and process them as described above

Finally we turn the AST into JS text, using escodegen. It should be ready to run.

Notes

The internal routine, visitCodeTree maintains a stack and passes it to the visit routine, but it isn't needed.

About

A simple JavaScript pre-processor to help get your project started.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published