Comments (10)
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.
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.
I'm fine with it being punted, just recording and pointing that this needs to be worked on eventually.
from loaders.
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.
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.
@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.
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.
[…] 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.
- https://www.w3.org/TR/webarch/#def-coneg
- https://www.w3.org/2001/tag/issues.html#contentTypeOverride-24
from loaders.
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)
- Import Maps Implementation Plan HOT 5
- Node.js Loaders Team Meeting 2023-11-07 HOT 5
- Loaders allow breaking JS spec invariants HOT 16
- Official `fs` overlay HOT 3
- Node.js Loaders Team Meeting 2023-11-21
- bug: CJS exports analysis reads directly from disk HOT 7
- Node.js Loaders Team Meeting 2023-12-05 HOT 9
- Node.js Loaders Team Meeting 2023-12-19
- Bad coverage information when loaders are used
- Node.js Loaders Team Meeting 2024-01-02
- Node.js Loaders Team Meeting 2024-01-16 HOT 2
- improve registration HOT 2
- Node.js Loaders Team Meeting 2024-01-30 HOT 3
- --experimental-loader breaks in Node 18.19 HOT 5
- Node.js Loaders Team Meeting 2024-02-13 HOT 1
- Node.js Loaders Team Meeting 2024-02-27 HOT 2
- Node.js Loaders Team Meeting 2024-03-12 HOT 1
- Node.js Loaders Team Meeting 2024-03-26 HOT 1
- Node.js Loaders Team Meeting 2024-04-09 HOT 15
- Node.js Loaders Team Meeting 2024-04-13
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 loaders.