Registry / testing / ember-compatibility-helpers

ember-compatibility-helpers

JSON →
library1.2.7jsnpmunverified

Provides build-time flags and version helpers for Ember addon authors to write backwards/forward compatible code. Current stable version: 1.2.7. Release cadence: infrequent, primarily maintenance. Key differentiators: zero-cost via Babel transform and dead code elimination; runtime has no overhead as flags are replaced with booleans at build time.

npm install ember-compatibility-helpers
INSTALL
IMPORT
SIG · EMBER-COMPATIBILIT
E
ember-compatibility-helpers
testingjavascriptv1.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

gte
✓ import { gte } from 'ember-compatibility-helpers'
✗ import gte from 'ember-compatibility-helpers'
gte is a named export, not default.
lte
✓ import { lte } from 'ember-compatibility-helpers'
✗ const lte = require('ember-compatibility-helpers').lte
CommonJS require works but ESM is recommended in Ember apps.
HAS_UNDERSCORE_ACTIONS
✓ import { HAS_UNDERSCORE_ACTIONS } from 'ember-compatibility-helpers'
✗ import HAS_UNDERSCORE_ACTIONS from 'ember-compatibility-helpers'
Flag is a named export; do not use default import.
SUPPORTS_NEW_COMPUTED
✓ import { SUPPORTS_NEW_COMPUTED } from 'ember-compatibility-helpers'
Named export. No common wrong pattern other than thinking it's a default export.

Shows usage of SUPPORTS_NEW_COMPUTED flag to conditionally use new computed syntax vs old getter/setter pattern.

// install: ember install ember-compatibility-helpers import Component from '@ember/component'; import { computed } from '@ember/object'; import { SUPPORTS_NEW_COMPUTED } from 'ember-compatibility-helpers'; function fooMacro() { if (SUPPORTS_NEW_COMPUTED) { return computed({ get() { return this.get('foo'); }, set(key, value) { this.set('foo', value); return value; } }); } else { return computed(function(key, value) { if (arguments.length === 2) { this.set('foo', value); return value; } return this.get('foo'); }); } } export default Component.extend({ bar: fooMacro() });
Debug
Known issues
gotchaVersion strings passed to gte/lte must be fully qualified (e.g., '3.13.0-beta.1'), not ranges or shorthands like '3.12' or '^3.12.0'.
fix
Use exact versions: gte('3.13.0') instead of gte('3.13').
affects: >=1.0.0
gotchaFlags are replaced at build time; they cannot be used in runtime dynamic checks (e.g., if (someCondition && SUPPORTS_NEW_COMPUTED) will work only if someCondition is also compile-time constant).
fix
Ensure flags are used in statically analyzable conditional blocks.
affects: >=1.0.0
deprecatedThis addon is in maintenance mode; newer Ember versions may require alternative approaches like @ember/optional-features or polyfills.
fix
Consider using @ember/optional-features or checking ember-source version in package.json.
affects: >=1.2.7
gotchaThe addon only supports Ember versions that are still receiving security patches; very old Ember versions may not be targeted.
fix
Update Ember to a supported LTS version or use a fork.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'ember-compatibility-helpers' or its corresponding type declarations.
TypeScript type definitions are not provided.
fix
Use // @ts-ignore or create a declaration file: declare module 'ember-compatibility-helpers';
Module not found: Error: Can't resolve 'ember-compatibility-helpers' in 'path/to/app'
Addon not installed or not included in the consuming app's package.json.
fix
Run 'ember install ember-compatibility-helpers' to add it to devDependencies.
Upgrade
Version history
1.2.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
ember-compatibility-helpers — npm install ember-compatibility-helpers · libregistry