# babel-plugin-ember-data-packages-polyfill

> Polyfill for EmberData Packages API.

Latest version **0.1.2** (published 2020-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-ember-data-packages-polyfill
pnpm add babel-plugin-ember-data-packages-polyfill
yarn add babel-plugin-ember-data-packages-polyfill
bun add babel-plugin-ember-data-packages-polyfill
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-02-12 |
| First published | 2020-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 6.* \|\| 8.* \|\| 10.* \|\| >= 12.* |
| Dependencies | 1 |
| Unpacked size | 30.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Chris Thoburn |
| Maintainers | runspired |
| Keywords | babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-ember-data-packages-polyfill
- Repository: https://github.com/ember-data/babel-plugin-ember-data-packages-polyfill
- Homepage: https://github.com/ember-data/babel-plugin-ember-data-packages-polyfill#readme
- Issues: https://github.com/ember-data/babel-plugin-ember-packages-polyfill/issues
- npm.io page: https://npm.io/package/babel-plugin-ember-data-packages-polyfill

## Dependencies (1)

- [@ember-data/rfc395-data](https://npm.io/package/@ember-data/rfc395-data.md) ^0.0.4

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2020-02-12
- 0.1.1 — 2020-02-04
- 0.1.0 — 2020-01-15

## README

# babel-plugin-ember-data-packages-polyfill

[![Greenkeeper badge](https://badges.greenkeeper.io/ember-data/babel-plugin-ember-data-packages-polyfill.svg)](https://greenkeeper.io/)

> This plugin transforms [Packages API](https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md)
> import statements back to the legacy "DS" EmberData import syntax

## Example

```js
import Model, { attr, belongsTo, hasMany } from "@ember-data/model"
```
back to the legacy
```js
import DS from 'ember-data';
const Model = DS.Model;
const attr = DS.attr;
const belongsTo = DS.belongsTo;
const hasMany = DS.hasMany;
```

## Installation

`npm install --save babel-plugin-ember-data-packages-polyfill`

## Why

This plugin provides an API polyfill to allow ember addon and app authors to adopt the
[Packages API](https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md)
whilst still maintaining backwards compatibility with older versions of EmberData 
that do not support this API.

The intention of this Babel Plugin is to also allow for a transition period and allow
applications to exist in a mixed state whilst transitioning from the old imports to the
new imports.

It also allows addons that only need to use a small amount of EmberData to do so while
still supporting applications using all of EmberData.

# How

Using the [@ember-data/rfc395-data](https://github.com/ember-data/ember-data-rfc395-data)
package, that contains the official mapping of old imports to new package imports, addons
that adopt the new package imports can be transpiled back to the legacy format if 
`ember-cli-babel` detects  that the host application ember version does not support the
new modules API.

The plugin supports both default `import Model from "@ember-data/model"` and named
`import { attr } from "@ember-data/model"` import statements, converting their syntax back
to separate `const` variables within the source file. This transpilation is done at 
compile time by EmberCLI using `ember-cli-babel`.

In order for ember addon developers to adopt this new API syntax, they must declare a 
dependency on `ember-cli-babel:v7.14.0` or above in their `package.json`:

```json
{
  "dependencies": {
    "ember-cli-babel": "^7.14.0"
  }
}
```

---
_Source: https://npm.io/package/babel-plugin-ember-data-packages-polyfill · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
