docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a utility that analyzes CommonJS module source code to detect exports defined using Object.defineProperty. The tool should identify both value-based exports and getter-based exports.
Your tool should parse JavaScript source code and detect the following export patterns:
Object.defineProperty with a value propertyObject.defineProperty with a get function that returns identifiers or member expressionsObject.defineProperty(exports, 'myValue', { value: 42, enumerable: true }), the analyzer detects 'myValue' as an export @testObject.defineProperty(exports, 'foo', { get: function() { return bar; }, enumerable: true }), it detects 'foo' as an export @testObject.defineProperty calls on exports, it returns all detected export names @test/**
* Analyzes CommonJS source code and detects exports defined via Object.defineProperty
*
* @param {string} source - The JavaScript source code to analyze
* @returns {{ exports: string[] }} An object containing an array of detected export names
*/
function analyzeExports(source) {
// IMPLEMENTATION HERE
}
module.exports = { analyzeExports };Provides CommonJS module parsing and export detection capabilities.