Git Product home page Git Product logo

Comments (10)

giltayar avatar giltayar commented on May 13, 2024 2

FYI: the start of the tweet that @bmeck linked to was mine. In the end, it was a bug on my part and not a problem in the loader interface. I found that I could get rid of the code that read the file explicitly.

from loaders.

GeoffreyBooth avatar GeoffreyBooth commented on May 13, 2024 1

The reason we consolidated the hooks was to enable chaining. I think we need to land chaining first before considering any new hooks, because for any new hooks the question will become how to preserve chaining with the addition of the new hooks.

from loaders.

bmeck avatar bmeck commented on May 13, 2024 1

I'm fine with it being punted, just recording and pointing that this needs to be worked on eventually.

from loaders.

GeoffreyBooth avatar GeoffreyBooth commented on May 13, 2024 1

The design docs are at https://github.com/nodejs/loaders/blob/main/doc/design/overview.md. I think the way forward is for proposals for new hooks to be PRs to add docs here. We've already started this in some of the open PRs. There's a design doc there for chaining, so any new proposed hooks for chaining would need to explain how they'd support chaining along the lines of how the existing hooks will.

If I remember correctly, the issue with many hooks for chaining was that each return value that Node uses (format, source) needs to have only one hook that returns that value. Otherwise it's not clear how to order the loaders.

Say we add back the transformSource hook and it returns source too; how will chaining work between that hook and load? All the load hooks run, then all the transformSource hooks? But we might need transpilation to happen before the final load hook is run, because of some other loader that does something in load that needs to be last, and now we have a transpilation loader not using the transformSource hook that was designed for it.

These are the types of issues that chaining introduces. They're not unsolvable, but this is why I think we need to land chaining first. We can design other hooks now, but their designs should include how they'd address these issues.

from loaders.

GeoffreyBooth avatar GeoffreyBooth commented on May 13, 2024

Yeah absolutely. I think for now the solution that I feel confident about is utility functions. If you want to propose new hooks that still can work with our current design for chaining, that can work too.

from loaders.

DerekNonGeneric avatar DerekNonGeneric commented on May 13, 2024

@GeoffreyBooth, I am not confident that your idea about chaining is solid, and it still has not been presented, so please try not to make your proposed chaining a constraint for future developments on loaders and the module system in general. There seem to be quite a few things that we have overlooked, seeing as how we still don't have fetch in core, and that is actually very relevant, but I digress.

from loaders.

GeoffreyBooth avatar GeoffreyBooth commented on May 13, 2024

The plan for chaining was presented and discussed in this week's meeting, and the design doc is merged in and linked from this repo's readme. We've been discussing chaining all year; it was the reason @JakobJingleheimer spent months on the consolidation PR.

I don't see any issues presented in that Twitter thread. It was known that moving getSource and transformSource within load would mean more boilerplate for folks writing load hooks. I was the one who created transformSource for just that reason, to avoid boilerplate. But chaining is a higher priority, and we'll have to find other ways to avoid boilerplate. Utility functions are one way, and if there's a way to do more hooks without breaking the use cases people want chaining for, then that would be fine too.

from loaders.

DerekNonGeneric avatar DerekNonGeneric commented on May 13, 2024

[…] it was the reason @JakobJingleheimer spent months on the consolidation PR.

The reason for the consolidation was because the way we had the hooks before was illogical.

That hook consolidation also did not have my approval nor any sort of consensus-agreement w/ the team.

Just because you stream a video to youtube doesn't mean that the relevant core team members are tuned in.

from loaders.

DerekNonGeneric avatar DerekNonGeneric commented on May 13, 2024

from loaders.

arcanis avatar arcanis commented on May 13, 2024

Fwiw, I find it difficult to weight on the chaining design if fs hooks aren't included. The util approach @GeoffreyBooth has in mind doesn't strike me as convincing (I mentioned it at least here), but if it's out of scope for these discussions then I'm worried it will be too late later (the hook consolidation is already used as a supporting reason why fs hooks would be best avoided, even if perhaps they'd have been considered if discussed in the previous iteration).

from loaders.

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.