1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-12 10:37:52 -05:00
denoland-deno/cli/js/ops/errors.ts
2020-07-06 21:45:39 -04:00

23 lines
633 B
TypeScript

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { DiagnosticItem } from "../diagnostics.ts";
import { sendSync } from "./dispatch_json.ts";
export function formatDiagnostics(items: DiagnosticItem[]): string {
return sendSync("op_format_diagnostic", { items });
}
export interface Location {
fileName: string;
lineNumber: number;
columnNumber: number;
}
export function applySourceMap(location: Location): Location {
const res = sendSync("op_apply_source_map", location);
return {
fileName: res.fileName,
lineNumber: res.lineNumber,
columnNumber: res.columnNumber,
};
}