-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify sourcemaps before publishing #372
Comments
Would be as easy as creating a package I don't think this belongs to something like |
Perhaps this should live in |
The only problem with an opt-in solution is that most library authors probably don't know that checking sourcemaps is a thing they need to do. Having an opt-out solution would be more helpful for the ecosystem IMHO. But a
Even though they're code-related, the root cause is almost always NPM configuration: either a bad @sholladay - Looking at the list of plugins for clinton, I agree that checking sourcemaps seems to fit in with other "is my package.json correct?" checks that clinton already has. BTW, I didn't know about clinton before-- thanks for pointing me at it. Looks like a useful tool! |
I also have a somewhat similar project named mop. Whereas |
I think this falls into #82, which also unfortunately hasn't received much interest. A sourcemap checker would not only have to check explicit files listed in package.json, but also scan every JS file and find their matching source map. Sounds too specific to be part of np before a tool like that even exists on its own. |
Description
np
should warn users when they try to publish a sourcemap that points to source files that don't exist in the package being published.Is the feature request related to a problem?
Lately I've been wasting a lot of time chasing down libraries that publish broken sourcemaps to npm, where "broken" means that the sourcemap's
sources
array includes paths to source files that are either not published or are published to different locations than what's specified in the sourcemap. There are two basic cases:npm install
that they did at build time. More details: map.sources converted to absolute paths + other changes webpack-contrib/source-map-loader#75 (comment)It would be very helpful for the ecosystem if publishing tools like np showed warnings if a sourcemap points to non-existent files.
Possible solution
A solution could be something like this:
npm pack
to generate the tarball that would be publishedsources
array from each sourcemapsources
, verify that that path (usually a relative path) is present in the packageWARN: sourcemap ${sourcemap file} references ${filePath} which does not exist. Please publish source folders for debugging!
Alternatives
npm publish
to add this warning instead, which I think is the right long-term solution, but it might be helpful to first get it into a faster-evolving tool likenp
.The text was updated successfully, but these errors were encountered: