Sourcypants 0.9.0

JavaScript sourcemap parser for .NET standard

Install-Package Sourcypants -Version 0.9.0
dotnet add package Sourcypants --version 0.9.0
<PackageReference Include="Sourcypants" Version="0.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sourcypants --version 0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sourcypants, 0.9.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sourcypants as a Cake Addin
#addin nuget:?package=Sourcypants&version=0.9.0

// Install Sourcypants as a Cake Tool
#tool nuget:?package=Sourcypants&version=0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SourcyPants

(Not to be confused with saucy pants)

Simple source map parser for .NET Standard.
Based on SourceMapDotNet, which titles itself as a "port of a small
portion of Mozilla's source-map module to .NET intended for reading a source
map".

This project goes a bit further, and adds support for asking "what line and
column number in the original source does line X and column Y in the generated
source map to?" instead of just what line.

It also handles a bit more for display purposes, such as supporting SourceRoot
and method names.

Usage

Build a SourceMapConsumer by either supplying the JSON contents of a source map
file:

var consumer = new Sourcypants.SourceMapConsumer("{ source: 'map', goes: 'here'
}");

Or build directly from a SourceMapFile instance, built using your JSON decoder
of choice:

var file = JsonConvert.Deserialize<Sourcypants.SourceMapFile>("{ source: 'map',
goes: 'here' }");
var consumer = new Sourcypants.SourceMapConsumer(file);

Then find out which original source lines map to a given generated source line
number (line numbers are 1-based):

// Get the original source lines that map to line 12, column 0 of the generated
source
var matches = consumer.OriginalPositionsFor(12, 0);

foreach (var match in matches)
{
    var line = match.LineNumber;
    var filename = match.File;
    
    // Do useful things...
}

An empty array is returned if there are no matching original source lines for
the specified generated source line.

License

MIT licensed

SourcyPants

(Not to be confused with saucy pants)

Simple source map parser for .NET Standard.
Based on SourceMapDotNet, which titles itself as a "port of a small
portion of Mozilla's source-map module to .NET intended for reading a source
map".

This project goes a bit further, and adds support for asking "what line and
column number in the original source does line X and column Y in the generated
source map to?" instead of just what line.

It also handles a bit more for display purposes, such as supporting SourceRoot
and method names.

Usage

Build a SourceMapConsumer by either supplying the JSON contents of a source map
file:

var consumer = new Sourcypants.SourceMapConsumer("{ source: 'map', goes: 'here'
}");

Or build directly from a SourceMapFile instance, built using your JSON decoder
of choice:

var file = JsonConvert.Deserialize<Sourcypants.SourceMapFile>("{ source: 'map',
goes: 'here' }");
var consumer = new Sourcypants.SourceMapConsumer(file);

Then find out which original source lines map to a given generated source line
number (line numbers are 1-based):

// Get the original source lines that map to line 12, column 0 of the generated
source
var matches = consumer.OriginalPositionsFor(12, 0);

foreach (var match in matches)
{
    var line = match.LineNumber;
    var filename = match.File;
    
    // Do useful things...
}

An empty array is returned if there are no matching original source lines for
the specified generated source line.

License

MIT licensed

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.9.0 3,889 3/8/2018
0.8.0 483 3/3/2018