Skip to content

Commit 0cbc2ff

Browse files
committed
more compact source map format
1 parent 1d85f2e commit 0cbc2ff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/dev_compiler/lib/src/codegen/js_printer.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ String writeJsLibrary(JS.Program jsTree, String outputPath,
4646
text = printer.text;
4747
var sourceMap = JSON.decode(printer.map);
4848
var sourceMapText = new JsonEncoder.withIndent(' ').convert(sourceMap);
49+
// Convert:
50+
// "names": [
51+
// "state",
52+
// "print"
53+
// ]
54+
// to:
55+
// "names": ["state","print"]
56+
sourceMapText =
57+
sourceMapText.replaceAll('\n ', '').replaceAll('\n ]', ']');
4958
new File('$outputPath.map').writeAsStringSync('$sourceMapText\n');
5059
} else {
5160
text = (context as JS.SimpleJavaScriptPrintingContext).getText();

0 commit comments

Comments
 (0)