Skip to content

Commit 6c75aa0

Browse files
Audit remaining top-level js.node externs for Node 24 / Haxe 4 (#272)
* Audit remaining top-level js.node externs for Node 24 / Haxe 4. Fill Report.excludeNetwork and timer Symbol.dispose/toPrimitive APIs, fix Os memory/setPriority typing, and modernize finals, named function types, docs, and copyright headers across the loose modules. Co-authored-by: Cursor <cursoragent@cursor.com> * Polish remaining js.node audit docs and deprecations. Add Node.global deprecation, refresh querystring/string_decoder docs links, and tidy SyncCPUProfileHandle / Require / KeyValue formatting. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7557330 commit 6c75aa0

16 files changed

Lines changed: 540 additions & 236 deletions

src/js/Node.hx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C)2014-2020 Haxe Foundation
2+
* Copyright (C)2014-2026 Haxe Foundation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -23,6 +23,7 @@
2323
package js;
2424

2525
import haxe.Constraints.Function;
26+
import haxe.extern.EitherType;
2627
import haxe.extern.Rest;
2728
import js.Syntax.code;
2829
import js.lib.Promise;
@@ -40,7 +41,9 @@ import js.node.web.Response;
4041
import js.node.web.Storage as WebStorage;
4142

4243
/**
43-
Node.js globals
44+
Node.js globals for the current process.
45+
46+
@see https://nodejs.org/docs/latest-v24.x/api/globals.html
4447
**/
4548
@:native("global")
4649
extern class Node {
@@ -69,13 +72,17 @@ extern class Node {
6972

7073
/**
7174
`clearInterval` is described in the [timers](https://nodejs.org/api/timers.html) section.
75+
76+
Accepts a `Timeout` or its primitive coercion value.
7277
**/
73-
static function clearInterval(timeout:Timeout):Void;
78+
static function clearInterval(timeout:EitherType<Timeout, EitherType<Float, String>>):Void;
7479

7580
/**
7681
`clearTimeout` is described in the [timers](https://nodejs.org/api/timers.html) section.
82+
83+
Accepts a `Timeout` or its primitive coercion value.
7784
**/
78-
static function clearTimeout(timeout:Timeout):Void;
85+
static function clearTimeout(timeout:EitherType<Timeout, EitherType<Float, String>>):Void;
7986

8087
/**
8188
Used to print to stdout and stderr. See the [console](https://nodejs.org/api/console.html) section.
@@ -112,6 +119,7 @@ extern class Node {
112119
113120
Stability: 3 - Legacy. Use `globalThis` instead.
114121
**/
122+
@:deprecated("Use globalThis instead")
115123
static inline var global:Dynamic<Dynamic> = cast Node;
116124

117125
/**
@@ -189,7 +197,7 @@ extern class Node {
189197
which is managed by Node.js.
190198
The `Process.nextTick()` queue is always processed before the microtask queue within each turn of the Node.js event loop.
191199
**/
192-
static function queueMicrotask(callback:Void->Void):Void;
200+
static function queueMicrotask(callback:() -> Void):Void;
193201

194202
/**
195203
This variable may appear to be global but is not. See [require()](https://nodejs.org/api/modules.html#modules_require_id).

src/js/node/Constants.hx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C)2014-2020 Haxe Foundation
2+
* Copyright (C)2014-2026 Haxe Foundation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -33,21 +33,21 @@ package js.node;
3333
**/
3434
@:jsRequire("constants")
3535
extern class Constants {
36-
static var ENGINE_METHOD_RSA(default, null):Int;
37-
static var ENGINE_METHOD_DSA(default, null):Int;
38-
static var ENGINE_METHOD_DH(default, null):Int;
39-
static var ENGINE_METHOD_RAND(default, null):Int;
40-
static var ENGINE_METHOD_ECDH(default, null):Int;
41-
static var ENGINE_METHOD_ECDSA(default, null):Int;
42-
static var ENGINE_METHOD_CIPHERS(default, null):Int;
43-
static var ENGINE_METHOD_DIGESTS(default, null):Int;
44-
static var ENGINE_METHOD_STORE(default, null):Int;
45-
static var ENGINE_METHOD_PKEY_METH(default, null):Int;
46-
static var ENGINE_METHOD_PKEY_ASN1_METH(default, null):Int;
47-
static var ENGINE_METHOD_ALL(default, null):Int;
48-
static var ENGINE_METHOD_NONE(default, null):Int;
36+
static final ENGINE_METHOD_RSA:Int;
37+
static final ENGINE_METHOD_DSA:Int;
38+
static final ENGINE_METHOD_DH:Int;
39+
static final ENGINE_METHOD_RAND:Int;
40+
static final ENGINE_METHOD_ECDH:Int;
41+
static final ENGINE_METHOD_ECDSA:Int;
42+
static final ENGINE_METHOD_CIPHERS:Int;
43+
static final ENGINE_METHOD_DIGESTS:Int;
44+
static final ENGINE_METHOD_STORE:Int;
45+
static final ENGINE_METHOD_PKEY_METH:Int;
46+
static final ENGINE_METHOD_PKEY_ASN1_METH:Int;
47+
static final ENGINE_METHOD_ALL:Int;
48+
static final ENGINE_METHOD_NONE:Int;
4949

50-
static var RSA_NO_PADDING(default, null):Int;
51-
static var RSA_PKCS1_PADDING(default, null):Int;
52-
static var RSA_PKCS1_OAEP_PADDING(default, null):Int;
50+
static final RSA_NO_PADDING:Int;
51+
static final RSA_PKCS1_PADDING:Int;
52+
static final RSA_PKCS1_OAEP_PADDING:Int;
5353
}

src/js/node/Iterator.hx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C)2014-2020 Haxe Foundation
2+
* Copyright (C)2014-2026 Haxe Foundation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -22,5 +22,10 @@
2222

2323
package js.node;
2424

25+
/**
26+
Compatibility aliases for `js.lib.Iterator` / `IteratorStep`.
27+
28+
Prefer importing `js.lib.Iterator` directly in new code.
29+
**/
2530
typedef Iterator<T> = js.lib.Iterator<T>;
2631
typedef IteratorStep<T> = js.lib.Iterator.IteratorStep<T>;

src/js/node/KeyValue.hx

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
/*
2-
* Copyright (C)2014-2020 Haxe Foundation
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20-
* DEALINGS IN THE SOFTWARE.
21-
*/
22-
23-
package js.node;
24-
25-
/**
26-
Key/value access helper.
27-
**/
28-
abstract KeyValue<K, V>(Array<Any>) {
29-
public var key(get, never):K;
30-
public var value(get, never):V;
31-
32-
inline function get_key():K {
33-
return this[0];
34-
}
35-
36-
inline function get_value():V {
37-
return this[1];
38-
}
39-
}
1+
/*
2+
* Copyright (C)2014-2026 Haxe Foundation
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
* DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
package js.node;
24+
25+
/**
26+
Key/value pair helper for tuple-like `[key, value]` arrays (for example Map entries).
27+
**/
28+
abstract KeyValue<K, V>(Array<Any>) {
29+
public var key(get, never):K;
30+
public var value(get, never):V;
31+
32+
inline function get_key():K {
33+
return this[0];
34+
}
35+
36+
inline function get_value():V {
37+
return this[1];
38+
}
39+
}

0 commit comments

Comments
 (0)