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, isPresent: Ember.isPresent,
}, },
rsvp: { 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, default: Ember.RSVP,
Promise: Ember.RSVP.Promise, Promise: Ember.RSVP.Promise,
hash: Ember.RSVP.hash, EventTarget: Ember.RSVP.EventTarget,
all: Ember.RSVP.all,
}, },
"@ember/string": { "@ember/string": {
w: Ember.String.w,
dasherize: Ember.String.dasherize, dasherize: Ember.String.dasherize,
decamelize: Ember.String.decamelize,
camelize: Ember.String.camelize,
classify: Ember.String.classify, classify: Ember.String.classify,
underscore: Ember.String.underscore, underscore: Ember.String.underscore,
camelize: Ember.String.camelize, capitalize: Ember.String.capitalize,
}, },
"@ember/template": { "@ember/template": {
htmlSafe: Ember.String.htmlSafe, htmlSafe: Ember.String.htmlSafe,

View File

@ -2,6 +2,11 @@
// TODO: These are needed to load plugins because @ember has its own loader. // TODO: These are needed to load plugins because @ember has its own loader.
// We should find a nicer way to do this. // We should find a nicer way to do this.
const EMBER_MODULES = { const EMBER_MODULES = {
"@ember/application": {
default: Ember.Application,
setOwner: Ember.setOwner,
getOwner: Ember.getOwner,
},
"@ember/array": { "@ember/array": {
default: Ember.Array, default: Ember.Array,
A: Ember.A, A: Ember.A,
@ -13,6 +18,15 @@
"@ember/component": { "@ember/component": {
default: 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": { "@ember/controller": {
default: Ember.Controller, default: Ember.Controller,
inject: Ember.inject.controller, inject: Ember.inject.controller,
@ -20,6 +34,9 @@
"@ember/debug": { "@ember/debug": {
warn: Ember.warn, warn: Ember.warn,
}, },
"@ember/error": {
default: Ember.error,
},
"@ember/object": { "@ember/object": {
action: Ember._action, action: Ember._action,
default: Ember.Object, default: Ember.Object,
@ -64,6 +81,9 @@
uniq: Ember.computed.uniq, uniq: Ember.computed.uniq,
uniqBy: Ember.computed.uniqBy, uniqBy: Ember.computed.uniqBy,
}, },
"@ember/object/internals": {
guidFor: Ember.guidFor,
},
"@ember/object/mixin": { default: Ember.Mixin }, "@ember/object/mixin": { default: Ember.Mixin },
"@ember/object/proxy": { default: Ember.ObjectProxy }, "@ember/object/proxy": { default: Ember.ObjectProxy },
"@ember/object/promise-proxy-mixin": { default: Ember.PromiseProxyMixin }, "@ember/object/promise-proxy-mixin": { default: Ember.PromiseProxyMixin },
@ -89,6 +109,15 @@
default: Ember.Service, default: Ember.Service,
inject: Ember.inject.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": { "@ember/template": {
htmlSafe: Ember.String.htmlSafe, htmlSafe: Ember.String.htmlSafe,
}, },
@ -98,6 +127,25 @@
isNone: Ember.isNone, isNone: Ember.isNone,
isPresent: Ember.isPresent, 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) => { Object.keys(EMBER_MODULES).forEach((mod) => {
define(mod, () => EMBER_MODULES[mod]); define(mod, () => EMBER_MODULES[mod]);