or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@babel/runtime@7.28.x
tile.json

tessl/npm-babel--runtime

tessl install tessl/npm-babel--runtime@7.28.0

Babel's modular runtime helpers that provide transpilation support for modern JavaScript features

Agent Success

Agent success rate when using this tile

94%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

79%

task.mdevals/scenario-5/

Custom Comment Parser Plugin

Build a Babel plugin that uses a custom parser to handle special comment syntax in JavaScript code.

Overview

You need to create a Babel plugin that replaces the default JavaScript parser with a custom one. The custom parser should be able to parse standard JavaScript code while also recognizing and preserving special metadata comments in a specific format: /*@metadata key=value */.

These special comments should be extracted during parsing and made available in the AST as custom metadata that can be accessed by other plugins or tools in the Babel pipeline.

Requirements

Your plugin should:

  1. Override the default parser - Replace Babel's default parser with a custom parser implementation that extends its functionality
  2. Parse special metadata comments - Recognize and extract comments in the format /*@metadata key=value */ during the parsing phase
  3. Preserve standard parsing - Ensure all standard JavaScript syntax continues to parse correctly
  4. Attach metadata to AST - Store extracted metadata in a way that makes it accessible from the resulting AST

Test Cases

  • Parsing code with a metadata comment /*@metadata author=john */ should extract the metadata and include it in the parse result @test
  • Parsing code without metadata comments should work exactly like the default parser @test
  • Parsing code with multiple metadata comments should extract all of them @test
  • The plugin should properly integrate with Babel's transformation pipeline @test

@generates

API

/**
 * A Babel plugin that overrides the default parser to handle special metadata comments.
 *
 * The plugin exports a function that returns a Babel plugin object with a parserOverride.
 *
 * @param {Object} api - The Babel API object
 * @returns {Object} A Babel plugin object with parserOverride
 */
module.exports = function(api) {
  // Plugin implementation
};

Dependencies { .dependencies }

@babel/core { .dependency }

Provides the core Babel transformation and parsing APIs, including the ability to override the default parser.