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.
- Preserve source-map extensions in
SingleMapping. Extensions are keys in the json map that start with
- Set max SDK version to
<3.0.0, and adjust other dependencies.
- Require version 2.0.0 of the Dart SDK.
SingleMapping.filesfield which provides access to
SourceFiles representing the
"sourcesContent"fields in the source map.
SingleMapping.toJson()which indicates whether to include source file contents in the source map.
- Require version
- Support for extended source map format.
MappingBundle.spanForhandling of URIs that have a suffix that exactly match a source map in the MappingBundle.
- Fix strong mode warning in test.
MappingBundle.spanForto accept requests for output files that don't have source maps.
MappingBundleclass that handles extended source map format that supports source maps for multiple output files in a single mapper. Extend
Mapping.spanForAPI to accept a uri parameter that is optional for normal source maps but required for MappingBundle source maps.
- Fix more strong mode warnings.
- Fix all strong mode warnings.
- Add a
mapUrlnamed argument to
parseJson. This argument is used to resolve source URLs for source spans.
- Fix analyzer error (FileSpan has a new field since
- 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.
- Remove the
SourceFileclasses. Use the corresponding
All methods that take
SourceFiles as inputs now also accept the corresponding
source_spanclasses as well. Using the old classes is now deprecated and will be unsupported in version 0.10.0.
- Support writing SingleMapping objects to source map version 3 format.
- Support the
sourceRootfield in the SingleMapping class.
- Support updating the
targetUrlfield in the SingleMapping class.
- Fix a bug in
- Minor readability improvements to
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:
dependencies: source_maps: ^0.10.8
2. Install it
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
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]
We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.4
lib/parser.dart. (-25 points)
lib/parser.dart reported 59 hints, including:
line 46 col 12: Unnecessary new keyword.
line 58 col 11: Unnecessary new keyword.
line 66 col 13: Unnecessary new keyword.
line 69 col 12: Unnecessary new keyword.
line 72 col 10: Unnecessary new keyword.
lib/printer.dart. (-6.78 points)
lib/printer.dart reported 14 hints, including:
line 20 col 30: Unnecessary new keyword.
line 21 col 34: Unnecessary new keyword.
line 41 col 37: Use
= to separate a named parameter from its default value.
line 55 col 18: Unnecessary new keyword.
line 69 col 37: DO use curly braces for all flow control structures.
lib/refactor.dart. (-3.45 points)
lib/refactor.dart reported 7 hints, including:
line 27 col 24: Use isNotEmpty instead of length
line 33 col 16: Unnecessary new keyword.
line 48 col 19: Unnecessary new keyword.
line 49 col 9: Use isEmpty instead of length
line 59 col 18: Unnecessary new keyword.
Fix additional 4 files with analysis or formatting issues. (-6.46 points)
Additional issues in the following files:
Package is getting outdated. (-31.51 points)
The package was last published 68 weeks ago.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
source_maps.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
Homepage URL is insecure. (-5 points)
homepage field and use a secure (
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.