mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-25 06:49:04 +00:00
feat: add node: specifier
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!global.fs && global.require) {
|
if (!global.fs && global.require) {
|
||||||
global.fs = require("fs");
|
global.fs = require("node:fs");
|
||||||
}
|
}
|
||||||
|
|
||||||
const enosys = () => {
|
const enosys = () => {
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!global.crypto) {
|
if (!global.crypto) {
|
||||||
const nodeCrypto = require("crypto");
|
const nodeCrypto = require("node:crypto");
|
||||||
global.crypto = {
|
global.crypto = {
|
||||||
getRandomValues(b) {
|
getRandomValues(b) {
|
||||||
nodeCrypto.randomFillSync(b);
|
nodeCrypto.randomFillSync(b);
|
||||||
@@ -119,11 +119,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!global.TextEncoder) {
|
if (!global.TextEncoder) {
|
||||||
global.TextEncoder = require("util").TextEncoder;
|
global.TextEncoder = require("node:util").TextEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!global.TextDecoder) {
|
if (!global.TextDecoder) {
|
||||||
global.TextDecoder = require("util").TextDecoder;
|
global.TextDecoder = require("node:util").TextDecoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of polyfills for common API.
|
// End of polyfills for common API.
|
||||||
|
|||||||
Reference in New Issue
Block a user