
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@vlocode/apex
Advanced tools
Antlr4 based APEX Parser and Grammar. This library uses antlr4ng as runtime library which is a port of the original antlr4 runtime library to TypeScript.
The library exposes the APEX Lexer and APEX parser generated from the .g4 grammar files allowing parsing of APEX source code using Visitor or Listener patterns.
Below code demonstrates how to identify which classes are tested by which test classes. And prints the test classes for a given class name.
import { TestIdentifier } from '@vlocode/apex';
const testIdentifier = container.create(TestIdentifier);
await testIdentifier.loadApexClasses(['path/to/apex/classes']);
const testClasses = testIdentifier.getTestClasses('MyClass');
console.log(testClasses);
Below code demonstrates how to extract class information from an APEX source fragment and prints the class name, fields and methods as well as their access modifiers.
import { Parser } from '@vlocode/apex';
const sourceCode = `public class Person {
private String name;
private Integer age;
public String nameProperty {
get { return this.name; }
}
public Integer getAge(Integer arg) {
return this.age;
}
public Date getBirthDate() {
return Date.now();
}
}`;
const parser = new Parser(sourceCode);
const struct = parser.getCodeStructure();
for (const classInfo of struct.classes) {
console.log(`Class ${classInfo.name}`);
console.log(` Fields: ${classInfo.fields.length}`);
classInfo.fields.forEach((field, i) =>
console.log(` ${i + 1}) ${field.name} (${field.access})`)
);
console.log(` Methods: ${classInfo.methods.length}`);
classInfo.methods.forEach((method, i) =>
console.log(` ${i + 1}) ${method.name} (${method.access})`)
);
}
Outputs the following:
Class Person
Fields: 2
1) name (private)
2) age (private)
Methods: 2
2) getAge (public)
3) getBirthDate (public)
The grammar files in this library are based on the grammar files from the apex-parser NPM library originally maintained by Andrey Gavrikov. The original library is no longer maintained and the grammar files have been updated to work with the latest version of Salesforce and the antlr4ng runtime library.
FAQs
Salesforce APEX Parser and Grammar
The npm package @vlocode/apex receives a total of 687 weekly downloads. As such, @vlocode/apex popularity was classified as not popular.
We found that @vlocode/apex demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.