adopted-ember-addons / adopted-ember-addons/ember-cp-validations

Embroider: Use of ember internals

未關閉
#739 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
embroider
主要語言
JavaScript
星號
439
分支
172
PR 合併指標
30 天內沒有已合併 PR

描述

This topic got raise by @Pixelik in https://github.com/adopted-ember-addons/ember-cp-validations/issues/733. I did some digging but figured I don't have enough knowledge about embroider. So all help is appreciated!

In an efford to have all the findings in one place, here is what I found:

The [genesis](https://github.com/adopted-ember-addons/ember-cp-validations/commits/master/addon/-private/ember-internals.js) of `addon/-private/ember-internals.js`:
- https://github.com/adopted-ember-addons/ember-cp-validations/pull/641 added the code to make it work for ember >= 3.10
- https://github.com/adopted-ember-addons/ember-cp-validations/pull/668 made it work for ember >= 3.13
- https://github.com/adopted-ember-addons/ember-cp-validations/pull/717/commits/89d83078741766106a82d754e4b50bb72d02f8f1 I changed it to `import __EMBER_METAL__ from '@ember/-internals/metal/index';`

So I have two assumptions:
1. The internal import does not work for Embroider
2. The internal import is stable since ember 3.13 and we no longer need the fallback implementations

Now my question is, how do we get the import embroider safe or even better remove it altogether? I found:
- https://github.com/qonto/ember-cp-validations/pull/20

We already borrowed a lot of the changes in the qonto fork so if this solution is still recommended by the embroider team I would say we use `require` and refactor the internals like I proposed here: https://github.com/adopted-ember-addons/ember-cp-validations/pull/735#issuecomment-1779742888 (maybe we don't even need the fix from @Pixelik)

The same goes for `import { meta } from '@ember/-internals/meta';`

//cc @ef4 @gilest

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。