wasm-rquickjs-cli 0.0.24

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
# 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
the [cargo-component](https://github.com/bytecodealliance/cargo-component) tool.

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

By default both feature flags are enabled.

### 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.

## 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`.

#### 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 |

### 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)

## Available JavaScript APIs

### APIs

#### Console

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`

#### HTTP (fetch)

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

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

#### URL

- `URL`
- `URLSearchParams`

#### Streams

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

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

#### Timeout functions

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

#### Abort Controller

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

#### Encoding

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

#### Structured Clone

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

- `structuredClone`

### `node:util`
- `format`
- `deprecate`
- `debugLog`
- `inspect`
- `isArray`
- `isBoolean`
- `isNull`
- `isNullOrUndefined`
- `isNumber`
- `isString`
- `isSymbol`
- `isUndefined`
- `isRegExp`
- `isObject`
- `isDate`
- `isError`
- `isFunction`
- `isPrimitive`
- `isBuffer`
- `log`
- `_extend`
- `promisify`
- `callbackify`

### `node:buffer`
- `Buffer`
- `INSPECT_MAX_BYTES`
- `kMaxLength`
- `kStringMaxLength`
- `constants`
- `SlowBuffer`

### `node:fs`
- `readFile`
- `readFileSync`
- `writeFile`
- `writeFileSync`

### `node:path`
- `sep`
- `delimiter`
- `basename`
- `dirname`
- `extname`
- `isAbsolute`
- `join`
- `normalize`
- `relative`
- `resolve`
- `parse`
- `format`
- `matchesGlob`
- `toNamespacedPath`
- `posix`

### `node:process`
- `argv`
- `argv0`
- `env`
- `cwd`

### `node:stream`
- `_uint8ArrayToBuffer`
- `addAbortSignal`
- `compose`
- `destroy`
- `Duplex`
- `finished`
- `isDisturbed`
- `_isUint8Array`
- `PassThrough`
- `pipeline`
- `Readable`
- `Stream`
- `Transform`
- `Writable`

### `base64-js`
- `byteLength`
- `toByteArray`
- `fromByteArray`

### `ieee754`
- `read`
- `write`

### Crypto
- `crypto.randomUUID`
- `crypto.getRandomValues`

### 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.

## 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