mirror of
https://github.com/denoland/deno.git
synced 2025-12-23 08:48:24 +00:00
fix(node): stub missing process.sourceMapsEnabled (#31358)
See https://nodejs.org/api/process.html#processsourcemapsenabled This fixes an issue in Fresh with vite's environment API which relies on this property to check if vite should map stack traces https://github.com/vitejs/vite/blob/main/packages/vite/src/module-runner/sourcemap/index.ts#L17
This commit is contained in:
parent
030826f589
commit
dbe35b03fb
2 changed files with 17 additions and 0 deletions
|
|
@ -756,6 +756,15 @@ process.setSourceMapsEnabled = (_val: boolean) => {
|
|||
// TODO(@satyarohith): support disabling source maps if needed.
|
||||
};
|
||||
|
||||
// Source maps are always enabled in Deno.
|
||||
Object.defineProperty(process, "sourceMapsEnabled", {
|
||||
get() {
|
||||
return true; // Source maps are always enabled in Deno.
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the current high-resolution real time in a [seconds, nanoseconds]
|
||||
* tuple.
|
||||
|
|
|
|||
|
|
@ -1207,6 +1207,14 @@ Deno.test({
|
|||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "process.sourceMapsEnabled",
|
||||
fn() {
|
||||
// @ts-ignore: not available in the types yet.
|
||||
assertEquals(process.sourceMapsEnabled, true);
|
||||
},
|
||||
});
|
||||
|
||||
// Regression test for https://github.com/denoland/deno/issues/23761
|
||||
Deno.test({
|
||||
name: "process.uptime without this",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue