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.
Files changed (114) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +191 -2
  3. package/dist/atoms.d.ts +255 -0
  4. package/dist/atoms.js +445 -0
  5. package/dist/atoms.js.map +1 -0
  6. package/dist/builtins/array.d.ts +3 -0
  7. package/dist/builtins/array.js +116 -0
  8. package/dist/builtins/array.js.map +1 -0
  9. package/dist/builtins/bigint.d.ts +3 -0
  10. package/dist/builtins/bigint.js +122 -0
  11. package/dist/builtins/bigint.js.map +1 -0
  12. package/dist/builtins/boolean.d.ts +2 -0
  13. package/dist/builtins/boolean.js +26 -0
  14. package/dist/builtins/boolean.js.map +1 -0
  15. package/dist/builtins/date.d.ts +3 -0
  16. package/dist/builtins/date.js +1046 -0
  17. package/dist/builtins/date.js.map +1 -0
  18. package/dist/builtins/error.d.ts +2 -0
  19. package/dist/builtins/error.js +154 -0
  20. package/dist/builtins/error.js.map +1 -0
  21. package/dist/builtins/function.d.ts +5 -0
  22. package/dist/builtins/function.js +164 -0
  23. package/dist/builtins/function.js.map +1 -0
  24. package/dist/builtins/global.d.ts +2 -0
  25. package/dist/builtins/global.js +29 -0
  26. package/dist/builtins/global.js.map +1 -0
  27. package/dist/builtins/index.d.ts +3 -0
  28. package/dist/builtins/index.js +139 -0
  29. package/dist/builtins/index.js.map +1 -0
  30. package/dist/builtins/json.d.ts +6 -0
  31. package/dist/builtins/json.js +984 -0
  32. package/dist/builtins/json.js.map +1 -0
  33. package/dist/builtins/mapset.d.ts +4 -0
  34. package/dist/builtins/mapset.js +234 -0
  35. package/dist/builtins/mapset.js.map +1 -0
  36. package/dist/builtins/math.d.ts +2 -0
  37. package/dist/builtins/math.js +62 -0
  38. package/dist/builtins/math.js.map +1 -0
  39. package/dist/builtins/native.d.ts +22 -0
  40. package/dist/builtins/native.js +250 -0
  41. package/dist/builtins/native.js.map +1 -0
  42. package/dist/builtins/number.d.ts +4 -0
  43. package/dist/builtins/number.js +76 -0
  44. package/dist/builtins/number.js.map +1 -0
  45. package/dist/builtins/object.d.ts +12 -0
  46. package/dist/builtins/object.js +575 -0
  47. package/dist/builtins/object.js.map +1 -0
  48. package/dist/builtins/promise.d.ts +13 -0
  49. package/dist/builtins/promise.js +582 -0
  50. package/dist/builtins/promise.js.map +1 -0
  51. package/dist/builtins/proxy.d.ts +3 -0
  52. package/dist/builtins/proxy.js +226 -0
  53. package/dist/builtins/proxy.js.map +1 -0
  54. package/dist/builtins/reflect.d.ts +2 -0
  55. package/dist/builtins/reflect.js +109 -0
  56. package/dist/builtins/reflect.js.map +1 -0
  57. package/dist/builtins/regexp.d.ts +2 -0
  58. package/dist/builtins/regexp.js +203 -0
  59. package/dist/builtins/regexp.js.map +1 -0
  60. package/dist/builtins/string.d.ts +4 -0
  61. package/dist/builtins/string.js +135 -0
  62. package/dist/builtins/string.js.map +1 -0
  63. package/dist/builtins/symbol.d.ts +3 -0
  64. package/dist/builtins/symbol.js +98 -0
  65. package/dist/builtins/symbol.js.map +1 -0
  66. package/dist/builtins/typedarray.d.ts +15 -0
  67. package/dist/builtins/typedarray.js +1838 -0
  68. package/dist/builtins/typedarray.js.map +1 -0
  69. package/dist/builtins/weakref.d.ts +18 -0
  70. package/dist/builtins/weakref.js +130 -0
  71. package/dist/builtins/weakref.js.map +1 -0
  72. package/dist/dump.d.ts +2 -0
  73. package/dist/dump.js +124 -0
  74. package/dist/dump.js.map +1 -0
  75. package/dist/embed.d.ts +18 -0
  76. package/dist/embed.js +286 -0
  77. package/dist/embed.js.map +1 -0
  78. package/dist/interpreter.d.ts +81 -0
  79. package/dist/interpreter.js +3768 -0
  80. package/dist/interpreter.js.map +1 -0
  81. package/dist/jit.d.ts +59 -0
  82. package/dist/jit.js +3440 -0
  83. package/dist/jit.js.map +1 -0
  84. package/dist/jit_hook.d.ts +21 -0
  85. package/dist/jit_hook.js +4 -0
  86. package/dist/jit_hook.js.map +1 -0
  87. package/dist/jit_runtime.d.ts +104 -0
  88. package/dist/jit_runtime.js +721 -0
  89. package/dist/jit_runtime.js.map +1 -0
  90. package/dist/jit_stack.d.ts +24 -0
  91. package/dist/jit_stack.js +227 -0
  92. package/dist/jit_stack.js.map +1 -0
  93. package/dist/jseption.d.ts +15 -0
  94. package/dist/jseption.js +61 -0
  95. package/dist/jseption.js.map +1 -0
  96. package/dist/opcodes.d.ts +347 -0
  97. package/dist/opcodes.js +322 -0
  98. package/dist/opcodes.js.map +1 -0
  99. package/dist/parser.d.ts +283 -0
  100. package/dist/parser.js +9752 -0
  101. package/dist/parser.js.map +1 -0
  102. package/dist/qjs.d.ts +2 -0
  103. package/dist/qjs.js +122 -0
  104. package/dist/qjs.js.map +1 -0
  105. package/dist/quickjs.d.ts +460 -0
  106. package/dist/quickjs.js +3408 -0
  107. package/dist/quickjs.js.map +1 -0
  108. package/dist/std.d.ts +4 -0
  109. package/dist/std.js +273 -0
  110. package/dist/std.js.map +1 -0
  111. package/dist/values.d.ts +447 -0
  112. package/dist/values.js +461 -0
  113. package/dist/values.js.map +1 -0
  114. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ jseption: TypeScript port of QuickJS
