Registry / devops / ember-cli-babel-plugin-helpers

ember-cli-babel-plugin-helpers

JSON →
library1.1.1jsnpmunverified

Utilities for managing Babel plugins in Ember CLI apps and addons. Provides functions to check, find, and add plugins (hasPlugin, findPlugin, addPlugin) while preventing duplicate registrations. Targets can be EmberApp, Addon instances, or arrays. Handles Babel's plugin name normalization, including scoped packages and Windows path fixes. Current stable version 1.1.1, ships TypeScript types. Minimal dependencies; primarily for addon authors who need to ensure specific Babel plugins are present in a parent project without collisions.

npm install ember-cli-babel-plugin-helpers
INSTALL
IMPORT
SIG · EMBER-CLI-BABEL-PL
E
ember-cli-babel-plugin-helpers
devopsjavascriptv1.1.1
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.

hasPlugin
const { hasPlugin } = require('ember-cli-babel-plugin-helpers')
import { hasPlugin } from 'ember-cli-babel-plugin-helpers'
CommonJS only; ESM import will fail. The package does not have a proper ESM entry, so use require() even in Node >=14.
findPlugin
const { findPlugin } = require('ember-cli-babel-plugin-helpers')
const findPlugin = require('ember-cli-babel-plugin-helpers').findPlugin
All three functions are named exports; accessing them via destructuring is standard.
addPlugin
const { addPlugin } = require('ember-cli-babel-plugin-helpers')
import { addPlugin } from 'ember-cli-babel-plugin-helpers'
Same as above; only CommonJS is supported.
PluginTarget
import type { PluginTarget } from 'ember-cli-babel-plugin-helpers'
TypeScript users should use type imports for the PluginTarget type, which represents EmberApp | Addon | BabelPlugin[].

Shows how an Ember addon uses hasPlugin and addPlugin to conditionally add a Babel plugin if not already present.

const { hasPlugin, addPlugin } = require('ember-cli-babel-plugin-helpers'); // Inside an Ember addon's included hook module.exports = { name: require('./package').name, included(parent) { this._super.included.apply(this, arguments); if (!hasPlugin(parent, '@babel/plugin-proposal-class-properties')) { addPlugin(parent, require.resolve('@babel/plugin-proposal-class-properties')); } } };
Debug
Known issues
gotchaPackage uses CommonJS (require) only; ESM import will throw a runtime error. Do not use import statements.
fix
Replace import { hasPlugin } from 'ember-cli-babel-plugin-helpers' with const { hasPlugin } = require('ember-cli-babel-plugin-helpers')
affects: >=0.0.0
gotchaOn Windows, scoped package names (like @babel/plugin-x) were not correctly normalized before v1.0.2, causing hasPlugin to fail matching.
fix
Upgrade to >=1.0.2 or normalize manually using the package's internal normalization (not exposed).
affects: <1.0.2
gotchaPassing a target that is not an EmberApp, Addon, or array leads to unexpected behavior or errors (e.g., using a plain object without babel property).
fix
Ensure target is either the parent from included(), an array of plugins, or has a babel property with plugins array.
affects: >=0.0.0
breakingRename from ember-cli-babel-plugin-helpers? Not applicable, but note that v1.0.0 introduced TypeScript types; no breaking API changes known.
fix
N/A (no real breaking change documented)
affects: >=0.0.0
gotchaaddPlugin with before/after constraints that conflict with each other or with existing plugin ordering will cause a runtime error (conflict detection is not graceful).
fix
Review existing plugin order; call addPlugin only if constraints can be satisfied, or catch errors.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: (0 , _emberCliBabelPluginHelpers.hasPlugin) is not a function
Using ES module import syntax (import { hasPlugin } from '...') on a CommonJS-only package.
fix
Replace with const { hasPlugin } = require('ember-cli-babel-plugin-helpers') in your code.
Cannot find module 'ember-cli-babel-plugin-helpers'
The package is not installed or is missing from node_modules.
fix
Run npm install ember-cli-babel-plugin-helpers --save-dev (or yarn add --dev) in your Ember addon project.
addPlugin expects pluginConfig to be a string or an array of up to 3 elements
Passing an invalid structure (e.g., an object with name property) as pluginConfig.
fix
Pass a string (plugin name) or an array [name, options?, identifier?] as the second argument.
Assertion Failed: You cannot call ember-cli-babel-plugin-helpers functions on a target that is not an EmberApp, addon, or array
Passing a bare object or other type as the target argument.
fix
Use the parent from the addon's included hook, or pass an explicit array of plugin configurations.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources