wasm-rquickjs-cli 0.4.13

Tool for wrapping JavaScript modules as WebAssembly components using the QuickJS engine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
# wasm-rquickjs

## Introduction

Command line tool and library to generate a Rust crate wrapping JavaScript code into a WebAssembly Component using the
QuickJS engine.

### Comparison with ComponentizeJS

[ComponentizeJS](https://github.com/bytecodealliance/ComponentizeJS) achieves the same goal of wrapping JavaScript code
into
a WebAssembly Component, but it does it using a modified version of the SpiderMonkey engine.

Advantages of wasm-rquickjs over ComponentizeJS:

- At the time of writing, there are known bugs in ComponentizeJS (or one of its underlying modules) that prevents it
  from being used in production.
- Much simpler to develop and debug, as everything exposed for JavaScript is implemented in async Rust using
  the [rquickjs library](https://github.com/DelSkayn/rquickjs)
- The WIT-JS mapping rules and the set of available JavaScript APIs are well defined
- Smaller WASM binary size

Advantages of ComponentizeJS over wasm-rquickjs:

- Faster runtime (due to the SpiderMonkey engine)
- Faster startup time (it does pre-initialization with Wizer)
- No need for the Rust toolchain for end users

### Comparison with wasmedge-quickjs

The project is similar to [wasmedge-quickjs](https://github.com/second-state/wasmedge-quickjs/) in using te QuickJS
engine compiled to WASM
to run JavaScript code, but it is different in the following ways:

- It does not provide support for using the component model from JS (defining imports and exports using WIT)
- The imports the resulting WASM component has are WasmEdge specific

## Usage

The tool can be used as a command line tool or as a library. The command line tool has two top level commands:

```
  generate-wrapper-crate  Generate the wrapper crate for a JavaScript module
  generate-dts            Generate TypeScript module definitions
```

### Generating the wrapper crate

This is the primary command that generates the Rust crate embedding the JavaScript code into a WebAssembly Component.

```
Usage: wasm-rquickjs generate-wrapper-crate --js <JS> --wit <WIT> --output <OUTPUT>
```

- The `--js` arguments is the path to the JavaScript file to be wrapped. There can be only one JavaScript file,
  containing an ES6 module exporting the necessary functions and classes as described below.
- The `--wit` argument is the path to the WIT root containing a single world that describes the imports and exports of
  the component
- The `--output` argument is the path to the output directory where the generated Rust crate will be created.

The output directory is going to contain a self-contained Rust crate that can be compiled into a WASM component using
`cargo build --target wasm32-wasip2`.

Every generated crate also contains a target-specific `THIRD_PARTY_COMPONENT_LICENSES.txt` for the
locked Cargo dependency union of the standard `normal` / `normal-p3` TypeScript runtime and
transform profiles. It is deliberately a superset for crates that enable fewer features.
Distributors must ship that notice with the compiled component and separately audit application
code, custom feature combinations, bundled JavaScript in the skeleton (including third-party code
adapted from Node.js, Deno, and web-streams-polyfill), toolchain and WASI sysroot components,
vendored native sources, and upstream `NOTICE` obligations. Maintainers can regenerate and verify
the retained notices with
`tools/check-component-licenses.sh --write` and `--check`, respectively, using the pinned
`cargo-about` version named by the script.

The generated crate has some **features** that control what imports the component will have beside the ones defined in
the user's WIT world:

- `logging`: enables the `wasi:logging` import to be used for the JavaScript `console` API
- `http`: enables the `wasi:http` import to be used for the JavaScript `fetch` API
- `sqlite`: enables the `node:sqlite` module with an embedded SQLite database engine

By default `logging` and `http` are enabled. The `sqlite` feature must be explicitly enabled.

#### Choosing the WASI target

The `--target` option selects which WASI generation mode is used:

- `--target wasi-p2` (**default**): the historical WASI Preview 2 mode. Component exports are
  synchronous WIT functions and the full Node.js-compatible builtin set is available. This is the
  stable, production path.
- `--target wasi-p3`: the opt-in WASI Preview 3 mode. WIT `async func` exports and imports use the
  Component Model async ABI, while plain functions remain synchronous. WIT `future<T>` /
  `stream<T>` values are supported at function boundaries, including inside composite types. See
  [WASI Preview 3 target](#wasi-preview-3-target) below for the current status and limitations.

Both targets generate a crate that is still compiled with `cargo build --target wasm32-wasip2`
(a dedicated `wasm32-wasip3` rustc target does not exist yet; the Preview 3 crate uses the
[`wasip3`](https://crates.io/crates/wasip3) bindings on top of the Preview 2 target).

### Generating TypeScript module definitions

The `generate-dts` command generates TypeScript module definitions for all the exported and imported interfaces:

```
Usage: wasm-rquickjs generate-dts --wit <WIT> --output <OUTPUT>
```

- The `--wit` argument is the path to the WIT root containing a single world that describes the imports and exports of
  the component.
- The `--output` argument is the path to the output directory where the generated TypeScript module definitions (
  `.d.ts`) will be created.

### Using with Golem

`wasm-rquickjs` is integrated into [Golem](https://golem.cloud)'s command line interface, so it can be directly used
using Golem app templates.

> **Note:** Golem's Preview 3 SDK/template builds pin the `wasi-p3` generator branch and pass
> `--target wasi-p3` when building their JavaScript guest images. Preview 2 remains the default for
> callers that do not select a target explicitly.

### WASI Preview 3 target

Passing `--target wasi-p3` to `generate-wrapper-crate` selects the **opt-in, asynchronous** WASI
Preview 3 generation mode. It is intended for hosts that support the Component Model async ABI.

**How it differs from Preview 2:**

- WIT `async func` exports and imports use the Component Model async ABI (`task.return`); plain
  functions remain synchronous.
- The JavaScript event loop is driven by the Component Model async executor instead of Preview 2
  `wasi:io/poll` pollables — there are no `wstd`/`wasip2`/pollable dependencies in the Preview 3
  code path.
- WIT `future<T>` and `stream<T>` are mapped to JavaScript `Promise<T>` and `AsyncIterable<T>`
  respectively, both directly and when nested in composite parameter/result types.
- `fetch` / HTTP uses the `wasi:http` Preview 3 (`wasi:http/handler`) async client.

**Building and running:**

The generated crate is still built with `cargo build --target wasm32-wasip2`. Running the resulting
component requires a host with Preview 3 and Component Model async support. For example, with the
`wasmtime` CLI (version 46.x):

```
wasmtime run -S p3=y -S http=y --wasm component-model=y --wasm component-model-async=y \
  --invoke 'my-export()' path/to/component.wasm
```

The Node.js-compatible builtin set is available on Preview 3 as well. Working end-to-end examples
live under [`examples/p3`](examples/p3), covering async exports/imports, `future<T>`/`stream<T>`
values, exported resources, and HTTP `fetch`.

**Current limitations (Preview 3):**

- **Composition** (`--js-modules name=@composition`) is not supported yet.
- An exported result containing `future<T>` or `stream<T>` must come from an `async func`; a
  synchronous export cannot return its reader before a backpressured writer starts.
- The error arm of an exported top-level `result<T, E>` cannot contain `future<T>` or `stream<T>`.

Wizer pre-initialization (`optimize`) supports Preview 3 components. As with Preview 2, module
initialization must become quiescent before the snapshot and cannot leave timers or tasks pending.
Runtime arguments and environment variables are restored before the first export runs; modules
must not capture their values or immutable aliases during top-level initialization.

**Deterministic pre-initialization:** newly generated P2 and P3 templates export
`wasm-rquickjs-wizer-restore-v1`. When optimizing their `wizer-initialize` export,
the optimizer supplies fixed-seed entropy, Unix-epoch wall time, and a zero
monotonic clock, with empty arguments/environment. These services exist only in
the optimizer store. Before any restored application JS runs, the guest reseeds
its crypto RNG from runtime host entropy (failure traps) and refreshes its
performance/uptime origin. Captured `Math.random` functions, including functions
from `node:vm` contexts, use that reseeded RNG. Runtime clock reads still use the
deployment host. Determinism is for identical input with the same optimizer and
dependencies, not a cross-version artifact format guarantee. Initialization must
also avoid external I/O and application-owned sources of nondeterminism; the
optimizer does not make arbitrary application code reproducible.

**Application initialization is still snapshotted.** Values already computed at
module top level—timestamps, random IDs, keys, library-owned PRNG state, performance
marks, and copies of environment values—remain frozen. Internal-service refresh
cannot undo those computations. Generate secrets and per-instance IDs after
restoration, inside an exported function; do not generate them at module top level.
Initialization must not depend on clocks advancing. Applications that need live
top-level entropy/time should skip `optimize` and initialize at runtime instead.

Old/unmarked components and other initializer names retain legacy real entropy
and clocks, with a warning: output is not guaranteed reproducible, and cached RNG
state may still be shared by restored instances. **Update both the optimizer and
rebuild guest templates** to enable the deterministic path safely. Updating the
optimizer alone does not repair a published template or existing snapshots. The
capability export is a template producer's declaration of this restore contract,
not a guarantee that arbitrary application state or composed code is snapshot-safe.

Library callers using the `optimize` feature can configure the guest-to-host copy budget for
initialization and Wizer snapshot memory extraction:

```rust,no_run
use wasm_rquickjs::{OptimizeOptions, optimize_component_with_options};

# async fn example(input: &camino::Utf8Path, output: &camino::Utf8Path) -> anyhow::Result<()> {
optimize_component_with_options(
    input,
    output,
    "wizer-initialize",
    &OptimizeOptions {
        hostcall_fuel: Some(512 * 1024 * 1024), // 512 MiB per hostcall
    },
).await?;
# Ok(())
# }
```

An explicit budget requires `use-golem-wasmtime` **and** Cargo patches selecting Golem's
compatible Wasmtime 46.0.1 fork (see the commented patches in `Cargo.toml`); the feature alone
does not select the fork. Stock Wasmtime does not expose this setting, and an explicit budget
without the feature returns an error. `optimize_component` and `OptimizeOptions::default()`
leave the engine default unchanged (128 MiB in Golem's fork). This limits bytes copied per
hostcall, not Wasm instruction fuel or the total snapshot size. Raising it allows larger
copies and increases potential host memory use; insufficient fuel can still trigger Wizer's
existing snapshot-extraction panic.

Preview 3 is opt-in and evolving; Preview 2 (`--target wasi-p2`) remains the default and stable
path.

## Mappings

### Exports

#### Top level exported functions

The following WIT code:

```wit
package demo:pkg;

world example {
  export hello: func() -> string;
}
```

must be implemented in JavaScript as:

```javascript
export const hello = () => {
    return "Hello, world!";
};
``` 

The `this` is bound to the module object. The JS function name is always in camelCase.

#### Exported interfaces

Exported interfaces has to be exported from JavaScript as objects:

The following WIT example:

```wit
package demo:pkg;

interface sample-api {
  get-string-length: func(value: string) -> u64;
}

world example {
  export sample-api;
}
```

has to be implemented in JavaScript as:

```javascript
export const sampleApi = {
    getStringLength: (value) => {
        return value.length;
    }
};
```

All names are converted to camelCase. The JavaScript `this` is bound to object representing the exporter interface, in
the above example it is `sampleApi`.

If two exported interfaces in the same world map to the same JavaScript object name, the colliding interfaces are
exported with a qualified name derived from their full WIT interface id. For example, `test:a/guest@1.0.0` and
`test:b/guest@1.0.0` both have the short interface name `guest`, so they must be exported as:

```javascript
export const testA100Guest = {
    invoke: (a, b, c) => `${a}:${b}:${c}`,
};

export const testB100Guest = {
    invoke: (a, b, c, d, e) => `${a}:${b}:${c}:${d}:${e}`,
};
```

Interfaces whose JavaScript object names do not collide keep the short camelCase export shape.

#### Exported resources

Exported resources are implemented as **classes** in JS:

The following WIT example:

```wit
package demo:pkg;

interface iface {
  resource example-resource {
    constructor(name: string);
    get-name: func() -> string;
    compare: static func(h1: borrow<example-resource>, h2: borrow<example-resource>) -> s32;
    merge: static func(h1: own<example-resource>, h2: own<example-resource>) -> hello;
  }
}

world example {
  export iface;
}
```

Must be exported from JavaScript in the following way:

```js
class Hello {
    constructor(name) {
        this.name = name;
    }

    // async to demonstrate it is possible
    async getName() {
        return this.name;
    }

    static compare(h1, h2) {
        if (h1.name === h2.name) {
            return 0;
        } else if h1.name < h2.name) {
            return -1;
        } else {
            return 1;
        }
    }

    static merge(h1, h2) {
        return new Hello(`${h1.name} & ${h2.name}`);
    }
}

export const iface = {
    Hello: Hello,
};
```

The classes have a UpperCamelCase name and their methods are in camelCase. All methods and static methods can be either
sync or async.

### Types

| Name                    | WIT                 | JS                                                | Notes                                                                         |
|-------------------------|---------------------|---------------------------------------------------|-------------------------------------------------------------------------------|
| Character               | `char`              | `string`                                          | -                                                                             |
| String                  | `string`            | `string`                                          | -                                                                             |
| Signed 8-bit integer    | `s8`                | `number`                                          | -                                                                             |
| Unsigned 8-bit integer  | `u8`                | `number`                                          | -                                                                             |
| Signed 16-bit integer   | `s16`               | `number`                                          | -                                                                             |
| Unsigned 16-bit integer | `u16`               | `number`                                          | -                                                                             |
| Signed 32-bit integer   | `s32`               | `number`                                          | -                                                                             |
| Unsigned 32-bit integer | `u32`               | `number`                                          | -                                                                             |
| Signed 64-bit integer   | `s64`               | `bigint`                                          | -                                                                             |
| Unsigned 64-bit integer | `u64`               | `bigint`                                          | -                                                                             |
| 32-bit float            | `f32`               | `number`                                          | -                                                                             |
| 64-bit float            | `f64`               | `number`                                          | -                                                                             |
| Optional type           | `option<T>`         | `T \| undefined`                                  | Nested options are encoded differently                                        |
| List                    | `list<T>`           | `T[]`                                             | -                                                                             |
| Result                  | `result<T, E>`      | `{ tag: "ok": val: T } \| { tag: "err", val: E }` | -                                                                             |
| Tuple                   | `tuple<A, B, C>`    | Array                                             | -                                                                             |
| Enum                    | `enum { a, b, c}`   | `"a" \| "b" \| "c"`                               | The strings match the WIT enum cases                                          |
| Flags                   | `flags { a, b, c }` | `{ a: boolean, b: boolean, c: boolean }`          | The object keys are camelCase                                                 |
| Record                  | `record { .. }`     | Object                                            | Field names are camelCase                                                     |
| Variant                 | `variant { .. }`    | `{ tag: "x", val: X }`                            | Tag names match the WIT variant case names; `val` is undefined for unit cases |
| Future                  | `future<T>`         | `Promise<T>`                                      | WASI Preview 3 (`--target wasi-p3`) only                                   |
| Stream                  | `stream<T>`         | `AsyncIterable<T>`                                | WASI Preview 3 (`--target wasi-p3`) only                                   |

### Imported result errors

An imported function that returns `result<T, E>` returns `T` on success and throws
`E` on failure. Async imports reject with the same error value.

Structured error values retain their WIT representation. `String(error)`, template
interpolation, and `new Error(error).message` render the payload as JSON instead of
`[object Object]`. For example, a permission error renders as
`{"tag":"permission-denied"}`, and a backend error renders as
`{"tag":"backend-error","val":"service unavailable"}`. Bigint fields render as
decimal strings without changing the original values.

The coercion methods are non-enumerable. The original fields, object identity,
enumerable keys, and typed catch-and-rethrow behavior remain unchanged. Primitive
errors and successful values are not decorated. This rendering applies to error
string coercion; it does not replace the runtime's uncaught-exception formatter.

### Limitations

- Maximum number of function parameters is 26
- Anonymous interface exports/imports are not supported
- Imported individual functions into the world are not supported (only whole interfaces)
- Preview 3 synchronous exports cannot return `future<T>` or `stream<T>`, directly or nested; use
  `async func`
- Preview 3 exported top-level `result<T, E>` error arms cannot contain `future<T>` or `stream<T>`

## Available JavaScript APIs

### APIs

#### Web Platform APIs

<details>
<summary><strong>Console</strong></summary>

If the `logging` feature flag is enabled in the generated crate, it depends on `wasi:logging`, otherwise just on the core WASI interfaces.

- `assert`, `clear`, `count`, `countReset`, `debug`, `dir`, `dirXml`, `error`, `group`, `groupCollapsed`, `groupEnd`, `info`, `log`, `table`, `time`, `timeEnd`, `timeLog`, `trace`, `warn`

</details>

<details>
<summary><strong>HTTP (fetch)</strong></summary>

Only if the `http` feature flag is enabled in the generated crate. It depends on `wasi:http`.

- `fetch`, `Headers`, `Request`, `Response`, `FormData`, `Blob`, `File`

</details>

<details>
<summary><strong>URL</strong></summary>

- `URL` (`createObjectURL`, `revokeObjectURL`)
- `URLSearchParams`

</details>

<details>
<summary><strong>Streams</strong></summary>

Implemented by https://github.com/MattiasBuelens/web-streams-polyfill

- `ByteLengthQueuingStrategy`, `CountQueuingStrategy`
- `ReadableStream`, `ReadableStreamDefaultReader`, `ReadableStreamBYOBReader`, `ReadableStreamDefaultController`, `ReadableByteStreamController`, `ReadableStreamBYOBRequest`
- `WritableStream`, `WritableStreamDefaultController`
- `TransformStream`, `TransformStreamDefaultController`

</details>

<details>
<summary><strong>Timers</strong></summary>

- `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval`, `setImmediate`

</details>

<details>
<summary><strong>Abort Controller</strong></summary>

- `AbortController`, `AbortSignal`, `DOMException`

</details>

<details>
<summary><strong>Encoding</strong></summary>

- `TextEncoder`, `TextDecoder`, `TextDecoderStream`, `TextEncoderStream`

</details>

<details>
<summary><strong>Messaging</strong></summary>

- `MessageChannel`, `MessagePort`

</details>

<details>
<summary><strong>Events</strong></summary>

- `Event`, `EventTarget`, `CustomEvent`

</details>

<details>
<summary><strong>Intl (Internationalization)</strong></summary>

Minimal en-US implementation for library compatibility. All locale inputs are accepted but resolved to `en-US`.

- `Intl.DateTimeFormat` — `format()`, `formatToParts()`, `resolvedOptions()`, `supportedLocalesOf()`
- `Intl.NumberFormat` — `format()`, `formatToParts()`, `resolvedOptions()`, `supportedLocalesOf()`
- `Intl.Collator` — `compare()`, `resolvedOptions()`, `supportedLocalesOf()`
- `Intl.PluralRules` — `select()`, `selectRange()`, `resolvedOptions()`, `supportedLocalesOf()`
- `Intl.getCanonicalLocales()`, `Intl.supportedValuesOf()`

When the `timezone` feature is enabled (default), `DateTimeFormat` supports all ~590 IANA timezones via `chrono-tz`.

</details>

<details>
<summary><strong>Crypto (global)</strong></summary>

- `crypto.randomUUID`, `crypto.getRandomValues`

</details>

<details>
<summary><strong>Performance (global)</strong></summary>

- `performance.now()` uses the WASI monotonic clock and is not affected by wall-clock adjustments.
- `performance.timeOrigin` is the deployment wall-clock origin paired with that monotonic timeline.
- The global object is shared with `node:perf_hooks`.

</details>

<details>
<summary><strong>Structured Clone</strong></summary>

Implemented by https://github.com/ungap/structured-clone — `structuredClone`

</details>

#### Node.js-Compatible Modules

<details>
<summary><strong><code>node:assert</code></strong></summary>

- `ok`, `equal`, `notEqual`, `strictEqual`, `notStrictEqual`
- `deepEqual`, `notDeepEqual`, `deepStrictEqual`, `notDeepStrictEqual`, `partialDeepStrictEqual`
- `throws`, `doesNotThrow`, `rejects`, `doesNotReject`
- `ifError`, `match`, `doesNotMatch`, `fail`
- `AssertionError`, `CallTracker`
- `strict` — strict mode variant (re-maps `equal` → `strictEqual`, `deepEqual` → `deepStrictEqual`, etc.)

</details>

<details>
<summary><strong><code>node:async_hooks</code></strong></summary>

- `AsyncLocalStorage` — `run`, `exit`, `getStore`, `enterWith`, `disable`, `snapshot`, `bind`
- `AsyncResource` — `runInAsyncScope`, `asyncId`, `triggerAsyncId`, `bind`
- `createHook` — stub (returns enable/disable no-ops)
- `executionAsyncId`, `triggerAsyncId`, `executionAsyncResource` — stubs

Context propagation works through `Promise.prototype.then/catch/finally` and `setTimeout`/`setInterval`. **Limitation:** QuickJS `await` uses internal C-level `perform_promise_then` which bypasses JS-visible `Promise.prototype.then`, so context is **not** propagated across `await` boundaries.

</details>

<details>
<summary><strong><code>node:buffer</code></strong></summary>

- `Buffer`, `Blob`, `File`, `SlowBuffer`
- `resolveObjectURL`, `isAscii`, `isUtf8`
- `INSPECT_MAX_BYTES`, `kMaxLength`, `kStringMaxLength`, `constants`

</details>

<details>
<summary><strong><code>node:child_process</code></strong></summary>

WASI cannot create host processes. A constrained compatibility adapter runs `process.execPath`
JavaScript targets inline with isolated argv, environment, and cwd views. It also recognizes npm's
literal `sh -c` form for plain Node commands and executable Node shebang files. Unsupported shells,
shell syntax, external executables, and unsupported shebangs fail explicitly with `ENOSYS`; inline
execution is not a fresh runtime or an operating-system subprocess.

- `ChildProcess`, `exec`, `execFile`, `fork`, `spawn`, `execSync`, `execFileSync`, `spawnSync`

</details>

<details>
<summary><strong><code>node:cluster</code></strong> (stub)</summary>

Compatibility stubs — clustering is not supported in WASM.

- `isPrimary`, `isMaster`, `isWorker`, `fork`, `disconnect`, `setupPrimary`

</details>

<details>
<summary><strong><code>node:constants</code></strong></summary>

Merged constants from `os.constants`, `fs.constants`, and `crypto.constants` (signal numbers, errno values, file flags, etc.)

</details>

<details>
<summary><strong><code>node:crypto</code></strong></summary>

- **Hashing:** `createHash`, `createHmac`, `hash`, `getHashes`
- **Ciphers:** `createCipheriv`, `createDecipheriv`, `getCiphers`
  - Supported: aes-128/256-cbc, aes-128/256-ctr, aes-128/256-gcm, aes-128/192/256-wrap, id-aes128/192/256-wrap, id-aes128/192/256-wrap-pad, des-ede3-cbc, des3-wrap, chacha20-poly1305
- **Signing:** `createSign`, `createVerify` (Ed25519, ECDSA with P-256, P-384, secp256k1)
- **Keys:** `createPublicKey`, `createPrivateKey`, `createSecretKey`, `KeyObject`, `generateKeyPairSync`, `generateKeyPair`
- **ECDH:** `createECDH`, `ECDH`, `diffieHellman`, `getCurves`
- **Certificate:** `Certificate` (`verifySpkac`, `exportPublicKey`, `exportChallenge`)
- **Random:** `randomBytes`, `randomFillSync`, `randomFill`, `randomInt`, `randomUUID`, `pseudoRandomBytes`, `prng`, `rng`
- **KDF:** `pbkdf2`, `pbkdf2Sync`, `scrypt`, `scryptSync`, `hkdf`, `hkdfSync`
- **Primes:** `generatePrime`, `generatePrimeSync`, `checkPrime`, `checkPrimeSync`
- **Other:** `timingSafeEqual`, `getFips`, `setFips`, `secureHeapUsed`

</details>

<details>
<summary><strong><code>node:dgram</code></strong></summary>

UDP datagram sockets built on WASI sockets.

- `dgram.createSocket(type[, listener])` — create a UDP socket (`udp4` or `udp6`)
- `socket.bind`, `socket.send`, `socket.sendto`, `socket.connect`, `socket.disconnect`, `socket.close`
- `socket.address()`, `socket.remoteAddress()`
- `socket.setTTL`, `socket.setRecvBufferSize` / `getRecvBufferSize`, `socket.setSendBufferSize` / `getSendBufferSize`
- `socket.ref()` / `socket.unref()` — no-op
- Events: `message`, `listening`, `close`, `error`, `connect`

**Not supported:** multicast operations (`setBroadcast`, `setMulticastTTL`, `addMembership`, etc.) throw `ENOSYS`.

</details>

<details>
<summary><strong><code>node:diagnostics_channel</code></strong></summary>

Publish/subscribe diagnostic messaging and tracing.

- `channel(name)`, `subscribe(name, onMessage)`, `unsubscribe(name, onMessage)`, `hasSubscribers(name)`, `tracingChannel(name)`
- `Channel` — `subscribe`, `unsubscribe`, `publish`, `bindStore`, `unbindStore`, `runStores`, `hasSubscribers`, `name`
- `TracingChannel` — `subscribe`, `unsubscribe`, `hasSubscribers`, `traceSync`, `tracePromise`, `traceCallback`

Built-in HTTP diagnostics channels: `http.client.request.created`, `http.client.request.start`, `http.client.request.error`, `http.client.response.finish`.

</details>

<details>
<summary><strong><code>node:dns</code></strong></summary>

DNS resolution via WASI sockets.

- `lookup`, `lookupService`, `resolve`, `resolve4`, `resolve6`
- `resolveAny`, `resolveCname`, `resolveCaa`, `resolveMx`, `resolveNaptr`, `resolveNs`, `resolvePtr`, `resolveSoa`, `resolveSrv`, `resolveTxt`, `resolveTlsa`
- `reverse`, `setServers`, `getServers`, `setDefaultResultOrder`, `getDefaultResultOrder`
- `Resolver` class
- `promises` — promise-based API
- Error constants: `NODATA`, `FORMERR`, `SERVFAIL`, `NOTFOUND`, `NOTIMP`, `REFUSED`, `BADQUERY`, `BADNAME`, `BADFAMILY`, `BADRESP`, `CONNREFUSED`, `TIMEOUT`, `EOF`, `FILE`, `NOMEM`, `DESTRUCTION`, `BADSTR`, `BADFLAGS`, `NONAME`, `BADHINTS`, `NOTINITIALIZED`, `LOADIPHLPAPI`, `ADDRGETNETWORKPARAMS`, `CANCELLED`, `ADDRCONFIG`, `V4MAPPED`, `ALL`

</details>

<details>
<summary><strong><code>node:domain</code></strong></summary>

Deprecated error-handling domains (sync-only).

- `domain.create()` / `domain.createDomain()`, `domain.active`, `domain._stack`
- `Domain` class (extends `EventEmitter`): `run`, `add`, `remove`, `bind`, `intercept`, `enter`, `exit`, `dispose`, `members`, `parent`
- `process.domain` — reflects active domain
- Error decoration: `error.domain`, `error.domainEmitter`, `error.domainBound`, `error.domainThrown`
- EventEmitter integration and async propagation via `process.nextTick`, `setTimeout`, `setInterval`

**Limitation:** No async context propagation via `async_hooks` — only synchronous errors and explicitly bound callbacks are captured.

</details>

<details>
<summary><strong><code>node:events</code></strong></summary>

- `EventEmitter` — `on`, `once`, `off`, `addListener`, `removeListener`, `removeAllListeners`, `emit`, `listenerCount`, `eventNames`, `listeners`, `rawListeners`, `prependListener`, `prependOnceListener`, `setMaxListeners`, `getMaxListeners`
- Static: `once`, `on`, `getEventListeners`, `getMaxListeners`, `setMaxListeners`, `addAbortListener`, `errorMonitor`, `captureRejections`
- `Event`, `EventTarget`, `CustomEvent`

</details>

<details>
<summary><strong><code>node:fs</code></strong></summary>

Comprehensive filesystem API built on WASI filesystem.

Symbolic links are persistent WASI filesystem objects, so linked package trees
remain visible to later fresh execution runtimes. Link targets must be relative:
Rooted targets cannot be resolved within a WASI preopen, so `symlink` fails with
`EINVAL` without creating an object when given one. Production Golem and
macOS/Linux local development support these links. Windows local development
currently requires Developer Mode or an equivalent symlink privilege; non-link
filesystem and npm workflows are unaffected.

- **Sync:** `readFileSync`, `writeFileSync`, `appendFileSync`, `openSync`, `closeSync`, `readSync`, `writeSync`, `ftruncateSync`, `fsyncSync`, `fdatasyncSync`, `statSync`, `lstatSync`, `fstatSync`, `statfsSync`, `readdirSync`, `accessSync`, `existsSync`, `realpathSync`, `truncateSync`, `copyFileSync`, `linkSync`, `symlinkSync`, `readlinkSync`, `chmodSync`, `fchmodSync`, `lchmodSync`, `chownSync`, `fchownSync`, `lchownSync`, `utimesSync`, `futimesSync`, `lutimesSync`, `unlinkSync`, `renameSync`, `mkdirSync`, `rmdirSync`, `rmSync`, `mkdtempSync`, `opendirSync`, `readvSync`, `writevSync`, `cpSync`
- **Async (callback):** `readFile`, `writeFile`, `appendFile`, `open`, `close`, `read`, `write`, `stat`, `lstat`, `fstat`, `statfs`, `ftruncate`, `fsync`, `fdatasync`, `readdir`, `access`, `exists`, `realpath`, `truncate`, `copyFile`, `link`, `symlink`, `readlink`, `chmod`, `fchmod`, `lchmod`, `chown`, `fchown`, `lchown`, `utimes`, `futimes`, `lutimes`, `unlink`, `rename`, `mkdir`, `rmdir`, `rm`, `mkdtemp`, `opendir`, `watch`, `watchFile`, `unwatchFile`, `readv`, `writev`, `cp`, `openAsBlob`
- **Streams:** `createReadStream`, `createWriteStream`
- **Classes:** `Stats`, `Dirent`, `Dir`, `FSWatcher`, `StatWatcher`, `ReadStream`, `WriteStream`
- **Constants:** `F_OK`, `R_OK`, `W_OK`, `X_OK`, `O_RDONLY`, `O_WRONLY`, `O_RDWR`, `O_CREAT`, `O_EXCL`, `O_TRUNC`, `O_APPEND`, etc.

</details>

<details>
<summary><strong><code>node:fs/promises</code></strong></summary>

Promise-based filesystem API.

- `FileHandle`, `open`, `readFile`, `writeFile`, `appendFile`, `unlink`, `rename`, `mkdir`, `rmdir`, `rm`, `stat`, `lstat`, `readdir`, `opendir`, `access`, `realpath`, `truncate`, `copyFile`, `link`, `symlink`, `readlink`, `chmod`, `lchmod`, `chown`, `lchown`, `utimes`, `lutimes`, `mkdtemp`, `cp`, `watch`, `statfs`, `constants`

</details>

<details>
<summary><strong><code>node:http</code> / <code>node:https</code></strong></summary>

Requires the `http` feature flag. Client requests use `wasi:http` (TLS handled transparently). Server support uses `wasi:sockets` for TCP-level HTTP/1.1 serving.

- `http.request(url|options[, callback])`, `http.get(url|options[, callback])`
- `http.METHODS`, `http.STATUS_CODES`, `http.maxHeaderSize`
- `http.validateHeaderName`, `http.validateHeaderValue`
- `http.Agent`, `http.globalAgent`
- `http.OutgoingMessage` — base class for writable HTTP message objects
- `http.ClientRequest` — `write`, `end`, `setHeader`, `getHeader`, `removeHeader`, `hasHeader`, `getHeaderNames`, `getHeaders`, `getRawHeaderNames`, `flushHeaders`, `setNoDelay`, `setSocketKeepAlive`, `abort`, `destroy`, `setTimeout`
- `http.IncomingMessage` — `statusCode`, `statusMessage`, `headers`, `rawHeaders`, `httpVersion`
- `https.request` / `https.get` — delegates to `http` (WASI-HTTP handles TLS transparently)
- `http.createServer([options][, requestListener])` — create an HTTP/1.1 server (requires `wasi:sockets`)
- `http.Server` (extends `net.Server`): `listen`, `close`, `closeAllConnections`, `closeIdleConnections`, `setTimeout`, `maxRequestsPerSocket`; emits `dropRequest` when the per-socket limit is exceeded
- `http.ServerResponse` (extends `EventEmitter`): `writeHead`, `setHeader`, `getHeader`, `removeHeader`, `hasHeader`, `getHeaders`, `getHeaderNames`, `getRawHeaderNames`, `write`, `end`, `flushHeaders`, `writeContinue`, `writeProcessing`, `writeEarlyHints`, `cork`, `uncork`
- Server-side `IncomingMessage` (extends `stream.Readable`): `method`, `url`, `headers`, `headersDistinct`, `rawHeaders`, `httpVersion`, `socket`, `client`, `complete`, `aborted`, `trailers`, `trailersDistinct`, `rawTrailers`
- `node:_http_common` — `_checkIsHttpToken`, `_checkInvalidHeaderChar`
- Supported features: keep-alive connections, chunked transfer encoding, content-length bodies, ordered pipelined responses, server-side 100/102/103 informational responses, per-socket request limits, idle connection cleanup

**Not yet supported:** HTTP Upgrade and CONNECT tunnels, client-side 1xx informational events
through `wasi:http`, server-side timeout enforcement, `https.createServer()` / HTTPS server, client
`lookup` / `autoSelectFamily` options, and custom per-request `createConnection` transports. Custom
Agent `createConnection` hooks are ignored with a warning so Agent metadata and scheduling remain
usable, but they cannot route or isolate traffic; every outbound request still uses `wasi:http`.

</details>

<details>
<summary><strong><code>node:http2</code></strong> (stub)</summary>

Compatibility stubs — HTTP/2 is not supported.

- `connect`, `createServer`, `createSecureServer`, `Http2ServerRequest`, `Http2ServerResponse`

</details>

<details>
<summary><strong><code>wasm-rquickjs:execution</code></strong></summary>

Runs JavaScript asynchronously in a fresh QuickJS runtime. `startJavaScript(options)` returns live
`stdout`/`stderr` readable streams, a `result` promise resolving to `{ value, overflowed }`, and
`cancel()`. `runJavaScript(options)` collects the streams and resolves to
`{ value, overflowed, stdout, stderr }`. `value` crosses the runtime boundary through structured
clone.

Options accept exactly one of `entry: string` or inline `source: string`, plus `cwd`, `argv`,
`env`, `timeoutMs`, `maxBytes` (1 MiB per stream by default, 64 MiB maximum), and `overflow`
(`terminate` by default or `truncate`). `language: "javascript" | "typescript"` applies only to
inline `source` and defaults to JavaScript. With the generated crate's `typescript-runtime`
feature enabled, TypeScript entry files are selected by their `.ts`, `.mts`, or `.cts` extension,
and inline jobs can select `language: "typescript"`.
Output and completion wake the parent without periodic polling. Timeout budgets start
after child-runtime initialization. An async wait observes deadlines while jobs yield; for
non-yielding JavaScript, the QuickJS interrupt handler samples the clock at an adaptive stride
targeting one check per 10% of `timeoutMs` during steady CPU work. This is a best-effort budget,
not an exact cutoff or a maximum-overrun guarantee. A job that finishes between checks can
succeed after its literal deadline; no extra clock check occurs at completion. Entry modules run
for their side effects; an exported
`default` function (or `run` function when there is no default function) is invoked and awaited.
Relative entry paths and imports resolve from `cwd`. Inline `source` is an async function body:
top-level `await` and `return` are supported, while static `import`/`export` declarations are not.
`env` is an explicit allowlist and defaults to an empty environment; jobs never merge or inherit
the enclosing component's environment variables. When `argv` is omitted, entry jobs receive
`["wasm-rquickjs-execution", resolvedEntryPath]` and inline jobs receive
`["wasm-rquickjs-execution"]`.
With `overflow: "terminate"`, exceeding either stream's bound rejects the job. With
`overflow: "truncate"`, execution continues, captured output is bounded, and `overflowed` is
`true` when either stream exceeded the bound.
Cancellation is cooperative for queued or yielding code and cannot preempt a tight loop already
running on the same thread; a positive `timeoutMs` is the best-effort escape mechanism for such a
loop. Cancellation remains a guest-local flag check on every QuickJS interrupt. A job that
never settles must be cancelled or given a timeout before the enclosing component invocation can
finish. A runtime accepts at
most eight active jobs, and child executions cannot recursively create more execution jobs.
Fresh-runtime execution means fresh JavaScript globals, process state, timers, module caches, and
other mutable QuickJS runtime state. Results cross the runtime boundary through structured clone.
It is not a security sandbox: execution code inherits the component's filesystem, network, clocks,
randomness, and other available host capabilities, and `cwd` is only a resolution base—not a
filesystem boundary. Failed jobs are
currently returned as parent-realm `Error` messages rather than structured-cloned thrown values.

This API is distinct from `node:vm`. The `node:vm` module provides synchronous Node-compatible
contexts within one QuickJS runtime, including live-object behavior required by its API.
`wasm-rquickjs:execution` provides asynchronous jobs in fresh runtimes with structured-clone
results. Neither API is a security sandbox, and both share the enclosing component's capabilities
and filesystem access.

</details>

<details>
<summary><strong><code>node:inspector</code></strong> (stub)</summary>

Compatibility stubs — no V8 inspector in WASM.

- `Session`, `open`, `close`, `url`, `waitForDebugger`, `console`, `Network`

</details>

<details>
<summary><strong><code>node:module</code></strong></summary>

- `require`, `require.resolve`, `createRequire`, `builtinModules`, `isBuiltin`, `runMain`, `_nodeModulePaths`
- `stripTypeScriptTypes(code[, options])` with Node-compatible strip and transform modes when the
  generated crate enables `typescript-runtime`
- Package resolution supports `package.json` `main`, `exports` root/subpath maps, wildcard `exports` patterns, `imports` maps, and wildcard `imports` patterns. CJS resolution recognizes `golem`, `node`, `require`, `module-sync`, and `default` conditions; ESM resolution recognizes `golem`, `node`, `import`, `module-sync`, and `default`. Package `imports` can target relative files, external packages, and `node:` builtins.
- With `typescript-runtime`, `.mts` is always ESM, `.cts` is always CommonJS, and `.ts` follows the
  nearest package type and Node-style syntax classification. ESM imports require explicit file
  extensions. Type stripping inside `node_modules` is rejected, matching Node's built-in support.
  The runtime does not type-check, read `tsconfig.json`, or support `.tsx`; enable
  `typescript-transform-runtime` instead of `typescript-runtime` for enums, runtime namespaces,
  and other transform-required syntax in module files or inline `language: "typescript"`
  execution source.

</details>

<details>
<summary><strong><code>node:net</code></strong></summary>

TCP sockets and servers built on WASI sockets.

- `net.createServer([options][, connectionListener])`, `net.createConnection(options[, connectListener])`, `net.connect(...)`
- `net.isIP(input)` / `net.isIPv4(input)` / `net.isIPv6(input)`
- `net.getDefaultAutoSelectFamily()` / `net.setDefaultAutoSelectFamily(value)` — stubs
- `net.Socket` (extends `stream.Duplex`): `connect`, `write`, `end`, `destroy`, `resetAndDestroy`, `setTimeout`, `setNoDelay`, `setKeepAlive`, `address`, `ref`, `unref`
  - Properties: `remoteAddress`, `remotePort`, `remoteFamily`, `localAddress`, `localPort`, `localFamily`, `bytesRead`, `bytesWritten`, `connecting`, `pending`, `readyState`
  - Events: `connect`, `ready`, `data`, `end`, `close`, `error`, `timeout`, `drain`, `lookup`
- `net.Server` (extends `EventEmitter`): `listen`, `close`, `address`, `getConnections`, `ref`, `unref`
  - Properties: `listening`, `maxConnections`
  - Events: `listening`, `connection`, `close`, `error`, `drop`
- `net.BlockList`, `net.SocketAddress`, `net.Stream`

**Not supported:** IPC/Unix domain sockets, Happy Eyeballs/`autoSelectFamily` (stubbed), `cluster` integration.

</details>

<details>
<summary><strong><code>node:os</code></strong></summary>

- `arch`, `platform`, `type`, `release`, `version`, `machine`, `hostname`, `homedir`, `tmpdir`, `endianness`
- `cpus`, `loadavg`, `freemem`, `totalmem`, `uptime`, `availableParallelism`
- `networkInterfaces`, `userInfo`, `getPriority`, `setPriority`
- `EOL`, `devNull`, `constants` (signals, errno, priority)

</details>

<details>
<summary><strong><code>node:path</code></strong></summary>

- `sep`, `delimiter`, `basename`, `dirname`, `extname`, `isAbsolute`, `join`, `normalize`, `relative`, `resolve`, `parse`, `format`, `matchesGlob`, `toNamespacedPath`, `posix`

</details>

<details>
<summary><strong><code>node:perf_hooks</code></strong></summary>

- `performance` — monotonic `now()`, deployment `timeOrigin`, `mark()`, `measure()`, `getEntries()`, `getEntriesByName()`, `getEntriesByType()`, `clearMarks()`, `clearMeasures()`, `toJSON()`
- `PerformanceEntry`, `PerformanceObserver`
- `monitorEventLoopDelay`, `createHistogram`, `constants`

</details>

<details>
<summary><strong><code>node:process</code></strong></summary>

- **Properties:** `argv`, `argv0`, `env`, `pid`, `ppid`, `platform` (`'wasi'`), `arch` (`'wasm32'`), `version`, `versions`, `config`, `features`, `execArgv`, `execPath`, `exitCode`, `stdout`, `stderr`
- **Methods:** `exit(code)`, `cwd()`, `nextTick(callback, ...args)`, `hrtime()`, `hrtime.bigint()`, `uptime()`, `cpuUsage()`, `memoryUsage()`, `kill(pid, signal)`, `abort()`, `emitWarning()`
- **User/Group:** `getuid`, `getgid`, `geteuid`, `getegid`, `getgroups`, `setuid`, `setgid`
- Inherits from `EventEmitter` — supports `on('uncaughtException')`, `on('unhandledRejection')`, etc.

</details>

<details>
<summary><strong><code>node:punycode</code></strong></summary>

- `decode`, `encode`, `toASCII`, `toUnicode`, `ucs2`, `version`

</details>

<details>
<summary><strong><code>node:querystring</code></strong></summary>

- `stringify` / `encode`, `parse` / `decode`, `escape`, `unescape`, `unescapeBuffer`

</details>

<details>
<summary><strong><code>node:readline</code></strong></summary>

- `createInterface`, `Interface`, `clearLine`, `clearScreenDown`, `cursorTo`, `moveCursor`, `emitKeypressEvents`
- `readline/promises` — promise-based API

</details>

<details>
<summary><strong><code>node:repl</code></strong> (stub)</summary>

- `start`, `REPLServer`, `Recoverable`, `builtinModules`

</details>

<details>
<summary><strong><code>node:sqlite</code></strong></summary>

Requires the `sqlite` feature flag. Provides a synchronous SQLite database API with an embedded SQLite engine.

- `DatabaseSync` — `prepare`, `exec`, `close`, `open`, `isOpen`, `isTransaction`, `createSession`, `applyChangeset`, `enableLoadExtension`, `function`, `aggregate`, `backup`
- `StatementSync` — `run`, `get`, `all`, `iterate`, `columns`, `setReadBigInts`, `setAllowBareNamedParameters`, `sourceSQL`, `expandedSQL`
- `Session` — `changeset`, `patchset`, `close`
- Constants: `SQLITE_CHANGESET_OMIT`, `SQLITE_CHANGESET_REPLACE`, `SQLITE_CHANGESET_ABORT`

**Not supported:** `loadExtension()` (throws — native extensions cannot be loaded in WASM).

</details>

<details>
<summary><strong><code>node:stream</code></strong></summary>

- `Readable` (with `from`, `fromWeb`, `toWeb`, `wrap`, and functional methods: `map`, `filter`, `flatMap`, `take`, `drop`, `toArray`, `forEach`, `reduce`, `some`, `every`, `find`)
- `Writable`, `Duplex`, `Transform`, `PassThrough`, `Stream`
- `pipeline`, `finished`, `compose`, `duplexPair`, `addAbortSignal`
- `getDefaultHighWaterMark`, `setDefaultHighWaterMark`, `isDisturbed`, `destroy`
- `stream/consumers` (`arrayBuffer`, `blob`, `buffer`, `json`, `text`)
- `stream/promises` — promise-based `pipeline` and `finished`

</details>

<details>
<summary><strong><code>node:string_decoder</code></strong></summary>

- `StringDecoder`

</details>

<details>
<summary><strong><code>node:test</code></strong></summary>

Built-in test runner.

- `test`, `describe` / `suite`, `it`, `before`, `after`, `beforeEach`, `afterEach`
- `mock` — function mocking utilities
- `run` — programmatic test execution

</details>

<details>
<summary><strong><code>node:timers</code></strong></summary>

- `setTimeout`, `setInterval`, `setImmediate`, `clearTimeout`, `clearInterval`
- `timers/promises` — promise-based `setTimeout`, `setInterval`, `setImmediate`

</details>

<details>
<summary><strong><code>node:tls</code></strong> (stub)</summary>

Compatibility stubs — TLS is handled transparently by the WASI-HTTP layer.

- `SecureContext`, `TLSSocket`, `Server`, `connect`, `createServer`, `createSecureContext`, `checkServerIdentity`, `getCiphers`, `rootCertificates`
- `DEFAULT_MIN_VERSION`, `DEFAULT_MAX_VERSION`, `DEFAULT_ECDH_CURVE`

</details>

<details>
<summary><strong><code>node:trace_events</code></strong></summary>

Partial compatibility API to unblock modules that inspect tracing state.

- `createTracing({ categories: string[] })` — creates a `Tracing` handle
- `Tracing#enable()` / `Tracing#disable()` — toggles local tracing state
- `Tracing#enabled` / `Tracing#categories` — read tracing configuration
- `getEnabledCategories()` — returns currently enabled categories as a comma-separated string

**Limitation:** No native trace sink; API-surface compatibility only.

</details>

<details>
<summary><strong><code>node:tty</code></strong></summary>

- `isatty`, `ReadStream`, `WriteStream`

</details>

<details>
<summary><strong><code>node:url</code></strong></summary>

- `URL`, `URLSearchParams`
- `parse`, `resolve`, `format` (legacy API)
- `domainToASCII`, `domainToUnicode`
- `fileURLToPath`, `pathToFileURL`, `urlToHttpOptions`

</details>

<details>
<summary><strong><code>node:util</code></strong></summary>

- `format`, `inspect`, `deprecate`, `debugLog`, `log`
- Type checks: `isArray`, `isBoolean`, `isNull`, `isNullOrUndefined`, `isNumber`, `isString`, `isSymbol`, `isUndefined`, `isRegExp`, `isObject`, `isDate`, `isError`, `isFunction`, `isPrimitive`, `isBuffer`
- `promisify`, `callbackify`
- `parseEnv`, `styleText`, `getCallSite`, `getCallSites`, `toUSVString`, `_extend`
- `TextEncoder`, `TextDecoder`

</details>

<details>
<summary><strong><code>node:v8</code></strong></summary>

- `getHeapStatistics`, `getHeapSpaceStatistics`, `getHeapSnapshot`, `getHeapCodeStatistics`
- `setFlagsFromString`, `writeHeapSnapshot`, `takeCoverage`, `stopCoverage`
- `serialize`, `deserialize`, `Serializer`, `Deserializer`, `DefaultSerializer`, `DefaultDeserializer`

</details>

<details>
<summary><strong><code>node:vm</code></strong></summary>

- `runInNewContext`, `runInContext`, `runInThisContext`, `createContext`, `isContext`, `compileFunction`
- `Script`, `createScript`
- `SourceTextModule` (experimental, limited `export const`/`export let`/`export var` support)

These contexts are synchronous compatibility contexts within one QuickJS runtime. For asynchronous
jobs in fresh runtimes with structured-clone results, use `wasm-rquickjs:execution`. Neither API is
a security sandbox; both share the enclosing component's capabilities and filesystem access.

</details>

<details>
<summary><strong><code>node:worker_threads</code></strong> (stub)</summary>

Compatibility stubs — workers are not supported in single-threaded WASM.

- `isMainThread`, `parentPort`, `workerData`, `threadId`, `resourceLimits`
- `Worker`, `BroadcastChannel`, `MessagePort`, `MessageChannel`
- `markAsUntransferable`, `moveMessagePortToContext`, `receiveMessageOnPort`
- `getEnvironmentData`, `setEnvironmentData`

</details>

<details>
<summary><strong><code>node:zlib</code></strong></summary>

- **Classes:** `Deflate`, `Inflate`, `Gzip`, `Gunzip`, `DeflateRaw`, `InflateRaw`, `Unzip`, `BrotliCompress`, `BrotliDecompress`
- **Factory:** `createGzip`, `createGunzip`, `createDeflate`, `createInflate`, `createDeflateRaw`, `createInflateRaw`, `createUnzip`, `createBrotliCompress`, `createBrotliDecompress`
- **Async:** `gzip`, `gunzip`, `deflate`, `inflate`, `deflateRaw`, `inflateRaw`, `unzip`, `brotliCompress`, `brotliDecompress`
- **Sync:** `gzipSync`, `gunzipSync`, `deflateSync`, `inflateSync`, `deflateRawSync`, `inflateRawSync`, `unzipSync`, `brotliCompressSync`, `brotliDecompressSync`
- `crc32`, `constants`, `codes`

</details>

#### Internal / Compatibility Modules

<details>
<summary><strong>Additional internal modules</strong></summary>

- `internal/url` — `isURL`
- `internal/http` — `kOutHeaders` symbol
- `base64-js` — `byteLength`, `toByteArray`, `fromByteArray`
- `ieee754` — `read`, `write`

</details>

### Compatibility Reports

- [NPM Library Compatibility Tracker](tests/libraries/libraries.md) — test results for popular npm packages
- [Node.js v22 Compatibility Report](tests/node_compat/report.md) — per-test results for vendored Node.js test suite

### Coming from QuickJS

- Global:
    - `parseInt`
    - `parseFloat`
    - `isNaN`
    - `isFinite`
    - `quickMicrotask`
    - `decodeURI`
    - `decodeURIComponent`
    - `encodeURI`
    - `encodeURIComponent`
    - `escape`
    - `unescape`
    - `Infinity`
    - `NaN`
    - `undefined`
    - `[Symbol.toStringTag]`

- `Object`
    - static methods and properties:
        - `create`
        - `getPrototypeOf`
        - `setPrototypeOf`
        - `defineProperty`
        - `defineProperties`
        - `getOwnPropertyNames`
        - `getOwnPropertySymbols`
        - `groupBy`
        - `keys`
        - `values`
        - `entries`
        - `isExtensible`
        - `preventExtensions`
        - `getOwnPropertyDescriptor`
        - `getOwnPropertyDescriptors`
        - `is`
        - `assign`
        - `seal`
        - `freeze`
        - `isSealed`
        - `isFrozen`
        - `fromEntries`
        - `hasOwn`
    - methods and properties:
        - `toString`
        - `toLocaleString`
        - `valueOf`
        - `hasOwnProperty`
        - `isPrototypeOf`
        - `propertyIsEnumerable`
        - `__proto__`
        - `__defineGetter__`
        - `__defineSetter__`
        - `__lookupGetter__`
        - `__lookupSetter__`
- `Function`
    - methods and properties:
        - `call`
        - `apply`
        - `bind`
        - `toString`
        - `[Symbol.hasInstance]`
        - `fileName`
        - `lineNumber`
        - `columnNumber`
- `Error`
    - methods and properties:
        - `name`
        - `message`
        - `toString`
    - static methods and properties:
        - `isError`
        - `captureStackTrace`
        - `stackTraceLimit`
        - `prepareStackTrace`
- `Generator`
    - methods and properties:
        - `next`
        - `return`
        - `throw`
        - `[Symbol.toStringTag]`
    - static methods and properties:
        - `from`
- `Iterator`
    - static methods and properties:
        - `from`
    - methods and properties:
        - `drop`
          `filter`
          `flatMap`
          `map`
          `take`
          `every`
          `find`
          `forEach`
          `some`
          `reduce`
          `toArray`
          `[Symbol.iterator]`
          `[Symbol.toStringTag]`
- `Array`
    - static methods and properties:
        - `isArray`
        - `from`
        - `of`
        - `[Symbol.species]`
    - methods and properties:
        - `at`
        - `with`
        - `concat`
        - `every`
        - `some`
        - `forEach`
        - `map`
        - `filter`
        - `reduce`
        - `reduceRight`
        - `fill`
        - `find`
        - `findIndex`
        - `findLast`
        - `findLastIndex`
        - `indexOf`
        - `lastIndexOf`
        - `includes`
        - `join`
        - `toString`
        - `toLocaleString`
        - `pop`
        - `push`
        - `shift`
        - `unshift`
        - `reverse`
        - `toReversed`
        - `sort`
        - `toSorted`
        - `slice`
        - `splice`
        - `toSpliced`
        - `copyWithin`
        - `flatMap`
        - `flat`
        - `values`
        - `[Symbol.iterator]`
        - `keys`
        - `entries`
- `Number`
    - static methods and properties:
        - `parseInt`
        - `parseFloat`
        - `isNaN`
        - `isFinite`
        - `isInteger`
        - `isSafeInteger`
        - `MAX_VALUE`
        - `MIN_VALUE`
        - `NaN`
        - `NEGATIVE_INFINITY`
        - `POSITIVE_INFINITY`
        - `EPSILON`
        - `MAX_SAFE_INTEGER`
        - `MIN_SAFE_INTEGER`
    - methods and properties:
        - `toExponential`
        - `toFixed`
        - `toPrecision`
        - `toString`
        - `toLocaleString`
        - `valueOf`
- `Boolean`
    - methods and properties:
        - `toString`
        - `valueOf`
- `String`
    - static methods and properties:
        - `fromCharCode`
        - `fromCodePoint`
        - `raw`
    - methods and properties:
        - `length`
        - `at`
        - `charCodeAt`
        - `charAt`
        - `concat`
        - `codePointAt`
        - `isWellFormed`
        - `toWellFormed`
        - `indexOf`
        - `lastIndexOf`
        - `includes`
        - `endsWith`
        - `startsWith`
        - `match`
        - `matchAll`
        - `search`
        - `split`
        - `substring`
        - `substr`
        - `slice`
        - `repeat`
        - `replace`
        - `replaceAll`
        - `padEnd`
        - `padStart`
        - `trim`
        - `trimEnd`
        - `trimRight`
        - `trimStart`
        - `trimLeft`
        - `toString`
        - `valueOf`
        - `localeCompare`
        - `normalize`
        - `toLowerCase`
        - `toUpperCase`
        - `toLocaleLowerCase`
        - `toLocaleUpperCase`
        - `[Symbol.iterator]`
        - `anchor`
        - `big`
        - `blink`
        - `bold`
        - `fixed`
        - `fontcolor`
        - `fontsize`
        - `italics`
        - `link`
        - `small`
        - `strike`
        - `sub`
        - `sup`
- `Symbol`
    - static methods and properties:
        - `for`
        - `keyFor`
    - methods and properties:
        - `toString`
        - `valueOf`
        - `description`
        - `[Symbol.toPrimitive]`
        - `[Symbol.toStringTag]`
- `Map`
    - static methods and properties:
        - `groupBy`
        - `[Symbol.species]`
    - methods and properties:
        - `set`
        - `get`
        - `has`
        - `delete`
        - `clear`
        - `size`
        - `forEach`
        - `values`
        - `keys`
        - `entries`
        - `[Symbol.iterator]`
        - `[Symbol.toStringTag]`
- `Set`
    - static methods and properties:
        - `[Symbol.species]`
    - methods and properties:
        - `add`
        - `has`
        - `delete`
        - `clear`
        - `size`
        - `forEach`
        - `isDisjointFrom`
        - `isSubsetOf`
        - `isSupersetOf`
        - `intersection`
        - `difference`
        - `symmetricDifference`
        - `union`
        - `values`
        - `keys`
        - `[Symbol.iterator]`
        - `entries`
        - `[Symbol.toStringTag]`
- `WeakMap`
    - methods and properties:
        - `set`
        - `get`
        - `has`
        - `delete`
        - `[Symbol.toStringTag]`
- `WeakSet`
    - methods and properties:
        - `add`
        - `has`
        - `delete`
        - `[Symbol.toStringTag]`
- `GeneratorFunction`
    - methods and properties:
        - `[Symbol.toStringTag]`
- `Math`
    - static methods and properties:
        - `min`
        - `max`
        - `abs`
        - `floor`
        - `ceil`
        - `round`
        - `sqrt`
        - `acos`
        - `asin`
        - `atan`
        - `atan2`
        - `cos`
        - `exp`
        - `log`
        - `pow`
        - `sin`
        - `tan`
        - `trunc`
        - `sign`
        - `cosh`
        - `sinh`
        - `tanh`
        - `acosh`
        - `asinh`
        - `atanh`
        - `expm1`
        - `log1p`
        - `log2`
        - `log10`
        - `cbrt`
        - `hypot`
        - `random`
        - `f16round`
        - `fround`
        - `imul`
        - `clz32`
        - `sumPrecise`
        - `[Symbol.toStringTag]`
        - `E`
        - `LN10`
        - `LN2`
        - `LOG2E`
        - `LOG10E`
        - `PI`
        - `SQRT1_2`
        - `SQRT2`
- `Reflect`
    - static methods and properties:
        - `apply`
        - `construct`
        - `defineProperty`
        - `deleteProperty`
        - `get`
        - `getOwnPropertyDescriptor`
        - `getPrototypeOf`
        - `has`
        - `isExtensible`
        - `ownKeys`
        - `preventExtensions`
        - `set`
        - `setPrototypeOf`
        - `[Symbol.toStringTag]`
- `RegExp`
    - static methods and properties:
        - `escape`
        - `[Symbol.species]`
    - methods and properties:
        - `flags`
        - `source`
        - `global`
        - `ignoreCase`
        - `multiline`
        - `dotAll`
        - `unicode`
        - `unicodeSets`
        - `sticky`
        - `hasIndices`
        - `exec`
        - `compile`
        - `test`
        - `toString`
        - `[Symbol.replace]`
        - `[Symbol.match]`
        - `[Symbol.matchAll]`
        - `[Symbol.search]`
        - `[Symbol.split]`
- `JSON`
    - static methods and properties:
        - `parse`
        - `stringify`
        - `[Symbol.toStringTag]`
- `Promise`
    - static methods and properties:
        - `resolve`
        - `reject`
        - `all`
        - `allSettled`
        - `any`
        - `try`
        - `race`
        - `withResolvers`
        - `[Symbol.species]`
    - methods and properties:
        - `then`
        - `catch`
        - `finally`
        - `[Symbol.toStringTag]`
- `AsyncFunction`
    - methods and properties:
        - `[Symbol.toStringTag]`
- `AsyncIterator`
    - methods and properties:
        - `next`
        - `return`
        - `throw`
- `AsyncGeneratorFunction`
    - methods and properties:
        - `[Symbol.toStringTag]`
- `AsyncGenerator`
    - methods and properties:
        - `next`
        - `return`
        - `throw`
        - `[Symbol.toStringTag]`
- `Date`
    - static methods and properties:
        - `now`
        - `parse`
        - `UTC`
    - methods and properties:
        - `valueOf`
        - `toString`
        - `[Symbol.toPrimitive]`
        - `toUTCString`
        - `toGMTString`
        - `toISOString`
        - `toDateString`
        - `toTimeString`
        - `toLocaleString`
        - `toLocaleDateString`
        - `toLocaleTimeString`
        - `getTimezoneOffset`
        - `getTime`
        - `getYear`
        - `getFullYear`
        - `getUTCFullYear`
        - `getMonth`
        - `getUTCMonth`
        - `getDate`
        - `getUTCDate`
        - `getHours`
        - `getUTCHours`
        - `getMinutes`
        - `getUTCMinutes`
        - `getSeconds`
        - `getUTCSeconds`
        - `getMilliseconds`
        - `getUTCMilliseconds`
        - `getDay`
        - `getUTCDay`
        - `setTime`
        - `setMilliseconds`
        - `setUTCMilliseconds`
        - `setSeconds`
        - `setUTCSeconds`
        - `setMinutes`
        - `setUTCMinutes`
        - `setHours`
        - `setUTCHours`
        - `setDate`
        - `setUTCDate`
        - `setMonth`
        - `setUTCMonth`
        - `setYear`
        - `setFullYear`
        - `setUTCFullYear`
        - `toJSON`
- `BigInt`
    - static methods and properties:
        - `asIntN`
        - `asUintN`
    - methods and properties:
        - `toString`
        - `valueOf`
        - `[Symbol.toStringTag]`
- `ArrayBuffer`
    - static methods and properties:
        - `isView`
        - `[Symbol.species`
    - methods and properties:
        - `byteLength`
        - `maxByteLength`
        - `resizeable`
        - `detached`
        - `resize`
        - `slice`
        - `transfer`
        - `transferToFixedLength`
        - `[Symbol.toStringTag]`
- `SharedArrayBuffer`
    - static methods and properties:
        - `[Symbol.species]`
    - methods and properties:
        - `byteLength`
        - `maxByteLength`
        - `growable`
        - `grow`
        - `slice`
        - `[Symbol.toStringTag]`
- Typed arrays (`Int8Array`, `Uint8Array`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `BigInt64Array`,
  `BigUint64Array`, `Float32Array`, `Float64Array`, `Float16Array`)
    - static methods and properties:
        - `from`
        - `of`
        - `[Symbol.species]`
    - methods and properties:
        - `length`
        - `at`
        - `with`
        - `buffer`
        - `byteLength`
        - `set`
        - `byteOffset`
        - `values`
        - `[Symbol.iterator]`
        - `keys`
        - `entries`
        - `[Symbol.toStringTag]`
        - `copyWithin`
        - `every`
        - `some`
        - `forEach`
        - `map`
        - `filter`
        - `reduce`
        - `reduceRight`
        - `fill`
        - `find`
        - `findIndex`
        - `findLast`
        - `findLastIndex`
        - `reverse`
        - `toReversed`
        - `slice`
        - `subarray`
        - `sort`
        - `toSorted`
        - `join`
        - `toLocaleString`
        - `indexOf`
        - `lastIndexOf`
        - `includes`
- `DataView`
    - methods and properties:
        - `buffer`
        - `byteLength`
        - `byteOffset`
        - `getInt8`
        - `getUint8`
        - `getInt16`
        - `getUint16`
        - `getInt32`
        - `getUint32`
        - `getBigInt64`
        - `getBigUint64`
        - `getFloat16`
        - `getFloat32`
        - `getFloat64`
        - `setInt8`
        - `setUint8`
        - `setInt16`
        - `setUint16`
        - `setInt32`
        - `setUint32`
        - `setBigInt64`
        - `setBigUint64`
        - `setFloat16`
        - `setFloat32`
        - `setFloat64`
        - `[Symbol.toStringTag]`
- `Atomics`
    - static methods and properties:
        - `add`
        - `and`
        - `or`
        - `sub`
        - `xor`
        - `exchange`
        - `compareExchange`
        - `load`
        - `store`
        - `isLockFree`
        - `pause`
        - `wait`
        - `notify`
        - `[Symbol.toStringTag]`
- `Performance`
    - methods and properties:
        - `now`
- `WeakRef`
    - methods and properties:
        - `deref`
        - `[Symbol.toStringTag]`
- `FinalizationRegistry`
    - methods and properties:
        - `register`
        - `unregister`
        - `[Symbol.toStringTag]`
- `Callsite`
    - methods and properties:
      -`isNative`
        - `getFileName`
        - `getFunction`
        - `getFunctionName`
        - `getColumnNumber`
        - `getLineNumber`
        - `[Symbol.toStringTag]`
- `Proxy`

## Developing

There are a few important things to keep in mind when working on the project:

- The `skeleton` crate can be opened and compiled separately when working on the APIs provided for JavaScript.
  Unfortunately we cannot use the `Cargo.toml` file name in it because that breaks Rust packaging - so before working on
  it, it has to be renamed to `Cargo.toml`
  and before committing back it has to be renamed back to `Cargo.toml_`.

- If the `skeleton` crate was compiled for testing, and then `wasm-rquickjs` is compiled, the `include_dir!` macro is
  embedding everything from the `skeleton` directory **including** the `target` directory, resulting in slow compilation
  times and huge resulting binaries. Use the `cleanup-skeleton.sh` script to quickly remove the `target` directory from
  the `skeleton` crate.

- Run `tools/check-skeleton-clippy.sh` to lint the supported Preview 2 and Preview 3 skeleton feature matrix. The helper
  temporarily symlinks `Cargo.toml` to the checked-in `Cargo.toml_`, directs output to the workspace-root `target/` cache,
  preserves that cache, and removes the symlink on exit. If a skeleton-local `target/` already exists, continue to use
  `cleanup-skeleton.sh` before embedding the skeleton.

- Runtime and node compatibility tests support opt-in caches for faster local iteration. Select Node with
  `nvm use 22.14.0`, then use the artifact and Wasmtime caches explicitly:

  ```sh
  WASM_RQUICKJS_TEST_ARTIFACT_CACHE=1 \
  WASM_RQUICKJS_TEST_WASMTIME_CACHE=1 \
  cargo test --test runtime --features use-golem-wasmtime -- module_resolution --report-time
  ```

  These caches may reuse generated wrapper, optimized component, and compiled Wasmtime artifacts. Every test still
  creates fresh wasm memory, a fresh Wasmtime `Store` and component instance, a fresh WASI context and temporary
  directory, and fresh QuickJS runtime state. Do not group compatibility cases into one wasm instance.

  `WASM_RQUICKJS_TEST_DROP_CACHE=1` forces generated artifacts to be rebuilt and bypasses Wasmtime's filesystem cache.
  `WASM_RQUICKJS_TEST_UNOPTIMIZED=1` skips Wizer pre-initialization for a shorter compile/test loop.
  `WASM_RQUICKJS_TEST_PREPARED_COMPONENT_CACHE=1` reuses immutable prepared `Engine`/`Linker`/`Component` state on the
  normal `TestInstance::new` path.

  For skeleton development, select a local performance profile:

  ```sh
  tools/dev-test.sh p2 fast-start runtime <exact_test_filter>
  tools/dev-test.sh p2 fast-run node_compat <test_filter>
  tools/dev-test.sh p2 fast-run node_compat <test_filter> --test-threads 4
  tools/dev-test.sh p3 standard runtime ':tag:group3'
  ```

  `fast-start` skips Wizer and uses one worker to minimize latency to the first result. `fast-run` runs Wizer,
  precompiles a changed component once before parallel workers start, reuses prepared components, and uses eight
  workers. Both accelerated profiles read the skeleton externally, reuse generated artifacts and Wasmtime's filesystem
  cache, and use locked Cargo builds. `standard` uses the embedded skeleton with optional caches and parent
  precompilation disabled, normal Wizer optimization, and default test-runner behavior.

  `fast-run` defaults to eight workers and `fast-start` to one; pass test-r's `--test-threads N` after the filter to
  override either default. The eight-worker default was measured on a 14-core Apple M3 Max MacBook Pro (10 performance
  cores, 4 efficiency cores, 36 GB RAM, macOS 26.5.1). Performance comparisons must report preparation time, test
  execution time, and total wall time separately: precompilation makes the execution phase much faster but adds
  preparation that is only recovered by a sufficiently large or repeated filter.

## Acknowledgements

The builtin JS modules are based on the work of several other projects:
  
- [abortcontroller-polyfill](https://github.com/mo/abortcontroller-polyfill)
- [base64-js](https://github.com/beatgammit/base64-js)
- [buffer](https://github.com/feross/buffer)
- [consoleTable](https://github.com/ronnyKJ/consoleTable)
- [eventemitter3](https://github.com/primus/eventemitter3)
- [fetch-blob](https://github.com/node-fetch/fetch-blob)
- [fetch.js](https://github.com/JakeChampion/fetch/blob/main/fetch.js)
- [FormData](https://github.com/jimmywarting/FormData)
- [ieee754](https://github.com/feross/ieee754)
- [url-search-params-polyfill](https://github.com/jerrybendy/url-search-params-polyfill)
- [structured-clone](https://github.com/ungap/structured-clone)
- [wasmedge-quickjs](https://github.com/second-state/wasmedge-quickjs)
- [web-streams-polyfill](https://github.com/MattiasBuelens/web-streams-polyfill)