source_maps 0.10.7

  • Installing
  • Versions
  • 91

Source Maps #

This project implements a Dart pub package to work with source maps. The implementation is based on the source map version 3 spec which was originated from the Closure Compiler and has been implemented in Chrome and Firefox.

In this package we provide:

  • Data types defining file locations and spans: these are not part of the original source map specification. These data types are great for tracking source locations on source maps, but they can also be used by tools to reporting useful error messages that include on source locations.
  • A builder that creates a source map programatically and produces the encoded source map format.
  • A parser that reads the source map format and provides APIs to read the mapping information.

Some upcoming features we are planning to add to this package are:

  • A printer that lets you generate code, but record source map information in the process.
  • A tool that can compose source maps together. This would be useful for instance, if you have 2 tools that produce source maps and you call one with the result of the other.

0.10.7 #

  • Set max SDK version to <3.0.0, and adjust other dependencies.

0.10.6 #

  • Require version 2.0.0 of the Dart SDK.

0.10.5 #

  • Add a SingleMapping.files field which provides access to SourceFiles representing the "sourcesContent" fields in the source map.

  • Add an includeSourceContents flag to SingleMapping.toJson() which indicates whether to include source file contents in the source map.

0.10.4 #

  • Implement highlight in SourceMapFileSpan.
  • Require version ^1.3.0 of source_span.

0.10.3 #

  • Add addMapping and containsMapping members to MappingBundle.

0.10.2 #

  • Support for extended source map format.
  • Polish MappingBundle.spanFor handling of URIs that have a suffix that exactly match a source map in the MappingBundle.

0.10.1+5 #

  • Fix strong mode warning in test.

0.10.1+4 #

  • Extend MappingBundle.spanFor to accept requests for output files that don't have source maps.

0.10.1+3 #

  • Add MappingBundle class that handles extended source map format that supports source maps for multiple output files in a single mapper. Extend Mapping.spanFor API to accept a uri parameter that is optional for normal source maps but required for MappingBundle source maps.

0.10.1+2 #

  • Fix more strong mode warnings.

0.10.1+1 #

  • Fix all strong mode warnings.

0.10.1 #

  • Add a mapUrl named argument to parse and parseJson. This argument is used to resolve source URLs for source spans.

0.10.0+2 #

  • Fix analyzer error (FileSpan has a new field since source_span 1.1.1)

0.10.0+1 #

  • Remove an unnecessary warning printed when the "file" field is missing from a Json formatted source map. This field is optional and its absence is not unusual.

0.10.0 #

  • Remove the Span, Location and SourceFile classes. Use the corresponding source_span classes instead.

0.9.4 #

  • Update SpanFormatException with source and offset.

  • All methods that take Spans, Locations, and SourceFiles as inputs now also accept the corresponding source_span classes as well. Using the old classes is now deprecated and will be unsupported in version 0.10.0.

0.9.3 #

  • Support writing SingleMapping objects to source map version 3 format.
  • Support the sourceRoot field in the SingleMapping class.
  • Support updating the targetUrl field in the SingleMapping class.

0.9.2+2 #

  • Fix a bug in FixedSpan.getLocationMessage.

0.9.2+1 #

  • Minor readability improvements to FixedSpan.getLocationMessage and SpanException.toString.

0.9.2 #

  • Add SpanException and SpanFormatException classes.

0.9.1 #

  • Support unmapped areas in source maps.

  • Increase the readability of location messages.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  source_maps: ^0.10.7

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:source_maps/source_maps.dart';
Version Uploaded Documentation Archive
0.10.8 Oct 3, 2018 Go to the documentation of source_maps 0.10.8 Download source_maps 0.10.8 archive
0.10.7 Jul 17, 2018 Go to the documentation of source_maps 0.10.7 Download source_maps 0.10.7 archive
0.10.6 Jun 26, 2018 Go to the documentation of source_maps 0.10.6 Download source_maps 0.10.6 archive
0.10.5 Apr 25, 2018 Go to the documentation of source_maps 0.10.5 Download source_maps 0.10.5 archive
0.10.4 Mar 23, 2017 Go to the documentation of source_maps 0.10.4 Download source_maps 0.10.4 archive
0.10.3 Mar 7, 2017 Go to the documentation of source_maps 0.10.3 Download source_maps 0.10.3 archive
0.10.2 Dec 14, 2016 Go to the documentation of source_maps 0.10.2 Download source_maps 0.10.2 archive
0.10.1+5 Dec 12, 2016 Go to the documentation of source_maps 0.10.1+5 Download source_maps 0.10.1+5 archive
0.10.1+4 Dec 9, 2016 Go to the documentation of source_maps 0.10.1+4 Download source_maps 0.10.1+4 archive
0.10.1+3 Dec 8, 2016 Go to the documentation of source_maps 0.10.1+3 Download source_maps 0.10.1+3 archive

All 97 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:source_maps/source_maps.dart.

Health suggestions

Fix lib/parser.dart. (-4.89 points)

Analysis of lib/parser.dart reported 10 hints, including:

line 139 col 9: Use isEmpty instead of length

line 182 col 19: Use ; instead of {} for empty constructor bodies.

line 365 col 13: Use isNotEmpty for Iterables and Maps.

line 414 col 9: Use isNotEmpty for Iterables and Maps.

line 423 col 41: Use = to separate a named parameter from its default value.

Fix lib/printer.dart. (-1.49 points)

Analysis of lib/printer.dart reported 3 hints:

line 41 col 37: Use = to separate a named parameter from its default value.

line 80 col 9: Don't explicitly initialize variables to null.

line 136 col 65: Use = to separate a named parameter from its default value.

Fix lib/refactor.dart. (-1 points)

Analysis of lib/refactor.dart reported 2 hints:

line 27 col 24: Use isNotEmpty instead of length

line 49 col 9: Use isEmpty instead of length

Fix lib/src/source_map_span.dart. (-1 points)

Analysis of lib/src/source_map_span.dart reported 2 hints:

line 20 col 25: Use = to separate a named parameter from its default value.

line 51 col 52: Use = to separate a named parameter from its default value.

Fix lib/src/utils.dart. (-0.50 points)

Analysis of lib/src/utils.dart reported 1 hint:

line 14 col 7: Use isEmpty instead of length

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and source_maps.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

The package description is too short. (-4 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.17.0 <3.0.0
source_span ^1.3.0 1.5.5
Transitive dependencies
charcode 1.1.2
path 1.6.2
term_glyph 1.1.0
Dev dependencies
test ^1.2.0