Babel syntax plugin that enables parsing of class properties, private properties, and private methods
94
Build a utility that parses JavaScript source to extract metadata about private class methods, relying on Babel configuration that accepts the syntax without transforming it.
#start and #stop alongside public methods, the analyzer returns both private method names with isStatic=false and source locations, leaving errors empty. @test#init and #reset plus other class members, the analyzer marks them with isStatic=true, preserves their order of appearance, and reports no errors. @testclass Broken { #bad; }, the analyzer returns a single error message mentioning private methods and the offending line number instead of throwing unhandled exceptions. @test@generates
/**
* Parses JavaScript source that may contain private class methods and reports their metadata.
*
* @param {string} source - JS code to inspect. Must be a string.
* @returns {{
* privateMethods: Array<{ name: string, isStatic: boolean, loc: { line: number, column: number } }>,
* errors: Array<{ message: string, line: number, column: number }>
* }}
* @throws {TypeError} when source is not a string
*/
function analyzePrivateMethods(source) {}
module.exports = { analyzePrivateMethods };Registers Babel parser plugins for class fields and private methods so the input code parses without transforms.
@satisfied-by
Provides the Babel parsing entrypoints used to build the analysis.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-syntax-class-properties