High-performance CommonJS module lexer for detecting named exports and reexports from JavaScript source code
93
Quality
Pending
Does it follow best practices?
Impact
93%
0.98xAverage score across 10 eval scenarios
Build a tool that analyzes CommonJS modules to detect and report transpiler-generated star re-export patterns. The tool should identify modules that re-export everything from other modules using patterns commonly generated by transpilers like TypeScript and Babel.
Your analyzer should:
__export(require("lodash")), detect "lodash" as a star re-export @test__exportStar(require("./utils"), exports), detect "./utils" as a star re-export @test__export(require("package-a")) and __exportStar(require("package-b"), exports), detect both "package-a" and "package-b" @testexports.name = value, return empty results indicating no star re-exports @test@generates
/**
* Analyze CommonJS source code for star re-export patterns
* @param {string} source - The JavaScript source code to analyze
* @returns {Object} Analysis report with reexported modules and detection flag
* @returns {string[]} return.modules - Array of module specifiers being star re-exported
* @returns {boolean} return.hasStarExports - True if any star re-export patterns were detected
*/
function analyzeStarExports(source) {
// Implementation here
}
module.exports = { analyzeStarExports };Provides lexical analysis of CommonJS modules to detect export patterns.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-cjs-module-lexerdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10