diff --git a/e2e/pnpm_lockfiles/lockfile-test.bzl b/e2e/pnpm_lockfiles/lockfile-test.bzl index 9cc4d7837..f94bb1a67 100644 --- a/e2e/pnpm_lockfiles/lockfile-test.bzl +++ b/e2e/pnpm_lockfiles/lockfile-test.bzl @@ -104,7 +104,7 @@ def lockfile_test(name = None): # Odd git/http versions ":node_modules/debug", ":node_modules/hello", - # ":node_modules/jsonify", TODO: v9 + ":node_modules/jsonify", # npm: alias ":node_modules/@aspect-test/a2", diff --git a/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl b/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl index 502e9fcc7..6955e1aa1 100644 --- a/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl +++ b/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl @@ -10,7 +10,7 @@ load("@@aspect_rules_js~~npm~lock-__at_aspect-test_c__2.0.0__links/ load("@@aspect_rules_js~~npm~lock-__at_aspect-test_c__2.0.2__links//:defs.bzl", store_3 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_aspect-test_d__2.0.0__at_aspect-test_c_2.0.2__links//:defs.bzl", store_4 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_aspect-test_e__1.0.0__links//:defs.bzl", link_5 = "npm_link_imported_package_store", store_5 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_foo_jsonify__https___github.com_aspect-build_test-packages_releases_download_0.0.0_at_foo-jsonify-0.0.0.tgz__links//:defs.bzl", store_6 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_foo_jsonify__https___github.com_aspect-build_test-packages_releases_download_0.0.0_at_foo-jsonify-0.0.0.tgz__links//:defs.bzl", link_6 = "npm_link_imported_package_store", store_6 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_types_archiver__5.3.1__links//:defs.bzl", link_7 = "npm_link_imported_package_store", store_7 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_types_glob__8.1.0__links//:defs.bzl", store_8 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__5.1.2__links//:defs.bzl", store_9 = "npm_imported_package_store") @@ -93,6 +93,8 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): link_5(name = "{}/@aspect-test/e".format(name)) link_targets.append("//{}:{}/@aspect-test/e".format(bazel_package, name)) scope_targets["@aspect-test"] = scope_targets["@aspect-test"] + [link_targets[-1]] if "@aspect-test" in scope_targets else [link_targets[-1]] + link_6(name = "{}/jsonify".format(name)) + link_targets.append("//{}:{}/jsonify".format(bazel_package, name)) link_7(name = "{}/@types/archiver".format(name)) link_targets.append("//{}:{}/@types/archiver".format(bazel_package, name)) scope_targets["@types"] = scope_targets["@types"] + [link_targets[-1]] if "@types" in scope_targets else [link_targets[-1]] @@ -294,6 +296,7 @@ def npm_link_targets(name = "node_modules", package = None): link_targets.append("//{}:{}/@aspect-test/b".format(bazel_package, name)) link_targets.append("//{}:{}/@aspect-test/c".format(bazel_package, name)) link_targets.append("//{}:{}/@aspect-test/e".format(bazel_package, name)) + link_targets.append("//{}:{}/jsonify".format(bazel_package, name)) link_targets.append("//{}:{}/@types/archiver".format(bazel_package, name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) link_targets.append("//{}:{}/alias-types-node".format(bazel_package, name)) diff --git a/npm/private/utils.bzl b/npm/private/utils.bzl index ae90d8573..62a5b5fa8 100644 --- a/npm/private/utils.bzl +++ b/npm/private/utils.bzl @@ -194,7 +194,7 @@ def _convert_v5_v6_file_package(package_path, package_snapshot): else: friendly_version = package_snapshot["version"] if "version" in package_snapshot else version - return _to_package_key(name, version), name, version, friendly_version + return name, version, friendly_version def _convert_v5_packages(packages): result = {} @@ -207,22 +207,22 @@ def _convert_v5_packages(packages): if package_path.startswith("file:"): # direct reference to file - package_key, name, version, friendly_version = _convert_v5_v6_file_package(package_path, package_snapshot) + name, version, friendly_version = _convert_v5_v6_file_package(package_path, package_snapshot) elif "name" in package_snapshot and "version" in package_snapshot: # key/path is complicated enough the real name+version are properties name = package_snapshot["name"] version = _strip_v5_default_registry_to_version(name, package_path) friendly_version = package_snapshot["version"] - package_key = _to_package_key(name, version) elif package_path.startswith("/"): # a simple /name/version[_peer_info] name, version = package_path[1:].rsplit("/", 1) friendly_version = _strip_v5_peer_dep_or_patched_version(version) - package_key = _to_package_key(name, version) else: msg = "unexpected package path: {} of {}".format(package_path, package_snapshot) fail(msg) + package_key = _to_package_key(name, version) + package_info = _new_package_info( id = package_snapshot.get("id", None), name = name, @@ -364,22 +364,22 @@ def _convert_v6_packages(packages): if package_path.startswith("file:"): # direct reference to file - package_key, name, version, friendly_version = _convert_v5_v6_file_package(package_path, package_snapshot) + name, version, friendly_version = _convert_v5_v6_file_package(package_path, package_snapshot) elif "name" in package_snapshot and "version" in package_snapshot: # key/path is complicated enough the real name+version are properties name = package_snapshot["name"] version = _strip_v6_default_registry_to_version(name, package_path) friendly_version = package_snapshot["version"] - package_key = _to_package_key(name, version) elif package_path.startswith("/"): # plain /pkg@version(_peer_info) name, version = package_path[1:].rsplit("@", 1) friendly_version = _strip_v5_peer_dep_or_patched_version(version) # NOTE: already converted to v5 peer style - package_key = _to_package_key(name, version) else: msg = "unexpected package path: {} of {}".format(package_path, package_snapshot) fail(msg) + package_key = _to_package_key(name, version) + package_info = _new_package_info( id = package_snapshot.get("id", None), name = name, @@ -501,9 +501,6 @@ def _convert_v9_packages(packages, snapshots): # package_data can have the resolved "version" for things like https:// deps friendly_version = package_data["version"] if "version" in package_data else static_key[version_index + 1:] - # Convert the package_key to a rules_js compatible format - package_key = _to_package_key(name, version) - package_info = _new_package_info( id = package_data.get("id", None), # TODO: does v9 have "id"? name = name,