Want help on maintenance?
pi0 opened this issue · 4 comments
Hi dear @wooorm and thanks for your nice package ❤️
We have adopted import-meta-resolve
(inline for packaging issues) for unjs/mlly that is used by nuxt and some other libs with over 1.5M monthly downloads.
I have discovered there are some upstream fixes in Node.js that need to be applied to both packages (here is a summary: unjs/mlly#134). I thought it would be a good chance to move import-meta-resolve to unjs ecosystem to make sure both packages leverage from latest updates and also allowing to use it as external package for mlly.
If you prefer not to, i will remember to make a backport PR for upstream changes.
Cheers.
Hi there Pooya!
All of those patches you list are already in this project, I just checked and there were only 3 commits of note in the last 2 months, that are only refactoring some internals around and changing an error message: 05c1bea.
If those earlier commits are not in your package, I recommend improving your inlining script to pull in changes from this repo. Something like this in a build script:
npx esbuild import-meta-resolve --bundle --platform=node --outfile=vendor/import-meta-resolve.js
Some of the commits you refer to work on experimental features, such as importing from HTTPS, which then requires features to “allowlist” domains and SHA checking of resources and such. Such code is not implemented here: a) that’s a ton of code, b) it’s super volatile and buggy, c) it changes so much.
So I don’t see a problem with how this project is maintained. I don’t see a reason to move it somewhere else. Though, of course, you are welcome to help maintain this project. I timed myself and it took me 20 minutes to check and port all changes.
Thanks so much for working on patches dear @wooorm ❤️ If this package could export dual cjs/mjs build i would directly use it. mlly can be require
ed too. So in the meantime will manually make sure to keep it updated.
I am not interested in shipping CJS.
It is possible to use a dynamic import expression in CJS. As resolve
is async anyway, you could use. This should be fine, because this package is Node.js-specific anyway, and modules are cached:
/**
* @param {string} specifier
* @param {string} url
* @returns {Promise<string>}
*/
async function mllyResolve(specifier, url) {
return import('import-meta-resolve').then((mod) =>
mod.resolve(specifier, url)
)
}
Yes, I'm aware of this possibility but the current version of mlly, also exports sync resolve methods for backward compatibility (undocumented). I am going to inline node dependency on the build to avoid copying the source for now (unjs/mlly@41a5ba1). Maybe later drop sync and do this. Thanks!