Skip to content

Commit ceb47bc

Browse files
author
Anna Gringauze
authored
Fix failure to get source maps on windows with base change in index.html (#1625)
* Fix failure to get source maps on windows with base change * Updated changelog * Fix test failures
1 parent fefed9e commit ceb47bc

File tree

6 files changed

+657
-1171
lines changed

6 files changed

+657
-1171
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- Make data types null safe
33
- Update `package:vm_service` to 8.3.0.
44
- Convert JavaScript stack traces in uncaught exceptions to Dart stack traces.
5+
- Fix failure to set breakpoints on windows with a base change in index.html.
56

67
## 14.0.2
78
- Update the min SDK constraint to 2.17.0.

dwds/lib/src/loaders/frontend_server_require.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ class FrontendServerRequireStrategyProvider {
3737
String _removeBasePath(String path) =>
3838
path.startsWith(_basePath) ? path.substring(_basePath.length) : null;
3939

40-
String _addBasePath(String serverPath) => p.join(_basePath, serverPath);
40+
String _addBasePath(String serverPath) =>
41+
_basePath == null || _basePath.isEmpty
42+
? relativizePath(serverPath)
43+
: '$_basePath/${relativizePath(serverPath)}';
4144

4245
Future<Map<String, String>> _moduleProvider(
4346
MetadataProvider metadataProvider) async =>
@@ -55,14 +58,12 @@ class FrontendServerRequireStrategyProvider {
5558
_addBasePath((await metadataProvider.moduleToModulePath)[module] ?? '');
5659

5760
Future<String> _sourceMapPathForModule(
58-
MetadataProvider metadataProvider, String module) async {
59-
var path = (await metadataProvider.moduleToSourceMap)[module] ?? '';
60-
return _addBasePath(relativizePath(path));
61-
}
61+
MetadataProvider metadataProvider, String module) async =>
62+
_addBasePath((await metadataProvider.moduleToSourceMap)[module] ?? '');
6263

6364
String _serverPathForAppUri(String appUri) {
6465
if (appUri.startsWith('org-dartlang-app:')) {
65-
return _addBasePath(Uri.parse(appUri).path.substring(1));
66+
return _addBasePath(Uri.parse(appUri).path);
6667
}
6768
return null;
6869
}

0 commit comments

Comments
 (0)