mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
BREAKING: Remove unstable Deno.applySourceMap API (#14473)
This commit is contained in:
parent
256dcb058a
commit
5ddb83a4c2
5 changed files with 1 additions and 61 deletions
|
@ -39,7 +39,6 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[
|
|||
"UnixConnectOptions",
|
||||
"UnixListenOptions",
|
||||
"addSignalListener",
|
||||
"applySourceMap",
|
||||
"bench",
|
||||
"connect",
|
||||
"consoleSize",
|
||||
|
|
39
cli/dts/lib.deno.unstable.d.ts
vendored
39
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -895,45 +895,6 @@ declare namespace Deno {
|
|||
options?: EmitOptions,
|
||||
): Promise<EmitResult>;
|
||||
|
||||
/** **UNSTABLE**: Should not have same name as `window.location` type. */
|
||||
interface Location {
|
||||
/** The full url for the module, e.g. `file://some/file.ts` or
|
||||
* `https://some/file.ts`. */
|
||||
fileName: string;
|
||||
/** The line number in the file. It is assumed to be 1-indexed. */
|
||||
lineNumber: number;
|
||||
/** The column number in the file. It is assumed to be 1-indexed. */
|
||||
columnNumber: number;
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: new API, yet to be vetted.
|
||||
*
|
||||
* Given a current location in a module, lookup the source location and return
|
||||
* it.
|
||||
*
|
||||
* When Deno transpiles code, it keep source maps of the transpiled code. This
|
||||
* function can be used to lookup the original location. This is
|
||||
* automatically done when accessing the `.stack` of an error, or when an
|
||||
* uncaught error is logged. This function can be used to perform the lookup
|
||||
* for creating better error handling.
|
||||
*
|
||||
* **Note:** `lineNumber` and `columnNumber` are 1 indexed, which matches display
|
||||
* expectations, but is not typical of most index numbers in Deno.
|
||||
*
|
||||
* An example:
|
||||
*
|
||||
* ```ts
|
||||
* const origin = Deno.applySourceMap({
|
||||
* fileName: "file://my/module.ts",
|
||||
* lineNumber: 5,
|
||||
* columnNumber: 15
|
||||
* });
|
||||
*
|
||||
* console.log(`${origin.fileName}:${origin.lineNumber}:${origin.columnNumber}`);
|
||||
* ```
|
||||
*/
|
||||
export function applySourceMap(location: Location): Location;
|
||||
|
||||
export type SetRawOptions = {
|
||||
cbreak: boolean;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
import { assert, assertEquals, assertMatch } from "./test_util.ts";
|
||||
import { assertEquals, assertMatch } from "./test_util.ts";
|
||||
|
||||
Deno.test(function errorStackMessageLine() {
|
||||
const e1 = new Error();
|
||||
|
@ -52,17 +52,3 @@ Deno.test(function captureStackTrace() {
|
|||
}
|
||||
foo();
|
||||
});
|
||||
|
||||
// FIXME(bartlomieju): no longer works after migrating
|
||||
// to JavaScript runtime code
|
||||
Deno.test({ ignore: true }, function applySourceMap() {
|
||||
const result = Deno.applySourceMap({
|
||||
fileName: "CLI_SNAPSHOT.js",
|
||||
lineNumber: 23,
|
||||
columnNumber: 0,
|
||||
});
|
||||
Deno.core.print(`result: ${result}`, true);
|
||||
assert(result.fileName.endsWith(".ts"));
|
||||
assert(result.lineNumber != null);
|
||||
assert(result.columnNumber != null);
|
||||
});
|
||||
|
|
|
@ -12,13 +12,8 @@
|
|||
return core.opSync("op_format_file_name", location);
|
||||
}
|
||||
|
||||
function opApplySourceMap(location) {
|
||||
return core.applySourceMap(location);
|
||||
}
|
||||
|
||||
window.__bootstrap.errorStack = {
|
||||
opFormatDiagnostics,
|
||||
opFormatFileName,
|
||||
opApplySourceMap,
|
||||
};
|
||||
})(this);
|
||||
|
|
|
@ -126,7 +126,6 @@
|
|||
systemMemoryInfo: __bootstrap.os.systemMemoryInfo,
|
||||
networkInterfaces: __bootstrap.os.networkInterfaces,
|
||||
getUid: __bootstrap.os.getUid,
|
||||
applySourceMap: __bootstrap.errorStack.opApplySourceMap,
|
||||
formatDiagnostics: __bootstrap.errorStack.opFormatDiagnostics,
|
||||
sleepSync: __bootstrap.timers.sleepSync,
|
||||
listen: __bootstrap.netUnstable.listen,
|
||||
|
|
Loading…
Reference in a new issue