@earendil-works/djs 0.0.0-stage → 0.1.0
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-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +88 -2
- package/dist/base.d.ts +33 -0
- package/dist/base.js +71 -0
- package/dist/dump-runtime.d.ts +16 -0
- package/dist/dump-runtime.js +107 -0
- package/dist/dump.d.ts +10 -0
- package/dist/dump.js +21 -0
- package/dist/env.d.ts +5 -0
- package/dist/env.js +17 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +21 -0
- package/dist/layout.generated.d.ts +921 -0
- package/dist/layout.generated.js +442 -0
- package/dist/reader.d.ts +47 -0
- package/dist/reader.js +599 -0
- package/dist/sandbox.d.ts +756 -0
- package/dist/sandbox.js +1958 -0
- package/dist/slim.d.ts +10 -0
- package/dist/slim.js +21 -0
- package/dist/trap.d.ts +16 -0
- package/dist/trap.js +23 -0
- package/dist/wire.d.ts +46 -0
- package/dist/wire.js +373 -0
- package/package.json +53 -4
- package/wasm/djs-dump.wasm +0 -0
- package/wasm/djs-slim.wasm +0 -0
- package/wasm/djs.wasm +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
// Generated from djs-core's heap layout (`heap::layout::layout_json`). Do not edit.
|
|
2
|
+
// Regenerate: DJS_UPDATE_LAYOUT=1 cargo test -p djs-core layout_generated
|
|
3
|
+
export const LAYOUT = {
|
|
4
|
+
"layoutHash": 3968409435,
|
|
5
|
+
"magic": 5458500,
|
|
6
|
+
"headerSize": 8,
|
|
7
|
+
"header": { "KIND": 0, "GC": 1, "FLAGS": 2, "SIZE": 4 },
|
|
8
|
+
"value": {
|
|
9
|
+
"tagPrefix": 65528,
|
|
10
|
+
"firstRef": 8,
|
|
11
|
+
"tags": { "UNDEFINED": 1, "NULL": 2, "BOOL": 3, "INT": 4, "HOLE": 5, "UNINITIALIZED": 6, "STRING": 8, "OBJECT": 9, "SYMBOL": 10, "BIGINT": 11, "HOST_REF": 12, "INTERNAL": 13 }
|
|
12
|
+
},
|
|
13
|
+
"atom": { "intBit": 2147483648, "symbolBit": 1073741824, "indexMask": 1073741823 },
|
|
14
|
+
"flags": { "ROPE_TWO_BYTE": 1, "ROPE_FLATTENED": 2, "ROPE_APPEND": 4, "STR_APPEND_BUF": 1, "OBJ_EXTENSIBLE": 1, "OBJ_INDEXED_PROPS": 2, "OBJ_LENGTH_READONLY": 4, "OBJ_DICTIONARY": 128, "BIGINT_NEG": 1 },
|
|
15
|
+
"objectClasses": { "Ordinary": 0, "Array": 1, "Function": 2, "HostFunction": 3, "Error": 4, "Arguments": 5, "ArrayIterator": 6, "BoundFunction": 7, "Boolean": 8, "Number": 9, "String": 10, "Symbol": 11, "Map": 12, "Set": 13, "WeakMap": 14, "WeakSet": 15, "CollectionIterator": 16, "Promise": 17, "BuiltinClosure": 18, "Record": 19, "Date": 20, "Generator": 21, "ArrayBuffer": 22, "TypedArray": 23, "DataView": 24, "RegExp": 25, "RegExpStringIterator": 26, "Proxy": 27, "IteratorHelper": 28, "RawJSON": 29, "BigInt": 30, "WeakRef": 31, "FinalizationRegistry": 32, "DisposableStack": 33, "CallSite": 34 },
|
|
16
|
+
"propFlags": { "WRITABLE": 1, "ENUMERABLE": 2, "CONFIGURABLE": 4, "ACCESSOR": 8 },
|
|
17
|
+
"cells": {
|
|
18
|
+
"Roots": {
|
|
19
|
+
"kind": 1,
|
|
20
|
+
"minSize": 112,
|
|
21
|
+
"fields": {
|
|
22
|
+
"MAGIC": { "offset": 8, "type": "u32" },
|
|
23
|
+
"VERSION": { "offset": 12, "type": "u32" },
|
|
24
|
+
"ATOMS": { "offset": 16, "type": "Ref" },
|
|
25
|
+
"STACK": { "offset": 20, "type": "Ref" },
|
|
26
|
+
"REALM": { "offset": 24, "type": "Value" },
|
|
27
|
+
"JOBS": { "offset": 32, "type": "Ref" },
|
|
28
|
+
"HOST_CALLS": { "offset": 36, "type": "Ref" },
|
|
29
|
+
"HANDLES": { "offset": 40, "type": "Ref" },
|
|
30
|
+
"INTERP": { "offset": 44, "type": "Ref" },
|
|
31
|
+
"COMPAT": { "offset": 48, "type": "u32" },
|
|
32
|
+
"FLAGS": { "offset": 52, "type": "u32" },
|
|
33
|
+
"GC_THRESHOLD": { "offset": 56, "type": "u32" },
|
|
34
|
+
"PROTO_EPOCH": { "offset": 60, "type": "u32" },
|
|
35
|
+
"ROOT_SHAPE": { "offset": 64, "type": "Ref" },
|
|
36
|
+
"SHAPES": { "offset": 68, "type": "u32" },
|
|
37
|
+
"OLD_END": { "offset": 72, "type": "u32" },
|
|
38
|
+
"MINORS": { "offset": 76, "type": "u32" },
|
|
39
|
+
"BASE_END": { "offset": 80, "type": "u32" },
|
|
40
|
+
"OPS": { "offset": 84, "type": "u32" },
|
|
41
|
+
"INTRINSICS": { "offset": 88, "type": "u32" },
|
|
42
|
+
"RECORDS": { "offset": 92, "type": "u32" },
|
|
43
|
+
"FEATURES": { "offset": 96, "type": "u32" },
|
|
44
|
+
"HASH_KEY": { "offset": 104, "type": "u64" }
|
|
45
|
+
},
|
|
46
|
+
"tail": null
|
|
47
|
+
},
|
|
48
|
+
"Str8": {
|
|
49
|
+
"kind": 2,
|
|
50
|
+
"minSize": 16,
|
|
51
|
+
"fields": {
|
|
52
|
+
"LEN": { "offset": 8, "type": "u32" },
|
|
53
|
+
"HASH": { "offset": 12, "type": "u32" }
|
|
54
|
+
},
|
|
55
|
+
"tail": {
|
|
56
|
+
"name": "DATA",
|
|
57
|
+
"offset": 16,
|
|
58
|
+
"elem": "u8",
|
|
59
|
+
"elemSize": 1,
|
|
60
|
+
"fields": {
|
|
61
|
+
"": { "offset": 0, "type": "u8" }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"Str16": {
|
|
66
|
+
"kind": 3,
|
|
67
|
+
"minSize": 16,
|
|
68
|
+
"fields": {
|
|
69
|
+
"LEN": { "offset": 8, "type": "u32" },
|
|
70
|
+
"HASH": { "offset": 12, "type": "u32" }
|
|
71
|
+
},
|
|
72
|
+
"tail": {
|
|
73
|
+
"name": "DATA",
|
|
74
|
+
"offset": 16,
|
|
75
|
+
"elem": "u16",
|
|
76
|
+
"elemSize": 2,
|
|
77
|
+
"fields": {
|
|
78
|
+
"": { "offset": 0, "type": "u16" }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"Rope": {
|
|
83
|
+
"kind": 4,
|
|
84
|
+
"minSize": 24,
|
|
85
|
+
"fields": {
|
|
86
|
+
"LEN": { "offset": 8, "type": "u32" },
|
|
87
|
+
"HASH": { "offset": 12, "type": "u32" },
|
|
88
|
+
"LEFT": { "offset": 16, "type": "Ref" },
|
|
89
|
+
"RIGHT": { "offset": 20, "type": "Ref" }
|
|
90
|
+
},
|
|
91
|
+
"tail": null
|
|
92
|
+
},
|
|
93
|
+
"Slice": {
|
|
94
|
+
"kind": 22,
|
|
95
|
+
"minSize": 24,
|
|
96
|
+
"fields": {
|
|
97
|
+
"LEN": { "offset": 8, "type": "u32" },
|
|
98
|
+
"HASH": { "offset": 12, "type": "u32" },
|
|
99
|
+
"PARENT": { "offset": 16, "type": "Ref" },
|
|
100
|
+
"OFF": { "offset": 20, "type": "u32" }
|
|
101
|
+
},
|
|
102
|
+
"tail": null
|
|
103
|
+
},
|
|
104
|
+
"Symbol": {
|
|
105
|
+
"kind": 5,
|
|
106
|
+
"minSize": 24,
|
|
107
|
+
"fields": {
|
|
108
|
+
"ATOM": { "offset": 8, "type": "u32" },
|
|
109
|
+
"DESCRIPTION": { "offset": 16, "type": "Value" }
|
|
110
|
+
},
|
|
111
|
+
"tail": null
|
|
112
|
+
},
|
|
113
|
+
"Object": {
|
|
114
|
+
"kind": 6,
|
|
115
|
+
"minSize": 24,
|
|
116
|
+
"fields": {
|
|
117
|
+
"CLASS": { "offset": 8, "type": "u32" },
|
|
118
|
+
"PROTO": { "offset": 12, "type": "Ref" },
|
|
119
|
+
"PROPS": { "offset": 16, "type": "Ref" },
|
|
120
|
+
"ELEMENTS": { "offset": 20, "type": "Ref" }
|
|
121
|
+
},
|
|
122
|
+
"tail": {
|
|
123
|
+
"name": "SLOTS",
|
|
124
|
+
"offset": 24,
|
|
125
|
+
"elem": "Value",
|
|
126
|
+
"elemSize": 8,
|
|
127
|
+
"fields": {
|
|
128
|
+
"": { "offset": 0, "type": "Value" }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"PropTable": {
|
|
133
|
+
"kind": 7,
|
|
134
|
+
"minSize": 24,
|
|
135
|
+
"fields": {
|
|
136
|
+
"COUNT": { "offset": 8, "type": "u32" },
|
|
137
|
+
"DELETED": { "offset": 12, "type": "u32" },
|
|
138
|
+
"INDEX": { "offset": 16, "type": "Ref" }
|
|
139
|
+
},
|
|
140
|
+
"tail": {
|
|
141
|
+
"name": "ENTRIES",
|
|
142
|
+
"offset": 24,
|
|
143
|
+
"elem": "PropEntry",
|
|
144
|
+
"elemSize": 16,
|
|
145
|
+
"fields": {
|
|
146
|
+
"KEY": { "offset": 0, "type": "u32" },
|
|
147
|
+
"FLAGS": { "offset": 4, "type": "u32" },
|
|
148
|
+
"VALUE": { "offset": 8, "type": "Value" }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"ValueArray": {
|
|
153
|
+
"kind": 8,
|
|
154
|
+
"minSize": 16,
|
|
155
|
+
"fields": {
|
|
156
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
157
|
+
},
|
|
158
|
+
"tail": {
|
|
159
|
+
"name": "VALUES",
|
|
160
|
+
"offset": 16,
|
|
161
|
+
"elem": "Value",
|
|
162
|
+
"elemSize": 8,
|
|
163
|
+
"fields": {
|
|
164
|
+
"": { "offset": 0, "type": "Value" }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"U32Array": {
|
|
169
|
+
"kind": 9,
|
|
170
|
+
"minSize": 16,
|
|
171
|
+
"fields": {
|
|
172
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
173
|
+
},
|
|
174
|
+
"tail": {
|
|
175
|
+
"name": "DATA",
|
|
176
|
+
"offset": 12,
|
|
177
|
+
"elem": "u32",
|
|
178
|
+
"elemSize": 4,
|
|
179
|
+
"fields": {
|
|
180
|
+
"": { "offset": 0, "type": "u32" }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"AtomTable": {
|
|
185
|
+
"kind": 10,
|
|
186
|
+
"minSize": 32,
|
|
187
|
+
"fields": {
|
|
188
|
+
"STRINGS": { "offset": 8, "type": "u32" },
|
|
189
|
+
"ENTRIES": { "offset": 12, "type": "Ref" },
|
|
190
|
+
"INDEX": { "offset": 16, "type": "Ref" },
|
|
191
|
+
"BASE_ENTRIES": { "offset": 20, "type": "Ref" },
|
|
192
|
+
"BASE_INDEX": { "offset": 24, "type": "Ref" },
|
|
193
|
+
"BASE_COUNT": { "offset": 28, "type": "u32" }
|
|
194
|
+
},
|
|
195
|
+
"tail": null
|
|
196
|
+
},
|
|
197
|
+
"HandleTable": {
|
|
198
|
+
"kind": 11,
|
|
199
|
+
"minSize": 24,
|
|
200
|
+
"fields": {
|
|
201
|
+
"LEN": { "offset": 8, "type": "u32" },
|
|
202
|
+
"FREE": { "offset": 12, "type": "u32" },
|
|
203
|
+
"LIVE": { "offset": 16, "type": "u32" }
|
|
204
|
+
},
|
|
205
|
+
"tail": {
|
|
206
|
+
"name": "SLOTS",
|
|
207
|
+
"offset": 24,
|
|
208
|
+
"elem": "HandleSlot",
|
|
209
|
+
"elemSize": 16,
|
|
210
|
+
"fields": {
|
|
211
|
+
"VALUE": { "offset": 0, "type": "Value" },
|
|
212
|
+
"NEXT": { "offset": 8, "type": "u32" }
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"FuncTemplate": {
|
|
217
|
+
"kind": 12,
|
|
218
|
+
"minSize": 48,
|
|
219
|
+
"fields": {
|
|
220
|
+
"NO_ELEMENTS": { "offset": 8, "type": "u32" },
|
|
221
|
+
"NAME": { "offset": 12, "type": "u32" },
|
|
222
|
+
"PARAMS": { "offset": 16, "type": "u16" },
|
|
223
|
+
"LENGTH": { "offset": 18, "type": "u16" },
|
|
224
|
+
"LOCALS": { "offset": 20, "type": "u16" },
|
|
225
|
+
"STACK": { "offset": 22, "type": "u16" },
|
|
226
|
+
"CAPTURES": { "offset": 24, "type": "u16" },
|
|
227
|
+
"IC_COUNT": { "offset": 26, "type": "u16" },
|
|
228
|
+
"CODE_LEN": { "offset": 28, "type": "u32" },
|
|
229
|
+
"CONSTS": { "offset": 32, "type": "Ref" },
|
|
230
|
+
"IC": { "offset": 36, "type": "Ref" },
|
|
231
|
+
"INFO": { "offset": 40, "type": "Ref" },
|
|
232
|
+
"FLAGS": { "offset": 44, "type": "u16" },
|
|
233
|
+
"NATIVE": { "offset": 46, "type": "u8" },
|
|
234
|
+
"FAST": { "offset": 47, "type": "u8" }
|
|
235
|
+
},
|
|
236
|
+
"tail": {
|
|
237
|
+
"name": "DATA",
|
|
238
|
+
"offset": 48,
|
|
239
|
+
"elem": "u8",
|
|
240
|
+
"elemSize": 1,
|
|
241
|
+
"fields": {
|
|
242
|
+
"": { "offset": 0, "type": "u8" }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"Script": {
|
|
247
|
+
"kind": 13,
|
|
248
|
+
"minSize": 24,
|
|
249
|
+
"fields": {
|
|
250
|
+
"NAME": { "offset": 8, "type": "Ref" },
|
|
251
|
+
"SOURCE": { "offset": 12, "type": "Ref" },
|
|
252
|
+
"OPTIONS": { "offset": 16, "type": "u32" },
|
|
253
|
+
"PARAMS": { "offset": 20, "type": "Ref" }
|
|
254
|
+
},
|
|
255
|
+
"tail": null
|
|
256
|
+
},
|
|
257
|
+
"BoxCell": {
|
|
258
|
+
"kind": 14,
|
|
259
|
+
"minSize": 16,
|
|
260
|
+
"fields": {
|
|
261
|
+
"VALUE": { "offset": 8, "type": "Value" }
|
|
262
|
+
},
|
|
263
|
+
"tail": null
|
|
264
|
+
},
|
|
265
|
+
"Bytes": {
|
|
266
|
+
"kind": 15,
|
|
267
|
+
"minSize": 16,
|
|
268
|
+
"fields": {
|
|
269
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
270
|
+
},
|
|
271
|
+
"tail": {
|
|
272
|
+
"name": "DATA",
|
|
273
|
+
"offset": 12,
|
|
274
|
+
"elem": "u8",
|
|
275
|
+
"elemSize": 1,
|
|
276
|
+
"fields": {
|
|
277
|
+
"": { "offset": 0, "type": "u8" }
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"RefArray": {
|
|
282
|
+
"kind": 16,
|
|
283
|
+
"minSize": 16,
|
|
284
|
+
"fields": {
|
|
285
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
286
|
+
},
|
|
287
|
+
"tail": {
|
|
288
|
+
"name": "REFS",
|
|
289
|
+
"offset": 12,
|
|
290
|
+
"elem": "Ref",
|
|
291
|
+
"elemSize": 4,
|
|
292
|
+
"fields": {
|
|
293
|
+
"": { "offset": 0, "type": "Ref" }
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"FuncInfo": {
|
|
298
|
+
"kind": 21,
|
|
299
|
+
"minSize": 32,
|
|
300
|
+
"fields": {
|
|
301
|
+
"SCRIPT": { "offset": 8, "type": "Ref" },
|
|
302
|
+
"SRC_START": { "offset": 12, "type": "u32" },
|
|
303
|
+
"SRC_END": { "offset": 16, "type": "u32" },
|
|
304
|
+
"LINES": { "offset": 20, "type": "Ref" },
|
|
305
|
+
"NAMES": { "offset": 24, "type": "Ref" },
|
|
306
|
+
"CHILD_COUNT": { "offset": 28, "type": "u32" }
|
|
307
|
+
},
|
|
308
|
+
"tail": {
|
|
309
|
+
"name": "CHILDREN",
|
|
310
|
+
"offset": 32,
|
|
311
|
+
"elem": "Ref",
|
|
312
|
+
"elemSize": 4,
|
|
313
|
+
"fields": {
|
|
314
|
+
"": { "offset": 0, "type": "Ref" }
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"Interp": {
|
|
319
|
+
"kind": 17,
|
|
320
|
+
"minSize": 88,
|
|
321
|
+
"fields": {
|
|
322
|
+
"STATE": { "offset": 8, "type": "u32" },
|
|
323
|
+
"BP": { "offset": 12, "type": "u32" },
|
|
324
|
+
"HP": { "offset": 16, "type": "u32" },
|
|
325
|
+
"SP": { "offset": 20, "type": "u32" },
|
|
326
|
+
"PC": { "offset": 24, "type": "u32" },
|
|
327
|
+
"HOST_CALL": { "offset": 28, "type": "u32" },
|
|
328
|
+
"NEXT_CALL_ID": { "offset": 32, "type": "u32" },
|
|
329
|
+
"FLAGS": { "offset": 36, "type": "u32" },
|
|
330
|
+
"RESULT": { "offset": 40, "type": "Value" },
|
|
331
|
+
"OUTCOME": { "offset": 48, "type": "u32" },
|
|
332
|
+
"JOB_HEAD": { "offset": 52, "type": "u32" },
|
|
333
|
+
"THROW": { "offset": 56, "type": "Value" },
|
|
334
|
+
"REJECTIONS": { "offset": 64, "type": "Ref" },
|
|
335
|
+
"REPORTED": { "offset": 68, "type": "u32" },
|
|
336
|
+
"INBOX": { "offset": 72, "type": "Ref" },
|
|
337
|
+
"INBOX_HEAD": { "offset": 76, "type": "u32" },
|
|
338
|
+
"FUEL_DEBT": { "offset": 80, "type": "Value" }
|
|
339
|
+
},
|
|
340
|
+
"tail": null
|
|
341
|
+
},
|
|
342
|
+
"Realm": {
|
|
343
|
+
"kind": 18,
|
|
344
|
+
"minSize": 16,
|
|
345
|
+
"fields": {
|
|
346
|
+
"GLOBAL_LEX": { "offset": 8, "type": "Ref" },
|
|
347
|
+
"INSTALLED": { "offset": 12, "type": "Ref" }
|
|
348
|
+
},
|
|
349
|
+
"tail": {
|
|
350
|
+
"name": "INTRINSICS",
|
|
351
|
+
"offset": 16,
|
|
352
|
+
"elem": "Value",
|
|
353
|
+
"elemSize": 8,
|
|
354
|
+
"fields": {
|
|
355
|
+
"": { "offset": 0, "type": "Value" }
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"HostCall": {
|
|
360
|
+
"kind": 19,
|
|
361
|
+
"minSize": 48,
|
|
362
|
+
"fields": {
|
|
363
|
+
"ID": { "offset": 8, "type": "u32" },
|
|
364
|
+
"FN": { "offset": 12, "type": "u32" },
|
|
365
|
+
"ARGS": { "offset": 16, "type": "Ref" },
|
|
366
|
+
"THIS": { "offset": 24, "type": "Value" },
|
|
367
|
+
"PROMISE": { "offset": 32, "type": "Value" },
|
|
368
|
+
"FLAGS": { "offset": 40, "type": "u32" }
|
|
369
|
+
},
|
|
370
|
+
"tail": null
|
|
371
|
+
},
|
|
372
|
+
"EphemeronArray": {
|
|
373
|
+
"kind": 20,
|
|
374
|
+
"minSize": 16,
|
|
375
|
+
"fields": {
|
|
376
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
377
|
+
},
|
|
378
|
+
"tail": {
|
|
379
|
+
"name": "VALUES",
|
|
380
|
+
"offset": 16,
|
|
381
|
+
"elem": "Value",
|
|
382
|
+
"elemSize": 8,
|
|
383
|
+
"fields": {
|
|
384
|
+
"": { "offset": 0, "type": "Value" }
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"AccessorPair": {
|
|
389
|
+
"kind": 25,
|
|
390
|
+
"minSize": 24,
|
|
391
|
+
"fields": {
|
|
392
|
+
"GETTER": { "offset": 8, "type": "Value" },
|
|
393
|
+
"SETTER": { "offset": 16, "type": "Value" }
|
|
394
|
+
},
|
|
395
|
+
"tail": null
|
|
396
|
+
},
|
|
397
|
+
"Shape": {
|
|
398
|
+
"kind": 26,
|
|
399
|
+
"minSize": 24,
|
|
400
|
+
"fields": {
|
|
401
|
+
"PARENT": { "offset": 8, "type": "Ref" },
|
|
402
|
+
"DESCS": { "offset": 12, "type": "Ref" },
|
|
403
|
+
"COUNT": { "offset": 16, "type": "u32" },
|
|
404
|
+
"TRANSITIONS": { "offset": 20, "type": "Ref" }
|
|
405
|
+
},
|
|
406
|
+
"tail": null
|
|
407
|
+
},
|
|
408
|
+
"PropValues": {
|
|
409
|
+
"kind": 27,
|
|
410
|
+
"minSize": 16,
|
|
411
|
+
"fields": {
|
|
412
|
+
"SHAPE": { "offset": 8, "type": "Ref" },
|
|
413
|
+
"LEN": { "offset": 12, "type": "u32" }
|
|
414
|
+
},
|
|
415
|
+
"tail": {
|
|
416
|
+
"name": "VALUES",
|
|
417
|
+
"offset": 16,
|
|
418
|
+
"elem": "Value",
|
|
419
|
+
"elemSize": 8,
|
|
420
|
+
"fields": {
|
|
421
|
+
"": { "offset": 0, "type": "Value" }
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
"BigInt": {
|
|
426
|
+
"kind": 24,
|
|
427
|
+
"minSize": 16,
|
|
428
|
+
"fields": {
|
|
429
|
+
"LEN": { "offset": 8, "type": "u32" }
|
|
430
|
+
},
|
|
431
|
+
"tail": {
|
|
432
|
+
"name": "LIMBS",
|
|
433
|
+
"offset": 12,
|
|
434
|
+
"elem": "u32",
|
|
435
|
+
"elemSize": 4,
|
|
436
|
+
"fields": {
|
|
437
|
+
"": { "offset": 0, "type": "u32" }
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
};
|
package/dist/reader.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A VM value with no host equivalent: a symbol, a function or other non-plain object, a
|
|
3
|
+
* host ref or an internal value (BigInts are read as native bigints). `ref` is the arena offset of its cell (0 if none).
|
|
4
|
+
*/
|
|
5
|
+
export declare class Opaque {
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly ref: number;
|
|
8
|
+
/** The object class (`Function`, `Error`, ...) for objects. */
|
|
9
|
+
readonly className?: string;
|
|
10
|
+
/** A symbol's description. */
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
constructor(type: string, ref: number, className?: string, description?: string);
|
|
13
|
+
}
|
|
14
|
+
export interface ReadOptions {
|
|
15
|
+
/** Use only standard APIs (TextDecoder, String.fromCharCode), not node's Buffer. */
|
|
16
|
+
portable?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The most values (containers and elements) to produce. Shared references are read
|
|
19
|
+
* once per occurrence, so a heap with sharing at every level could otherwise expand
|
|
20
|
+
* exponentially. Default: four times the arena's value slots, plus a million.
|
|
21
|
+
*/
|
|
22
|
+
maxValues?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Atom index -> key string, filled while reading. Reusing one array across reads of the
|
|
25
|
+
* same VM is safe: atoms are never freed and their strings never change.
|
|
26
|
+
*/
|
|
27
|
+
atomCache?: (string | undefined)[];
|
|
28
|
+
}
|
|
29
|
+
/** Thrown when the memory does not hold a heap of this build's layout. */
|
|
30
|
+
export declare class LayoutMismatch extends Error {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks that `memory` holds a djs heap with the layout this reader was generated for
|
|
34
|
+
* (the magic and `LAYOUT_HASH` in the roots cell).
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkHeap(memory: Uint8Array): void;
|
|
37
|
+
/**
|
|
38
|
+
* Decodes the VM value `value` (its 64 bits, or `[lo, hi]` as two u32) from the heap arena
|
|
39
|
+
* `memory` (offset 0 of the view is the arena start, i.e. the roots cell).
|
|
40
|
+
*
|
|
41
|
+
* Primitives map to themselves; strings (flat or ropes) to strings; arrays to arrays (holes
|
|
42
|
+
* stay holes); ordinary objects to plain objects with their own enumerable string-keyed data
|
|
43
|
+
* properties in property order. Accessors, non-enumerable and symbol-keyed properties are
|
|
44
|
+
* left out. Everything else becomes an {@link Opaque}. The result is a tree, as with JSON:
|
|
45
|
+
* a shared object is read once per reference, and a cycle is a TypeError naming its path.
|
|
46
|
+
*/
|
|
47
|
+
export declare function readValue(memory: Uint8Array, value: bigint | readonly [number, number], opts?: ReadOptions): unknown;
|