GithubHelp home page GithubHelp logo

Comments (4)

runspired avatar runspired commented on July 28, 2024

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.

ef4 avatar ef4 commented on July 28, 2024

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.

runspired avatar runspired commented on July 28, 2024

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.

runspired avatar runspired commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.