CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-cjs-module-lexer

High-performance CommonJS module lexer for detecting named exports and reexports from JavaScript source code

93

0.98x

Quality

Pending

Does it follow best practices?

Impact

93%

0.98x

Average score across 10 eval scenarios

Overview
Eval results
Files

Evaluation results

97%

2%

Module Export Analyzer

Token parsing (strings, comments, templates, regex)

Criteria
Without context
With context

Package import

100%

100%

parse() invocation

100%

100%

Exports array usage

100%

100%

Reexports array usage

100%

100%

Proper initialization

0%

40%

92%

-8%

CommonJS Export Analyzer

Basic export detection (exports.name, module.exports)

Criteria
Without context
With context

Import package

100%

100%

Call parse function

100%

100%

Handle initialization

100%

46%

Extract exports array

100%

100%

Extract reexports array

100%

100%

Return correct format

100%

100%

100%

CommonJS Export Analyzer

Object.defineProperty getter and value detection

Criteria
Without context
With context

Import parse function

100%

100%

Call parse function

100%

100%

Extract exports array

100%

100%

Value property detection

100%

100%

Getter property detection

100%

100%

Multiple exports handling

100%

100%

100%

Module Export Batch Analyzer

Performance optimizations (memory management, endian handling)

Criteria
Without context
With context

Imports cjs-module-lexer

100%

100%

Calls init()

100%

100%

Uses parse() function

100%

100%

Extracts exports array

100%

100%

Extracts reexports array

100%

100%

Handles parse errors

100%

100%

73%

8%

JavaScript Identifier Validator

Grammar validation (ECMA-262 identifiers, surrogate pairs)

Criteria
Without context
With context

Uses parse function

80%

100%

Extracts exports correctly

100%

100%

Handles Unicode identifiers

50%

50%

Validates surrogate pairs

50%

50%

Filters reserved words

33%

53%

100%

CommonJS Module Reexport Analyzer

Module reexport detection (module.exports = require())

Criteria
Without context
With context

Imports parse function

100%

100%

Calls parse correctly

100%

100%

Extracts reexports field

100%

100%

Returns reexports array

100%

100%

70%

-25%

Module Export Analyzer

Star re-export pattern detection (__export, __exportStar)

Criteria
Without context
With context

Uses parse function

100%

100%

Extracts reexports data

100%

60%

Returns module list

75%

50%

Detects presence flag

100%

50%

Handles empty case

100%

100%

100%

CommonJS Module Analyzer

Parse function with exports and reexports extraction

Criteria
Without context
With context

Import package

100%

100%

Call init()

100%

100%

Use parse() function

100%

100%

Extract exports array

100%

100%

Extract reexports array

100%

100%

Handle errors

100%

100%

100%

20%

Transpiler Export Pattern Analyzer

Transpiler-specific Object.keys().forEach() patterns

Criteria
Without context
With context

Imports parse function

100%

100%

Calls parse function

100%

100%

Accesses exports array

100%

100%

Handles reexports array

100%

100%

Detects Babel pattern

33%

100%

Identifies source module

33%

100%

Handles arrow functions

100%

100%

Negative case handling

100%

100%

100%

Transpiled Module Analyzer

TypeScript transpiler pattern recognition

Criteria
Without context
With context

Uses parse function

100%

100%

Analyzes source code

100%

100%

Detects Babel patterns

100%

100%

Detects TypeScript patterns

100%

100%

Returns correct format

100%

100%

Install with Tessl CLI

npx tessl i tessl/npm-cjs-module-lexer
Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents