or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-10/

Transpiled Module Analyzer

Build a tool that analyzes transpiled JavaScript modules to detect and identify star re-export patterns.

Overview

When TypeScript and Babel transpilers convert ESM star re-exports (export * from 'module') to CommonJS, they generate distinctive code patterns. Your task is to build an analyzer that detects these patterns and classifies which transpiler generated them.

Capabilities

Detect Babel patterns

  • Given source code with a Babel star re-export pattern (Object.keys forEach loop), returns { detected: true, transpiler: 'babel' } @test

Detect TypeScript patterns

  • Given source code with a TypeScript star re-export pattern (__export or __exportStar function), returns { detected: true, transpiler: 'typescript' } @test

Handle non-transpiled code

  • Given source code without star re-export patterns, returns { detected: false, transpiler: null } @test

Implementation

@generates

API

/**
 * Analyzes transpiled CommonJS code to detect star re-export patterns
 * @param {string} source - JavaScript source code to analyze
 * @returns {Object} Analysis result with detected (boolean) and transpiler (string|null) properties
 */
function analyzeTranspiledModule(source) {
  // Implementation here
}

module.exports = { analyzeTranspiledModule };

Dependencies { .dependencies }

cjs-module-lexer { .dependency }

Provides CommonJS module lexing and export detection capabilities.