Skip to content

Commit b9bcdb3

Browse files
authored
feat(bazel): support more options in spec-bundle rule (#2710)
Support `config` in `spec-bundle` rule. This is useful for supporting e.g. path mappings.
1 parent 6127cf1 commit b9bcdb3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bazel/spec-bundling/index_rjs.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
22
load("@devinfra//bazel/spec-bundling:spec-entrypoint.bzl", "spec_entrypoint")
33

4-
def spec_bundle(name, deps, bootstrap = [], testonly = True, config = {}, **kwargs):
4+
def spec_bundle(name, deps, srcs = [], bootstrap = [], testonly = True, config = {}, **kwargs):
55
spec_entrypoint(
66
name = "%s_entrypoint" % name,
77
deps = deps,
@@ -13,7 +13,7 @@ def spec_bundle(name, deps, bootstrap = [], testonly = True, config = {}, **kwar
1313
name = name,
1414
# Note: `deps` are added here to automatically collect transitive NPM
1515
# sources etc. and make them available for bundling.
16-
srcs = deps + [
16+
srcs = srcs + deps + [
1717
":%s_entrypoint" % name,
1818
],
1919
config = dict({
@@ -38,15 +38,15 @@ def spec_bundle(name, deps, bootstrap = [], testonly = True, config = {}, **kwar
3838
**kwargs
3939
)
4040

41-
def spec_bundle_amd(name, workspace_name, **kwargs):
41+
def spec_bundle_amd(name, workspace_name, config = {}, **kwargs):
4242
amd_name = "%s/%s/%s" % (workspace_name, native.package_name(), name + ".spec")
4343

4444
spec_bundle(
4545
name,
46-
config = {
46+
config = dict({
4747
"globalName": "__exports",
4848
"banner": {"js": "define(\"%s\", [], function() {" % amd_name},
4949
"footer": {"js": "return __exports;})"},
50-
},
50+
}, **config),
5151
**kwargs
5252
)

0 commit comments

Comments
 (0)