typenative 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -2
- package/.github/workflows/npm-publish-github-packages.yml +2 -2
- package/CHANGELOG.md +271 -1
- package/CONTRIBUTION.md +2 -1
- package/README.md +15 -7
- package/bin/cli.js +1 -0
- package/bin/index.js +62 -3
- package/bin/main.js +1 -0
- package/bin/node/core.js +41 -0
- package/bin/node/events.js +15 -10
- package/bin/node/process.js +13 -0
- package/bin/node/punycode.js +2 -2
- package/bin/node/timers.js +4 -2
- package/bin/node/url.js +1 -1
- package/bin/parse-node.js +2 -2
- package/bin/regex_vm.js +2057 -0
- package/bin/transpiler.js +17225 -4830
- package/bin/typecheck-node.js +2 -1
- package/bin/version.js +1 -1
- package/conformance.md +57 -15
- package/examples/README.md +46 -23
- package/examples/angular-templates/README.md +139 -0
- package/examples/angular-templates/bench.mjs +173 -0
- package/examples/angular-templates/dom-type-globals.d.ts +21 -0
- package/examples/angular-templates/dom-type-stubs.ts +21 -0
- package/examples/angular-templates/main.ts +135 -0
- package/examples/angular-templates/parity.mjs +157 -0
- package/examples/angular-templates/run-node.mjs +69 -0
- package/examples/angular-templates/vendor/angular/compiler/LICENSE +21 -0
- package/examples/desktop-notes/README.md +11 -13
- package/examples/dupe-finder/README.md +7 -5
- package/examples/fibonacci/README.md +7 -7
- package/examples/hello-world/README.md +6 -6
- package/examples/json-server/README.md +19 -18
- package/examples/mandelbrot-png/README.md +11 -13
- package/examples/marked-cli/README.md +38 -37
- package/examples/openai-chat/README.md +148 -0
- package/examples/openai-chat/bench.mjs +175 -0
- package/examples/openai-chat/main.ts +488 -0
- package/examples/react-compiler/README.md +170 -0
- package/examples/react-compiler/bench.mjs +181 -0
- package/examples/react-compiler/main.ts +158 -0
- package/examples/react-compiler/parity.mjs +362 -0
- package/examples/react-compiler/run-node.mjs +88 -0
- package/examples/react-compiler/vendor/babel/LICENSE +22 -0
- package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +15 -0
- package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +51 -0
- package/examples/react-compiler/vendor/charcodes/package.json +25 -0
- package/examples/react-compiler/vendor/invariant/LICENSE +21 -0
- package/examples/react-compiler/vendor/invariant/invariant.cjs +51 -0
- package/examples/react-compiler/vendor/invariant/invariant.d.cts +11 -0
- package/examples/react-compiler/vendor/invariant/types/LICENSE +21 -0
- package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +19 -0
- package/examples/react-compiler/vendor/js-tokens/LICENSE +21 -0
- package/examples/react-compiler/vendor/js-tokens/index.cjs +23 -0
- package/examples/react-compiler/vendor/js-tokens/index.d.cts +13 -0
- package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +20 -0
- package/examples/react-compiler/vendor/jsesc/jsesc.cjs +337 -0
- package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +384 -0
- package/examples/react-compiler/vendor/jsesc/types/LICENSE +21 -0
- package/examples/react-compiler/vendor/picocolors/LICENSE +15 -0
- package/examples/react-compiler/vendor/picocolors/picocolors.cjs +75 -0
- package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +5 -0
- package/examples/react-compiler/vendor/picocolors/types.d.ts +51 -0
- package/examples/react-compiler/vendor/react-compiler/LICENSE +21 -0
- package/examples/react-compiler/vendor/stubs/babel-core.ts +31 -0
- package/examples/react-compiler/vendor/stubs/debug.ts +18 -0
- package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +13 -0
- package/examples/react-compiler/vendor/stubs/pretty-format.ts +18 -0
- package/examples/react-compiler/vendor/zod/LICENSE +21 -0
- package/examples/react-compiler/vendor/zod-validation-error/LICENSE +9 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +5 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +49 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +48 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +50 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +6 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +126 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +39 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +78 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +2 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +131 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +54 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +40 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +76 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +76 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +27 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +27 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +13 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +61 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +38 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +20 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +5 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +8 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +11 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +20 -0
- package/examples/react-compiler/vendor.mjs +688 -0
- package/examples/todo-cli/README.md +9 -9
- package/examples/yaml-cli/README.md +38 -28
- package/package.json +8 -5
- package/performance/README.md +195 -0
- package/performance/any-dynamic.ts +21 -0
- package/performance/any-record-view.ts +20 -0
- package/performance/arr-hof.ts +21 -0
- package/performance/arr-push-index.ts +15 -0
- package/performance/arr-sort.ts +21 -0
- package/performance/async-await.ts +24 -0
- package/performance/class-dispatch.ts +52 -0
- package/performance/events-emit.ts +27 -0
- package/performance/exc-throw-rare.ts +25 -0
- package/performance/exc-try-catch.ts +26 -0
- package/performance/fn-closures.ts +29 -0
- package/performance/fn-recursion-tree.ts +31 -0
- package/performance/gen-for-of.ts +46 -0
- package/performance/json-roundtrip.ts +27 -0
- package/performance/map-delete.ts +24 -0
- package/performance/map-string-keys.ts +22 -0
- package/performance/num-arith-loop.ts +14 -0
- package/performance/num-bitwise.ts +21 -0
- package/performance/num-mod-int.ts +16 -0
- package/performance/num-to-string.ts +16 -0
- package/performance/obj-alloc.ts +32 -0
- package/performance/regex-exec.ts +29 -0
- package/performance/regex-site.ts +28 -0
- package/performance/set-ops.ts +20 -0
- package/performance/str-char-scan.ts +35 -0
- package/performance/str-concat-plus.ts +18 -0
- package/performance/str-concat.ts +24 -0
- package/performance/str-short-scan.ts +26 -0
- package/performance/str-split-join.ts +23 -0
- package/performance/str-template.ts +16 -0
- package/performance/union-switch.ts +57 -0
- package/tsparser/check.go +2 -1
- package/tsparser/main.go +1 -0
- package/types/typenative-npm.d.ts +3 -2
- package/types/typenative.d.ts +42 -12
- package/ROUND2-HANDOFF.md +0 -200
package/bin/typecheck-node.js
CHANGED
|
@@ -38,7 +38,8 @@ export function typeCheckNode(entry, typesDir) {
|
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
options = {
|
|
41
|
-
target: ts.ScriptTarget.
|
|
41
|
+
target: ts.ScriptTarget.ES2025,
|
|
42
|
+
useDefineForClassFields: false,
|
|
42
43
|
module: ts.ModuleKind.ESNext,
|
|
43
44
|
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
44
45
|
lib: [],
|
package/bin/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/gen-version.mjs — do not edit.
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.6.0';
|
package/conformance.md
CHANGED
|
@@ -387,6 +387,13 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
387
387
|
[types/typenative-npm.d.ts](types/typenative-npm.d.ts) (`node:*`) and
|
|
388
388
|
[types/typenative-go.d.ts](types/typenative-go.d.ts) (`go:*`).
|
|
389
389
|
|
|
390
|
+
The reference runtime is Node 26 (V8 14.6). Notes that start with **Node 25** or
|
|
391
|
+
**Node 26** mark APIs added, changed or removed since Node 24, the previous
|
|
392
|
+
baseline, and name the release that changed them. Experimental modules that
|
|
393
|
+
still need a flag in Node 26 (`node:vfs`, `node:bench`, `node:dtls`,
|
|
394
|
+
`node:stream/iter`, the global `Worker`) aren't tracked until they ship
|
|
395
|
+
unflagged.
|
|
396
|
+
|
|
390
397
|
### `console`
|
|
391
398
|
|
|
392
399
|
| API | Status | Probe | Notes |
|
|
@@ -508,6 +515,7 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
508
515
|
| `Array.of` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
509
516
|
| 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 |
|
|
510
517
|
| `Array.fromAsync` | ❌ | — | Not declared |
|
|
518
|
+
| `Iterator.concat(...iterables)` | ❌ | — | **Node 26** (ES2026 iterator sequencing). Not declared; `Iterator.from` takes only arrays and generators today |
|
|
511
519
|
| `[...map.keys()]` / `[...map.values()]` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | |
|
|
512
520
|
| `anyArray.concat([…])` with an array of another element type (`xs.concat(['x'])` on `any[]`) | ❌ | — | Go build error; spread instead (`[...xs, 'x']`) |
|
|
513
521
|
|
|
@@ -522,6 +530,7 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
522
530
|
| `Map.clear` / `Set.clear` | ✅ | [lib-map-clear.ts](conformance/lib-map-clear.ts) | `TnMap.Clear()` |
|
|
523
531
|
| `WeakMap` / `WeakSet` | ✅ | [lib-weak-collections.ts](conformance/lib-weak-collections.ts) | Same as `Map` / `Set` (weakness is not observable) |
|
|
524
532
|
| Set operations (`union` / `intersection` / `difference`) | ✅ | [lib-set-operations.ts](conformance/lib-set-operations.ts) | Plus `symmetricDifference` / `isSubsetOf` / `isSupersetOf` / `isDisjointFrom` |
|
|
533
|
+
| `Map` / `WeakMap` `getOrInsert(key, value)` / `getOrInsertComputed(key, fn)` | ❌ | — | **Node 26** (ES2026 upsert). Not declared; one lookup, then a store when the key is missing |
|
|
525
534
|
| `new Map(iterable)` / `new Set(iterable)` from Maps, iterators, generators, `Object.entries`, strings, `null` | ✅ | [lib-collection-constructors.ts](conformance/lib-collection-constructors.ts) | A Map copy keeps the source's key and value types; plain objects and arrays as keys / members are compared by identity |
|
|
526
535
|
|
|
527
536
|
### `Number`
|
|
@@ -557,20 +566,24 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
557
566
|
|
|
558
567
|
| API | Status | Probe | Notes |
|
|
559
568
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
560
|
-
| Regex literals | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | `/pattern/flags`
|
|
569
|
+
| Regex literals | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | `/pattern/flags` run on the regex VM, compiled once per pattern and flags |
|
|
561
570
|
| `new RegExp()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Constructor with optional flags |
|
|
562
|
-
| `test()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) |
|
|
563
|
-
| `exec()` (groups) | ✅ | [lib-regex-groups.ts](conformance/lib-regex-groups.ts) |
|
|
571
|
+
| `test()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Matches without building the groups |
|
|
572
|
+
| `exec()` (groups) | ✅ | [lib-regex-groups.ts](conformance/lib-regex-groups.ts) | A match array; a group that took no part is `undefined` |
|
|
564
573
|
| Flags (`i`, `m`) | ✅ | [lib-regex-flags.ts](conformance/lib-regex-flags.ts) | Case-insensitive, multiline |
|
|
565
|
-
| Backreferences | ✅ | [lib-regex-backreference.ts](conformance/lib-regex-backreference.ts) |
|
|
574
|
+
| Backreferences | ✅ | [lib-regex-backreference.ts](conformance/lib-regex-backreference.ts) | By number and by name, on the regex VM |
|
|
566
575
|
| Named groups | ✅ | [lib-regex-named-groups.ts](conformance/lib-regex-named-groups.ts) | `(?<name>` → `(?P<name>`; `exec` returns a match with `.groups` |
|
|
567
576
|
| 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 |
|
|
568
|
-
| Lookbehind | ✅ | [lib-regex-lookbehind.ts](conformance/lib-regex-lookbehind.ts) | Lookaround
|
|
577
|
+
| Lookbehind | ✅ | [lib-regex-lookbehind.ts](conformance/lib-regex-lookbehind.ts) | Lookaround runs on the regex VM |
|
|
569
578
|
| 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 |
|
|
570
579
|
| `split` with RegExp | ✅ | [lib-regex-split.ts](conformance/lib-regex-split.ts) | JS semantics: captures are included, `limit` counts items |
|
|
571
580
|
| 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 |
|
|
572
|
-
| Unicode property escapes (`\p{L}`) with `u` | ✅ | — |
|
|
573
|
-
|
|
|
581
|
+
| Unicode property escapes (`\p{L}`) with `u` | ✅ | — | Only with `u` or `v`, as in JS |
|
|
582
|
+
| Backtracking semantics (capture reset, empty loops, line terminators, `[]`) | ✅ | [lib-regex-engine.ts](conformance/lib-regex-engine.ts) | Expected values checked against Node; a pattern that explodes switches to RE2 when RE2 can run it |
|
|
583
|
+
| Long strings: slices, indexes, `+=` | ✅ | [lib-string-long-slices.ts](conformance/lib-string-long-slices.ts) | Code-point offsets in long and non-ASCII strings; `+=` on a dynamic value keeps earlier values intact |
|
|
584
|
+
| Fields of dynamic objects | ✅ | [semantics-dynamic-field-access.ts](conformance/semantics-dynamic-field-access.ts)| Reads stay copies across later writes; setters, `switch` tags, in-place `push`, `Object.assign` |
|
|
585
|
+
| `d` flag `indices` / `hasIndices`; `RegExp.escape` | ❌ | — | `/x/d` compiles and matches (`flags` includes `d`); `indices`, `hasIndices` and `RegExp.escape` are not declared |
|
|
586
|
+
| `v` flag (`unicodeSets`): class subtraction `--`, intersection `&&`, nested and negated classes, `\q{…}` strings, `i` folding each operand; `unicodeSets` property | ✅ | [lib-regex-unicode-sets.ts](conformance/lib-regex-unicode-sets.ts) | Strings are tried longest first, as in JS; properties of strings (`\p{RGI_Emoji}`) aren't supported |
|
|
574
587
|
| Unmatched groups are `undefined`; sticky (`y`) regexes; lookaround captures; `$&` / `` $` `` / `$'` / `$<name>` / `$$` replacements; replacer offsets | ✅ | [lib-regex-groups-replace.ts](conformance/lib-regex-groups-replace.ts) | `new RegExp(src, 'g')` keeps its flags. An unmatched group still reads as `''` in string comparisons other than `=== undefined` |
|
|
575
588
|
| JS escapes in every pattern, also those the backtracking engine runs (backreferences, lookaround): `\xHH`, `\uHHHH`, `\u{…}`, `\cJ`, `\p{…}` / `\P{…}`, `\k<name>`; `\s` as JS's Unicode whitespace | ✅ | [lib-regex-escapes.ts](conformance/lib-regex-escapes.ts) | Group numbers count opening parentheses, as in JS |
|
|
576
589
|
| RegExp values: in objects, passed around, built at run time (`new RegExp(src, 'g')`), called through `any`; an object cast to `RegExp` | ✅ | [lib-regex-values.ts](conformance/lib-regex-values.ts) | `Object.prototype.toString.call(re)` |
|
|
@@ -608,15 +621,16 @@ See [Async & timing](#async--timing): `Promise` (constructor, `.then` / `.catch`
|
|
|
608
621
|
| `globalThis` | ✅ | [lib-global-this.ts](conformance/lib-global-this.ts) | `globalThis.x` is the global `x`; `(globalThis as any)` is a dynamic object |
|
|
609
622
|
| `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 |
|
|
610
623
|
| `AggregateError` (`errors`) | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | |
|
|
611
|
-
| `Error.captureStackTrace` / `Error.isError` / `DOMException`
|
|
624
|
+
| `Error.captureStackTrace` / `Error.isError` / `DOMException` / `QuotaExceededError` | ❌ | — | Not declared. **Node 26** makes `QuotaExceededError` a global `DOMException` subclass |
|
|
612
625
|
| `Symbol.for` / `Symbol.keyFor` / `description` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | A global registry by key |
|
|
613
626
|
| `[Symbol.asyncIterator]()` methods; `Symbol.toPrimitive` / `hasInstance` / `toStringTag` | ❌ | — | Only `Symbol()`, `Symbol.iterator` and `Symbol.dispose` are lowered |
|
|
614
627
|
| `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) |
|
|
615
628
|
| `Reflect` (`ownKeys` / `has` / `get` / `set` / …) | ❌ | — | Feasible over the existing dynamic property access |
|
|
616
629
|
| `Proxy` | 🚫 | — | Intercepting every property access on static Go structs; a `Proxy` limited to dynamic (`any`) objects would be feasible |
|
|
617
630
|
| `Intl` (`NumberFormat`, `DateTimeFormat`, `Collator`, `PluralRules`, `ListFormat`, `RelativeTimeFormat`, `Segmenter`), `toLocaleString` | ❌ | — | Needs locale data (vendored `golang.org/x/text`, or hand-written `en-US` first) |
|
|
618
|
-
| `Temporal` | ❌ | — | Feasible on Go's `time` and tzdata
|
|
619
|
-
| `WebSocket` / `navigator` / `CustomEvent` / `URLPattern` / `EventSource` / `reportError`
|
|
631
|
+
| `Temporal` | ❌ | — | **Node 26** makes it a global with no flag (`Temporal.Now`, `PlainDate`, `ZonedDateTime`, `Instant`, `Duration`, …). Feasible on Go's `time` and tzdata |
|
|
632
|
+
| `WebSocket` / `navigator` / `CustomEvent` / `URLPattern` / `EventSource` / `reportError` / `ErrorEvent` | ❌ | — | Not declared. `ErrorEvent` is a global from **Node 25** |
|
|
633
|
+
| `localStorage` / `sessionStorage` / `Storage` (`getItem` / `setItem` / `removeItem` / `clear` / `key` / `length`) | ❌ | — | **Node 25** turns Web Storage on by default. `sessionStorage` lives in memory; `localStorage` persists to `--localstorage-file` and, from **Node 26**, is `undefined` without it |
|
|
620
634
|
| `WebAssembly` | ❌ | — | Needs a Wasm runtime: vendoring wazero (pure Go, no cgo) would provide one (see [wasi](#nodewasi)) |
|
|
621
635
|
| `Function` as a value (`const Type = Function`), `x instanceof Function` | ✅ | [syntax-error-subclass-idiom.ts](conformance/syntax-error-subclass-idiom.ts) | An opaque sentinel; `instanceof Function` checks for a function value |
|
|
622
636
|
|
|
@@ -644,6 +658,7 @@ async function runs synchronously until its first `await`.
|
|
|
644
658
|
| `node:dns` / `node:dns/promises` | ✅ | [dns](#nodedns) |
|
|
645
659
|
| `node:domain` | 🚫 | [domain](#nodedomain) |
|
|
646
660
|
| `node:events` (+ `EventTarget`, `AbortController`) | ✅ | [events](#nodeevents) |
|
|
661
|
+
| `node:ffi` | ❌ | [ffi](#nodeffi) |
|
|
647
662
|
| `node:fs` / `node:fs/promises` | ✅ | [fs](#nodefs) |
|
|
648
663
|
| `node:http` / `node:https` | ✅ | [http / https](#nodehttp--nodehttps) |
|
|
649
664
|
| `node:http2` | ✅ | [http2](#nodehttp2) |
|
|
@@ -701,7 +716,10 @@ async function runs synchronously until its first `await`.
|
|
|
701
716
|
| `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` |
|
|
702
717
|
| 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`. |
|
|
703
718
|
| `BigInt64Array` / `BigUint64Array` | ❌ | — | `DataView` already has the BigInt64 accessors |
|
|
704
|
-
| `
|
|
719
|
+
| `Uint8Array.fromBase64` / `u8.toBase64()` | ✅ | [lib-uint8array-base64.ts](conformance/lib-uint8array-base64.ts) | Standard alphabet with padding; no options (`alphabet`, `omitPadding`, `lastChunkHandling`) |
|
|
720
|
+
| `Float16Array`, resizable `ArrayBuffer` (`resize`, `transfer`), `Uint8Array` `toHex` / `fromHex` | ❌ | — | Not declared |
|
|
721
|
+
| `Uint8Array` `setFromBase64` / `setFromHex`; `toBase64` / `fromBase64` options (`alphabet`, `omitPadding`, `lastChunkHandling`) | ❌ | — | **Node 25** (V8 14.1) ships the whole ES2026 base64 / hex API |
|
|
722
|
+
| `Buffer.stringLength(input, encoding)`, `buffer.isLatin1`, `blob.textStream()`, `end` argument of `buf.indexOf` / `lastIndexOf` / `includes`, `alignment` argument of `Buffer.allocUnsafe(Slow)`, `Buffer.poolSize` | ❌ | — | **Node 26**: `end` (26.1), `textStream` (26.5), `alignment` (26.8), `stringLength` / `isLatin1` (26.11); `poolSize` now defaults to 64 KiB (26.3). `lastIndexOf` isn't declared at all |
|
|
705
723
|
| `JSON.stringify(buffer)`, `buf.toJSON()` | ✅ | [lib-buffer-json.ts](conformance/lib-buffer-json.ts) | `{"type":"Buffer","data":[…]}`, keys in that order |
|
|
706
724
|
|
|
707
725
|
#### `node:fs`
|
|
@@ -718,6 +736,9 @@ async function runs synchronously until its first `await`.
|
|
|
718
736
|
| `createReadStream` / `createWriteStream` | ✅ | [lib-node-fs-streams.ts](conformance/lib-node-fs-streams.ts) | `encoding`, `start` / `end`, `highWaterMark`, `flags` |
|
|
719
737
|
| `chmodSync` / `utimesSync` / `symlinkSync` / `readlinkSync` / `linkSync` | ✅ | — | Implemented, not probed (symlinks need privileges on Windows) |
|
|
720
738
|
| `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()` |
|
|
739
|
+
| Removed in Node 25: `fs.F_OK` / `R_OK` / `W_OK` / `X_OK` (use `fs.constants`), the `recursive` option of `rmdir` / `rmdirSync` / `fs/promises` `rmdir` | ❌ | — | **Node 25**. TypeNative still declares and compiles them; they should leave the types so programs fail the type check, as they fail in Node |
|
|
740
|
+
| `openAsBlobSync` / `openAsBlob`, `statfs` / `statfsSync` (with `frsize`), the `buffer` option of `readFile`, `signal` on `stat` / `lstat` / `fstat`, `Temporal.Instant` fields on `Stats` (`atimeInstant` …), the `windowsHandle` stream option; `FileHandle` `pull` / `pullSync` / `writer` | ❌ | — | **Node 25 / 26**: `FileHandle` iteration (25.9), `frsize` and `stat` `signal` (26.1), `Instant` fields (26.2), `readFile` `buffer` (26.4), `openAsBlobSync` (26.10) |
|
|
741
|
+
| `glob` / `globSync` / `fs/promises` `glob` (`cwd`, `exclude`, `withFileTypes`, `followSymlinks`, `maxDepth`) | ❌ | — | **Node 26** adds `followSymlinks` (26.1) and `maxDepth` (26.9). `path.matchesGlob` already compiles the patterns |
|
|
721
742
|
|
|
722
743
|
#### `node:os`
|
|
723
744
|
|
|
@@ -741,6 +762,8 @@ async function runs synchronously until its first `await`.
|
|
|
741
762
|
| `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 |
|
|
742
763
|
| `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 |
|
|
743
764
|
| `emitWarning(warning, type)` | ✅ | [lib-process-emit-warning.ts](conformance/lib-process-emit-warning.ts) | `(node:PID) <type>: <message>` on stderr, and Node's `--trace-warnings` hint after the first one |
|
|
765
|
+
| `process.version` / `versions.node` reporting Node 26 | ❌ | — | Both still report `v24.0.0` / `24.0.0` ([src/node/process.ts](src/node/process.ts)) |
|
|
766
|
+
| `process.ref(x)` / `process.unref(x)`, `addUncaughtExceptionCaptureCallback`, `execve`, `process.permission` (`has`, `drop`) | ❌ | — | **Node 25 / 26**: `addUncaughtExceptionCaptureCallback` (25.9), `execve` throws on failure instead of aborting (26.1), `permission.drop` (26.3), `ref` / `unref` stable (26.11) |
|
|
744
767
|
|
|
745
768
|
#### `node:console`
|
|
746
769
|
|
|
@@ -762,13 +785,15 @@ async function runs synchronously until its first `await`.
|
|
|
762
785
|
| `inherits` (legacy) | 🚫 | — | Rewrites prototypes; classes are static Go structs |
|
|
763
786
|
| 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 |
|
|
764
787
|
| `parseArgs` result typed from the `options` config | ✅ | [lib-util-parse-args-typed.ts](conformance/lib-util-parse-args-typed.ts) | `values.json` is a `boolean`, `values.indent` a `string` |
|
|
788
|
+
| `debounce` / `throttle` / `markPromiseAsHandled`, `isPartialDeepStrictEqual`, `MIMEType.parse` (returns `null` instead of throwing), hex colours in `styleText` (`'#ff8800'`) | ❌ | — | **Node 26**: hex colours (26.1), `MIMEType.parse` (26.8), `debounce` / `throttle` / `markPromiseAsHandled` (26.10), `isPartialDeepStrictEqual` (26.11) |
|
|
765
789
|
|
|
766
790
|
#### `node:assert`
|
|
767
791
|
|
|
768
792
|
| API | Status | Probe | Notes |
|
|
769
793
|
| ------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
770
794
|
| `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 |
|
|
771
|
-
| `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)
|
|
795
|
+
| `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). Invalid `Date`s compare equal, as in **Node 25** |
|
|
796
|
+
| `printf`-style messages (`assert.ok(v, 'got %s', x)`) and message functions on every assertion; `partialDeepStrictEqual` | ❌ | — | **Node 26** (printf messages). The type check rejects extra message arguments today (`Expected 1-2 arguments`) |
|
|
772
797
|
|
|
773
798
|
#### `node:url`
|
|
774
799
|
|
|
@@ -816,6 +841,7 @@ async function runs synchronously until its first `await`.
|
|
|
816
841
|
| `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 |
|
|
817
842
|
| 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 |
|
|
818
843
|
| 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 |
|
|
844
|
+
| `randomUUIDv7`, `createMac` / `getMacs` / `Mac` (`update` / `final`), `parsePKCS12`, SIV and GCM-SIV cipher modes | ❌ | — | **Node 26**: `randomUUIDv7` (26.1), SIV / GCM-SIV (26.8), `createMac` (26.9), `parsePKCS12` (26.10). A v7 UUID is a millisecond timestamp plus `crypto/rand` bits; PKCS#12 is the decoder [tls](#nodetls) PFX needs too |
|
|
819
845
|
|
|
820
846
|
#### `node:zlib`
|
|
821
847
|
|
|
@@ -825,6 +851,8 @@ async function runs synchronously until its first `await`.
|
|
|
825
851
|
| `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 |
|
|
826
852
|
| 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 |
|
|
827
853
|
| 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 |
|
|
854
|
+
| ZIP archives: `ZipFile` (`open(Sync)`, `get` / `add` / `delete` / `compact`, `stream`), `ZipBuffer`, `ZipEntry`, `createZipArchive(Sync)`, `zipFiles`, `get/setMaxZipContentSize` | ❌ | — | **Node 26** (26.8). Feasible on Go's `archive/zip` |
|
|
855
|
+
| Iterable compression: `compressGzipSync()` / `decompressGzipSync()` and the Deflate / Brotli / Zstd variants; Zstd itself (`zstdCompress(Sync)` & co.) | ❌ | — | **Node 25** (25.9) for the iterable forms. Zstd needs a vendored pure-Go codec (`klauspost/compress/zstd`) |
|
|
828
856
|
|
|
829
857
|
#### `node:timers`
|
|
830
858
|
|
|
@@ -840,6 +868,7 @@ async function runs synchronously until its first `await`.
|
|
|
840
868
|
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------- |
|
|
841
869
|
| `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 |
|
|
842
870
|
| `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 |
|
|
871
|
+
| Histogram statistics (`cdf` / `ccdf` / `countAt` / `percentileCI` / `meanCI` / `skewness` / `kurtosis` / `ewma*`, `welchTest` / `ksTest` / `mannWhitneyTest` / `cohensD`, `subtract` / `diff` / `snapshot`, `export` / `importHistogram`), `recordCorrected`, `createSlidingWindowHistogram` | ❌ | — | **Node 26** (26.8 – 26.11). Arithmetic over the recorded values |
|
|
843
872
|
|
|
844
873
|
#### `node:tty`
|
|
845
874
|
|
|
@@ -877,6 +906,7 @@ async function runs synchronously until its first `await`.
|
|
|
877
906
|
| `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 |
|
|
878
907
|
| `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 |
|
|
879
908
|
| Backpressure (`highWaterMark` beyond `write()`'s return value), `compose` with generator functions | ❌ | — | Not implemented yet |
|
|
909
|
+
| `duplexPair`, `Duplex.toWeb` `readableType`, `readable[Symbol.for('Stream.toAsyncStreamable')]()` | ❌ | — | **Node 25 / 26**: `readableType` (25.7); `duplexPair` destroys both ends together (26.1); `compose` is stable (26.2) |
|
|
880
910
|
|
|
881
911
|
#### `node:stream/web`
|
|
882
912
|
|
|
@@ -963,6 +993,7 @@ async function runs synchronously until its first `await`.
|
|
|
963
993
|
| `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` |
|
|
964
994
|
| Trailers on client requests, `Agent` socket pooling control | ❌ | — | Feasible: Go's `Request.Trailer`, `Transport.MaxConnsPerHost` / `MaxIdleConnsPerHost` |
|
|
965
995
|
| `statusMessage` on responses we send, `'checkContinue'` | ❌ | — | Go's `ResponseWriter` sends its standard reason phrases and answers `100-continue` itself: needs a hijacked connection |
|
|
996
|
+
| `res.writeInformation(status, headers)` (any 1xx), `req.signal`, `isValidHeaderName` / `isValidHeaderValue`, `websocketMask` / `websocketUnmask`, the `httpValidation` option | ❌ | — | **Node 26**: `req.signal` (26.1), `writeInformation` (26.2), `httpValidation` (26.3), header checks (26.11), WebSocket masking (26.12). Removed in 26.0: `writeHeader` (never declared here) |
|
|
966
997
|
|
|
967
998
|
#### `node:http2`
|
|
968
999
|
|
|
@@ -1026,6 +1057,7 @@ async function runs synchronously until its first `await`.
|
|
|
1026
1057
|
| Snapshots: `t.assert.snapshot` / `t.assert.fileSnapshot`, `--test-update-snapshots`, `snapshot.setDefaultSnapshotSerializers` / `setResolveSnapshotPath` | ✅ | [lib-node-test-snapshots.ts](conformance/lib-node-test-snapshots.ts) | Node's `<test file>.snapshot` format (entries sorted by name, JSON values), redirectable with `setResolveSnapshotPath`; a missing file or entry names the update flag |
|
|
1027
1058
|
| `run({ files })`: a TestsStream (`test:pass` & co. events, `compose(reporter)`, `pipe`) | ✅ | [lib-node-test-run.ts](conformance/lib-node-test-run.ts) | Files with literal paths compile in as entry points and run as child processes; top-level numbering continues across files, child output becomes `test:stdout` / `test:stderr`, coverage and summaries merge |
|
|
1028
1059
|
| Coverage: `--experimental-test-coverage`, `--test-coverage-include` / `-exclude`, `-lines` / `-branches` / `-functions` thresholds | ✅ | [lib-node-test-coverage.ts](conformance/lib-node-test-coverage.ts) | Programs that import `node:test` count what runs over V8-style source ranges (functions, blocks, ternary arms, `&&` / `\|\|` / `??` operands, class field initializers); `node:coverage ignore` comments exclude ranges; lcov records and the tap / spec table match Node's output |
|
|
1060
|
+
| `t.log` / `'test:log'`, `getTestContext`, `t.passed` / `t.attempt` / `t.workerId`, tags (`t.tags`), `--test-randomize` / `--test-random-seed`, `'test:interrupted'`, `t.assert.called` / `callCount` / `nthCalledWith` / `lastCalledWith`, `--test-coverage-include-all` | ❌ | — | **Node 25 / 26**: `'test:interrupted'` (25.7), `workerId` (25.8), `getTestContext` / randomized order (26.1), tags (26.2), `t.log` (26.6), `--test-coverage-include-all` (26.7), call assertions (26.12) |
|
|
1029
1061
|
|
|
1030
1062
|
#### `node:worker_threads`
|
|
1031
1063
|
|
|
@@ -1061,8 +1093,11 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
1061
1093
|
| `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 |
|
|
1062
1094
|
| `loadExtension` / `enableLoadExtension` | 🚫 | — | SQLite runs as Wasm inside the program; native extensions can't load |
|
|
1063
1095
|
| `createSession` / `applyChangeset` | ❌ | — | The bundled SQLite build has no session extension: needs an emulation over the preupdate hook (hard) |
|
|
1064
|
-
| `serialize(dbName?)` / `deserialize(buffer, { dbName })` | ✅ | [lib-node-sqlite-serialize.ts](conformance/lib-node-sqlite-serialize.ts) |
|
|
1065
|
-
| `undefined` as a parameter value
|
|
1096
|
+
| `serialize(dbName?)` / `deserialize(buffer, { dbName })` | ✅ | [lib-node-sqlite-serialize.ts](conformance/lib-node-sqlite-serialize.ts) | **Node 26** (26.1) API. The driver has no `sqlite3_serialize` binding, so the image goes through a temporary file and SQLite's backup API |
|
|
1097
|
+
| `undefined` as a parameter value | ✅ | — | Binds NULL, as **Node 26** (26.10) does; Node 24 threw. `undefined` and `null` are both `nil` |
|
|
1098
|
+
| `[Object: null prototype]` rows | 🚫 | — | Rows print as plain objects |
|
|
1099
|
+
| `Database` / `Statement` class names | ❌ | — | **Node 26** (26.11) renames them; `DatabaseSync` / `StatementSync` stay as deprecated aliases (DEP0210). Only the `*Sync` names are declared |
|
|
1100
|
+
| `statement.close()` / `statement[Symbol.dispose]()` / `stat(counter)` / `resetStats()`, `database.createModule(name, options)` (virtual tables) | ❌ | — | **Node 26**: statement methods (26.8), `createModule` (26.11) |
|
|
1066
1101
|
| 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 |
|
|
1067
1102
|
|
|
1068
1103
|
#### `node:inspector`
|
|
@@ -1115,9 +1150,10 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
1115
1150
|
| API | Status | Probe | Notes |
|
|
1116
1151
|
| ----------------------------------------------------------------------------- | :----: | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
1117
1152
|
| `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 |
|
|
1153
|
+
| `builtinModules` as Node 26 lists it | ❌ | — | **Node 26** drops `_stream_duplex` & co. (removed in 26.0) and, since Node 23.5, lists the scheme-only `node:ffi` / `node:sea` / `node:sqlite` / `node:test` / `node:test/reporters` |
|
|
1118
1154
|
| `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`) |
|
|
1119
1155
|
| `findPackageJSON`, `require` of modules | ❌ | — | Feasible: a literal module specifier resolved at compile time like an import |
|
|
1120
|
-
| `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time
|
|
1156
|
+
| `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time. **Node 26** runtime-deprecates `register` |
|
|
1121
1157
|
|
|
1122
1158
|
#### `node:test/reporters`
|
|
1123
1159
|
|
|
@@ -1132,6 +1168,12 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
1132
1168
|
| ------------------- | :----: | ----- | ------------------- |
|
|
1133
1169
|
| `create` / `Domain` | 🚫 | — | Deprecated upstream |
|
|
1134
1170
|
|
|
1171
|
+
#### `node:ffi`
|
|
1172
|
+
|
|
1173
|
+
| API | Status | Probe | Notes |
|
|
1174
|
+
| ----------------------------------------------------------------------- | :----: | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1175
|
+
| Loading dynamic libraries and calling native symbols, `getCurrentEventLoop` | ❌ | — | **Node 26**: added in 26.1, on by default since 26.9 (still experimental). Without cgo this needs a pure-Go `dlopen` (`purego`) or `syscall.LoadDLL` on Windows; [`go:*` bridges](#go-bridges-go) already call Go code |
|
|
1176
|
+
|
|
1135
1177
|
### Go bridges (`go:*`)
|
|
1136
1178
|
|
|
1137
1179
|
Status: ✅ probed, 🚫 can't work in a TypeNative program (see [Known limitations](#known-limitations-)).
|
package/examples/README.md
CHANGED
|
@@ -6,29 +6,48 @@ Node vs TypeNative on the same workload and a README documenting the results.
|
|
|
6
6
|
|
|
7
7
|
| Example | Demonstrates | Headline result (this machine*) |
|
|
8
8
|
|-----------------------------------|----------------------------------------------------------------------------|--------------------------------------------------------------|
|
|
9
|
-
| [hello-world](hello-world/) | `console.log`, `process.argv`, template literals | **
|
|
10
|
-
| [fibonacci](fibonacci/) | Recursion, `perf_hooks` timing, CPU-bound number crunching | **
|
|
11
|
-
| [json-server](json-server/) | `node:http` web server with GET + POST JSON routes, zero dependencies |
|
|
12
|
-
| [todo-cli](todo-cli/) | A to-do CLI persisting to a JSON file, run many times a day | **
|
|
13
|
-
| [dupe-finder](dupe-finder/) | Recursive directory walk, SHA-256 hashing, JSON report written to disk | **
|
|
14
|
-
| [mandelbrot-png](mandelbrot-png/) | Fractal render + hand-written PNG encoder on `node:zlib`, no image library | **1.
|
|
15
|
-
| [desktop-notes](desktop-notes/) | Notes app in a native webview window, UI compiled into one binary | **4.
|
|
16
|
-
| [yaml-cli](yaml-cli/) | The `yaml` package's own CLI from its unmodified source, 100% Node parity | **
|
|
17
|
-
| [marked-cli](marked-cli/) | The `marked` markdown CLI from its unmodified source, 100% Node parity | **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
| [hello-world](hello-world/) | `console.log`, `process.argv`, template literals | **8.5x faster startup** (7.4 ms vs 62.4 ms) |
|
|
10
|
+
| [fibonacci](fibonacci/) | Recursion, `perf_hooks` timing, CPU-bound number crunching | **2.0x faster compute** (36.4 ms vs 73.8 ms) |
|
|
11
|
+
| [json-server](json-server/) | `node:http` web server with GET + POST JSON routes, zero dependencies | 0.7x Node's HTTP throughput (44.3k vs 60.0k GET req/s) |
|
|
12
|
+
| [todo-cli](todo-cli/) | A to-do CLI persisting to a JSON file, run many times a day | **8.2x faster per command** (9.3 ms vs 76.1 ms) |
|
|
13
|
+
| [dupe-finder](dupe-finder/) | Recursive directory walk, SHA-256 hashing, JSON report written to disk | **2.9x faster scan** (224 ms vs 645 ms, 2,000 files) |
|
|
14
|
+
| [mandelbrot-png](mandelbrot-png/) | Fractal render + hand-written PNG encoder on `node:zlib`, no image library | **1.1x faster** (452 ms vs 514 ms) |
|
|
15
|
+
| [desktop-notes](desktop-notes/) | Notes app in a native webview window, UI compiled into one binary | **4.4x faster launch, 6.7x less memory** (11 vs 73 MiB) |
|
|
16
|
+
| [yaml-cli](yaml-cli/) | The `yaml` package's own CLI from its unmodified source, 100% Node parity | **13x faster per call** (9 vs 117 ms); 3.9x slower on 10 MB† |
|
|
17
|
+
| [marked-cli](marked-cli/) | The `marked` markdown CLI from its unmodified source, 100% Node parity | **8.4x faster per call** (14 vs 119 ms); 1.6x slower on 10 MB‡ |
|
|
18
|
+
| [openai-chat](openai-chat/) | Chat client for any OpenAI-compatible API: streaming `fetch` + SSE parsing, readline REPL | **1.1x faster per answer** (716 vs 780 ms streamed) |
|
|
19
|
+
| [angular-templates](angular-templates/) | Angular's template compiler (`@angular/compiler`, 233 files) to Ivy instructions, 100% Node parity | **3.7x faster per template** (61 vs 223 ms); 1.9x slower at 64 KB§ |
|
|
20
|
+
| [react-compiler](react-compiler/) | The React Compiler (`babel-plugin-react-compiler` + Babel 7.29 + zod 4, ~470 files) compiling components to their auto-memoized form | in progress — the full pipeline runs; simple functions compile byte-identically, runtime panics remain in the compiler's passes¶ |
|
|
21
|
+
|
|
22
|
+
\* Windows 11 Pro, AMD Ryzen 5 7600, Node v26.13.0, Go 1.27.4, TypeNative
|
|
23
|
+
0.5.0 (unreleased changes), all examples. See each example's README for full
|
|
24
|
+
methodology and numbers.
|
|
25
|
+
|
|
26
|
+
† The native binary is faster up to about 350 KB of input per run.
|
|
25
27
|
yaml-cli's [parity.mjs](yaml-cli/parity.mjs) also checks every output against
|
|
26
28
|
Node byte for byte on the yaml-test-suite (1,608 cases).
|
|
27
29
|
|
|
28
|
-
‡
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
‡ The native binary is faster up to about 1–1.5 MB of markdown per run.
|
|
31
|
+
marked-cli's [parity.mjs](marked-cli/parity.mjs) checks every output against
|
|
32
|
+
Node byte for byte on marked's spec suites (2,859 cases).
|
|
33
|
+
|
|
34
|
+
§ The native binary is faster up to about 25 KB of template
|
|
35
|
+
per run; most component templates are a few KB. angular-templates'
|
|
36
|
+
[parity.mjs](angular-templates/parity.mjs) checks every output against Node
|
|
37
|
+
byte for byte on the templates of Angular's compiler compliance suite (612
|
|
38
|
+
templates).
|
|
39
|
+
|
|
40
|
+
¶ The largest codebase TypeNative compiles. The binary builds and
|
|
41
|
+
initializes all ~470 vendored modules in Node's evaluation order (see the
|
|
42
|
+
TypeNative CHANGELOG for what that took); the whole pipeline runs natively —
|
|
43
|
+
JSX parses, Scope collects bindings, the HIR builds, and codegen emits
|
|
44
|
+
memoized output whose CompileSuccess lines match Node's. Simple functions
|
|
45
|
+
compile byte-identically; the remaining fixtures fail inside the compiler's
|
|
46
|
+
own passes (effects-inference ordering, nil dereferences in instruction
|
|
47
|
+
rewriting), tracked in
|
|
48
|
+
[the example's README](react-compiler/README.md#status-what-works-natively);
|
|
49
|
+
[parity.mjs](react-compiler/parity.mjs) reports the current gap and
|
|
50
|
+
[bench.mjs](react-compiler/bench.mjs) is ready.
|
|
32
51
|
|
|
33
52
|
## Running an example
|
|
34
53
|
|
|
@@ -72,12 +91,16 @@ cd examples/mandelbrot-png && node bench.mjs
|
|
|
72
91
|
cd examples/desktop-notes && npm install && node bench.mjs
|
|
73
92
|
cd examples/yaml-cli && node bench.mjs # and node parity.mjs
|
|
74
93
|
cd examples/marked-cli && node bench.mjs # and node parity.mjs
|
|
94
|
+
cd examples/openai-chat && node bench.mjs # against a local mock API, no key needed
|
|
95
|
+
cd examples/angular-templates && node bench.mjs # and node parity.mjs
|
|
96
|
+
cd examples/react-compiler && node parity.mjs # and node bench.mjs
|
|
75
97
|
```
|
|
76
98
|
|
|
77
99
|
TypeNative's clearest wins are process startup and memory. Startup is about
|
|
78
|
-
|
|
79
|
-
like desktop-notes idles at about a
|
|
80
|
-
hash-bound work (dupe-finder)
|
|
100
|
+
8x faster, which is what you feel in a CLI like todo-cli. A long-running app
|
|
101
|
+
like desktop-notes idles at about a seventh of Node's memory. Disk- and
|
|
102
|
+
hash-bound work (dupe-finder) runs about 3x faster, while HTTP serving
|
|
103
|
+
(json-server) handles fewer requests per second than Node 26. Pure
|
|
81
104
|
floating-point loops (mandelbrot-png) run at about the same speed as V8's
|
|
82
105
|
JIT, and recursion-heavy code (fibonacci) runs about 2x faster. Every example
|
|
83
106
|
also ships as one dependency-free binary. The READMEs report what was
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Angular template compiler
|
|
2
|
+
|
|
3
|
+
The Angular template compiler, natively. [vendor/angular/compiler/](vendor/angular/compiler/)
|
|
4
|
+
holds `@angular/compiler`'s TypeScript source (`packages/compiler/src`: 233
|
|
5
|
+
files, about 66,000 lines, MIT licensed). Its logic is upstream's own; the only
|
|
6
|
+
edits are mechanical, so Node.js can run the files directly: import specifiers
|
|
7
|
+
carry their `.ts` extension, and type-only imports are marked `type`.
|
|
8
|
+
[main.ts](main.ts) parses an Angular template (control flow, bindings, pipes,
|
|
9
|
+
i18n, `@defer`, `@let`, …) with `parseTemplate`, compiles it to a component
|
|
10
|
+
definition with `compileComponentFromMetadata`, and prints the Ivy
|
|
11
|
+
instructions as JavaScript, the way the Angular CLI's output reads.
|
|
12
|
+
|
|
13
|
+
This is the largest real codebase TypeNative compiles. The compiler is
|
|
14
|
+
built around deep class hierarchies with abstract members and `super` calls,
|
|
15
|
+
visitor interfaces implemented by dozens of classes, generators, structural
|
|
16
|
+
object types that extend each other, `Map`s and `Set`s of arrays and objects,
|
|
17
|
+
`bigint` message fingerprints, and template-literal code generation whose
|
|
18
|
+
output must match V8's byte for byte.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
ng-compile # compile the built-in demo template
|
|
24
|
+
ng-compile app.component.html # compile a template file
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A template with syntax errors prints them as `// error: …` comments. An error
|
|
28
|
+
the compiler throws prints as `// compile error: …` and exits with code 1.
|
|
29
|
+
|
|
30
|
+
## Run it
|
|
31
|
+
|
|
32
|
+
With Node.js. Node runs TypeScript only by stripping types, and Angular's
|
|
33
|
+
compiler source uses enums, which that mode rejects, so `run-node.mjs`
|
|
34
|
+
compiles `main.ts` and everything it imports to JavaScript with the
|
|
35
|
+
repository's `typescript` package once, caches it in `.cache/node/`, and runs
|
|
36
|
+
it:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
node run-node.mjs my.component.html
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
With TypeNative:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx typenative --source main.ts --output dist/ng-compile
|
|
46
|
+
./dist/ng-compile app.component.html
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
From a checkout of this repository:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
node bin/cli.js --source examples/angular-templates/main.ts --output dist/ng-compile
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Parity with Node.js
|
|
56
|
+
|
|
57
|
+
Reproduce with `node parity.mjs [filter]`. The script fetches the test cases
|
|
58
|
+
of Angular's compiler compliance suite
|
|
59
|
+
(`packages/compiler-cli/test/compliance/test_cases`, at commit `939171c`) into
|
|
60
|
+
`.cache/` (it isn't committed) and compiles `main.ts`. It then compiles every
|
|
61
|
+
component template in them with both runtimes: each external `.html` template,
|
|
62
|
+
and each inline `template:` string literal. stdout, stderr and the exit code
|
|
63
|
+
must match byte for byte, with no normalization. Failures are written to
|
|
64
|
+
`.cache/failures/`.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
612/612 templates match (100.00%)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The corpus covers control flow (`@if`, `@for`, `@switch`, `@defer` with every
|
|
71
|
+
trigger, `@let`), i18n (attributes, ICUs nested in ICUs, meanings,
|
|
72
|
+
descriptions and custom ids, legacy message ids, line-ending normalization),
|
|
73
|
+
pipes, two-way bindings, listeners, directive matching, `ng-content`
|
|
74
|
+
projection, styling bindings and templates with errors (which
|
|
75
|
+
must report the same messages).
|
|
76
|
+
|
|
77
|
+
## Benchmark: Node.js vs TypeNative
|
|
78
|
+
|
|
79
|
+
Reproduce with `node bench.mjs [runs=30] [sizeRuns=5] [kilobytes=8,16,32,64]`.
|
|
80
|
+
The script compiles `main.ts`, then times **complete process runs** (spawn to
|
|
81
|
+
exit) of `ng-compile` under both runtimes, alternating Node and native runs,
|
|
82
|
+
and checks that the two outputs are identical:
|
|
83
|
+
|
|
84
|
+
- **(a) per-call latency:** the built-in demo template (control flow,
|
|
85
|
+
bindings, pipes, listeners, `@let`, `ng-content`), about one component's
|
|
86
|
+
worth. This is what a build tool or editor pays per template when it starts
|
|
87
|
+
a compiler process per file.
|
|
88
|
+
- **(b) scaling:** generated templates from 8 to 64 KB. Each is a dashboard of
|
|
89
|
+
cards using `@if`/`@for`/`@switch`, `@defer`, `@let`, property, class, style
|
|
90
|
+
and attribute bindings, listeners, two-way bindings, pipes, i18n attributes
|
|
91
|
+
and ICUs, `ng-template` references and `ng-content`, from a fixed-seed
|
|
92
|
+
generator, so every machine gets the same input. Each card is its own
|
|
93
|
+
embedded view (`@if (panels.x) { … }`), the way sections of a real template
|
|
94
|
+
are.
|
|
95
|
+
|
|
96
|
+
**Environment:** Windows 11 Pro, AMD Ryzen 5 7600 (6 cores, 12 threads),
|
|
97
|
+
Node v26.13.0, Go 1.27.4, TypeNative 0.5.0 (unreleased changes), default
|
|
98
|
+
(non-`--release`) build. The binary is 15.3 MB. Node runs the compiler as
|
|
99
|
+
precompiled JavaScript (see [Run it](#run-it)); that build is done once,
|
|
100
|
+
before timing.
|
|
101
|
+
|
|
102
|
+
(a) `ng-compile` (built-in demo template), 30 runs each:
|
|
103
|
+
|
|
104
|
+
| Runtime | min | median | mean | max |
|
|
105
|
+
| ---------- | --------- | ----------- | ----------- | ----------- |
|
|
106
|
+
| Node.js | 219.27 ms | 223.39 ms | 223.24 ms | 227.55 ms |
|
|
107
|
+
| TypeNative | 58.18 ms | 60.61 ms | 61.53 ms | 94.50 ms |
|
|
108
|
+
|
|
109
|
+
(b) `ng-compile generated.component.html`, 5 runs per size (medians):
|
|
110
|
+
|
|
111
|
+
| Template | Node.js | TypeNative | TypeNative vs Node |
|
|
112
|
+
| ------------------ | -------- | ---------- | ------------------ |
|
|
113
|
+
| 9 KB, 186 lines | 254 ms | 140 ms | 1.8x faster |
|
|
114
|
+
| 16 KB, 362 lines | 275 ms | 222 ms | 1.2x faster |
|
|
115
|
+
| 32 KB, 706 lines | 316 ms | 392 ms | 1.2x slower |
|
|
116
|
+
| 65 KB, 1,388 lines | 386 ms | 753 ms | 1.9x slower |
|
|
117
|
+
|
|
118
|
+
**Per call, TypeNative is 3.7x faster** (61 ms vs 223 ms, median). Almost
|
|
119
|
+
all of both times is fixed: a one-line template takes about as long. Node
|
|
120
|
+
spends it loading and evaluating the compiler's 233 modules before it
|
|
121
|
+
compiles anything. The native binary's 60 ms is mostly the compiler's own
|
|
122
|
+
module setup, such as the DOM schema and entity tables.
|
|
123
|
+
|
|
124
|
+
**On large templates the native binary loses its lead at about 25 KB.** Past
|
|
125
|
+
startup, compiling costs about 11 ms per KB natively against about 2–3 ms per
|
|
126
|
+
KB under V8's JIT, so the gap closes as templates grow. Real component
|
|
127
|
+
templates are mostly a few KB, well inside the native binary's lead. In a
|
|
128
|
+
profile of the 64 KB run, about a third of the samples are goroutine handoffs:
|
|
129
|
+
TypeNative runs each generator as a goroutine that passes every value to its
|
|
130
|
+
consumer over a channel, in lockstep, and the compiler iterates its operation
|
|
131
|
+
lists (`OpList`) through generators in each of its 74 phases. Property access
|
|
132
|
+
through reflection on dynamically typed values and garbage collection are the
|
|
133
|
+
next largest costs.
|
|
134
|
+
|
|
135
|
+
A template whose sections all share the root view is another matter: Angular
|
|
136
|
+
copies every `@let` and `#ref` of a view into each of its child views, so with
|
|
137
|
+
hundreds of them at the top level the compile becomes quadratic in both
|
|
138
|
+
runtimes. In this generator without the per-card `@if`, 64 KB took 2.7 s under
|
|
139
|
+
Node and 7.3 s natively.
|