p-hatan/ mirror

pub repository

mirror.p-hatan.ir

source_map_stack_trace

2.1.0

A package for applying source maps to stack traces.

Download archive

Readme

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
Changelog

2.1.0

  • Stable release for null safety.

2.1.0-nullsafety.4

  • Update SDK constraints to >=2.12.0-0 <3.0.0 based on beta release guidelines.

2.1.0-nullsafety.3

  • Allow prerelease versions of the 2.12 sdk.

2.1.0-nullsafety.2

  • Allow 2.10 stable and 2.11.0 dev SDK versions.

2.1.0-nullsafety.1

  • Update source_maps constraint.

2.1.0-nullsafety

  • Migrate to null safety.

2.0.0

Breaking Changes

  • Removed dependency on package_resolver and changed the apis to accept a Map<String, Uri> which maps package names to the base uri to resolve the package: uris for those packages.
  • The sdkRoot argument must be an Uri. Use Uri.parse for use cases previously passing a String.
  • The deprecated packageRoot argument has been removed.

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.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add source_map_stack_trace
pubspec.yaml
name: source_map_stack_trace
version: 2.1.0
description: A package for applying source maps to stack traces.
homepage: https://github.com/dart-lang/source_map_stack_trace

environment:
  sdk: ">=2.12.0-0 <3.0.0"

dependencies:
  path: ^1.8.0
  stack_trace: ^1.10.0
  source_maps: ^0.10.10

dev_dependencies:
  source_span: ^1.8.0-nullsafety
  test: ^1.16.0-nullsafety
  pedantic: ^1.10.0-nullsafety

Version history

VersionPublishedArchiveSHA-256
1.0.02015-04-29T19:36:13.396730ZDownload1eea5d0c65c1e9e50a9b31aa90e5aa56500517180d0b3e46d36ecad29b5c95ce
1.0.12015-04-29T20:59:01.347860ZDownloadea606a575e107dd672e2a1f27dcd6c6ac1d8c1c916feae6ee3a6130300257e80
1.0.22015-04-29T22:16:30.487790ZDownload8de12a7445dfa632ece8d89d2dd9cd3d17b39bb5e3be34f8fac1996cf49eb62a
1.0.32015-05-04T20:47:12.092070ZDownload8d7b0d65cc1e252c8a10424d246018e7860f875a6b110ced20086c83f4565e4b
1.0.42015-05-05T19:37:21.947670ZDownload5d7af801537f01b58ba570a3163aeff357c00d17b732f3a8718d4a9d6995b3da
1.1.02016-07-26T01:04:33.504ZDownload62ea9d6a88cdb4375c10c858c18fd7b01f3b4b42f46a28866d5e970c9a1f3792
1.1.12016-07-27T20:10:27.727ZDownload0f86227967e0d246d0366fe5a139423f94c30245e9d2b4c132963e871c74ad52
1.1.22016-07-27T20:32:14.119ZDownload48f14204c7899fa6b23e82e5c2783f52add06d4a1d174d7c6fd59773122f8852
1.1.32016-08-11T00:47:19.826ZDownload7f457f6c378e1f325bad74793cb864ca9eab3875604b52632832cc59aeb74c95
1.1.42016-12-14T22:40:15.690ZDownloada9dde62354b0544f4c7e6ee00e7584e327c77dd6b380f18d7ec91aa72e07ebf2
1.1.52018-07-19T19:22:11.012847ZDownload0254bf4c783d8cfb22a79a3ee62509c9d08b42128ed19ec2135ec436eda7fe39
2.0.02020-03-03T18:01:53.212724ZDownload76624522db5c4f0ed5c143b08948eb507115030613c1c16d74e9ac31594be2ca
2.1.0-nullsafety2020-07-29T15:59:05.659455ZDownloade32a6f9417f2144ece92d1f979b983d6c81e6249edaa97a808dab4f263770a9e
2.1.0-nullsafety.12020-07-29T20:37:47.242650ZDownload7f35b04a79fc5437319c9e533bb4c8a2ce8bd4f545b6d6cfbdf261a1eba950d8
2.1.0-nullsafety.22020-09-22T16:12:00.239017ZDownloade360be8135d35b7d5bbd5db1dd6b2a6906c2c34d41696a37c075d940b4be51f5
2.1.0-nullsafety.32020-10-23T20:08:06.655735ZDownloadddbca699470665958c43207012984b5e160483ce7ba5f926aaa81c713f5c3e6c
2.1.0-nullsafety.42020-11-03T22:27:29.263730ZDownloadc116c0e79641066b71ed44fa759cd381b906dd30b5702e7e7f8a2d16fd45211c
2.1.02021-02-03T01:25:31.259396ZDownload8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11
2.1.12022-10-18T18:15:59.773934ZDownload84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae
2.1.22024-08-21T11:24:31.605033ZDownloadc0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b

Dependencies

path "^1.8.0"

source_maps "^0.10.10"

stack_trace "^1.10.0"