Introduce high-performance native addon API in Bun.build, starting with build.onBeforeParse hook (#14971)

Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2024-12-04 22:35:43 -08:00
committed by GitHub
parent dd5c40dab7
commit 784bc4e012
61 changed files with 4234 additions and 123 deletions

View File

@@ -414,6 +414,15 @@ pub fn addBunObject(b: *Build, opts: *BunBuildOptions) *Compile {
}
addInternalPackages(b, obj, opts);
obj.root_module.addImport("build_options", opts.buildOptionsModule(b));
const translate_plugin_api = b.addTranslateC(.{
.root_source_file = b.path("./packages/bun-native-bundler-plugin-api/bundler_plugin.h"),
.target = opts.target,
.optimize = opts.optimize,
.link_libc = true,
});
obj.root_module.addImport("bun-native-bundler-plugin-api", translate_plugin_api.createModule());
return obj;
}