File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cloudflare/unenv-preset " : patch
3+ ---
4+
5+ Removes node: net and node: timers from polyfills
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type { Preset } from "unenv";
44// Built-in APIs provided by workerd.
55// https://developers.cloudflare.com/workers/runtime-apis/nodejs/
66// https://github.com/cloudflare/workerd/tree/main/src/node
7- // Last checked: 2024-10-22
7+ // Last checked: 2025-01-24
88const cloudflareNodeCompatModules = [
99 "_stream_duplex" ,
1010 "_stream_passthrough" ,
@@ -18,6 +18,8 @@ const cloudflareNodeCompatModules = [
1818 "dns" ,
1919 "dns/promises" ,
2020 "events" ,
21+ "net" ,
22+ "net/promises" ,
2123 "path" ,
2224 "path/posix" ,
2325 "path/win32" ,
@@ -27,6 +29,8 @@ const cloudflareNodeCompatModules = [
2729 "stream/promises" ,
2830 "stream/web" ,
2931 "string_decoder" ,
32+ "timers" ,
33+ "timers/promises" ,
3034 "url" ,
3135 "util/types" ,
3236 "zlib" ,
@@ -39,7 +43,6 @@ const hybridNodeCompatModules = [
3943 "crypto" ,
4044 "module" ,
4145 "process" ,
42- "timers" ,
4346 "util" ,
4447] ;
4548
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export const TESTS = {
1010 testPath,
1111 testDns,
1212 testTimers,
13+ testNet,
1314} ;
1415
1516export default {
@@ -86,6 +87,8 @@ async function testModules() {
8687 "dns" ,
8788 "dns/promises" ,
8889 "events" ,
90+ "net" ,
91+ "net/promises" ,
8992 "path" ,
9093 "path/posix" ,
9194 "path/win32" ,
@@ -95,6 +98,8 @@ async function testModules() {
9598 "stream/promises" ,
9699 "stream/web" ,
97100 "string_decoder" ,
101+ "timers" ,
102+ "timers/promises" ,
98103 "url" ,
99104 "util/types" ,
100105 "zlib" ,
@@ -150,3 +155,10 @@ async function testTimers() {
150155 ( timers as any ) . active ( timeout ) ;
151156 timers . clearTimeout ( timeout ) ;
152157}
158+
159+ export async function testNet ( ) {
160+ const net = await import ( "node:net" ) ;
161+ assert . strictEqual ( typeof net , "object" ) ;
162+ assert . strictEqual ( typeof net . createConnection , "function" ) ;
163+ assert . throws ( ( ) => net . createServer ( ) , / n o t i m p l e m e n t e d / ) ;
164+ }
You can’t perform that action at this time.
0 commit comments