Skip to content

Commit 81e0579

Browse files
authored
Serve dart2wasm source map files (#2532)
1 parent 9354f23 commit 81e0579

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pkgs/test/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Restrict to latest version of analyzer package.
44
* Require Dart 3.7
55
* Add `--coverage-path` and `--branch-coverage` options to `dart test`.
6+
* Serve dart2wasm source map files.
67

78
## 1.26.3
89

pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class Dart2WasmSupport extends CompilerSupport with WasmHtmlWrapper {
134134
var baseUrl =
135135
'${p.toUri(p.relative(dartPath, from: _root)).path}.browser_test.dart';
136136
var wasmUrl = '$baseUrl.wasm';
137+
var sourceMapUrl = '$wasmUrl.map';
137138
var jsRuntimeWrapperUrl = '$baseUrl.js';
138139
var jsRuntimeUrl = '$baseUrl.mjs';
139140
var htmlUrl = '$baseUrl.html';
@@ -186,6 +187,14 @@ class Dart2WasmSupport extends CompilerSupport with WasmHtmlWrapper {
186187
headers: {'Content-Type': 'text/html'},
187188
);
188189
});
190+
191+
var sourceMapPath = '$wasmPath.map';
192+
_pathHandler.add(sourceMapUrl, (request) {
193+
return shelf.Response.ok(
194+
File(sourceMapPath).readAsBytesSync(),
195+
headers: {'Content-Type': 'application/json'},
196+
);
197+
});
189198
});
190199
}
191200

0 commit comments

Comments
 (0)