Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
1 change: 1 addition & 0 deletions src/assets/bun-modules.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"bun": true,
"bun:bundle": ">= 1.3.5",
"bun:ffi": true,
"bun:jsc": true,
"bun:sqlite": true,
Expand Down
39 changes: 38 additions & 1 deletion src/assets/implemented-node-modules.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
{
"_http_agent": ">= 1.2.11",
"_http_client": ">= 1.2.11",
"_http_common": ">= 1.2.11",
"_http_incoming": ">= 1.2.11",
"_http_outgoing": ">= 1.2.11",
"_http_server": ">= 1.2.11",
"node:_http_agent": ">= 1.2.11",
"node:_http_client": ">= 1.2.11",
"node:_http_common": ">= 1.2.11",
"node:_http_incoming": ">= 1.2.11",
"node:_http_outgoing": ">= 1.2.11",
"node:_http_server": ">= 1.2.11",
"_stream_duplex": ">= 1.1.45",
"_stream_passthrough": ">= 1.1.45",
"_stream_readable": ">= 1.1.45",
"_stream_transform": ">= 1.1.45",
"_stream_wrap": ">= 1.1.45",
"_stream_writable": ">= 1.1.45",
"node:_stream_duplex": ">= 1.1.45",
"node:_stream_passthrough": ">= 1.1.45",
"node:_stream_readable": ">= 1.1.45",
"node:_stream_transform": ">= 1.1.45",
"node:_stream_wrap": ">= 1.1.45",
"node:_stream_writable": ">= 1.1.45",
"_tls_common": ">= 1.2.6",
"node:_tls_common": ">= 1.2.6",
"_tls_wrap": ">= 1.4.0",
"node:_tls_wrap": ">= 1.4.0",
"assert": true,
"assert/strict": true,
"node:assert": true,
"node:assert/strict": true,
"async_hooks": true,
"node:async_hooks": true,
"async_hooks/async_context": true,
"buffer": true,
"node:buffer": true,
"child_process": true,
Expand Down Expand Up @@ -40,6 +67,10 @@
"node:http2": ">= 1.0.13",
"https": true,
"node:https": true,
"inspector": ">= 1.3.7",
"inspector/promises": ">= 1.3.7",
"node:inspector": ">= 1.3.7",
"node:inspector/promises": ">= 1.3.7",
"module": true,
"node:module": true,
"net": true,
Expand All @@ -60,10 +91,14 @@
"node:punycode": true,
"querystring": true,
"node:querystring": true,
"node:quic": ">= 1.4.0",
"readline": true,
"readline/promises": true,
"node:readline": true,
"node:readline/promises": true,
"repl": ">= 1.4.0",
"node:repl": ">= 1.4.0",
"node:sqlite": ">= 1.4.0",
"stream": true,
"stream/consumers": true,
"stream/promises": true,
Expand All @@ -82,6 +117,8 @@
"node:timers/promises": true,
"tls": true,
"node:tls": true,
"trace_events": ">= 1.4.0",
"node:trace_events": ">= 1.4.0",
"tty": true,
"node:tty": true,
"url": true,
Expand Down
12 changes: 11 additions & 1 deletion test/isBunImplementedNodeModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ describe("Implemented Node modules checking", () => {
expect(isBunImplementedNodeModule("http2", "1.0.13")).toBe(true);
expect(isBunImplementedNodeModule("node:http2", "1.0.13")).toBe(true);
expect(isBunImplementedNodeModule("node:test", "1.2.6")).toBe(true);
expect(isBunImplementedNodeModule("_tls_wrap", "1.4.0")).toBe(true);
expect(isBunImplementedNodeModule("async_hooks", "1.0.0")).toBe(true);
});

test("Return false for non-node/not implemented modules", () => {
expect(isBunImplementedNodeModule("bun")).toBe(false);
expect(isBunImplementedNodeModule("node:bun")).toBe(false);
expect(isBunImplementedNodeModule("node:http2", "1.0.0")).toBe(false);
expect(isBunImplementedNodeModule("http2", "1.0.0")).toBe(false);
expect(isBunImplementedNodeModule("test", "1.2.6")).toBe(false);
expect(isBunImplementedNodeModule("node:test", "1.2.5")).toBe(false);
expect(isBunImplementedNodeModule("_tls_wrap", "1.3.14")).toBe(false);
expect(isBunImplementedNodeModule("async_hooks/async_context", "1.0.0")).toBe(false);
});

test("Return false for unprefixed names of modules with mandatory prefix", () => {
expect(isBunImplementedNodeModule("sqlite", "latest")).toBe(false);
expect(isBunImplementedNodeModule("quic", "latest")).toBe(false);
expect(isBunImplementedNodeModule("test", "latest")).toBe(false);
});
});