Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
c122a25
Add assert.match, doesNotMatch, and partialDeepStrictEqual
kevinresol Jul 13, 2026
c61d3ad
Add zlib Brotli compress/decompress APIs
kevinresol Jul 13, 2026
6b6fb17
Remove duplicate doesNotMatch declaration
kevinresol Jul 13, 2026
41de359
Add stream.finished/helpers and events utilities
kevinresol Jul 13, 2026
b3e624a
Add missing fs LTS APIs (copyFile, rm, cp, glob, etc.).
kevinresol Jul 13, 2026
4d745a2
Add net BlockList/SocketAddress, buffer utils, cluster aliases
kevinresol Jul 13, 2026
e097cc6
Add Os/Path/Url/Tls LTS constants and helpers
kevinresol Jul 13, 2026
a479946
Expose common crypto RNG, KDF, and FIPS helpers for modern Node.js.
kevinresol Jul 13, 2026
362f92d
Align BrotliOptions with Node.js LTS zlib docs
kevinresol Jul 13, 2026
68f1358
Align stream.finished/helpers and events utils with Node 24 LTS
kevinresol Jul 13, 2026
50e56c8
Align readv/writev buffer typing with Node LTS.
kevinresol Jul 13, 2026
c42934e
Align net/buffer/cluster externs with Node 24 LTS APIs.
kevinresol Jul 13, 2026
96f3942
Align crypto externs with Node.js 24 Active LTS.
kevinresol Jul 13, 2026
4f79cd5
Align TLS CA helpers with Node LTS by adding setDefaultCACertificates.
kevinresol Jul 13, 2026
c2e1665
Add globalThis and structuredClone globals
kevinresol Jul 13, 2026
6a54b1f
Add Event, EventTarget, CustomEvent, DOMException externs
kevinresol Jul 13, 2026
4592f51
Add AbortController and AbortSignal externs
kevinresol Jul 13, 2026
614ac4e
Add fetch, Request, Response, Headers, FormData, Blob, File externs
kevinresol Jul 13, 2026
679c4fd
[ci] Add github action build workflow (#210)
tobil4sk Jul 13, 2026
805d57d
Merge pull request #199 from kevinresol/feat/assert-match-partial
kevinresol Jul 13, 2026
d2d18d5
Merge pull request #200 from kevinresol/feat/zlib-brotli
kevinresol Jul 13, 2026
7f3a07a
Merge pull request #201 from kevinresol/feat/stream-events-utils
kevinresol Jul 13, 2026
2b107e0
Merge pull request #202 from kevinresol/feat/fs-missing-apis
kevinresol Jul 13, 2026
5c87889
Merge pull request #203 from kevinresol/feat/net-buffer-cluster
kevinresol Jul 13, 2026
11a134e
Merge pull request #204 from kevinresol/feat/os-path-url-tls
kevinresol Jul 13, 2026
dac4321
Merge pull request #206 from kevinresol/feat/globals-core
kevinresol Jul 13, 2026
c51c4a0
Merge pull request #207 from kevinresol/feat/globals-events
kevinresol Jul 13, 2026
c498f32
Merge pull request #208 from kevinresol/feat/globals-abort
kevinresol Jul 13, 2026
e92c9fd
Merge pull request #209 from kevinresol/feat/globals-fetch
kevinresol Jul 13, 2026
061469b
Merge pull request #205 from kevinresol/feat/crypto-rng-kdf
kevinresol Jul 13, 2026
c2ebfa5
[ci] Retire Travis and deploy docs from GitHub Actions
kevinresol Jul 13, 2026
988524c
Merge pull request #211 from kevinresol/ci/retire-travis-deploy-gha
kevinresol Jul 13, 2026
26c8cd0
[ci] Use official github pages deployment actions
tobil4sk Jul 13, 2026
9bf2279
Merge pull request #212 from tobil4sk/cleanup-pages
kevinresol Jul 13, 2026
8f683b5
[ci] Add test workflow (#223)
tobil4sk Jul 14, 2026
a72b250
Add diagnostics_channel module externs (#213)
kevinresol Jul 14, 2026
c0e3eef
Add perf_hooks module externs and global performance (#216)
kevinresol Jul 14, 2026
b3d7832
Add Node.js inspector (+ inspector/promises) externs (#218)
kevinresol Jul 14, 2026
55fb01e
Add stream/promises externs (#222)
kevinresol Jul 14, 2026
2bcdccf
Add readline/promises externs (#221)
kevinresol Jul 14, 2026
41d1d68
Add timers/promises externs (#220)
kevinresol Jul 14, 2026
3e56e9f
Add http2 module externs (#217)
kevinresol Jul 14, 2026
66e5c57
Add fs/promises and FileHandle externs (#215)
kevinresol Jul 14, 2026
59b2280
Add dns/promises externs (#219)
kevinresol Jul 14, 2026
79ea682
Add node:test runner externs (#214)
kevinresol Jul 14, 2026
1c0e66b
Audit fs/path/os/zlib for Node 24 and Haxe 4 (#224)
kevinresol Jul 14, 2026
140fa6e
Audit observability/test externs for Node 24 + Haxe 4 (#225)
kevinresol Jul 14, 2026
13aabdd
Align networking externs with Node 24 and drop Haxe 3. (#226)
kevinresol Jul 14, 2026
0704320
Audit process/CLI/VM externs for Node 24 and Haxe 4. (#227)
kevinresol Jul 14, 2026
5279fcb
Audit Section 1 core foundation for Node 24 / Haxe 4+. (#228)
kevinresol Jul 14, 2026
6a7e4c7
Audit js.node.web for Node 24 web globals (#230)
kevinresol Jul 14, 2026
9f01c64
Audit crypto/util/assert/url for Node 24 + Haxe 4 (#229)
kevinresol Jul 14, 2026
6101173
Wire TLSSocket X509Certificate return types to crypto.X509Certificate…
kevinresol Jul 14, 2026
22ec603
Wire stream/Blob/WebSocket APIs to js.node.web types (#232)
kevinresol Jul 14, 2026
e380790
Wire Assert, TextEncoder, and MessagePort transfer typing (#234)
kevinresol Jul 14, 2026
0ac995b
Wire async_hooks and IPC types across events, diagnostics, and proces…
kevinresol Jul 14, 2026
0419c6a
Wire js.Node web globals (fetch, events, storage, …) (#233)
kevinresol Jul 14, 2026
fa32efe
Add replacement strings to bare @:deprecated annotations (#236)
kevinresol Jul 14, 2026
6c1856e
Audit stream externs for Node 24 and Haxe 4.
kevinresol Jul 14, 2026
2a7ee7a
Finish stream closed/errored wiring and Transform flush typing.
kevinresol Jul 14, 2026
35debcf
Fix StreamExample for Writable.end returning this.
kevinresol Jul 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
haxe_ver: [4.0.5, 4.3.7, latest]

steps:
- uses: actions/checkout@v7

- uses: krdlab/setup-haxe@v2
with:
haxe-version: ${{ matrix.haxe_ver }}

- run: haxelib dev hxnodejs .
name: Set haxelib dev path

- run: |
haxe build.hxml
haxelib git dox https://github.com/HaxeFoundation/dox
haxe doc.hxml
name: Build

- name: Upload artifact
if: matrix.haxe_ver == 'latest'
uses: actions/upload-pages-artifact@v3
with:
path: ./bin/api

test:
strategy:
fail-fast: false
matrix:
haxe_ver: [4.3.7, latest]
runner: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7

- uses: krdlab/setup-haxe@v2
with:
haxe-version: ${{ matrix.haxe_ver }}

- uses: actions/setup-node@v4
if: matrix.runner == 'windows-latest'
with:
node-version: 24

- run: haxelib dev hxnodejs .
name: Set haxelib dev path

- name: Get Haxe commit SHA
id: haxe_sha
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(haxe --version)
echo "Haxe version: $version"
short_sha=${version##*+}
full_sha=$(gh api repos/HaxeFoundation/haxe/commits/$short_sha --jq '.sha')
echo "Commit SHA: $short_sha, Full SHA: $full_sha"
echo "sha=$full_sha" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v7
with:
repository: HaxeFoundation/haxe
path: haxe
ref: ${{ steps.haxe_sha.outputs.sha }}

- name: Test
shell: bash
run: |
if [[ "${{ matrix.runner }}" == "macos-latest" ]]; then
echo "" > sys/compile-fs.hxml
fi
haxe --run RunCi js
working-directory: haxe/tests

deploy:
needs: [build, test]
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write

environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Deploy artifact
id: deployment
uses: actions/deploy-pages@v4

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

16 changes: 8 additions & 8 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ Node.js event emitters take strings as event names and don't check listener sign

If you provide an instance of `Event<T>` abstract string type where an event name is expected in any `EventEmitter` method, then the listener type will be unified with `T` and thus provide type checking and inference for the listener function.

We provide [@:enum abstract types](http://haxe.org/manual/types-abstract-enum.html) that enumerate possible event names for a given event emitter. They are implicitly castable to `Event<T>` and can be used for type-checking listener functions as described above. For each `EventEmitter` subclass, an `@:enum abstract` type must be created with a `Event` postfix in its name. For example, if we have a `Process` class which is an `EventEmitter`, it should have a pairing `ProcessEvent` type in its module, i.e.:
We provide [enum abstract types](https://haxe.org/manual/types-abstract-enum.html) that enumerate possible event names for a given event emitter. They are implicitly castable to `Event<T>` and can be used for type-checking listener functions as described above. For each `EventEmitter` subclass, an `enum abstract` type must be created with a `Event` postfix in its name. For example, if we have a `Process` class which is an `EventEmitter`, it should have a pairing `ProcessEvent` type in its module, i.e.:

```haxe
extern class Process extends EventEmitter {
// ...
}

@:enum abstract ProcessEvent<T:haxe.Constraints.Function>(Event<T>) to Event<T> {
enum abstract ProcessEvent<T:haxe.Constraints.Function>(Event<T>) to Event<T> {
var Exit : ProcessEvent<Int->Void> = "exit";
}
```
Expand All @@ -96,7 +96,7 @@ TODO (describe the difference of overloading/optional argument concepts and advi

The whole idea of haxe externs is provide a fully type-checked access to external API. Considering that, we must avoid the need for use `Dynamic` type or `cast` and think of a way to properly express type restrictions.

On the other hand, we want developers to be able to copy-paste node.js code into haxe with minimal modification and have it compiling. For that reason we have to weaken some typing restrictions, for example adding implicit cast `from String` for our `@:enum abstract` types.
On the other hand, we want developers to be able to copy-paste node.js code into haxe with minimal modification and have it compiling. For that reason we have to weaken some typing restrictions, for example adding implicit cast `from String` for our `enum abstract` types.

### Multiple inheritance

Expand Down Expand Up @@ -147,12 +147,12 @@ If a type can be of 3 and more types, nested `EitherType` can be used.

### Constant enumeration

If there's a finite set of posible values for a function argument or object field, [@:enum abstract types](http://haxe.org/manual/types-abstract-enum.html) are used to enumerate those values.
If there's a finite set of posible values for a function argument or object field, [enum abstract types](https://haxe.org/manual/types-abstract-enum.html) are used to enumerate those values.

Example:

```haxe
@:enum abstract SymlinkType(String) from String to String {
enum abstract SymlinkType(String) from String to String {
var File = "file";
var Dir = "dir";
var Junction = "junction";
Expand All @@ -164,10 +164,10 @@ The `to` and `from` implicit cast must be added so user can use both enumeration
Constant names are `UpperCamelCase` and their values are actual values expected by native API.


Note that combined with `haxe.EitherType` (described above), `@:enum abstract`s can handle even complicated cases where a value can be of different types, e.g.
Note that combined with `haxe.EitherType` (described above), `enum abstract`s can handle even complicated cases where a value can be of different types, e.g.

```haxe
@:enum abstract ListeningEventAddressType(haxe.EitherType<Int,String>) to haxe.EitherType<Int,String> {
enum abstract ListeningEventAddressType(haxe.EitherType<Int,String>) to haxe.EitherType<Int,String> {
var TCPv4 = 4;
var TCPv6 = 6;
var Unix = -1;
Expand Down Expand Up @@ -213,4 +213,4 @@ extern class NotSoDeprecated {

## Tricks and hints

TODO (dealing with keywords, `untyped __js__`, inline methods and properties on extern classes)
TODO (dealing with keywords, `js.Syntax.code`, inline methods and properties on extern classes)
4 changes: 4 additions & 0 deletions ImportAll.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class ImportAll {
Context.getType(typePath);
}
}
#if haxe5
Context.onAfterInitMacros(() -> loop([]));
#else
loop([]);
#end
}
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

# Haxe Node.JS

[![Build Status](https://badgen.net/travis/HaxeFoundation/hxnodejs?label=build)](https://travis-ci.org/HaxeFoundation/hxnodejs)
[![Build Status](https://img.shields.io/github/actions/workflow/status/HaxeFoundation/hxnodejs/main.yml?branch=master&label=build)](https://github.com/HaxeFoundation/hxnodejs/actions/workflows/main.yml)
[![Haxelib Version](https://badgen.net/haxelib/v/hxnodejs)](https://lib.haxe.org/p/hxnodejs)
[![Haxelib Downloads](https://badgen.net/haxelib/d/hxnodejs?color=blue)](https://lib.haxe.org/p/hxnodejs)
[![Haxelib License](https://badgen.net/haxelib/license/hxnodejs)](LICENSE.md)

Extern type definitions for Node.JS. Haxe **3.4** or newer is required.
Extern type definitions for Node.JS. Haxe **4.0** or newer is required.
Targeted at **Node.js 24** Active LTS APIs (bindings may lag behind edge cases).

Haxe-generated API documentation is available at http://haxefoundation.github.io/hxnodejs/js/Node.html.

Expand Down
9 changes: 0 additions & 9 deletions ci/Config.hx

This file was deleted.

45 changes: 0 additions & 45 deletions ci/DeployGhPages.hx

This file was deleted.

62 changes: 0 additions & 62 deletions ci/Utils.hx

This file was deleted.

2 changes: 0 additions & 2 deletions deploy.hxml

This file was deleted.

13 changes: 7 additions & 6 deletions examples/AssertThrows.hx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#if haxe4
import js.lib.Error;
import js.lib.RegExp;
#else
import js.Error;
import js.RegExp;
#end
import js.node.Assert;

class AssertThrows {
static function main() {
Assert.throws(function() throw new Error("Wrong value"), Error);
Assert.throws(function() throw new Error("Wrong value"), new RegExp("value"));
Assert.throws(function() throw new Error("Wrong value"), function(err) return (Std.is(err, Error) && ~/value/.match(err.message)), "unexpected error");
Assert.throws(function() throw new Error("Wrong value"), function(err)
return switch Std.downcast(cast err, Error) {
case null: false;
case e: ~/value/.match(e.message);
},
"unexpected error"
);
}
}
3 changes: 2 additions & 1 deletion examples/StreamExample.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class StreamExample {
} catch (er:Error) {
// uh oh! bad json!
res.statusCode = 400;
return res.end('error: ' + er.message);
res.end('error: ' + er.message);
return;
}

// write back something interesting to the user:
Expand Down
2 changes: 1 addition & 1 deletion haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Extern definitions for node.js",
"license": "MIT",
"version": "12.2.0",
"releasenote": "Update some API, fix some deprecation warnings.",
"releasenote": "Node.js 24 Active LTS audit ongoing; Haxe 4.0+ only.",
"classPath": "src",
"contributors": ["nadako", "Simn", "Gama11", "HaxeFoundation"],
"tags": ["js", "nodejs", "async", "net", "web", "extern"]
Expand Down
Loading
Loading