4
+ Copyright (c) 2026 jseption contributors
5
+
6
+ QuickJS Javascript Engine
7
+ Copyright (c) 2017-2025 Fabrice Bellard
8
+ Copyright (c) 2017-2025 Charlie Gordon
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,192 @@
1
- # Temporary Holding Version
1
+ # jseption
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **jseption** is a TypeScript port of [QuickJS](https://bellard.org/quickjs/), Fabrice
4
+ Bellard's small and complete JavaScript engine, turned into a sandboxed JavaScript engine
5
+ that runs anywhere JavaScript runs (browsers, including workers, Bun, Node, Deno) at close
6
+ to host speed.
7
+
8
+ The front end is QuickJS: a single-pass parser that emits QuickJS bytecode, the
9
+ `resolve_variables` / `resolve_labels` compiler passes, the same opcode set (including the
10
+ short opcodes), and the standard library declared with `JSCFunctionListEntry`-style
11
+ tables. The back end is new: guest values are host values whose prototype chains are
12
+ owned by the guest (see `docs/HOST_VALUES.md`), functions are compiled from bytecode to
13
+ host JavaScript once they are hot, with on-stack replacement of running loops (see
14
+ `docs/JIT.md`), and hot builtins forward
15
+ to the host's natives behind guest-prototyped wrappers. The `JS_CallInternal` interpreter
16
+ remains as the fallback tier for generators, async functions, direct `eval` and `with`.
17
+
18
+ Guest code can only reach guest intrinsics: nothing it can name or traverse to leads to a
19
+ host object (`tests/sandbox.test.ts` and `tests/sandbox-audit.test.ts` check this,
20
+ including through host-raised errors, iterators, proxies, `eval` and `Function`).
21
+
22
+ The reference version is QuickJS 2025-04-26. Development uses [Bun](https://bun.sh) as
23
+ the package manager and test runner.
24
+
25
+ ```sh
26
+ bun install
27
+ bun test # run the test suite (bun test runner)
28
+ bun run src/qjs.ts file.js # run a script with the qjs-like CLI
29
+ bun run src/qjs.ts -e 'print(1 + 2)'
30
+ bun run src/qjs.ts -d -e 'let x = 1' # dump the generated bytecode
31
+ bun run src/qjs.ts # REPL
32
+ JSEPTION_JIT=0 bun test # run the suite on the interpreter tier only
33
+ JSEPTION_JIT=always bun test # compile every function that runs (no lazy tier-up)
34
+ JSEPTION_JIT_DUMP=1 bun run src/qjs.ts file.js # print the generated host code
35
+ bun run bench/inproc.ts # host vs tier modes, incl. cold-code bundles
36
+ ```
37
+
38
+ ## Installing
39
+
40
+ ```sh
41
+ npm install jseption # or: bun add jseption
42
+ npx jseption -e 'print(1 + 2)'
43
+ ```
44
+
45
+ The `jseption` entry point is host-neutral (browsers, workers, Bun, Node, Deno);
46
+ `jseption/std` and the `jseption` command need Node. Releases are published from
47
+ GitHub Actions, see `docs/RELEASING.md`.
48
+
49
+ ## Using the engine from TypeScript
50
+
51
+ The public API mirrors the QuickJS C API:
52
+
53
+ ```ts
54
+ import { JS_NewRuntime, JS_NewContext, JS_Eval, JS_IsException, JS_GetException,
55
+ JS_ToString, JS_EVAL_TYPE_GLOBAL, runPendingJobs } from 'jseption';
56
+
57
+ const rt = JS_NewRuntime();
58
+ const ctx = JS_NewContext(rt);
59
+ const val = JS_Eval(ctx, '[1, 2, 3].map(x => x * 2).join()', '<input>', JS_EVAL_TYPE_GLOBAL);
60
+ if (JS_IsException(val)) {
61
+ console.error(JS_ToString(ctx, JS_GetException(ctx)));
62
+ } else {
63
+ console.log(val); // "2,4,6"
64
+ }
65
+ runPendingJobs(rt); // run the promise jobs
66
+ ```
67
+
68
+ Guest values are host values: primitives are the same host primitives, objects are host
69
+ objects with guest prototypes (`JS_IsObject`, `JS_GetOpaque` and the class ids work on
70
+ engine metadata kept in a `WeakMap`). Engine code signals exceptions with the
71
+ `JS_EXCEPTION` sentinel exactly like in C; compiled guest code and host natives throw, and
72
+ the two conventions meet at the call boundary. See `docs/PORTING.md` and
73
+ `docs/HOST_VALUES.md` for the internals.
74
+
75
+ ## Passing values between host and guest
76
+
77
+ Guest values are host values, but the sandbox forbids handing the guest an object whose
78
+ prototype chain reaches a host intrinsic. `src/embed.ts` marshals values at the boundary:
79
+
80
+ ```ts
81
+ import { expose, toGuest, fromGuest, guestPromiseToHost } from 'jseption';
82
+
83
+ // plain data, functions and promises become guest values; host class instances are
84
+ // rejected unless a `custom` converter is given
85
+ expose(ctx, 'fetch', async (url: string) => {
86
+ const res = await fetch(url);
87
+ return { status: res.status, json: () => res.json(), text: () => res.text() };
88
+ });
89
+ const p = JS_Eval(ctx, '(async () => (await (await fetch(u)).json()).id)()', 'guest.js', JS_EVAL_TYPE_GLOBAL);
90
+ const id = await guestPromiseToHost(ctx, p); // guest promise -> host promise
91
+ const data = fromGuest(ctx, value); // guest object graph -> plain host data
92
+ ```
93
+
94
+ Primitives cross unchanged. `toGuest` copies objects, arrays, Date, RegExp, Map, Set,
95
+ typed arrays and Errors into guest equivalents, wraps host functions in guest functions
96
+ (host exceptions become guest errors, returned promises are bridged, guest promise jobs
97
+ run when they settle) and preserves shared references and cycles. `fromGuest` does the
98
+ reverse, turning guest functions into host functions that call into the guest. See
99
+ `examples/fetch.ts`.
100
+
101
+ ## Layout
102
+
103
+ ```
104
+ src/atoms.ts atom table (JS_ATOM_*), tagged integer atoms, atom -> property key
105
+ src/values.ts JSValue, object metadata, bytecode & frame structures
106
+ src/opcodes.ts opcode table generated from quickjs-opcode.h
107
+ src/quickjs.ts runtime, context, property layer over Reflect, calls, conversions, jobs
108
+ src/parser.ts tokenizer, parser, bytecode emitter, variable/label resolution, eval
109
+ src/interpreter.ts JS_CallInternal, closures, generators, async functions (fallback tier)
110
+ src/jit.ts bytecode -> host JavaScript compiler (stack-to-register, relooper)
111
+ src/jit_runtime.ts the helpers generated code calls into (the only engine touchpoint)
112
+ src/builtins/ standard library; native.ts borrows host natives behind guest wrappers
113
+ src/std.ts print / console / std / os helpers for the CLI (subset of quickjs-libc)
114
+ src/qjs.ts command line interpreter
115
+ src/dump.ts bytecode disassembler
116
+ src/embed.ts host <-> guest value marshalling (expose, toGuest, fromGuest, promises)
117
+ examples/ embedding examples (fetch facade)
118
+ bench/ benchmark programs and runners (host vs compiled vs interpreted)
119
+ tests/ bun tests, including the QuickJS test suite files in tests/qjs/
120
+ ```
121
+
122
+ ## Status
123
+
124
+ The test suite (`bun test`) has 480+ tests, including QuickJS's own `test_language.js`,
125
+ `test_closure.js`, `test_loop.js`, `test_builtin.js` and `test_bigint.js` run unmodified
126
+ inside the engine (only the two tests that need a deterministic garbage collector are
127
+ skipped). The suite passes in every mode (`JSEPTION_JIT=0`, the default, `always`). QuickJS's
128
+ `microbench.js` runs with `bun run src/qjs.ts tests/qjs/microbench.js`. The compiled tier
129
+ is the only part that generates code from strings (`new Function`, CSP `'unsafe-eval'`);
130
+ where the host forbids it, the tier turns itself off and the interpreter runs everything
131
+ (see docs/JIT.md).
132
+
133
+ Performance (`bench/inproc.ts`, Bun 1.4 / JavaScriptCore, time relative to running the same
134
+ program directly on the host; function-local variants keep their state in locals, the
135
+ others in top-level globals, which cost about 20 ns per access). The default mode (`hot`)
136
+ compiles a function once it is hot and replaces running interpreter loops with compiled
137
+ code; `always` compiles every function that runs:
138
+
139
+ | program | default (hot) / host | always / host | interpreted / host |
140
+ | --- | --- | --- | --- |
141
+ | integer loop (function-local) | 1.0x | 1.0x | 18x |
142
+ | string building and methods | 1.3x | 1.3x | 4x |
143
+ | array push / sort / map / filter | 2.1x | 1.9x | 100x |
144
+ | object allocation + method calls (function-local) | 2.8x | 2.8x | 650x |
145
+ | closures + try/catch (function-local) | 4.3x | 3.0x | 190x |
146
+ | recursive fib (function-local) | 3.4x | 2.9x | 85x |
147
+ | the same programs on top-level globals | 4x to 19x | 3x to 18x | |
148
+ | 2000 / 8000 functions that each run once | 12x / 7.5x | 42x / 39x | 12x / 7.6x |
149
+
150
+ The last row is application start-up: code that runs once is cheaper to interpret than
151
+ to compile (300 to 400 µs per compiled function, most of it the host compiling the
152
+ generated source), which is why `hot` is the default. See docs/JIT.md for the details.
153
+
154
+ Implemented: the complete ES2023 language (classes with private members and static
155
+ blocks, generators, async functions and async generators, destructuring, spread,
156
+ optional chaining, template literals, labeled statements, `with`, direct and indirect
157
+ `eval`, `new.target`, `super`, BigInt, ...), the QuickJS bytecode compiler with its
158
+ peephole optimizations and short opcodes, and the standard library.
159
+
160
+ Differences from the C implementation:
161
+
162
+ * The object model is the host's (see `docs/HOST_VALUES.md`): property storage,
163
+ descriptors, frozen objects, Proxy invariants and typed array indexing are implemented
164
+ by the host engine; the QuickJS shapes, exotic method tables and reference counting are
165
+ gone.
166
+ * Hot builtins (`Array`, `String`, `Object`, `Math`, `Number`, `JSON`, `Map`, `Set`,
167
+ `RegExp`, ...) forward to the host natives, so their error messages are the host's and
168
+ `Math.random` is the host generator. Builtins that must follow QuickJS (`eval`,
169
+ `Function`, `Error`, `Promise` and the job queue, `Date`, generators) stay ported.
170
+ * Compiled functions have no interpreter frame; see `docs/JIT.md` for how error locations
171
+ are recovered.
172
+
173
+ * Regular expressions are executed by the host JavaScript engine (libregexp is not
174
+ ported); the `RegExp` builtin reproduces the QuickJS/ECMAScript semantics on top of it.
175
+ * Errors raised by the host for native operations (typed array element conversion,
176
+ Proxy invariant violations, array length limits, ...) carry the host engine's messages;
177
+ errors raised by the engine itself keep the QuickJS messages.
178
+ * Mapped `arguments` objects alias the parameters through accessor properties, and
179
+ constructors always have a `prototype` own property (`undefined` when the
180
+ specification has none, e.g. `Proxy`).
181
+ * Memory management relies on the host garbage collector: there is no reference
182
+ counting, `JS_FreeValue`/`JS_DupValue` are no-ops, and `WeakRef` / `FinalizationRegistry`
183
+ use the host weak references.
184
+ * ES modules (`import` / `export`), `Atomics`, `SharedArrayBuffer` threads and the
185
+ bytecode serialization (`JS_WriteObject` / `JS_ReadObject`) are not ported.
186
+ * Number formatting and parsing use the host conversions (they are specified by
187
+ ECMAScript, so the results are identical).
188
+
189
+ ## License
190
+
191
+ MIT, like QuickJS. The test files under `tests/qjs/` come from the QuickJS distribution
192
+ (copyright Fabrice Bellard and Charlie Gordon).
@@ -0,0 +1,255 @@
1
+ export type JSAtom = number;
2
+ export declare const JS_ATOM_NULL: JSAtom;
3
+ export declare const predefinedAtomNames: string[];
4
+ export declare const JS_ATOM_null = 1;
5
+ export declare const JS_ATOM_false: number;
6
+ export declare const JS_ATOM_true: number;
7
+ export declare const JS_ATOM_if: number;
8
+ export declare const JS_ATOM_else: number;
9
+ export declare const JS_ATOM_return: number;
10
+ export declare const JS_ATOM_var: number;
11
+ export declare const JS_ATOM_this: number;
12
+ export declare const JS_ATOM_delete: number;
13
+ export declare const JS_ATOM_void: number;
14
+ export declare const JS_ATOM_typeof: number;
15
+ export declare const JS_ATOM_new: number;
16
+ export declare const JS_ATOM_in: number;
17
+ export declare const JS_ATOM_instanceof: number;
18
+ export declare const JS_ATOM_do: number;
19
+ export declare const JS_ATOM_while: number;
20
+ export declare const JS_ATOM_for: number;
21
+ export declare const JS_ATOM_break: number;
22
+ export declare const JS_ATOM_continue: number;
23
+ export declare const JS_ATOM_switch: number;
24
+ export declare const JS_ATOM_case: number;
25
+ export declare const JS_ATOM_default: number;
26
+ export declare const JS_ATOM_throw: number;
27
+ export declare const JS_ATOM_try: number;
28
+ export declare const JS_ATOM_catch: number;
29
+ export declare const JS_ATOM_finally: number;
30
+ export declare const JS_ATOM_function: number;
31
+ export declare const JS_ATOM_debugger: number;
32
+ export declare const JS_ATOM_with: number;
33
+ export declare const JS_ATOM_class: number;
34
+ export declare const JS_ATOM_const: number;
35
+ export declare const JS_ATOM_enum: number;
36
+ export declare const JS_ATOM_export: number;
37
+ export declare const JS_ATOM_extends: number;
38
+ export declare const JS_ATOM_import: number;
39
+ export declare const JS_ATOM_super: number;
40
+ export declare const JS_ATOM_implements: number;
41
+ export declare const JS_ATOM_interface: number;
42
+ export declare const JS_ATOM_let: number;
43
+ export declare const JS_ATOM_package: number;
44
+ export declare const JS_ATOM_private: number;
45
+ export declare const JS_ATOM_protected: number;
46
+ export declare const JS_ATOM_public: number;
47
+ export declare const JS_ATOM_static: number;
48
+ export declare const JS_ATOM_yield: number;
49
+ export declare const JS_ATOM_await: number;
50
+ export declare const JS_ATOM_empty_string: number;
51
+ export declare const JS_ATOM_length: number;
52
+ export declare const JS_ATOM_fileName: number;
53
+ export declare const JS_ATOM_lineNumber: number;
54
+ export declare const JS_ATOM_columnNumber: number;
55
+ export declare const JS_ATOM_message: number;
56
+ export declare const JS_ATOM_cause: number;
57
+ export declare const JS_ATOM_errors: number;
58
+ export declare const JS_ATOM_stack: number;
59
+ export declare const JS_ATOM_name: number;
60
+ export declare const JS_ATOM_toString: number;
61
+ export declare const JS_ATOM_toLocaleString: number;
62
+ export declare const JS_ATOM_valueOf: number;
63
+ export declare const JS_ATOM_eval: number;
64
+ export declare const JS_ATOM_prototype: number;
65
+ export declare const JS_ATOM_constructor: number;
66
+ export declare const JS_ATOM_configurable: number;
67
+ export declare const JS_ATOM_writable: number;
68
+ export declare const JS_ATOM_enumerable: number;
69
+ export declare const JS_ATOM_value: number;
70
+ export declare const JS_ATOM_get: number;
71
+ export declare const JS_ATOM_set: number;
72
+ export declare const JS_ATOM_of: number;
73
+ export declare const JS_ATOM___proto__: number;
74
+ export declare const JS_ATOM_undefined: number;
75
+ export declare const JS_ATOM_number: number;
76
+ export declare const JS_ATOM_boolean: number;
77
+ export declare const JS_ATOM_string: number;
78
+ export declare const JS_ATOM_object: number;
79
+ export declare const JS_ATOM_symbol: number;
80
+ export declare const JS_ATOM_integer: number;
81
+ export declare const JS_ATOM_unknown: number;
82
+ export declare const JS_ATOM_arguments: number;
83
+ export declare const JS_ATOM_callee: number;
84
+ export declare const JS_ATOM_caller: number;
85
+ export declare const JS_ATOM__eval_: number;
86
+ export declare const JS_ATOM__ret_: number;
87
+ export declare const JS_ATOM__var_: number;
88
+ export declare const JS_ATOM__arg_var_: number;
89
+ export declare const JS_ATOM__with_: number;
90
+ export declare const JS_ATOM_lastIndex: number;
91
+ export declare const JS_ATOM_target: number;
92
+ export declare const JS_ATOM_index: number;
93
+ export declare const JS_ATOM_input: number;
94
+ export declare const JS_ATOM_defineProperties: number;
95
+ export declare const JS_ATOM_apply: number;
96
+ export declare const JS_ATOM_join: number;
97
+ export declare const JS_ATOM_concat: number;
98
+ export declare const JS_ATOM_split: number;
99
+ export declare const JS_ATOM_construct: number;
100
+ export declare const JS_ATOM_getPrototypeOf: number;
101
+ export declare const JS_ATOM_setPrototypeOf: number;
102
+ export declare const JS_ATOM_isExtensible: number;
103
+ export declare const JS_ATOM_preventExtensions: number;
104
+ export declare const JS_ATOM_has: number;
105
+ export declare const JS_ATOM_deleteProperty: number;
106
+ export declare const JS_ATOM_defineProperty: number;
107
+ export declare const JS_ATOM_getOwnPropertyDescriptor: number;
108
+ export declare const JS_ATOM_ownKeys: number;
109
+ export declare const JS_ATOM_add: number;
110
+ export declare const JS_ATOM_done: number;
111
+ export declare const JS_ATOM_next: number;
112
+ export declare const JS_ATOM_values: number;
113
+ export declare const JS_ATOM_source: number;
114
+ export declare const JS_ATOM_flags: number;
115
+ export declare const JS_ATOM_global: number;
116
+ export declare const JS_ATOM_unicode: number;
117
+ export declare const JS_ATOM_raw: number;
118
+ export declare const JS_ATOM_new_target: number;
119
+ export declare const JS_ATOM_this_active_func: number;
120
+ export declare const JS_ATOM_home_object: number;
121
+ export declare const JS_ATOM_computed_field: number;
122
+ export declare const JS_ATOM_static_computed_field: number;
123
+ export declare const JS_ATOM_class_fields_init: number;
124
+ export declare const JS_ATOM_brand: number;
125
+ export declare const JS_ATOM_hash_constructor: number;
126
+ export declare const JS_ATOM_as: number;
127
+ export declare const JS_ATOM_from: number;
128
+ export declare const JS_ATOM_meta: number;
129
+ export declare const JS_ATOM__default_: number;
130
+ export declare const JS_ATOM__star_: number;
131
+ export declare const JS_ATOM_Module: number;
132
+ export declare const JS_ATOM_then: number;
133
+ export declare const JS_ATOM_resolve: number;
134
+ export declare const JS_ATOM_reject: number;
135
+ export declare const JS_ATOM_promise: number;
136
+ export declare const JS_ATOM_proxy: number;
137
+ export declare const JS_ATOM_revoke: number;
138
+ export declare const JS_ATOM_async: number;
139
+ export declare const JS_ATOM_exec: number;
140
+ export declare const JS_ATOM_groups: number;
141
+ export declare const JS_ATOM_indices: number;
142
+ export declare const JS_ATOM_status: number;
143
+ export declare const JS_ATOM_reason: number;
144
+ export declare const JS_ATOM_globalThis: number;
145
+ export declare const JS_ATOM_bigint: number;
146
+ export declare const JS_ATOM_minus_zero: number;
147
+ export declare const JS_ATOM_Infinity: number;
148
+ export declare const JS_ATOM_minus_Infinity: number;
149
+ export declare const JS_ATOM_NaN: number;
150
+ export declare const JS_ATOM_not_equal: number;
151
+ export declare const JS_ATOM_timed_out: number;
152
+ export declare const JS_ATOM_ok: number;
153
+ export declare const JS_ATOM_toJSON: number;
154
+ export declare const JS_ATOM_Object: number;
155
+ export declare const JS_ATOM_Array: number;
156
+ export declare const JS_ATOM_Error: number;
157
+ export declare const JS_ATOM_Number: number;
158
+ export declare const JS_ATOM_String: number;
159
+ export declare const JS_ATOM_Boolean: number;
160
+ export declare const JS_ATOM_Symbol: number;
161
+ export declare const JS_ATOM_Arguments: number;
162
+ export declare const JS_ATOM_Math: number;
163
+ export declare const JS_ATOM_JSON: number;
164
+ export declare const JS_ATOM_Date: number;
165
+ export declare const JS_ATOM_Function: number;
166
+ export declare const JS_ATOM_GeneratorFunction: number;
167
+ export declare const JS_ATOM_ForInIterator: number;
168
+ export declare const JS_ATOM_RegExp: number;
169
+ export declare const JS_ATOM_ArrayBuffer: number;
170
+ export declare const JS_ATOM_SharedArrayBuffer: number;
171
+ export declare const JS_ATOM_Uint8ClampedArray: number;
172
+ export declare const JS_ATOM_Int8Array: number;
173
+ export declare const JS_ATOM_Uint8Array: number;
174
+ export declare const JS_ATOM_Int16Array: number;
175
+ export declare const JS_ATOM_Uint16Array: number;
176
+ export declare const JS_ATOM_Int32Array: number;
177
+ export declare const JS_ATOM_Uint32Array: number;
178
+ export declare const JS_ATOM_BigInt64Array: number;
179
+ export declare const JS_ATOM_BigUint64Array: number;
180
+ export declare const JS_ATOM_Float32Array: number;
181
+ export declare const JS_ATOM_Float64Array: number;
182
+ export declare const JS_ATOM_DataView: number;
183
+ export declare const JS_ATOM_BigInt: number;
184
+ export declare const JS_ATOM_WeakRef: number;
185
+ export declare const JS_ATOM_FinalizationRegistry: number;
186
+ export declare const JS_ATOM_Map: number;
187
+ export declare const JS_ATOM_Set: number;
188
+ export declare const JS_ATOM_WeakMap: number;
189
+ export declare const JS_ATOM_WeakSet: number;
190
+ export declare const JS_ATOM_Map_Iterator: number;
191
+ export declare const JS_ATOM_Set_Iterator: number;
192
+ export declare const JS_ATOM_Array_Iterator: number;
193
+ export declare const JS_ATOM_String_Iterator: number;
194
+ export declare const JS_ATOM_RegExp_String_Iterator: number;
195
+ export declare const JS_ATOM_Generator: number;
196
+ export declare const JS_ATOM_Proxy: number;
197
+ export declare const JS_ATOM_Promise: number;
198
+ export declare const JS_ATOM_PromiseResolveFunction: number;
199
+ export declare const JS_ATOM_PromiseRejectFunction: number;
200
+ export declare const JS_ATOM_AsyncFunction: number;
201
+ export declare const JS_ATOM_AsyncFunctionResolve: number;
202
+ export declare const JS_ATOM_AsyncFunctionReject: number;
203
+ export declare const JS_ATOM_AsyncGeneratorFunction: number;
204
+ export declare const JS_ATOM_AsyncGenerator: number;
205
+ export declare const JS_ATOM_EvalError: number;
206
+ export declare const JS_ATOM_RangeError: number;
207
+ export declare const JS_ATOM_ReferenceError: number;
208
+ export declare const JS_ATOM_SyntaxError: number;
209
+ export declare const JS_ATOM_TypeError: number;
210
+ export declare const JS_ATOM_URIError: number;
211
+ export declare const JS_ATOM_InternalError: number;
212
+ export declare const JS_ATOM_Private_brand: number;
213
+ export declare const JS_ATOM_Symbol_toPrimitive: number;
214
+ export declare const JS_ATOM_Symbol_iterator: number;
215
+ export declare const JS_ATOM_Symbol_match: number;
216
+ export declare const JS_ATOM_Symbol_matchAll: number;
217
+ export declare const JS_ATOM_Symbol_replace: number;
218
+ export declare const JS_ATOM_Symbol_search: number;
219
+ export declare const JS_ATOM_Symbol_split: number;
220
+ export declare const JS_ATOM_Symbol_toStringTag: number;
221
+ export declare const JS_ATOM_Symbol_isConcatSpreadable: number;
222
+ export declare const JS_ATOM_Symbol_hasInstance: number;
223
+ export declare const JS_ATOM_Symbol_species: number;
224
+ export declare const JS_ATOM_Symbol_unscopables: number;
225
+ export declare const JS_ATOM_Symbol_asyncIterator: number;
226
+ export declare const JS_ATOM_END: number;
227
+ export declare const JS_ATOM_TYPE_STRING = 1;
228
+ export declare const JS_ATOM_TYPE_GLOBAL_SYMBOL = 2;
229
+ export declare const JS_ATOM_TYPE_SYMBOL = 3;
230
+ export declare const JS_ATOM_TYPE_PRIVATE = 4;
231
+ export declare const JS_ATOM_TAG_INT = 2147483648;
232
+ export declare const JS_ATOM_MAX_INT = 2147483647;
233
+ export declare function __JS_AtomIsTaggedInt(v: JSAtom): boolean;
234
+ export declare function __JS_AtomFromUInt32(v: number): JSAtom;
235
+ export declare function __JS_AtomToUInt32(atom: JSAtom): number;
236
+ export declare function js_well_known_symbol(name: string): symbol | null;
237
+ export declare function is_num_string(str: string): number;
238
+ export declare class AtomTable {
239
+ private names;
240
+ private types;
241
+ private strMap;
242
+ private symMap;
243
+ constructor();
244
+ newAtomStr(str: string): JSAtom;
245
+ newAtomUInt32(n: number): JSAtom;
246
+ newSymbol(description: string | undefined, atom_type: number): symbol;
247
+ symbolToAtom(sym: symbol): JSAtom;
248
+ getType(atom: JSAtom): number;
249
+ isString(atom: JSAtom): boolean;
250
+ isSymbol(atom: JSAtom): boolean;
251
+ getSymbol(atom: JSAtom): symbol;
252
+ toKey(atom: JSAtom): string | number | symbol;
253
+ toStr(atom: JSAtom): string;
254
+ toDisplayStr(atom: JSAtom): string;
255
+ }