CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--preset-stage-0

Deprecated Babel preset for stage 0 plugins that provides migration guidelines to explicit plugin configurations

80

1.21x
Overview
Eval results
Files

task.mdevals/scenario-6/

Runtime Transpilation Filters and Cache Control

Design a runtime transpilation helper that installs a require-time compiler with fine-grained filtering and cache behavior so Node.js code using modern syntax can load without a build step.

Capabilities

Selective transpilation

  • Installs the hook so modules under provided allowlist globs (defaulting to app/src JS and TS files) are transpiled, while any path matching the blocklist (defaulting to vendor/build outputs) is skipped. An allowed fixture that uses modern syntax such as optional chaining should run without syntax errors; a blocked fixture should load untouched. @test

Persistent cache reuse

  • Compiled output is written to a deterministic cache directory (default .cache/babel-register in the project root unless overridden) and reused across repeated requires so the second load avoids re-compiling. @test

Cache opt-out and purge

  • Setting environment flag TRANSPILE_CACHE=0 or passing cache: false disables cache writes and removes any existing cache directory. Exposing a purgeTranspileCache helper clears the cache directory when invoked. @test

Implementation

@generates

API

/**
 * Installs runtime transpilation for require/import with selective filtering and cache control.
 *
 * @param {Object} [options]
 * @param {string[]} [options.allow] - Globs or regex patterns to transpile; defaults to app/src JS and TS files.
 * @param {string[]} [options.block] - Globs or regex patterns to skip; defaults to node_modules and build outputs.
 * @param {string} [options.cacheDirectory] - Directory for compiled cache; defaults to a project-local folder.
 * @param {boolean} [options.cache] - Force-enable or disable caching; env TRANSPILE_CACHE=0 overrides to disable.
 * @param {Array} [options.presets] - Presets to apply during runtime compilation.
 * @returns {() => void} disposer that removes the hook and closes any related resources.
 */
export function installRuntimeTranspiler(options);

/**
 * Deletes all compiled runtime cache artifacts and returns true when removal succeeds.
 *
 * @returns {Promise<boolean>}
 */
export function purgeTranspileCache();

Dependencies { .dependencies }

@babel/register { .dependency }

Installs a runtime transpilation hook with filtering and cache control.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-babel--preset-stage-0

tile.json