Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
node-syntax-tree
Advanced tools
node-syntax-tree
is a node package for executing Syntax Tree in a WASM environment. It functions by compiling the Ruby interpreter and Syntax Tree source files into a WASM package that is loaded and executed at runtime.
If you're using the npm
:
npm install --save node-syntax-tree
Or if you're using yarn
, then add the plugin by:
yarn add node-syntax-tree
node-syntax-tree
provides both CJS and ESM modules distributions. To require through CJS, run:
const { default: createSyntaxTree } = require("node-syntax-tree");
To require through ESM, run:
import createSyntaxTree from "node-syntax-tree";
Once you have the import, you can initial the virtual machine and run the associated functions, as in:
createSyntaxTree().then((syntaxTree) => {
console.log(syntaxTree.handlers.ruby.parse("foo"));
// => (program (statements ((vcall (ident "foo")))))
console.log(syntaxTree.handlers.ruby.format("1+1"));
// => 1 + 1
console.log(syntaxTree.handlers.haml.parse("= foo"));
// => (root children=[(script text=" foo")])
console.log(syntaxTree.handlers.haml.format("= foo"));
// => = foo
});
TypeScript types are provided along with this package, and effectively boil down to:
type SyntaxTreeHandler = {
format(source: string): string;
parse(source: string): string;
read(filepath: string): string;
};
type SyntaxTree = {
handlers: Record<"haml" | "ruby", SyntaxTreeHandler>
};
function createSyntaxTree(): Promise<SyntaxTree>;
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby-syntax-tree/node-syntax-tree.
The package is available as open source under the terms of the MIT License.
[0.1.0] - 2022-08-09
FAQs
A node package for accessing Syntax Tree through WASM
The npm package node-syntax-tree receives a total of 0 weekly downloads. As such, node-syntax-tree popularity was classified as not popular.
We found that node-syntax-tree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.