Registry / devops / babel-plugin-kea

babel-plugin-kea

JSON →
library3.0.0jsnpmunverified

A Babel plugin that automatically generates path strings for Kea logic stores based on the file path. Version 3.0.0 is the latest stable release. It eliminates the need to manually specify a `path` property in every `kea()` call, with support for dynamic keys and custom path prefix configuration. Unlike manual path management, this plugin ensures consistency and reduces boilerplate in Kea-based projects. It requires Kea 3.x and is intended for build-time usage with Babel.

npm install babel-plugin-kea
INSTALL
IMPORT
SIG · BABEL-PLUGIN-KEA
B
babel-plugin-kea
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin (default)
plugins: ['babel-plugin-kea']
plugins: ['babel-plugin-kea', { path: './src' }] (wrong syntax, must be nested array)
Add to .babelrc plugins array. With options: ['babel-plugin-kea', { path: './src' }]
Plugin with options
plugins: [['babel-plugin-kea', { path: './src' }]]
plugins: ['babel-plugin-kea', { path: './src' }] (options must be inside nested array)
Options object must be second element in a tuple.
Programmatic usage
const plugin = require('babel-plugin-kea'); require('@babel/core').transform(code, { plugins: [plugin] })
const plugin = require('babel-plugin-kea').default (default export is the plugin function)
Plugin is a function, not an object with default property.

Basic Babel configuration enabling the plugin and an example with custom path prefix to trim root directory.

// .babelrc { "plugins": [ "babel-plugin-kea" ] } // With path prefix to skip 'frontend/src': // { // "plugins": [ // ["babel-plugin-kea", { "path": "./frontend/src" }] // ] // }
Debug
Known issues
breakingPlugin v3.x only works with Kea 3.x. Using with Kea 2.x will break.
fix
Upgrade Kea to 3.x or use babel-plugin-kea@2.x for Kea 2.x.
affects: >=3.0.0
gotchaIf a kea({ path: ... }) already has a path string, the plugin will NOT override it. It only adds path when missing.
fix
Remove explicit path from kea() calls to let plugin generate them automatically.
affects: >=0.0.0
gotchaThe generated path uses the file path relative to the project, not the module name. Moving files changes the path.
fix
Use the 'path' option to trim a prefix (e.g., './src') to keep paths stable if files move under src.
affects: >=0.0.0
deprecatedPlugin auto-generates path based on file path. To override path for a specific logic, you must still provide a custom path function; an array or string will be treated as custom path and not overwritten.
fix
Use path: () => [...] for dynamic paths; static paths as arrays are not modified.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Could not find plugin "babel-plugin-kea"
Plugin not installed or not in node_modules.
fix
Run 'npm install babel-plugin-kea --save-dev' or 'yarn add babel-plugin-kea --dev'.
TypeError: babelPluginKea is not a function
Incorrect import/require when using programmatic API (e.g., require('babel-plugin-kea').default).
fix
Use 'const plugin = require('babel-plugin-kea')' (no .default).
Error: Plugin options must be an array when using two-element tuple
Misconfigured .babelrc plugins array (e.g., missing nested array).
fix
Use [['babel-plugin-kea', { path: './src' }]] not ['babel-plugin-kea', { path: './src' }].
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency: plugin runs as a Babel transform
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
babel-plugin-kea — npm install babel-plugin-kea · libregistry