8000 fix: npm_translate_lock(exclude_package_contents["*"]) should only be a fallback if no explicit package found by jbedard · Pull Request #2151 · aspect-build/rules_js · GitHub
[go: up one dir, main page]

Skip to content

fix: npm_translate_lock(exclude_package_contents["*"]) should only be a fallback if no explicit package found #2151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions npm/private/npm_translate_lock_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ Check the public_hoist_packages attribute for duplicates.

################################################################################
def _gather_package_content_excludes(keyed_lists, *names):
keys = []
result = {}
found = False
excludes = []
for name in names:
if name and (name in keyed_lists or "*" in keyed_lists):
keys.append(name)
v = keyed_lists[name] if name in keyed_lists else keyed_lists["*"]
if name in keyed_lists:
found = True
v = keyed_lists[name]
if type(v) == "list":
for item in v:
result[item] = []
for e in v:
excludes.append(e)
elif type(v) == "string":
result[v] = []
excludes.append(v)
else:
fail("expected value to be list or string")

# in case the key has not been met even once, we return None, instead of empty list as empty list is a valid value
if not keys:
return None
if not found and "*" in keyed_lists:
excludes = keyed_lists["*"] if type(keyed_lists["*"]) == "list" else [keyed_lists["*"]]

return result.keys()
return None if len(excludes) == 0 else excludes

################################################################################
def _gather_values_from_matching_names(additive, keyed_lists, *names):
Expand Down
0