Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-ember-modules-api-polyfill

ember-cli1.5mMIT3.5.0

Polyfill for Ember JS API.

babel-plugin

readme

babel-plugin-ember-modules-api-polyfill

This plugin transforms JavaScript modules API import statements back to the legacy "global" ember object syntax

Example

import { inject } from "@ember/service"

back to the legacy

const inject = Ember.inject.service

Installation

npm install --save babel-plugin-ember-modules-api-polyfill

Why

This plugin provides an API polyfill to allow ember addon authors to adopt the new JavaScript modules API whilst still maintaining backwards compatibility with older versions of Ember that do not support the new modules 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 "global" ember object pattern, into the new modular pattern.

How

Using the ember-rfc176-data package, that contains the official mapping of old global object names to the new JS modules API import statements, addons that adopt the new API can be transpiled back to the legacy format if Ember-CLI detects that the host application ember version does not support the new modules API.

The plugin supports both default import Component from "@ember/component" and named import { inject } from "@ember/service" import statements, converting their syntax back to separate const variables within the source file. This transpilation is done at compile time by Ember CLI.

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

{
  "dependencies": {
    "ember-cli-babel": "^6.6.0"
  }
}

changelog

v3.5.0 (2021-03-17)

:rocket: Enhancement

Committers: 1

v3.4.0 (2021-02-24)

:rocket: Enhancement

Committers: 1

v3.3.0 (2021-02-16)

:rocket: Enhancement

  • #175 Add useEmberModule option to force ember module usage (to avoid global window.Ember deprecation on Ember 3.27+). (@NullVoxPopuli)

Committers: 1

v3.2.2 (2021-02-11)

:bug: Bug Fix

  • #156 Fix "container is falsey" error when using code coverage (@mdeanjones)

Committers: 1

v3.2.1 (2021-01-15)

:bug: Bug Fix

  • #170 Ensure decorators are transpiled properly when the decorator identifier is aliased within the decorated method (@dwickern)

:house: Internal

Committers: 3

v3.2.0 (2020-10-02)

:rocket: Enhancement

  • #141 Update ember-rfc176-data to add Helper Manager APIs. (@rwjblue)

Committers: 1

v3.1.1 (2020-07-31)

:bug: Bug fix

  • Update ember-rfc176-data to ensure destroy is provided by @ember/destroyable

v3.1.0 (2020-07-31)

:rocket: Enhancement

  • #125 Update ember-rfc176-data to add @ember/destroyable API (@rwjblue)

Committers: 1

v3.0.0 (2020-07-27)

:boom: Breaking Change

Committers: 1

v2.13.4 (2020-06-02)

:bug: Bug Fix

  • #116 Ensure generated global MemberExpressions are not shared (@rwjblue)

Committers: 1

v2.13.3 (2020-05-29)

:bug: Bug Fix

  • #111 Properly transpile (emberImportedThing as any)() (@rwjblue)

Committers: 1

v2.13.2 (2020-05-29)

:bug: Bug Fix

  • #110 Avoid errors when replacing Ember modules imports that are used as both a type and a value (@fivetanley)

Committers: 1

v2.13.1 (2020-05-29)

:bug: Bug Fix

  • #109 Ensure identifiers are properly re-written. (@rwjblue)

:house: Internal

Committers: 1

v2.13.0 (2020-05-19)

:rocket: Enhancement

  • #101 Add support for import { createCache, getValue, isConst } from '@glimmer/tracking/primitives/cache' (@rwjblue)

Committers: 1

v2.12.0 (2019-08-28)

:rocket: Enhancement

  • #66 Add support for import { dependentKeyCompat } from '@ember/object/compat' (@rwjblue)

Committers: 1

v2.11.0 (2019-08-16)

:rocket: Enhancement

  • #63 Update ember-rfc176-data to get modifier manager capabilities. (@rwjblue)

Committers: 1

v2.10.0 (2019-08-12)

:rocket: Enhancement

  • #62 Update ember-rfc176-data to 0.3.10 for colocation support. (@rwjblue)

Committers: 2

Changelog

v2.9.0 (2019-04-12)

:rocket: Enhancement

  • #59 Update rfc176-data to add setModifierManager API (@jordpo)

Committers: 1

v2.8.0 (2019-03-14)

:rocket: Enhancement

Committers: 1

v2.7.0 (2019-02-22)

:rocket: Enhancement

Committers: 1

v2.6.0 (2018-12-12)

:rocket: Enhancement

Committers: 3

v2.5.0 (2018-09-12)

:rocket: Enhancement

  • Update minimum version of ember-rfc176-data to 0.3.5 (@rwjblue)

Committers: 1

v2.4.0 (2018-09-12)

:rocket: Enhancement

  • Update minimum version of ember-rfc176-data to 0.3.4 (@rwjblue)

Committers: 1

v2.3.2 (2018-06-18)

:bug: Bug Fix

Committers: 1

v2.3.1 (2018-06-17)

:bug: Bug Fix

Committers: 1

v2.2.1 (2017-11-06)

:bug: Bug Fix

Committers: 1

v2.2.0 (2017-10-27)

:bug: Bug Fix

  • #31 Allow export { computed } from '@ember/object' to work. (@Turbo87)
  • #30 Fix confusing "missing import" warning. (@Turbo87)

Committers: 1

v2.1.0 (2017-10-03)

:rocket: Enhancement

Committers: 1

v2.0.1 (2017-08-29)

:bug: Bug Fix

:memo: Documentation

:house: Internal

Committers: 3

v2.0.0 (2017-08-22)

:rocket: Enhancement

  • #21 Reverts polyfillEmberString option. (@locks)

Committers: 1

v1.6.0 (2017-08-17)

:rocket: Enhancement

  • #17 Make the plugin @ember/string aware. (@locks)

:memo: Documentation

Committers: 2

v1.5.1 (2017-08-15)

:bug: Bug Fix

  • #19 Ensure that side-effect imports are not removed.. (@rwjblue)

Committers: 1

v1.5.0 (2017-08-15)

:rocket: Enhancement

  • #18 Add transpile support for 'ember' module. (@mixonic)

:memo: Documentation

Committers: 2

v1.4.2 (2017-07-06)

:bug: Bug Fix

Committers: 1

v1.4.1 (2017-07-04)

:rocket: Enhancement

  • #11 Ensure no errors are thrown when blacklist option is present but import is missing.. (@rwjblue)

Committers: 1

v1.4.0 (2017-07-03)

:rocket: Enhancement

  • #10 Add support for a per-export blacklist.. (@rwjblue)

Committers: 1

v1.3.0 (2017-07-03)

:rocket: Enhancement

  • #9 Allow blacklisting specific modules from being replaced.. (@rwjblue)

Committers: 1

v1.2.0 (2017-07-02)

:rocket: Enhancement

  • #8 Avoid throwing errors for unknown modules.. (@rwjblue)
  • #7 Allow caching with broccoli-babel-transpiler.. (@rwjblue)

Committers: 1

v1.1.0 (2017-07-02)

:rocket: Enhancement

  • #6 Make work with jquery and rsvp modules.. (@rwjblue)
  • #5 Replace "ember-modules-codemod" with "ember-rfc176-data" package. (@Turbo87)

Committers: 2