typenative 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -0
- package/CHANGELOG.md +201 -0
- package/CONTRIBUTION.md +1 -1
- package/bin/cli.js +1 -0
- package/bin/go/bridge.js +74 -14
- package/bin/go/convert.js +48 -0
- package/bin/go/metadata.js +13 -4
- package/bin/go/overrides.js +4 -6
- package/bin/go/stdlib.generated.js +2 -0
- package/bin/index.js +117 -0
- package/bin/main.js +1 -0
- package/bin/node/child_process.js +51 -3
- package/bin/node/cluster.js +41 -3
- package/bin/node/core.js +1 -1
- package/bin/node/crypto.js +205 -4
- package/bin/node/dgram.js +230 -6
- package/bin/node/dns.js +470 -7
- package/bin/node/errno_tables.js +445 -0
- package/bin/node/fs.js +21 -14
- package/bin/node/http.js +128 -30
- package/bin/node/http2.js +4 -1
- package/bin/node/module_v8.js +142 -0
- package/bin/node/net.js +9 -6
- package/bin/node/process.js +242 -0
- package/bin/node/readline.js +271 -0
- package/bin/node/registry.js +2 -1
- package/bin/node/sqlite.js +60 -12
- package/bin/node/stream.js +139 -7
- package/bin/node/test.js +311 -19
- package/bin/node/url.js +23 -5
- package/bin/node/util.js +18 -1
- package/bin/node/util_extra.js +6 -30
- package/bin/node/worker_threads.js +79 -19
- package/bin/transpiler.js +4019 -497
- package/bin/typecheck-node.js +1 -0
- package/bin/version.js +1 -1
- package/conformance.md +1025 -884
- package/examples/README.md +5 -5
- package/examples/json-server/README.md +31 -29
- package/examples/json-server/bench.mjs +130 -38
- package/package.json +1 -1
- package/types/typenative-go.d.ts +23 -0
- package/types/typenative-npm.d.ts +169 -5
- package/types/typenative.d.ts +185 -11
package/conformance.md
CHANGED
|
@@ -4,257 +4,314 @@ Every TypeScript language feature and standard-library API TypeNative aims to
|
|
|
4
4
|
support, split by area. Each ✅ row links to the [conformance/](conformance/)
|
|
5
5
|
probe that proves it transpiles correctly (`npm run conformance`, filter with an
|
|
6
6
|
optional substring: `node scripts/conformance.mjs <filter>`; `--native` runs the
|
|
7
|
-
self-hosted binary).
|
|
7
|
+
self-hosted binary).
|
|
8
|
+
|
|
9
|
+
| Status | Meaning |
|
|
10
|
+
| :----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| ✅ | Implemented; the linked probe proves it (`—` in the Probe column: implemented, not probed yet) |
|
|
12
|
+
| ❌ | Not implemented yet, but feasible: a known gap |
|
|
13
|
+
| 🚫 | Will not be implemented: needs something a native Go binary doesn't have (a JavaScript engine, mutable prototypes, shared memory between isolates, cgo), or is deprecated upstream |
|
|
14
|
+
|
|
15
|
+
User programs are type-checked against [types/](types/) only (`lib: []`), so an API that isn't
|
|
16
|
+
declared there fails the type check before it reaches the transpiler. The
|
|
17
|
+
[roadmap](#roadmap-known-limitations) lists the structural limitations and the order in which the
|
|
18
|
+
❌ rows are planned.
|
|
8
19
|
|
|
9
20
|
## Basic types
|
|
10
21
|
|
|
11
|
-
| Feature
|
|
12
|
-
|
|
|
13
|
-
| `number`
|
|
14
|
-
| `boolean`
|
|
15
|
-
| `string`
|
|
16
|
-
| `null`
|
|
17
|
-
| `undefined`
|
|
18
|
-
| `any` / `unknown`
|
|
19
|
-
|
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
22
|
+
| Feature | Status | Probe | Notes |
|
|
23
|
+
| ----------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
24
|
+
| `number` | ✅ | [syntax-arithmetic.ts](conformance/syntax-arithmetic.ts) | Transpiled to `float64` |
|
|
25
|
+
| `boolean` | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | Transpiled to `bool` |
|
|
26
|
+
| `string` | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | |
|
|
27
|
+
| `null` | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | |
|
|
28
|
+
| `undefined` | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | |
|
|
29
|
+
| `any` / `unknown` | ✅ | [syntax-selfhost-context.ts](conformance/syntax-selfhost-context.ts) | Dynamic values handled at runtime (JSON-like objects, arrays, primitives) |
|
|
30
|
+
| A variable declared `any` / `unknown` with a primitive initializer (`const x: any = '6'`) | ✅ | [semantics-any-variables.ts](conformance/semantics-any-variables.ts) | Dynamic: `-` `*` `/` use ToNumber, `==` coerces like JS, reassignment to another type works. `any + number` adds numbers (a string operand isn't concatenated), while `+` on two dynamic values decides at run time like JS ([syntax-callback-destructuring.ts](conformance/syntax-callback-destructuring.ts)); objects keep their inferred type |
|
|
31
|
+
| Nullable types (`T \| null`, `T \| undefined`) | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | Transpiled to Go pointer types |
|
|
32
|
+
| `bigint` | ✅ | [syntax-bigint.ts](conformance/syntax-bigint.ts) | `2n` literals → `*big.Int`; `**` → `.Exp`, comparisons via `.Cmp` |
|
|
33
|
+
| `bigint` bitwise / shift operators (`&`, `\|`, `^`, `~`, `<<`, `>>`, compound forms) | ✅ | [syntax-bigint-bitwise.ts](conformance/syntax-bigint-bitwise.ts) | `math/big`'s two's-complement `And` / `Or` / `Xor` / `Not`; shifts round toward -Infinity |
|
|
34
|
+
| `BigInt()`, `BigInt.asIntN` / `asUintN` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | Integers, numeric strings and booleans; a fraction throws a `RangeError`, a bad string a `SyntaxError` |
|
|
35
|
+
| bigint–number loose comparisons (`5n == 5`) | ❌ | — | `false` (no cross-type coercion) |
|
|
36
|
+
| `symbol` | ✅ | [syntax-symbols.ts](conformance/syntax-symbols.ts) | `Symbol()` → unique `*TnSymbol` pointers, usable as record keys |
|
|
37
|
+
| `object` type | ✅ | [syntax-object-type.ts](conformance/syntax-object-type.ts) | `object` → `interface{}` |
|
|
38
|
+
| `void` / `never` | ✅ | [syntax-void-never.ts](conformance/syntax-void-never.ts) | No return value in Go |
|
|
24
39
|
|
|
25
40
|
## Variables & destructuring
|
|
26
41
|
|
|
27
|
-
| Feature
|
|
28
|
-
|
|
|
29
|
-
| Variable declarations (`let` / `const`)
|
|
30
|
-
| Array destructuring
|
|
31
|
-
| Object destructuring
|
|
32
|
-
| Destructuring with defaults
|
|
33
|
-
| Destructured parameters
|
|
34
|
-
|
|
|
35
|
-
| Object
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
42
|
+
| Feature | Status | Probe | Notes |
|
|
43
|
+
| ---------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
44
|
+
| Variable declarations (`let` / `const`) | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | |
|
|
45
|
+
| Array destructuring | ✅ | [syntax-destructuring.ts](conformance/syntax-destructuring.ts) | Parenthesized initializers; elision and element/property reads |
|
|
46
|
+
| Object destructuring | ✅ | [syntax-destructuring.ts](conformance/syntax-destructuring.ts) | Parenthesized initializers; elision and element/property reads; the initializer is evaluated once ([lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts)) |
|
|
47
|
+
| Destructuring with defaults | ✅ | [syntax-destructuring-defaults.ts](conformance/syntax-destructuring-defaults.ts) | Missing elements/properties take defaults (nil- and bounds-checked) |
|
|
48
|
+
| Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
|
|
49
|
+
| Destructured callback parameters (`([k, v]) => …`, `({ a }) => …`), `[...map]`, `map.entries()`, `{ ...record, k: v }` | ✅ | [syntax-callback-destructuring.ts](conformance/syntax-callback-destructuring.ts) | Without annotations, in `map` / `filter` / `some` & co. over tuples, Map pairs and `Object.entries`; elements of mixed tuples are dynamic |
|
|
50
|
+
| Object shorthand | ✅ | [lib-go-container-heap.ts](conformance/lib-go-container-heap.ts) | `{ name, priority }` takes the fields from same-named variables |
|
|
51
|
+
| Object spread | ✅ | [syntax-object-spread.ts](conformance/syntax-object-spread.ts) | Spread sources copied field-by-field into the new struct |
|
|
52
|
+
| Array spread | ✅ | [syntax-array-spread.ts](conformance/syntax-array-spread.ts) | `[...arr]`, `fn(...args)` |
|
|
53
|
+
| `delete` operator | ✅ | [syntax-delete.ts](conformance/syntax-delete.ts) | `delete o.key` on records |
|
|
54
|
+
| Computed keys | ✅ | [syntax-computed-keys.ts](conformance/syntax-computed-keys.ts) | Computed keys become map entries; `o.name` reads lower to `.Get("name")` |
|
|
55
|
+
| Records / dictionaries | ✅ | [syntax-in-operator.ts](conformance/syntax-in-operator.ts) | `Record<K, V>` and objects indexed by key → Go maps; so are literals with keys that aren't identifiers (`{ 'Content-Type': … }`, [lib-node-http-server.ts](conformance/lib-node-http-server.ts)) |
|
|
56
|
+
| Reading a missing key of a `Record` / `Map` of primitives (`rec[k] === undefined`) | ❌ | — | Gives the value type's zero value (`""`, `0`), so the comparison is `false`; test with `k in rec` / `map.has(k)` |
|
|
57
|
+
| Tuples | ✅ | [syntax-tuples.ts](conformance/syntax-tuples.ts) | `[string, number]` fixed-length arrays |
|
|
58
|
+
| Top-level / module-scope variables | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Functions see main-file top-level variables |
|
|
59
|
+
| Numeric separators | ✅ | [syntax-numeric-separators.ts](conformance/syntax-numeric-separators.ts) | `1_000_000` |
|
|
60
|
+
| Hex / octal / binary literals | ✅ | [syntax-numeric-literals.ts](conformance/syntax-numeric-literals.ts) | `0xFF`, `0o17`, `0b1010`, `1e3` |
|
|
61
|
+
| `var` declarations (hoisting) | ✅ | [syntax-var.ts](conformance/syntax-var.ts) | Function- and module-level `var` |
|
|
62
|
+
| `using` / `await using` declarations | ✅ | [syntax-using.ts](conformance/syntax-using.ts) | Disposed in reverse order when the block ends (`defer`); `[Symbol.dispose]` methods |
|
|
63
|
+
| Writing past the end of an array (`arr[arr.length + 2] = x`) | ✅ | [semantics-array-growth.ts](conformance/semantics-array-growth.ts) | The array grows; holes read as the zero value (`0`, `""`), not `undefined` |
|
|
64
|
+
| Sparse-array holes | 🚫 | — | Slices have no holes: a hole would read as the zero value, not `undefined` |
|
|
46
65
|
|
|
47
66
|
## Operators
|
|
48
67
|
|
|
49
|
-
| Feature
|
|
50
|
-
|
|
|
51
|
-
| Arithmetic operators
|
|
52
|
-
| Exponent operator
|
|
53
|
-
| Bitwise operators
|
|
54
|
-
| Unsigned shift
|
|
55
|
-
| Comparison operators
|
|
56
|
-
| Logical operators
|
|
57
|
-
| Increment / decrement
|
|
58
|
-
| Non-null assertion (`!`)
|
|
59
|
-
| Ternary expressions
|
|
60
|
-
| Nullish coalescing
|
|
61
|
-
| Optional chaining
|
|
62
|
-
| Nullish / logical assignment
|
|
63
|
-
| `in` operator
|
|
64
|
-
| `typeof`
|
|
65
|
-
| `instanceof`
|
|
66
|
-
| JS truthiness
|
|
67
|
-
| Loose equality (`==`)
|
|
68
|
-
| Optional call (`fn?.()`)
|
|
69
|
-
| Comma operator
|
|
70
|
-
| `void` operator
|
|
71
|
-
| `new.target`
|
|
68
|
+
| Feature | Status | Probe | Notes |
|
|
69
|
+
| --------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| Arithmetic operators | ✅ | [syntax-arithmetic.ts](conformance/syntax-arithmetic.ts) | `+`, `-`, etc.; `%`/`%=` via `math.Mod` |
|
|
71
|
+
| Exponent operator | ✅ | [syntax-exponent.ts](conformance/syntax-exponent.ts) | `2 ** 10` |
|
|
72
|
+
| Bitwise operators | ✅ | [syntax-bitwise.ts](conformance/syntax-bitwise.ts) | `&`, `\|`, `^`, `<<`, `>>` |
|
|
73
|
+
| Unsigned shift | ✅ | [syntax-unsigned-shift.ts](conformance/syntax-unsigned-shift.ts) | `>>>` |
|
|
74
|
+
| Comparison operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `==`, `!=`, `===`, `!==`, etc. |
|
|
75
|
+
| Logical operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `&&`, `\|\|` |
|
|
76
|
+
| Increment / decrement | ✅ | [syntax-increment-expression.ts](conformance/syntax-increment-expression.ts) | `++`, `--`, incl. as expressions |
|
|
77
|
+
| Non-null assertion (`!`) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Stripped during transpilation |
|
|
78
|
+
| Ternary expressions | ✅ | [syntax-ternary.ts](conformance/syntax-ternary.ts) | `condition ? a : b` |
|
|
79
|
+
| Nullish coalescing | ✅ | [syntax-nullish.ts](conformance/syntax-nullish.ts) | `??` operator, incl. chains |
|
|
80
|
+
| Optional chaining | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `obj?.prop`, `arr?.[i]`, chains across calls |
|
|
81
|
+
| Nullish / logical assignment | ✅ | [syntax-logical-assignment.ts](conformance/syntax-logical-assignment.ts) | `??=`, `\|\|=`, `&&=` |
|
|
82
|
+
| `in` operator | ✅ | [syntax-in-operator.ts](conformance/syntax-in-operator.ts) | `"key" in obj` on records |
|
|
83
|
+
| `typeof` | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `typeof x === "string"`; `"function"` for function values |
|
|
84
|
+
| `instanceof` | ✅ | [syntax-instanceof.ts](conformance/syntax-instanceof.ts) | User classes, `Error` classes and Node globals (`URL`, `Uint8Array`, …) |
|
|
85
|
+
| JS truthiness | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `if (str)`, `!count`, `a \|\| fallback` on any type |
|
|
86
|
+
| Loose equality (`==`) | ✅ | [semantics-loose-equality.ts](conformance/semantics-loose-equality.ts), [semantics-any-variables.ts](conformance/semantics-any-variables.ts) | `bool`/`number`/`string` mixtures coerce like JS (`TnNumber`/`TnParseFloat`), also between `any` values (`TnLooseEqual`) |
|
|
87
|
+
| Optional call (`fn?.()`) | ✅ | [syntax-optional-call.ts](conformance/syntax-optional-call.ts) | Nil check on the function value; result is nullable |
|
|
88
|
+
| Comma operator | ✅ | [syntax-comma-operator.ts](conformance/syntax-comma-operator.ts) | In `for` headers (`i = 0, j = 10` / `i++, j--`) |
|
|
89
|
+
| `void` operator | ✅ | [syntax-void-operator.ts](conformance/syntax-void-operator.ts) | Evaluates, then `nil` |
|
|
90
|
+
| `new.target` | ✅ | [syntax-new-target.ts](conformance/syntax-new-target.ts) | Constructors pass the target class name through `super()` chains |
|
|
91
|
+
| `instanceof Map` / `Set` / `Date` / `Array`, subclass instances | ✅ | [syntax-instanceof-builtins.ts](conformance/syntax-instanceof-builtins.ts) | Maps and Sets made by `new Map()` / `new Set()` are tagged (records are not Maps); arrays exclude Buffers; `instanceof Parent` holds for subclass instances |
|
|
92
|
+
| `#x in obj` (private brand checks) | ✅ | [syntax-instanceof-builtins.ts](conformance/syntax-instanceof-builtins.ts) | An instance of the class declaring `#x`, or of a subclass |
|
|
72
93
|
|
|
73
94
|
## Control flow
|
|
74
95
|
|
|
75
|
-
| Feature
|
|
76
|
-
|
|
|
77
|
-
| If / else statements
|
|
78
|
-
| Switch statements
|
|
79
|
-
| Switch fallthrough
|
|
80
|
-
| `for` loops
|
|
81
|
-
| `continue`
|
|
82
|
-
| `break`
|
|
83
|
-
| `for...of` loops
|
|
84
|
-
| `for...in` loops
|
|
85
|
-
| `for await...of`
|
|
86
|
-
| `while` loops
|
|
87
|
-
| `do...while` loops
|
|
88
|
-
| Labeled loops
|
|
89
|
-
| `try` / `catch` / `finally`
|
|
90
|
-
| Optional catch binding (`catch {}`)
|
|
91
|
-
| Custom error classes
|
|
92
|
-
| `Error.message`
|
|
93
|
-
| `Error` `cause` (`new Error(message, { cause })`, `err.cause`)
|
|
94
|
-
| Narrowing
|
|
96
|
+
| Feature | Status | Probe | Notes |
|
|
97
|
+
| ------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
98
|
+
| If / else statements | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts) | Incl. unbraced bodies and else-if chains |
|
|
99
|
+
| Switch statements | ✅ | [syntax-switch.ts](conformance/syntax-switch.ts) | Case and default statements |
|
|
100
|
+
| Switch fallthrough | ✅ | [syntax-switch-fallthrough.ts](conformance/syntax-switch-fallthrough.ts) | Explicit fallthrough between cases |
|
|
101
|
+
| `for` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Standard `for` loops, incl. unbraced bodies |
|
|
102
|
+
| `continue` | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | `continue` in all loop kinds |
|
|
103
|
+
| `break` | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts), [syntax-do-while.ts](conformance/syntax-do-while.ts) | In switch cases and loops |
|
|
104
|
+
| `for...of` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts), [syntax-for-of-string.ts](conformance/syntax-for-of-string.ts) | Arrays, Maps, Sets, strings, tuples; `Object.entries()` unwrapping |
|
|
105
|
+
| `for...in` loops | ✅ | [syntax-for-in.ts](conformance/syntax-for-in.ts) | Key range over records/maps |
|
|
106
|
+
| `for await...of` | ✅ | [syntax-for-await.ts](conformance/syntax-for-await.ts) | Ranges over the async generator's channel |
|
|
107
|
+
| `while` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Transpiled to Go's `for` loops; assignment in condition |
|
|
108
|
+
| `do...while` loops | ✅ | [syntax-do-while.ts](conformance/syntax-do-while.ts) | Implemented with conditional break |
|
|
109
|
+
| Labeled loops | ✅ | [syntax-labeled-loops.ts](conformance/syntax-labeled-loops.ts) | `LabeledStatement` → Go labels; labeled `continue`/`break` |
|
|
110
|
+
| `try` / `catch` / `finally` | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | `throw` → `panic`; catch/finally via `defer`/`recover` |
|
|
111
|
+
| Optional catch binding (`catch {}`) | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | |
|
|
112
|
+
| Custom error classes | ✅ | [syntax-custom-errors.ts](conformance/syntax-custom-errors.ts) | `extends Error` → embedded `TnError`; constructors take the message |
|
|
113
|
+
| `Error.message` | ✅ | [syntax-error-message.ts](conformance/syntax-error-message.ts) | `throw new Error` panics with a `*TnError`; `.message` on caught values |
|
|
114
|
+
| `Error` `cause` (`new Error(message, { cause })`, `err.cause`) | ✅ | [lib-node-fetch-bad-port.ts](conformance/lib-node-fetch-bad-port.ts) | Built-in error classes too |
|
|
115
|
+
| Narrowing | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `T \| undefined` narrowed after `if (x)`, `x !== undefined`, early returns |
|
|
116
|
+
| Exhaustive `switch` without `default`; statements after a `switch` | ✅ | [syntax-switch-exhaustive.ts](conformance/syntax-switch-exhaustive.ts) | A function that can end without a `return` returns its result type's zero value (JS: `undefined`) |
|
|
117
|
+
| Labeled blocks and statements (`label: { … break label; }`) | ✅ | [syntax-labeled-blocks.ts](conformance/syntax-labeled-blocks.ts) | `break label` jumps past the statement (`goto`) |
|
|
118
|
+
| Throwing non-`Error` values (`throw 'x'`, `throw { code: 1 }`) | ✅ | — | Caught as `interface{}`; properties read dynamically |
|
|
119
|
+
| `debugger` | ✅ | — | Erased |
|
|
120
|
+
| `with` | 🚫 | — | Not allowed in strict mode (modules are strict) |
|
|
95
121
|
|
|
96
122
|
## Functions
|
|
97
123
|
|
|
98
|
-
| Feature
|
|
99
|
-
|
|
|
100
|
-
| Function declarations
|
|
101
|
-
| Arrow functions
|
|
102
|
-
| IIFEs
|
|
103
|
-
| Closures over mutable state
|
|
104
|
-
| Function types
|
|
105
|
-
| Default parameter values
|
|
106
|
-
| Rest parameters
|
|
107
|
-
| Spread in calls
|
|
108
|
-
| Optional parameters
|
|
109
|
-
| Destructured parameters
|
|
110
|
-
| Contextual object-literal arguments
|
|
111
|
-
| Recursion
|
|
112
|
-
| Recursive arrow functions
|
|
113
|
-
| Generators (`function*` / `yield` / `yield*`)
|
|
114
|
-
| Async generators (`async function*`)
|
|
115
|
-
| Custom iterators (`Symbol.iterator`)
|
|
116
|
-
| `as const` assertions
|
|
117
|
-
| Function overloads
|
|
118
|
-
| `this` parameter (`function f(this: T)`)
|
|
119
|
-
| `arguments` object
|
|
124
|
+
| Feature | Status | Probe | Notes |
|
|
125
|
+
| --------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
126
|
+
| Function declarations | ✅ | [syntax-functions.ts](conformance/syntax-functions.ts) | Transpiled to Go functions |
|
|
127
|
+
| Arrow functions | ✅ | [syntax-arrow-functions.ts](conformance/syntax-arrow-functions.ts) | Transpiled to anonymous functions |
|
|
128
|
+
| IIFEs | ✅ | [syntax-iife.ts](conformance/syntax-iife.ts) | `(() => { ... })()` and `(function name() { ... })()` |
|
|
129
|
+
| Closures over mutable state | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | Functions capturing and mutating outer variables; per-iteration `let` |
|
|
130
|
+
| Function types | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | `() => number`, `(x: number) => string` as type annotations |
|
|
131
|
+
| Default parameter values | ✅ | [syntax-default-params.ts](conformance/syntax-default-params.ts) | `function(x = defaultValue)`, incl. constructors, methods, arrows |
|
|
132
|
+
| Rest parameters | ✅ | [syntax-rest-params.ts](conformance/syntax-rest-params.ts) | `function(...args: T[])` → Go variadic |
|
|
133
|
+
| Spread in calls | ✅ | [syntax-spread-call.ts](conformance/syntax-spread-call.ts) | `f(...args)` incl. tuples |
|
|
134
|
+
| Optional parameters | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `function f(x?: string)` |
|
|
135
|
+
| Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
|
|
136
|
+
| Contextual object-literal arguments | ✅ | [syntax-contextual-arguments.ts](conformance/syntax-contextual-arguments.ts) | Struct type inferred from parameter / return type |
|
|
137
|
+
| Recursion | ✅ | [syntax-recursion.ts](conformance/syntax-recursion.ts) | Direct self-recursion |
|
|
138
|
+
| Recursive arrow functions | ✅ | [syntax-recursive-arrow.ts](conformance/syntax-recursive-arrow.ts) | `const f = () => … f() …` → declared, then assigned |
|
|
139
|
+
| Generators (`function*` / `yield` / `yield*`) | ✅ | [syntax-generators.ts](conformance/syntax-generators.ts) | `function*` runs in a goroutine sending yields over a channel; `for...of` ranges it |
|
|
140
|
+
| Async generators (`async function*`) | ✅ | [syntax-async-generators.ts](conformance/syntax-async-generators.ts) | Goroutine + channel, consumed with `for await` |
|
|
141
|
+
| Custom iterators (`Symbol.iterator`) | ✅ | [syntax-custom-iterators.ts](conformance/syntax-custom-iterators.ts) | `*[Symbol.iterator]()` → a `Symbol_iterator()` channel method |
|
|
142
|
+
| `as const` assertions | ✅ | [syntax-as-const.ts](conformance/syntax-as-const.ts) | Erased during transpilation |
|
|
143
|
+
| Function overloads | ✅ | [syntax-function-overloads.ts](conformance/syntax-function-overloads.ts) | Signatures are erased; the implementation is emitted |
|
|
144
|
+
| `this` parameter (`function f(this: T)`) | ✅ | [syntax-this-parameter.ts](conformance/syntax-this-parameter.ts) | Erased |
|
|
145
|
+
| `arguments` object | ✅ | [syntax-arguments.ts](conformance/syntax-arguments.ts) | Functions reading it take extra arguments variadically (`[]interface{}`) |
|
|
146
|
+
| Top-level `await` | ✅ | — | In modules (files with an `import` / `export`) |
|
|
147
|
+
| Generator `next()` | ✅ | [lib-iterator-helpers.ts](conformance/lib-iterator-helpers.ts) | `{ value, done }` |
|
|
148
|
+
| Generator `next(value)` (sending a value in) / `return()` / `throw()` | ❌ | — | Generators are goroutines feeding a channel: values only flow out |
|
|
149
|
+
| `fn.call` / `fn.apply` / `fn.bind` | ✅ | [syntax-function-values.ts](conformance/syntax-function-values.ts) | Function declarations and function values; `apply` spreads the array over the parameters; `thisArg` is ignored (methods taken from an object are already bound in Go) |
|
|
150
|
+
| `fn.name` / `fn.length` | ✅ | [syntax-function-values.ts](conformance/syntax-function-values.ts) | Known at compile time for declared functions, classes and function variables |
|
|
151
|
+
| `eval` / `new Function(…)` | 🚫 | — | Compile and run JavaScript at runtime: needs a JavaScript engine |
|
|
120
152
|
|
|
121
153
|
## Classes & interfaces
|
|
122
154
|
|
|
123
|
-
| Feature
|
|
124
|
-
|
|
|
125
|
-
| Classes
|
|
126
|
-
| Constructor parameter properties
|
|
127
|
-
| Class inheritance
|
|
128
|
-
| `implements` clauses
|
|
129
|
-
| Interface `extends`
|
|
130
|
-
| Static members
|
|
131
|
-
| Getters / setters (classes)
|
|
132
|
-
| Getters (object literals)
|
|
133
|
-
| Object-literal methods
|
|
134
|
-
| Private `#` fields
|
|
135
|
-
| Access modifiers (`private` / `protected` / `public` on members)
|
|
136
|
-
| Abstract classes
|
|
137
|
-
| Static initialization blocks (`static {}`)
|
|
138
|
-
| Class expressions (`const C = class {}`)
|
|
139
|
-
| Interfaces
|
|
140
|
-
| Optional properties
|
|
141
|
-
| Type-aware method dispatch
|
|
142
|
-
| Index signatures (`[key: string]: T`)
|
|
155
|
+
| Feature | Status | Probe | Notes |
|
|
156
|
+
| ---------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
157
|
+
| Classes | ✅ | [syntax-class.ts](conformance/syntax-class.ts) | Transpiled to Go structs with constructor and receiver methods |
|
|
158
|
+
| Constructor parameter properties | ✅ | [syntax-class-parameter-properties.ts](conformance/syntax-class-parameter-properties.ts) | `constructor(private x: number)` |
|
|
159
|
+
| Class inheritance | ✅ | [syntax-class-inheritance.ts](conformance/syntax-class-inheritance.ts) | `super.method()` → `self.Parent.method()`; inherited methods copied for `this` dispatch |
|
|
160
|
+
| `implements` clauses | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | `class C implements I` |
|
|
161
|
+
| Interface `extends` | ✅ | [syntax-interface-extends.ts](conformance/syntax-interface-extends.ts) | Inherited properties flattened into the derived struct |
|
|
162
|
+
| Static members | ✅ | [syntax-class-static.ts](conformance/syntax-class-static.ts) | Static members → package-level `Class_member` vars/functions |
|
|
163
|
+
| Getters / setters (classes) | ✅ | [syntax-class-getters.ts](conformance/syntax-class-getters.ts) | `c.v` reads/writes rewrite to `Get_v()`/`Set_v()` accessor calls |
|
|
164
|
+
| Getters (object literals) | ✅ | [syntax-object-getters.ts](conformance/syntax-object-getters.ts) | Getter closures stored as function fields; reads invoke them |
|
|
165
|
+
| Object-literal methods | ✅ | [syntax-object-methods.ts](conformance/syntax-object-methods.ts) | Method closures stored as function fields capturing the instance (`this` → the object) |
|
|
166
|
+
| Private `#` fields | ✅ | [syntax-class-private-fields.ts](conformance/syntax-class-private-fields.ts) | `#secret` → a `__secret` struct field, left out of `JSON.stringify` and `console.log` |
|
|
167
|
+
| Access modifiers (`private` / `protected` / `public` on members) | ✅ | [syntax-access-modifiers.ts](conformance/syntax-access-modifiers.ts) | `private` / `protected` / `public` are erased |
|
|
168
|
+
| Abstract classes | ✅ | [syntax-class-abstract.ts](conformance/syntax-class-abstract.ts) | Abstract members skipped; concrete methods copied onto subclasses |
|
|
169
|
+
| Static initialization blocks (`static {}`) | ✅ | [syntax-static-blocks.ts](conformance/syntax-static-blocks.ts) | Go `func init()` |
|
|
170
|
+
| Class expressions (`const C = class {}`) | ✅ | [syntax-class-expressions.ts](conformance/syntax-class-expressions.ts) | `const C = class {…}` becomes a class named after the variable |
|
|
171
|
+
| Interfaces | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | Transpiled to Go interfaces |
|
|
172
|
+
| Optional properties | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `prop?: Type` in interfaces/types |
|
|
173
|
+
| Type-aware method dispatch | ✅ | [semantics-method-dispatch.ts](conformance/semantics-method-dispatch.ts) | Class `.push()` / `.length` not confused with array builtins |
|
|
174
|
+
| Index signatures (`[key: string]: T`) | ✅ | [syntax-index-signatures.ts](conformance/syntax-index-signatures.ts) | `{ [k: K]: V }` is `Record<K, V>` (an ordered Go map) |
|
|
175
|
+
| Methods without a return-type annotation | ✅ | [syntax-method-return-inference.ts](conformance/syntax-method-return-inference.ts) | Inferred from the returns, as for functions (also returns nested in `if` / loops / `switch` / `try`); an inherited `return this` returns the subclass |
|
|
176
|
+
| Field initializers reading parameter properties or parent fields | ✅ | [syntax-class-field-order.ts](conformance/syntax-class-field-order.ts) | `super()`, then parameter properties, then field initializers, then the constructor body (TS's ES2020 order) |
|
|
177
|
+
| Arrow-function fields (`h = () => this.x`), fields reading earlier fields | ✅ | — | Run in the constructor; `this` is the instance |
|
|
178
|
+
| Private methods (`#m()`) | ✅ | [syntax-method-return-inference.ts](conformance/syntax-method-return-inference.ts) | |
|
|
179
|
+
| A private and a public member with the same name (`#x` and `x`) | ✅ | [syntax-private-public-names.ts](conformance/syntax-private-public-names.ts) | `#x` is the Go field `__x` |
|
|
180
|
+
| Private accessors (`get #x()`) / static private fields (`static #x`) | ✅ | [syntax-class-accessor-inheritance.ts](conformance/syntax-class-accessor-inheritance.ts), [syntax-class-static-inheritance.ts](conformance/syntax-class-static-inheritance.ts) | |
|
|
181
|
+
| `accessor` fields | ✅ | — | Plain fields (decorating them is not supported) |
|
|
182
|
+
| Static inheritance (`Child.staticOfParent()`) | ✅ | [syntax-class-static-inheritance.ts](conformance/syntax-class-static-inheritance.ts) | Resolved to the declaring class's `Parent_member` at compile time |
|
|
183
|
+
| Inherited getters / setters, `super.x` on accessors | ✅ | [syntax-class-accessor-inheritance.ts](conformance/syntax-class-accessor-inheritance.ts) | Accessors are copied onto subclasses like methods |
|
|
184
|
+
| Object-literal setters (`set x(v) {}`) | ✅ | [syntax-object-setters.ts](conformance/syntax-object-setters.ts) | A `Set_x` closure field: `o.x = v` calls it |
|
|
185
|
+
| Mixins (class factories, `return class extends Base {}`, `class extends f()`) | ❌ | — | `Unsupported syntax: ClassExpression` outside `const C = class {}` |
|
|
186
|
+
| Polymorphic `this` return types (fluent chains) | ✅ | [syntax-polymorphic-this.ts](conformance/syntax-polymorphic-this.ts) | `this` is the class; methods inherited by a subclass return the subclass |
|
|
187
|
+
| Dynamic keys on class instances and typed objects (`inst[key]`) | ✅ | [syntax-instance-keys.ts](conformance/syntax-instance-keys.ts) | A `switch` over the declared fields and getters (reads and writes); through `any`, reflection |
|
|
188
|
+
| Declaration merging (interface + interface, enum + enum, class + interface) | ✅ | [syntax-declaration-merging.ts](conformance/syntax-declaration-merging.ts) | Merged within one scope; an interface adds its properties to a same-named class as fields; namespace + function merging works too |
|
|
189
|
+
| Prototype mutation (`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`) | 🚫 | — | Classes are static Go structs with fixed method sets |
|
|
143
190
|
|
|
144
191
|
## Generics
|
|
145
192
|
|
|
146
|
-
| Feature | Status | Probe
|
|
147
|
-
| ------------------------------------------------------------- | :----: |
|
|
148
|
-
| Generic functions | ✅
|
|
149
|
-
| Generic classes | ✅
|
|
150
|
-
| Generic constraints (`<T extends U>`) | ✅
|
|
151
|
-
| Default type parameters (`<T = D>`) | ✅
|
|
152
|
-
| Generic interfaces / type aliases | ✅
|
|
153
|
-
| `const` type parameters / variance annotations (`in` / `out`) | ✅
|
|
193
|
+
| Feature | Status | Probe | Notes |
|
|
194
|
+
| ------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
|
|
195
|
+
| Generic functions | ✅ | [syntax-generic-functions.ts](conformance/syntax-generic-functions.ts) | Type parameters → Go generics; call sites infer from arguments |
|
|
196
|
+
| Generic classes | ✅ | [syntax-generic-classes.ts](conformance/syntax-generic-classes.ts) | Type parameters via Go generics |
|
|
197
|
+
| Generic constraints (`<T extends U>`) | ✅ | [syntax-generic-constraints.ts](conformance/syntax-generic-constraints.ts) | Object-type bounds become `any`; properties of `T` values read dynamically |
|
|
198
|
+
| Default type parameters (`<T = D>`) | ✅ | [syntax-generic-defaults.ts](conformance/syntax-generic-defaults.ts) | Defaults are erased; Go infers from arguments |
|
|
199
|
+
| Generic interfaces / type aliases | ✅ | [syntax-generic-interfaces.ts](conformance/syntax-generic-interfaces.ts) | Go generic structs; literals instantiate them (`Box[float64]{…}`) |
|
|
200
|
+
| `const` type parameters / variance annotations (`in` / `out`) | ✅ | [syntax-const-type-parameters.ts](conformance/syntax-const-type-parameters.ts) | Erased; object literals of method interfaces use an adapter struct |
|
|
154
201
|
|
|
155
202
|
## Enums
|
|
156
203
|
|
|
157
|
-
| Feature
|
|
158
|
-
|
|
|
159
|
-
| Numeric enums
|
|
160
|
-
| String enums
|
|
161
|
-
| `const enum`
|
|
162
|
-
| Computed / heterogeneous enum members
|
|
204
|
+
| Feature | Status | Probe | Notes |
|
|
205
|
+
| ---------------------------------------------- | :----: | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
206
|
+
| Numeric enums | ✅ | [syntax-enum-numeric.ts](conformance/syntax-enum-numeric.ts) | Numeric members are `float64` constants; string enums keep a named type |
|
|
207
|
+
| String enums | ✅ | [syntax-enum-string.ts](conformance/syntax-enum-string.ts) | `enum` declarations and member access |
|
|
208
|
+
| `const enum` | ✅ | [syntax-const-enum.ts](conformance/syntax-const-enum.ts) | Compiled like a regular enum |
|
|
209
|
+
| Computed / heterogeneous enum members | ✅ | [syntax-enum-computed.ts](conformance/syntax-enum-computed.ts) | Computed members assigned in source order; mixed enums keep each member's type |
|
|
210
|
+
| Reverse mapping (`Color[0]`), `Enum['Member']` | ✅ | [syntax-enum-reverse.ts](conformance/syntax-enum-reverse.ts) | A generated `Color__name` function: the last member with the value wins; an unknown value gives `""` (JS: `undefined`). String enum members concatenate and print as strings |
|
|
163
211
|
|
|
164
212
|
## Type-system features
|
|
165
213
|
|
|
166
|
-
| Feature
|
|
167
|
-
|
|
|
168
|
-
| Type aliases
|
|
169
|
-
| Union types
|
|
170
|
-
| Type guards (`is`)
|
|
171
|
-
| `as` assertions
|
|
172
|
-
| Self-host contextual typing
|
|
173
|
-
| Decorators (`@`)
|
|
174
|
-
|
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
|
|
|
180
|
-
|
|
|
181
|
-
| `
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
| `
|
|
214
|
+
| Feature | Status | Probe | Notes |
|
|
215
|
+
| ------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
216
|
+
| Type aliases | ✅ | [syntax-type-aliases.ts](conformance/syntax-type-aliases.ts) | `type P = { x: number }` → Go struct; alias-of-alias |
|
|
217
|
+
| Union types | ✅ | [syntax-union-types.ts](conformance/syntax-union-types.ts) | Narrowed via `typeof` checks |
|
|
218
|
+
| Type guards (`is`) | ✅ | [syntax-type-guards.ts](conformance/syntax-type-guards.ts) | `p is T` → Go `bool`; `in` checks struct fields at runtime |
|
|
219
|
+
| `as` assertions | ✅ | [syntax-type-aliases.ts](conformance/syntax-type-aliases.ts) | `x as T`, incl. angle-bracket syntax (`<T>x`); `any` values convert to `T` |
|
|
220
|
+
| Self-host contextual typing | ✅ | [syntax-selfhost-context.ts](conformance/syntax-selfhost-context.ts) | Object/array literals typed from context, `Record` literals, `in`, `any` params |
|
|
221
|
+
| Decorators (`@`) | ✅ | [syntax-decorators.ts](conformance/syntax-decorators.ts) | Standard method & class decorators, applied in source order; `this` is the receiver |
|
|
222
|
+
| Field / accessor / parameter decorators, `context.addInitializer`, `Symbol.metadata` | ❌ | — | Only method and class decorators: field and accessor decorators fail the type check (`ClassFieldDecoratorContext` / `ClassAccessorDecoratorContext` are not declared) |
|
|
223
|
+
| Namespaces / `module` blocks | ✅ | [syntax-namespaces.ts](conformance/syntax-namespaces.ts) | Flattened to prefixed declarations (`N.f` → `N_f`), nested and in types |
|
|
224
|
+
| `override` modifier | ✅ | [syntax-override.ts](conformance/syntax-override.ts) | Erased |
|
|
225
|
+
| `readonly` modifier (properties, `readonly T[]`) | ✅ | [syntax-readonly.ts](conformance/syntax-readonly.ts) | Erased (`readonly T[]` → `[]T`) |
|
|
226
|
+
| `satisfies` operator | ✅ | [syntax-satisfies.ts](conformance/syntax-satisfies.ts) | Checked by tsc, erased; the type guides literals |
|
|
227
|
+
| `keyof` / mapped types | ✅ | [syntax-keyof-mapped-types.ts](conformance/syntax-keyof-mapped-types.ts) | `keyof` → `string`; mapped types → structs (literal keys) or maps |
|
|
228
|
+
| Conditional types | ✅ | [syntax-conditional-types.ts](conformance/syntax-conditional-types.ts) | Resolved to their branch's Go type |
|
|
229
|
+
| `infer` types | ✅ | [syntax-infer-types.ts](conformance/syntax-infer-types.ts) | Resolved to their branch's Go type |
|
|
230
|
+
| `import type` / `export type` | ✅ | [syntax-import-type.ts](conformance/syntax-import-type.ts) | Type-only imports are erased |
|
|
231
|
+
| Intersection types (`A & B`) | ✅ | [syntax-intersection-types.ts](conformance/syntax-intersection-types.ts) | Object types merge into one struct |
|
|
232
|
+
| Literal types (`'a' \| 'b'`) | ✅ | [syntax-literal-types.ts](conformance/syntax-literal-types.ts) | Erased; string/number/boolean literals map to their base Go types |
|
|
233
|
+
| Tuple optional / rest / labeled elements | ✅ | [syntax-tuple-elements.ts](conformance/syntax-tuple-elements.ts) | Tuples are slices |
|
|
234
|
+
| Indexed access types (`T['k']`) | ✅ | [syntax-indexed-access-types.ts](conformance/syntax-indexed-access-types.ts) | `T['k']` resolves to the member type |
|
|
235
|
+
| Type-level `typeof` (`typeof obj`) | ✅ | [syntax-type-typeof.ts](conformance/syntax-type-typeof.ts) | The variable's Go type |
|
|
236
|
+
| Template literal types | ✅ | [syntax-template-literal-types.ts](conformance/syntax-template-literal-types.ts) | Template literal types → `string` |
|
|
237
|
+
| Utility types (`Partial`, `Pick`, `Omit`, …) | ✅ | [syntax-utility-types.ts](conformance/syntax-utility-types.ts) | `Partial` / `Required` / `Readonly` / `Pick` / `Omit` / `NonNullable` → the base type |
|
|
238
|
+
| Assertion functions (`asserts x is T`) | ✅ | [syntax-assertion-functions.ts](conformance/syntax-assertion-functions.ts) | No return value |
|
|
239
|
+
| Callable / construct signatures (`type F = { (): void }`) | ✅ | [syntax-callable-signatures.ts](conformance/syntax-callable-signatures.ts) | Function types; a class passed as a value is its constructor |
|
|
240
|
+
| JSX / `.tsx` syntax | ✅ | [syntax-jsx.tsx](conformance/syntax-jsx.tsx) | Renders to HTML strings (text escaped); components are calls with props |
|
|
241
|
+
| Ambient declarations (`declare`, `.d.ts`, `x!: T`) | ✅ | [syntax-ambient-declarations.ts](conformance/syntax-ambient-declarations.ts) | `declare` only types code; `declare const` is an unset variable |
|
|
242
|
+
| `export =` / `import x = require()` | ✅ | [syntax-export-equals.ts](conformance/syntax-export-equals.ts) | `import x = require()` is a namespace import |
|
|
243
|
+
| Recursive types (`type Tree = { children: Tree[] }`) | ✅ | — | Self-referencing structs |
|
|
194
244
|
|
|
195
245
|
## Modules & imports
|
|
196
246
|
|
|
197
|
-
| Feature
|
|
198
|
-
|
|
|
199
|
-
| Named imports
|
|
200
|
-
| Import renaming (`import { x as y }`)
|
|
201
|
-
| Named exports (`export const` / `export function`)
|
|
202
|
-
| Default imports
|
|
203
|
-
| Namespace imports
|
|
204
|
-
| Local file imports
|
|
205
|
-
| Default export
|
|
206
|
-
| Node.js built-in imports
|
|
207
|
-
| Go package imports
|
|
208
|
-
| npm package imports
|
|
209
|
-
| Re-exports (`export { x } from`, `export *`)
|
|
210
|
-
| Dynamic `import()`
|
|
211
|
-
| Side-effect imports (`import './mod'`)
|
|
212
|
-
| `import.meta.url`
|
|
247
|
+
| Feature | Status | Probe | Notes |
|
|
248
|
+
| ------------------------------------------------------------------ | :----: | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| Named imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from './file'` |
|
|
250
|
+
| Import renaming (`import { x as y }`) | ✅ | [syntax-import-renaming.ts](conformance/syntax-import-renaming.ts) | Local file imports |
|
|
251
|
+
| Named exports (`export const` / `export function`) | ✅ | [syntax-import-local.ts](conformance/syntax-import-local.ts) | Helper [import-local-helper.ts](conformance/import-local-helper.ts) exports `multiply` |
|
|
252
|
+
| Default imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import x from 'pkg'` — namespace stripped in output |
|
|
253
|
+
| Namespace imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import * as x from 'pkg'` |
|
|
254
|
+
| Local file imports | ✅ | [syntax-import-local.ts](conformance/syntax-import-local.ts) | Relative paths transpiled to a separate Go file (helper: [import-local-helper.ts](conformance/import-local-helper.ts)) |
|
|
255
|
+
| Default export | ✅ | [syntax-default-export.ts](conformance/syntax-default-export.ts) | `export default function` |
|
|
256
|
+
| Node.js built-in imports | ✅ | [lib-node-path.ts](conformance/lib-node-path.ts) | `node:x` or bare (`'fs'`), named / default / namespace imports, subpaths (`fs/promises`) (see [Node builtins](#node-builtins-node)) |
|
|
257
|
+
| Go package imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from 'go:pkg'` |
|
|
258
|
+
| npm package imports | ✅ | [syntax-import-npm.ts](conformance/syntax-import-npm.ts) | `import { x } from 'pkg'` mapped to Go module imports |
|
|
259
|
+
| Re-exports (`export { x } from`, `export *`) | ✅ | [syntax-re-exports.ts](conformance/syntax-re-exports.ts) | Re-exported files are included (one Go package) |
|
|
260
|
+
| Dynamic `import()` | ✅ | [syntax-dynamic-import.ts](conformance/syntax-dynamic-import.ts) | `const m = await import('./x')` is a namespace import |
|
|
261
|
+
| Side-effect imports (`import './mod'`) | ✅ | [syntax-side-effect-import.ts](conformance/syntax-side-effect-import.ts) | Module top-level statements run in Go's `init()` |
|
|
262
|
+
| `import.meta.url` | ✅ | [syntax-import-meta.ts](conformance/syntax-import-meta.ts) | The `file://` URL of the running program (`os.Executable` → `pathToFileURL`) |
|
|
263
|
+
| JSON modules (`import data from './x.json' with { type: 'json' }`) | ✅ | [lib-json-modules.ts](conformance/lib-json-modules.ts) | Read at compile time and compiled as an object literal, so fields keep their types (helper [json-module-helper.json](conformance/json-module-helper.json)); needs `resolveJsonModule` and a `module` setting that allows import attributes in a project tsconfig |
|
|
213
264
|
|
|
214
265
|
## Async & timing
|
|
215
266
|
|
|
216
|
-
| Feature
|
|
217
|
-
|
|
|
218
|
-
| `async` / `await`
|
|
219
|
-
| Async arrow callbacks (`emitter.on('x', async () => { await … })`, `test('t', async () => …)`) |
|
|
220
|
-
| `Promise` constructor / `.then`
|
|
221
|
-
| `Promise.all`
|
|
222
|
-
| `Promise.resolve`
|
|
223
|
-
| `Promise.reject` / `.catch` / `.finally`
|
|
224
|
-
| `Promise.race` / `allSettled` / `any`
|
|
225
|
-
| `clearTimeout`
|
|
226
|
-
| `setInterval` / `clearInterval`
|
|
227
|
-
| `queueMicrotask`
|
|
228
|
-
| `setTimeout`
|
|
267
|
+
| Feature | Status | Probe | Notes |
|
|
268
|
+
| ---------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
269
|
+
| `async` / `await` | ✅ | [syntax-async-await.ts](conformance/syntax-async-await.ts) | The body runs synchronously until its first `await`; `await` runs pending event-loop tasks while it waits; the loop drains before exit |
|
|
270
|
+
| Async arrow callbacks (`emitter.on('x', async () => { await … })`, `test('t', async () => …)`) | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Run to completion when called (their awaits keep the event loop running), so the caller sees them finish before it continues |
|
|
271
|
+
| `Promise` constructor / `.then` | ✅ | [syntax-promise-then.ts](conformance/syntax-promise-then.ts) | The executor runs synchronously; promises are buffered channels; `.then` callbacks run on the event loop |
|
|
272
|
+
| `Promise.all` | ✅ | [syntax-promise-all.ts](conformance/syntax-promise-all.ts) | `TnPromiseAll` drains every promise channel into a slice |
|
|
273
|
+
| `Promise.resolve` | ✅ | [lib-promise-resolve.ts](conformance/lib-promise-resolve.ts) | Buffered channel holding the value |
|
|
274
|
+
| `Promise.reject` / `.catch` / `.finally` | ✅ | [lib-promise-catch.ts](conformance/lib-promise-catch.ts) | Rejected promises are closed channels with a reason; `await` rethrows |
|
|
275
|
+
| `Promise.race` / `allSettled` / `any` | ✅ | [lib-promise-combinators.ts](conformance/lib-promise-combinators.ts) | Goroutine per promise; first settled / all settled / first fulfilled |
|
|
276
|
+
| `clearTimeout` | ✅ | [lib-timers.ts](conformance/lib-timers.ts) | `TnClearTimeout` stops the timer |
|
|
277
|
+
| `setInterval` / `clearInterval` | ✅ | [lib-set-interval.ts](conformance/lib-set-interval.ts) | `time.Ticker` posting to the event loop; the process lives until cleared |
|
|
278
|
+
| `queueMicrotask` | ✅ | [lib-queue-microtask.ts](conformance/lib-queue-microtask.ts) | Runs after the current synchronous code (end of main or of an event-loop task) |
|
|
279
|
+
| `setTimeout` | ✅ | [lib-set-timeout.ts](conformance/lib-set-timeout.ts) | `time.AfterFunc` posting the callback to the event loop, which keeps the process alive |
|
|
280
|
+
| `resolve` / `reject` passed as values | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | `new Promise((resolve) => setTimeout(resolve, ms))` |
|
|
281
|
+
| Async class methods (instance, static, inherited, unannotated); `return otherPromise()` | ✅ | [syntax-async-methods.ts](conformance/syntax-async-methods.ts) | Lowered like async functions; a returned promise is awaited |
|
|
282
|
+
| `Promise.withResolvers` / `Promise.try` | ✅ | [lib-promise-extras.ts](conformance/lib-promise-extras.ts) | |
|
|
283
|
+
| Async arrows kept as values (`const f = async () => …`) | ✅ | [lib-promise-extras.ts](conformance/lib-promise-extras.ts) | Return a promise like async functions (concise bodies too); async arrows passed straight to a call run inline (see above) |
|
|
229
284
|
|
|
230
285
|
## Semantics (JS behaviour preserved)
|
|
231
286
|
|
|
232
|
-
| Feature
|
|
233
|
-
|
|
|
234
|
-
| Array reference semantics
|
|
235
|
-
|
|
|
236
|
-
| Object
|
|
237
|
-
| Object
|
|
238
|
-
|
|
|
239
|
-
|
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
|
|
|
243
|
-
|
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
|
|
|
247
|
-
|
|
|
287
|
+
| Feature | Status | Probe | Notes |
|
|
288
|
+
| --------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
289
|
+
| Array reference semantics | ✅ | [semantics-array-reference.ts](conformance/semantics-array-reference.ts) | Array variables hold `*[]T` so aliases share the slice header |
|
|
290
|
+
| `any[]` arrays mutated through a parameter (`function f(a: any[]) { a.push(x) }`) | ❌ | — | `any[]` arrays are plain `[]interface{}`, not shared references: a `push` inside the callee is lost to the caller (typed arrays share) |
|
|
291
|
+
| Object reference semantics | ✅ | [semantics-object-reference.ts](conformance/semantics-object-reference.ts) | Aliased objects share state; [semantics-parameter-mutation.ts](conformance/semantics-parameter-mutation.ts) |
|
|
292
|
+
| Object identity | ✅ | [semantics-object-identity.ts](conformance/semantics-object-identity.ts) | Equal literals are different references |
|
|
293
|
+
| Object key order | ✅ | [semantics-object-key-order.ts](conformance/semantics-object-key-order.ts) | Insertion order preserved |
|
|
294
|
+
| Map insertion order | ✅ | [semantics-map-order.ts](conformance/semantics-map-order.ts) | Iteration follows insertion order |
|
|
295
|
+
| Set insertion order | ✅ | [semantics-set-order.ts](conformance/semantics-set-order.ts) | Spread follows insertion order |
|
|
296
|
+
| Default sort is lexicographic | ✅ | [semantics-default-sort.ts](conformance/semantics-default-sort.ts) | `[10, 9, 1].sort()` → `1,10,9` |
|
|
297
|
+
| Float math | ✅ | [semantics-float-math.ts](conformance/semantics-float-math.ts) | `7 / 2 === 3.5`, `0.1 + 0.2 !== 0.3` |
|
|
298
|
+
| Integer precision | ✅ | [semantics-integer-precision.ts](conformance/semantics-integer-precision.ts) | `2 ** 53 + 1 === 2 ** 53` |
|
|
299
|
+
| `NaN` semantics | ✅ | [semantics-nan.ts](conformance/semantics-nan.ts) | `NaN !== NaN`, `Number.isNaN(0 / 0)` |
|
|
300
|
+
| String-number concatenation order | ✅ | [semantics-string-number-concat.ts](conformance/semantics-string-number-concat.ts) | `'a' + 1 + 2` vs `1 + 2 + 'a'` |
|
|
301
|
+
| Array truthiness | ✅ | [semantics-array-truthy.ts](conformance/semantics-array-truthy.ts) | Empty array is truthy |
|
|
302
|
+
| An object's own `length` field (`{ length: 3 }.length`) | ✅ | [semantics-length-field.ts](conformance/semantics-length-field.ts) | A field read, not an array length |
|
|
303
|
+
| Loop closures capture per-iteration `let` | ✅ | [semantics-loop-closures.ts](conformance/semantics-loop-closures.ts) | |
|
|
304
|
+
| Functions stored in Records | ✅ | [semantics-record-functions.ts](conformance/semantics-record-functions.ts) | `rec.fn()` → `rec.Get("fn")()`, also for names like `get` / `sort` |
|
|
248
305
|
|
|
249
306
|
## Sample apps
|
|
250
307
|
|
|
251
308
|
End-to-end programs that combine many features the way real code does (they run in the suite like any probe).
|
|
252
309
|
|
|
253
|
-
| App
|
|
254
|
-
|
|
|
255
|
-
| `wc`-style CLI
|
|
256
|
-
| JSON API on HTTP + SQLite | [app-http-sqlite.ts](conformance/app-http-sqlite.ts)
|
|
257
|
-
| Stream pipeline
|
|
310
|
+
| App | Probe | Covers |
|
|
311
|
+
| ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
312
|
+
| `wc`-style CLI | [app-cli-wordcount.ts](conformance/app-cli-wordcount.ts) | `util.parseArgs`, `fs`, `path`, `os.EOL`, a class with a `Map` field, tuples sorted with a `\|\|` comparator, `reduce` into an object, `crypto` |
|
|
313
|
+
| JSON API on HTTP + SQLite | [app-http-sqlite.ts](conformance/app-http-sqlite.ts) | `http.createServer` routing, `URL`, `node:sqlite` prepared statements, `fetch` (POST / GET / DELETE), JSON bodies, status codes |
|
|
314
|
+
| Stream pipeline | [app-stream-pipeline.ts](conformance/app-stream-pipeline.ts) | A generator through `Readable.from`, a CSV-aggregating `Transform`, `Float64Array` series, `stream/promises` `pipeline` to files, gzip and Brotli streams, SHA-256 |
|
|
258
315
|
|
|
259
316
|
## Standard library
|
|
260
317
|
|
|
@@ -264,186 +321,219 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
264
321
|
|
|
265
322
|
### `console`
|
|
266
323
|
|
|
267
|
-
| API
|
|
268
|
-
|
|
|
269
|
-
| `console.log`
|
|
270
|
-
| `console.error`
|
|
271
|
-
| `console.warn`
|
|
272
|
-
| `console.time` / `console.timeEnd` / `console.timeLog`
|
|
273
|
-
| `console.info` / `debug` / `dir` / `count` / `countReset` / `group` / `groupEnd` / `assert` / `trace` |
|
|
274
|
-
| `console.table` (arrays, objects, `Map`, `Set`, a `properties` filter)
|
|
324
|
+
| API | Status | Probe | Notes |
|
|
325
|
+
| ----------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
326
|
+
| `console.log` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts) | `fmt.Println`; non-string arguments print like Node (`util.inspect`), format strings like `util.format` |
|
|
327
|
+
| `console.error` | ✅ | [lib-console-error.ts](conformance/lib-console-error.ts) | `fmt.Fprintln(os.Stderr, ...)` |
|
|
328
|
+
| `console.warn` | ✅ | [lib-console-error.ts](conformance/lib-console-error.ts) | Mapped to stderr like `console.error` |
|
|
329
|
+
| `console.time` / `console.timeEnd` / `console.timeLog` | ✅ | [lib-console-time.ts](conformance/lib-console-time.ts) | Node's format: `label: 1.234ms` |
|
|
330
|
+
| `console.info` / `debug` / `dir` / `count` / `countReset` / `group` / `groupEnd` / `assert` / `trace` | ✅ | [lib-console-more.ts](conformance/lib-console-more.ts) | `group` indents every later console line; `assert` prints `Assertion failed` |
|
|
331
|
+
| `console.table` (arrays, objects, `Map`, `Set`, a `properties` filter) | ✅ | [lib-node-console-table.ts](conformance/lib-node-console-table.ts) | Node's box-drawn layout (left-aligned cells); other values are logged as is |
|
|
275
332
|
|
|
276
333
|
### `Math`
|
|
277
334
|
|
|
278
|
-
| API
|
|
279
|
-
|
|
|
280
|
-
| `Math.floor` / `ceil` / `round`
|
|
281
|
-
| `Math.abs` / `sqrt` / `pow`
|
|
282
|
-
| `Math.min` / `Math.max`
|
|
283
|
-
| `Math.max(...arr)` / spread & variadic
|
|
284
|
-
| `Math.random`
|
|
285
|
-
| `Math.log` / `log2` / `log10`
|
|
286
|
-
| `Math.sin` / `cos` / `tan`
|
|
287
|
-
| `Math.trunc` / `sign`
|
|
288
|
-
| Constants (`Math.PI`, `Math.E`, …)
|
|
289
|
-
| `Math.asin` / `acos` / `atan` / `atan2` / `hypot` / `cbrt` / `exp`
|
|
335
|
+
| API | Status | Probe | Notes |
|
|
336
|
+
| ----------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ----------------------------------------------------------- |
|
|
337
|
+
| `Math.floor` / `ceil` / `round` | ✅ | [lib-math.ts](conformance/lib-math.ts) | Mapped to `math.Floor`, `math.Ceil`, `math.Round` |
|
|
338
|
+
| `Math.abs` / `sqrt` / `pow` | ✅ | [lib-math.ts](conformance/lib-math.ts) | Mapped to corresponding `math` functions |
|
|
339
|
+
| `Math.min` / `Math.max` | ✅ | [lib-math-min-max.ts](conformance/lib-math-min-max.ts) | Go builtins `min` / `max` |
|
|
340
|
+
| `Math.max(...arr)` / spread & variadic | ✅ | [lib-math-min-max.ts](conformance/lib-math-min-max.ts) | Spread and any number of arguments via `slices.Max` / `max` |
|
|
341
|
+
| `Math.random` | ✅ | [lib-math-random.ts](conformance/lib-math-random.ts) | Mapped to `rand.Float64()` |
|
|
342
|
+
| `Math.log` / `log2` / `log10` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Log` / `math.Log2` / `math.Log10` |
|
|
343
|
+
| `Math.sin` / `cos` / `tan` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Sin` / `math.Cos` / `math.Tan` |
|
|
344
|
+
| `Math.trunc` / `sign` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Trunc` / inline sign check |
|
|
345
|
+
| Constants (`Math.PI`, `Math.E`, …) | ✅ | [lib-math-constants.ts](conformance/lib-math-constants.ts) | `math.Pi`, `math.E`, `math.Sqrt2`, … |
|
|
346
|
+
| `Math.asin` / `acos` / `atan` / `atan2` / `hypot` / `cbrt` / `exp` | ✅ | [lib-math-more.ts](conformance/lib-math-more.ts) | Corresponding `math` functions |
|
|
347
|
+
| `Math.sinh` / `cosh` / `tanh` / `expm1` / `log1p` | ✅ | — | Corresponding `math` functions |
|
|
348
|
+
| `Math.fround` / `imul` / `clz32` / `asinh` / `acosh` / `atanh` / `sumPrecise` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | `sumPrecise` is a compensated (Neumaier) sum |
|
|
349
|
+
| `Math.f16round` | ❌ | — | Not declared |
|
|
290
350
|
|
|
291
351
|
### `JSON`
|
|
292
352
|
|
|
293
|
-
| API
|
|
294
|
-
|
|
|
295
|
-
| `JSON.parse`
|
|
296
|
-
| `JSON.stringify`
|
|
353
|
+
| API | Status | Probe | Notes |
|
|
354
|
+
| ----------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
355
|
+
| `JSON.parse` | ✅ | [lib-json-parse.ts](conformance/lib-json-parse.ts) | Mapped to `encoding/json` `Unmarshal`; assigned to an interface type, the result converts into its struct |
|
|
356
|
+
| `JSON.stringify` | ✅ | [lib-json-stringify.ts](conformance/lib-json-stringify.ts) | Reflection serializer includes unexported struct fields and inherited ones |
|
|
357
|
+
| `JSON.stringify` `space`, replacer (function or key list), `toJSON()`; circular structures; `JSON.parse` reviver and `SyntaxError`s | ✅ | [lib-json-options.ts](conformance/lib-json-options.ts) | Node's layout; Dates serialize as ISO strings, `Map` / `Set` as `{}`, bigints throw. A replacer or reviver returning `undefined` gives `null` (it doesn't drop the key) |
|
|
358
|
+
| Key order of `JSON.parse` objects | ✅ | [lib-object-keys-typed.ts](conformance/lib-object-keys-typed.ts) | Parsed objects are ordered records (a duplicate key keeps its first position and last value); `delete`, `in`, `for...in` and spreads keep the order |
|
|
297
359
|
|
|
298
360
|
### `Object`
|
|
299
361
|
|
|
300
|
-
| API
|
|
301
|
-
|
|
|
302
|
-
| `Object.keys` / `values` / `entries`
|
|
303
|
-
| `Object.
|
|
304
|
-
| `Object.
|
|
305
|
-
| `Object.
|
|
306
|
-
| `Object.
|
|
362
|
+
| API | Status | Probe | Notes |
|
|
363
|
+
| ---------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
364
|
+
| `Object.keys` / `values` / `entries` | ✅ | [lib-object-helpers.ts](conformance/lib-object-helpers.ts) | Map key/value iteration helpers; typed results for maps and records |
|
|
365
|
+
| `Object.keys` / `values` / `entries`, `for...in` on typed objects (interfaces, object literals, class instances) | ✅ | [lib-object-keys-typed.ts](conformance/lib-object-keys-typed.ts) | Own data fields in declaration order, a parent class's first; no `#private` fields or accessors (they are on the prototype); unset optional properties are absent |
|
|
366
|
+
| `Object.assign` | ✅ | [lib-object-assign.ts](conformance/lib-object-assign.ts) | Sources (structs, maps, dynamic objects) copied into an ordered map |
|
|
367
|
+
| `Object.freeze` / `seal` / `preventExtensions` / `isFrozen` / `isSealed` / `isExtensible` | ✅ | [lib-object-freeze.ts](conformance/lib-object-freeze.ts) | Integrity level tracked by identity; writes rejected by `Readonly<T>` types (`preventExtensions` / `isSealed` / `isExtensible` not probed) |
|
|
368
|
+
| `Object.fromEntries` | ✅ | [lib-object-from-entries.ts](conformance/lib-object-from-entries.ts) | `TnFromEntries` → dynamic object |
|
|
369
|
+
| `Object.hasOwn` / `defineProperty` / `getOwnPropertyNames` | ✅ | [lib-object-own.ts](conformance/lib-object-own.ts) | Maps, dynamic objects and typed objects (literal keys); `{ value }` descriptors |
|
|
370
|
+
| `Object.hasOwn` / `defineProperty` with a non-literal key on a typed object | ✅ | [lib-object-own-computed.ts](conformance/lib-object-own-computed.ts) | A `switch` over the declared fields (an unset optional field is not own) |
|
|
371
|
+
| `Object.is` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | SameValue; two empty object literals may share an address in Go, so `Object.is({}, {})` can be `true` |
|
|
372
|
+
| `Object.groupBy` / `Map.groupBy` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | Groups in first-seen key order |
|
|
373
|
+
| `Object.create` / `getPrototypeOf` / `getOwnPropertyDescriptor(s)` / `defineProperties` | ❌ | — | Not declared |
|
|
307
374
|
|
|
308
375
|
### `String`
|
|
309
376
|
|
|
310
|
-
| API
|
|
311
|
-
|
|
|
312
|
-
| Template literals
|
|
313
|
-
| Tagged templates
|
|
314
|
-
| `toUpperCase` / `toLowerCase`
|
|
315
|
-
| `trim` / `trimStart` / `trimEnd`
|
|
316
|
-
| `split` / `join`
|
|
317
|
-
| `includes` / `startsWith` / `endsWith` / `indexOf` (with `fromIndex`)
|
|
318
|
-
| `replace` / `replaceAll` (string pattern)
|
|
319
|
-
| `replace` / `replaceAll` (RegExp, `$1`/`$&`, fn replacer)
|
|
320
|
-
| `charAt` / `substring` / `slice`
|
|
321
|
-
| `charCodeAt` / `String.fromCharCode`
|
|
322
|
-
| `concat` / `repeat`
|
|
323
|
-
| `padStart` / `padEnd`
|
|
324
|
-
| `localeCompare`
|
|
325
|
-
| `match` / `matchAll` / `search`
|
|
326
|
-
| `at` (negative indices)
|
|
327
|
-
| Unicode length / iteration
|
|
328
|
-
| `String.raw`
|
|
329
|
-
| `normalize`
|
|
377
|
+
| API | Status | Probe | Notes |
|
|
378
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
379
|
+
| Template literals | ✅ | [syntax-template-literals.ts](conformance/syntax-template-literals.ts) | Backtick strings with `${expr}` interpolation |
|
|
380
|
+
| Tagged templates | ✅ | [syntax-tagged-templates.ts](conformance/syntax-tagged-templates.ts) | Desugared to `tag([...strings], ...values)` |
|
|
381
|
+
| `toUpperCase` / `toLowerCase` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
|
|
382
|
+
| `trim` / `trimStart` / `trimEnd` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
|
|
383
|
+
| `split` / `join` | ✅ | [lib-string-split-join.ts](conformance/lib-string-split-join.ts) | Via `strings` package |
|
|
384
|
+
| `includes` / `startsWith` / `endsWith` / `indexOf` (with `fromIndex`) | ✅ | [lib-string-search.ts](conformance/lib-string-search.ts) | Via `strings` package |
|
|
385
|
+
| `replace` / `replaceAll` (string pattern) | ✅ | [lib-string-replace.ts](conformance/lib-string-replace.ts) | Via `strings` package |
|
|
386
|
+
| `replace` / `replaceAll` (RegExp, `$1`/`$&`, fn replacer) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | `/g` vs first match, `$1`/`$&` patterns, function replacers |
|
|
387
|
+
| `charAt` / `substring` / `slice` | ✅ | [lib-string-slice.ts](conformance/lib-string-slice.ts) | Direct Go string indexing/slicing |
|
|
388
|
+
| `charCodeAt` / `String.fromCharCode` | ✅ | [lib-string-char-codes.ts](conformance/lib-string-char-codes.ts) | `charCodeAt` reads the byte; `String.fromCharCode` → `string(rune(n))` |
|
|
389
|
+
| `concat` / `repeat` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Concatenation and `strings.Repeat` |
|
|
390
|
+
| `padStart` / `padEnd` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Via `strings.Repeat` |
|
|
391
|
+
| `localeCompare` | ✅ | [lib-string-compare.ts](conformance/lib-string-compare.ts) | `strings.Compare` → -1/0/1: code-unit order, not locale-aware |
|
|
392
|
+
| `match` / `matchAll` / `search` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Via `regexp` package (`String.match` with groups) |
|
|
393
|
+
| `at` (negative indices) | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices |
|
|
394
|
+
| Unicode length / iteration | ✅ | [lib-string-unicode.ts](conformance/lib-string-unicode.ts) | `.length` counts runes; `[...str]` spreads runes |
|
|
395
|
+
| `String.raw` | ✅ | [lib-string-raw.ts](conformance/lib-string-raw.ts) | Raw template text with values interpolated |
|
|
396
|
+
| `normalize` | ✅ | [lib-string-normalize.ts](conformance/lib-string-normalize.ts) | `golang.org/x/text/unicode/norm`, copied from GOROOT's vendor tree (offline) |
|
|
397
|
+
| `split(sep, limit)` / `lastIndexOf(s, fromIndex)` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
398
|
+
| `localeCompare(s, locales, options)` | ❌ | — | Locales / options are not declared; the comparison is by code unit |
|
|
399
|
+
| `codePointAt` / `String.fromCodePoint` / `substr` / `trimLeft` / `trimRight` / `isWellFormed` / `toWellFormed` / `toLocaleUpperCase` / `toLocaleLowerCase` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | `codePointAt` past the end is `NaN` (JS: `undefined`); the locale variants ignore the locale |
|
|
330
400
|
|
|
331
401
|
### `Array`
|
|
332
402
|
|
|
333
|
-
| API
|
|
334
|
-
|
|
|
335
|
-
| `push` / `pop`
|
|
336
|
-
| `shift` / `unshift`
|
|
337
|
-
| `join` / `reverse`
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `sort` (
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
| `Array.
|
|
347
|
-
| `
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `
|
|
351
|
-
| `
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
354
|
-
| `
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `
|
|
358
|
-
|
|
|
359
|
-
| `
|
|
403
|
+
| API | Status | Probe | Notes |
|
|
404
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
405
|
+
| `push` / `pop` | ✅ | [lib-array-push-pop.ts](conformance/lib-array-push-pop.ts) | Basic stack operations |
|
|
406
|
+
| `shift` / `unshift` | ✅ | [lib-array-shift-unshift.ts](conformance/lib-array-shift-unshift.ts) | Queue operations |
|
|
407
|
+
| `join` / `reverse` | ✅ | [lib-array-reverse-join.ts](conformance/lib-array-reverse-join.ts) | `join()` defaults to `","`; `reverse` reverses in place and returns the array |
|
|
408
|
+
| `toString()` / `String(arr)` / `` `${arr}` `` | ✅ | [syntax-array-to-string.ts](conformance/syntax-array-to-string.ts) | Elements joined with `,` (nested arrays flatten) |
|
|
409
|
+
| `slice` | ✅ | [lib-array-slice.ts](conformance/lib-array-slice.ts) | Negative indices count from the end |
|
|
410
|
+
| `splice` | ✅ | [lib-array-splice.ts](conformance/lib-array-splice.ts) | Removes and returns elements in place, inserting extra arguments |
|
|
411
|
+
| `sort` (default, lexicographic) | ✅ | [semantics-default-sort.ts](conformance/semantics-default-sort.ts) | String sort by default |
|
|
412
|
+
| `sort` (comparator) | ✅ | [lib-array-sort-comparator.ts](conformance/lib-array-sort-comparator.ts) | Comparator lowered into `sort.SliceStable` |
|
|
413
|
+
| `flat` / `flatMap` | ✅ | [lib-array-flat-flatmap.ts](conformance/lib-array-flat-flatmap.ts) | One-level `flat`; `flatMap` appends callback results |
|
|
414
|
+
| `at` | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices |
|
|
415
|
+
| `fill` | ✅ | [lib-array-fill.ts](conformance/lib-array-fill.ts) | `new Array<T>(n)` → `make([]T, n)`; `fill` assigns in place |
|
|
416
|
+
| `Array.from` | ✅ | [lib-array-from.ts](conformance/lib-array-from.ts) | Array-likes read `length`; the callback gets the index |
|
|
417
|
+
| `Array.isArray` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Type check on values |
|
|
418
|
+
| `map` / `filter` / `reduce` | ✅ | [lib-array-map-filter-reduce.ts](conformance/lib-array-map-filter-reduce.ts) | Incl. chaining and object arrays |
|
|
419
|
+
| `some` / `every` | ✅ | [lib-array-some-every.ts](conformance/lib-array-some-every.ts) | Predicate quantifiers |
|
|
420
|
+
| `find` / `findIndex` / `findLast` / `findLastIndex` | ✅ | [lib-array-find.ts](conformance/lib-array-find.ts) | `findLast`/`findLastIndex` search from the end |
|
|
421
|
+
| `forEach` | ✅ | [lib-map-iteration.ts](conformance/lib-map-iteration.ts) | Block-body callbacks; `Map.forEach` |
|
|
422
|
+
| `includes` / `indexOf` / `lastIndexOf` | ✅ | [lib-array-search.ts](conformance/lib-array-search.ts) | `lastIndexOf` searches from the end |
|
|
423
|
+
| `entries` / `keys` / `values` | ✅ | [lib-array-entries.ts](conformance/lib-array-entries.ts) | `[index, value]` pairs destructured in `for...of` |
|
|
424
|
+
| `length` truncation (`arr.length = 0`) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Clear via length assignment |
|
|
425
|
+
| `filter(Boolean)` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Constructor as predicate |
|
|
426
|
+
| `concat` | ✅ | [lib-array-concat.ts](conformance/lib-array-concat.ts) | Arrays flattened one level, values appended |
|
|
427
|
+
| `reduceRight` | ✅ | [lib-array-reduce-right.ts](conformance/lib-array-reduce-right.ts) | `reduce` over a reversed copy |
|
|
428
|
+
| `copyWithin` | ✅ | [lib-array-copy-within.ts](conformance/lib-array-copy-within.ts) | Go `copy` (overlap-safe) |
|
|
429
|
+
| Change-preserving copies (`toSorted` / `toReversed` / `with`) | ✅ | [lib-array-copies.ts](conformance/lib-array-copies.ts) | Clone, then sort / reverse / set |
|
|
430
|
+
| `toSpliced` | ✅ | [lib-array-to-spliced.ts](conformance/lib-array-to-spliced.ts) | `slices.Concat` of the kept parts |
|
|
431
|
+
| `Array.of` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
432
|
+
| Iterator helpers on generators (`map` / `filter` / `flatMap` / `take` / `drop` / `toArray` / `forEach` / `some` / `every` / `find` / `reduce`), `Iterator.from(array)` | ✅ | [lib-iterator-helpers.ts](conformance/lib-iterator-helpers.ts) | Lazy (works on infinite generators): one goroutine per stage |
|
|
433
|
+
| `Array.fromAsync` | ❌ | — | Not declared |
|
|
434
|
+
| `[...map.keys()]` / `[...map.values()]` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | |
|
|
360
435
|
|
|
361
436
|
### `Map` / `Set`
|
|
362
437
|
|
|
363
|
-
| API | Status | Probe | Notes
|
|
364
|
-
| -------------------------------------------------------- | :----: | ------------------------------------------------------------------ |
|
|
365
|
-
| `Map` (`set` / `get` / `has` / `delete` / `size`) | ✅
|
|
366
|
-
| `Map` iteration (`for...of`, destructuring) | ✅
|
|
367
|
-
| `Set` (`add` / `has` / `delete` / `size`) | ✅
|
|
368
|
-
| `Set` iteration / spread | ✅
|
|
369
|
-
| `Map.clear` / `Set.clear` | ✅
|
|
370
|
-
| `WeakMap` / `WeakSet` | ✅
|
|
371
|
-
| Set operations (`union` / `intersection` / `difference`) | ✅
|
|
438
|
+
| API | Status | Probe | Notes |
|
|
439
|
+
| -------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
440
|
+
| `Map` (`set` / `get` / `has` / `delete` / `size`) | ✅ | [lib-map.ts](conformance/lib-map.ts) | `Map<K, V>` → Go `map[K]V`; constructor with entries |
|
|
441
|
+
| `Map` iteration (`for...of`, destructuring) | ✅ | [lib-map-iteration.ts](conformance/lib-map-iteration.ts) | Key/value iteration, `Object.entries()` unwrapping |
|
|
442
|
+
| `Set` (`add` / `has` / `delete` / `size`) | ✅ | [lib-set.ts](conformance/lib-set.ts) | `Set<T>` → Go `map[T]struct{}`; constructor with values |
|
|
443
|
+
| `Set` iteration / spread | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | `for...of`, `[...set]` |
|
|
444
|
+
| `Map.clear` / `Set.clear` | ✅ | [lib-map-clear.ts](conformance/lib-map-clear.ts) | `TnMap.Clear()` |
|
|
445
|
+
| `WeakMap` / `WeakSet` | ✅ | [lib-weak-collections.ts](conformance/lib-weak-collections.ts) | Same as `Map` / `Set` (weakness is not observable) |
|
|
446
|
+
| Set operations (`union` / `intersection` / `difference`) | ✅ | [lib-set-operations.ts](conformance/lib-set-operations.ts) | Plus `symmetricDifference` / `isSubsetOf` / `isSupersetOf` / `isDisjointFrom` |
|
|
372
447
|
|
|
373
448
|
### `Number`
|
|
374
449
|
|
|
375
|
-
| API
|
|
376
|
-
|
|
|
377
|
-
| `toString` (incl. radix)
|
|
378
|
-
| `toFixed`
|
|
379
|
-
| `parseInt` / `parseFloat` / `Number()`
|
|
380
|
-
| `Number.isInteger` / `isNaN` / `MAX_SAFE_INTEGER`
|
|
381
|
-
| `Number.
|
|
382
|
-
| `
|
|
450
|
+
| API | Status | Probe | Notes |
|
|
451
|
+
| -------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ----------------------------------------------------- |
|
|
452
|
+
| `toString` (incl. radix) | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | Universal `toString()` via `fmt.Sprintf` for any type |
|
|
453
|
+
| `toFixed` | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | `n.toFixed(2)` via `strconv.FormatFloat` |
|
|
454
|
+
| `parseInt` / `parseFloat` / `Number()` | ✅ | [lib-number-parse.ts](conformance/lib-number-parse.ts) | Mapped to Go's `strconv` package |
|
|
455
|
+
| `Number.isInteger` / `isNaN` / `MAX_SAFE_INTEGER` | ✅ | [lib-number-checks.ts](conformance/lib-number-checks.ts) | Number predicates and constants |
|
|
456
|
+
| `Number.MIN_SAFE_INTEGER` / `MAX_VALUE` | ✅ | — | |
|
|
457
|
+
| `Number.EPSILON` / `isFinite` / `toPrecision` | ✅ | [lib-number-misc.ts](conformance/lib-number-misc.ts) | `toPrecision` → `strconv.FormatFloat(x, 'g', n, 64)` |
|
|
458
|
+
| `String()` / `Boolean()` conversions | ✅ | [lib-conversions.ts](conformance/lib-conversions.ts) | JS formatting / truthiness |
|
|
459
|
+
| `toExponential` / `Number.isSafeInteger` / `parseInt` / `parseFloat` / `MIN_VALUE` / `NEGATIVE_INFINITY` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
460
|
+
| Number `toLocaleString` | ❌ | — | Needs `Intl` |
|
|
383
461
|
|
|
384
462
|
### `Date`
|
|
385
463
|
|
|
386
|
-
| API
|
|
387
|
-
|
|
|
388
|
-
| `new Date()` / `getTime` / `toISOString`
|
|
389
|
-
| `Date.now()`
|
|
390
|
-
| Component getters (`getFullYear`, `getMonth`, …)
|
|
464
|
+
| API | Status | Probe | Notes |
|
|
465
|
+
| ----------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
466
|
+
| `new Date()` / `getTime` / `toISOString` | ✅ | [lib-date.ts](conformance/lib-date.ts) | `new Date(ms)` → `time.UnixMilli`; `getTime`/`toISOString` mapped to `time.Time` |
|
|
467
|
+
| `Date.now()` | ✅ | [lib-date-now.ts](conformance/lib-date-now.ts) | `time.Now().UnixMilli()` |
|
|
468
|
+
| Component getters (`getFullYear`, `getMonth`, …) | ✅ | [lib-date-getters.ts](conformance/lib-date-getters.ts) | Local and `getUTC*` getters, `Date.UTC` |
|
|
469
|
+
| `toJSON` / `valueOf`; Invalid Dates (`getTime()` is `NaN`, `toISOString` throws a `RangeError`) | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | |
|
|
470
|
+
| `toString` / `toDateString` / `toTimeString` / `toUTCString`, `String(date)`, `` `${date}` `` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | Node's formats in the local zone; long zone names for common zones (`Coordinated Universal Time`, `Central European Standard Time`, …), `GMT±hh:mm` otherwise |
|
|
471
|
+
| `new Date(string)` / `new Date(y, m, d, …)` / `new Date(date)` / `Date.parse` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | ISO strings (date-only UTC, date-times local unless offset) and the formats `toString` / `toUTCString` / common `Month D, YYYY` and `YYYY/MM/DD` forms produce; an unparsable string is an Invalid Date |
|
|
472
|
+
| Setters (`setFullYear`, `setDate`, `setHours`, … and `setUTC*`), `setTime`, `getTimezoneOffset` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | Fields overflow like JS. Dates are values: a setter updates the variable or field it is called on, not other references to the same Date |
|
|
473
|
+
| `toLocaleDateString` / `toLocaleTimeString` / `toLocaleString` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | `en-US` format; locales and options are ignored |
|
|
474
|
+
| Date arithmetic and ordering (`b - a`, `+d`, `a < b`) | ✅ | [semantics-date-arithmetic.ts](conformance/semantics-date-arithmetic.ts) | The time value in milliseconds; `any` operands of `-` `*` `/` `%` convert with ToNumber |
|
|
391
475
|
|
|
392
476
|
### `RegExp`
|
|
393
477
|
|
|
394
|
-
| API
|
|
395
|
-
|
|
|
396
|
-
| Regex literals
|
|
397
|
-
| `new RegExp()`
|
|
398
|
-
| `test()`
|
|
399
|
-
| `exec()` (groups)
|
|
400
|
-
| Flags (`i`, `m`)
|
|
401
|
-
| Backreferences
|
|
402
|
-
| Named groups
|
|
403
|
-
| Global `exec` loop (`/g` + `lastIndex`)
|
|
404
|
-
| Lookbehind
|
|
405
|
-
| Remaining flags (`s` / `u` / `y`) & `source` / `flags`
|
|
406
|
-
| `split` with RegExp
|
|
478
|
+
| API | Status | Probe | Notes |
|
|
479
|
+
| ----------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
480
|
+
| Regex literals | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | `/pattern/flags` transpiled to `regexp.MustCompile` |
|
|
481
|
+
| `new RegExp()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Constructor with optional flags |
|
|
482
|
+
| `test()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Mapped to `regexp.MatchString` |
|
|
483
|
+
| `exec()` (groups) | ✅ | [lib-regex-groups.ts](conformance/lib-regex-groups.ts) | Mapped to `regexp.FindStringSubmatch` |
|
|
484
|
+
| Flags (`i`, `m`) | ✅ | [lib-regex-flags.ts](conformance/lib-regex-flags.ts) | Case-insensitive, multiline |
|
|
485
|
+
| Backreferences | ✅ | [lib-regex-backreference.ts](conformance/lib-regex-backreference.ts) | Backreference patterns run on a small backtracking engine |
|
|
486
|
+
| Named groups | ✅ | [lib-regex-named-groups.ts](conformance/lib-regex-named-groups.ts) | `(?<name>` → `(?P<name>`; `exec` returns a match with `.groups` |
|
|
487
|
+
| Global `exec` loop (`/g` + `lastIndex`) | ✅ | [lib-regex-global-exec.ts](conformance/lib-regex-global-exec.ts) | /g regexes carry `lastIndex` state in the `TnRegex` wrapper |
|
|
488
|
+
| Lookbehind | ✅ | [lib-regex-lookbehind.ts](conformance/lib-regex-lookbehind.ts) | Lookaround patterns run on the backtracking engine |
|
|
489
|
+
| Remaining flags (`s` / `u` / `y`) & `source` / `flags` | ✅ | [lib-regex-more-flags.ts](conformance/lib-regex-more-flags.ts) | Sticky matching, `\u{…}` escapes, `lastIndex` / `source` / `flags` / flag getters |
|
|
490
|
+
| `split` with RegExp | ✅ | [lib-regex-split.ts](conformance/lib-regex-split.ts) | JS semantics: captures are included, `limit` counts items |
|
|
491
|
+
| Match `.index` (`exec` / `match` / `matchAll`), `match` with `/g` | ✅ | [lib-regex-index-split.ts](conformance/lib-regex-index-split.ts) | Character index kept in a hidden slot of the match array; `search` counts characters |
|
|
492
|
+
| Unicode property escapes (`\p{L}`) with `u` | ✅ | — | Go's `regexp` |
|
|
493
|
+
| `\p{…}` in patterns that need the backtracking engine (backreferences, lookaround); `d` flag (`indices`); `v` flag; `RegExp.escape` | ❌ | — | The backtracking engine has no `\p`: `/(\p{L})\1/u` doesn't match `aa` (wrong result, no error) |
|
|
407
494
|
|
|
408
495
|
### `Promise` / timers
|
|
409
496
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
| `resolve` / `reject` passed as values | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | `new Promise((resolve) => setTimeout(resolve, ms))` |
|
|
414
|
-
| `Promise.all` | ✅ | [syntax-promise-all.ts](conformance/syntax-promise-all.ts) | Channel lowering works (see [Async & timing](#async--timing)) |
|
|
415
|
-
| `Promise.resolve` | ✅ | [lib-promise-resolve.ts](conformance/lib-promise-resolve.ts) | Buffered channel holding the value |
|
|
416
|
-
| `Promise.reject` / `.catch` / `.finally` | ✅ | [lib-promise-catch.ts](conformance/lib-promise-catch.ts) | Rejected promises are closed channels with a reason; `await` rethrows |
|
|
417
|
-
| `Promise.race` / `allSettled` / `any` | ✅ | [lib-promise-combinators.ts](conformance/lib-promise-combinators.ts) | Goroutine per promise; first settled / all settled / first fulfilled |
|
|
418
|
-
| `clearTimeout` | ✅ | [lib-timers.ts](conformance/lib-timers.ts) | `TnClearTimeout` stops the timer |
|
|
419
|
-
| `setInterval` / `clearInterval` | ✅ | [lib-set-interval.ts](conformance/lib-set-interval.ts) | `time.Ticker`; the process lives until cleared |
|
|
420
|
-
| `queueMicrotask` | ✅ | [lib-queue-microtask.ts](conformance/lib-queue-microtask.ts) | Runs after the current synchronous code (end of main or a timer callback) |
|
|
421
|
-
| `setTimeout` | ✅ | [lib-set-timeout.ts](conformance/lib-set-timeout.ts) | Lowered to `time.AfterFunc` (see [Async & timing](#async--timing)) |
|
|
497
|
+
See [Async & timing](#async--timing): `Promise` (constructor, `.then` / `.catch` / `.finally`,
|
|
498
|
+
`resolve` / `reject` / `all` / `race` / `allSettled` / `any`), `setTimeout`, `setInterval`,
|
|
499
|
+
`queueMicrotask` and their `clear*` functions, plus the gaps.
|
|
422
500
|
|
|
423
501
|
### Misc globals
|
|
424
502
|
|
|
425
|
-
| API
|
|
426
|
-
|
|
|
427
|
-
| `assert`
|
|
428
|
-
| `process.argv` / `process.platform`
|
|
429
|
-
| `process.env`
|
|
430
|
-
| `process.exit`
|
|
431
|
-
| `process.cwd()`
|
|
432
|
-
| `Buffer` / `Uint8Array` / `TextEncoder` / `TextDecoder` / `atob` / `btoa`
|
|
433
|
-
| `URL` / `URLSearchParams`
|
|
434
|
-
| `EventTarget` / `Event` / `AbortController` / `AbortSignal`
|
|
435
|
-
| `performance` / `setImmediate` / `crypto`
|
|
436
|
-
| `TypeError` / `RangeError` / `SyntaxError` & co.
|
|
437
|
-
| `Infinity`
|
|
438
|
-
| Global `isNaN` / `isFinite`
|
|
439
|
-
| `encodeURIComponent` / `decodeURIComponent`
|
|
440
|
-
| `structuredClone`
|
|
441
|
-
| `fetch` / `Headers` / `Request` / `Response`
|
|
442
|
-
| `ReadableStream` / `WritableStream` / `TransformStream` & co., `TextEncoderStream` / `TextDecoderStream`, `CompressionStream` / `DecompressionStream` |
|
|
443
|
-
| `Blob` / `File` / `FormData`
|
|
444
|
-
| `MessageChannel` / `MessagePort` / `BroadcastChannel`
|
|
445
|
-
| `__filename` / `__dirname`
|
|
446
|
-
| `globalThis`
|
|
503
|
+
| API | Status | Probe | Notes |
|
|
504
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
505
|
+
| `assert` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts) | Transpiled to `panic` on failure |
|
|
506
|
+
| `process.argv` / `process.platform` | ✅ | [lib-process.ts](conformance/lib-process.ts) | Node's shapes (`[execPath, script, ...args]`, `win32`); the rest of `process` is in [node:process](#nodeprocess) |
|
|
507
|
+
| `process.env` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Environment variable access |
|
|
508
|
+
| `process.exit` | ✅ | [lib-process-exit.ts](conformance/lib-process-exit.ts) | `os.Exit`, after `process.on('exit')` listeners |
|
|
509
|
+
| `process.cwd()` | ✅ | [lib-process-cwd.ts](conformance/lib-process-cwd.ts) | `os.Getwd()` |
|
|
510
|
+
| `Buffer` / `Uint8Array` / `TextEncoder` / `TextDecoder` / `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | See [node:buffer](#nodebuffer) |
|
|
511
|
+
| `URL` / `URLSearchParams` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts) | See [node:url](#nodeurl) |
|
|
512
|
+
| `EventTarget` / `Event` / `AbortController` / `AbortSignal` | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts) | See [node:events](#nodeevents) |
|
|
513
|
+
| `performance` / `setImmediate` / `crypto` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | See [perf_hooks](#nodeperf_hooks), [timers](#nodetimers), [crypto](#nodecrypto) |
|
|
514
|
+
| `TypeError` / `RangeError` / `SyntaxError` & co. | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts) | `TnError`s carrying their `name`; `instanceof` checks the name |
|
|
515
|
+
| `Infinity` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.Inf(1)` |
|
|
516
|
+
| Global `isNaN` / `isFinite` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.IsNaN` / `math.IsInf` |
|
|
517
|
+
| `encodeURIComponent` / `decodeURIComponent` | ✅ | [lib-uri.ts](conformance/lib-uri.ts) | `TnEncodeURIComponent` / `url.PathUnescape` |
|
|
518
|
+
| `structuredClone` | ✅ | [lib-structured-clone.ts](conformance/lib-structured-clone.ts) | Reflection deep copy |
|
|
519
|
+
| `fetch` / `Headers` / `Request` / `Response` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | See [fetch](#fetch) |
|
|
520
|
+
| `ReadableStream` / `WritableStream` / `TransformStream` & co., `TextEncoderStream` / `TextDecoderStream`, `CompressionStream` / `DecompressionStream` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | See [stream/web](#nodestreamweb) |
|
|
521
|
+
| `Blob` / `File` / `FormData` | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts) | See [buffer](#nodebuffer) and [fetch](#fetch) |
|
|
522
|
+
| `MessageChannel` / `MessagePort` / `BroadcastChannel` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | See [worker_threads](#nodeworker_threads) |
|
|
523
|
+
| `__filename` / `__dirname` | ✅ | — | The running executable (a native binary has no script file) |
|
|
524
|
+
| `globalThis` | ✅ | [lib-global-this.ts](conformance/lib-global-this.ts) | `globalThis.x` is the global `x`; `(globalThis as any)` is a dynamic object |
|
|
525
|
+
| `err.stack` | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | `Name: message` and an `at fn (file.ts:line)` line per TS frame (no columns), from `runtime.Callers` and the `//line` directives |
|
|
526
|
+
| `AggregateError` (`errors`) | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | |
|
|
527
|
+
| `Error.captureStackTrace` / `Error.isError` / `DOMException` | ❌ | — | Not declared |
|
|
528
|
+
| `Symbol.for` / `Symbol.keyFor` / `description` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | A global registry by key |
|
|
529
|
+
| `[Symbol.asyncIterator]()` methods; `Symbol.toPrimitive` / `hasInstance` / `toStringTag` | ❌ | — | Only `Symbol()`, `Symbol.iterator` and `Symbol.dispose` are lowered |
|
|
530
|
+
| `WeakRef` / `FinalizationRegistry` | ✅ | [lib-weak-refs.ts](conformance/lib-weak-refs.ts) | Go's `weak` package and `runtime.AddCleanup`; cleanup callbacks run on the event loop. Targets must be objects (pointers) |
|
|
531
|
+
| `Reflect` (`ownKeys` / `has` / `get` / `set` / …) | ❌ | — | Feasible over the existing dynamic property access |
|
|
532
|
+
| `Proxy` | 🚫 | — | Intercepting every property access on static Go structs; a `Proxy` limited to dynamic (`any`) objects would be feasible |
|
|
533
|
+
| `Intl` (`NumberFormat`, `DateTimeFormat`, `Collator`, `PluralRules`, `ListFormat`, `RelativeTimeFormat`, `Segmenter`), `toLocaleString` | ❌ | — | Needs locale data (vendored `golang.org/x/text`, or hand-written `en-US` first) |
|
|
534
|
+
| `Temporal` | ❌ | — | Feasible on Go's `time` and tzdata |
|
|
535
|
+
| `WebSocket` / `navigator` / `CustomEvent` / `URLPattern` / `EventSource` / `reportError` | ❌ | — | Not declared |
|
|
536
|
+
| `WebAssembly` | ❌ | — | Needs a Wasm runtime: vendoring wazero (pure Go, no cgo) would provide one (see [wasi](#nodewasi)) |
|
|
447
537
|
|
|
448
538
|
### Node builtins (`node:*`)
|
|
449
539
|
|
|
@@ -454,392 +544,410 @@ named, default or namespace imports; subpaths (`fs/promises`, `path/posix`,
|
|
|
454
544
|
completions and events run on one event loop, one at a time, as in Node; an
|
|
455
545
|
async function runs synchronously until its first `await`.
|
|
456
546
|
|
|
457
|
-
| Module
|
|
458
|
-
|
|
|
459
|
-
| `node:assert` / `node:assert/strict`
|
|
460
|
-
| `node:async_hooks`
|
|
461
|
-
| `node:buffer` (+ globals `Buffer`, `Uint8Array`, `atob`, `btoa`, `Blob`, `File`)
|
|
462
|
-
| `node:child_process`
|
|
463
|
-
| `node:cluster`
|
|
464
|
-
| `node:console`
|
|
465
|
-
| `node:constants`
|
|
466
|
-
| `node:crypto` (+ global `crypto`)
|
|
467
|
-
| `node:dgram`
|
|
468
|
-
| `node:diagnostics_channel`
|
|
469
|
-
| `node:dns` / `node:dns/promises`
|
|
470
|
-
| `node:domain`
|
|
471
|
-
| `node:events` (+ `EventTarget`, `AbortController`)
|
|
472
|
-
| `node:fs` / `node:fs/promises`
|
|
473
|
-
| `node:http` / `node:https`
|
|
474
|
-
| `node:http2`
|
|
475
|
-
| `node:inspector`
|
|
476
|
-
| `node:module`
|
|
477
|
-
| `node:net`
|
|
478
|
-
| `node:os`
|
|
479
|
-
| `node:path` / `path/posix` / `path/win32`
|
|
480
|
-
| `node:perf_hooks` (+ global `performance`)
|
|
481
|
-
| `node:process` (+ global `process`)
|
|
482
|
-
| `node:punycode`
|
|
483
|
-
| `node:querystring`
|
|
484
|
-
| `node:readline` / `node:readline/promises`
|
|
485
|
-
| `node:repl`
|
|
486
|
-
| `node:sea`
|
|
487
|
-
| `node:sqlite`
|
|
488
|
-
| `node:stream` / `stream/promises` / `stream/consumers`
|
|
489
|
-
| `node:stream/web` (+ globals `ReadableStream`, `WritableStream`, `TransformStream`, …) |
|
|
490
|
-
| `node:string_decoder`
|
|
491
|
-
| `node:sys`
|
|
492
|
-
| `node:test`
|
|
493
|
-
| `node:test/reporters`
|
|
494
|
-
| `node:timers` / `node:timers/promises`
|
|
495
|
-
| `node:tls`
|
|
496
|
-
| `node:trace_events`
|
|
497
|
-
| `node:tty`
|
|
498
|
-
| `node:url` (+ globals `URL`, `URLSearchParams`)
|
|
499
|
-
| `node:util` / `node:util/types`
|
|
500
|
-
| `node:v8`
|
|
501
|
-
| `node:vm`
|
|
502
|
-
| `node:wasi`
|
|
503
|
-
| `node:worker_threads` (+ globals `MessageChannel`, `MessagePort`, `BroadcastChannel`)
|
|
504
|
-
| `node:zlib`
|
|
505
|
-
| Global `fetch` (+ `Headers`, `Request`, `Response`, `FormData`)
|
|
547
|
+
| Module | Status | Section |
|
|
548
|
+
| -------------------------------------------------------------------------------------- | :----: | ----------------------------------------------- |
|
|
549
|
+
| `node:assert` / `node:assert/strict` | ✅ | [assert](#nodeassert) |
|
|
550
|
+
| `node:async_hooks` | ✅ | [async_hooks](#nodeasync_hooks) |
|
|
551
|
+
| `node:buffer` (+ globals `Buffer`, `Uint8Array`, `atob`, `btoa`, `Blob`, `File`) | ✅ | [buffer](#nodebuffer) |
|
|
552
|
+
| `node:child_process` | ✅ | [child_process](#nodechild_process) |
|
|
553
|
+
| `node:cluster` | ✅ | [cluster](#nodecluster) |
|
|
554
|
+
| `node:console` | ✅ | [console](#nodeconsole) |
|
|
555
|
+
| `node:constants` | ✅ | [constants](#nodeconstants--nodesys) |
|
|
556
|
+
| `node:crypto` (+ global `crypto`) | ✅ | [crypto](#nodecrypto) |
|
|
557
|
+
| `node:dgram` | ✅ | [dgram](#nodedgram) |
|
|
558
|
+
| `node:diagnostics_channel` | ✅ | [diagnostics_channel](#nodediagnostics_channel) |
|
|
559
|
+
| `node:dns` / `node:dns/promises` | ✅ | [dns](#nodedns) |
|
|
560
|
+
| `node:domain` | 🚫 | [domain](#nodedomain) |
|
|
561
|
+
| `node:events` (+ `EventTarget`, `AbortController`) | ✅ | [events](#nodeevents) |
|
|
562
|
+
| `node:fs` / `node:fs/promises` | ✅ | [fs](#nodefs) |
|
|
563
|
+
| `node:http` / `node:https` | ✅ | [http / https](#nodehttp--nodehttps) |
|
|
564
|
+
| `node:http2` | ✅ | [http2](#nodehttp2) |
|
|
565
|
+
| `node:inspector` | 🚫 | [inspector](#nodeinspector) |
|
|
566
|
+
| `node:module` | ✅ | [module](#nodemodule) |
|
|
567
|
+
| `node:net` | ✅ | [net](#nodenet) |
|
|
568
|
+
| `node:os` | ✅ | [os](#nodeos) |
|
|
569
|
+
| `node:path` / `path/posix` / `path/win32` | ✅ | [path](#nodepath) |
|
|
570
|
+
| `node:perf_hooks` (+ global `performance`) | ✅ | [perf_hooks](#nodeperf_hooks) |
|
|
571
|
+
| `node:process` (+ global `process`) | ✅ | [process](#nodeprocess) |
|
|
572
|
+
| `node:punycode` | ✅ | [punycode](#nodepunycode) |
|
|
573
|
+
| `node:querystring` | ✅ | [querystring](#nodequerystring) |
|
|
574
|
+
| `node:readline` / `node:readline/promises` | ✅ | [readline](#nodereadline) |
|
|
575
|
+
| `node:repl` | 🚫 | [repl](#noderepl) |
|
|
576
|
+
| `node:sea` | ✅ | [sea](#nodesea) |
|
|
577
|
+
| `node:sqlite` | ✅ | [sqlite](#nodesqlite) |
|
|
578
|
+
| `node:stream` / `stream/promises` / `stream/consumers` | ✅ | [stream](#nodestream) |
|
|
579
|
+
| `node:stream/web` (+ globals `ReadableStream`, `WritableStream`, `TransformStream`, …) | ✅ | [stream/web](#nodestreamweb) |
|
|
580
|
+
| `node:string_decoder` | ✅ | [string_decoder](#nodestring_decoder) |
|
|
581
|
+
| `node:sys` | ✅ | [constants / sys](#nodeconstants--nodesys) |
|
|
582
|
+
| `node:test` | ✅ | [test](#nodetest) |
|
|
583
|
+
| `node:test/reporters` | ❌ | [test/reporters](#nodetestreporters) |
|
|
584
|
+
| `node:timers` / `node:timers/promises` | ✅ | [timers](#nodetimers) |
|
|
585
|
+
| `node:tls` | ✅ | [tls](#nodetls) |
|
|
586
|
+
| `node:trace_events` | 🚫 | [trace_events](#nodetrace_events) |
|
|
587
|
+
| `node:tty` | ✅ | [tty](#nodetty) |
|
|
588
|
+
| `node:url` (+ globals `URL`, `URLSearchParams`) | ✅ | [url](#nodeurl) |
|
|
589
|
+
| `node:util` / `node:util/types` | ✅ | [util](#nodeutil) |
|
|
590
|
+
| `node:v8` | ✅ | [v8](#nodev8) |
|
|
591
|
+
| `node:vm` | 🚫 | [vm](#nodevm) |
|
|
592
|
+
| `node:wasi` | ❌ | [wasi](#nodewasi) |
|
|
593
|
+
| `node:worker_threads` (+ globals `MessageChannel`, `MessagePort`, `BroadcastChannel`) | ✅ | [worker_threads](#nodeworker_threads) |
|
|
594
|
+
| `node:zlib` | ✅ | [zlib](#nodezlib) |
|
|
595
|
+
| Global `fetch` (+ `Headers`, `Request`, `Response`, `FormData`) | ✅ | [fetch](#fetch) |
|
|
506
596
|
|
|
507
597
|
#### `node:path`
|
|
508
598
|
|
|
509
|
-
| API
|
|
510
|
-
|
|
|
511
|
-
| `join` / `dirname` / `basename` / `extname` / `resolve`
|
|
512
|
-
| `normalize` / `relative` / `isAbsolute` / `parse` / `format` / `sep` / `delimiter` |
|
|
513
|
-
| `path.posix` / `path.win32` / `node:path/posix` / `toNamespacedPath`
|
|
514
|
-
| `matchesGlob` (`*`, `**`, `?`, `[...]`, `{a,b}`; no leading-dot matches)
|
|
599
|
+
| API | Status | Probe | Notes |
|
|
600
|
+
| ---------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
601
|
+
| `join` / `dirname` / `basename` / `extname` / `resolve` | ✅ | [lib-node-path.ts](conformance/lib-node-path.ts) | Ports of Node's algorithms (not Go's `filepath`): same results as Node |
|
|
602
|
+
| `normalize` / `relative` / `isAbsolute` / `parse` / `format` / `sep` / `delimiter` | ✅ | [lib-node-path-more.ts](conformance/lib-node-path-more.ts) | Trailing separators, `.bashrc`-style extensions, `''` for same paths |
|
|
603
|
+
| `path.posix` / `path.win32` / `node:path/posix` / `toNamespacedPath` | ✅ | [lib-node-path-posix-win32.ts](conformance/lib-node-path-posix-win32.ts) | Both flavours on every OS (drive letters, UNC roots); `path` is the platform's |
|
|
604
|
+
| `matchesGlob` (`*`, `**`, `?`, `[...]`, `{a,b}`; no leading-dot matches) | ✅ | [lib-node-path-glob.ts](conformance/lib-node-path-glob.ts) | minimatch-style patterns compiled to regular expressions |
|
|
515
605
|
|
|
516
606
|
#### `node:buffer`
|
|
517
607
|
|
|
518
|
-
| API
|
|
519
|
-
|
|
|
520
|
-
| `Buffer.from` / `alloc` / `concat` / `byteLength` / `isBuffer` / `compare`; `buf[i]`, `length`
|
|
521
|
-
| `toString` / `equals` / `indexOf` / `includes` / `fill` / `write` / `copy`
|
|
522
|
-
| Encodings (utf8, hex, base64, base64url, latin1, ascii, utf16le); `atob` / `btoa`
|
|
523
|
-
| `TextEncoder` / `TextDecoder` (`decode(bytes, { stream: true })`), minimal `Uint8Array`
|
|
524
|
-
| `read*` / `write*` (U)Int8/16/32 LE/BE, Float, Double
|
|
525
|
-
| `Blob` / `File` (`size`, `type`, `name`, `lastModified`, `text()` / `bytes()` / `arrayBuffer()`, `slice`, `stream()`); parts of strings, Buffers and Blobs
|
|
526
|
-
| `read/writeBigInt64LE/BE`, `read/writeBigUInt64LE/BE`, `swap16/32/64`; `isUtf8` / `isAscii` / `transcode` / `kMaxLength`
|
|
527
|
-
| Typed arrays (`Int8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`): indexing, `length` / `byteLength` / `buffer`, `from` / `of`, `fill` / `set` / `subarray` / `slice` / `copyWithin`, `map` / `filter` / `reduce` / `forEach` & co., `sort` / `toSorted`, `join`, `for…of`, spread; `ArrayBuffer` (`slice`, `isView`); `DataView` (all getters / setters incl. BigInt64) |
|
|
608
|
+
| API | Status | Probe | Notes |
|
|
609
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
610
|
+
| `Buffer.from` / `alloc` / `concat` / `byteLength` / `isBuffer` / `compare`; `buf[i]`, `length` | ✅ | [lib-node-buffer.ts](conformance/lib-node-buffer.ts) | Buffers are Go `[]byte`; `subarray` / `slice` share memory; writes wrap modulo 256 |
|
|
611
|
+
| `toString` / `equals` / `indexOf` / `includes` / `fill` / `write` / `copy` | ✅ | [lib-node-buffer.ts](conformance/lib-node-buffer.ts) | `` `${buf}` `` decodes UTF-8; `console.log(buf)` prints `<Buffer 68 69>` |
|
|
612
|
+
| Encodings (utf8, hex, base64, base64url, latin1, ascii, utf16le); `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | Invalid UTF-8 bytes decode to U+FFFD, as in Node |
|
|
613
|
+
| `TextEncoder` / `TextDecoder` (`decode(bytes, { stream: true })`), minimal `Uint8Array` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | `Uint8Array` is `[]byte` too: `length`, indexing, `subarray`, `slice`, `set` |
|
|
614
|
+
| `read*` / `write*` (U)Int8/16/32 LE/BE, Float, Double | ✅ | [lib-node-buffer-binary.ts](conformance/lib-node-buffer-binary.ts) | Out-of-range offsets throw `ERR_OUT_OF_RANGE` |
|
|
615
|
+
| `Blob` / `File` (`size`, `type`, `name`, `lastModified`, `text()` / `bytes()` / `arrayBuffer()`, `slice`, `stream()`); parts of strings, Buffers and Blobs | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts) | Also globals; bytes held in memory |
|
|
616
|
+
| `read/writeBigInt64LE/BE`, `read/writeBigUInt64LE/BE`, `swap16/32/64`; `isUtf8` / `isAscii` / `transcode` / `kMaxLength` | ✅ | [lib-node-buffer-bigint.ts](conformance/lib-node-buffer-bigint.ts) | bigints are `*big.Int` |
|
|
617
|
+
| Typed arrays (`Int8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`): indexing, `length` / `byteLength` / `buffer`, `from` / `of`, `fill` / `set` / `subarray` / `slice` / `copyWithin`, `map` / `filter` / `reduce` / `forEach` & co., `sort` / `toSorted`, `join`, `for…of`, spread; `ArrayBuffer` (`slice`, `isView`); `DataView` (all getters / setters incl. BigInt64) | ✅ | [lib-typed-arrays.ts](conformance/lib-typed-arrays.ts) | One Go slice per element type; views on an `ArrayBuffer` share its memory. Writes convert like JS (wrapping, clamping). A view's `.buffer` is its own bytes (`byteOffset` 0). Out-of-range reads give `0`, not `undefined`. |
|
|
618
|
+
| `BigInt64Array` / `BigUint64Array` | ❌ | — | `DataView` already has the BigInt64 accessors |
|
|
619
|
+
| `Float16Array`, resizable `ArrayBuffer` (`resize`, `transfer`), `Uint8Array` `toBase64` / `fromBase64` / `toHex` / `fromHex` | ❌ | — | Not declared |
|
|
528
620
|
|
|
529
621
|
#### `node:fs`
|
|
530
622
|
|
|
531
|
-
| API
|
|
532
|
-
|
|
|
533
|
-
| `readFileSync` / `writeFileSync` / `appendFileSync` / `existsSync` / `rmSync`
|
|
534
|
-
| `statSync` / `lstatSync` (`Stats`) / `renameSync` / `copyFileSync` / `truncateSync` / `realpathSync` / `accessSync` / `unlinkSync`
|
|
535
|
-
| `mkdirSync` / `mkdtempSync` / `readdirSync` (`withFileTypes`, `recursive`) / `rmdirSync` / `cpSync`
|
|
536
|
-
| Node system errors (`err.code` / `syscall` / `path` / `errno`)
|
|
537
|
-
| File descriptors: `openSync` / `readSync` / `writeSync` / `fstatSync` / `closeSync`
|
|
538
|
-
| Callback API (`readFile(path, enc, (err, data) => …)` & co.)
|
|
539
|
-
| `fs/promises` / `fs.promises` (incl. `FileHandle` from `open`)
|
|
540
|
-
| `createReadStream` / `createWriteStream`
|
|
541
|
-
| `chmodSync` / `utimesSync` / `symlinkSync` / `readlinkSync` / `linkSync`
|
|
542
|
-
| `watch` (`recursive`, `persistent`, `signal`, `ref` / `unref`, `'change'` / `'error'` / `'close'`) / `watchFile` / `unwatchFile`; `fs/promises` `watch` |
|
|
623
|
+
| API | Status | Probe | Notes |
|
|
624
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
625
|
+
| `readFileSync` / `writeFileSync` / `appendFileSync` / `existsSync` / `rmSync` | ✅ | [lib-node-fs.ts](conformance/lib-node-fs.ts) | `readFileSync` returns a Buffer without an encoding, a string with one; `flag` option |
|
|
626
|
+
| `statSync` / `lstatSync` (`Stats`) / `renameSync` / `copyFileSync` / `truncateSync` / `realpathSync` / `accessSync` / `unlinkSync` | ✅ | [lib-node-fs-stat.ts](conformance/lib-node-fs-stat.ts) | `throwIfNoEntry: false`; Go exposes only the modification time portably, so `atime` / `ctime` / `birthtime` report it too |
|
|
627
|
+
| `mkdirSync` / `mkdtempSync` / `readdirSync` (`withFileTypes`, `recursive`) / `rmdirSync` / `cpSync` | ✅ | [lib-node-fs-dirs.ts](conformance/lib-node-fs-dirs.ts) | `Dirent` with `isFile()` / `isDirectory()` / `parentPath` |
|
|
628
|
+
| Node system errors (`err.code` / `syscall` / `path` / `errno`) | ✅ | [lib-node-fs-errors.ts](conformance/lib-node-fs-errors.ts) | `ENOENT: no such file or directory, open 'x'`; `EEXIST`, `ENOTEMPTY`, `ERR_FS_EISDIR`, `COPYFILE_EXCL` |
|
|
629
|
+
| File descriptors: `openSync` / `readSync` / `writeSync` / `fstatSync` / `closeSync` | ✅ | [lib-node-fs-fd.ts](conformance/lib-node-fs-fd.ts) | Flags `r`, `w`, `a`, `+`, `x`; positional reads and writes |
|
|
630
|
+
| Callback API (`readFile(path, enc, (err, data) => …)` & co.) | ✅ | [lib-node-fs-callbacks.ts](conformance/lib-node-fs-callbacks.ts) | Work runs on a goroutine; callbacks run on the event loop |
|
|
631
|
+
| `fs/promises` / `fs.promises` (incl. `FileHandle` from `open`) | ✅ | [lib-node-fs-promises.ts](conformance/lib-node-fs-promises.ts) | Rejections carry the error code |
|
|
632
|
+
| `createReadStream` / `createWriteStream` | ✅ | [lib-node-fs-streams.ts](conformance/lib-node-fs-streams.ts) | `encoding`, `start` / `end`, `highWaterMark`, `flags` |
|
|
633
|
+
| `chmodSync` / `utimesSync` / `symlinkSync` / `readlinkSync` / `linkSync` | ✅ | — | Implemented, not probed (symlinks need privileges on Windows) |
|
|
634
|
+
| `watch` (`recursive`, `persistent`, `signal`, `ref` / `unref`, `'change'` / `'error'` / `'close'`) / `watchFile` / `unwatchFile`; `fs/promises` `watch` | ✅ | [lib-node-fs-watch.ts](conformance/lib-node-fs-watch.ts) | `watch` uses the OS's notifications through the vendored `fsnotify` (only linked into programs that call it); recursive watches add subdirectories as they appear. `watchFile` polls `stat()` |
|
|
543
635
|
|
|
544
636
|
#### `node:os`
|
|
545
637
|
|
|
546
|
-
| API
|
|
547
|
-
|
|
|
548
|
-
| `platform` / `arch` / `type` / `machine` / `EOL` / `devNull` / `endianness`
|
|
549
|
-
| `hostname` / `homedir` / `tmpdir` / `userInfo` / `cpus` / `availableParallelism` / `networkInterfaces` / `constants.signals` |
|
|
550
|
-
| `totalmem` / `freemem` / `uptime` / `loadavg` / `release` / `version`
|
|
638
|
+
| API | Status | Probe | Notes |
|
|
639
|
+
| ---------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
640
|
+
| `platform` / `arch` / `type` / `machine` / `EOL` / `devNull` / `endianness` | ✅ | [lib-node-os.ts](conformance/lib-node-os.ts) | Node's names (`win32`, `x64`, `Windows_NT`, `x86_64`) |
|
|
641
|
+
| `hostname` / `homedir` / `tmpdir` / `userInfo` / `cpus` / `availableParallelism` / `networkInterfaces` / `constants.signals` | ✅ | [lib-node-os.ts](conformance/lib-node-os.ts) | `cpus()` has one entry per logical CPU (model / speed / times are zero) |
|
|
642
|
+
| `totalmem` / `freemem` / `uptime` / `loadavg` / `release` / `version` | ✅ | [lib-node-os-mem.ts](conformance/lib-node-os-mem.ts) | `/proc` on Linux, `sysctl` on macOS / BSD, `GlobalMemoryStatusEx` / `GetTickCount64` on Windows (`loadavg` is zeros there, as in Node) |
|
|
551
643
|
|
|
552
644
|
#### `node:process`
|
|
553
645
|
|
|
554
|
-
| API
|
|
555
|
-
|
|
|
556
|
-
| `argv` / `argv0` / `execPath` / `execArgv` / `pid` / `ppid` / `arch` / `version` / `versions`
|
|
557
|
-
| `hrtime` / `hrtime.bigint` / `uptime` / `memoryUsage` / `chdir` / `cwd` / `stdout.write` / `nextTick` / `exitCode`
|
|
558
|
-
| `process.env` reads, writes, `delete`, `in`, `Object.keys(process.env)`; `import { env } from 'node:process'`
|
|
559
|
-
| `process.on('exit' \| 'SIGINT' \| 'SIGTERM' \| 'SIGHUP')` / `once` / `off` / `emit`
|
|
560
|
-
| `process.stdin` / `stdout` / `stderr` as streams
|
|
561
|
-
| `kill` / `emitWarning` / `getuid` / `getgid`
|
|
562
|
-
| `on('uncaughtException')` / `'uncaughtExceptionMonitor'` / `'unhandledRejection'` / `'beforeExit'` (per drain, can schedule more work); `cpuUsage` / `resourceUsage` / `availableMemory` / `loadEnvFile` |
|
|
563
|
-
| `
|
|
646
|
+
| API | Status | Probe | Notes |
|
|
647
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
648
|
+
| `argv` / `argv0` / `execPath` / `execArgv` / `pid` / `ppid` / `arch` / `version` / `versions` | ✅ | [lib-node-process.ts](conformance/lib-node-process.ts) | `argv` has Node's shape: `[execPath, script, ...args]`; `version` is `v24.0.0`; `versions.go` is Go's |
|
|
649
|
+
| `hrtime` / `hrtime.bigint` / `uptime` / `memoryUsage` / `chdir` / `cwd` / `stdout.write` / `nextTick` / `exitCode` | ✅ | [lib-node-process.ts](conformance/lib-node-process.ts) | `exitCode` is applied when the event loop drains |
|
|
650
|
+
| `process.env` reads, writes, `delete`, `in`, `Object.keys(process.env)`; `import { env } from 'node:process'` | ✅ | [lib-node-process-env.ts](conformance/lib-node-process-env.ts) | `os.Setenv` / `os.Unsetenv`; missing variables read as `""` |
|
|
651
|
+
| `process.on('exit' \| 'SIGINT' \| 'SIGTERM' \| 'SIGHUP')` / `once` / `off` / `emit` | ✅ | [lib-node-process-events.ts](conformance/lib-node-process-events.ts) | `'exit'` runs after the event loop with the exit code; signals arrive on the loop |
|
|
652
|
+
| `process.stdin` / `stdout` / `stderr` as streams | ✅ | [lib-node-child-process-async.ts](conformance/lib-node-child-process-async.ts) | `stdin` keeps the process alive only while flowing |
|
|
653
|
+
| `kill` / `emitWarning` / `getuid` / `getgid` | ✅ | — | Implemented, not probed |
|
|
654
|
+
| `on('uncaughtException')` / `'uncaughtExceptionMonitor'` / `'unhandledRejection'` / `'beforeExit'` (per drain, can schedule more work); `cpuUsage` / `resourceUsage` / `availableMemory` / `loadEnvFile` | ✅ | [lib-node-process-uncaught.ts](conformance/lib-node-process-uncaught.ts), [lib-node-os-mem.ts](conformance/lib-node-os-mem.ts) | Throws in the top-level code, loop callbacks and detached async calls reach the handlers; CPU times from `/proc` (Linux) or Go's runtime metrics |
|
|
655
|
+
| `stdout.columns` / `rows` / `getWindowSize()` (and `stderr`), `stdin.setRawMode` / `isRaw`, `umask` | ✅ | [lib-node-process-tty.ts](conformance/lib-node-process-tty.ts) | A per-OS helper: `TIOCGWINSZ` and termios ioctls (Linux, macOS, FreeBSD), the console API (Windows). `columns` / `rows` are `0`, not `undefined`, when not a terminal (`columns \|\| 80` still works); raw mode is libuv's and is undone at exit; `setRawMode` throws when stdin isn't a terminal. No raw mode on Linux PowerPC / MIPS, no `umask` on Windows (`0`, as in Node); no `'resize'` event |
|
|
564
656
|
|
|
565
657
|
#### `node:console`
|
|
566
658
|
|
|
567
|
-
| API
|
|
568
|
-
|
|
|
569
|
-
| Module re-export (`import { log } from 'node:console'`)
|
|
570
|
-
| `new Console(stdout, stderr)` / `new Console({ stdout, stderr })` | ✅
|
|
659
|
+
| API | Status | Probe | Notes |
|
|
660
|
+
| ----------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | --------------------------------------------------- |
|
|
661
|
+
| Module re-export (`import { log } from 'node:console'`) | ✅ | [lib-node-console-class.ts](conformance/lib-node-console-class.ts) | Same as the global `console` |
|
|
662
|
+
| `new Console(stdout, stderr)` / `new Console({ stdout, stderr })` | ✅ | [lib-node-console-class.ts](conformance/lib-node-console-class.ts) | `log` / `info` / `debug` / `error` / `warn` / `dir` |
|
|
571
663
|
|
|
572
664
|
#### `node:util`
|
|
573
665
|
|
|
574
|
-
| API
|
|
575
|
-
|
|
|
576
|
-
| `format` / `formatWithOptions` (`%s %d %i %f %j %o %O %c %%`)
|
|
577
|
-
| `inspect` (`depth`, `breakLength`, `compact`)
|
|
578
|
-
| `isDeepStrictEqual` / `types.*` (`node:util/types`) / `deprecate` / `stripVTControlCharacters` / `styleText`
|
|
579
|
-
| `promisify` / `callbackify`
|
|
580
|
-
| `parseArgs` (short / long / grouped flags, `multiple`, `default`, `strict`, `allowPositionals`, `allowNegative`, `tokens`, Node's errors), `getSystemErrorName` / `getSystemErrorMessage` / `getSystemErrorMap`, `MIMEType` / `MIMEParams`, `parseEnv` (+ `process.loadEnvFile`), `aborted`, `debuglog` (`NODE_DEBUG`), `toUSVString` |
|
|
581
|
-
| `
|
|
582
|
-
|
|
|
666
|
+
| API | Status | Probe | Notes |
|
|
667
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
668
|
+
| `format` / `formatWithOptions` (`%s %d %i %f %j %o %O %c %%`) | ✅ | [lib-node-util-format.ts](conformance/lib-node-util-format.ts) | Extra arguments appended; also used by `console.log` |
|
|
669
|
+
| `inspect` (`depth`, `breakLength`, `compact`) | ✅ | [lib-node-util-inspect.ts](conformance/lib-node-util-inspect.ts) | Node's layout rules: single line up to 80 columns, number arrays grouped in columns, `Map(1) {…}`, `ClassName {…}`, `[Circular *1]` |
|
|
670
|
+
| `isDeepStrictEqual` / `types.*` (`node:util/types`) / `deprecate` / `stripVTControlCharacters` / `styleText` | ✅ | [lib-node-util-misc.ts](conformance/lib-node-util-misc.ts) | `styleText` colours only TTYs unless `validateStream: false` |
|
|
671
|
+
| `promisify` / `callbackify` | ✅ | [lib-node-util-promisify.ts](conformance/lib-node-util-promisify.ts) | Node functions map to their promise versions at compile time (`fs.readFile`, `setTimeout`, `exec`); other functions are wrapped |
|
|
672
|
+
| `parseArgs` (short / long / grouped flags, `multiple`, `default`, `strict`, `allowPositionals`, `allowNegative`, `tokens`, Node's errors), `getSystemErrorName` / `getSystemErrorMessage` / `getSystemErrorMap`, `MIMEType` / `MIMEParams`, `parseEnv` (+ `process.loadEnvFile`), `aborted`, `debuglog` (`NODE_DEBUG`), `toUSVString` | ✅ | [lib-node-util-parse-args.ts](conformance/lib-node-util-parse-args.ts) | |
|
|
673
|
+
| `inspect.custom` methods, `getCallSites` | ❌ | — | `[inspect.custom]()` can lower to a method like `[Symbol.dispose]()`; `getCallSites` can read `runtime.Callers`, which reports `.ts` lines through the `//line` directives |
|
|
674
|
+
| `inherits` (legacy) | 🚫 | — | Rewrites prototypes; classes are static Go structs |
|
|
675
|
+
| Node's errno numbers per OS (`err.errno`, `getSystemErrorMap`) | ✅ | [lib-node-errno.ts](conformance/lib-node-errno.ts) | libuv's table, generated into `src/node/errno_tables.ts`: the OS's errno on Unix (`ECONNREFUSED` is `-111` on Linux, `-61` on macOS) and libuv's fixed numbers on Windows (`ENOENT` is `-4058`). Messages are libuv's; the map matches Node's on Linux entry for entry |
|
|
583
676
|
|
|
584
677
|
#### `node:assert`
|
|
585
678
|
|
|
586
|
-
| API
|
|
587
|
-
|
|
|
588
|
-
| `assert` / `ok` / `equal` / `strictEqual` (+ `not*`) / `match` / `throws` / `doesNotThrow` / `fail` / `ifError`; `node:assert/strict` |
|
|
589
|
-
| `deepEqual` / `deepStrictEqual` (+ `not*`) / `rejects` / `doesNotReject`
|
|
679
|
+
| API | Status | Probe | Notes |
|
|
680
|
+
| ------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
681
|
+
| `assert` / `ok` / `equal` / `strictEqual` (+ `not*`) / `match` / `throws` / `doesNotThrow` / `fail` / `ifError`; `node:assert/strict` | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts) | Failures throw an `AssertionError` (`code: 'ERR_ASSERTION'`, `actual`, `expected`, `operator`); `throws` validates with a RegExp, class or object |
|
|
682
|
+
| `deepEqual` / `deepStrictEqual` (+ `not*`) / `rejects` / `doesNotReject` | ✅ | [lib-node-assert-deep.ts](conformance/lib-node-assert-deep.ts) | Key order is ignored for objects, Maps and Sets; failure messages are simplified (no diff) |
|
|
590
683
|
|
|
591
684
|
#### `node:url`
|
|
592
685
|
|
|
593
|
-
| API
|
|
594
|
-
|
|
|
595
|
-
| `fileURLToPath` / `pathToFileURL`
|
|
596
|
-
| `URL` (WHATWG): parsing, relative resolution, getters / setters, `canParse`, `parse`; `domainToASCII` / `domainToUnicode`; `format` |
|
|
597
|
-
| `URLSearchParams` (and `url.searchParams`, kept in sync)
|
|
598
|
-
| Legacy `url.parse` / `url.resolve`
|
|
686
|
+
| API | Status | Probe | Notes |
|
|
687
|
+
| ----------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
688
|
+
| `fileURLToPath` / `pathToFileURL` | ✅ | [lib-node-url.ts](conformance/lib-node-url.ts) | `pathToFileURL` returns a `URL`; Windows drive letters |
|
|
689
|
+
| `URL` (WHATWG): parsing, relative resolution, getters / setters, `canParse`, `parse`; `domainToASCII` / `domainToUnicode`; `format` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts) | Special schemes, dot segments, default ports, percent-encode sets, IDN hosts (punycode); invalid input throws `ERR_INVALID_URL` |
|
|
690
|
+
| `URLSearchParams` (and `url.searchParams`, kept in sync) | ✅ | [lib-node-url-search-params.ts](conformance/lib-node-url-search-params.ts) | `for...of`, `forEach`, `sort`, construction from strings / objects / pairs |
|
|
691
|
+
| Legacy `url.parse` / `url.resolve` | ❌ | — | Deprecated upstream, but a pure port is feasible |
|
|
599
692
|
|
|
600
693
|
#### `node:querystring`
|
|
601
694
|
|
|
602
|
-
| API
|
|
603
|
-
|
|
|
604
|
-
| `parse` / `stringify` / `escape` / `unescape` / `decode` / `encode`
|
|
695
|
+
| API | Status | Probe | Notes |
|
|
696
|
+
| ------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ---------------------------------------------- |
|
|
697
|
+
| `parse` / `stringify` / `escape` / `unescape` / `decode` / `encode` | ✅ | [lib-node-querystring.ts](conformance/lib-node-querystring.ts) | Repeated keys become arrays; custom separators |
|
|
605
698
|
|
|
606
699
|
#### `node:punycode`
|
|
607
700
|
|
|
608
|
-
| API | Status | Probe | Notes
|
|
609
|
-
| --------------------------------------------- | :----: | -------------------------------------------------------- |
|
|
610
|
-
| `encode` / `decode` / `toASCII` / `toUnicode` | ✅
|
|
701
|
+
| API | Status | Probe | Notes |
|
|
702
|
+
| --------------------------------------------- | :----: | -------------------------------------------------------- | ------------------------------ |
|
|
703
|
+
| `encode` / `decode` / `toASCII` / `toUnicode` | ✅ | [lib-node-punycode.ts](conformance/lib-node-punycode.ts) | RFC 3492 (deprecated upstream) |
|
|
611
704
|
|
|
612
705
|
#### `node:string_decoder`
|
|
613
706
|
|
|
614
|
-
| API
|
|
615
|
-
|
|
|
616
|
-
| `StringDecoder` (`write` / `end`)
|
|
707
|
+
| API | Status | Probe | Notes |
|
|
708
|
+
| --------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
709
|
+
| `StringDecoder` (`write` / `end`) | ✅ | [lib-node-string-decoder.ts](conformance/lib-node-string-decoder.ts) | Holds back split UTF-8 / UTF-16LE characters and base64 groups |
|
|
617
710
|
|
|
618
711
|
#### `node:crypto`
|
|
619
712
|
|
|
620
|
-
| API
|
|
621
|
-
|
|
|
622
|
-
| `createHash` / `createHmac` / `hash` / `getHashes` (`update` / `digest` / `copy`)
|
|
623
|
-
| `randomBytes` / `randomUUID` / `randomInt` / `getRandomValues` / `timingSafeEqual`; global `crypto`
|
|
624
|
-
| `pbkdf2Sync` / `hkdfSync`
|
|
625
|
-
| `createCipheriv` / `createDecipheriv` (aes-128/192/256-cbc/ctr/gcm)
|
|
626
|
-
| `scryptSync` / `scrypt` (`N` / `r` / `p` / `maxmem` and their aliases); callback forms of `pbkdf2`, `hkdf`, `randomBytes`, `randomFill`; `randomFillSync`
|
|
627
|
-
| `KeyObject` (`type`, `asymmetricKeyType`, `asymmetricKeyDetails`, `symmetricKeySize`, `export` as PEM / DER / JWK, `equals`, `KeyObject.from`), `createPrivateKey` / `createPublicKey` / `createSecretKey` (PEM, DER, JWK; pkcs1 / pkcs8 / sec1 / spki; certificates)
|
|
628
|
-
| `generateKeyPair(Sync)` (`rsa`, `ec`, `ed25519`, `x25519`; KeyObjects or `publicKeyEncoding` / `privateKeyEncoding`), `generateKey(Sync)` (`hmac`, `aes`)
|
|
629
|
-
| `sign` / `verify`, `createSign` / `createVerify` (RSA PKCS#1 v1.5 and PSS with `saltLength`, ECDSA in DER or `ieee-p1363`, Ed25519); `publicEncrypt` / `privateDecrypt` (OAEP with `oaepHash` / `oaepLabel`, PKCS#1, none), `privateEncrypt` / `publicDecrypt`; `crypto.constants`
|
|
630
|
-
| `createECDH` (compressed / uncompressed keys), `getCurves`, `diffieHellman` (ec / x25519 KeyObjects), `createDiffieHellman` / `getDiffieHellman` (modp1 – modp18)
|
|
631
|
-
| `generatePrime(Sync)` (`bigint`, `safe`, `add` / `rem`), `checkPrime(Sync)`
|
|
632
|
-
| `X509Certificate` (`subject`, `issuer`, `subjectAltName`, `validFrom` / `validTo` (+ `Date`s), fingerprints, `serialNumber`, `ca`, `publicKey`, `raw`, `keyUsage`, `checkHost` / `checkIP` / `checkEmail`, `checkIssued`, `verify`, `toString`, `toLegacyObject`)
|
|
633
|
-
| `crypto.subtle` / `webcrypto.subtle`: `digest`, `generateKey`, `importKey` / `exportKey` (`raw`, `spki`, `pkcs8`, `jwk`), `sign` / `verify` (HMAC, RSASSA-PKCS1-v1_5, RSA-PSS, ECDSA, Ed25519), `encrypt` / `decrypt` (AES-GCM / CBC / CTR, RSA-OAEP), `deriveBits` / `deriveKey` (PBKDF2, HKDF, ECDH, X25519), `wrapKey` / `unwrapKey` |
|
|
634
|
-
|
|
|
713
|
+
| API | Status | Probe | Notes |
|
|
714
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
715
|
+
| `createHash` / `createHmac` / `hash` / `getHashes` (`update` / `digest` / `copy`) | ✅ | [lib-node-crypto-hash.ts](conformance/lib-node-crypto-hash.ts) | md5, sha1, sha224/256/384/512, sha512-224/256, sha3-224/256/384/512 |
|
|
716
|
+
| `randomBytes` / `randomUUID` / `randomInt` / `getRandomValues` / `timingSafeEqual`; global `crypto` | ✅ | [lib-node-crypto-random.ts](conformance/lib-node-crypto-random.ts) | `crypto/rand` |
|
|
717
|
+
| `pbkdf2Sync` / `hkdfSync` | ✅ | [lib-node-crypto-kdf.ts](conformance/lib-node-crypto-kdf.ts) | `crypto/pbkdf2` / `crypto/hkdf` (Go 1.24+) |
|
|
718
|
+
| `createCipheriv` / `createDecipheriv` (aes-128/192/256-cbc/ctr/gcm) | ✅ | [lib-node-crypto-cipher.ts](conformance/lib-node-crypto-cipher.ts) | GCM output arrives from `final()` (authenticated as a whole) |
|
|
719
|
+
| `scryptSync` / `scrypt` (`N` / `r` / `p` / `maxmem` and their aliases); callback forms of `pbkdf2`, `hkdf`, `randomBytes`, `randomFill`; `randomFillSync` | ✅ | [lib-node-crypto-scrypt.ts](conformance/lib-node-crypto-scrypt.ts) | scrypt written out over `crypto/pbkdf2` (Salsa20/8, BlockMix, ROMix); callbacks run on the event loop |
|
|
720
|
+
| `KeyObject` (`type`, `asymmetricKeyType`, `asymmetricKeyDetails`, `symmetricKeySize`, `export` as PEM / DER / JWK, `equals`, `KeyObject.from`), `createPrivateKey` / `createPublicKey` / `createSecretKey` (PEM, DER, JWK; pkcs1 / pkcs8 / sec1 / spki; certificates) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | RSA, EC (P-256 / P-384 / P-521), Ed25519, X25519 |
|
|
721
|
+
| `generateKeyPair(Sync)` (`rsa`, `ec`, `ed25519`, `x25519`; KeyObjects or `publicKeyEncoding` / `privateKeyEncoding`), `generateKey(Sync)` (`hmac`, `aes`) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | RSA keys use the public exponent 65537 |
|
|
722
|
+
| `sign` / `verify`, `createSign` / `createVerify` (RSA PKCS#1 v1.5 and PSS with `saltLength`, ECDSA in DER or `ieee-p1363`, Ed25519); `publicEncrypt` / `privateDecrypt` (OAEP with `oaepHash` / `oaepLabel`, PKCS#1, none), `privateEncrypt` / `publicDecrypt`; `crypto.constants` | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | |
|
|
723
|
+
| `createECDH` (compressed / uncompressed keys), `getCurves`, `diffieHellman` (ec / x25519 KeyObjects), `createDiffieHellman` / `getDiffieHellman` (modp1 – modp18) | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | `createDiffieHellman(bits)` generates a random (not safe) prime |
|
|
724
|
+
| `generatePrime(Sync)` (`bigint`, `safe`, `add` / `rem`), `checkPrime(Sync)` | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | `math/big`'s Miller-Rabin |
|
|
725
|
+
| `X509Certificate` (`subject`, `issuer`, `subjectAltName`, `validFrom` / `validTo` (+ `Date`s), fingerprints, `serialNumber`, `ca`, `publicKey`, `raw`, `keyUsage`, `checkHost` / `checkIP` / `checkEmail`, `checkIssued`, `verify`, `toString`, `toLegacyObject`) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | `crypto/x509` |
|
|
726
|
+
| `crypto.subtle` / `webcrypto.subtle`: `digest`, `generateKey`, `importKey` / `exportKey` (`raw`, `spki`, `pkcs8`, `jwk`), `sign` / `verify` (HMAC, RSASSA-PKCS1-v1_5, RSA-PSS, ECDSA, Ed25519), `encrypt` / `decrypt` (AES-GCM / CBC / CTR, RSA-OAEP), `deriveBits` / `deriveKey` (PBKDF2, HKDF, ECDH, X25519), `wrapKey` / `unwrapKey` | ✅ | [lib-node-crypto-subtle.ts](conformance/lib-node-crypto-subtle.ts) | Key usages are recorded but not enforced |
|
|
727
|
+
| `Hash` / `Hmac` as streams (`write` / `end`, `'readable'`, `pipe` into a hash, `pipeline`, `setEncoding`) | ✅ | [lib-node-crypto-hash-stream.ts](conformance/lib-node-crypto-hash-stream.ts) | A transform that pushes the digest at the end, as in Node; afterwards `hash.digest()` throws and `hmac.digest()` is empty. Only programs that use a hash as a stream carry the stream code |
|
|
728
|
+
| AES key wrap: `id-aes128-wrap` … `id-aes256-wrap-pad` (and the `aes128-wrap` aliases) | ✅ | [lib-node-crypto-keywrap.ts](conformance/lib-node-crypto-keywrap.ts) | RFC 3394 and RFC 5649, checked against the RFC vectors; the whole input goes through one `update()`, as with OpenSSL |
|
|
729
|
+
| Encrypted private keys (`passphrase` / `cipher`), `rsa-pss` / `dsa` / `dh` / `ed448` / `x448` key types, `secp256k1`, `Certificate` (SPKAC) | ❌ | — | Not in Go's standard library, but portable: encrypted PKCS#8 is PBES2 over `pbkdf2` + AES-CBC; `rsa-pss` / `dsa` / `dh` keys and SPKAC are ASN.1 on existing primitives; `secp256k1` / `ed448` / `x448` need vendored curve code |
|
|
635
730
|
|
|
636
731
|
#### `node:zlib`
|
|
637
732
|
|
|
638
|
-
| API
|
|
639
|
-
|
|
|
640
|
-
| `gzipSync` / `gunzipSync` / `deflateSync` / `inflateSync` / `deflateRawSync` / `inflateRawSync` / `unzipSync` / `crc32` / `constants`
|
|
641
|
-
| `createGzip` / `createGunzip` / `createDeflate` / `createInflate` / `createDeflateRaw` / `createInflateRaw` / `createUnzip`
|
|
642
|
-
| Callback forms `gzip` / `gunzip` / `deflate` / `inflate` / `deflateRaw` / `inflateRaw` / `unzip` (`buf, [options], cb`) and `util.promisify` of them
|
|
643
|
-
| Brotli: `brotliCompressSync` / `brotliDecompressSync`, callback and promisified `brotliCompress` / `brotliDecompress`, `createBrotliCompress` / `createBrotliDecompress`, `constants.BROTLI_*` |
|
|
733
|
+
| API | Status | Probe | Notes |
|
|
734
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
735
|
+
| `gzipSync` / `gunzipSync` / `deflateSync` / `inflateSync` / `deflateRawSync` / `inflateRawSync` / `unzipSync` / `crc32` / `constants` | ✅ | [lib-node-zlib.ts](conformance/lib-node-zlib.ts) | `{ level }`; invalid input throws `Z_DATA_ERROR` |
|
|
736
|
+
| `createGzip` / `createGunzip` / `createDeflate` / `createInflate` / `createDeflateRaw` / `createInflateRaw` / `createUnzip` | ✅ | [lib-node-zlib-streams.ts](conformance/lib-node-zlib-streams.ts) | Transforms that (de)compress when the input ends |
|
|
737
|
+
| Callback forms `gzip` / `gunzip` / `deflate` / `inflate` / `deflateRaw` / `inflateRaw` / `unzip` (`buf, [options], cb`) and `util.promisify` of them | ✅ | [lib-node-zlib-async.ts](conformance/lib-node-zlib-async.ts) | The codec runs on a goroutine; the callback runs on the event loop |
|
|
738
|
+
| Brotli: `brotliCompressSync` / `brotliDecompressSync`, callback and promisified `brotliCompress` / `brotliDecompress`, `createBrotliCompress` / `createBrotliDecompress`, `constants.BROTLI_*` | ✅ | [lib-node-zlib-brotli.ts](conformance/lib-node-zlib-brotli.ts) | The vendored `andybalholm/brotli` (pure Go, only linked into programs that use it); `params` quality / window. Output matches Node's; decoder errors carry Node's codes |
|
|
644
739
|
|
|
645
740
|
#### `node:timers`
|
|
646
741
|
|
|
647
|
-
| API
|
|
648
|
-
|
|
|
649
|
-
| `setTimeout` / `setInterval` / `setImmediate` (+ extra arguments) / `clear*`; global `setImmediate`
|
|
650
|
-
| `node:timers/promises` (`setTimeout`, `setImmediate`, `setInterval`, `scheduler`)
|
|
651
|
-
| `Timeout` / `Immediate` handles: `ref` / `unref` / `hasRef` / `refresh` / `close` (also on intervals) |
|
|
742
|
+
| API | Status | Probe | Notes |
|
|
743
|
+
| ----------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
744
|
+
| `setTimeout` / `setInterval` / `setImmediate` (+ extra arguments) / `clear*`; global `setImmediate` | ✅ | [lib-node-timers.ts](conformance/lib-node-timers.ts) | Callbacks run on the event loop |
|
|
745
|
+
| `node:timers/promises` (`setTimeout`, `setImmediate`, `setInterval`, `scheduler`) | ✅ | [lib-node-timers-promises.ts](conformance/lib-node-timers-promises.ts) | `{ signal }` aborts; `setInterval` is an async iterator |
|
|
746
|
+
| `Timeout` / `Immediate` handles: `ref` / `unref` / `hasRef` / `refresh` / `close` (also on intervals) | ✅ | [lib-node-timers-ref.ts](conformance/lib-node-timers-ref.ts) | Unref'ed timers don't keep the process alive |
|
|
652
747
|
|
|
653
748
|
#### `node:perf_hooks`
|
|
654
749
|
|
|
655
|
-
| API
|
|
656
|
-
|
|
|
657
|
-
| `performance.now` / `timeOrigin` / `mark` / `measure` / `getEntries*` / `clearMarks`; global `performance`
|
|
658
|
-
| `PerformanceObserver` (`entryTypes` / `type` + `buffered`, batched, sorted by `startTime`), `timerify`, `createHistogram`, `monitorEventLoopDelay`, `eventLoopUtilization` |
|
|
750
|
+
| API | Status | Probe | Notes |
|
|
751
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------- |
|
|
752
|
+
| `performance.now` / `timeOrigin` / `mark` / `measure` / `getEntries*` / `clearMarks`; global `performance` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Monotonic milliseconds since process start |
|
|
753
|
+
| `PerformanceObserver` (`entryTypes` / `type` + `buffered`, batched, sorted by `startTime`), `timerify`, `createHistogram`, `monitorEventLoopDelay`, `eventLoopUtilization` | ✅ | [lib-node-perf-observer.ts](conformance/lib-node-perf-observer.ts) | `eventLoopUtilization` is estimated from CPU time |
|
|
659
754
|
|
|
660
755
|
#### `node:tty`
|
|
661
756
|
|
|
662
|
-
| API
|
|
663
|
-
|
|
|
664
|
-
| `isatty(fd)`
|
|
665
|
-
| `ReadStream` / `WriteStream`
|
|
757
|
+
| API | Status | Probe | Notes |
|
|
758
|
+
| ------------------------------------ | :----: | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
759
|
+
| `isatty(fd)` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Character-device check on fds 0–2 |
|
|
760
|
+
| `ReadStream` / `WriteStream` classes | ❌ | — | Feasible; the terminal calls behind them exist (`process.stdout.columns`, `process.stdin.setRawMode` in [process](#nodeprocess)) |
|
|
666
761
|
|
|
667
762
|
#### `node:constants` / `node:sys`
|
|
668
763
|
|
|
669
|
-
| API
|
|
670
|
-
|
|
|
671
|
-
| `node:constants` (`F_OK`, `SIGINT`, …)
|
|
672
|
-
| `node:sys`
|
|
764
|
+
| API | Status | Probe | Notes |
|
|
765
|
+
| -------------------------------------- | :----: | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
766
|
+
| `node:constants` (`F_OK`, `SIGINT`, …) | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Deprecated upstream: `fs.constants` + `os.constants.signals` |
|
|
767
|
+
| `node:sys` | ✅ | — | Deprecated alias of `node:util` |
|
|
673
768
|
|
|
674
769
|
#### `node:events`
|
|
675
770
|
|
|
676
|
-
| API
|
|
677
|
-
|
|
|
678
|
-
| `EventEmitter`: `on` / `once` / `off` / `prepend*` / `emit` / `removeAllListeners` / `listenerCount` / `eventNames` / max listeners / `newListener`; unhandled `'error'` throws |
|
|
679
|
-
| `class X extends EventEmitter`
|
|
680
|
-
| `events.once` (→ promise) / `events.on` (async iterator)
|
|
681
|
-
| `EventTarget` / `Event` / `AbortController` / `AbortSignal` (`abort`, `timeout`, `any`, `throwIfAborted`)
|
|
682
|
-
| `errorMonitor`, `captureRejections` (option and global), `getMaxListeners` / `setMaxListeners` (static), `addAbortListener`
|
|
683
|
-
| Symbol event names other than `errorMonitor`, `EventEmitterAsyncResource`, `Symbol.for('nodejs.rejection')`
|
|
771
|
+
| API | Status | Probe | Notes |
|
|
772
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
773
|
+
| `EventEmitter`: `on` / `once` / `off` / `prepend*` / `emit` / `removeAllListeners` / `listenerCount` / `eventNames` / max listeners / `newListener`; unhandled `'error'` throws | ✅ | [lib-node-events.ts](conformance/lib-node-events.ts) | Listeners are called with any signature; removal by identity |
|
|
774
|
+
| `class X extends EventEmitter` | ✅ | [lib-node-events-extends.ts](conformance/lib-node-events-extends.ts) | The emitter is embedded; `this.emit` and inherited methods work |
|
|
775
|
+
| `events.once` (→ promise) / `events.on` (async iterator) | ✅ | [lib-node-events-once.ts](conformance/lib-node-events-once.ts) | `'error'` rejects `once` |
|
|
776
|
+
| `EventTarget` / `Event` / `AbortController` / `AbortSignal` (`abort`, `timeout`, `any`, `throwIfAborted`) | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts) | Globals (also exported by `node:events`) |
|
|
777
|
+
| `errorMonitor`, `captureRejections` (option and global), `getMaxListeners` / `setMaxListeners` (static), `addAbortListener` | ✅ | [lib-node-events-extra.ts](conformance/lib-node-events-extra.ts) | Captures rejections of listeners that return a promise; async arrow listeners run inline (their `await`s don't yield to `emit`) |
|
|
778
|
+
| Symbol event names other than `errorMonitor`, `EventEmitterAsyncResource`, `Symbol.for('nodejs.rejection')` | ❌ | — | Event names are strings today; symbols are unique pointers, usable as listener keys, and `EventEmitterAsyncResource` fits on `AsyncResource` |
|
|
684
779
|
|
|
685
780
|
#### `node:stream`
|
|
686
781
|
|
|
687
|
-
| API
|
|
688
|
-
|
|
|
689
|
-
| `Readable` (`push`, `read`, `pause` / `resume`, `setEncoding`, `destroy`), `Readable.from`, `for await`
|
|
690
|
-
| `
|
|
691
|
-
| `
|
|
692
|
-
| `
|
|
693
|
-
| `
|
|
694
|
-
|
|
|
782
|
+
| API | Status | Probe | Notes |
|
|
783
|
+
| ------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
784
|
+
| `Readable` (`push`, `read`, `pause` / `resume`, `setEncoding`, `destroy`), `Readable.from`, `for await` | ✅ | [lib-node-stream-readable.ts](conformance/lib-node-stream-readable.ts) | Arrays, strings, Buffers and async generators as sources |
|
|
785
|
+
| `'readable'` events (paused mode), `read()` / `read(size)` | ✅ | [lib-node-stream-readable-event.ts](conformance/lib-node-stream-readable-event.ts) | A last `'readable'` (with `read()` giving `null`) comes before `'end'`; `read()` returns everything buffered, `read(n)` waits for `n` bytes unless the stream ended, and what it returns is also a `'data'` event. Chunk boundaries can differ from Node's read-ahead |
|
|
786
|
+
| `Writable` (`write` / `end` / callbacks, `final`, `'finish'`, write after end) | ✅ | [lib-node-stream-writable.ts](conformance/lib-node-stream-writable.ts) | Strings become Buffers unless `decodeStrings: false` or `objectMode` |
|
|
787
|
+
| `Transform` / `PassThrough` / `Duplex`, `pipe` chains, subclasses overriding `_transform` & co. | ✅ | [lib-node-stream-transform.ts](conformance/lib-node-stream-transform.ts) | Option methods (`transform`, `flush`, `write`, `final`, `read`) and `_`-overrides both work; `this` inside option methods is not the stream (use the callback) |
|
|
788
|
+
| `pipeline` / `finished` / `stream/promises` / `stream/consumers` (`text`, `json`, `buffer`) | ✅ | [lib-node-stream-pipeline.ts](conformance/lib-node-stream-pipeline.ts) | Errors destroy the pipeline and reach the callback / rejection |
|
|
789
|
+
| `Readable.toWeb` / `fromWeb`, `Writable.toWeb` / `fromWeb`, `Duplex.toWeb` / `fromWeb`, `compose` (Node and web streams) | ✅ | [lib-node-stream-web-bridge.ts](conformance/lib-node-stream-web-bridge.ts) | `toWeb` pauses the Node stream while the web queue is full |
|
|
790
|
+
| Backpressure (`highWaterMark` beyond `write()`'s return value), `compose` with generator functions | ❌ | — | Not implemented yet |
|
|
695
791
|
|
|
696
792
|
#### `node:stream/web`
|
|
697
793
|
|
|
698
|
-
| API
|
|
699
|
-
|
|
|
700
|
-
| `ReadableStream` (underlying source `start` / `pull` / `cancel`, sync or async), `getReader()` → `read` / `releaseLock` / `cancel` / `closed`, `locked`, `cancel`, `tee`, `for await` / `values()`, `ReadableStream.from` |
|
|
701
|
-
| `WritableStream` (sink `start` / `write` / `close` / `abort`), `getWriter()` → `write` / `close` / `abort` / `ready` / `closed` / `desiredSize` / `releaseLock`; controller `error` / `signal`
|
|
702
|
-
| `TransformStream` (`transform` / `flush` / `start`, controller `enqueue` / `error` / `terminate`), `pipeThrough` / `pipeTo` (`preventClose` / `preventAbort` / `preventCancel` / `signal`)
|
|
703
|
-
| `CountQueuingStrategy` / `ByteLengthQueuingStrategy`, `{ highWaterMark, size }` strategies
|
|
704
|
-
| `TextEncoderStream` / `TextDecoderStream` (characters split across chunks), `CompressionStream` / `DecompressionStream` (`gzip`, `deflate`, `deflate-raw`)
|
|
705
|
-
| BYOB readers (`getReader({ mode: 'byob' })` reads into a view), byte-stream controllers' `byobRequest`, transferring streams
|
|
794
|
+
| API | Status | Probe | Notes |
|
|
795
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
796
|
+
| `ReadableStream` (underlying source `start` / `pull` / `cancel`, sync or async), `getReader()` → `read` / `releaseLock` / `cancel` / `closed`, `locked`, `cancel`, `tee`, `for await` / `values()`, `ReadableStream.from` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | Promise reactions run as microtasks on the event loop; an error ends `for await` with a throw |
|
|
797
|
+
| `WritableStream` (sink `start` / `write` / `close` / `abort`), `getWriter()` → `write` / `close` / `abort` / `ready` / `closed` / `desiredSize` / `releaseLock`; controller `error` / `signal` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | Writes run one at a time; `ready` follows the queue's backpressure |
|
|
798
|
+
| `TransformStream` (`transform` / `flush` / `start`, controller `enqueue` / `error` / `terminate`), `pipeThrough` / `pipeTo` (`preventClose` / `preventAbort` / `preventCancel` / `signal`) | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | A transform waits until its readable side wants more |
|
|
799
|
+
| `CountQueuingStrategy` / `ByteLengthQueuingStrategy`, `{ highWaterMark, size }` strategies | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | |
|
|
800
|
+
| `TextEncoderStream` / `TextDecoderStream` (characters split across chunks), `CompressionStream` / `DecompressionStream` (`gzip`, `deflate`, `deflate-raw`) | ✅ | [lib-node-stream-web-bridge.ts](conformance/lib-node-stream-web-bridge.ts) | Decompression decodes once the input ends |
|
|
801
|
+
| BYOB readers (`getReader({ mode: 'byob' })` reads into a view), byte-stream controllers' `byobRequest`, transferring streams | ❌ | — | `getReader({ mode: 'byob' })` returns a default reader |
|
|
706
802
|
|
|
707
803
|
#### `node:readline`
|
|
708
804
|
|
|
709
|
-
| API
|
|
710
|
-
|
|
|
711
|
-
| `createInterface` (`'line'` / `'close'`, `question(q, cb)`, `prompt`, `close`, `for await`) | ✅
|
|
712
|
-
| `node:readline/promises` (`await rl.question(q)`)
|
|
713
|
-
| `question(prompt)` (synchronous)
|
|
714
|
-
| `cursorTo` / `moveCursor` / `clearLine` / `clearScreenDown`
|
|
715
|
-
| `emitKeypressEvents
|
|
805
|
+
| API | Status | Probe | Notes |
|
|
806
|
+
| ------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
807
|
+
| `createInterface` (`'line'` / `'close'`, `question(q, cb)`, `prompt`, `close`, `for await`) | ✅ | [lib-node-readline.ts](conformance/lib-node-readline.ts) | Any readable stream as input (`process.stdin` included) |
|
|
808
|
+
| `node:readline/promises` (`await rl.question(q)`) | ✅ | [lib-node-readline-promises.ts](conformance/lib-node-readline-promises.ts) | |
|
|
809
|
+
| `question(prompt)` (synchronous) | ✅ | [lib-node-readline-question.ts](conformance/lib-node-readline-question.ts) | TypeNative extension (not in Node): used by the self-hosted compiler |
|
|
810
|
+
| `cursorTo` / `moveCursor` / `clearLine` / `clearScreenDown` | ✅ | [lib-node-readline-cursor.ts](conformance/lib-node-readline-cursor.ts) | ANSI escape sequences written to the stream; optional callback |
|
|
811
|
+
| `emitKeypressEvents(stream)` (`'keypress'` with `(str, key)`) | ✅ | [lib-node-readline-keypress.ts](conformance/lib-node-readline-keypress.ts) | A port of Node's key decoder: names, `ctrl` / `meta` / `shift`, xterm / rxvt / putty sequences, Escape after 500 ms. `str` is `""` (not `undefined`) for escape sequences, and so are `name` / `code` when Node leaves them out |
|
|
812
|
+
| `Interface` line editing, `history`, `completer` | ❌ | — | Feasible: keypresses and raw mode exist; needs the terminal-mode line editor on top |
|
|
716
813
|
|
|
717
814
|
#### `node:child_process`
|
|
718
815
|
|
|
719
|
-
| API
|
|
720
|
-
|
|
|
721
|
-
| `execSync` / `execFileSync` / `spawnSync` (`encoding`, `input`, `cwd`, `env`, `shell`, `stdio: 'inherit'`)
|
|
722
|
-
| `exec` / `execFile` (callbacks), `spawn` → `ChildProcess` (stdio streams, `'exit'` / `'close'`, `kill`); `promisify(exec)`
|
|
723
|
-
| `fork(modulePath, args, { env, cwd, silent })` → `send` / `'message'` / `disconnect` / `'disconnect'` / `connected`; in the child `process.send` / `process.on('message')` / `process.connected` / `process.disconnect` |
|
|
724
|
-
| `detached`, `
|
|
816
|
+
| API | Status | Probe | Notes |
|
|
817
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
818
|
+
| `execSync` / `execFileSync` / `spawnSync` (`encoding`, `input`, `cwd`, `env`, `shell`, `stdio: 'inherit'`) | ✅ | [lib-node-child-process-sync.ts](conformance/lib-node-child-process-sync.ts) | Buffers unless an encoding is given (as in Node); a non-zero exit throws with `status` / `stdout` / `stderr` |
|
|
819
|
+
| `exec` / `execFile` (callbacks), `spawn` → `ChildProcess` (stdio streams, `'exit'` / `'close'`, `kill`); `promisify(exec)` | ✅ | [lib-node-child-process-async.ts](conformance/lib-node-child-process-async.ts) | `'close'` follows the end of the stdio streams being read; exit codes on `err.code` |
|
|
820
|
+
| `fork(modulePath, args, { env, cwd, silent })` → `send` / `'message'` / `disconnect` / `'disconnect'` / `connected`; in the child `process.send` / `process.on('message')` / `process.connected` / `process.disconnect` | ✅ | [lib-node-child-process-fork.ts](conformance/lib-node-child-process-fork.ts) | The child is this program run again (branch on `process.argv` / `process.send`), linked over loopback TCP; messages are structured clones (a superset of Node's default JSON) |
|
|
821
|
+
| `spawn` `detached`, `child.unref()` / `ref()` | ✅ | [lib-node-child-process-detached.ts](conformance/lib-node-child-process-detached.ts) | A new session (`setsid`) on Unix; `DETACHED_PROCESS \| CREATE_NEW_PROCESS_GROUP` on Windows, as libuv does. An unref'ed child's stdio pipes don't keep the parent alive either |
|
|
822
|
+
| `fork('./child.ts')` (another file) | ✅ | [lib-node-worker-entry.ts](conformance/lib-node-worker-entry.ts) | As for workers: a second entry point of the binary |
|
|
823
|
+
| `stdio` arrays beyond stdout | ❌ | — | Extra `stdio` entries are `ExtraFiles` |
|
|
824
|
+
| `serialization: 'advanced'` handle passing (`send(msg, socket)`) | ❌ | — | Needs file-descriptor passing over the IPC channel (`SCM_RIGHTS` on Unix) |
|
|
725
825
|
|
|
726
826
|
#### `node:cluster`
|
|
727
827
|
|
|
728
|
-
| API
|
|
729
|
-
|
|
|
730
|
-
| `isPrimary` / `isWorker` / `isMaster`, `fork(env)`, `workers`, `worker`, `setupPrimary` / `settings`, `disconnect(cb)`, `SCHED_RR` / `schedulingPolicy`; events `'fork'` / `'online'` / `'listening'` / `'message'` / `'disconnect'` / `'exit'` |
|
|
731
|
-
| `Worker` (`id`, `process`, `send`, `'message'`, `disconnect`, `kill`, `isConnected`, `isDead`, `exitedAfterDisconnect`); `process.send` from workers
|
|
732
|
-
| Shared ports: `net` / `http` / `https` / `tls` servers in workers listen on one port (also `listen(0)`), connections round-robin
|
|
733
|
-
| `SCHED_NONE` (OS-level balancing), `exclusive: true` listeners, dgram sockets in workers
|
|
828
|
+
| API | Status | Probe | Notes |
|
|
829
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
830
|
+
| `isPrimary` / `isWorker` / `isMaster`, `fork(env)`, `workers`, `worker`, `setupPrimary` / `settings`, `disconnect(cb)`, `SCHED_RR` / `schedulingPolicy`; events `'fork'` / `'online'` / `'listening'` / `'message'` / `'disconnect'` / `'exit'` | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | Workers are this program run again with `NODE_UNIQUE_ID` set |
|
|
831
|
+
| `Worker` (`id`, `process`, `send`, `'message'`, `disconnect`, `kill`, `isConnected`, `isDead`, `exitedAfterDisconnect`); `process.send` from workers | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | |
|
|
832
|
+
| Shared ports: `net` / `http` / `https` / `tls` servers in workers listen on one port (also `listen(0)`), connections round-robin | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | The primary owns the listener and relays each connection to a worker's private loopback listener with the client's address (no handle passing) |
|
|
833
|
+
| `SCHED_NONE` (OS-level balancing), `exclusive: true` listeners, dgram sockets in workers | ❌ | — | Everything goes through the primary today; `SO_REUSEPORT` or handle passing would remove it |
|
|
734
834
|
|
|
735
835
|
#### `node:diagnostics_channel`
|
|
736
836
|
|
|
737
|
-
| API
|
|
738
|
-
|
|
|
739
|
-
| `channel` / `publish` / `subscribe` / `unsubscribe` / `hasSubscribers`
|
|
740
|
-
| `tracingChannel` (`start` / `end` / `asyncStart` / `asyncEnd` / `error` channels, `subscribe` / `unsubscribe`, `traceSync` / `tracePromise` / `traceCallback`); `channel.bindStore` / `unbindStore` / `runStores` |
|
|
837
|
+
| API | Status | Probe | Notes |
|
|
838
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
|
839
|
+
| `channel` / `publish` / `subscribe` / `unsubscribe` / `hasSubscribers` | ✅ | [lib-node-diagnostics-channel.ts](conformance/lib-node-diagnostics-channel.ts) | Synchronous; shared by name |
|
|
840
|
+
| `tracingChannel` (`start` / `end` / `asyncStart` / `asyncEnd` / `error` channels, `subscribe` / `unsubscribe`, `traceSync` / `tracePromise` / `traceCallback`); `channel.bindStore` / `unbindStore` / `runStores` | ✅ | [lib-node-diagnostics-tracing.ts](conformance/lib-node-diagnostics-tracing.ts) | The context gets `result` / `error`; a struct context without those fields is copied into a record |
|
|
741
841
|
|
|
742
842
|
#### `node:net`
|
|
743
843
|
|
|
744
|
-
| API
|
|
745
|
-
|
|
|
746
|
-
| `createServer` / `Server` (`listen` forms incl. `{ port, host }` and Unix paths, `address()`, `close(cb)`, `getConnections`, `maxConnections`, `ref` / `unref`; `'listening'` / `'connection'` / `'close'` / `'error'`)
|
|
747
|
-
| `connect` / `createConnection` / `Socket` (a duplex stream: `write` / `end` / `'data'` / `'end'`, `setEncoding`, `remoteAddress` / `remotePort` / `localPort`, `setTimeout` + `'timeout'`, `setNoDelay`, `setKeepAlive`, `destroy`, `'close'(hadError)`) |
|
|
748
|
-
| Node's errors (`connect ECONNREFUSED 127.0.0.1:80`, `EADDRINUSE`, `ECONNRESET`; `code` / `errno` / `syscall` / `address` / `port`)
|
|
749
|
-
| `isIP` / `isIPv4` / `isIPv6`
|
|
750
|
-
| `BlockList` (`addAddress` / `addRange` / `addSubnet` / `check` / `rules` / `isBlockList`) / `SocketAddress` (`parse`, `toJSON`)
|
|
751
|
-
| `net.Stream`, `get/setDefaultAutoSelectFamily(AttemptTimeout)`
|
|
752
|
-
| IPC handle passing (`send(msg, socket)`)
|
|
844
|
+
| API | Status | Probe | Notes |
|
|
845
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
|
|
846
|
+
| `createServer` / `Server` (`listen` forms incl. `{ port, host }` and Unix paths, `address()`, `close(cb)`, `getConnections`, `maxConnections`, `ref` / `unref`; `'listening'` / `'connection'` / `'close'` / `'error'`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | A listening server keeps the process alive; `close()` emits `'close'` once its connections end |
|
|
847
|
+
| `connect` / `createConnection` / `Socket` (a duplex stream: `write` / `end` / `'data'` / `'end'`, `setEncoding`, `remoteAddress` / `remotePort` / `localPort`, `setTimeout` + `'timeout'`, `setNoDelay`, `setKeepAlive`, `destroy`, `'close'(hadError)`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | One goroutine reads the `net.Conn`; `allowHalfOpen: false` ends the socket after `'end'`, as in Node |
|
|
848
|
+
| Node's errors (`connect ECONNREFUSED 127.0.0.1:80`, `EADDRINUSE`, `ECONNRESET`; `code` / `errno` / `syscall` / `address` / `port`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | |
|
|
849
|
+
| `isIP` / `isIPv4` / `isIPv6` | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | |
|
|
850
|
+
| `BlockList` (`addAddress` / `addRange` / `addSubnet` / `check` / `rules` / `isBlockList`) / `SocketAddress` (`parse`, `toJSON`) | ✅ | [lib-node-net-blocklist.ts](conformance/lib-node-net-blocklist.ts) | `net/netip`; IPv4-mapped IPv6 addresses match IPv4 rules, as in Node |
|
|
851
|
+
| `net.Stream`, `get/setDefaultAutoSelectFamily(AttemptTimeout)` | ✅ | [lib-node-net-blocklist.ts](conformance/lib-node-net-blocklist.ts) | Go's dialer always races IPv4 / IPv6, so the settings are reported but not used |
|
|
852
|
+
| IPC handle passing (`send(msg, socket)`) | ❌ | — | Needs file-descriptor passing over the IPC channel |
|
|
753
853
|
|
|
754
854
|
#### `node:dns`
|
|
755
855
|
|
|
756
|
-
| API
|
|
757
|
-
|
|
|
758
|
-
| `lookup` (`family`, `all`) and `dns/promises` / `dns.promises` `lookup`
|
|
759
|
-
| `resolve` (rrtype) / `resolve4` / `resolve6` / `resolveCname` / `resolveMx` / `resolveTxt` / `resolveNs` / `resolveSrv` / `reverse` (callback and promise forms), `getServers` |
|
|
760
|
-
| `Resolver` class (callback and `dns/promises` forms: `setServers` / `getServers` / `setLocalAddress` / `cancel`, `timeout` option), module `setServers`, `lookupService`
|
|
761
|
-
| `resolveAny` / `resolveCaa` / `resolveNaptr` / `resolvePtr` / `resolveSoa
|
|
856
|
+
| API | Status | Probe | Notes |
|
|
857
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
858
|
+
| `lookup` (`family`, `all`) and `dns/promises` / `dns.promises` `lookup` | ✅ | [lib-node-dns.ts](conformance/lib-node-dns.ts) | Go's resolver; `getaddrinfo ENOTFOUND host` errors with `hostname` |
|
|
859
|
+
| `resolve` (rrtype) / `resolve4` / `resolve6` / `resolveCname` / `resolveMx` / `resolveTxt` / `resolveNs` / `resolveSrv` / `reverse` (callback and promise forms), `getServers` | ✅ | — | Implemented, not probed (needs a network); `getServers` reads `/etc/resolv.conf` |
|
|
860
|
+
| `Resolver` class (callback and `dns/promises` forms: `setServers` / `getServers` / `setLocalAddress` / `cancel`, `timeout` option), module `setServers`, `lookupService` | ✅ | [lib-node-dns-resolver.ts](conformance/lib-node-dns-resolver.ts) | Go's pure resolver dialing the configured servers in turn; `ETIMEOUT` / `ECANCELLED`; services from `/etc/services` |
|
|
861
|
+
| `resolveAny` / `resolveCaa` / `resolveNaptr` / `resolvePtr` / `resolveSoa` (and `resolve(name, rrtype)` for them), `resolve4` / `resolve6` `{ ttl: true }`, the `tries` option | ✅ | [lib-node-dns-records.ts](conformance/lib-node-dns-records.ts) | Queries built and parsed with `golang.org/x/net/dns/dnsmessage`, copied from GOROOT like `x/text`: UDP with EDNS0, TCP when truncated, each server in turn `tries` times (default 4, 5 s each). Errors are Node's (`queryX ENOTFOUND host`, `ENODATA`, `ESERVFAIL`, `EREFUSED`, `ETIMEOUT`, `ECANCELLED`); `resolveAny` groups records by type in Node's order |
|
|
762
862
|
|
|
763
863
|
#### `node:http` / `node:https`
|
|
764
864
|
|
|
765
|
-
| API
|
|
766
|
-
|
|
|
767
|
-
| `createServer((req, res) => …)` / `'request'`; `IncomingMessage` (a Readable: `method`, `url`, `headers`, `headersDistinct`, `rawHeaders`, `httpVersion`, `socket.remoteAddress`)
|
|
768
|
-
| `ServerResponse` (a Writable: `statusCode`, `setHeader` / `getHeader` / `getHeaders` / `hasHeader` / `removeHeader` / `appendHeader`, `writeHead`, `write`, `end`, `headersSent`, `'finish'`)
|
|
769
|
-
| `request` / `get` (URL strings, `URL` objects, options: `hostname` / `port` / `path` / `method` / `headers` / `auth` / `timeout` / `signal` / `socketPath`); `ClientRequest` (`setHeader`, `write`, `end`, `destroy`, `'response'`, `'error'`, `'timeout'`) |
|
|
770
|
-
| `STATUS_CODES` / `METHODS` / `maxHeaderSize` / `Agent` / `globalAgent`
|
|
771
|
-
| `https.createServer({ key, cert })` / `https.request` / `https.get` (`ca`, `rejectUnauthorized`, `servername`, client `key` / `cert`)
|
|
772
|
-
| `headers` values
|
|
773
|
-
| Server `'upgrade'` / `'connect'` (`req, socket, head`) and client `'upgrade'` / `'connect'` events
|
|
774
|
-
| `
|
|
865
|
+
| API | Status | Probe | Notes |
|
|
866
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
867
|
+
| `createServer((req, res) => …)` / `'request'`; `IncomingMessage` (a Readable: `method`, `url`, `headers`, `headersDistinct`, `rawHeaders`, `httpVersion`, `socket.remoteAddress`) | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | Go's `net/http` serves the connections; bodies stream into the request |
|
|
868
|
+
| `ServerResponse` (a Writable: `statusCode`, `setHeader` / `getHeader` / `getHeaders` / `hasHeader` / `removeHeader` / `appendHeader`, `writeHead`, `write`, `end`, `headersSent`, `'finish'`) | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | `end(data)` without earlier writes sends a `Content-Length`; `write()` streams a chunked body |
|
|
869
|
+
| `request` / `get` (URL strings, `URL` objects, options: `hostname` / `port` / `path` / `method` / `headers` / `auth` / `timeout` / `signal` / `socketPath`); `ClientRequest` (`setHeader`, `write`, `end`, `destroy`, `'response'`, `'error'`, `'timeout'`) | ✅ | [lib-node-http-client.ts](conformance/lib-node-http-client.ts) | No redirects are followed and bodies are not decompressed, as in Node; `destroy()` before a response fails with `socket hang up` |
|
|
870
|
+
| `STATUS_CODES` / `METHODS` / `maxHeaderSize` / `Agent` / `globalAgent` | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | `Agent` options are accepted; Go's transport pools connections |
|
|
871
|
+
| `https.createServer({ key, cert })` / `https.request` / `https.get` (`ca`, `rejectUnauthorized`, `servername`, client `key` / `cert`) | ✅ | [lib-node-https.ts](conformance/lib-node-https.ts) | Certificate checks as in [node:tls](#nodetls) |
|
|
872
|
+
| `headers` values | ✅ | [lib-node-http-client.ts](conformance/lib-node-http-client.ts) | Repeated headers are joined with `, ` (`; ` for `cookie`) — including `set-cookie`, which Node keeps as an array: use `headersDistinct['set-cookie']` |
|
|
873
|
+
| Server `'upgrade'` / `'connect'` (`req, socket, head`) and client `'upgrade'` / `'connect'` events | ✅ | [lib-node-http-upgrade.ts](conformance/lib-node-http-upgrade.ts) | The server hijacks the connection; an upgrade nobody listens for is an ordinary request, an unhandled CONNECT closes the connection, as in Node |
|
|
874
|
+
| `res.addTrailers()` | ✅ | [lib-node-http-trailers.ts](conformance/lib-node-http-trailers.ts) | Sent after a chunked body, as in Node (not with a `Content-Length`); clients read them as `res.trailers` |
|
|
875
|
+
| Trailers on client requests, `Agent` socket pooling control | ❌ | — | Feasible: Go's `Request.Trailer`, `Transport.MaxConnsPerHost` / `MaxIdleConnsPerHost` |
|
|
876
|
+
| `statusMessage` on responses we send, `'checkContinue'` | ❌ | — | Go's `ResponseWriter` sends its standard reason phrases and answers `100-continue` itself: needs a hijacked connection |
|
|
775
877
|
|
|
776
878
|
#### `node:http2`
|
|
777
879
|
|
|
778
|
-
| API
|
|
779
|
-
|
|
|
780
|
-
| `createServer` (cleartext h2c) / `createSecureServer({ key, cert, allowHTTP1 })`; `'stream'` → `ServerHttp2Stream` (`respond`, `write` / `end`, `respondWithFile`, `close`, a Duplex over the request body) with `:method` / `:path` / `:scheme` / `:authority` headers
|
|
781
|
-
| Compatibility API: `(req, res)` handlers get `Http2ServerRequest` / `Http2ServerResponse` (`httpVersion` `'2.0'`, pseudo-headers in `req.headers`)
|
|
782
|
-
| `connect(authority, { ca, rejectUnauthorized, servername })` → `ClientHttp2Session` (`request`, `close`, `destroy`, `'connect'` / `'error'` / `'close'`, `alpnProtocol`, `encrypted`); `ClientHttp2Stream` (`'response'` with `:status`, body as a Readable, request bodies) |
|
|
783
|
-
| `constants`, `getDefaultSettings`
|
|
784
|
-
|
|
|
880
|
+
| API | Status | Probe | Notes |
|
|
881
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
882
|
+
| `createServer` (cleartext h2c) / `createSecureServer({ key, cert, allowHTTP1 })`; `'stream'` → `ServerHttp2Stream` (`respond`, `write` / `end`, `respondWithFile`, `close`, a Duplex over the request body) with `:method` / `:path` / `:scheme` / `:authority` headers | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts), [lib-node-http2-secure.ts](conformance/lib-node-http2-secure.ts) | On `net/http`'s HTTP/2 (`http.Protocols`) |
|
|
883
|
+
| Compatibility API: `(req, res)` handlers get `Http2ServerRequest` / `Http2ServerResponse` (`httpVersion` `'2.0'`, pseudo-headers in `req.headers`) | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts) | The node:http objects |
|
|
884
|
+
| `connect(authority, { ca, rejectUnauthorized, servername })` → `ClientHttp2Session` (`request`, `close`, `destroy`, `'connect'` / `'error'` / `'close'`, `alpnProtocol`, `encrypted`); `ClientHttp2Stream` (`'response'` with `:status`, body as a Readable, request bodies) | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts), [lib-node-http2-secure.ts](conformance/lib-node-http2-secure.ts) | Connection failures error the session and cancel its streams (`ERR_HTTP2_STREAM_CANCEL`); request bodies are sent once the writable side ends |
|
|
885
|
+
| `constants`, `getDefaultSettings` | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts) | |
|
|
886
|
+
| `ping`, `settings` / `goaway` / `altsvc`, `'session'` events, `getPackedSettings`, upgrades from HTTP/1 | ❌ | — | Go's bundled HTTP/2 hides frames: needs a vendored `golang.org/x/net/http2` |
|
|
887
|
+
| Server push | 🚫 | — | Deprecated (browsers removed it); Go's server doesn't push |
|
|
785
888
|
|
|
786
889
|
#### `node:tls`
|
|
787
890
|
|
|
788
|
-
| API
|
|
789
|
-
|
|
|
790
|
-
| `createServer({ key, cert, ca, requestCert, ALPNProtocols, minVersion, maxVersion }, cb)` / `'secureConnection'`
|
|
791
|
-
| `connect` (`host`, `port`, `ca`, `servername`, `rejectUnauthorized`, client `key` / `cert`) / `'secureConnect'`; `TLSSocket` (`authorized`, `authorizationError`, `encrypted`, `alpnProtocol`, `getPeerCertificate`, `getProtocol`, `getCipher`) |
|
|
792
|
-
| `createSecureContext` / `getCiphers` / `DEFAULT_MIN_VERSION` / `DEFAULT_MAX_VERSION`
|
|
793
|
-
| `checkServerIdentity` (function and `connect` option)
|
|
794
|
-
| PFX / passphrase-protected keys, session resumption, `renegotiate`, `rootCertificates`
|
|
891
|
+
| API | Status | Probe | Notes |
|
|
892
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
893
|
+
| `createServer({ key, cert, ca, requestCert, ALPNProtocols, minVersion, maxVersion }, cb)` / `'secureConnection'` | ✅ | [lib-node-tls.ts](conformance/lib-node-tls.ts) | Handshakes run on the accept goroutine |
|
|
894
|
+
| `connect` (`host`, `port`, `ca`, `servername`, `rejectUnauthorized`, client `key` / `cert`) / `'secureConnect'`; `TLSSocket` (`authorized`, `authorizationError`, `encrypted`, `alpnProtocol`, `getPeerCertificate`, `getProtocol`, `getCipher`) | ✅ | [lib-node-tls.ts](conformance/lib-node-tls.ts) | Node's verification codes: `DEPTH_ZERO_SELF_SIGNED_CERT`, `SELF_SIGNED_CERT_IN_CHAIN`, `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`, `CERT_HAS_EXPIRED`, `ERR_TLS_CERT_ALTNAME_INVALID` |
|
|
895
|
+
| `createSecureContext` / `getCiphers` / `DEFAULT_MIN_VERSION` / `DEFAULT_MAX_VERSION` | ✅ | — | Implemented, not probed; cipher names are Go's |
|
|
896
|
+
| `checkServerIdentity` (function and `connect` option) | ✅ | [lib-node-tls-identity.ts](conformance/lib-node-tls-identity.ts) | Node's rules: one leftmost wildcard label, IP altnames, CN only without DNS altnames |
|
|
897
|
+
| PFX / passphrase-protected keys, session resumption, `renegotiate`, `rootCertificates` | ❌ | — | Not implemented yet: PFX needs a PKCS#12 decoder; `rootCertificates` can embed Mozilla's bundle (as Node does); Go has session tickets (`ClientSessionCache`) and client-side renegotiation |
|
|
795
898
|
|
|
796
899
|
#### `node:dgram`
|
|
797
900
|
|
|
798
|
-
| API
|
|
799
|
-
|
|
|
800
|
-
| `createSocket('udp4' \| 'udp6' \| { type })`, `bind`, `send` (offset / length forms, callback), `'message'(msg, rinfo)`, `address`, `close`, `connect` / `disconnect` / `remoteAddress`, `ref` / `unref` |
|
|
801
|
-
|
|
|
901
|
+
| API | Status | Probe | Notes |
|
|
902
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
903
|
+
| `createSocket('udp4' \| 'udp6' \| { type })`, `bind`, `send` (offset / length forms, callback), `'message'(msg, rinfo)`, `address`, `close`, `connect` / `disconnect` / `remoteAddress`, `ref` / `unref` | ✅ | [lib-node-dgram.ts](conformance/lib-node-dgram.ts) | `send` binds an unbound socket first, as in Node |
|
|
904
|
+
| `addMembership` / `dropMembership`, `setMulticastInterface` / `setMulticastTTL` / `setMulticastLoopback`, `setBroadcast`, `setTTL` | ✅ | [lib-node-dgram-multicast.ts](conformance/lib-node-dgram-multicast.ts) | `setsockopt` on the socket per OS (Linux, macOS, the BSDs, Windows). Options before `bind()` throw `EBADF` and membership binds an unbound socket, as in Node |
|
|
905
|
+
| `addSourceSpecificMembership` / `dropSourceSpecificMembership` | ❌ | — | Feasible: `IP_ADD_SOURCE_MEMBERSHIP`, whose struct layout differs per OS |
|
|
802
906
|
|
|
803
907
|
#### `fetch`
|
|
804
908
|
|
|
805
|
-
| API
|
|
806
|
-
|
|
|
807
|
-
| `fetch(url \| Request, { method, headers, body, redirect, signal })`; `Response` (`status`, `ok`, `statusText`, `headers`, `url`, `redirected`, `text()` / `json()` / `bytes()` / `arrayBuffer()`, `clone()`, `Response.json` / `error` / `redirect`) |
|
|
808
|
-
| `Headers` (`get` / `set` / `append` / `has` / `delete` / `forEach` / `entries` / `getSetCookie`, `for...of`) / `Request`
|
|
809
|
-
| Streaming bodies: `response.body` / `request.body` as `ReadableStream`s, `ReadableStream` request bodies (`duplex: 'half'`), `clone()` tees the body
|
|
810
|
-
| `Blob` / `FormData` bodies (multipart encoding), `blob()` / `formData()` (multipart and urlencoded)
|
|
811
|
-
| The Fetch standard's bad-port list (also on redirects)
|
|
909
|
+
| API | Status | Probe | Notes |
|
|
910
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
911
|
+
| `fetch(url \| Request, { method, headers, body, redirect, signal })`; `Response` (`status`, `ok`, `statusText`, `headers`, `url`, `redirected`, `text()` / `json()` / `bytes()` / `arrayBuffer()`, `clone()`, `Response.json` / `error` / `redirect`) | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | Follows redirects (`manual` / `error` too); gzip bodies are decompressed; failures reject with `TypeError('fetch failed')` whose `cause` is the system error; aborts reject with `AbortError` |
|
|
912
|
+
| `Headers` (`get` / `set` / `append` / `has` / `delete` / `forEach` / `entries` / `getSetCookie`, `for...of`) / `Request` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | Names are lower-cased and iterated in sorted order |
|
|
913
|
+
| Streaming bodies: `response.body` / `request.body` as `ReadableStream`s, `ReadableStream` request bodies (`duplex: 'half'`), `clone()` tees the body | ✅ | [lib-node-fetch-stream.ts](conformance/lib-node-fetch-stream.ts) | Network bodies are read a chunk per pull |
|
|
914
|
+
| `Blob` / `FormData` bodies (multipart encoding), `blob()` / `formData()` (multipart and urlencoded) | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts), [lib-node-fetch-stream.ts](conformance/lib-node-fetch-stream.ts) | |
|
|
915
|
+
| The Fetch standard's bad-port list (also on redirects) | ✅ | [lib-node-fetch-bad-port.ts](conformance/lib-node-fetch-bad-port.ts) | `TypeError: fetch failed` with cause `bad port` |
|
|
812
916
|
|
|
813
917
|
#### `node:async_hooks`
|
|
814
918
|
|
|
815
|
-
| API
|
|
816
|
-
|
|
|
817
|
-
| `AsyncLocalStorage` (`run`, `getStore`, `enterWith`, `exit`, `disable`, static `bind` / `snapshot`)
|
|
818
|
-
| `AsyncResource` (`runInAsyncScope`, `bind`, `asyncId`, static `bind`)
|
|
819
|
-
| `createHook` callbacks (`init` / `before` / `after` / `destroy`), real `executionAsyncId` / `triggerAsyncId` | ❌
|
|
919
|
+
| API | Status | Probe | Notes |
|
|
920
|
+
| ------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
921
|
+
| `AsyncLocalStorage` (`run`, `getStore`, `enterWith`, `exit`, `disable`, static `bind` / `snapshot`) | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | The store follows timers, `setImmediate`, `nextTick`, microtasks, promise callbacks, `await`, async function bodies, fs / dns callbacks; streams, sockets and servers emit in the context they were created / listened in |
|
|
922
|
+
| `AsyncResource` (`runInAsyncScope`, `bind`, `asyncId`, static `bind`) | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | Captures the context it is created in |
|
|
923
|
+
| `createHook` callbacks (`init` / `before` / `after` / `destroy`), real `executionAsyncId` / `triggerAsyncId` | ❌ | — | `createHook` is accepted but never calls back; ids are always `1` / `0`. Feasible: the event loop's `TnAsyncSnapshot` / `TnAsyncRun` are where the callbacks would fire |
|
|
820
924
|
|
|
821
925
|
#### `node:test`
|
|
822
926
|
|
|
823
|
-
| API
|
|
824
|
-
|
|
|
825
|
-
| `test` / `it` / `describe` / `suite` (+ `.skip` / `.todo` / `.only`; `skip` / `todo` / `timeout` options); sync, async and `done`-callback tests
|
|
826
|
-
| `before` / `after` / `beforeEach` / `afterEach` (file and suite level, `t.before` & co.)
|
|
827
|
-
| `TestContext`: `t.test` subtests, `t.skip`, `t.todo`, `t.diagnostic`, `t.plan`, `t.name`, `t.fullName`, `t.signal`, `t.mock`
|
|
828
|
-
| Reporting: TAP (Node's default when stdout is not a terminal) / spec (on a terminal); `tests` / `suites` / `pass` / `fail` / `cancelled` / `skipped` / `todo` counters; exit code 1 on failure
|
|
829
|
-
| `mock.fn(original?, implementation?)`; `fn.mock.calls` / `callCount()` / `mockImplementation(Once)` / `resetCalls()` / `restore()`
|
|
830
|
-
| `t.assert` (`node:assert`'s functions, counted by `t.plan`) and `mock.timers` (`enable({ apis, now })`, `tick`, `runAll`, `setTime`, `reset`; `setTimeout` / `setInterval` / `setImmediate` / `Date`)
|
|
831
|
-
| `mock.method` / `mock.getter` / `mock.setter`
|
|
832
|
-
|
|
|
927
|
+
| API | Status | Probe | Notes |
|
|
928
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
929
|
+
| `test` / `it` / `describe` / `suite` (+ `.skip` / `.todo` / `.only`; `skip` / `todo` / `timeout` options); sync, async and `done`-callback tests | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Tests run one after another once the main module has finished, as in Node |
|
|
930
|
+
| `before` / `after` / `beforeEach` / `afterEach` (file and suite level, `t.before` & co.) | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Node's order: outer `beforeEach` first, inner `afterEach` first |
|
|
931
|
+
| `TestContext`: `t.test` subtests, `t.skip`, `t.todo`, `t.diagnostic`, `t.plan`, `t.name`, `t.fullName`, `t.signal`, `t.mock` | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | |
|
|
932
|
+
| Reporting: TAP (Node's default when stdout is not a terminal) / spec (on a terminal); `tests` / `suites` / `pass` / `fail` / `cancelled` / `skipped` / `todo` counters; exit code 1 on failure | ✅ | [lib-node-test-fail.ts](conformance/lib-node-test-fail.ts) | Same layout as Node, without `location` / `stack` yet (the `//line` directives make them recoverable through `runtime.Callers`); timeouts count as cancelled |
|
|
933
|
+
| `mock.fn(original?, implementation?)`; `fn.mock.calls` / `callCount()` / `mockImplementation(Once)` / `resetCalls()` / `restore()` | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | The mock has the original's Go function type |
|
|
934
|
+
| `t.assert` (`node:assert`'s functions, counted by `t.plan`) and `mock.timers` (`enable({ apis, now })`, `tick`, `runAll`, `setTime`, `reset`; `setTimeout` / `setInterval` / `setImmediate` / `Date`) | ✅ | [lib-node-test-mock-timers.ts](conformance/lib-node-test-mock-timers.ts) | Mocked timers do not keep the process alive; `t.mock` timers reset after each test |
|
|
935
|
+
| `mock.method` / `mock.getter` / `mock.setter` | ❌ | — | Object-literal methods are function fields and can be swapped; class methods need calls routed through a replaceable table |
|
|
936
|
+
| `NODE_OPTIONS` flags: `--test-name-pattern` / `--test-skip-pattern` (repeatable, `/re/flags`), `--test-only`, `--test-reporter=tap\|spec\|dot\|junit`; Node's notice for `.only` without `--test-only` | ✅ | [lib-node-test-flags.ts](conformance/lib-node-test-flags.ts) | Read from `NODE_OPTIONS`, as Node reads them (arguments after a program never reach Node's runner either). Filtered-out tests are not reported; a matching suite runs all its tests. The TAP / spec / dot outputs match Node's; junit's failure bodies have no stack traces |
|
|
937
|
+
| Snapshots, `run()`, `--test-reporter-destination` | ❌ | — | Snapshots need `--test-update-snapshots` files next to the program; `run()` needs extra entry points |
|
|
938
|
+
| Coverage | ❌ | — | Would need Go's `-cover` instrumentation mapped back through the `//line` directives |
|
|
833
939
|
|
|
834
940
|
#### `node:worker_threads`
|
|
835
941
|
|
|
836
|
-
| API
|
|
837
|
-
|
|
|
838
|
-
| `Worker` (`workerData`, `argv`, `env` / `SHARE_ENV`; `postMessage`, `'online'` / `'message'` / `'error'` / `'exit'`, `terminate()`, `threadId`, `ref` / `unref`); `isMainThread`, `parentPort`, `workerData`, `threadId` |
|
|
839
|
-
| Messages: structured clone of JSON-like values, Buffers (arriving as `Uint8Array`s), `Map`, `Set`, `Date`, `bigint`, errors
|
|
840
|
-
| Uncaught exceptions in a worker / `terminate()`
|
|
841
|
-
| `MessageChannel` / `MessagePort` (`postMessage`, `on('message')`, `onmessage`, `start`, `close`, `ref` / `unref`), `receiveMessageOnPort`, `BroadcastChannel`, `get/setEnvironmentData`
|
|
842
|
-
|
|
|
942
|
+
| API | Status | Probe | Notes |
|
|
943
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
944
|
+
| `Worker` (`workerData`, `argv`, `env` / `SHARE_ENV`; `postMessage`, `'online'` / `'message'` / `'error'` / `'exit'`, `terminate()`, `threadId`, `ref` / `unref`); `isMainThread`, `parentPort`, `workerData`, `threadId` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | A worker re-runs the current program as a child process (an isolate of its own, as in Node) linked over loopback TCP; branch on `isMainThread` |
|
|
945
|
+
| Messages: structured clone of JSON-like values, Buffers (arriving as `Uint8Array`s), `Map`, `Set`, `Date`, `bigint`, errors | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | Objects and records keep their key order, and convert to the listener's declared types; functions throw `DataCloneError` |
|
|
946
|
+
| Uncaught exceptions in a worker / `terminate()` | ✅ | [lib-node-worker-errors.ts](conformance/lib-node-worker-errors.ts) | `'error'` with the message, then exit code `1` |
|
|
947
|
+
| `MessageChannel` / `MessagePort` (`postMessage`, `on('message')`, `onmessage`, `start`, `close`, `ref` / `unref`), `receiveMessageOnPort`, `BroadcastChannel`, `get/setEnvironmentData` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | Channels and broadcast channels work within one process (ports can't be transferred to workers) |
|
|
948
|
+
| `new Worker('./worker.ts')` (another file) | ✅ | [lib-node-worker-entry.ts](conformance/lib-node-worker-entry.ts) | The file (a literal path, `new URL('./f.ts', import.meta.url)` or `path.join(__dirname, 'f.ts')`, resolved from the source file at compile time) is compiled into the binary as a second entry point; the child runs it instead of the program, picked by `TN_ENTRY`. Its top-level names share one Go package with the program, so they must not clash; files the program imports still run their top-level code in every process |
|
|
949
|
+
| Transferring ports, `resourceLimits`, worker `stdout: true` streams | ❌ | — | Ports can be relayed through the parent; `resourceLimits` maps to `debug.SetMemoryLimit` |
|
|
950
|
+
| `eval: true`, `SharedArrayBuffer` / `Atomics` | 🚫 | — | `eval` needs a JavaScript engine; workers are processes, so memory is not shared |
|
|
843
951
|
|
|
844
952
|
#### `node:sqlite`
|
|
845
953
|
|
|
@@ -849,291 +957,324 @@ ships the driver in [govendor/](govendor/) (`npm run vendor:go` updates it), so
|
|
|
849
957
|
network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as Row` and
|
|
850
958
|
`rows as Row[]` all work.
|
|
851
959
|
|
|
852
|
-
| API
|
|
853
|
-
|
|
|
854
|
-
| `new DatabaseSync(path, options)` (`:memory:`, files, `file:` URIs), `open` / `close` / `isOpen` / `isTransaction` / `location()`, `exec`
|
|
855
|
-
| `prepare(sql, options)`; `StatementSync#run` (`{ changes, lastInsertRowid }`) / `get` / `all` / `iterate` (`for…of`, `next()`)
|
|
856
|
-
| Parameters: anonymous `?`, named `:x` / `$x` / `@x`, bare names (`{ x }`); values `null`, number (REAL), bigint (INTEGER), string, boolean (1 / 0), `Uint8Array` / Buffer
|
|
857
|
-
| Options `readOnly`, `enableForeignKeyConstraints` (on by default), `enableDoubleQuotedStringLiterals`, `timeout`, `readBigInts`, `returnArrays`, `allowBareNamedParameters`, `allowUnknownNamedParameters`, `defensive`, `limits` |
|
|
858
|
-
| `columns()`, `sourceSQL`, `expandedSQL`, `setReadBigInts` / `setReturnArrays` / `setAllowBareNamedParameters` / `setAllowUnknownNamedParameters`, `enableDefensive`
|
|
859
|
-
| `createTagStore()` (`` sql.get`… ${x}` `` / `all` / `run` / `iterate`, `size`, `capacity`, `clear`)
|
|
860
|
-
| `function(name, options, fn)` (`deterministic`, `directOnly`, `varargs`, `useBigIntArguments`), `aggregate(name, { start, step, result, inverse })` (window functions)
|
|
861
|
-
| `setAuthorizer(callback)`, `constants` (`SQLITE_OK` / `DENY` / `IGNORE`, action codes, `SQLITE_CHANGESET_*`)
|
|
862
|
-
| Errors: SQLite's message with `code: 'ERR_SQLITE_ERROR'`, `errcode` (extended result code), `errstr`; `ERR_INVALID_STATE` / `ERR_OUT_OF_RANGE` / `ERR_INVALID_ARG_VALUE`
|
|
863
|
-
| `backup(db, path, { source, rate, progress })`
|
|
864
|
-
| `loadExtension` / `enableLoadExtension`
|
|
865
|
-
| `createSession` / `applyChangeset`
|
|
866
|
-
| `serialize` / `deserialize
|
|
867
|
-
| `undefined` as a parameter value, `[Object: null prototype]` rows
|
|
868
|
-
| Finalizing a statement when it is garbage-collected
|
|
960
|
+
| API | Status | Probe | Notes |
|
|
961
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
962
|
+
| `new DatabaseSync(path, options)` (`:memory:`, files, `file:` URIs), `open` / `close` / `isOpen` / `isTransaction` / `location()`, `exec` | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | `open: false` defers to `open()` |
|
|
963
|
+
| `prepare(sql, options)`; `StatementSync#run` (`{ changes, lastInsertRowid }`) / `get` / `all` / `iterate` (`for…of`, `next()`) | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | Rows are objects keyed by column name; `get()` without a row is `undefined` |
|
|
964
|
+
| Parameters: anonymous `?`, named `:x` / `$x` / `@x`, bare names (`{ x }`); values `null`, number (REAL), bigint (INTEGER), string, boolean (1 / 0), `Uint8Array` / Buffer | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | Results: INTEGER → number (bigint with `readBigInts`), REAL → number, TEXT → string, BLOB → `Uint8Array`, NULL → `null` |
|
|
965
|
+
| Options `readOnly`, `enableForeignKeyConstraints` (on by default), `enableDoubleQuotedStringLiterals`, `timeout`, `readBigInts`, `returnArrays`, `allowBareNamedParameters`, `allowUnknownNamedParameters`, `defensive`, `limits` | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | `db.limits.x = n` sets a limit; `Infinity` restores the maximum |
|
|
966
|
+
| `columns()`, `sourceSQL`, `expandedSQL`, `setReadBigInts` / `setReturnArrays` / `setAllowBareNamedParameters` / `setAllowUnknownNamedParameters`, `enableDefensive` | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | |
|
|
967
|
+
| `createTagStore()` (`` sql.get`… ${x}` `` / `all` / `run` / `iterate`, `size`, `capacity`, `clear`) | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | One cached statement per template, least recently used out first |
|
|
968
|
+
| `function(name, options, fn)` (`deterministic`, `directOnly`, `varargs`, `useBigIntArguments`), `aggregate(name, { start, step, result, inverse })` (window functions) | ✅ | [lib-node-sqlite-functions.ts](conformance/lib-node-sqlite-functions.ts) | A throw inside the callback is rethrown by the statement |
|
|
969
|
+
| `setAuthorizer(callback)`, `constants` (`SQLITE_OK` / `DENY` / `IGNORE`, action codes, `SQLITE_CHANGESET_*`) | ✅ | [lib-node-sqlite-functions.ts](conformance/lib-node-sqlite-functions.ts) | |
|
|
970
|
+
| Errors: SQLite's message with `code: 'ERR_SQLITE_ERROR'`, `errcode` (extended result code), `errstr`; `ERR_INVALID_STATE` / `ERR_OUT_OF_RANGE` / `ERR_INVALID_ARG_VALUE` | ✅ | [lib-node-sqlite-errors.ts](conformance/lib-node-sqlite-errors.ts) | Same messages as Node 24 |
|
|
971
|
+
| `backup(db, path, { source, rate, progress })` | ✅ | [lib-node-sqlite-errors.ts](conformance/lib-node-sqlite-errors.ts) | Copies `rate` pages per event-loop turn; resolves with the page count |
|
|
972
|
+
| `loadExtension` / `enableLoadExtension` | 🚫 | — | SQLite runs as Wasm inside the program; native extensions can't load |
|
|
973
|
+
| `createSession` / `applyChangeset` | ❌ | — | The bundled SQLite build has no session extension: needs an emulation over the preupdate hook (hard) |
|
|
974
|
+
| `serialize(dbName?)` / `deserialize(buffer, { dbName })` | ✅ | [lib-node-sqlite-serialize.ts](conformance/lib-node-sqlite-serialize.ts) | Newer Node API (not in Node 22). The driver has no `sqlite3_serialize` binding, so the image goes through a temporary file and SQLite's backup API |
|
|
975
|
+
| `undefined` as a parameter value, `[Object: null prototype]` rows | 🚫 | — | `undefined` and `null` are both `nil` (binds NULL instead of throwing); rows print as plain objects |
|
|
976
|
+
| Finalizing a statement when it is garbage-collected | ✅ | [lib-node-sqlite-finalize.ts](conformance/lib-node-sqlite-finalize.ts) | `runtime.AddCleanup` posts the finalize to the event loop once nothing references the statement; `db.close()` finalizes the rest |
|
|
869
977
|
|
|
870
978
|
#### `node:inspector`
|
|
871
979
|
|
|
872
|
-
| API
|
|
873
|
-
|
|
|
874
|
-
| Debugger / profiler sessions (`Session`, `open`, `url`) |
|
|
980
|
+
| API | Status | Probe | Notes |
|
|
981
|
+
| ------------------------------------------------------- | :----: | ----- | ------------------------------------------------------------------------------ |
|
|
982
|
+
| Debugger / profiler sessions (`Session`, `open`, `url`) | 🚫 | — | Speaks the inspector protocol of a JavaScript engine; a native binary has none |
|
|
875
983
|
|
|
876
984
|
#### `node:repl`
|
|
877
985
|
|
|
878
|
-
| API
|
|
879
|
-
|
|
|
880
|
-
| `start` / `REPLServer` |
|
|
986
|
+
| API | Status | Probe | Notes |
|
|
987
|
+
| ---------------------- | :----: | ----- | ---------------------------------------------------------- |
|
|
988
|
+
| `start` / `REPLServer` | 🚫 | — | Evaluates JavaScript at runtime; needs a JavaScript engine |
|
|
881
989
|
|
|
882
990
|
#### `node:vm`
|
|
883
991
|
|
|
884
|
-
| API
|
|
885
|
-
|
|
|
886
|
-
| `Script` / `runInContext` / `createContext` / `compileFunction` & co. |
|
|
992
|
+
| API | Status | Probe | Notes |
|
|
993
|
+
| --------------------------------------------------------------------- | :----: | ----- | ----------------------------------------------------------------------- |
|
|
994
|
+
| `Script` / `runInContext` / `createContext` / `compileFunction` & co. | 🚫 | — | Compiles and runs JavaScript code at runtime; needs a JavaScript engine |
|
|
887
995
|
|
|
888
996
|
#### `node:v8`
|
|
889
997
|
|
|
890
|
-
| API
|
|
891
|
-
|
|
|
892
|
-
|
|
|
998
|
+
| API | Status | Probe | Notes |
|
|
999
|
+
| ------------------------------------------------------- | :----: | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1000
|
+
| `getHeapStatistics`, `serialize` / `deserialize` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Heap numbers from `runtime.MemStats` (the limit is `GOMEMLIMIT`, else 4 GiB); `serialize` uses the structured-clone codec workers use, not V8's wire format; objects keep their key order |
|
|
1001
|
+
| `getHeapSpaceStatistics`, `getHeapCodeStatistics` | ❌ | — | Feasible as approximations; Go's heap has no V8 spaces |
|
|
1002
|
+
| Heap snapshots, `setFlagsFromString`, `startupSnapshot` | 🚫 | — | V8 internals; there is no V8 in a native binary |
|
|
893
1003
|
|
|
894
1004
|
#### `node:wasi`
|
|
895
1005
|
|
|
896
|
-
| API
|
|
897
|
-
|
|
|
898
|
-
| `WASI` |
|
|
1006
|
+
| API | Status | Probe | Notes |
|
|
1007
|
+
| ------ | :----: | ----- | -------------------------------------------------------------------------- |
|
|
1008
|
+
| `WASI` | ❌ | — | Needs a Wasm runtime: vendoring wazero (pure Go, no cgo) would provide one |
|
|
899
1009
|
|
|
900
1010
|
#### `node:sea`
|
|
901
1011
|
|
|
902
|
-
| API
|
|
903
|
-
|
|
|
904
|
-
| `isSea` /
|
|
1012
|
+
| API | Status | Probe | Notes |
|
|
1013
|
+
| -------------------------------------- | :----: | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1014
|
+
| `isSea` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Always `true`: every TypeNative binary is a single executable |
|
|
1015
|
+
| `getAsset` / `getRawAsset` with assets | ❌ | — | No SEA config is read, so no asset is added and these throw `ERR_SINGLE_EXECUTABLE_APPLICATION_ASSET_NOT_FOUND`; embed files with `go:embed` instead ([lib-go-embed.ts](conformance/lib-go-embed.ts)) |
|
|
905
1016
|
|
|
906
1017
|
#### `node:trace_events`
|
|
907
1018
|
|
|
908
|
-
| API
|
|
909
|
-
|
|
|
910
|
-
| `createTracing` / `getEnabledCategories` |
|
|
1019
|
+
| API | Status | Probe | Notes |
|
|
1020
|
+
| ---------------------------------------- | :----: | ----- | ------------------------------------------------ |
|
|
1021
|
+
| `createTracing` / `getEnabledCategories` | 🚫 | — | V8 / Node trace categories; no native equivalent |
|
|
911
1022
|
|
|
912
1023
|
#### `node:module`
|
|
913
1024
|
|
|
914
|
-
| API
|
|
915
|
-
|
|
|
916
|
-
| `
|
|
1025
|
+
| API | Status | Probe | Notes |
|
|
1026
|
+
| ----------------------------------------------------------------------------- | :----: | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
1027
|
+
| `builtinModules` / `isBuiltin` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Node 22's list; `node:test`, `node:sqlite` and `node:sea` need the scheme, as in Node |
|
|
1028
|
+
| `createRequire(import.meta.url)` and `require('./data.json')` | ✅ | [lib-json-modules.ts](conformance/lib-json-modules.ts) | JSON files only, read at compile time; `require` of a module reports an error (use `import`) |
|
|
1029
|
+
| `findPackageJSON`, `require` of modules | ❌ | — | Feasible: a literal module specifier resolved at compile time like an import |
|
|
1030
|
+
| `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time |
|
|
917
1031
|
|
|
918
1032
|
#### `node:test/reporters`
|
|
919
1033
|
|
|
920
|
-
| API
|
|
921
|
-
|
|
|
922
|
-
| `tap` / `spec` / `dot` / `junit`
|
|
1034
|
+
| API | Status | Probe | Notes |
|
|
1035
|
+
| ------------------------------------------- | :----: | ----- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
1036
|
+
| `tap` / `spec` / `dot` / `junit` as exports | ❌ | — | The four reporters exist (`--test-reporter` in [test](#nodetest)); exporting them as stream transforms only matters with `run()` |
|
|
1037
|
+
| `lcov` | ❌ | — | Needs coverage (see [test](#nodetest)) |
|
|
923
1038
|
|
|
924
1039
|
#### `node:domain`
|
|
925
1040
|
|
|
926
|
-
| API
|
|
927
|
-
|
|
|
928
|
-
| `create` / `Domain` |
|
|
1041
|
+
| API | Status | Probe | Notes |
|
|
1042
|
+
| ------------------- | :----: | ----- | ------------------- |
|
|
1043
|
+
| `create` / `Domain` | 🚫 | — | Deprecated upstream |
|
|
929
1044
|
|
|
930
1045
|
### Go bridges (`go:*`)
|
|
931
1046
|
|
|
932
|
-
Status: ✅ probed,
|
|
1047
|
+
Status: ✅ probed, 🚫 can't work in a TypeNative program (see [Known limitations](#known-limitations-)).
|
|
933
1048
|
|
|
934
1049
|
<!-- go-bridges:start -->
|
|
935
|
-
|
|
936
|
-
|
|
|
937
|
-
|
|
|
938
|
-
| `go:archive/
|
|
939
|
-
| `go:
|
|
940
|
-
| `go:
|
|
941
|
-
| `go:
|
|
942
|
-
| `go:
|
|
943
|
-
| `go:compress/
|
|
944
|
-
| `go:compress/
|
|
945
|
-
| `go:compress/
|
|
946
|
-
| `go:compress/
|
|
947
|
-
| `go:
|
|
948
|
-
| `go:container/
|
|
949
|
-
| `go:container/
|
|
950
|
-
| `go:
|
|
951
|
-
| `go:
|
|
952
|
-
| `go:crypto
|
|
953
|
-
| `go:crypto/
|
|
954
|
-
| `go:crypto/
|
|
955
|
-
| `go:crypto/
|
|
956
|
-
| `go:crypto/
|
|
957
|
-
| `go:crypto/
|
|
958
|
-
| `go:crypto/
|
|
959
|
-
| `go:crypto/
|
|
960
|
-
| `go:crypto/
|
|
961
|
-
| `go:crypto/
|
|
962
|
-
| `go:crypto/
|
|
963
|
-
| `go:crypto/
|
|
964
|
-
| `go:crypto/
|
|
965
|
-
| `go:crypto/
|
|
966
|
-
| `go:crypto/mlkem
|
|
967
|
-
| `go:crypto/
|
|
968
|
-
| `go:crypto/
|
|
969
|
-
| `go:crypto/
|
|
970
|
-
| `go:crypto/
|
|
971
|
-
| `go:crypto/
|
|
972
|
-
| `go:crypto/
|
|
973
|
-
| `go:crypto/
|
|
974
|
-
| `go:crypto/
|
|
975
|
-
| `go:crypto/
|
|
976
|
-
| `go:crypto/
|
|
977
|
-
| `go:crypto/
|
|
978
|
-
| `go:crypto/x509
|
|
979
|
-
| `go:
|
|
980
|
-
| `go:database/sql
|
|
981
|
-
| `go:
|
|
982
|
-
| `go:debug/
|
|
983
|
-
| `go:debug/
|
|
984
|
-
| `go:debug/
|
|
985
|
-
| `go:debug/
|
|
986
|
-
| `go:debug/
|
|
987
|
-
| `go:debug/
|
|
988
|
-
| `go:
|
|
989
|
-
| `go:
|
|
990
|
-
| `go:encoding
|
|
991
|
-
| `go:encoding/
|
|
992
|
-
| `go:encoding/
|
|
993
|
-
| `go:encoding/
|
|
994
|
-
| `go:encoding/
|
|
995
|
-
| `go:encoding/
|
|
996
|
-
| `go:encoding/
|
|
997
|
-
| `go:encoding/
|
|
998
|
-
| `go:encoding/
|
|
999
|
-
| `go:encoding/
|
|
1000
|
-
| `go:
|
|
1001
|
-
| `go:
|
|
1002
|
-
| `go:
|
|
1003
|
-
| `go:
|
|
1004
|
-
| `go:
|
|
1005
|
-
| `go:
|
|
1006
|
-
| `go:go/
|
|
1007
|
-
| `go:go/
|
|
1008
|
-
| `go:go/
|
|
1009
|
-
| `go:go/
|
|
1010
|
-
| `go:go/
|
|
1011
|
-
| `go:go/
|
|
1012
|
-
| `go:go/
|
|
1013
|
-
| `go:go/
|
|
1014
|
-
| `go:go/
|
|
1015
|
-
| `go:go/
|
|
1016
|
-
| `go:go/
|
|
1017
|
-
| `go:go/
|
|
1018
|
-
| `go:
|
|
1019
|
-
| `go:
|
|
1020
|
-
| `go:hash
|
|
1021
|
-
| `go:hash/
|
|
1022
|
-
| `go:hash/
|
|
1023
|
-
| `go:hash/
|
|
1024
|
-
| `go:
|
|
1025
|
-
| `go:
|
|
1026
|
-
| `go:
|
|
1027
|
-
| `go:
|
|
1028
|
-
| `go:image
|
|
1029
|
-
| `go:image/
|
|
1030
|
-
| `go:image/
|
|
1031
|
-
| `go:image/
|
|
1032
|
-
| `go:image/
|
|
1033
|
-
| `go:
|
|
1034
|
-
| `go:
|
|
1035
|
-
| `go:
|
|
1036
|
-
| `go:io
|
|
1037
|
-
| `go:
|
|
1038
|
-
| `go:
|
|
1039
|
-
| `go:
|
|
1040
|
-
| `go:log
|
|
1041
|
-
| `go:
|
|
1042
|
-
| `go:
|
|
1043
|
-
| `go:
|
|
1044
|
-
| `go:math
|
|
1045
|
-
| `go:math/
|
|
1046
|
-
| `go:math/
|
|
1047
|
-
| `go:math/
|
|
1048
|
-
| `go:
|
|
1049
|
-
| `go:
|
|
1050
|
-
| `go:mime
|
|
1051
|
-
| `go:
|
|
1052
|
-
| `go:
|
|
1053
|
-
| `go:net
|
|
1054
|
-
| `go:net/http
|
|
1055
|
-
| `go:net/http/
|
|
1056
|
-
| `go:net/http/
|
|
1057
|
-
| `go:net/http/
|
|
1058
|
-
| `go:net/http/
|
|
1059
|
-
| `go:net/http/
|
|
1060
|
-
| `go:net/
|
|
1061
|
-
| `go:net/
|
|
1062
|
-
| `go:net/
|
|
1063
|
-
| `go:net/
|
|
1064
|
-
| `go:net/
|
|
1065
|
-
| `go:net/
|
|
1066
|
-
| `go:net/
|
|
1067
|
-
| `go:
|
|
1068
|
-
| `go:
|
|
1069
|
-
| `go:os
|
|
1070
|
-
| `go:os/
|
|
1071
|
-
| `go:
|
|
1072
|
-
| `go:
|
|
1073
|
-
| `go:
|
|
1074
|
-
| `go:
|
|
1075
|
-
| `go:
|
|
1076
|
-
| `go:
|
|
1077
|
-
| `go:
|
|
1078
|
-
| `go:runtime
|
|
1079
|
-
| `go:runtime/
|
|
1080
|
-
| `go:runtime/
|
|
1081
|
-
| `go:
|
|
1082
|
-
| `go:
|
|
1083
|
-
| `go:
|
|
1084
|
-
| `go:
|
|
1085
|
-
| `go:
|
|
1086
|
-
| `go:
|
|
1087
|
-
| `go:
|
|
1088
|
-
| `go:
|
|
1089
|
-
| `go:
|
|
1090
|
-
| `go:
|
|
1091
|
-
| `go:
|
|
1092
|
-
| `go:testing
|
|
1093
|
-
| `go:testing/
|
|
1094
|
-
| `go:testing/
|
|
1095
|
-
| `go:testing/
|
|
1096
|
-
| `go:
|
|
1097
|
-
| `go:
|
|
1098
|
-
| `go:
|
|
1099
|
-
| `go:text/
|
|
1100
|
-
| `go:
|
|
1101
|
-
| `go:
|
|
1102
|
-
| `go:
|
|
1103
|
-
| `go:
|
|
1104
|
-
| `go:
|
|
1105
|
-
| `go:
|
|
1106
|
-
| `go:
|
|
1107
|
-
| `go:
|
|
1108
|
-
| `go:
|
|
1109
|
-
| `go:
|
|
1110
|
-
| `go:
|
|
1111
|
-
| `go:
|
|
1112
|
-
| `go:
|
|
1050
|
+
|
|
1051
|
+
| Module | Status | Probe | Notes |
|
|
1052
|
+
| --------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
1053
|
+
| `go:archive/tar` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | tar archive read/write |
|
|
1054
|
+
| `go:archive/zip` | ✅ | [lib-go-archive.ts](conformance/lib-go-archive.ts) | ZIP archive read/write |
|
|
1055
|
+
| `go:bufio` | ✅ | [lib-go-bufio.ts](conformance/lib-go-bufio.ts) | Buffered I/O |
|
|
1056
|
+
| `go:bytes` | ✅ | [lib-go-bytes.ts](conformance/lib-go-bytes.ts) | Byte-slice utilities |
|
|
1057
|
+
| `go:cmp` | ✅ | [lib-go-slices.ts](conformance/lib-go-slices.ts) | Ordered comparison primitives |
|
|
1058
|
+
| `go:compress/bzip2` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | bzip2 decompression (read-only) |
|
|
1059
|
+
| `go:compress/flate` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | DEFLATE compression |
|
|
1060
|
+
| `go:compress/gzip` | ✅ | [lib-go-compress-gzip.ts](conformance/lib-go-compress-gzip.ts) | gzip read/write |
|
|
1061
|
+
| `go:compress/lzw` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | LZW compression (GIF/PDF/TIFF) |
|
|
1062
|
+
| `go:compress/zlib` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | zlib read/write |
|
|
1063
|
+
| `go:container/heap` | ✅ | [lib-go-container-heap.ts](conformance/lib-go-container-heap.ts) | A TS class implementing `heap.Interface` (see Go interfaces below) |
|
|
1064
|
+
| `go:container/list` | ✅ | [lib-go-containers.ts](conformance/lib-go-containers.ts) | Doubly linked list |
|
|
1065
|
+
| `go:container/ring` | ✅ | [lib-go-containers.ts](conformance/lib-go-containers.ts) | Circular list |
|
|
1066
|
+
| `go:context` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Cancellation and deadlines |
|
|
1067
|
+
| `go:crypto` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | Crypto constants and algorithm selection |
|
|
1068
|
+
| `go:crypto/aes` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | AES encryption |
|
|
1069
|
+
| `go:crypto/cipher` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Block cipher modes (GCM, CBC, CTR) |
|
|
1070
|
+
| `go:crypto/des` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | DES / triple DES (deprecated) |
|
|
1071
|
+
| `go:crypto/dsa` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | DSA signatures (deprecated) |
|
|
1072
|
+
| `go:crypto/ecdh` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ECDH key exchange |
|
|
1073
|
+
| `go:crypto/ecdsa` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ECDSA signatures |
|
|
1074
|
+
| `go:crypto/ed25519` | ✅ | [lib-go-ed25519.ts](conformance/lib-go-ed25519.ts) | Ed25519 signatures |
|
|
1075
|
+
| `go:crypto/elliptic` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | Elliptic curves (legacy; use ecdh/ecdsa) |
|
|
1076
|
+
| `go:crypto/fips140` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | FIPS 140-3 mode controls |
|
|
1077
|
+
| `go:crypto/hkdf` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | HKDF key derivation |
|
|
1078
|
+
| `go:crypto/hmac` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | HMAC keyed hashing |
|
|
1079
|
+
| `go:crypto/hpke` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | HPKE encryption (RFC 9180) |
|
|
1080
|
+
| `go:crypto/md5` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | MD5 hash |
|
|
1081
|
+
| `go:crypto/mlkem` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ML-KEM post-quantum key encapsulation |
|
|
1082
|
+
| `go:crypto/mlkem/mlkemtest` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | Deterministic ML-KEM encapsulation |
|
|
1083
|
+
| `go:crypto/pbkdf2` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | PBKDF2 key derivation |
|
|
1084
|
+
| `go:crypto/rand` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Cryptographically secure random bytes |
|
|
1085
|
+
| `go:crypto/rc4` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | RC4 stream cipher (deprecated) |
|
|
1086
|
+
| `go:crypto/rsa` | ✅ | [lib-go-rsa.ts](conformance/lib-go-rsa.ts) | RSA signatures / encryption |
|
|
1087
|
+
| `go:crypto/sha1` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | SHA-1 hash |
|
|
1088
|
+
| `go:crypto/sha256` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | SHA-224 / SHA-256 hashes |
|
|
1089
|
+
| `go:crypto/sha3` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | SHA-3 / SHAKE hashes |
|
|
1090
|
+
| `go:crypto/sha512` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | SHA-384 / SHA-512 family hashes |
|
|
1091
|
+
| `go:crypto/subtle` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Constant-time comparison primitives |
|
|
1092
|
+
| `go:crypto/tls` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | TLS client/server; loopback probe is a later phase |
|
|
1093
|
+
| `go:crypto/x509` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | X.509 certificates and revocation |
|
|
1094
|
+
| `go:crypto/x509/pkix` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | X.509 ASN.1/PKIX structures |
|
|
1095
|
+
| `go:database/sql` | ✅ | [lib-go-sql.ts](conformance/lib-go-sql.ts) | No std driver: registry and errors probed |
|
|
1096
|
+
| `go:database/sql/driver` | ✅ | [lib-go-sql.ts](conformance/lib-go-sql.ts) | Driver interfaces and value converters |
|
|
1097
|
+
| `go:debug/buildinfo` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Build info from executables |
|
|
1098
|
+
| `go:debug/dwarf` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | DWARF debug info parsing |
|
|
1099
|
+
| `go:debug/elf` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | ELF object files |
|
|
1100
|
+
| `go:debug/gosym` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Go symbol tables |
|
|
1101
|
+
| `go:debug/macho` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Mach-O object files |
|
|
1102
|
+
| `go:debug/pe` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | PE (Windows) object files |
|
|
1103
|
+
| `go:debug/plan9obj` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Plan 9 object files |
|
|
1104
|
+
| `go:embed` | ✅ | [lib-go-embed.ts](conformance/lib-go-embed.ts) | `embed.string` / `bytes` / `files` compile to `//go:embed` vars |
|
|
1105
|
+
| `go:encoding` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | Shared encoding interfaces |
|
|
1106
|
+
| `go:encoding/ascii85` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | ascii85 encoding |
|
|
1107
|
+
| `go:encoding/asn1` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | ASN.1 DER encoding |
|
|
1108
|
+
| `go:encoding/base32` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | base32 encoding |
|
|
1109
|
+
| `go:encoding/base64` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | base64 encoding |
|
|
1110
|
+
| `go:encoding/binary` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | Binary packing / varints |
|
|
1111
|
+
| `go:encoding/csv` | ✅ | [lib-go-csv.ts](conformance/lib-go-csv.ts) | CSV read/write |
|
|
1112
|
+
| `go:encoding/gob` | ✅ | [lib-go-gob.ts](conformance/lib-go-gob.ts) | Go binary serialization |
|
|
1113
|
+
| `go:encoding/hex` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | hex encoding |
|
|
1114
|
+
| `go:encoding/json` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | JSON encode/decode |
|
|
1115
|
+
| `go:encoding/pem` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | PEM encoding |
|
|
1116
|
+
| `go:encoding/xml` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | XML read/write |
|
|
1117
|
+
| `go:errors` | ✅ | [lib-go-errors.ts](conformance/lib-go-errors.ts) | Error creation / wrapping / inspection |
|
|
1118
|
+
| `go:expvar` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Public process variables |
|
|
1119
|
+
| `go:flag` | ✅ | [lib-go-exec.ts](conformance/lib-go-exec.ts) | Command-line flag parsing |
|
|
1120
|
+
| `go:fmt` | ✅ | [lib-go-fmt.ts](conformance/lib-go-fmt.ts) | Formatted I/O; integer verbs take TS numbers |
|
|
1121
|
+
| `go:go/ast` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go syntax tree |
|
|
1122
|
+
| `go:go/build` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go package build metadata |
|
|
1123
|
+
| `go:go/build/constraint` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Build-tag constraint parsing |
|
|
1124
|
+
| `go:go/constant` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Untyped constant values |
|
|
1125
|
+
| `go:go/doc` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go doc extraction |
|
|
1126
|
+
| `go:go/doc/comment` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Doc comment parse/print |
|
|
1127
|
+
| `go:go/format` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go source formatting |
|
|
1128
|
+
| `go:go/importer` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Export-data type importer |
|
|
1129
|
+
| `go:go/parser` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go source parser |
|
|
1130
|
+
| `go:go/printer` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go AST printer |
|
|
1131
|
+
| `go:go/scanner` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go tokenizer |
|
|
1132
|
+
| `go:go/token` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go tokens / positions |
|
|
1133
|
+
| `go:go/types` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go type checker |
|
|
1134
|
+
| `go:go/version` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go version comparison |
|
|
1135
|
+
| `go:hash` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | Hash function interface |
|
|
1136
|
+
| `go:hash/adler32` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | Adler-32 checksum |
|
|
1137
|
+
| `go:hash/crc32` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | CRC-32 checksum |
|
|
1138
|
+
| `go:hash/crc64` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | CRC-64 checksum |
|
|
1139
|
+
| `go:hash/fnv` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | FNV-1 / FNV-1a hash |
|
|
1140
|
+
| `go:hash/maphash` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | Seeded string hashing |
|
|
1141
|
+
| `go:html` | ✅ | [lib-go-url.ts](conformance/lib-go-url.ts) | HTML escaping |
|
|
1142
|
+
| `go:html/template` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | HTML templating (auto-escaped) |
|
|
1143
|
+
| `go:image` | ✅ | [lib-go-image.ts](conformance/lib-go-image.ts) | 2D image interface |
|
|
1144
|
+
| `go:image/color` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Color types |
|
|
1145
|
+
| `go:image/color/palette` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Standard color palettes |
|
|
1146
|
+
| `go:image/draw` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Image compositing |
|
|
1147
|
+
| `go:image/gif` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | GIF decode/encode |
|
|
1148
|
+
| `go:image/jpeg` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | JPEG decode/encode |
|
|
1149
|
+
| `go:image/png` | ✅ | [lib-go-image.ts](conformance/lib-go-image.ts) | PNG decode/encode |
|
|
1150
|
+
| `go:index/suffixarray` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Suffix-array substring search |
|
|
1151
|
+
| `go:io` | ✅ | [lib-go-compress-gzip.ts](conformance/lib-go-compress-gzip.ts) | Core I/O interfaces (Reader/Writer) |
|
|
1152
|
+
| `go:io/fs` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Filesystem abstraction |
|
|
1153
|
+
| `go:io/ioutil` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Deprecated I/O helpers (Go 1.16) |
|
|
1154
|
+
| `go:iter` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Range-over-func iterators via `for…of`; `Pull` not bridged |
|
|
1155
|
+
| `go:log` | ✅ | [lib-go-log.ts](conformance/lib-go-log.ts) | Logging to stderr |
|
|
1156
|
+
| `go:log/slog` | ✅ | [lib-go-log.ts](conformance/lib-go-log.ts) | Structured logging |
|
|
1157
|
+
| `go:log/syslog` | ✅ | [lib-go-syslog.ts](conformance/lib-go-syslog.ts) | Network syslog; Unix only (no Windows build, the probe skips it) |
|
|
1158
|
+
| `go:maps` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Generic map helpers |
|
|
1159
|
+
| `go:math` | ✅ | [lib-go-math.ts](conformance/lib-go-math.ts) | Math functions |
|
|
1160
|
+
| `go:math/big` | ✅ | [lib-go-big.ts](conformance/lib-go-big.ts) | Arbitrary-precision arithmetic |
|
|
1161
|
+
| `go:math/bits` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Bit operations |
|
|
1162
|
+
| `go:math/cmplx` | ✅ | [lib-go-math-cmplx.ts](conformance/lib-go-math-cmplx.ts) | `complex128` values pass between calls opaquely |
|
|
1163
|
+
| `go:math/rand` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Pseudo-random numbers |
|
|
1164
|
+
| `go:math/rand/v2` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Pseudo-random numbers (v2 API) |
|
|
1165
|
+
| `go:mime` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | MIME media types |
|
|
1166
|
+
| `go:mime/multipart` | ✅ | [lib-go-misc.ts](conformance/lib-go-misc.ts) | Multipart forms |
|
|
1167
|
+
| `go:mime/quotedprintable` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | Quoted-printable encoding |
|
|
1168
|
+
| `go:net` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Sockets (loopback TCP), addresses |
|
|
1169
|
+
| `go:net/http` | ✅ | [lib-go-http.ts](conformance/lib-go-http.ts) | HTTP client/server (loopback) |
|
|
1170
|
+
| `go:net/http/cgi` | ✅ | [lib-go-http-extra.ts](conformance/lib-go-http-extra.ts) | CGI request parsing |
|
|
1171
|
+
| `go:net/http/cookiejar` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Cookie jars (loopback) |
|
|
1172
|
+
| `go:net/http/fcgi` | ✅ | [lib-go-fcgi.ts](conformance/lib-go-fcgi.ts) | FastCGI responder serving a TS `http.Handler` class |
|
|
1173
|
+
| `go:net/http/httptest` | ✅ | [lib-go-http.ts](conformance/lib-go-http.ts) | HTTP test servers (loopback) |
|
|
1174
|
+
| `go:net/http/httptrace` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | HTTP tracing hooks |
|
|
1175
|
+
| `go:net/http/httputil` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | HTTP utilities (loopback) |
|
|
1176
|
+
| `go:net/http/pprof` | ✅ | [lib-go-http-extra.ts](conformance/lib-go-http-extra.ts) | pprof HTTP handlers |
|
|
1177
|
+
| `go:net/mail` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | Mail address parsing |
|
|
1178
|
+
| `go:net/netip` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | IP address types |
|
|
1179
|
+
| `go:net/rpc` | ✅ | [lib-go-rpc.ts](conformance/lib-go-rpc.ts) | TS class services: methods compile to `M(*Args, *Reply) error` |
|
|
1180
|
+
| `go:net/rpc/jsonrpc` | ✅ | [lib-go-rpc.ts](conformance/lib-go-rpc.ts) | JSON-RPC codec (client, server and the wire format) |
|
|
1181
|
+
| `go:net/smtp` | ✅ | [lib-go-smtp.ts](conformance/lib-go-smtp.ts) | SMTP client, against a TS server over loopback |
|
|
1182
|
+
| `go:net/textproto` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Text protocol I/O |
|
|
1183
|
+
| `go:net/url` | ✅ | [lib-go-url.ts](conformance/lib-go-url.ts) | URL parsing |
|
|
1184
|
+
| `go:os` | ✅ | [lib-go-os.ts](conformance/lib-go-os.ts) | OS files and processes |
|
|
1185
|
+
| `go:os/exec` | ✅ | [lib-go-exec.ts](conformance/lib-go-exec.ts) | External commands |
|
|
1186
|
+
| `go:os/signal` | ✅ | [lib-go-misc.ts](conformance/lib-go-misc.ts) | Signal notification (`Notify` + `Stop`) |
|
|
1187
|
+
| `go:os/user` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | User lookup |
|
|
1188
|
+
| `go:path` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Slash-separated paths |
|
|
1189
|
+
| `go:path/filepath` | ✅ | [lib-go-os.ts](conformance/lib-go-os.ts) | File paths |
|
|
1190
|
+
| `go:reflect` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Runtime reflection |
|
|
1191
|
+
| `go:regexp` | ✅ | [lib-go-regexp.ts](conformance/lib-go-regexp.ts) | Regular expressions |
|
|
1192
|
+
| `go:regexp/syntax` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Regexp parse trees |
|
|
1193
|
+
| `go:runtime` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Runtime introspection |
|
|
1194
|
+
| `go:runtime/coverage` | ✅ | [lib-go-coverage.ts](conformance/lib-go-coverage.ts) | Needs `--cover`; calls throw without it |
|
|
1195
|
+
| `go:runtime/debug` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Stack traces and GC stats |
|
|
1196
|
+
| `go:runtime/metrics` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Runtime metrics sampling |
|
|
1197
|
+
| `go:runtime/pprof` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Profiling data |
|
|
1198
|
+
| `go:runtime/trace` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Execution tracing |
|
|
1199
|
+
| `go:slices` | ✅ | [lib-go-slices.ts](conformance/lib-go-slices.ts) | Generic slice helpers |
|
|
1200
|
+
| `go:sort` | ✅ | [lib-go-sort.ts](conformance/lib-go-sort.ts) | Sorting |
|
|
1201
|
+
| `go:strconv` | ✅ | [lib-go-strconv.ts](conformance/lib-go-strconv.ts) | String conversions |
|
|
1202
|
+
| `go:strings` | ✅ | [lib-go-strings.ts](conformance/lib-go-strings.ts) | String utilities |
|
|
1203
|
+
| `go:structs` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | `HostLayout` marker |
|
|
1204
|
+
| `go:sync` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Mutexes and wait groups |
|
|
1205
|
+
| `go:sync/atomic` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Atomic operations |
|
|
1206
|
+
| `go:syscall` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | Portable subset probed; per-arch constants dropped |
|
|
1207
|
+
| `go:testing` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Helpers usable outside `go test` |
|
|
1208
|
+
| `go:testing/cryptotest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Real `*testing.T` via `testing.Main`; refuses outside `go test` |
|
|
1209
|
+
| `go:testing/fstest` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | `TestFS` over any `fs.FS` |
|
|
1210
|
+
| `go:testing/iotest` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Reader/writer test wrappers |
|
|
1211
|
+
| `go:testing/quick` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Property checks with TS callbacks |
|
|
1212
|
+
| `go:testing/slogtest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Handler suite: `TestHandler`, and `Run` under `testing.Main` |
|
|
1213
|
+
| `go:testing/synctest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Fake-time bubbles under `testing.Main` |
|
|
1214
|
+
| `go:text/scanner` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Text scanner |
|
|
1215
|
+
| `go:text/tabwriter` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Aligned text columns |
|
|
1216
|
+
| `go:text/template` | ✅ | [lib-go-template.ts](conformance/lib-go-template.ts) | Text templating |
|
|
1217
|
+
| `go:text/template/parse` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Template parse trees |
|
|
1218
|
+
| `go:time` | ✅ | [lib-go-time.ts](conformance/lib-go-time.ts) | Time and durations |
|
|
1219
|
+
| `go:time/tzdata` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Embedded timezone database (side-effect import) |
|
|
1220
|
+
| `go:unicode` | ✅ | [lib-go-unicode.ts](conformance/lib-go-unicode.ts) | Unicode tables |
|
|
1221
|
+
| `go:unicode/utf16` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | UTF-16 encoding |
|
|
1222
|
+
| `go:unicode/utf8` | ✅ | [lib-go-unicode.ts](conformance/lib-go-unicode.ts) | UTF-8 encoding |
|
|
1223
|
+
| `go:unique` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Canonical values |
|
|
1224
|
+
| `go:weak` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | Weak pointers |
|
|
1225
|
+
| `go:plugin` | 🚫 | — | Loads plugins with `dlopen`: needs cgo and `-buildmode=plugin` (no Windows support) |
|
|
1226
|
+
| `go:unsafe` | 🚫 | — | Raw pointer arithmetic and memory reinterpretation; TS values have no addresses |
|
|
1227
|
+
| `go:runtime/race` | 🚫 | — | No public API: the race detector is a build mode (`-race`) that needs cgo |
|
|
1228
|
+
| `go:runtime/cgo` | 🚫 | — | Links only with cgo and a C toolchain; `Handle` exists to pass Go values to C |
|
|
1229
|
+
|
|
1113
1230
|
<!-- go-bridges:end -->
|
|
1114
1231
|
|
|
1115
1232
|
#### Go bridge semantics
|
|
1116
1233
|
|
|
1117
|
-
| Rule
|
|
1118
|
-
|
|
|
1119
|
-
| Number conversion
|
|
1120
|
-
| Throw on error
|
|
1121
|
-
| Tuples
|
|
1122
|
-
| Structs
|
|
1123
|
-
|
|
|
1124
|
-
|
|
|
1125
|
-
|
|
|
1126
|
-
|
|
|
1127
|
-
|
|
|
1128
|
-
|
|
|
1129
|
-
|
|
|
1130
|
-
|
|
|
1131
|
-
|
|
|
1132
|
-
|
|
|
1234
|
+
| Rule | Meaning |
|
|
1235
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1236
|
+
| Number conversion | All Go ints/floats map to TS `number`; args convert via `T(x)`, results read back via `float64(x)`. `int64`/`uint64` beyond 2^53 lose precision. |
|
|
1237
|
+
| Throw on error | `(T, error)` results throw a `GoError` on failure; `error`-only calls throw as statements and yield the error value in value position ([lib-go-bridge-smoke.ts](conformance/lib-go-bridge-smoke.ts)). |
|
|
1238
|
+
| Tuples | Multi-value results pack into a slice (TS tuple); `const [a, b] = f()` types each element (ints read as numbers). |
|
|
1239
|
+
| Structs | `new pkg.T({...})` builds a composite literal (pointer when any method needs it); fields read/write directly, converting numbers both ways (`h.Size += 1`). Embedded structs promote their fields. |
|
|
1240
|
+
| Type annotations | `pkg.T` in an annotation is the Go type (`let d: dwarf.Data \| null = null`, `(t: testing.T) => …`): a struct is a pointer when the package hands out `*T`, a value when it hands out `T` (`time.Time`) ([lib-go-debug.ts](conformance/lib-go-debug.ts)). |
|
|
1241
|
+
| Named numerics | Typed constants (`time.Second`, `reflect.String`) stay typed in Go; arithmetic and `===` coerce the `number` side (`time.Second * 2`). Results read as numbers: `token.Token(n)` restores the methods. |
|
|
1242
|
+
| Callbacks | Func-typed params and struct fields become Go closures with the exact Go signature (int params read as numbers, returns convert to the result type); a `(T, error)` callback returns `T` and a `nil` error; sync callbacks (sort, slices, strings, ...) run inline. |
|
|
1243
|
+
| Generics | Type args are inferred from the arguments, including through constraints (`maps.Keys(m)` with `Map ~map[K]V`); unresolved ones become `any`. |
|
|
1244
|
+
| printf verbs | With a literal format, numbers passed to `%d %x %o %b %c %U` convert to `int64`; scan into number refs with `%v`. |
|
|
1245
|
+
| nil | `null` passes as `nil`; `x === null` on nil-able Go values (slices, maps, interfaces, pointers) is a real nil check. |
|
|
1246
|
+
| Channels | `chan<T>(size?)` (a `chan T`) / `GoChan<T>` with `send`, `recv`, `close`; `for…of` ranges channels, `iter.Seq` and `iter.Seq2` (`for (const [k, v] of seq2)`) ([lib-go-builtin.ts](conformance/lib-go-builtin.ts)). |
|
|
1247
|
+
| Out-params | `ref<T>(init?)` makes a pointer cell; `.value` reads and writes through it, also on `GoRef<T>` params ([lib-go-builtin.ts](conformance/lib-go-builtin.ts), [lib-go-rpc.ts](conformance/lib-go-rpc.ts)). |
|
|
1248
|
+
| Byte slices | `[]byte` is `Uint8Array` (zero-copy); `number[]` converts per call (mutations of the copy are lost). |
|
|
1249
|
+
| Maps | A TS record (`Record<K, V>`) passes where Go takes a `map[K]V` of the same key and value types, as a copy ([lib-go-testing-t.ts](conformance/lib-go-testing-t.ts)). |
|
|
1250
|
+
| Side-effect imports | `import 'go:time/tzdata'` emits a blank `import _`. |
|
|
1251
|
+
| Embedding | `const page = embed.string('./page.html')` (also `embed.bytes`, and `embed.files(...patterns)` for an `embed.FS`) compiles to a package-level `//go:embed` var. Only as a top-level initializer with literal paths, relative to the file; they must stay inside the entry file's directory, and `embed.FS` names are relative to it. The CLI copies the files next to the Go sources ([lib-go-embed.ts](conformance/lib-go-embed.ts)). |
|
|
1252
|
+
| Coverage | `--cover` builds with `-cover -covermode=atomic`, so `go:runtime/coverage` has data to write; set `GOCOVERDIR` to also get a profile at exit ([lib-go-coverage.ts](conformance/lib-go-coverage.ts)). |
|
|
1253
|
+
| Go interfaces | A TS class instance passed where Go expects an interface (`heap.Interface`, `sort.Interface`) is wrapped in a generated adapter with the exact Go method signatures (`Len() int` calls the class's `Len(): number`); the class needs every method, inherited ones count. Values typed as the interface itself are not adapted. |
|
|
1133
1254
|
|
|
1134
1255
|
### npm packages
|
|
1135
1256
|
|
|
1136
|
-
| Pattern
|
|
1137
|
-
|
|
|
1138
|
-
| `import { x } from 'pkg'`
|
|
1139
|
-
| Packages published as plain JavaScript / CommonJS (tried: `ms`, `escape-html`, `tiny-invariant`) |
|
|
1257
|
+
| Pattern | Status | Probe | Notes |
|
|
1258
|
+
| ------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1259
|
+
| `import { x } from 'pkg'` | ✅ | [syntax-import-npm.ts](conformance/syntax-import-npm.ts) | Mapped to Go module imports (fixture dep in [conformance/package.json](conformance/package.json)) |
|
|
1260
|
+
| Packages published as plain JavaScript / CommonJS (tried: `ms`, `escape-html`, `tiny-invariant`) | ❌ | — | Without TypeScript sources there are no types to compile from: untyped packages stop at the type check (TS7016), and typed ones whose code is CommonJS (`module.exports`, union-typed callbacks) don't lower. Packages that ship `.ts` sources work |
|
|
1261
|
+
|
|
1262
|
+
## Known limitations (🚫)
|
|
1263
|
+
|
|
1264
|
+
These follow from compiling to a native Go binary, and won't change:
|
|
1265
|
+
|
|
1266
|
+
- **No JavaScript engine at runtime**, so code can't be compiled while the program runs: `eval`,
|
|
1267
|
+
`new Function`, `node:vm`, `node:repl`, Worker `eval: true`. Nothing can inspect an engine
|
|
1268
|
+
either: `node:inspector`, `node:v8` heap snapshots and flags, `node:trace_events`, and
|
|
1269
|
+
`node:module` loader hooks.
|
|
1270
|
+
- **Classes are static Go structs** with fixed fields and method sets: no prototype mutation
|
|
1271
|
+
(`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`), no `Proxy` over typed values,
|
|
1272
|
+
no sparse-array holes.
|
|
1273
|
+
- **`undefined` and `null` are both Go `nil`**, so APIs that tell them apart can't (`node:sqlite`
|
|
1274
|
+
binding `undefined`).
|
|
1275
|
+
- **One process per isolate**: workers, `fork` and cluster workers are separate processes, so
|
|
1276
|
+
`SharedArrayBuffer` / `Atomics` can't share memory.
|
|
1277
|
+
- **No cgo**: `go:plugin`, `go:runtime/cgo`, `go:runtime/race` (the race detector), and SQLite
|
|
1278
|
+
native extensions (SQLite runs as Wasm translated to Go).
|
|
1279
|
+
- **No raw memory**: `go:unsafe` reinterprets memory through pointers; TS values have no addresses.
|
|
1280
|
+
- **Deprecated upstream**: `node:domain`, HTTP/2 server push, `util.inherits`.
|