Skip to content

Commit

Permalink
feat: add node: specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
monta-k authored and aykevl committed Aug 9, 2024
1 parent fb3d98c commit 841abb0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions targets/wasm_exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

if (!global.fs && global.require) {
global.fs = require("fs");
global.fs = require("node:fs");
}

const enosys = () => {
Expand Down Expand Up @@ -101,7 +101,7 @@
}

if (!global.crypto) {
const nodeCrypto = require("crypto");
const nodeCrypto = require("node:crypto");
global.crypto = {
getRandomValues(b) {
nodeCrypto.randomFillSync(b);
Expand All @@ -119,11 +119,11 @@
}

if (!global.TextEncoder) {
global.TextEncoder = require("util").TextEncoder;
global.TextEncoder = require("node:util").TextEncoder;
}

if (!global.TextDecoder) {
global.TextDecoder = require("util").TextDecoder;
global.TextDecoder = require("node:util").TextDecoder;
}

// End of polyfills for common API.
Expand Down

0 comments on commit 841abb0

Please sign in to comment.