npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sourcemap-locator

v2.1.3

Published

From a browser, finds the sourcemap url or the sourcemap file itself, given the URL (or source) of the original source file.

Downloads

4

Readme

sourcemap-locator

From a browser, finds the sourcemap url or the sourcemap file itself, given the URL (or source) of the original source file. Uses async-futures.

Example

findSourcemap.fromUrl('originalSourceFile.js').then(function(sourcemapUrl) {
    // do something with the sourcemapUrl
}).done()

Install

npm install sourcemap-locator

Usage

var findSourcemap = require('sourcemap-locator') // use webpack (recommended) or browserify

These return a future of the sourcemap URL, or future undefined if it isn't found:

findSourcemap.fromUrl(originalSourceUrl)
findSourcemap.fromSource(originalSourceText) // works in node.js (the other ones don't)

These return a future of the text of the sourcemap file, or future undefined if it isn't found:

findSourcemap.fromUrl(originalSourceUrl, true)
findSourcemap.fromSource(originalSourceUrl, true)

These override cache maintainance functions if you have a separate cache of file sources

findSourcemap.cacheGet(function(url) {
   // get the url from your own cache
})
findSourcemap.cacheSet(function(url, futureResponse) {
   // set the content downloaded from a url for your own cache using futureResponse
})

Browser Support

Tested in the following browsers:

  • Chrome 31
  • Firefox 26
  • IE 10

How to Contribute!

Anything helps:

  • Creating issues (aka tickets/bugs/etc). Please feel free to use issues to report bugs, request features, and discuss changes.
  • Updating the documentation: ie this readme file. Be bold! Help create amazing documentation!
  • Submitting pull requests.

How to submit pull requests:

  1. Please create an issue and get my input before spending too much time creating a feature. Work with me to ensure your feature or addition is optimal and fits with the purpose of the project.
  2. Fork the repository
  3. clone your forked repo onto your machine and run npm install at its root
  4. If you're gonna work on multiple separate things, its best to create a separate branch for each of them
  5. edit!
  6. If it's a code change, please add to the unit tests (in the 'test/' folder) to verify that your change works
  • Browser tests need to have the test package built and test server running - run test/buildAndServe.js to do this
  1. When you're done, run the unit tests and ensure they all pass
  2. Commit and push your changes
  3. Submit a pull request: https://help.github.com/articles/creating-a-pull-request

Change Log

  • 2.1.3 - updating ajax
  • 2.1.2 - updating async-future
  • 2.1.1 - supporting data urls
  • 2.1.0 - properly handling files that don't have a sourcemap (duh)
  • 2.0.0 - changing to asynchronous file loading
  • 1.0.0 - first release

License

Released under the MIT license: http://opensource.org/licenses/MIT