typenative 0.4.1 → 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 +442 -1
- package/CONTRIBUTION.md +2 -1
- package/README.md +73 -25
- package/bin/cli.js +2 -0
- package/bin/index.js +75 -5
- package/bin/main.js +2 -0
- package/bin/node/assert.js +2 -2
- package/bin/node/async_hooks.js +1 -1
- package/bin/node/buffer.js +16 -5
- package/bin/node/child_process.js +7 -7
- package/bin/node/cluster.js +3 -3
- package/bin/node/core.js +41 -0
- package/bin/node/crypto_keys.js +21 -21
- package/bin/node/dgram.js +1 -1
- package/bin/node/diagnostics_channel.js +3 -3
- package/bin/node/dns.js +2 -2
- package/bin/node/events.js +18 -13
- package/bin/node/fetch.js +2 -2
- package/bin/node/fs.js +3 -3
- package/bin/node/fs_watch.js +5 -5
- package/bin/node/http.js +3 -3
- package/bin/node/http2.js +3 -3
- package/bin/node/net.js +8 -8
- package/bin/node/path.js +17 -3
- package/bin/node/process.js +47 -11
- package/bin/node/punycode.js +2 -2
- package/bin/node/readline.js +1 -1
- package/bin/node/registry.js +4 -1
- package/bin/node/sqlite.js +6 -6
- package/bin/node/stream.js +81 -15
- package/bin/node/stream_web.js +10 -10
- package/bin/node/system_extra.js +3 -3
- package/bin/node/test.js +674 -366
- package/bin/node/test_coverage.js +187 -0
- package/bin/node/test_report.js +1392 -0
- package/bin/node/test_run.js +575 -0
- package/bin/node/timers.js +8 -6
- package/bin/node/tls.js +5 -5
- package/bin/node/url.js +1 -1
- package/bin/node/util.js +31 -7
- package/bin/node/util_extra.js +7 -7
- package/bin/node/webview.js +654 -0
- package/bin/node/worker_threads.js +1 -1
- package/bin/node/zlib.js +3 -3
- package/bin/parse-node.js +6 -2
- package/bin/regex_vm.js +2057 -0
- package/bin/transpiler.js +32872 -11265
- package/bin/typecheck-node.js +2 -1
- package/bin/version.js +1 -1
- package/conformance.md +515 -345
- package/examples/README.md +71 -11
- 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 +106 -0
- package/examples/desktop-notes/bench.mjs +125 -0
- package/examples/desktop-notes/main.ts +131 -0
- package/examples/desktop-notes/package-lock.json +726 -0
- package/examples/desktop-notes/package.json +9 -0
- package/examples/desktop-notes/ui.ts +176 -0
- package/examples/dupe-finder/README.md +78 -0
- package/examples/dupe-finder/bench.mjs +120 -0
- package/examples/dupe-finder/main.ts +87 -0
- 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 +63 -0
- package/examples/mandelbrot-png/bench.mjs +95 -0
- package/examples/mandelbrot-png/main.ts +98 -0
- package/examples/mandelbrot-png/preview.png +0 -0
- package/examples/marked-cli/README.md +160 -0
- package/examples/marked-cli/bench.mjs +178 -0
- package/examples/marked-cli/main.ts +292 -0
- package/examples/marked-cli/parity.mjs +185 -0
- package/examples/marked-cli/vendor/marked/LICENSE +44 -0
- package/examples/marked-cli/vendor/marked/VENDOR.md +26 -0
- 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 +69 -0
- package/examples/todo-cli/bench.mjs +89 -0
- package/examples/todo-cli/main.ts +92 -0
- package/examples/yaml-cli/README.md +146 -0
- package/examples/yaml-cli/bench.mjs +265 -0
- package/examples/yaml-cli/main.ts +29 -0
- package/examples/yaml-cli/parity.mjs +156 -0
- package/examples/yaml-cli/vendor/yaml/LICENSE +13 -0
- package/examples/yaml-cli/vendor/yaml/VENDOR.md +25 -0
- package/govendor/github.com/jchv/go-webview2/LICENSE +22 -0
- package/govendor/github.com/jchv/go-webview2/README.md +21 -0
- package/govendor/github.com/jchv/go-webview2/common.go +84 -0
- package/govendor/github.com/jchv/go-webview2/go.mod +3 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32.go +194 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32_386.go +14 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32_64bit.go +15 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_COLOR.go +8 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND.go +9 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_KEY_EVENT_KIND.go +10 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_MOVE_FOCUS_REASON.go +9 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_PHYSICAL_KEY_STATUS.go +10 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_WEB_RESOURCE_CONTEXT.go +23 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventArgs.go +78 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventHandler.go +52 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller.go +132 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller2.go +74 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2CreateCoreWebView2ControllerCompletedHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventArgs.go +17 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Settings.go +270 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequest.go +43 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventArgs.go +51 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceResponse.go +21 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_2.go +21 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_3.go +60 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebViewSettings.go +396 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium.go +361 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_386.go +24 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_amd64.go +22 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_arm64.go +26 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc.go +13 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go17.go +51 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go18.go +16 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/corewebview2.go +411 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/guid.go +223 -0
- package/govendor/github.com/jchv/go-webview2/webview.go +482 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/README.md +3 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module.go +153 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_386.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_amd64.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_arm64.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/arm64/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x64/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x86/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-winloader/LICENSE.md +7 -0
- package/govendor/github.com/jchv/go-winloader/README.md +124 -0
- package/govendor/github.com/jchv/go-winloader/common.go +11 -0
- package/govendor/github.com/jchv/go-winloader/go.mod +3 -0
- package/govendor/github.com/jchv/go-winloader/internal/loader/loader.go +25 -0
- package/govendor/github.com/jchv/go-winloader/internal/loader/machine.go +53 -0
- package/govendor/github.com/jchv/go-winloader/internal/memloader/cache.go +42 -0
- package/govendor/github.com/jchv/go-winloader/internal/memloader/loader.go +253 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/export.go +76 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/format.go +522 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/import.go +106 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/module.go +91 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/reloc.go +177 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/util.go +40 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/common.go +55 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_other.go +71 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_windows.go +179 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_other.go +17 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_windows.go +73 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/loader_windows.go +64 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/machine_windows.go +32 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_386.go +9 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_amd64.go +9 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_arm64.go +9 -0
- package/govendor/github.com/jchv/go-winloader/loader_other.go +24 -0
- package/govendor/github.com/jchv/go-winloader/loader_windows.go +33 -0
- package/govendor/manifest.txt +3 -1
- 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 +5 -0
- package/types/typenative-npm.d.ts +193 -4
- package/types/typenative.d.ts +138 -41
package/.github/workflows/ci.yml
CHANGED
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
|
|
18
18
|
- uses: actions/setup-node@v4
|
|
19
19
|
with:
|
|
20
|
-
node-version:
|
|
20
|
+
node-version: 26
|
|
21
21
|
cache: npm
|
|
22
22
|
|
|
23
23
|
- uses: actions/setup-go@v5
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
|
|
47
47
|
- uses: actions/setup-node@v4
|
|
48
48
|
with:
|
|
49
|
-
node-version:
|
|
49
|
+
node-version: 26
|
|
50
50
|
cache: npm
|
|
51
51
|
|
|
52
52
|
- uses: actions/setup-go@v5
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
- uses: actions/checkout@v4
|
|
25
25
|
- uses: actions/setup-node@v4
|
|
26
26
|
with:
|
|
27
|
-
node-version:
|
|
27
|
+
node-version: 26
|
|
28
28
|
- uses: actions/setup-go@v5
|
|
29
29
|
with:
|
|
30
30
|
go-version: '1.26'
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
|
|
66
66
|
- uses: actions/setup-node@v4
|
|
67
67
|
with:
|
|
68
|
-
node-version:
|
|
68
|
+
node-version: 26
|
|
69
69
|
registry-url: https://registry.npmjs.org/
|
|
70
70
|
|
|
71
71
|
# Trusted Publishing (OIDC) requires npm >= 11.5.1 — ensure we have it
|
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,448 @@ All notable changes to TypeNative will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [0.6.0] - 2026-11-13
|
|
9
|
+
|
|
10
|
+
The React Compiler itself (`babel-plugin-react-compiler` + Babel + zod, ~470 vendored files)
|
|
11
|
+
compiles React components and hooks to their auto-memoized form, natively, and an
|
|
12
|
+
OpenAI-compatible chat client streams answers token by token. Getting there drove the round's
|
|
13
|
+
transpiler fixes: JS object identity and callee write-back across Go conversions, one
|
|
14
|
+
backtracking regex VM with JS semantics for every pattern, and module initialization in the
|
|
15
|
+
import graph's evaluation order. TypeNative now requires Node.js 26. A `--profile` flag
|
|
16
|
+
and two rounds of hot-path fixes (bitwise and `%` arithmetic, generators, Map / Set deletes,
|
|
17
|
+
class dispatch, async functions and `JSON.parse`) narrow the gap with Node on the large
|
|
18
|
+
examples: react-compiler runs 26% faster at 64 KB and angular-templates 17% faster.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`--profile`:** the built program writes a CPU profile (`runtime/pprof`) to
|
|
23
|
+
`$TYPENATIVE_CPUPROFILE` (default `cpu.pprof`) when it exits, on every exit
|
|
24
|
+
path, for `go tool pprof`
|
|
25
|
+
- **Performance probes:** `num-bitwise`, `num-mod-int`, `map-delete`,
|
|
26
|
+
`gen-for-of`, `str-short-scan`, `str-concat-plus`, `regex-site`,
|
|
27
|
+
`events-emit`, `async-await` and `exc-throw-rare`, covering what the large
|
|
28
|
+
examples stress; `performance/README.md` lists each fixed and open cause
|
|
29
|
+
- **examples/react-compiler:** the React Compiler (`babel-plugin-react-compiler` + Babel 7.29 parser/traverse/generator + zod 4, ~470 vendored files) compiling
|
|
30
|
+
React components and hooks to their auto-memoized form, natively. The build
|
|
31
|
+
drove a series of transpiler and runtime fixes (below); every fixture in
|
|
32
|
+
`parity.mjs` — components, hooks, the compiler's pragmas, JSX outlining,
|
|
33
|
+
TypeScript syntax and the error paths — now matches Node byte for byte,
|
|
34
|
+
output, `// CompileSuccess` counts and error code frames included, and
|
|
35
|
+
`bench.mjs` reports per-call latency and scaling
|
|
36
|
+
- **JS object and array identity across Go conversions:** converting one
|
|
37
|
+
object to another struct type gives the same converted object every time
|
|
38
|
+
(Set / Map keys and `===` find it), and union and intersection members are
|
|
39
|
+
views of the same memory; arrays stay shared through any-typed fields,
|
|
40
|
+
getters, dynamic calls and `splice`; a callee's changes to a converted
|
|
41
|
+
argument — an array, a Map or Set, an object's fields, through an
|
|
42
|
+
override too — are written back to the caller's; `slice` copies
|
|
43
|
+
- **JS semantics at the edges:** object-literal getters stay live (also when
|
|
44
|
+
a function returns the literal as `{ value: T }`); `Object.prototype`
|
|
45
|
+
methods read as values (`const toString = {}.toString`) run through
|
|
46
|
+
`call` / `apply`; default parameters apply to an explicit or forwarded
|
|
47
|
+
`undefined`; `null` stays apart from `undefined` where a function tests
|
|
48
|
+
both; Map misses and unset optional enum fields fall back with `??`; keys
|
|
49
|
+
written as `undefined` are own keys for `Object.keys`; `x.at(i)` and
|
|
50
|
+
`?.push` work on arrays held as any
|
|
51
|
+
- **Regex `v` flag (`unicodeSets`):** the backtracking VM now reads v-flag
|
|
52
|
+
class set expressions: subtraction (`[\p{L}--[aeiou]]`), intersection
|
|
53
|
+
(`[\p{Lu}&&[A-F]]`), nested and negated classes, and `\q{…}` strings, which
|
|
54
|
+
are tried longest first. With `i`, each operand is case-folded before the set
|
|
55
|
+
operation, as in JS. `v` implies unicode mode, and `re.unicodeSets` reports
|
|
56
|
+
the flag. Until now these patterns went to RE2, which misread the class and
|
|
57
|
+
matched the wrong text. Properties of strings (`\p{RGI_Emoji}`) aren't
|
|
58
|
+
supported.
|
|
59
|
+
- **examples/openai-chat:** a chat client for any OpenAI-compatible
|
|
60
|
+
`/v1/chat/completions` API. Answers stream into the terminal token by token:
|
|
61
|
+
`fetch` with a streaming response body (`response.body.getReader()`),
|
|
62
|
+
hand-parsed server-sent events (`data:` lines, `[DONE]`, ignored keep-alive
|
|
63
|
+
comments), an `AbortController` timeout, Ctrl+C aborting the answer in flight,
|
|
64
|
+
and a `for await` readline REPL with `/clear` and `/system`. Targets the free
|
|
65
|
+
OpenRouter API by default (`google/gemma-4-31b-it:free`), and OpenAI, Ollama
|
|
66
|
+
or any other compatible server through `--base-url`. `bench.mjs` stands up a
|
|
67
|
+
local mock SSE API, checks Node and TypeNative stdout byte for byte, then
|
|
68
|
+
times full one-shot runs (1.2x faster per answer, 716 vs 875 ms median — both
|
|
69
|
+
runtimes mostly wait on the mock's paced chunks). The example works around
|
|
70
|
+
two catch-block sharp edges (`return`/`continue` inside `catch` compiles
|
|
71
|
+
wrong or not at all), documented in its README
|
|
72
|
+
- **conformance:** `lib-regex-engine`, `lib-string-long-slices` and
|
|
73
|
+
`semantics-dynamic-field-access`, with expected values checked against Node
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
|
|
77
|
+
- **Node 26 and ES2025:** TypeNative now requires Node.js 26 or newer
|
|
78
|
+
(`engines`), and CI runs on Node 26. Scaffolded projects (`--new`) and the
|
|
79
|
+
default type-check (no `tsconfig.json`) target `es2025` instead of `es2020`,
|
|
80
|
+
so target-gated syntax such as the regex `v` flag, regex modifiers and
|
|
81
|
+
duplicate named groups type-checks. `useDefineForClassFields: false` is set
|
|
82
|
+
alongside it to keep TypeScript's classic field order (parameter properties
|
|
83
|
+
before field initializers), which is what TypeNative compiles. Existing
|
|
84
|
+
projects that keep `target: es2020` are unaffected.
|
|
85
|
+
- **Regex engine:** every `TnRegex` now runs on one backtracking VM with JS
|
|
86
|
+
semantics (`src/regex_vm.ts`), replacing the closure-based backtracker and RE2
|
|
87
|
+
as the first choice. Programs compile lazily and once per pattern and flags. A
|
|
88
|
+
match allocates only its result, and first-byte sets, literal prefixes and
|
|
89
|
+
anchors reject most calls without running anything. RE2 stays as a fallback
|
|
90
|
+
for patterns it can run that exhaust the VM's step budget, so those keep their
|
|
91
|
+
linear-time guarantee. Regex literals used inline get the same engine; only
|
|
92
|
+
Node built-ins' arguments and `/(?<name>…)/.exec(s)` stay on plain RE2
|
|
93
|
+
- **Dynamic values:** property reads and writes on objects held as any go through
|
|
94
|
+
plans cached per type and key instead of reflection; a read consumed on the
|
|
95
|
+
spot doesn't box its value; `obj.list.push(x)` appends in place instead of
|
|
96
|
+
converting the array on every push; object-type conversions are compiled per
|
|
97
|
+
pair of types; `Object.assign` between objects uses the same plans; `switch`
|
|
98
|
+
on a dynamic value over string literals is a Go string switch
|
|
99
|
+
- **Strings:** long strings grown with `+=` on a dynamic value are amortized;
|
|
100
|
+
short ASCII strings need no code-point index
|
|
101
|
+
- **Performance:** on 10 MB of input, examples/marked-cli went from 5.5x to 1.6x
|
|
102
|
+
slower than Node and examples/yaml-cli from 3.8x to 1.9x (the native binary
|
|
103
|
+
now finishes first up to about 1–2 MB per run), and marked's ReDoS inputs from
|
|
104
|
+
over 72 s to 4.7 s in total
|
|
105
|
+
- **Hot paths:** bitwise operators no longer call `math.Mod` (`TnInt32`
|
|
106
|
+
converts in-range values directly, literal operands fold, nested bitwise
|
|
107
|
+
expressions stay int32); `%` on integers is an `int64` remainder; a sync
|
|
108
|
+
generator iterated by `for…of` runs as a Go range function instead of a
|
|
109
|
+
goroutine in lockstep (break and throw keep JS's `finally` / `catch`
|
|
110
|
+
semantics); `Map` / `Set` deletes are O(1) and key handling takes no
|
|
111
|
+
reflection; `s = s + …` appends in place like `s += …`; `charCodeAt` over
|
|
112
|
+
short strings no longer rescans the string; `toFixed` skips exact
|
|
113
|
+
1100-digit formatting except on ties; any-typed objects read their map
|
|
114
|
+
first; `Record<string, any>` views of an any object share its map;
|
|
115
|
+
common listener shapes are called without reflection; regex literals
|
|
116
|
+
share their compiled program per site. Probe medians: bitwise 2160 →
|
|
117
|
+
129 ms, `%` loops 4527 → 162 ms, generators 1843 → 12 ms (now 4.4x faster
|
|
118
|
+
than Node), `Set` churn 1556 → 97 ms. examples/react-compiler at 64 KB
|
|
119
|
+
runs 26% faster (7.5 s → 5.6 s, interleaved against the previous build)
|
|
120
|
+
- **Dispatch, async and JSON hot paths:** a generator method called on a
|
|
121
|
+
value typed as a base class or interface (`unit.ops()`) runs its push form
|
|
122
|
+
through `TnCallSeq_<m>`, lazily as JS does (it used to collect every value
|
|
123
|
+
before the loop ran), and spread / `Array.from` of a generator collect its
|
|
124
|
+
push form into a typed slice; a method call through a class or interface
|
|
125
|
+
hierarchy whose implementations share a signature goes through a typed
|
|
126
|
+
dispatcher, without boxing; async functions that never wait on anything
|
|
127
|
+
pending run on the caller's goroutine, and settling a promise no longer
|
|
128
|
+
allocates when nobody waits; `JSON.parse(text) as T[]` decodes straight
|
|
129
|
+
into `T` when the text matches it; `for` loop counters and bitwise-result
|
|
130
|
+
consts are Go integers. Probe medians: `async-await` 1985 → 201 ms,
|
|
131
|
+
`class-dispatch` 709 → 124 ms, `json-roundtrip` 347 → 97 ms, `num-bitwise`
|
|
132
|
+
128 → 114 ms; examples/angular-templates at 64 KB runs 17% faster (721 →
|
|
133
|
+
601 ms, interleaved against the previous build)
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
|
|
137
|
+
- **`null` is not `undefined`:** `typeof null` is `"object"` (it gave
|
|
138
|
+
`"undefined"`), `String(null)` and `null` in `+` / template strings give
|
|
139
|
+
`"null"` (`String(null)` printed `<nil>`), and `null` declared or assigned
|
|
140
|
+
into an `any` / `unknown` variable stays JS null
|
|
141
|
+
- **Classes with `*[Symbol.iterator]()`:** instances destructure
|
|
142
|
+
(`const [a, b] = bag`, reading only as many values as are bound, so an
|
|
143
|
+
endless iterator ends and its `finally` runs), spread into call and `new`
|
|
144
|
+
arguments (`Math.max(...bag)`, `f(...bag)`), and `bag[Symbol.iterator]()`
|
|
145
|
+
is a generator of its own; subclasses inherit all of it. Spreads that are
|
|
146
|
+
not the only argument of a rest parameter (`f(1, ...xs, 2)`,
|
|
147
|
+
`f(...xs, ...ys)`) now compile, for arrays too
|
|
148
|
+
- **Spread of a generator into arguments:** `f(...gen())` into a rest
|
|
149
|
+
parameter failed to compile, and `xs.push(...unit.ops())` through a
|
|
150
|
+
dynamic receiver asserted the generator's channel to an array
|
|
151
|
+
- **`(-Infinity).toFixed(n)`** returns `"-Infinity"` (it printed `-Inf`)
|
|
152
|
+
|
|
153
|
+
- **Namespaces of types only:** `namespace Tokens { export interface Def … }`
|
|
154
|
+
is flattened like any namespace (`Tokens_Def`) instead of being dropped, so
|
|
155
|
+
`Tokens.Def` resolves to its declaration (an unmatched regex group stored in
|
|
156
|
+
one of its `string` fields stays `undefined` and `JSON.stringify` leaves it
|
|
157
|
+
out: marked's `--tokens` printed `"title": ""` for a link definition without
|
|
158
|
+
a title). Only type references `Ns.T` are rewritten for such a namespace, so
|
|
159
|
+
a class merged with it keeps its value reads (`Scope.x`, `typeof Scope.x`)
|
|
160
|
+
|
|
161
|
+
- **Converting an object to a wider struct no longer reads or writes past
|
|
162
|
+
it:** a conversion whose source struct's fields are a prefix of the
|
|
163
|
+
target's (a member held in a merged union's slot) used to view the source's
|
|
164
|
+
memory as the target, so the target's extra fields lay past the object — in
|
|
165
|
+
the next object, or in size-class slack the garbage collector doesn't scan
|
|
166
|
+
for pointers. Such a view is now made only where the object's memory is
|
|
167
|
+
known to cover the target: a union narrowed to a member and widened back,
|
|
168
|
+
or an object literal allocated union-sized (an object literal whose struct
|
|
169
|
+
is a strict prefix of merged unions now gets room for their fields, with
|
|
170
|
+
the pointer layout they share, so a member held in a union's slot stays the
|
|
171
|
+
one object). Every other such conversion copies, through the identity
|
|
172
|
+
cache. (A literal's struct read as the interface it matches plus the
|
|
173
|
+
interface's key list `__keys` read the key list from whatever followed
|
|
174
|
+
the literal: `JSON.stringify` crashed on marked's table cells)
|
|
175
|
+
- **Module initialization order:** a program's module-level code now runs in
|
|
176
|
+
the import graph's evaluation order, as JS evaluates it — each module after
|
|
177
|
+
the modules it imports, with an import cycle's back edge not waiting (the
|
|
178
|
+
way Node starts evaluating a cycle mid-way through a module). It used to be
|
|
179
|
+
the emission order, which a cycle (the React Compiler's entrypoint barrels,
|
|
180
|
+
zod's) evaluates differently, leaving re-exported values uninitialized.
|
|
181
|
+
Imports whose bindings the code never uses as values — which tsc's emit
|
|
182
|
+
elides — no longer order inits either
|
|
183
|
+
- **`new F(…)` on a constructor-function value** now has JS `new` semantics:
|
|
184
|
+
the function runs with `this` a fresh object, which it may return or fill
|
|
185
|
+
(zod's `$constructor` factories read `this`); it used to be a plain call,
|
|
186
|
+
so a function reading `this` saw nothing
|
|
187
|
+
- **`fn.bind(…)` on a function value held as any** returns a bound function
|
|
188
|
+
(with the bound `this` and prepended arguments) instead of failing with
|
|
189
|
+
"bind is not a function"
|
|
190
|
+
- **`Object.assign(fn, props)`** copies the properties onto the function
|
|
191
|
+
value, where `fn.prop` reads them, instead of dropping them
|
|
192
|
+
- **`C.prototype[k] = fn` with a computed key** adds the method to the
|
|
193
|
+
class's prototype (its instances call it with `this` the instance) instead
|
|
194
|
+
of failing
|
|
195
|
+
- **A dynamic array method whose name a class or object literal declares
|
|
196
|
+
too** (`values.map(…)` beside a `Result.map`) runs the array method on
|
|
197
|
+
arrays and dispatches to the class on class instances, decided at run time
|
|
198
|
+
- **`x ??= v` on a nullable array variable** tests the reference itself
|
|
199
|
+
instead of dereferencing it, which panicked when it was unset
|
|
200
|
+
- **An empty object literal (`{}`) is no longer a zero-size Go value** — Go
|
|
201
|
+
gives every zero-size value the same address, which made every `{}` in a
|
|
202
|
+
program one shared object (each zod schema's internals landed in one place,
|
|
203
|
+
every schema reading the last-written definition)
|
|
204
|
+
- **Properties set on dynamic objects** are keyed by the object itself, so a
|
|
205
|
+
garbage-collected object's address being reused cannot hand its properties
|
|
206
|
+
to the new object
|
|
207
|
+
- **`Object.assign`/spread into a fresh object** skips a struct's internal
|
|
208
|
+
`__`-prefixed fields
|
|
209
|
+
- **A property assigned a value its field's Go type can't hold** now replaces
|
|
210
|
+
the property, as in JS: the field reads as undefined and the value is kept
|
|
211
|
+
beside the object (`Object.defineProperty`-style visitors — Babel's traverse
|
|
212
|
+
`explode` replaces a visitor function with `{ enter: fn }`) instead of
|
|
213
|
+
leaving the stale value readable and dropping the assignment. Reads fall
|
|
214
|
+
through a nil reference field to what was set beside the object, and
|
|
215
|
+
`Object.defineProperty` with a getter/setter now defines a real accessor on
|
|
216
|
+
class instances too (Babel's ParseError computes its `message` in a getter
|
|
217
|
+
that self-assigns); it used to silently support them only on dynamic objects
|
|
218
|
+
- **A call's argument converted to a copy the callee changes** is written back
|
|
219
|
+
at every statement position (plain calls, `x = f(op)`, `const x = f(op)`,
|
|
220
|
+
`return f(op)`), including arguments written `node as SomeType` and calls
|
|
221
|
+
through a mixin's virtual table, when the callee mutates the parameter's
|
|
222
|
+
fields — directly or by passing it on to a function that does. The fields it
|
|
223
|
+
changes are copied back to the original object, and ones the original's type
|
|
224
|
+
has no slot for are kept beside it (Babel's parser passes its nodes between
|
|
225
|
+
`parseExport`/`maybeParseExportDeclaration` and reads the fields back on the
|
|
226
|
+
original); the copy's changes used to be lost, emptying the parse result
|
|
227
|
+
- **`arr.push(x)` on an array read out of a container** (`aliases[k].push(x)`,
|
|
228
|
+
a Map's array value) stores the appended array back into the container, as
|
|
229
|
+
push mutates it in JS; it used to append to a copy and drop it, which left
|
|
230
|
+
@babel/types' alias tables empty and its node validators rejecting every node
|
|
231
|
+
- **A class instance passed where an interface type is expected** converts
|
|
232
|
+
with the properties it carries beyond its class filling the interface's
|
|
233
|
+
fields (Babel's parser keeps `imported`/`local` of an import specifier on a
|
|
234
|
+
bare Node); the conversion used to build a zero-filled struct
|
|
235
|
+
- **`f?.call(thisArg, …)` on a function value** calls nothing when f is unset
|
|
236
|
+
(an optional callback parameter's Go func type is nil); it used to deref nil.
|
|
237
|
+
A `do { … = this.parseSubscript(…, state) } while (!state.stop)` also no
|
|
238
|
+
longer loops forever: the state object the callee writes through the
|
|
239
|
+
converted parameter is written back
|
|
240
|
+
- **An intersection type alias** (`ParseResult<File> = File & { … }`) compiles
|
|
241
|
+
to a struct with every member's fields, and an interface renamed for a
|
|
242
|
+
cross-module name collision still resolves its fields (and shadows a Node
|
|
243
|
+
global's type) through the original name — the parser's `File` used to
|
|
244
|
+
convert to a 3-field struct and Node's `File` global type leaked into Babel's
|
|
245
|
+
- **A nullable array parameter with a default** (`tokens: Token[] | null =
|
|
246
|
+
null`) reads as nil when absent instead of dereferencing nil
|
|
247
|
+
- Optional chain calls guard the receiver, and a function's result type drives
|
|
248
|
+
`return f(…)` conversions again after the write-back change
|
|
249
|
+
- **A destructured binding of an object's array field** binds the array
|
|
250
|
+
itself, as in JS: push/pop/splice through it mutate the field's array
|
|
251
|
+
(`const { context } = this.state` then `context.push(…)` in Babel's JSX
|
|
252
|
+
tokenizer); it used to bind a copy and drop every mutation, flattening the
|
|
253
|
+
tokenizer's element context stack
|
|
254
|
+
- **An array stored into a dynamic object is kept as a reference**, as JS
|
|
255
|
+
arrays are shared: a push through any binding of the value reaches the
|
|
256
|
+
object's entry (`(ids[name] = ids[name] || []).push(…)` building Babel
|
|
257
|
+
traverse's Scope binding tables); the push used to append to a copy and
|
|
258
|
+
never register a binding, which rejected every node in Scope's validators.
|
|
259
|
+
`push`/`pop`/`shift`/`unshift` work on such references held as any
|
|
260
|
+
- **`x.push(…)` on an expando-stored array** (a bare parser Node's `body`)
|
|
261
|
+
appends to the array the object holds; it used to append to a copy and drop
|
|
262
|
+
it, which emptied every statement list the compiler's lowering walked
|
|
263
|
+
- **A mixin virtual method call returns its implementations' result** even
|
|
264
|
+
when an abstract declaration types it `: void` (Babel:
|
|
265
|
+
`return this.parseObjPropValue(prop, …)` over an
|
|
266
|
+
`abstract parseObjPropValue(…): void`); the returned node used to be
|
|
267
|
+
dropped, which made the compiler lower every function body to nothing
|
|
268
|
+
- **conformance:parallel:** example builds get the 10-minute budget the
|
|
269
|
+
sequential runner already gave them (the vendored-package examples
|
|
270
|
+
transpile tens of thousands of lines and go build the result — the React
|
|
271
|
+
Compiler example used to be killed at 90 s and reported as a bare `exit 1`),
|
|
272
|
+
and the largest example runs alone before the pack
|
|
273
|
+
- `.`, `^` and `$` follow JS's line terminators in every regex, `[]` and `[^]`
|
|
274
|
+
mean what they do in JS, captures reset on each loop iteration, and `\p` is a
|
|
275
|
+
property only with the `u` flag
|
|
276
|
+
- `\k<name>` in a regex literal panicked in RE2
|
|
277
|
+
- Slices of a long non-ASCII string rebuilt its whole index each time, making a
|
|
278
|
+
lexer over non-ASCII input quadratic
|
|
279
|
+
|
|
280
|
+
## [0.5.0] - 2026-11-01
|
|
281
|
+
|
|
282
|
+
The `yaml` package's own CLI, compiled from its unmodified TypeScript source, as the first
|
|
283
|
+
flagship example: 100% output parity with Node on the yaml-test-suite in all four modes. Getting
|
|
284
|
+
there took transpiler fixes across the board, each with a conformance probe.
|
|
285
|
+
|
|
286
|
+
The second flagship example is the `marked` package's own CLI, compiled from marked's unmodified
|
|
287
|
+
TypeScript source: 100% output parity with Node on marked's spec suites (CommonMark, GFM and its
|
|
288
|
+
own tests, ReDoS inputs included) in three modes. Its fixes are listed under **marked** below.
|
|
289
|
+
|
|
290
|
+
### Added
|
|
291
|
+
|
|
292
|
+
- **Native app windows:** programs can open webview windows through the
|
|
293
|
+
`@webviewjs/webview` API, so the same source runs under Node.js (the npm package) and compiled
|
|
294
|
+
(built in). Windows embeds the system WebView2 through the vendored, pure-Go
|
|
295
|
+
`jchv/go-webview2`; macOS and Linux, and Windows without the WebView2 runtime, open Chrome, Edge
|
|
296
|
+
or Chromium in app mode. No cgo, and cross-compiling still works. The macOS and Linux path builds
|
|
297
|
+
in CI but has not been run on those systems
|
|
298
|
+
- **`--gui`:** builds a windowed app with no console window on Windows (ignored for other targets)
|
|
299
|
+
- **examples/marked-cli:** marked v18.1.2 vendored unpatched (`vendor/marked/VENDOR.md`),
|
|
300
|
+
`main.ts` porting upstream's `bin/main.js`, `parity.mjs` (2,859 cases: marked's commonmark,
|
|
301
|
+
gfm, new, original and redos specs in default, `--no-gfm` and `--tokens` modes, compared byte
|
|
302
|
+
for byte with Node) and `bench.mjs` (per-call latency on marked's README, throughput on ~10 MB
|
|
303
|
+
of generated markdown)
|
|
304
|
+
- **marked:** function declarations inside functions and blocks (hoisted; async and generator
|
|
305
|
+
ones too); `f.apply` / `f.call` on functions held as `any`; `Ns.T` of a namespace another
|
|
306
|
+
module declares; generic interfaces used without type arguments, interfaces extending
|
|
307
|
+
`Omit<>` / `Pick<>` / `Partial<>`, open object types and array types with properties
|
|
308
|
+
(`T[] & { links: L }`); `process.stdout.write(data, callback)`; `split(sep, limit)` with a
|
|
309
|
+
RegExp
|
|
310
|
+
|
|
311
|
+
- **examples/yaml-cli:** yaml v3.0.0-2 vendored unpatched (`vendor/yaml/VENDOR.md`), `main.ts`
|
|
312
|
+
porting upstream's `bin.js`, `parity.mjs` (1,608 cases from yaml-test-suite data-2022-01-17
|
|
313
|
+
in default, `--json`, `valid` and `lex` modes, compared byte for byte with Node) and
|
|
314
|
+
`bench.mjs` (per-call latency on a docker-compose.yml, throughput on ~10 MB of generated
|
|
315
|
+
Kubernetes manifests)
|
|
316
|
+
- `new Map(iterable)` from Maps, iterators, generators and `Object.entries`; plain objects and
|
|
317
|
+
arrays as Map keys and Set members, by identity (they panicked as unhashable); generic type aliases
|
|
318
|
+
(`type WithId<T> = T & { id: number }`); instantiation expressions (`g<number>`) and explicit
|
|
319
|
+
type arguments in call results; `typeof f` as a function type
|
|
320
|
+
- `emitWarning(warning, type)`; `JSON.stringify(buffer)` as `{ type: 'Buffer', data }`
|
|
321
|
+
|
|
322
|
+
### Changed
|
|
323
|
+
|
|
324
|
+
- **examples/desktop-notes:** the UI now opens in a real webview window under both Node.js and
|
|
325
|
+
TypeNative, instead of launching Edge or Chrome with `--app`. Closing the window ends the app
|
|
326
|
+
directly, so the `/api/bye` beacon and the heartbeat timeout are gone. Running it under Node.js
|
|
327
|
+
now needs `npm install` in the example folder
|
|
328
|
+
|
|
329
|
+
### Fixed
|
|
330
|
+
|
|
331
|
+
- **marked — arrays:** arrays are shared as in JS: an object type's array field, an `any[]`
|
|
332
|
+
variable and a parameter holding one array see each other's pushes, also through `any`
|
|
333
|
+
(`tok.tokens.unshift(…)`); a method returning its array argument returns that array
|
|
334
|
+
- **marked — regexes:** JS escapes (`\xHH`, `\u{…}`, `\cJ`, `\p{…}`, `\k<name>`) and JS's
|
|
335
|
+
Unicode `\s` in every pattern, also in the backtracking engine; RegExp values stored in
|
|
336
|
+
objects, built at run time and called through `any`; regexes that look behind the match
|
|
337
|
+
(`^`, `\b`) at a non-zero offset; unmatched groups stay `undefined` through consts,
|
|
338
|
+
conditionals and `string` fields (left out of JSON)
|
|
339
|
+
- **marked — strings and objects:** `toUpperCase` / `toLowerCase` map case as JS does (`ß` →
|
|
340
|
+
`SS`, `İ` → `i̇`, final `ς`); `trim` uses JS's whitespace; `replace` with a `string | RegExp`
|
|
341
|
+
pattern or a function value; JSON key order of object literals that list keys in another
|
|
342
|
+
order than their type; `string | null` fields keep `null` and `undefined` apart (an optional
|
|
343
|
+
one is an any field; a required one is written as `null` by `JSON.stringify`)
|
|
344
|
+
- **marked — type inference:** `let x;` assigned on every path holds its value type; long call
|
|
345
|
+
chains on a fluent builder (`edit(re).replace(…).replace(…)…`) no longer take exponential time
|
|
346
|
+
(inference is memoized per query); module-level names a local shadows; a `for…of` whose body
|
|
347
|
+
never reads its variable compiles
|
|
348
|
+
- **marked — performance:** the regex backtracker works on byte offsets (no rune conversion of
|
|
349
|
+
the input per match), repeats a single character class without allocating and tests ASCII
|
|
350
|
+
against a table; regexes skip ahead with a first-byte prefilter (an anchored one fails at
|
|
351
|
+
once) instead of running RE2 over the rest of a long input; strings built with `+=` in a loop
|
|
352
|
+
are `strings.Builder`s. Rendering is now linear in the input
|
|
353
|
+
- **marked — self-hosting:** the native compiler builds and `npm run bootstrap:check` holds
|
|
354
|
+
with this round's changes: a function literal stored where a function type is expected takes
|
|
355
|
+
that type's (plain slice) array parameters, and a function value with array-reference
|
|
356
|
+
parameters is adapted where plain slices are expected; a string-method name that some object
|
|
357
|
+
literal's function also has (`x.startsWith(…)` on an any value) runs the string method on a
|
|
358
|
+
string; functions in a `Record<K, F>` dictionary no longer count as such methods; a `+=`
|
|
359
|
+
string accumulator used in a closure stays a plain string
|
|
360
|
+
- **Regexes:** unmatched groups are `undefined`; `new RegExp(src, 'g' | 'y')` keeps its flags;
|
|
361
|
+
`$&`, `` $` ``, `$'`, `$<name>` and `$$` replacements; replacer callbacks get the match offset
|
|
362
|
+
and the input
|
|
363
|
+
- **Objects:** `Object.assign({}, typed, overrides)` keeps the type and its function fields, and
|
|
364
|
+
an explicit `undefined` override clears; integer-like keys of plain objects come first;
|
|
365
|
+
`x.constructor` on any values; `null` in JSON and `any` data stays `null` (not `undefined`)
|
|
366
|
+
- **Classes:** a class picked at run time or passed as `new (…) => T` constructs; `this.name` in
|
|
367
|
+
an Error subclass; optional array parameters passed on to defaulted ones (`super(items)`);
|
|
368
|
+
`x as unknown as T[]` returns the value as is
|
|
369
|
+
- **Numbers:** `toFixed` rounds ties away from zero, also on `any` values and in callbacks
|
|
370
|
+
- **Control flow:** `for (; …; a, b)` with no initializer; function properties assigned twice;
|
|
371
|
+
unread `for (const [k, v] of map)` bindings; `instanceof Date` narrowing
|
|
372
|
+
- **Type inference:** user-defined type guards (`(t): t is string`) narrow their argument; a
|
|
373
|
+
conditional's branches are typed with the condition's narrowing; array callbacks' locals are
|
|
374
|
+
typed from their own declarations; `o?.m()` and `o?.push(x)` on any values don't call through
|
|
375
|
+
a nullish `o`; `flatMap` callbacks returning any values; a function declared to return
|
|
376
|
+
`T[] | undefined` keeps `undefined` (it was an empty array); `xs[i] ?? d` over
|
|
377
|
+
`(T | undefined)[]` elements; object literals assigned into any
|
|
378
|
+
slots stay extensible
|
|
379
|
+
- **Self-hosting:** the native compiler builds again (`npm run build:native`; it also failed on
|
|
380
|
+
0.4.2's coverage code) and `npm run bootstrap:check` holds: it turns its own source into the
|
|
381
|
+
same Go as the Node CLI. The compiler's code no longer reads missing `Map` / `Record` keys
|
|
382
|
+
as `undefined` (natively they read as `''`)
|
|
383
|
+
- **Performance:** string positions on long inputs no longer rebuild their code-point index per
|
|
384
|
+
regex match (quadratic lexing); struct field lookups and struct-to-struct copies are cached
|
|
385
|
+
|
|
386
|
+
## [0.4.2] - 2026-10-28
|
|
387
|
+
|
|
388
|
+
`node:test` reporters, `run()`, coverage, snapshots and member mocks; four runnable examples
|
|
389
|
+
with Node-vs-TypeNative benchmarks, examples type-checked and built by the conformance suite,
|
|
390
|
+
and compiler fixes for names that shadow Go types, rest destructuring, number formatting, and
|
|
391
|
+
`Number()` on optional values.
|
|
392
|
+
|
|
393
|
+
### Added
|
|
394
|
+
|
|
395
|
+
- **`node:test`:**
|
|
396
|
+
- `run({ files })`: files with literal paths compile in as entry points and run as child
|
|
397
|
+
processes; their events stream back on a TestsStream — top-level numbering continues across
|
|
398
|
+
files, child output becomes `test:stdout` / `test:stderr`, per-file summaries and coverage
|
|
399
|
+
merge, and listeners get typed data (`run(…).on('test:fail', (data) => …)`)
|
|
400
|
+
- coverage with `--experimental-test-coverage`: programs that import `node:test` count what
|
|
401
|
+
runs over V8-style source ranges (functions, blocks, ternary arms, `&&` / `||` / `??`
|
|
402
|
+
operands, class field initializers), with `node:coverage ignore` comments, `--test-coverage-include` /
|
|
403
|
+
`-exclude` and the `-lines` / `-branches` / `-functions` thresholds; the lcov records and
|
|
404
|
+
the tap / spec coverage table match Node's output
|
|
405
|
+
- snapshots: `t.assert.snapshot` / `t.assert.fileSnapshot` with `--test-update-snapshots`
|
|
406
|
+
(Node's `<test file>.snapshot` format), `snapshot.setDefaultSnapshotSerializers` /
|
|
407
|
+
`setResolveSnapshotPath`; a missing file or entry names the update flag
|
|
408
|
+
- `mock.method` / `mock.getter` / `mock.setter` on object literals, class instances
|
|
409
|
+
(inherited members included, other instances unaffected) and namespace functions
|
|
410
|
+
(`console.log`, `Math.random`, …); `.mock` reads the call record, `t.mock` restores after
|
|
411
|
+
each test
|
|
412
|
+
- failing tests report their `location` (`file:line:col`) in TAP, spec and junit
|
|
413
|
+
- `--test-reporter-destination` pairs with `--test-reporter` (a file, `stdout` or `stderr`)
|
|
414
|
+
- **`node:test/reporters`:** `tap` / `dot` / `junit` as generator functions over an event
|
|
415
|
+
source (an array, an async generator, a stream such as `run()`'s) and `spec` / `lcov` as
|
|
416
|
+
Transform streams for `compose()` — Node's output, byte for byte
|
|
417
|
+
- **Streams:** `compose()` (pipe into a stream, or hand the source to a function — an async
|
|
418
|
+
generator over the chunks, a reporter), and `.on()` / `.once()` return the stream, for
|
|
419
|
+
chaining as in Node
|
|
420
|
+
- **Types:** `AsyncIterable<T>` / `AsyncIterableIterator<T>` / `AsyncGenerator<T>` map to
|
|
421
|
+
channels (like `Promise<T>`), so async-iterable parameters type-check
|
|
422
|
+
- **Examples:** `todo-cli`, `dupe-finder`, `mandelbrot-png` and `desktop-notes` (a notes app in an
|
|
423
|
+
Edge/Chrome app window), each with a Node-vs-TypeNative benchmark
|
|
424
|
+
- **Conformance:** every `examples/*/main.ts` is type-checked and built by the suite as
|
|
425
|
+
`example-<name>`
|
|
426
|
+
|
|
427
|
+
### Changed
|
|
428
|
+
|
|
429
|
+
- `conformance.md` lists npm packages published only as JavaScript/CommonJS as 🚫 (their
|
|
430
|
+
implementations have no types to compile from), not ❌
|
|
431
|
+
|
|
432
|
+
### Fixed
|
|
433
|
+
|
|
434
|
+
- **Object-literal methods:** reading one as a value (`const f = obj.method`) no longer calls
|
|
435
|
+
it; getters still run on read, including when destructured (`const { double } = calc`)
|
|
436
|
+
- **`node:stream`:** programs that use streams but not `util.inspect` compile again (a
|
|
437
|
+
`compose()` error message referenced `util.inspect`'s helper)
|
|
438
|
+
- **Names:** variables and parameters named like Go types (`string`, `bool`, `int32`, ...) no
|
|
439
|
+
longer shadow the type; methods named like Go builtins (`copy()`, `len()`, `static make`) are
|
|
440
|
+
callable (the declaration was renamed, the call wasn't), and inherited methods named like Go
|
|
441
|
+
keywords (`range()`) compile
|
|
442
|
+
- **Destructuring:** `const [a, ...rest] = arr` gives `rest` the remaining elements (it compiled to
|
|
443
|
+
a single element)
|
|
444
|
+
- **Numbers:** `String(n)`, templates and `JSON.stringify` print non-integers in plain notation
|
|
445
|
+
from `1e-6` up to `1e21` (`1761603012345.678`, not `1.761603012345678e+12`), and exponents
|
|
446
|
+
without padding (`1e-7`, not `1e-07`)
|
|
447
|
+
- **`Number()`:** converts optional strings and booleans (`Number(s)` with `s: string | undefined`
|
|
448
|
+
gave `NaN`)
|
|
449
|
+
- **Conformance:** the detached child-process probe no longer spawns Unix `sleep` on Windows
|
|
9
450
|
|
|
10
451
|
## [0.4.1] - 2026-10-24
|
|
11
452
|
|
package/CONTRIBUTION.md
CHANGED
|
@@ -8,6 +8,7 @@ Thanks for helping build TypeNative — a TypeScript-to-Go transpiler that ships
|
|
|
8
8
|
|
|
9
9
|
- **Add a missing feature** — pick a ❌ row in [conformance.md](conformance.md) and make it ✅.
|
|
10
10
|
- **Fix a bug** — failing probe, wrong Go output, bad error message.
|
|
11
|
+
- **Make a hot path faster** — pick a slow row in [performance/README.md](performance/README.md). Quote `node scripts/performance.mjs <filter>` before and after in the PR, and add a probe if the path you sped up has none.
|
|
11
12
|
- **Improve docs** — README, conformance matrix, code comments.
|
|
12
13
|
- **Report issues** — open an issue with a minimal `.ts` repro, expected vs. actual output, and your `node --version` / `go version`.
|
|
13
14
|
|
|
@@ -114,7 +115,7 @@ npm run bootstrap:check # native/typenative must emit the same Go for sr
|
|
|
114
115
|
node scripts/conformance-parallel.mjs --native # full suite through your new binary
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
CI ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs `npm run build`, `npm run check:go-types` and `npm run conformance:parallel` on Ubuntu, Windows and macOS (Node
|
|
118
|
+
CI ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs `npm run build`, `npm run check:go-types` and `npm run conformance:parallel` on Ubuntu, Windows and macOS (Node 26 + Go 1.26), plus a Linux job that builds the native compiler, runs `npm run bootstrap:check` and the suite through it. Probes that depend on the OS should hold on all three (branch on `process.platform` where Node itself differs). A probe that can't build on one of them (`go:log/syslog` has no Windows build) starts with `// conformance-skip: win32 (reason)`; the runners skip it there and list it.
|
|
118
119
|
|
|
119
120
|
## Pull requests
|
|
120
121
|
|