Skip to content

Commit

Permalink
Add support for + in canonical repo names (#1927)
Browse files Browse the repository at this point in the history
Also add a missing Bzlmod dependency that otherwise fails the example with `--noenable_workspace`.
  • Loading branch information
fmeum authored Oct 1, 2024
1 parent f0c67a2 commit b8e14f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local_path_override(

bazel_dep(name = "aspect_bazel_lib", version = "2.7.7", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.10", dev_dependency = True)

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
Expand Down
3 changes: 2 additions & 1 deletion npm/private/npm_translate_lock_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ def _is_url(url):

################################################################################
def _to_apparent_repo_name(canonical_name):
return canonical_name[canonical_name.rfind("~") + 1:]
# Bazel 7 uses `~` as the canonical name separator by default, Bazel 8 always uses `+`.
return canonical_name[max(canonical_name.rfind("~"), canonical_name.rfind("+")) + 1:]

################################################################################
def _verify_node_modules_ignored(rctx, importers, root_package):
Expand Down

0 comments on commit b8e14f9

Please sign in to comment.