DEV: Add more @ember modules for plugins compatibility with Ember CLI (#11972)

Some plugins (like discourse-calendar) import things from `@ember/string` and `rsvp`, so we need to add them in order for the plugins to work with Ember CLI.
This commit is contained in:
Osama Sayegh 2021-02-04 16:26:06 +03:00 committed by GitHub
parent 309adb82ba
commit b580e3e657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 3 deletions

View File

@ -112,16 +112,31 @@ var define, requirejs;
isPresent: Ember.isPresent,
},
rsvp: {
asap: Ember.RSVP.asap,
all: Ember.RSVP.all,
allSettled: Ember.RSVP.allSettled,
race: Ember.RSVP.race,
hash: Ember.RSVP.hash,
hashSettled: Ember.RSVP.hashSettled,
rethrow: Ember.RSVP.rethrow,
defer: Ember.RSVP.defer,
denodeify: Ember.RSVP.denodeify,
resolve: Ember.RSVP.resolve,
reject: Ember.RSVP.reject,
map: Ember.RSVP.map,
filter: Ember.RSVP.filter,
default: Ember.RSVP,
Promise: Ember.RSVP.Promise,
hash: Ember.RSVP.hash,
all: Ember.RSVP.all,
EventTarget: Ember.RSVP.EventTarget,
},
"@ember/string": {
w: Ember.String.w,
dasherize: Ember.String.dasherize,
decamelize: Ember.String.decamelize,
camelize: Ember.String.camelize,
classify: Ember.String.classify,
underscore: Ember.String.underscore,
camelize: Ember.String.camelize,
capitalize: Ember.String.capitalize,
},
"@ember/template": {
htmlSafe: Ember.String.htmlSafe,

View File

@ -2,6 +2,11 @@
// TODO: These are needed to load plugins because @ember has its own loader.
// We should find a nicer way to do this.
const EMBER_MODULES = {
"@ember/application": {
default: Ember.Application,
setOwner: Ember.setOwner,
getOwner: Ember.getOwner,
},
"@ember/array": {
default: Ember.Array,
A: Ember.A,
@ -13,6 +18,15 @@
"@ember/component": {
default: Ember.Component,
},
"@ember/component/helper": {
default: Ember.Helper,
},
"@ember/component/text-field": {
default: Ember.TextField,
},
"@ember/component/text-area": {
default: Ember.TextArea,
},
"@ember/controller": {
default: Ember.Controller,
inject: Ember.inject.controller,
@ -20,6 +34,9 @@
"@ember/debug": {
warn: Ember.warn,
},
"@ember/error": {
default: Ember.error,
},
"@ember/object": {
action: Ember._action,
default: Ember.Object,
@ -64,6 +81,9 @@
uniq: Ember.computed.uniq,
uniqBy: Ember.computed.uniqBy,
},
"@ember/object/internals": {
guidFor: Ember.guidFor,
},
"@ember/object/mixin": { default: Ember.Mixin },
"@ember/object/proxy": { default: Ember.ObjectProxy },
"@ember/object/promise-proxy-mixin": { default: Ember.PromiseProxyMixin },
@ -89,6 +109,15 @@
default: Ember.Service,
inject: Ember.inject.service,
},
"@ember/string": {
w: Ember.String.w,
dasherize: Ember.String.dasherize,
decamelize: Ember.String.decamelize,
camelize: Ember.String.camelize,
classify: Ember.String.classify,
underscore: Ember.String.underscore,
capitalize: Ember.String.capitalize,
},
"@ember/template": {
htmlSafe: Ember.String.htmlSafe,
},
@ -98,6 +127,25 @@
isNone: Ember.isNone,
isPresent: Ember.isPresent,
},
jquery: { default: $ },
rsvp: {
asap: Ember.RSVP.asap,
all: Ember.RSVP.all,
allSettled: Ember.RSVP.allSettled,
race: Ember.RSVP.race,
hash: Ember.RSVP.hash,
hashSettled: Ember.RSVP.hashSettled,
rethrow: Ember.RSVP.rethrow,
defer: Ember.RSVP.defer,
denodeify: Ember.RSVP.denodeify,
resolve: Ember.RSVP.resolve,
reject: Ember.RSVP.reject,
map: Ember.RSVP.map,
filter: Ember.RSVP.filter,
default: Ember.RSVP,
Promise: Ember.RSVP.Promise,
EventTarget: Ember.RSVP.EventTarget,
},
};
Object.keys(EMBER_MODULES).forEach((mod) => {
define(mod, () => EMBER_MODULES[mod]);