CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-babel-plugin-transform-es2015-sticky-regex

tessl install tessl/npm-babel-plugin-transform-es2015-sticky-regex@6.24.0

Babel plugin that transforms ES2015 sticky regex literals to ES5-compatible RegExp constructor calls

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.03x

Baseline

Agent success rate without this tile

97%

task.mdevals/scenario-4/

Sticky Regex Build Support

Enable compilation of JavaScript sources so sticky regex literals work in runtimes without native y flag support by configuring the build with a sticky-regex Babel transform.

Capabilities

Rewrites sticky regex literals

  • Compiling code containing a sticky regex literal such as /foo/y emits output where that literal becomes an equivalent RegExp constructor call that preserves the y flag and any other flags present (e.g., /foo/gy becomes new RegExp("foo", "gy")). @test

Leaves non-sticky regex untouched

  • Compiling code containing regex literals without the y flag returns output that keeps those literals unchanged (e.g., /foo/gi remains /foo/gi). @test

Babel config enables sticky transform

  • The build setup exposes a babel.config.json (or equivalent) that lists the sticky regex transform plugin so consumers can enable it via config, and compilation uses that config entry when transforming sources. @test

Implementation

@generates

API

/**
 * Compiles the provided source string using Babel and the sticky-regex transform config.
 * Returns the transpiled code string with sticky regex literals rewritten.
 */
export function compileWithStickySupport(source, filename);

/**
 * Loads and returns the Babel configuration that declares the sticky-regex transform plugin.
 */
export function loadBabelConfig();

Dependencies { .dependencies }

@babel/core { .dependency }

Runs Babel transforms for the compilation pipeline. @satisfied-by

@babel/plugin-transform-sticky-regex { .dependency }

Provides the sticky regex transform declared in the Babel configuration. @satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/babel-plugin-transform-es2015-sticky-regex@6.24.x
tile.json