feat: add phase 7 bun_install module extension

This commit is contained in:
Eric
2026-03-04 07:52:24 +00:00
parent 81810b83ba
commit f367aab629
5 changed files with 51 additions and 1 deletions

View File

@@ -1,7 +1,10 @@
load(":toolchain.bzl", "bun_toolchain")
load(":version.bzl", "BUN_VERSION")
exports_files(["defs.bzl"])
exports_files([
"defs.bzl",
"extensions.bzl",
])
toolchain_type(name = "toolchain_type")

View File

@@ -1,4 +1,5 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//internal:bun_install.bzl", _bun_install_repository = "_bun_install_repository")
load(":version.bzl", "BUN_VERSION")
_BUN_ARCHIVES = {
@@ -53,3 +54,27 @@ filegroup(
bun = module_extension(
implementation = _bun_repos_impl,
)
_install = tag_class(
attrs = {
"name": attr.string(default = "node_modules"),
"package_json": attr.string(mandatory = True),
"bun_lockfile": attr.string(mandatory = True),
},
)
def _bun_install_impl(ctx):
for mod in ctx.modules:
for install in mod.tags.install:
_bun_install_repository(
name = install.name,
package_json = install.package_json,
bun_lockfile = install.bun_lockfile,
)
bun_install = module_extension(
implementation = _bun_install_impl,
tag_classes = {"install": _install},
)