Comments (4)
Historically Ember has allowed "modules" to remain un-evaluated until they are synchronously required. That is not possible under true ES modules.
This sounds like a bundler error then, not a spec error so I wouldn't phrase it as "under true ES modules". By spec, a module should not even be loaded until a module which requires it is evaluated, and so a spec compliant bundler would in fact not eagerly evaluate the module unless accessing a specific entry point ultimately led to accessing the file.
As regards EmberData, overall I'm incline to believe we shouldn't do anything different here. We ship native ESM modules and we aren't what is responsible for causing those to be pushed into the build automatically. Transforms get pushed in because our tooling historically assumes that all code in the app directory needs to be pushed in, and because transforms are usually used via ember's resolver and so need to be there synchronously (they don't have to be used that way fwiw).
With this said, if you get this deprecation then almost by definition you should get this deprecation, because even if you don't think you are using these transforms you are and should go ahead and make their inclusion public, else drop ember-data as a dep and consume the individual packages so that they aren't guaranteed to be available to the resolver.
If any files print this that aren't the transforms, I'll reopen this to pursue a pragmatic fix.
from data.
By spec, a module should not even be loaded until a module which requires it is evaluated
Yes, but "requires" is an imprecise word here. What you mean is "imports it", because importing a module is the only legal way to depend on it. And ember-data doesn't ever import the transforms, which is the only reason we're having this discussion.
ember-data is going to do getOwner(this).lookup('transform:boolean')
an expect to synchronously get back the contents of the ES module. That absolutely means that the module must have already been evaluated earlier, because there's no way to synchronously evaluate an ES module that wasn't already evaluated.
from data.
ember-data is going to do getOwner(this).lookup('transform:boolean') an expect to synchronously get back the contents of the ES module
nit: a specific serializer we currently provide does do this though we consider it to be app code if an app makes use of it. Most of the time, it will be app code that does the resolver lookup. EmberData itself makes no use of Ember's resolver outside of adapterFor and serializerFor, both of which are also optional hooks and can be easily implemented to not use the resolver.
from data.
My general takeaway is the transform deprecation printing in this situation is desirable and not spurious, it just alerts the user to a requirement they may not have been paying attention to. If they truly don't want the code, then it might be time to consider bringing less of EmberData :D
from data.
Related Issues (20)
- Attributes with defaultValue functions not persisting HOT 8
- 🛤️ tracking: The Road to Polaris ✨ HOT 3
- Request can't handle `null` as response HOT 3
- Overridden `Model` methods have incorrect `this` type HOT 1
- Custom model instances’ type is not assignable to `Model` HOT 1
- EmberData's native types don't compile with glint HOT 9
- @ember-data/debug/data-adapter.js: Cannot read properties of undefined (reading 'env') HOT 2
- The kind `collection` is missing in schema-record HOT 2
- "Cannot supply a different store via context than was used to create the request" on autorefresh HOT 2
- Error `Cannot read properties of undefined (reading 'env')` after updating to 5.3.4 (extending `@ember-data/store`) HOT 12
- [5.3.4] EmberData deprecation for `ember-inflector` is incorrect HOT 1
- inspector cannot inspect ember-data - ember-data/debug is missing app-reexports HOT 10
- [5.3.7] Issue with use in nested addon HOT 4
- [5.3.7] when using ember-cli-mirage `ember-inflector` must be a installed, otherwise production build is broken HOT 2
- [5.4.0-alpha.91] Incorrect/Missing typings HOT 4
- Error: Could not find module `@ember-data/adapter/rest` HOT 1
- [5.3.4+] `polyfillUUID` isn't anymore working when there was added over `@embroider/macros` option HOT 1
- Descendants of 'Model' cannot be upcast
- 'options' is undefined for 'attr<BooleanTransform>'
- Cannot get the Identifier of the record HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data.