`mapKeys()` function and missing `soy/map.js`
pcj opened this issue · comments
Attempting to do {for $k in mapKeys($pkg.ruleMap) }
where ruleMap is a proto map-field like map<string,Rule>
.
Observing:
ERROR - Namespace not provided by any srcs or direct deps of //app/soy:workspace.
goog.require('soy.map');
^
ProTip: "CR_NOT_PROVIDED" or "strictDependencies" can be added to the `suppress` attribute of:
//app/soy:workspace
1 error(s), 0 warning(s)
Perhaps there is a closure library soy/map.js
that has not been open-sourced? Where can one find this file?
Looking at the error message, I assume this happened while using rules_closure
, right?
If so, this is something we would need to fix there. soy.map
is defined in <closure-templates>/javascript/soyutils_map.js
, which is not included in the dependencies of closure_js_template
.
Yes, rules_closure. Thanks for the info, that should fix it!
Leaving an additional note to self. Not sure this is the easiest way, but it compiles:
# WORKSPACE
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
closure_repositories(
omit_com_google_protobuf = True,
omit_com_google_template_soy_jssrc = True,
)
http_archive(
name = "com_google_template_soy_jssrc",
sha256 = "c2c744f70be575f2bb614956e300786a9e3bb53bd46f3ae3ce212ac3cfa9d0b1",
strip_prefix = "closure-templates-63f34802b543dadb72a078b006a0e7e4dbc71d7e/javascript",
urls = ["https://github.com/google/closure-templates/archive/63f34802b543dadb72a078b006a0e7e4dbc71d7e.tar.gz"],
build_file_content = """
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
filegroup(
name = "com_google_template_soy_jssrc",
srcs = [
"jspbconversions.js",
"soydata_converters.js",
"soyutils_usegoog.js",
"soyutils_map.js",
"soyutils_newmaps.js",
],
)
""",
)