Closed gossi closed 10 months ago
For exploratory reasons,
Does this all get resolved if you change your test-app's package.json to specify:
"dependenciesMeta": {
"ember-ability": {
"injected": true
}
},
and then pnpm build
, pnpm i -f
?
Potentially related:
Yeah, that does 🙈
Using your pnpm-sync-dependencies-meta-injected
in the test-app does the job. I gonna re-trigger CI, then we should see it.
That solved all of the CI problems 😀 Thank you very much. Can close this issue.
I'm working on
ember-ability
which has apeerDependency
toember-resources
. In my test-matrix the tests fail, because@ember/owner
cannot be found for ember versions< 4.12
. The PR in question: gossi/ember-ability#12In more detailed steps:
The little code for
ember-ability
is a fairly tiny, 27loc.The complete error message:
Which kept me wondering, since
ember-ability
has no direct dependency to@ember/owner
. I traced it down and apparentlyember-resources
does have a dependency to@ember/owner
in: https://github.com/NullVoxPopuli/ember-resources/blob/c4948618dfc94b81ed4c68dcbf27e322d0371d2c/ember-resources/src/core/function-based/immediate-invocation.ts#L24-L32 but this is behind a condition using macros:I did enable
forbidEval: true
inember-auto-import
for leaner output and found this:which later on is transformed into a
require()
statement (as far as understood) - yet none of the dependencies is actually used in thefunction()
call.Since, these are none of the dependencies that
ember-ability
uses directly, those are the transitive dependencies, too. This brings me back to the code fromember-resources
above, which has animportSync()
to both@ember/owner
and@ember/application
, which is why I think BOTH OF THEM are in the list of deps.If I'm not mistaken, this code finds them: https://github.com/embroider-build/ember-auto-import/blob/843ed86e7fc61c5c29c012738b905a551cb4d49a/packages/ember-auto-import/ts/analyzer-plugin.ts#L46-L67
Thus the analyzer finds imports based on symbols, but is not evaluating the code here. The
macroCondition(dependencySatisfies('ember-source', '>=4.12.0'))
expression is not evaluated and such a dependency, in this case@ember/owner
, is added as dependency, which in reality isn't.Which I think is the root cause for why my build is failing.