begin hacky fix
Some checks are pending
ci / Linux (Ubuntu) (push) Waiting to run
ci / linux-asan (push) Waiting to run
ci / linux-msan (push) Waiting to run
ci / linux-ubsan (push) Waiting to run
ci / macOS (push) Waiting to run
ci / macos-asan (push) Waiting to run
ci / macos-ubsan (push) Waiting to run
ci / freebsd (push) Waiting to run
ci / qemu-alpine (arm32v6) (push) Waiting to run
ci / qemu-alpine (arm32v7) (push) Waiting to run
ci / qemu-alpine (arm64v8) (push) Waiting to run
ci / qemu-alpine (i386) (push) Waiting to run
ci / qemu-alpine (s390x) (push) Waiting to run
Some checks are pending
ci / Linux (Ubuntu) (push) Waiting to run
ci / linux-asan (push) Waiting to run
ci / linux-msan (push) Waiting to run
ci / linux-ubsan (push) Waiting to run
ci / macOS (push) Waiting to run
ci / macos-asan (push) Waiting to run
ci / macos-ubsan (push) Waiting to run
ci / freebsd (push) Waiting to run
ci / qemu-alpine (arm32v6) (push) Waiting to run
ci / qemu-alpine (arm32v7) (push) Waiting to run
ci / qemu-alpine (arm64v8) (push) Waiting to run
ci / qemu-alpine (i386) (push) Waiting to run
ci / qemu-alpine (s390x) (push) Waiting to run
This commit is contained in:
parent
98e7a7e595
commit
868bc825e1
3 changed files with 11 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,3 +21,4 @@ unicode_gen
|
|||
run_octane
|
||||
run_sunspider_like
|
||||
build/
|
||||
.vscode/
|
2
qjs.c
2
qjs.c
|
@ -174,7 +174,7 @@ static int eval_file(JSContext *ctx, const char *filename, int module)
|
|||
" globalThis.loadFile = std.loadFile;\n"
|
||||
" globalThis.printf = console.log;\n"
|
||||
" globalThis.evalFile = std.loadScript;\n"
|
||||
//" globalThis.require = std.loadScript;\n"
|
||||
" globalThis.require = (moduleSpecifier) => import(moduleSpecifier).then(mod => mod.default || mod);\n"
|
||||
" globalThis.getURL = std.urlGet;\n"
|
||||
"} else {\n"
|
||||
" console.error('std is not defined.');\n"
|
||||
|
|
12
repl.js
12
repl.js
|
@ -27,6 +27,11 @@ import * as os from "qjs:os";
|
|||
import * as bjson from "qjs:bjson";
|
||||
|
||||
|
||||
globalThis.global = globalThis
|
||||
globalThis.safeGlobal = {}
|
||||
global.console.error = console.log
|
||||
global.console.warn = console.log
|
||||
|
||||
if (typeof os !== 'undefined') {
|
||||
globalThis.sleep = os.sleep
|
||||
async function setTimeout2(func, ms) {globalThis.clearTimeout = false; await sleep(ms); if (!clearTimeout) { func(); } }
|
||||
|
@ -35,20 +40,21 @@ if (typeof os !== 'undefined') {
|
|||
console.error('os is not defined.')
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (typeof std !== 'undefined') {
|
||||
globalThis.urlGet = std.urlGet
|
||||
globalThis.loadFile = std.loadFile
|
||||
globalThis.printf = console.log
|
||||
globalThis.evalFile = std.loadScript
|
||||
// " globalThis.require = std.loadScript"
|
||||
globalThis.require = (moduleSpecifier) => import(moduleSpecifier).then(mod => mod.default || mod);
|
||||
globalThis.getURL = std.urlGet
|
||||
} else {
|
||||
console.error('std is not defined.');
|
||||
}
|
||||
|
||||
(function(g) {
|
||||
/* init polyfills */
|
||||
g = globalThis
|
||||
|
||||
/* add 'bjson', 'os' and 'std' bindings */
|
||||
g.bjson = bjson;
|
||||
g.os = os;
|
||||
|
|
Loading…
Reference in a new issue