mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Add a new generator for JS → Zig bindings. The bulk of the conversion is done in C++, after which the data is transformed into an FFI-safe representation, passed to Zig, and then finally transformed into idiomatic Zig types. In its current form, the new bindings generator supports: * Signed and unsigned integers * Floats (plus a “finite” variant that disallows NaN and infinities) * Strings * ArrayBuffer (accepts ArrayBuffer, TypedArray, or DataView) * Blob * Optional types * Nullable types (allows null, whereas Optional only allows undefined) * Arrays * User-defined string enumerations * User-defined unions (fields can optionally be named to provide a better experience in Zig) * Null and undefined, for use in unions (can more efficiently represent optional/nullable unions than wrapping a union in an optional) * User-defined dictionaries (arbitrary key-value pairs; expects a JS object and parses it into a struct) * Default values for dictionary members * Alternative names for dictionary members (e.g., to support both `serverName` and `servername` without taking up twice the space) * Descriptive error messages * Automatic `fromJS` functions in Zig for dictionaries * Automatic `deinit` functions for the generated Zig types Although this bindings generator has many features not present in `bindgen.ts`, it does not yet implement all of `bindgen.ts`'s functionality, so for the time being, it has been named `bindgenv2`, and its configuration is specified in `.bindv2.ts` files. Once all `bindgen.ts`'s functionality has been incorporated, it will be renamed. This PR ports `SSLConfig` to use the new bindings generator; see `SSLConfig.bindv2.ts`. (For internal tracking: fixes STAB-1319, STAB-1322, STAB-1323, STAB-1324) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Alistair Smith <hi@alistair.sh>
81 lines
2.1 KiB
JSON
81 lines
2.1 KiB
JSON
[
|
|
{
|
|
"output": "BunErrorSources.txt",
|
|
"paths": ["packages/bun-error/*.{json,ts,tsx,css}", "packages/bun-error/img/*"]
|
|
},
|
|
{
|
|
"output": "NodeFallbacksSources.txt",
|
|
"paths": ["src/node-fallbacks/*.js"]
|
|
},
|
|
{
|
|
"output": "ZigGeneratedClassesSources.txt",
|
|
"paths": ["src/bun.js/*.classes.ts", "src/bun.js/{api,node,test,webcore}/*.classes.ts"]
|
|
},
|
|
{
|
|
"output": "JavaScriptSources.txt",
|
|
"paths": [
|
|
"src/js/**/*.{js,ts}",
|
|
"src/install/PackageManager/scanner-entry.ts"
|
|
]
|
|
},
|
|
{
|
|
"output": "JavaScriptCodegenSources.txt",
|
|
"paths": ["src/codegen/*.ts"]
|
|
},
|
|
{
|
|
"output": "BakeRuntimeSources.txt",
|
|
"paths": ["src/bake/*.ts", "src/bake/*/*.{ts,css}"],
|
|
"exclude": ["src/bake/generated.ts"]
|
|
},
|
|
{
|
|
"output": "BindgenSources.txt",
|
|
"paths": ["src/**/*.bind.ts"]
|
|
},
|
|
{
|
|
"output": "BindgenV2Sources.txt",
|
|
"paths": ["src/**/*.bindv2.ts"]
|
|
},
|
|
{
|
|
"output": "BindgenV2InternalSources.txt",
|
|
"paths": ["src/codegen/bindgenv2/**/*.ts"]
|
|
},
|
|
{
|
|
"output": "ZigSources.txt",
|
|
"paths": ["src/**/*.zig"]
|
|
},
|
|
{
|
|
"output": "CxxSources.txt",
|
|
"paths": [
|
|
"src/io/*.cpp",
|
|
"src/bun.js/modules/*.cpp",
|
|
"src/bun.js/bindings/*.cpp",
|
|
"src/bun.js/bindings/webcore/*.cpp",
|
|
"src/bun.js/bindings/sqlite/*.cpp",
|
|
"src/bun.js/bindings/webcrypto/*.cpp",
|
|
"src/bun.js/bindings/webcrypto/*/*.cpp",
|
|
"src/bun.js/bindings/node/*.cpp",
|
|
"src/bun.js/bindings/node/crypto/*.cpp",
|
|
"src/bun.js/bindings/node/http/*.cpp",
|
|
"src/bun.js/bindings/v8/*.cpp",
|
|
"src/bun.js/bindings/v8/shim/*.cpp",
|
|
"src/bake/*.cpp",
|
|
"src/deps/*.cpp",
|
|
"src/vm/*.cpp",
|
|
"packages/bun-usockets/src/crypto/*.cpp"
|
|
]
|
|
},
|
|
{
|
|
"output": "CSources.txt",
|
|
"paths": [
|
|
"packages/bun-usockets/src/*.c",
|
|
"packages/bun-usockets/src/eventing/*.c",
|
|
"packages/bun-usockets/src/internal/*.c",
|
|
"packages/bun-usockets/src/crypto/*.c",
|
|
"src/bun.js/bindings/uv-posix-polyfills.c",
|
|
"src/bun.js/bindings/uv-posix-stubs.c",
|
|
"src/*.c",
|
|
"src/bun.js/bindings/node/http/llhttp/*.c"
|
|
]
|
|
}
|
|
]
|