mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Make qjs --std switch include bjson module (#640)
This commit is contained in:
parent
dfe5675f25
commit
df81c9940f
1 changed files with 6 additions and 3 deletions
9
qjs.c
9
qjs.c
|
@ -320,7 +320,7 @@ void help(void)
|
||||||
"-m --module load as ES6 module (default=autodetect)\n"
|
"-m --module load as ES6 module (default=autodetect)\n"
|
||||||
" --script load as ES6 script (default=autodetect)\n"
|
" --script load as ES6 script (default=autodetect)\n"
|
||||||
"-I --include file include an additional file\n"
|
"-I --include file include an additional file\n"
|
||||||
" --std make 'std' and 'os' available to the loaded script\n"
|
" --std make 'std', 'os' and 'bjson' available to script\n"
|
||||||
"-T --trace trace memory allocation\n"
|
"-T --trace trace memory allocation\n"
|
||||||
"-d --dump dump the memory usage stats\n"
|
"-d --dump dump the memory usage stats\n"
|
||||||
"-D --dump-flags flags for dumping debug data (see DUMP_* defines)\n"
|
"-D --dump-flags flags for dumping debug data (see DUMP_* defines)\n"
|
||||||
|
@ -522,8 +522,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* make 'std' and 'os' visible to non module code */
|
/* make 'std' and 'os' visible to non module code */
|
||||||
if (load_std) {
|
if (load_std) {
|
||||||
const char *str = "import * as std from 'std';\n"
|
const char *str =
|
||||||
"import * as os from 'os';\n"
|
"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.std = std;\n"
|
||||||
"globalThis.os = os;\n";
|
"globalThis.os = os;\n";
|
||||||
eval_buf(ctx, str, strlen(str), "<input>", JS_EVAL_TYPE_MODULE);
|
eval_buf(ctx, str, strlen(str), "<input>", JS_EVAL_TYPE_MODULE);
|
||||||
|
|
Loading…
Reference in a new issue