mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Update qjs.c
This commit is contained in:
parent
47a857309f
commit
2639ec1199
1 changed files with 15 additions and 15 deletions
28
qjs.c
28
qjs.c
|
@ -621,20 +621,6 @@ start:
|
||||||
/* exit on unhandled promise rejections */
|
/* exit on unhandled promise rejections */
|
||||||
JS_SetHostPromiseRejectionTracker(rt, js_std_promise_rejection_tracker, NULL);
|
JS_SetHostPromiseRejectionTracker(rt, js_std_promise_rejection_tracker, NULL);
|
||||||
|
|
||||||
if (!empty_run) {
|
|
||||||
js_std_add_helpers(ctx, argc - optind, argv + optind);
|
|
||||||
|
|
||||||
/* make 'std' and 'os' visible to non module code */
|
|
||||||
if (load_std) {
|
|
||||||
const char *str =
|
|
||||||
"import * as bjson from 'qjs:bjson';\n"
|
|
||||||
"import * as std from 'qjs:std';\n"
|
|
||||||
"import * as os from 'qjs:os';\n"
|
|
||||||
"globalThis.bjson = bjson;\n"
|
|
||||||
"globalThis.std = std;\n"
|
|
||||||
"globalThis.os = os;\n";
|
|
||||||
eval_buf(ctx, str, strlen(str), "<input>", JS_EVAL_TYPE_MODULE);
|
|
||||||
|
|
||||||
//POLYFILLS FOR QJS FILES BEGIN
|
//POLYFILLS FOR QJS FILES BEGIN
|
||||||
const char *pf = "globalThis.global = globalThis;\n"
|
const char *pf = "globalThis.global = globalThis;\n"
|
||||||
"global.console.error = console.log\n"
|
"global.console.error = console.log\n"
|
||||||
|
@ -664,6 +650,20 @@ start:
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
eval_buf(ctx, pf, strlen(pf), "<input>", JS_EVAL_TYPE_MODULE);
|
eval_buf(ctx, pf, strlen(pf), "<input>", JS_EVAL_TYPE_MODULE);
|
||||||
|
|
||||||
|
if (!empty_run) {
|
||||||
|
js_std_add_helpers(ctx, argc - optind, argv + optind);
|
||||||
|
|
||||||
|
/* make 'std' and 'os' visible to non module code */
|
||||||
|
if (load_std) {
|
||||||
|
const char *str =
|
||||||
|
"import * as bjson from 'qjs:bjson';\n"
|
||||||
|
"import * as std from 'qjs:std';\n"
|
||||||
|
"import * as os from 'qjs:os';\n"
|
||||||
|
"globalThis.bjson = bjson;\n"
|
||||||
|
"globalThis.std = std;\n"
|
||||||
|
"globalThis.os = os;\n";
|
||||||
|
eval_buf(ctx, str, strlen(str), "<input>", JS_EVAL_TYPE_MODULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < include_count; i++) {
|
for(i = 0; i < include_count; i++) {
|
||||||
|
|
Loading…
Reference in a new issue