source_map_stack_trace 1.1.5

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 90

source_map_stack_trace is a package for converting stack traces generated by dart2js-compiled JavaScript code into readable native Dart stack traces using source maps. For example:

import 'package:source_map_stack_trace/source_map_stack_trace.dart';

void main() {
  var jsTrace = // Get a StackTrace generated by dart2js.
  var mapping = // Get a source map mapping the JS to the Dart source.

  // Convert jsTrace to refer to the Dart source instead.
  var dartTrace = mapStackTrace(jsTrace, sourceMap);
  print(dartTrace);
}

This can convert the following JavaScript trace:

expect_async_test.dart.browser_test.dart.js 2636:15   dart.wrapException
expect_async_test.dart.browser_test.dart.js 14661:15  main__closure16.call$0
expect_async_test.dart.browser_test.dart.js 18237:26  Declarer_test__closure.call$1
expect_async_test.dart.browser_test.dart.js 17905:23  StackZoneSpecification_registerUnaryCallback__closure.call$0
expect_async_test.dart.browser_test.dart.js 17876:16  StackZoneSpecification._stack_zone_specification$_run$2
expect_async_test.dart.browser_test.dart.js 17899:26  StackZoneSpecification_registerUnaryCallback_closure.call$1
expect_async_test.dart.browser_test.dart.js 6115:16   _rootRunUnary
expect_async_test.dart.browser_test.dart.js 8576:39   _CustomZone.runUnary$2
expect_async_test.dart.browser_test.dart.js 7135:57   _Future__propagateToListeners_handleValueCallback.call$0
expect_async_test.dart.browser_test.dart.js 7031:147  dart._Future.static._Future__propagateToListeners

to:

dart:_internal/compiler/js_lib/js_helper.dart 1210:1          wrapException
test/frontend/expect_async_test.dart 24:5                     main.<fn>.<fn>
package:test/src/backend/declarer.dart 45:48                  Declarer.test.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 134:30  StackZoneSpecification.registerUnaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 210:7   StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 135:5   StackZoneSpecification.registerUnaryCallback.<fn>
dart:async/zone.dart 904:14                                   _rootRunUnary
dart:async/zone.dart 806:3                                    _CustomZone.runUnary
dart:async/future_impl.dart 486:13                            _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 567:32                            _Future._propagateToListeners

1.1.5

  • Set max SDK version to <3.0.0.

1.1.4

  • Support source maps that depend on the uri of the location to resolve spans correctly.

1.1.3

  • Add a missing dependency on path.

1.1.2

  • Fix a typo in the previous fix.

1.1.1

  • Don't crash if the SyncPackageResolver has no package information at all.

1.1.0

  • mapStackTrace() now uses a SyncPackageResolver object from the package_resolver package to recreate package: URIs.

  • Deprecation: the packageRoot parameter to mapStackTrace is deprecated in favor of the packageInfo parameter described above. It will be removed in a future release.

1.0.5

  • Add compatibility for member names that include named arguments.

1.0.4

  • Add compatibility for Dart 1.10-style name munging.

1.0.3

  • Prefer "dart:" URLs to "package:" URLs.

1.0.2

  • Fix an off-by-one bug that was causing line numbers to be slightly off.

1.0.1

  • Don't crash when mapping stack chains.

1.0.0

  • Initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  source_map_stack_trace: ^1.1.5

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_map_stack_trace/source_map_stack_trace.dart';
  
Version Uploaded Documentation Archive
1.1.5 Jul 19, 2018 Go to the documentation of source_map_stack_trace 1.1.5 Download source_map_stack_trace 1.1.5 archive
1.1.4 Dec 14, 2016 Go to the documentation of source_map_stack_trace 1.1.4 Download source_map_stack_trace 1.1.4 archive
1.1.3 Aug 11, 2016 Go to the documentation of source_map_stack_trace 1.1.3 Download source_map_stack_trace 1.1.3 archive
1.1.2 Jul 27, 2016 Go to the documentation of source_map_stack_trace 1.1.2 Download source_map_stack_trace 1.1.2 archive
1.1.1 Jul 27, 2016 Go to the documentation of source_map_stack_trace 1.1.1 Download source_map_stack_trace 1.1.1 archive
1.1.0 Jul 26, 2016 Go to the documentation of source_map_stack_trace 1.1.0 Download source_map_stack_trace 1.1.0 archive
1.0.4 May 5, 2015 Go to the documentation of source_map_stack_trace 1.0.4 Download source_map_stack_trace 1.0.4 archive
1.0.3 May 4, 2015 Go to the documentation of source_map_stack_trace 1.0.3 Download source_map_stack_trace 1.0.3 archive
1.0.2 Apr 29, 2015 Go to the documentation of source_map_stack_trace 1.0.2 Download source_map_stack_trace 1.0.2 archive
1.0.1 Apr 29, 2015 Go to the documentation of source_map_stack_trace 1.0.1 Download source_map_stack_trace 1.0.1 archive

All 11 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
93
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, other

Primary library: package:source_map_stack_trace/source_map_stack_trace.dart with components: isolate.

Health suggestions

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

Analysis of lib/source_map_stack_trace.dart reported 2 hints:

line 23 col 6: 'packageRoot' is deprecated and shouldn't be used.

line 24 col 28: 'packageRoot' is deprecated and shouldn't be used.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use source_map_stack_trace.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
package_resolver ^1.0.0 1.0.6
path ^1.0.0 1.6.2
source_maps ^0.10.2 0.10.8
stack_trace ^1.0.0 1.9.3
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http 0.12.0
http_parser 3.1.3
meta 1.1.6
package_config 1.0.5
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
test >=0.12.0 <2.0.0