CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-transform-parameters

Babel plugin that compiles ES2015 default and rest parameters to ES5-compatible code

91

1.02x
Overview
Eval results
Files

task.mdevals/scenario-1/

Babel Plugin for Experimental Syntax Support

Build a Babel plugin that enables parsing and transforming experimental JavaScript syntax features. Your plugin should support parsing code that uses cutting-edge ECMAScript proposals.

Requirements

Create a Babel plugin that:

  1. Configures parser for experimental syntax: Set up the Babel parser to accept experimental JavaScript proposals including pipeline operators and decorators.

  2. Transforms experimental features: Transform at least one experimental syntax feature (such as do expressions) into backward-compatible JavaScript code.

  3. Provides plugin options: Allow users to configure which experimental features to enable through plugin options.

  4. Integrates with Babel's plugin system: Return a proper plugin object with visitor methods that work with Babel's transformation pipeline.

Implementation Details

Create the following files:

  • src/plugin.js - The main Babel plugin implementation
  • test/plugin.test.js - Tests verifying the plugin works correctly

Your plugin should be able to process source code containing experimental syntax and produce transformed output. The plugin must work with Babel's standard transformation pipeline.

Test Cases

  • The plugin parses code with pipeline operator syntax without errors @test
  • The plugin parses code with decorator syntax without errors @test
  • The plugin transforms do expressions into valid JavaScript @test
  • The plugin respects configuration options to enable/disable specific proposals @test

@generates

API

/**
 * Babel plugin that enables experimental syntax support
 * @param {Object} api - Babel API object
 * @param {Object} options - Plugin configuration options
 * @param {boolean} options.pipelineOperator - Enable pipeline operator support
 * @param {boolean} options.decorators - Enable decorators support
 * @param {boolean} options.doExpressions - Enable do expressions support
 * @returns {Object} Babel plugin object with visitor methods
 */
module.exports = function experimentalSyntaxPlugin(api, options) {
  // Plugin implementation
};

Dependencies { .dependencies }

@babel/core { .dependency }

Provides the core Babel transformation API and plugin system.

@babel/parser { .dependency }

Provides JavaScript parsing with support for experimental syntax plugins.

@babel/types { .dependency }

Provides AST node builders and utilities for code transformation.

Install with Tessl CLI

npx tessl i tessl/npm-babel--plugin-transform-parameters

tile.json