Skip to content

Commit

Permalink
fix: Buffer global in --unstable-node-globals (#26973)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju authored Nov 21, 2024
1 parent 3f3568b commit aa0ba65
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/js/98_global_scope_shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { DOMException } from "ext:deno_web/01_dom_exception.js";
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
import * as imageData from "ext:deno_web/16_image_data.js";
import process from "node:process";
import Buffer from "node:buffer";
import { Buffer } from "node:buffer";
import { clearImmediate, setImmediate } from "node:timers";
import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
Expand Down
8 changes: 7 additions & 1 deletion tests/specs/run/unstable/node_globals.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
global: true
Buffer: true
Buffer: function from(
value,
encodingOrOffset,
length,
) {
return _from(value, encodingOrOffset, length);
}
setImmediate: true
clearImmediate: true
2 changes: 1 addition & 1 deletion tests/specs/run/unstable/node_globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import * as nodeBuffer from "node:buffer";
import * as nodeTimers from "node:timers";

console.log(`global: ${globalThis === global}`);
console.log(`Buffer: ${Buffer === nodeBuffer.default}`);
console.log(`Buffer: ${Buffer.from}`);
console.log(`setImmediate: ${setImmediate === nodeTimers.setImmediate}`);
console.log(`clearImmediate: ${clearImmediate === nodeTimers.clearImmediate}`);

0 comments on commit aa0ba65

Please sign in to comment.