8000 Condition the custom serialization on the existance of JSON · johnangularjs/TypeScript@09d6e4a · GitHub
[go: up one dir, main page]

Skip to content

Commit 09d6e4a

Browse files
committed
Condition the custom serialization on the existance of JSON
1 parent 7e6bb85 commit 09d6e4a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/compiler/emitter.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,17 @@ module ts {
604604
};
605605

606606
function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string) {
607+
if (typeof JSON !== "undefined") {
608+
return JSON.stringify({
609+
version: version,
610+
file: file,
611+
sourceRoot: sourceRoot,
612+
sources: sources,
613+
names: names,
614+
mappings: mappings
615+
});
616+
}
617+
607618
return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}";
608619

609620
/** This does not support the full escape characters, it only supports the subset that can be used in file names

0 commit comments

Comments
 (0)
0