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

source-map-fixtures

v2.1.0

Published

Simple test fixtures backed by inline source maps and source map files

Downloads

107

Readme

source-map-fixtures

Simple test fixtures backed by inline source maps and source map files. Can be used to test code that needs to resolve or apply source maps.

Requirements

The fixtures should work in Node.js 0.10 and up. Generating fixtures requires some ES2015 features, Node.js 5 or up is recommended.

Installation

npm install --save-dev source-map-fixtures

Source maps will only change between major versions. New fixtures or other features may be added in minor releases.

Available fixtures

branching

See src/branching.js. Exports a run(value) function which returns true if value === 42, else returns undefined.

istanbul-ignore

Like branching, but the if condition is prefaced with a /* istanbul ignore if */ comment.

When running branching with value !== 42 the statement body won't execute. If you're using the fixture to test a code coverage tool that line will show up as missing coverage. If instead you use the istanbul-ignore fixture the coverage report will ignore the statement body.

If the exported run(value) is called with a value other than 42 the statement body won't execute, but this does not result in missing coverage. It would in the branching fixture.

simple

See src/simple.js. Exports a run() function which returns 42.

throws

See src/throws.js. Exports a run() function which returns throws an error.

bundle

See src/bundle.js. Bundled version of the above fixtures, exports branching(value), istanbulIgnore(), simple() etc.

Available source map types

inline

The source map is included inside the fixture source.

map-file

The source map is provided as a separate file, referenced by the fixture source.

none

No source map is provided.

API

const fixtures = require('source-map-fixtures')

Use fixtures.inline(name), fixtures.mapFile(name) and fixtures.none(name), where name is one of branching, simple, etc. This returns a fixture object:

const fixture = require('source-map-fixtures').inline('simple')

fixture.name

Provides the name of the fixture.

fixture.type

Provides the source map type of the fixture (inline, map-file, none).

fixture.file

Provides the full path to the fixture file.

fixture.sourceFile

Provides the full path to the fixture's source file.

fixture.require()

Requires the fixture file (returns it as a module).

fixture.contentSync()

Synchronously reads the fixture file's content from disk.

fixture.sourceContentSync()

Synchronously reads the fixture's source's content from disk.