jseption 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +191 -2
- package/dist/atoms.d.ts +255 -0
- package/dist/atoms.js +445 -0
- package/dist/atoms.js.map +1 -0
- package/dist/builtins/array.d.ts +3 -0
- package/dist/builtins/array.js +116 -0
- package/dist/builtins/array.js.map +1 -0
- package/dist/builtins/bigint.d.ts +3 -0
- package/dist/builtins/bigint.js +122 -0
- package/dist/builtins/bigint.js.map +1 -0
- package/dist/builtins/boolean.d.ts +2 -0
- package/dist/builtins/boolean.js +26 -0
- package/dist/builtins/boolean.js.map +1 -0
- package/dist/builtins/date.d.ts +3 -0
- package/dist/builtins/date.js +1046 -0
- package/dist/builtins/date.js.map +1 -0
- package/dist/builtins/error.d.ts +2 -0
- package/dist/builtins/error.js +154 -0
- package/dist/builtins/error.js.map +1 -0
- package/dist/builtins/function.d.ts +5 -0
- package/dist/builtins/function.js +164 -0
- package/dist/builtins/function.js.map +1 -0
- package/dist/builtins/global.d.ts +2 -0
- package/dist/builtins/global.js +29 -0
- package/dist/builtins/global.js.map +1 -0
- package/dist/builtins/index.d.ts +3 -0
- package/dist/builtins/index.js +139 -0
- package/dist/builtins/index.js.map +1 -0
- package/dist/builtins/json.d.ts +6 -0
- package/dist/builtins/json.js +984 -0
- package/dist/builtins/json.js.map +1 -0
- package/dist/builtins/mapset.d.ts +4 -0
- package/dist/builtins/mapset.js +234 -0
- package/dist/builtins/mapset.js.map +1 -0
- package/dist/builtins/math.d.ts +2 -0
- package/dist/builtins/math.js +62 -0
- package/dist/builtins/math.js.map +1 -0
- package/dist/builtins/native.d.ts +22 -0
- package/dist/builtins/native.js +250 -0
- package/dist/builtins/native.js.map +1 -0
- package/dist/builtins/number.d.ts +4 -0
- package/dist/builtins/number.js +76 -0
- package/dist/builtins/number.js.map +1 -0
- package/dist/builtins/object.d.ts +12 -0
- package/dist/builtins/object.js +575 -0
- package/dist/builtins/object.js.map +1 -0
- package/dist/builtins/promise.d.ts +13 -0
- package/dist/builtins/promise.js +582 -0
- package/dist/builtins/promise.js.map +1 -0
- package/dist/builtins/proxy.d.ts +3 -0
- package/dist/builtins/proxy.js +226 -0
- package/dist/builtins/proxy.js.map +1 -0
- package/dist/builtins/reflect.d.ts +2 -0
- package/dist/builtins/reflect.js +109 -0
- package/dist/builtins/reflect.js.map +1 -0
- package/dist/builtins/regexp.d.ts +2 -0
- package/dist/builtins/regexp.js +203 -0
- package/dist/builtins/regexp.js.map +1 -0
- package/dist/builtins/string.d.ts +4 -0
- package/dist/builtins/string.js +135 -0
- package/dist/builtins/string.js.map +1 -0
- package/dist/builtins/symbol.d.ts +3 -0
- package/dist/builtins/symbol.js +98 -0
- package/dist/builtins/symbol.js.map +1 -0
- package/dist/builtins/typedarray.d.ts +15 -0
- package/dist/builtins/typedarray.js +1838 -0
- package/dist/builtins/typedarray.js.map +1 -0
- package/dist/builtins/weakref.d.ts +18 -0
- package/dist/builtins/weakref.js +130 -0
- package/dist/builtins/weakref.js.map +1 -0
- package/dist/dump.d.ts +2 -0
- package/dist/dump.js +124 -0
- package/dist/dump.js.map +1 -0
- package/dist/embed.d.ts +18 -0
- package/dist/embed.js +286 -0
- package/dist/embed.js.map +1 -0
- package/dist/interpreter.d.ts +81 -0
- package/dist/interpreter.js +3768 -0
- package/dist/interpreter.js.map +1 -0
- package/dist/jit.d.ts +59 -0
- package/dist/jit.js +3440 -0
- package/dist/jit.js.map +1 -0
- package/dist/jit_hook.d.ts +21 -0
- package/dist/jit_hook.js +4 -0
- package/dist/jit_hook.js.map +1 -0
- package/dist/jit_runtime.d.ts +104 -0
- package/dist/jit_runtime.js +721 -0
- package/dist/jit_runtime.js.map +1 -0
- package/dist/jit_stack.d.ts +24 -0
- package/dist/jit_stack.js +227 -0
- package/dist/jit_stack.js.map +1 -0
- package/dist/jseption.d.ts +15 -0
- package/dist/jseption.js +61 -0
- package/dist/jseption.js.map +1 -0
- package/dist/opcodes.d.ts +347 -0
- package/dist/opcodes.js +322 -0
- package/dist/opcodes.js.map +1 -0
- package/dist/parser.d.ts +283 -0
- package/dist/parser.js +9752 -0
- package/dist/parser.js.map +1 -0
- package/dist/qjs.d.ts +2 -0
- package/dist/qjs.js +122 -0
- package/dist/qjs.js.map +1 -0
- package/dist/quickjs.d.ts +460 -0
- package/dist/quickjs.js +3408 -0
- package/dist/quickjs.js.map +1 -0
- package/dist/std.d.ts +4 -0
- package/dist/std.js +273 -0
- package/dist/std.js.map +1 -0
- package/dist/values.d.ts +447 -0
- package/dist/values.js +461 -0
- package/dist/values.js.map +1 -0
- package/package.json +59 -4
package/dist/qjs.d.ts
ADDED
package/dist/qjs.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* qjs: command line interpreter (port of qjs.c)
|
|
4
|
+
*/
|
|
5
|
+
import { JS_NewRuntime, JS_NewContext, JS_Eval, JS_IsException, JS_EVAL_TYPE_GLOBAL, JS_EVAL_FLAG_STRICT, JS_EVAL_FLAG_COMPILE_ONLY, JS_IsUndefined, JS_ToString, JS_GetFunctionData, JS_SetMaxStackSize } from "./jseption.js";
|
|
6
|
+
import { js_std_add_helpers, js_std_loop, js_std_dump_error } from "./std.js";
|
|
7
|
+
import { dump_byte_code } from "./dump.js";
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
function help() {
|
|
10
|
+
console.log(`usage: qjs [options] [file [args]]
|
|
11
|
+
-h --help list options
|
|
12
|
+
-e --eval EXPR evaluate EXPR
|
|
13
|
+
-i --interactive go to interactive mode
|
|
14
|
+
-d --dump dump the bytecode of the evaluated code
|
|
15
|
+
--strict evaluate in strict mode
|
|
16
|
+
-q --quit just instantiate the interpreter and quit`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
function eval_buf(ctx, buf, filename, eval_flags, dump) {
|
|
20
|
+
if (dump) {
|
|
21
|
+
const fn = JS_Eval(ctx, buf, filename, eval_flags | JS_EVAL_FLAG_COMPILE_ONLY);
|
|
22
|
+
if (JS_IsException(fn)) {
|
|
23
|
+
js_std_dump_error(ctx);
|
|
24
|
+
return -1;
|
|
25
|
+
}
|
|
26
|
+
process.stdout.write(dump_byte_code(ctx, JS_GetFunctionData(fn).function_bytecode));
|
|
27
|
+
}
|
|
28
|
+
const val = JS_Eval(ctx, buf, filename, eval_flags);
|
|
29
|
+
if (JS_IsException(val)) {
|
|
30
|
+
js_std_dump_error(ctx);
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
async function repl(ctx) {
|
|
36
|
+
const readline = await import('readline');
|
|
37
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: 'qjs > ' });
|
|
38
|
+
rl.prompt();
|
|
39
|
+
for await (const line of rl) {
|
|
40
|
+
if (line.trim() === '') {
|
|
41
|
+
rl.prompt();
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const val = JS_Eval(ctx, line, '<repl>', JS_EVAL_TYPE_GLOBAL);
|
|
45
|
+
if (JS_IsException(val)) {
|
|
46
|
+
js_std_dump_error(ctx);
|
|
47
|
+
}
|
|
48
|
+
else if (!JS_IsUndefined(val)) {
|
|
49
|
+
const s = JS_ToString(ctx, val);
|
|
50
|
+
if (JS_IsException(s))
|
|
51
|
+
js_std_dump_error(ctx);
|
|
52
|
+
else
|
|
53
|
+
console.log(s);
|
|
54
|
+
}
|
|
55
|
+
await js_std_loop(ctx);
|
|
56
|
+
rl.prompt();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function main() {
|
|
60
|
+
const argv = process.argv.slice(2);
|
|
61
|
+
let optind = 0;
|
|
62
|
+
const expr = [];
|
|
63
|
+
let interactive = false, dump = false, strict = false, quit = false;
|
|
64
|
+
while (optind < argv.length && argv[optind].startsWith('-')) {
|
|
65
|
+
const arg = argv[optind++];
|
|
66
|
+
if (arg === '-h' || arg === '--help')
|
|
67
|
+
help();
|
|
68
|
+
else if (arg === '-e' || arg === '--eval') {
|
|
69
|
+
if (optind >= argv.length)
|
|
70
|
+
help();
|
|
71
|
+
expr.push(argv[optind++]);
|
|
72
|
+
}
|
|
73
|
+
else if (arg === '-i' || arg === '--interactive')
|
|
74
|
+
interactive = true;
|
|
75
|
+
else if (arg === '-d' || arg === '--dump')
|
|
76
|
+
dump = true;
|
|
77
|
+
else if (arg === '--strict')
|
|
78
|
+
strict = true;
|
|
79
|
+
else if (arg === '-q' || arg === '--quit')
|
|
80
|
+
quit = true;
|
|
81
|
+
else if (arg === '--')
|
|
82
|
+
break;
|
|
83
|
+
else {
|
|
84
|
+
console.error(`qjs: unknown option '${arg}'`);
|
|
85
|
+
help();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const rt = JS_NewRuntime();
|
|
89
|
+
JS_SetMaxStackSize(rt, 1000);
|
|
90
|
+
const ctx = JS_NewContext(rt);
|
|
91
|
+
js_std_add_helpers(ctx, argv.slice(optind));
|
|
92
|
+
if (quit)
|
|
93
|
+
return 0;
|
|
94
|
+
const eval_flags = JS_EVAL_TYPE_GLOBAL | (strict ? JS_EVAL_FLAG_STRICT : 0);
|
|
95
|
+
let status = 0;
|
|
96
|
+
for (const e of expr) {
|
|
97
|
+
if (eval_buf(ctx, e, '<cmdline>', eval_flags, dump))
|
|
98
|
+
status = 1;
|
|
99
|
+
}
|
|
100
|
+
if (optind < argv.length) {
|
|
101
|
+
const filename = argv[optind];
|
|
102
|
+
let buf;
|
|
103
|
+
try {
|
|
104
|
+
buf = readFileSync(filename, 'utf8');
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
console.error(`qjs: cannot load '${filename}': ${e.message}`);
|
|
108
|
+
return 1;
|
|
109
|
+
}
|
|
110
|
+
if (eval_buf(ctx, buf, filename, eval_flags, dump))
|
|
111
|
+
status = 1;
|
|
112
|
+
}
|
|
113
|
+
else if (expr.length === 0) {
|
|
114
|
+
interactive = true;
|
|
115
|
+
}
|
|
116
|
+
await js_std_loop(ctx);
|
|
117
|
+
if (interactive)
|
|
118
|
+
await repl(ctx);
|
|
119
|
+
return status;
|
|
120
|
+
}
|
|
121
|
+
main().then(code => process.exit(code), e => { console.error(e); process.exit(2); });
|
|
122
|
+
//# sourceMappingURL=qjs.js.map
|
package/dist/qjs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qjs.js","sourceRoot":"","sources":["../src/qjs.ts"],"names":[],"mappings":"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","sourcesContent":["#!/usr/bin/env node\n/*\n * qjs: command line interpreter (port of qjs.c)\n */\nimport { JS_NewRuntime, JS_NewContext, JS_Eval, JS_IsException, JS_EVAL_TYPE_GLOBAL, JS_EVAL_FLAG_STRICT,\n JS_EVAL_FLAG_COMPILE_ONLY, JS_IsUndefined, JS_ToString, JS_GetFunctionData, JS_SetMaxStackSize, formatException,\n JS_GetException, JSContext } from './jseption.ts';\nimport { js_std_add_helpers, js_std_loop, js_std_dump_error } from './std.ts';\nimport { dump_byte_code } from './dump.ts';\nimport { readFileSync } from 'node:fs';\n\nfunction help(): never {\n console.log(`usage: qjs [options] [file [args]]\n-h --help list options\n-e --eval EXPR evaluate EXPR\n-i --interactive go to interactive mode\n-d --dump dump the bytecode of the evaluated code\n --strict evaluate in strict mode\n-q --quit just instantiate the interpreter and quit`);\n process.exit(1);\n}\n\nfunction eval_buf(ctx: JSContext, buf: string, filename: string, eval_flags: number, dump: boolean): number {\n if (dump) {\n const fn = JS_Eval(ctx, buf, filename, eval_flags | JS_EVAL_FLAG_COMPILE_ONLY);\n if (JS_IsException(fn)) { js_std_dump_error(ctx); return -1; }\n process.stdout.write(dump_byte_code(ctx, JS_GetFunctionData(fn)!.function_bytecode));\n }\n const val = JS_Eval(ctx, buf, filename, eval_flags);\n if (JS_IsException(val)) {\n js_std_dump_error(ctx);\n return -1;\n }\n return 0;\n}\n\nasync function repl(ctx: JSContext): Promise<void> {\n const readline = await import('readline');\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: 'qjs > ' });\n rl.prompt();\n for await (const line of rl) {\n if (line.trim() === '') { rl.prompt(); continue; }\n const val = JS_Eval(ctx, line, '<repl>', JS_EVAL_TYPE_GLOBAL);\n if (JS_IsException(val)) {\n js_std_dump_error(ctx);\n } else if (!JS_IsUndefined(val)) {\n const s = JS_ToString(ctx, val);\n if (JS_IsException(s)) js_std_dump_error(ctx);\n else console.log(s);\n }\n await js_std_loop(ctx);\n rl.prompt();\n }\n}\n\nasync function main(): Promise<number> {\n const argv = process.argv.slice(2);\n let optind = 0;\n const expr: string[] = [];\n let interactive = false, dump = false, strict = false, quit = false;\n while (optind < argv.length && argv[optind].startsWith('-')) {\n const arg = argv[optind++];\n if (arg === '-h' || arg === '--help') help();\n else if (arg === '-e' || arg === '--eval') { if (optind >= argv.length) help(); expr.push(argv[optind++]); }\n else if (arg === '-i' || arg === '--interactive') interactive = true;\n else if (arg === '-d' || arg === '--dump') dump = true;\n else if (arg === '--strict') strict = true;\n else if (arg === '-q' || arg === '--quit') quit = true;\n else if (arg === '--') break;\n else { console.error(`qjs: unknown option '${arg}'`); help(); }\n }\n const rt = JS_NewRuntime();\n JS_SetMaxStackSize(rt, 1000);\n const ctx = JS_NewContext(rt);\n js_std_add_helpers(ctx, argv.slice(optind));\n if (quit) return 0;\n const eval_flags = JS_EVAL_TYPE_GLOBAL | (strict ? JS_EVAL_FLAG_STRICT : 0);\n let status = 0;\n for (const e of expr) {\n if (eval_buf(ctx, e, '<cmdline>', eval_flags, dump)) status = 1;\n }\n if (optind < argv.length) {\n const filename = argv[optind];\n let buf: string;\n try {\n buf = readFileSync(filename, 'utf8');\n } catch (e) {\n console.error(`qjs: cannot load '${filename}': ${(e as Error).message}`);\n return 1;\n }\n if (eval_buf(ctx, buf, filename, eval_flags, dump)) status = 1;\n } else if (expr.length === 0) {\n interactive = true;\n }\n await js_std_loop(ctx);\n if (interactive) await repl(ctx);\n return status;\n}\n\nmain().then(code => process.exit(code), e => { console.error(e); process.exit(2); });\n"]}
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { AtomTable, JSAtom } from './atoms.ts';
|
|
2
|
+
import { JSValue, JSObject, JSSpecial, JSClassID, JSCFunction, JSCFunctionMagic, JSCFunctionData, JSCFunctionEnum, JSFunctionBytecode, JSFunctionData, JSVarRef, JSStackFrame, JSErrorEnum, JSObjectMeta } from './values.ts';
|
|
3
|
+
export * from './values.ts';
|
|
4
|
+
export * from './atoms.ts';
|
|
5
|
+
export type JSClassCall = (ctx: JSContext, func_obj: JSValue, this_val: JSValue, argv: JSValue[], flags: number) => JSValue;
|
|
6
|
+
export interface JSPropertyDescriptor {
|
|
7
|
+
flags: number;
|
|
8
|
+
value: JSValue;
|
|
9
|
+
getter: JSValue;
|
|
10
|
+
setter: JSValue;
|
|
11
|
+
}
|
|
12
|
+
export interface JSClassDef {
|
|
13
|
+
class_name: JSAtom;
|
|
14
|
+
}
|
|
15
|
+
export declare class JSClass {
|
|
16
|
+
class_id: JSClassID;
|
|
17
|
+
class_name: JSAtom;
|
|
18
|
+
constructor(class_id: JSClassID, def: JSClassDef);
|
|
19
|
+
}
|
|
20
|
+
export interface JSJobEntry {
|
|
21
|
+
job_func: (ctx: JSContext, argv: JSValue[]) => JSValue;
|
|
22
|
+
ctx: JSContext;
|
|
23
|
+
argv: JSValue[];
|
|
24
|
+
}
|
|
25
|
+
export type JSInterruptHandler = (rt: JSRuntime, opaque: any) => number;
|
|
26
|
+
export type JSHostPromiseRejectionTracker = (ctx: JSContext, promise: JSValue, reason: JSValue, is_handled: boolean, opaque: any) => void;
|
|
27
|
+
export declare const js_meta: WeakMap<object, JSObjectMeta>;
|
|
28
|
+
export declare const js_privates: WeakMap<object, Map<symbol, JSValue>>;
|
|
29
|
+
export declare const js_direct: WeakMap<Function, Function>;
|
|
30
|
+
export declare function js_get_meta(obj: JSValue): JSObjectMeta | undefined;
|
|
31
|
+
export declare function js_ensure_meta(obj: object, class_id?: JSClassID): JSObjectMeta;
|
|
32
|
+
export declare function JS_GetFunctionData(func: JSValue): JSFunctionData | null;
|
|
33
|
+
export declare class JSRuntime {
|
|
34
|
+
atoms: AtomTable;
|
|
35
|
+
class_array: (JSClass | null)[];
|
|
36
|
+
class_count: number;
|
|
37
|
+
current_exception: JSValue;
|
|
38
|
+
exception_pending: boolean;
|
|
39
|
+
current_stack_frame: JSStackFrame | null;
|
|
40
|
+
interrupt_handler: JSInterruptHandler | null;
|
|
41
|
+
interrupt_opaque: any;
|
|
42
|
+
host_promise_rejection_tracker: JSHostPromiseRejectionTracker | null;
|
|
43
|
+
host_promise_rejection_tracker_opaque: any;
|
|
44
|
+
job_list: JSJobEntry[];
|
|
45
|
+
module_normalize_func: any;
|
|
46
|
+
module_loader_func: any;
|
|
47
|
+
module_loader_opaque: any;
|
|
48
|
+
stack_depth: number;
|
|
49
|
+
max_stack_depth: number;
|
|
50
|
+
user_opaque: any;
|
|
51
|
+
global_symbol_registry: Map<string, symbol>;
|
|
52
|
+
can_block: boolean;
|
|
53
|
+
context_list: JSContext[];
|
|
54
|
+
interrupt_counter: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class JSContext {
|
|
57
|
+
rt: JSRuntime;
|
|
58
|
+
class_proto: (JSObject | null)[];
|
|
59
|
+
function_proto: JSObject | null;
|
|
60
|
+
function_ctor: JSObject | null;
|
|
61
|
+
array_ctor: JSObject | null;
|
|
62
|
+
regexp_ctor: JSObject | null;
|
|
63
|
+
promise_ctor: JSObject | null;
|
|
64
|
+
native_error_proto: (JSObject | null)[];
|
|
65
|
+
error_ctor: JSObject | null;
|
|
66
|
+
error_prepare_stack: JSValue;
|
|
67
|
+
error_stack_trace_limit: number;
|
|
68
|
+
iterator_proto: JSObject | null;
|
|
69
|
+
async_iterator_proto: JSObject | null;
|
|
70
|
+
array_proto_values: JSValue;
|
|
71
|
+
throw_type_error: JSObject | null;
|
|
72
|
+
eval_obj: JSValue;
|
|
73
|
+
global_obj: JSObject;
|
|
74
|
+
plain_object_proto: {
|
|
75
|
+
ok: boolean;
|
|
76
|
+
};
|
|
77
|
+
global_var_obj: Record<string | symbol, JSValue>;
|
|
78
|
+
user_opaque: any;
|
|
79
|
+
loaded_modules: Map<string, any>;
|
|
80
|
+
interrupt_counter: number;
|
|
81
|
+
array_iterator_proto: JSObject | null;
|
|
82
|
+
generator_proto: JSObject | null;
|
|
83
|
+
async_generator_proto: JSObject | null;
|
|
84
|
+
constructor(rt: JSRuntime);
|
|
85
|
+
}
|
|
86
|
+
export interface JSHooks {
|
|
87
|
+
JS_CallInternal: (ctx: JSContext, func_obj: JSValue, this_obj: JSValue, new_target: JSValue, argv: JSValue[], flags: number) => JSValue;
|
|
88
|
+
JS_EvalInternal: (ctx: JSContext, this_obj: JSValue, input: string, filename: string, flags: number, scope_idx: number) => JSValue;
|
|
89
|
+
JS_AddIntrinsicBaseObjects: (ctx: JSContext) => void;
|
|
90
|
+
js_closure: (ctx: JSContext, bfunc: JSFunctionBytecode, cur_var_refs: JSVarRef[] | null, sf: JSStackFrame | null) => JSValue;
|
|
91
|
+
js_regexp_constructor_internal: ((ctx: JSContext, ctor: JSValue, pattern: string, flags: string) => JSValue) | null;
|
|
92
|
+
js_borrow_native: (ctx: JSContext, host: Function, name: string, length: number, fix: JSNativeFixer | null) => JSValue;
|
|
93
|
+
init_runtime: ((rt: JSRuntime) => void)[];
|
|
94
|
+
}
|
|
95
|
+
export declare const hooks: JSHooks;
|
|
96
|
+
export declare function JS_NewClass1(rt: JSRuntime, class_id: JSClassID, def: JSClassDef): void;
|
|
97
|
+
export declare function JS_NewClass(rt: JSRuntime, class_id: JSClassID, def: JSClassDef): number;
|
|
98
|
+
export declare function JS_NewClassID(): JSClassID;
|
|
99
|
+
export declare function JS_IsRegisteredClass(rt: JSRuntime, class_id: JSClassID): boolean;
|
|
100
|
+
export declare function JS_NewRuntime(): JSRuntime;
|
|
101
|
+
export declare function JS_FreeRuntime(rt: JSRuntime): void;
|
|
102
|
+
export declare function JS_SetRuntimeOpaque(rt: JSRuntime, opaque: any): void;
|
|
103
|
+
export declare function JS_GetRuntimeOpaque(rt: JSRuntime): any;
|
|
104
|
+
export declare function JS_SetContextOpaque(ctx: JSContext, opaque: any): void;
|
|
105
|
+
export declare function JS_GetContextOpaque(ctx: JSContext): any;
|
|
106
|
+
export declare function JS_GetRuntime(ctx: JSContext): JSRuntime;
|
|
107
|
+
export declare function JS_SetMaxStackSize(rt: JSRuntime, depth: number): void;
|
|
108
|
+
export declare function JS_SetInterruptHandler(rt: JSRuntime, cb: JSInterruptHandler | null, opaque: any): void;
|
|
109
|
+
export declare function JS_SetHostPromiseRejectionTracker(rt: JSRuntime, cb: JSHostPromiseRejectionTracker | null, opaque: any): void;
|
|
110
|
+
export declare function JS_NewContextRaw(rt: JSRuntime): JSContext;
|
|
111
|
+
export declare function JS_NewContext(rt: JSRuntime): JSContext;
|
|
112
|
+
export declare function JS_FreeContext(ctx: JSContext): void;
|
|
113
|
+
export declare function JS_GetClassProto(ctx: JSContext, class_id: JSClassID): JSValue;
|
|
114
|
+
export declare function JS_SetClassProto(ctx: JSContext, class_id: JSClassID, obj: JSValue): void;
|
|
115
|
+
export declare function JS_GetGlobalObject(ctx: JSContext): JSValue;
|
|
116
|
+
export declare function JS_NewAtom(ctx: JSContext, str: string): JSAtom;
|
|
117
|
+
export declare function JS_NewAtomStr(ctx: JSContext, str: string): JSAtom;
|
|
118
|
+
export declare function JS_NewAtomUInt32(ctx: JSContext, n: number): JSAtom;
|
|
119
|
+
export declare function JS_NewAtomInt64(ctx: JSContext, n: number): JSAtom;
|
|
120
|
+
export declare function JS_DupAtom(_ctx: JSContext, v: JSAtom): JSAtom;
|
|
121
|
+
export declare function JS_FreeAtom(_ctx: JSContext, _v: JSAtom): void;
|
|
122
|
+
export declare function JS_FreeValue(_ctx: JSContext, _v: JSValue): void;
|
|
123
|
+
export declare function JS_DupValue(_ctx: JSContext, v: JSValue): JSValue;
|
|
124
|
+
export declare function JS_AtomIsString(ctx: JSContext, atom: JSAtom): boolean;
|
|
125
|
+
export declare function JS_AtomIsSymbol(ctx: JSContext, atom: JSAtom): boolean;
|
|
126
|
+
export declare function JS_AtomGetStr(ctx: JSContext, atom: JSAtom): string;
|
|
127
|
+
export declare function JS_AtomGetStrRT(rt: JSRuntime, atom: JSAtom): string;
|
|
128
|
+
export type JSPropertyKey = string | number | symbol;
|
|
129
|
+
export declare function JS_AtomToKey(ctx: JSContext, atom: JSAtom): JSPropertyKey;
|
|
130
|
+
export declare function JS_KeyToAtom(ctx: JSContext, key: JSPropertyKey): JSAtom;
|
|
131
|
+
export declare function JS_AtomToValue(ctx: JSContext, atom: JSAtom): JSValue;
|
|
132
|
+
export declare function JS_AtomToString(ctx: JSContext, atom: JSAtom): string;
|
|
133
|
+
export declare function JS_AtomIsArrayIndex(ctx: JSContext, atom: JSAtom): number;
|
|
134
|
+
export declare function JS_AtomIsNumericIndex1(ctx: JSContext, atom: JSAtom): JSValue;
|
|
135
|
+
export declare function JS_AtomIsNumericIndex(ctx: JSContext, atom: JSAtom): boolean;
|
|
136
|
+
export declare function JS_ValueToAtom(ctx: JSContext, val: JSValue): JSAtom;
|
|
137
|
+
export declare function JS_NewSymbol(ctx: JSContext, description: string | undefined, atom_type?: number): symbol;
|
|
138
|
+
export declare function JS_NewSymbolFromAtom(ctx: JSContext, descr: JSAtom, atom_type: number): symbol;
|
|
139
|
+
export declare function JS_Throw(ctx: JSContext, obj: JSValue): JSValue;
|
|
140
|
+
export declare function JS_GetException(ctx: JSContext): JSValue;
|
|
141
|
+
export declare function JS_HasException(ctx: JSContext): boolean;
|
|
142
|
+
export declare function js_take_exception(ctx: JSContext): JSValue;
|
|
143
|
+
export declare function js_normalize_host_message(e: Error): string;
|
|
144
|
+
export declare function js_host_exception_to_guest(ctx: JSContext, e: unknown): JSValue;
|
|
145
|
+
export declare function JS_IsError(ctx: JSContext, val: JSValue): boolean;
|
|
146
|
+
export declare function JS_IsUncatchableError(ctx: JSContext, val: JSValue): boolean;
|
|
147
|
+
export declare function JS_SetUncatchableError(ctx: JSContext, val: JSValue, flag: boolean): void;
|
|
148
|
+
export declare function JS_NewError(ctx: JSContext): JSValue;
|
|
149
|
+
export declare function JS_NewErrorNative(ctx: JSContext, error_num: JSErrorEnum, message: string): JSObject;
|
|
150
|
+
export declare const JS_BACKTRACE_FLAG_SKIP_FIRST_LEVEL: number;
|
|
151
|
+
export declare function build_backtrace(ctx: JSContext, error_obj: JSValue, filename: string | null, line_num: number, col_num: number, backtrace_flags: number, host_stack?: string | null): void;
|
|
152
|
+
export declare function get_func_name(ctx: JSContext, func: JSObject): string;
|
|
153
|
+
export declare function find_line_num(ctx: JSContext, b: JSFunctionBytecode, pc_value: number): [number, number];
|
|
154
|
+
export declare function get_leb128(buf: Uint8Array, pos: number): [number, number];
|
|
155
|
+
export declare function get_sleb128(buf: Uint8Array, pos: number): [number, number];
|
|
156
|
+
export declare function JS_ThrowError2(ctx: JSContext, error_num: JSErrorEnum, message: string, add_backtrace: boolean, host_stack?: string | null): JSValue;
|
|
157
|
+
export declare function JS_ThrowError(ctx: JSContext, error_num: JSErrorEnum, message: string): JSValue;
|
|
158
|
+
export declare function JS_ThrowSyntaxError(ctx: JSContext, msg: string): JSValue;
|
|
159
|
+
export declare function JS_ThrowTypeError(ctx: JSContext, msg: string): JSValue;
|
|
160
|
+
export declare function JS_ThrowReferenceError(ctx: JSContext, msg: string): JSValue;
|
|
161
|
+
export declare function JS_ThrowRangeError(ctx: JSContext, msg: string): JSValue;
|
|
162
|
+
export declare function JS_ThrowInternalError(ctx: JSContext, msg: string): JSValue;
|
|
163
|
+
export declare function JS_ThrowURIError(ctx: JSContext, msg: string): JSValue;
|
|
164
|
+
export declare function JS_ThrowEvalError(ctx: JSContext, msg: string): JSValue;
|
|
165
|
+
export declare function JS_ThrowOutOfMemory(ctx: JSContext): JSValue;
|
|
166
|
+
export declare function JS_ThrowStackOverflow(ctx: JSContext): JSValue;
|
|
167
|
+
export declare function JS_ThrowTypeErrorAtom(ctx: JSContext, fmt: string, atom: JSAtom): JSValue;
|
|
168
|
+
export declare function JS_ThrowSyntaxErrorAtom(ctx: JSContext, fmt: string, atom: JSAtom): JSValue;
|
|
169
|
+
export declare function JS_ThrowReferenceErrorNotDefined(ctx: JSContext, name: JSAtom): JSValue;
|
|
170
|
+
export declare function JS_ThrowReferenceErrorUninitialized(ctx: JSContext, name: JSAtom): JSValue;
|
|
171
|
+
export declare function JS_ThrowReferenceErrorUninitialized2(ctx: JSContext, b: JSFunctionBytecode, idx: number, is_ref: boolean): JSValue;
|
|
172
|
+
export declare function JS_ThrowTypeErrorReadOnly(ctx: JSContext, flags: number, atom: JSAtom): number;
|
|
173
|
+
export declare function JS_ThrowTypeErrorNotAnObject(ctx: JSContext): JSValue;
|
|
174
|
+
export declare function JS_ThrowTypeErrorNotASymbol(ctx: JSContext): JSValue;
|
|
175
|
+
export declare function JS_ThrowTypeErrorInvalidClass(ctx: JSContext, class_id: JSClassID): JSValue;
|
|
176
|
+
export declare function JS_ThrowTypeErrorNotAFunction(ctx: JSContext): JSValue;
|
|
177
|
+
export declare function is_strict_mode(ctx: JSContext): boolean;
|
|
178
|
+
export declare class JSInternalError extends Error {
|
|
179
|
+
}
|
|
180
|
+
export declare function JS_NewObjectProtoClass(ctx: JSContext, proto: JSValue | null, class_id: JSClassID): JSValue;
|
|
181
|
+
export declare function JS_NewObjectClass(ctx: JSContext, class_id: JSClassID): JSValue;
|
|
182
|
+
export declare function JS_NewObjectProto(ctx: JSContext, proto: JSValue | null): JSValue;
|
|
183
|
+
export declare function JS_NewObject(ctx: JSContext): JSValue;
|
|
184
|
+
export declare function JS_NewArray(ctx: JSContext): JSValue;
|
|
185
|
+
export declare function js_create_array(ctx: JSContext, values: JSValue[]): JSValue;
|
|
186
|
+
export declare function JS_NewArrayFrom(ctx: JSContext, values: JSValue[]): JSValue;
|
|
187
|
+
export declare function js_get_fast_array(ctx: JSContext, obj: JSValue): JSValue[] | null;
|
|
188
|
+
export declare function JS_SetOpaque(obj: JSValue, opaque: any): number;
|
|
189
|
+
export declare function JS_GetOpaque(obj: JSValue, class_id: JSClassID): any;
|
|
190
|
+
export declare function JS_GetOpaque2(ctx: JSContext, obj: JSValue, class_id: JSClassID): any;
|
|
191
|
+
export declare function JS_GetAnyOpaque(obj: JSValue): any;
|
|
192
|
+
export declare function JS_GetClassID(v: JSValue): JSClassID;
|
|
193
|
+
export type JSHostImpl = (this_val: JSValue, new_target: JSValue, args: JSValue[]) => JSValue;
|
|
194
|
+
export declare function js_new_host_function(ctx: JSContext, impl: JSHostImpl, is_ctor: boolean, name: string, length: number, proto: JSValue | null, class_id: JSClassID): object;
|
|
195
|
+
export declare function js_init_host_function(ctx: JSContext, f: Function, is_ctor: boolean, name: string, length: number, proto: JSValue | null, class_id: JSClassID): JSObjectMeta;
|
|
196
|
+
export declare function JS_IsFunction(ctx: JSContext, val: JSValue): boolean;
|
|
197
|
+
export declare function JS_IsConstructor(ctx: JSContext, val: JSValue): boolean;
|
|
198
|
+
export declare function JS_SetConstructorBit(ctx: JSContext, func_obj: JSValue, val: boolean): boolean;
|
|
199
|
+
export declare function JS_IsArray(ctx: JSContext, val: JSValue): number;
|
|
200
|
+
export declare function JS_NewCFunction3(ctx: JSContext, func: Function, name: string, length: number, cproto: JSCFunctionEnum, magic: number, proto_val: JSValue): JSValue;
|
|
201
|
+
export declare function JS_NewCFunction2(ctx: JSContext, func: Function, name: string, length: number, cproto: JSCFunctionEnum, magic: number): JSValue;
|
|
202
|
+
export declare function JS_NewCFunction(ctx: JSContext, func: JSCFunction, name: string, length: number): JSValue;
|
|
203
|
+
export declare function JS_NewCFunctionMagic(ctx: JSContext, func: JSCFunctionMagic, name: string, length: number, cproto: JSCFunctionEnum, magic: number): JSValue;
|
|
204
|
+
export declare function JS_NewCFunctionData(ctx: JSContext, func: JSCFunctionData, length: number, magic: number, data: JSValue[]): JSValue;
|
|
205
|
+
export declare function js_c_function_data_call(ctx: JSContext, func_obj: JSValue, this_val: JSValue, argv: JSValue[], flags: number): JSValue;
|
|
206
|
+
export declare function js_call_c_function(ctx: JSContext, func_obj: JSValue, this_obj: JSValue, argv: JSValue[], flags: number): JSValue;
|
|
207
|
+
export declare function js_call_host_function(ctx: JSContext, func_obj: JSValue, this_obj: JSValue, new_target: JSValue, argv: JSValue[], flags: number): JSValue;
|
|
208
|
+
export declare function JS_Call(ctx: JSContext, func_obj: JSValue, this_obj: JSValue, argv: JSValue[]): JSValue;
|
|
209
|
+
export declare function JS_CallFree(ctx: JSContext, func_obj: JSValue, this_obj: JSValue, argv: JSValue[]): JSValue;
|
|
210
|
+
export declare function JS_CallConstructorInternal(ctx: JSContext, func_obj: JSValue, new_target: JSValue, argv: JSValue[], flags: number): JSValue;
|
|
211
|
+
export declare function JS_CallConstructor2(ctx: JSContext, func_obj: JSValue, new_target: JSValue, argv: JSValue[]): JSValue;
|
|
212
|
+
export declare function JS_CallConstructor(ctx: JSContext, func_obj: JSValue, argv: JSValue[]): JSValue;
|
|
213
|
+
export declare function JS_Invoke(ctx: JSContext, this_val: JSValue, atom: JSAtom, argv: JSValue[]): JSValue;
|
|
214
|
+
export declare function JS_GetFunctionRealm(ctx: JSContext, func_obj: JSValue): JSContext;
|
|
215
|
+
export declare function js_create_from_ctor(ctx: JSContext, ctor: JSValue, class_id: JSClassID): JSValue;
|
|
216
|
+
export declare function js_proto_from_ctor(ctx: JSContext, ctor: JSValue, class_id: JSClassID): JSValue;
|
|
217
|
+
export declare function js_new_primitive_wrapper(ctx: JSContext, proto: JSValue | null, class_id: JSClassID, value: JSValue): JSValue;
|
|
218
|
+
export declare function js_create_wrapper_from_ctor(ctx: JSContext, ctor: JSValue, class_id: JSClassID, value: JSValue): JSValue;
|
|
219
|
+
export declare function JS_SetConstructor2(ctx: JSContext, func_obj: JSValue, proto: JSValue, proto_flags: number, ctor_flags: number): void;
|
|
220
|
+
export declare function JS_SetConstructor(ctx: JSContext, func_obj: JSValue, proto: JSValue): void;
|
|
221
|
+
export declare function JS_NewGlobalCConstructor2(ctx: JSContext, func_obj: JSValue, name: string, proto: JSValue): JSValue;
|
|
222
|
+
export declare function JS_NewGlobalCConstructor(ctx: JSContext, name: string, func: Function, length: number, proto: JSValue): JSValue;
|
|
223
|
+
export declare function JS_NewGlobalCConstructorOnly(ctx: JSContext, name: string, func: Function, length: number, proto: JSValue): JSValue;
|
|
224
|
+
export declare const enum JSDefKind {
|
|
225
|
+
CFUNC = 0,
|
|
226
|
+
CGETSET = 1,
|
|
227
|
+
CGETSET_MAGIC = 2,
|
|
228
|
+
PROP_STRING = 3,
|
|
229
|
+
PROP_INT32 = 4,
|
|
230
|
+
PROP_INT64 = 5,
|
|
231
|
+
PROP_DOUBLE = 6,
|
|
232
|
+
PROP_UNDEFINED = 7,
|
|
233
|
+
OBJECT = 8,
|
|
234
|
+
ALIAS = 9,
|
|
235
|
+
NATIVE = 10,
|
|
236
|
+
NATIVE_GETSET = 11
|
|
237
|
+
}
|
|
238
|
+
export type JSNativeFixer = (ctx: JSContext, v: any) => any;
|
|
239
|
+
export declare function JS_NATIVE_DEF(name: string | JSAtom, length: number, host: Function, fix?: JSNativeFixer | null): JSCFunctionListEntry;
|
|
240
|
+
export declare function JS_NATIVE_GETSET_DEF(name: string | JSAtom, get: Function | null, set: Function | null, fix?: JSNativeFixer | null): JSCFunctionListEntry;
|
|
241
|
+
export interface JSCFunctionListEntry {
|
|
242
|
+
name: string | JSAtom;
|
|
243
|
+
prop_flags: number;
|
|
244
|
+
def_type: JSDefKind;
|
|
245
|
+
magic: number;
|
|
246
|
+
u: any;
|
|
247
|
+
}
|
|
248
|
+
export declare function JS_CFUNC_DEF(name: string | JSAtom, length: number, func: Function): JSCFunctionListEntry;
|
|
249
|
+
export declare function JS_CFUNC_MAGIC_DEF(name: string | JSAtom, length: number, func: Function, magic: number): JSCFunctionListEntry;
|
|
250
|
+
export declare function JS_CFUNC_SPECIAL_DEF(name: string | JSAtom, length: number, cproto: JSCFunctionEnum, func: Function): JSCFunctionListEntry;
|
|
251
|
+
export declare function JS_ITERATOR_NEXT_DEF(name: string | JSAtom, length: number, func: Function, magic: number): JSCFunctionListEntry;
|
|
252
|
+
export declare function JS_CGETSET_DEF(name: string | JSAtom, fgetter: Function | null, fsetter: Function | null): JSCFunctionListEntry;
|
|
253
|
+
export declare function JS_CGETSET_MAGIC_DEF(name: string | JSAtom, fgetter: Function | null, fsetter: Function | null, magic: number): JSCFunctionListEntry;
|
|
254
|
+
export declare function JS_CGETSET_ENUMERABLE_DEF(name: string | JSAtom, fgetter: Function | null, fsetter: Function | null): JSCFunctionListEntry;
|
|
255
|
+
export declare function JS_PROP_STRING_DEF(name: string | JSAtom, cstr: string, prop_flags: number): JSCFunctionListEntry;
|
|
256
|
+
export declare function JS_PROP_INT32_DEF(name: string | JSAtom, val: number, prop_flags: number): JSCFunctionListEntry;
|
|
257
|
+
export declare function JS_PROP_INT64_DEF(name: string | JSAtom, val: number, prop_flags: number): JSCFunctionListEntry;
|
|
258
|
+
export declare function JS_PROP_DOUBLE_DEF(name: string | JSAtom, val: number, prop_flags: number): JSCFunctionListEntry;
|
|
259
|
+
export declare function JS_PROP_UNDEFINED_DEF(name: string | JSAtom, prop_flags: number): JSCFunctionListEntry;
|
|
260
|
+
export declare function JS_OBJECT_DEF(name: string | JSAtom, tab: JSCFunctionListEntry[], prop_flags: number): JSCFunctionListEntry;
|
|
261
|
+
export declare function JS_ALIAS_DEF(name: string | JSAtom, from: string): JSCFunctionListEntry;
|
|
262
|
+
export declare function JS_ALIAS_BASE_DEF(name: string | JSAtom, from: string, base: number): JSCFunctionListEntry;
|
|
263
|
+
export declare function JS_InstantiateFunctionListItem(ctx: JSContext, obj: JSValue, atom: JSAtom, e: JSCFunctionListEntry): number;
|
|
264
|
+
export declare function JS_SetPropertyFunctionList(ctx: JSContext, obj: JSValue, tab: JSCFunctionListEntry[]): void;
|
|
265
|
+
export declare function is_typed_array(class_id: JSClassID): boolean;
|
|
266
|
+
export declare function JS_ThrowTypeErrorOrFalse(ctx: JSContext, flags: number, msg: string): number;
|
|
267
|
+
export declare function check_define_prop_flags(prop_flags: number, flags: number): boolean;
|
|
268
|
+
export declare function JS_GetOwnPropertyInternal(ctx: JSContext, desc: JSPropertyDescriptor | null, p: JSObject, prop: JSAtom): number;
|
|
269
|
+
export declare function JS_GetOwnProperty(ctx: JSContext, desc: JSPropertyDescriptor | null, obj: JSValue, prop: JSAtom): number;
|
|
270
|
+
export declare function new_desc(): JSPropertyDescriptor;
|
|
271
|
+
export declare function JS_GetPrototypePrimitive(ctx: JSContext, val: JSValue): JSObject | null;
|
|
272
|
+
export declare function JS_GetPrototype(ctx: JSContext, obj: JSValue): JSValue;
|
|
273
|
+
export declare function JS_GetPrototypeFree(ctx: JSContext, obj: JSValue): JSValue;
|
|
274
|
+
export declare function JS_GetPropertyInternal(ctx: JSContext, obj: JSValue, prop: JSAtom, this_obj: JSValue, throw_ref_error: boolean): JSValue;
|
|
275
|
+
export declare function JS_GetProperty(ctx: JSContext, this_obj: JSValue, prop: JSAtom): JSValue;
|
|
276
|
+
export declare function JS_GetPropertyStr(ctx: JSContext, this_obj: JSValue, prop: string): JSValue;
|
|
277
|
+
export declare function JS_GetPropertyUint32(ctx: JSContext, this_obj: JSValue, idx: number): JSValue;
|
|
278
|
+
export declare function JS_GetPropertyInt64(ctx: JSContext, this_obj: JSValue, idx: number): JSValue;
|
|
279
|
+
export declare function JS_GetPropertyValue(ctx: JSContext, this_obj: JSValue, prop: JSValue): JSValue;
|
|
280
|
+
export declare function JS_HasProperty(ctx: JSContext, obj: JSValue, prop: JSAtom): number;
|
|
281
|
+
export declare function JS_IsExtensible(ctx: JSContext, obj: JSValue): number;
|
|
282
|
+
export declare function JS_PreventExtensions(ctx: JSContext, obj: JSValue): number;
|
|
283
|
+
export declare function JS_SetPrototypeInternal(ctx: JSContext, obj: JSValue, proto_val: JSValue, throw_flag: boolean): number;
|
|
284
|
+
export declare function JS_SetPrototype(ctx: JSContext, obj: JSValue, proto_val: JSValue): number;
|
|
285
|
+
export declare function js_is_host_error(e: unknown): boolean;
|
|
286
|
+
export declare function JS_SetPropertyInternal(ctx: JSContext, obj: JSValue, prop: JSAtom, val: JSValue, this_obj: JSValue, flags: number): number;
|
|
287
|
+
export declare function JS_SetProperty(ctx: JSContext, this_obj: JSValue, prop: JSAtom, val: JSValue): number;
|
|
288
|
+
export declare function JS_SetPropertyStr(ctx: JSContext, this_obj: JSValue, prop: string, val: JSValue): number;
|
|
289
|
+
export declare function JS_SetPropertyUint32(ctx: JSContext, this_obj: JSValue, idx: number, val: JSValue): number;
|
|
290
|
+
export declare function JS_SetPropertyInt64(ctx: JSContext, this_obj: JSValue, idx: number, val: JSValue): number;
|
|
291
|
+
export declare function JS_SetPropertyValue(ctx: JSContext, this_obj: JSValue, prop: JSValue, val: JSValue, flags: number): number;
|
|
292
|
+
export declare function JS_CreateDataPropertyUint32(ctx: JSContext, this_obj: JSValue, index: number, val: JSValue, flags: number): number;
|
|
293
|
+
export declare function JS_DefineProperty(ctx: JSContext, this_obj: JSValue, prop: JSAtom, val: JSValue, getter: JSValue, setter: JSValue, flags: number): number;
|
|
294
|
+
export declare function JS_DefinePropertyValue(ctx: JSContext, this_obj: JSValue, prop: JSAtom, val: JSValue, flags: number): number;
|
|
295
|
+
export declare function JS_DefinePropertyValueValue(ctx: JSContext, this_obj: JSValue, prop: JSValue, val: JSValue, flags: number): number;
|
|
296
|
+
export declare function JS_DefinePropertyValueUint32(ctx: JSContext, this_obj: JSValue, idx: number, val: JSValue, flags: number): number;
|
|
297
|
+
export declare function JS_DefinePropertyValueInt64(ctx: JSContext, this_obj: JSValue, idx: number, val: JSValue, flags: number): number;
|
|
298
|
+
export declare function JS_DefinePropertyValueStr(ctx: JSContext, this_obj: JSValue, prop: string, val: JSValue, flags: number): number;
|
|
299
|
+
export declare function JS_DefinePropertyGetSet(ctx: JSContext, this_obj: JSValue, prop: JSAtom, getter: JSValue, setter: JSValue, flags: number): number;
|
|
300
|
+
export declare function delete_property(ctx: JSContext, p: JSObject, atom: JSAtom): number;
|
|
301
|
+
export declare function JS_DeleteProperty(ctx: JSContext, obj: JSValue, prop: JSAtom, flags: number): number;
|
|
302
|
+
export declare function JS_DeletePropertyInt64(ctx: JSContext, obj: JSValue, idx: number, flags: number): number;
|
|
303
|
+
export interface JSPropertyEnum {
|
|
304
|
+
atom: JSAtom;
|
|
305
|
+
is_enumerable: boolean;
|
|
306
|
+
}
|
|
307
|
+
export declare function JS_GetOwnPropertyNamesInternal(ctx: JSContext, p: JSObject, flags: number): JSPropertyEnum[] | null;
|
|
308
|
+
export declare function JS_GetOwnPropertyNames(ctx: JSContext, obj: JSValue, flags: number): JSPropertyEnum[] | null;
|
|
309
|
+
export declare function JS_FromPropertyDescriptor(ctx: JSContext, d: JSPropertyDescriptor): JSValue;
|
|
310
|
+
export declare function js_obj_to_desc(ctx: JSContext, d: JSPropertyDescriptor, desc: JSValue): number;
|
|
311
|
+
export declare function js_get_length64(ctx: JSContext, obj: JSValue): number;
|
|
312
|
+
export declare const js_get_length32: typeof js_get_length64;
|
|
313
|
+
export declare function js_set_length64(ctx: JSContext, obj: JSValue, len: number): number;
|
|
314
|
+
export declare const DEFINE_GLOBAL_LEX_VAR: number;
|
|
315
|
+
export declare const DEFINE_GLOBAL_FUNC_VAR: number;
|
|
316
|
+
export declare function JS_CheckDefineGlobalVar(ctx: JSContext, prop: JSAtom, flags: number): number;
|
|
317
|
+
export declare function JS_DefineGlobalVar(ctx: JSContext, prop: JSAtom, def_flags: number): number;
|
|
318
|
+
export declare function JS_DefineGlobalFunction(ctx: JSContext, prop: JSAtom, func: JSValue, def_flags: number): number;
|
|
319
|
+
export declare function JS_GetGlobalVar(ctx: JSContext, prop: JSAtom, throw_ref_error: number): JSValue;
|
|
320
|
+
export declare function JS_GetGlobalVarRef(ctx: JSContext, prop: JSAtom): [JSValue, JSValue] | null;
|
|
321
|
+
export declare function JS_CheckGlobalVar(ctx: JSContext, prop: JSAtom): number;
|
|
322
|
+
export declare function JS_SetGlobalVar(ctx: JSContext, prop: JSAtom, val: JSValue, flag: number): number;
|
|
323
|
+
export declare const HINT_STRING = 0;
|
|
324
|
+
export declare const HINT_NUMBER = 1;
|
|
325
|
+
export declare const HINT_NONE = 2;
|
|
326
|
+
export declare const HINT_FORCE_ORDINARY: number;
|
|
327
|
+
export declare function JS_ToPrimitiveFree(ctx: JSContext, val: JSValue, hint: number): JSValue;
|
|
328
|
+
export declare function JS_ToPrimitive(ctx: JSContext, val: JSValue, hint: number): JSValue;
|
|
329
|
+
export declare function JS_ToBoolFree(ctx: JSContext, val: JSValue): boolean;
|
|
330
|
+
export declare const JS_ToBool: typeof JS_ToBoolFree;
|
|
331
|
+
export declare function js_atof(ctx: JSContext, str: string): number;
|
|
332
|
+
export declare function JS_ToNumberFree(ctx: JSContext, val: JSValue): JSValue;
|
|
333
|
+
export declare const JS_ToNumber: typeof JS_ToNumberFree;
|
|
334
|
+
export declare function JS_ToNumericFree(ctx: JSContext, val: JSValue): JSValue;
|
|
335
|
+
export declare const JS_ToNumeric: typeof JS_ToNumericFree;
|
|
336
|
+
export declare function JS_ToFloat64(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
337
|
+
export declare function JS_ToInt32Free(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
338
|
+
export declare const JS_ToInt32: typeof JS_ToInt32Free;
|
|
339
|
+
export declare function JS_ToUint32Free(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
340
|
+
export declare const JS_ToUint32: typeof JS_ToUint32Free;
|
|
341
|
+
export declare function JS_ToInt32Clamp(ctx: JSContext, val: JSValue, min_val: number, max_val: number, neg_offset: number): number | JSSpecial;
|
|
342
|
+
export declare function JS_ToInt32Sat(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
343
|
+
export declare function JS_ToInt64Sat(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
344
|
+
export declare function JS_ToInt64Clamp(ctx: JSContext, val: JSValue, min_val: number, max_val: number, neg_offset: number): number | JSSpecial;
|
|
345
|
+
export declare function JS_ToInt64Free(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
346
|
+
export declare const JS_ToInt64: typeof JS_ToInt64Free;
|
|
347
|
+
export declare function JS_ToIndex(ctx: JSContext, val: JSValue): number;
|
|
348
|
+
export declare function JS_ToLengthFree(ctx: JSContext, val: JSValue): number;
|
|
349
|
+
export declare function JS_ToArrayLengthFree(ctx: JSContext, val: JSValue, is_array_ctor: boolean): number;
|
|
350
|
+
export declare function JS_ToUint8ClampFree(ctx: JSContext, val: JSValue): number | JSSpecial;
|
|
351
|
+
export declare function JS_ToBigIntFree(ctx: JSContext, val: JSValue): JSValue;
|
|
352
|
+
export declare const JS_ToBigInt: typeof JS_ToBigIntFree;
|
|
353
|
+
export declare function js_string_to_bigint(str: string): bigint | null;
|
|
354
|
+
export declare function JS_NewBigInt64(ctx: JSContext, v: bigint | number): JSValue;
|
|
355
|
+
export declare function JS_NewBigUint64(ctx: JSContext, v: bigint | number): JSValue;
|
|
356
|
+
export declare function JS_ToBigInt64(ctx: JSContext, val: JSValue): bigint | JSSpecial;
|
|
357
|
+
export declare function js_number_to_string(d: number, radix: number): string;
|
|
358
|
+
export declare function js_dtoa(d: number): string;
|
|
359
|
+
export declare function JS_ToStringInternal(ctx: JSContext, val: JSValue, is_ToPropertyKey: boolean): JSValue;
|
|
360
|
+
export declare function JS_ToString(ctx: JSContext, val: JSValue): JSValue;
|
|
361
|
+
export declare const JS_ToStringFree: typeof JS_ToString;
|
|
362
|
+
export declare function JS_ToCString(ctx: JSContext, val: JSValue): string | null;
|
|
363
|
+
export declare function JS_ToPropertyKey(ctx: JSContext, val: JSValue): JSValue;
|
|
364
|
+
export declare function JS_ToQuotedString(ctx: JSContext, val: JSValue): JSValue;
|
|
365
|
+
export declare function js_quote_string(s: string): string;
|
|
366
|
+
export declare function JS_ToObject(ctx: JSContext, val: JSValue): JSValue;
|
|
367
|
+
export declare const JS_ToObjectFree: typeof JS_ToObject;
|
|
368
|
+
export declare function JS_ThisObjectData(ctx: JSContext, this_val: JSValue, class_id: JSClassID): JSValue;
|
|
369
|
+
export declare function js_same_value(ctx: JSContext, op1: JSValue, op2: JSValue): boolean;
|
|
370
|
+
export declare function js_same_value_zero(ctx: JSContext, op1: JSValue, op2: JSValue): boolean;
|
|
371
|
+
export declare const enum JSStrictEqMode {
|
|
372
|
+
STRICT = 0,
|
|
373
|
+
SAME_VALUE = 1,
|
|
374
|
+
SAME_VALUE_ZERO = 2
|
|
375
|
+
}
|
|
376
|
+
export declare function js_strict_eq2(ctx: JSContext, op1: JSValue, op2: JSValue, eq_mode: JSStrictEqMode): boolean;
|
|
377
|
+
export declare function js_strict_eq(ctx: JSContext, op1: JSValue, op2: JSValue): boolean;
|
|
378
|
+
export declare function js_loose_eq(ctx: JSContext, op1: JSValue, op2: JSValue): number;
|
|
379
|
+
export declare const enum JSRelOp {
|
|
380
|
+
LT = 0,
|
|
381
|
+
LTE = 1,
|
|
382
|
+
GT = 2,
|
|
383
|
+
GTE = 3
|
|
384
|
+
}
|
|
385
|
+
export declare function js_relational_op(ctx: JSContext, op: JSRelOp, op1: JSValue, op2: JSValue): number;
|
|
386
|
+
export declare function JS_OrdinaryIsInstanceOf(ctx: JSContext, val: JSValue, obj: JSValue): number;
|
|
387
|
+
export declare function JS_IsInstanceOf(ctx: JSContext, val: JSValue, obj: JSValue): number;
|
|
388
|
+
export declare function js_operator_typeof(ctx: JSContext, op1: JSValue): JSAtom;
|
|
389
|
+
export declare function js_operator_in(ctx: JSContext, op1: JSValue, op2: JSValue): number;
|
|
390
|
+
export declare const enum JSArithOp {
|
|
391
|
+
ADD = 0,
|
|
392
|
+
SUB = 1,
|
|
393
|
+
MUL = 2,
|
|
394
|
+
DIV = 3,
|
|
395
|
+
MOD = 4,
|
|
396
|
+
POW = 5,
|
|
397
|
+
SHL = 6,
|
|
398
|
+
SAR = 7,
|
|
399
|
+
SHR = 8,
|
|
400
|
+
AND = 9,
|
|
401
|
+
OR = 10,
|
|
402
|
+
XOR = 11
|
|
403
|
+
}
|
|
404
|
+
export declare function js_binary_arith_slow(ctx: JSContext, op: JSArithOp, op1: JSValue, op2: JSValue): JSValue;
|
|
405
|
+
export declare function js_pow(a: number, b: number): number;
|
|
406
|
+
export declare function js_add_slow(ctx: JSContext, op1: JSValue, op2: JSValue): JSValue;
|
|
407
|
+
export declare const enum JSUnaryOp {
|
|
408
|
+
NEG = 0,
|
|
409
|
+
PLUS = 1,
|
|
410
|
+
INC = 2,
|
|
411
|
+
DEC = 3,
|
|
412
|
+
NOT = 4
|
|
413
|
+
}
|
|
414
|
+
export declare function js_unary_arith_slow(ctx: JSContext, op: JSUnaryOp, op1: JSValue): JSValue;
|
|
415
|
+
export declare function js_create_iterator_result(ctx: JSContext, val: JSValue, done: boolean): JSValue;
|
|
416
|
+
export declare const JS_CreateIterResultObject: typeof js_create_iterator_result;
|
|
417
|
+
export declare function JS_GetIterator2(ctx: JSContext, obj: JSValue, method: JSValue): JSValue;
|
|
418
|
+
export declare const async_hooks: {
|
|
419
|
+
JS_CreateAsyncFromSyncIterator: ((ctx: JSContext, sync_iter: JSValue) => JSValue) | null;
|
|
420
|
+
};
|
|
421
|
+
export declare function JS_GetIterator(ctx: JSContext, obj: JSValue, is_async: boolean): JSValue;
|
|
422
|
+
export declare function JS_IteratorNext2(ctx: JSContext, enum_obj: JSValue, method: JSValue, argv: JSValue[], pdone: {
|
|
423
|
+
done: number;
|
|
424
|
+
}): JSValue;
|
|
425
|
+
export declare function JS_IteratorNext(ctx: JSContext, enum_obj: JSValue, method: JSValue, argv: JSValue[], pdone: {
|
|
426
|
+
done: number;
|
|
427
|
+
}): JSValue;
|
|
428
|
+
export declare function JS_IteratorClose(ctx: JSContext, enum_obj: JSValue, is_exception_pending: boolean): number;
|
|
429
|
+
export declare function JS_IteratorGetCompleteValue(ctx: JSContext, obj: JSValue, pdone: {
|
|
430
|
+
done: number;
|
|
431
|
+
}): JSValue;
|
|
432
|
+
export declare function build_arg_list(ctx: JSContext, array_arg: JSValue): JSValue[] | null;
|
|
433
|
+
export declare function build_for_in_iterator(ctx: JSContext, obj: JSValue): JSValue;
|
|
434
|
+
export declare function js_for_in_next(ctx: JSContext, enum_obj: JSValue, pdone: {
|
|
435
|
+
done: number;
|
|
436
|
+
}): JSValue;
|
|
437
|
+
export declare function JS_EnqueueJob(ctx: JSContext, job_func: (ctx: JSContext, argv: JSValue[]) => JSValue, argv: JSValue[]): number;
|
|
438
|
+
export declare function JS_IsJobPending(rt: JSRuntime): boolean;
|
|
439
|
+
export declare function JS_ExecutePendingJob(rt: JSRuntime, pctx: {
|
|
440
|
+
ctx: JSContext | null;
|
|
441
|
+
}): number;
|
|
442
|
+
export declare function JS_EvalThis(ctx: JSContext, this_obj: JSValue, input: string, filename: string, eval_flags: number): JSValue;
|
|
443
|
+
export declare function JS_Eval(ctx: JSContext, input: string, filename: string, eval_flags: number): JSValue;
|
|
444
|
+
export declare function JS_EvalFunction(ctx: JSContext, fun_obj: JSValue): JSValue;
|
|
445
|
+
export declare function JS_RunGC(_rt: JSRuntime): void;
|
|
446
|
+
export declare function JS_NewString(ctx: JSContext, s: string): JSValue;
|
|
447
|
+
export declare function JS_NewStringLen(ctx: JSContext, s: string): JSValue;
|
|
448
|
+
export declare function JS_NewAtomString(ctx: JSContext, s: string): JSValue;
|
|
449
|
+
export declare function JS_NewBool(ctx: JSContext, v: boolean): JSValue;
|
|
450
|
+
export declare function JS_NewInt32(ctx: JSContext, v: number): JSValue;
|
|
451
|
+
export declare function JS_NewUint32(ctx: JSContext, v: number): JSValue;
|
|
452
|
+
export declare function JS_NewInt64(ctx: JSContext, v: number): JSValue;
|
|
453
|
+
export declare function JS_NewFloat64(ctx: JSContext, v: number): JSValue;
|
|
454
|
+
export declare function JS_NewCatchOffsetValue(v: number): JSValue;
|
|
455
|
+
export declare function JS_IsLiveObject(_rt: JSRuntime, obj: JSValue): boolean;
|
|
456
|
+
export declare function JS_GetClassName(ctx: JSContext, class_id: JSClassID): string;
|
|
457
|
+
export declare function js_object_class_name(ctx: JSContext, obj: JSObject): string;
|
|
458
|
+
export declare function JS_CopyDataProperties(ctx: JSContext, target: JSValue, source: JSValue, excluded: JSValue, setprop: boolean): number;
|
|
459
|
+
export declare function JS_DumpValue(ctx: JSContext, val: JSValue): string;
|
|
460
|
+
export declare function JS_SetErrorBacktraceDone(obj: JSValue): void;
|