Registry / devops / babel-plugin-ember-data-packages-polyfill

babel-plugin-ember-data-packages-polyfill

JSON →
library0.1.2jsnpmunverified

A Babel plugin (v0.1.2) that transforms EmberData Packages API import statements (e.g., `import { attr } from '@ember-data/model'`) back to the legacy `DS.*` syntax for backward compatibility with older EmberData versions. It uses the @ember-data/rfc395-data mapping and is intended for use within Ember CLI apps and addons during the transition to the new packages. The plugin supports both default and named imports and works with Node 6+.

npm install babel-plugin-ember-data-packages-polyfill
INSTALL
IMPORT
SIG · BABEL-PLUGIN-EMBER
B
babel-plugin-ember-data-packages-polyfill
devopsjavascriptv0.1.2
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.

babel-plugin-ember-data-packages-polyfill
// add to .babelrc plugins or ember-cli-build.js plugins
import plugin from 'babel-plugin-ember-data-packages-polyfill'; // This is a Babel plugin, not an importable module
Use as a Babel plugin, not a JavaScript import.

Shows how to add the plugin to Babel config and an example of how imports are transformed.

// In your .babelrc or ember-cli-build.js { "plugins": ["babel-plugin-ember-data-packages-polyfill"] } // Then in your source code, use new packages API: import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; // Will be transpiled to legacy syntax: // import DS from 'ember-data'; // const Model = DS.Model; // const attr = DS.attr; // const belongsTo = DS.belongsTo; // const hasMany = DS.hasMany;
Debug
Known issues
gotchaPlugin requires @ember-data/rfc395-data to be installed as a dependency, otherwise it will fail to find mappings.
fix
Ensure @ember-data/rfc395-data is in your package.json dependencies.
affects: >=0.1.0
gotchaThe plugin only works with import statements; it does not transform dynamic require() calls.
fix
Use static import syntax for EmberData members.
affects: *
deprecatedThis plugin is a transitional polyfill; as EmberData packages become universally supported, the plugin may become unnecessary.
fix
Migrate away from legacy DS syntax entirely when possible.
affects: *
Errors
Common errors & fixes
Cannot find module '@ember-data/rfc395-data'
The dependency @ember-data/rfc395-data is not installed.
fix
npm install --save-dev @ember-data/rfc395-data
Error: Babel plugin throw: Could not find mapping for '@ember-data/model'
The plugin could not map a given import to a legacy path (possibly due to a new package not in the mapping data).
fix
Update @ember-data/rfc395-data to the latest version or add a custom mapping.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
@ember-data/rfc395-datarequiredProvides the official mapping of old import paths to new package names
Agent activity
4 hits · last 30 days
node
4
Resources
babel-plugin-ember-data-packages-polyfill — npm install babel-plugin-ember-data-packages-polyfill · libregistry