Skip to content
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

chore: add comments/docs for pnpm lockfile fields #2060

Merged
merged 1 commit into from
Jan 12, 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
34 changes: 33 additions & 1 deletion npm/private/pnpm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,38 @@ def _new_import_info(dependencies, dev_dependencies, optional_dependencies):
#
# Metadata may come from different locations depending on the lockfile, this struct should
# have data normalized across lockfiles.
#
# Args:
# id: a "universal identifier of the package" only present when the id is not the same as the key
# Normally present when the package is an odd version (such as file: or link: package) while
# also having peer dependencies in the key.
#
# Removed in lockfile v9+ where snapshots/packages are separate.
#
# See https://github.com/pnpm/spec/blob/master/lockfile/6.0.md#packagesdependencypathid
#
# name:
# version:
# dependencies:
# optional_dependencies:
# friendly_version:
#
# dev_only: True if the package is exclusively a dev dependency throughout the workspace
# Removed in lockfile v9+
# See https://github.com/pnpm/spec/blob/master/lockfile/6.0.md#packagesdependencypathdev
#
# has_bin: True if the package has binaries
# See https://github.com/pnpm/spec/blob/master/lockfile/9.0.md#packagesdependencyidhasbin
#
# optional: True if the package is exclusively an optional dependency throughout the workspace
# TODO: Removed in lockfile v9+?
# See https://github.com/pnpm/spec/blob/master/lockfile/6.0.md#packagesdependencypathoptional
#
# requires_build: True if pnpm predicted the package requires a build step
# Removed in lockfile v9+
# See https://github.com/pnpm/spec/blob/master/lockfile/6.0.md#packagesdependencypathrequiresbuild
#
# resolution: the lockfile resolution field
def _new_package_info(id, name, dependencies, optional_dependencies, dev_only, has_bin, optional, requires_build, version, friendly_version, resolution):
return {
"id": id,
Expand Down Expand Up @@ -486,7 +518,7 @@ def _convert_v9_packages(packages, snapshots):
friendly_version = package_data["version"] if "version" in package_data else static_key[version_index + 1:]

package_info = _new_package_info(
id = package_data.get("id", None), # TODO: does v9 have "id"?
id = None, # pnpm v9+ no longer requires an id field
name = name,
version = version,
friendly_version = friendly_version,
Expand Down
Loading