Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion src/bun.js/bindings/libuv/generate_uv_posix_stubs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import { join } from "path";
import { symbols, test_skipped } from "./generate_uv_posix_stubs_constants";
import { symbols as all_symbols, test_skipped, polyfilled } from "./generate_uv_posix_stubs_constants";

// Validate: every name in `polyfilled` must exist in all_symbols to prevent silent stub drift
const missing = polyfilled.filter(p => !all_symbols.includes(p));
if (missing.length > 0) {
throw new Error(
`polyfilled contains symbols not found in all_symbols: ${missing.join(", ")}\n` +
`Either add them to the symbols array or remove them from polyfilled.`
);
}

// Filter out functions that have real implementations in uv-posix-polyfills.c
const symbols = all_symbols.filter(s => !polyfilled.includes(s));

import Parser from "tree-sitter";
import C from "tree-sitter-c";
Expand Down
14 changes: 14 additions & 0 deletions src/bun.js/bindings/libuv/generate_uv_posix_stubs_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ export const test_skipped = [
"uv_thread_setpriority",
];

// Functions implemented in uv-posix-polyfills.c — excluded from stub generation
export const polyfilled = [
"uv_async_init",
"uv_async_send",
"uv_close",
"uv_default_loop",
"uv_poll_init",
"uv_poll_init_socket",
"uv_poll_start",
"uv_poll_stop",
"uv_strerror",
"uv_unref",
];

export const symbols = [
"uv_accept",
"uv_async_init",
Expand Down
Loading