Skip to content

[dart2wasm] Follow-up tasks on source maps #56232

Open
@mkustermann

Description

@mkustermann

Source map support has now landed in dart2wasm (thanks to @osa1 ) in 10742d9 (see flutter/flutter/pull/151643 for the flutter tools PR to take advantage of this).

Though we do have a set of follow-up tasks:

  • Currently method/function tear-offs have no mapping (we should map them to the function that's torn off I think)
  • Core libraries have currently no sources iff we compile from platform file (the org-dartlang-sdk://dart-sdk/lib/**/*.dart scheme we emit isn't resolvable by the browser. We have a few options here
    • Be fine with not having source maps for dart:* code
    • Put the sources for the dart:* into the source map file - downside: increases size of mapping file
    • Expose an option that flutter can pass to remap the org-dartlang-sdk://* scheme to a different uri scheme that flutter's http server can serve in e.g. flutter run
  • Have an option to not bake in file:///**/*.dart urls in the mapping file
    • Make it configurable on how package URIs are encoded in the mapping file - the user (or tool like flutter run) knows how the app is hosted and served and can therefore choose to serve package sources as under a specific url space
      => it just needs to tell dart2wasm that url space we should use for packages
    • Put the sources for the dart code into the source map file - downside: increases size of mapping file significantly
  • Make StackTrace.toString() fetch source maps at runtime & stringify stack. (Possibly only in --enable-assertions / profile mode?)
  • Pass source map file to wasm-opt: https://dart-review.googlesource.com/c/sdk/+/378421.

We should align the approach with dart2js here (@sigmundch). (See also existing dart2js issues with source maps in flutter flutter/flutter#151641)

@yjbanov @eyebrowsoffire any preferences here what would be best for flutter? (the current dart2wasm approach of baking in absolute file uris works really well for local development but not if app is used on non-developer machines)

/cc @osa1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart2wasmIssues for the dart2wasm compiler.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions