Skip to content

Commit

Permalink
Fix setMainSourceMap signature
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 2, 2018
1 parent 81f96f6 commit dfd3206
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions js/lib.deno.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// <reference no-default-lib="true"/>

/// <reference lib="esnext" />
import { RawSourceMap } from "source-map";

// TODO generate `console.d.ts` and inline it in `assets.ts` and remove
// declaration of `Console`
Expand All @@ -29,7 +30,7 @@ interface Window {
console: Console;
// TODO(ry) These shouldn't be global.
mainSource: string;
setMainSourceMap(sm: string): void;
setMainSourceMap(sm: RawSourcemap): void;
}

// Globals in the runtime environment
Expand All @@ -38,4 +39,4 @@ declare const window: Window;

// TODO(ry) These shouldn't be global.
declare let mainSource: string;
declare function setMainSourceMap(sm: string): void;
declare function setMainSourceMap(sm: RawSourcemap): void;
6 changes: 3 additions & 3 deletions js/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ function setMainSourceMap(rawSourceMap: RawSourceMap) {
util.assert(Number(rawSourceMap.version) === 3);
mainSourceMap = rawSourceMap;
}
window["setMainSourceMap"] = setMainSourceMap;
window.setMainSourceMap = setMainSourceMap;

export function setup(): void {
sourceMaps.install({
installPrepareStackTrace: true,
getGeneratedContents: (filename: string): string | RawSourceMap => {
util.log("getGeneratedContents", filename);
if (filename === "gen/bundle/main.js") {
util.assert(window["mainSource"].length > 0);
return window["mainSource"];
util.assert(window.mainSource.length > 0);
return window.mainSource;
} else if (filename === "main.js.map") {
return mainSourceMap;
} else if (filename === "deno_main.js") {
Expand Down

0 comments on commit dfd3206

Please sign in to comment.