Embroider: Use of ember-data internals
fsmanuel opened this issue · comments
Similar to #739 we use ember-data internals to detect if ember-data is installed and if it's a DS.Model
, DS.ManyArray
, or DS.PromiseManyArray
.
function requireModule(module, exportName = 'default') {
if (require.has(module)) {
return require(module)[exportName];
}
}
const DS = requireModule('ember-data');
export function isDsModel(o) {
return !!(DS && o && o instanceof DS.Model);
}
export function isDSManyArray(o) {
return !!(
DS &&
o &&
isArray(o) &&
(o instanceof DS.PromiseManyArray || o instanceof DS.ManyArray)
);
}
I wonder how long the ember-data
import will be arround and if @ember-data/model/-private
could be an embroider safe alternative.
const Model = requireModule('@ember-data/model');
const { ManyArray, PromiseManyArray } = requireModule('@ember-data/model/-private');
//cc @runspired @ef4 @gilest
isDSManyArray
should just go away.