CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-syntax-class-properties

Babel syntax plugin that enables parsing of class properties, private properties, and private methods

94

1.04x
Overview
Eval results
Files

task.mdevals/scenario-8/

Class Feature Syntax Gateway

A Babel-focused task to provide syntax-only support for class fields and private methods by wiring parser options while leaving emitted code untouched.

Capabilities

Accepts public fields

  • Transforming code containing public or static class fields succeeds without syntax errors and returns the same code. @test

Accepts private fields and methods

  • Transforming code containing private fields and private methods succeeds without syntax errors and returns the same code. @test

Syntax-only passthrough

  • When only this plugin is configured, transforming code with class field syntax returns output identical to the input source. @test

Babel version assertion

  • Initializing the plugin against a Babel core version lower than 7 triggers a version assertion error. @test

Implementation

@generates

API

/**
 * Returns a Babel plugin that enables parsing of class feature syntax without emitting transforms.
 * Expects Babel's plugin API object as the only argument.
 */
function buildSyntaxPlugin(api);

/**
 * Transforms the given source string using @babel/core with only this plugin enabled.
 * Resolves with the transformed code string.
 */
async function transformWithSyntaxSupport(source);

module.exports = { buildSyntaxPlugin, transformWithSyntaxSupport };

Dependencies { .dependencies }

@babel/core { .dependency }

Required to run programmatic transforms in the tests.

@babel/plugin-syntax-class-properties { .dependency }

Enables parser support for public and private class features when parser options are extended.

Install with Tessl CLI

npx tessl i tessl/npm-babel--plugin-syntax-class-properties

tile.json