GithubHelp home page GithubHelp logo

fivetanley / babel-plugin-ember-modules-api-polyfill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ember-cli/babel-plugin-ember-modules-api-polyfill

0.0 2.0 0.0 580 KB

Polyfill for Ember JS API

License: MIT License

JavaScript 100.00%

babel-plugin-ember-modules-api-polyfill's Introduction

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"
  }
}

babel-plugin-ember-modules-api-polyfill's People

Contributors

cibernox avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar ef4 avatar greenkeeper[bot] avatar john-griffin avatar jordpo avatar locks avatar mixonic avatar oligriffiths avatar rwjblue avatar serabe avatar stefanpenner avatar thomascchen avatar turbo87 avatar xcambar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.