From 9acbca61ed0b47b8cb53342d9e3989ec5bb2a121 Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Tue, 21 May 2024 09:31:15 -0700 Subject: [PATCH] fix(pnpm): url and git package specifiers Ref #1753 --- e2e/pnpm_lockfiles/README.md | 4 -- e2e/pnpm_lockfiles/base/package.json | 2 + e2e/pnpm_lockfiles/v54/pnpm-lock.yaml | 27 +++++++++++++ e2e/pnpm_lockfiles/v54/snapshots/defs.bzl | 48 ++++++++++++++--------- e2e/pnpm_lockfiles/v60/pnpm-lock.yaml | 29 ++++++++++++++ e2e/pnpm_lockfiles/v60/snapshots/defs.bzl | 48 ++++++++++++++--------- e2e/pnpm_lockfiles/v61/pnpm-lock.yaml | 29 ++++++++++++++ e2e/pnpm_lockfiles/v61/snapshots/defs.bzl | 48 ++++++++++++++--------- e2e/pnpm_lockfiles/v90/pnpm-lock.yaml | 30 ++++++++++++++ e2e/pnpm_lockfiles/v90/snapshots/defs.bzl | 48 +++++++++++++---------- npm/private/utils.bzl | 40 +++++++++++++------ 11 files changed, 263 insertions(+), 90 deletions(-) diff --git a/e2e/pnpm_lockfiles/README.md b/e2e/pnpm_lockfiles/README.md index 1848438e1b..fd28361d75 100644 --- a/e2e/pnpm_lockfiles/README.md +++ b/e2e/pnpm_lockfiles/README.md @@ -2,10 +2,6 @@ TODO: -- http references: `"hello": "https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello"` - - Has inconsistencies across pnpm lockfile versions, issues with pnpm9 - - file references: `"@scoped/c": "file:../projects/c"` Has inconsistencies across pnpm lockfile versions, issues with pnpm9 diff --git a/e2e/pnpm_lockfiles/base/package.json b/e2e/pnpm_lockfiles/base/package.json index 8dbca01c3e..d87abbca5f 100644 --- a/e2e/pnpm_lockfiles/base/package.json +++ b/e2e/pnpm_lockfiles/base/package.json @@ -3,6 +3,8 @@ "private": true, "dependencies": { "@aspect-test/a": "^5.0.2", + "debug": "ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53", + "hello": "https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello", "rollup": "3.2.5", "meaning-of-life": "1.0.0", "uvu": "0.5.6", diff --git a/e2e/pnpm_lockfiles/v54/pnpm-lock.yaml b/e2e/pnpm_lockfiles/v54/pnpm-lock.yaml index 3b86ae1f32..07795232a8 100644 --- a/e2e/pnpm_lockfiles/v54/pnpm-lock.yaml +++ b/e2e/pnpm_lockfiles/v54/pnpm-lock.yaml @@ -18,6 +18,8 @@ importers: '@scoped/d': ../projects/d '@types/archiver': 5.3.1 '@types/node': 16.18.11 + debug: ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53 + hello: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello meaning-of-life: 1.0.0 rollup: 3.2.5 uvu: 0.5.6 @@ -27,6 +29,8 @@ importers: '@scoped/b': link:../projects/b '@scoped/c': file:../projects/c '@scoped/d': link:../projects/d + debug: github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53 + hello: '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello' meaning-of-life: 1.0.0_o3deharooos255qt5xdujc3cuq rollup: 3.2.5 uvu: 0.5.6 @@ -129,6 +133,10 @@ packages: engines: {node: '>=4'} dev: false + /ms/0.7.3: + resolution: {integrity: sha512-lrKNzMWqQZgwJahtrtrM+9NgOoDUveDrVmm5aGXrf3BdtL0mq7X6IVzoZaw+TfNti29eHd1/8GI+h45K5cQ6/w==} + dev: false + /rollup/3.2.5: resolution: {integrity: sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -155,6 +163,12 @@ packages: sade: 1.8.1 dev: false + '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello': + resolution: {tarball: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello} + name: hello + version: 1.0.0 + dev: false + file:../projects/c: resolution: {directory: ../projects/c, type: directory} name: '@scoped/c' @@ -162,6 +176,19 @@ packages: '@scoped/a': link:../a dev: false + github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53: + resolution: {tarball: https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53} + name: debug + version: 2.6.3 + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 0.7.3 + dev: false + registry.npmjs.org/@types/archiver/5.3.1: resolution: {integrity: sha512-wKYZaSXaDvTZuInAWjCeGG7BEAgTWG2zZW0/f7IYFcoHB2X2d9lkVFnrOlXl3W6NrvO6Ml3FLLu8Uksyymcpnw==, registry: https://registry.yarnpkg.com/, tarball: https://registry.npmjs.org/@types/archiver/-/archiver-5.3.1.tgz} name: '@types/archiver' diff --git a/e2e/pnpm_lockfiles/v54/snapshots/defs.bzl b/e2e/pnpm_lockfiles/v54/snapshots/defs.bzl index 42feeccf13..8611eafb43 100644 --- a/e2e/pnpm_lockfiles/v54/snapshots/defs.bzl +++ b/e2e/pnpm_lockfiles/v54/snapshots/defs.bzl @@ -15,13 +15,16 @@ load("@@aspect_rules_js~~npm~lock-__fsevents__2.3.3__links//:defs.b load("@@aspect_rules_js~~npm~lock-__kleur__4.1.5__links//:defs.bzl", store_8 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq__links//:defs.bzl", link_9 = "npm_link_imported_package_store", store_9 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__mri__1.2.0__links//:defs.bzl", store_10 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_11 = "npm_link_imported_package_store", store_11 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_12 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_13 = "npm_link_imported_package_store", store_13 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_14 = "npm_link_imported_package_store", store_14 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_15 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_16 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_17 = "npm_link_imported_package_store", store_17 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__ms__0.7.3__links//:defs.bzl", store_11 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_12 = "npm_link_imported_package_store", store_12 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_13 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_14 = "npm_link_imported_package_store", store_14 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__hello__at_gitpkg.vercel.app_EqualMa_gitpkg-hello_packages_hello__links//:defs.bzl", link_15 = "npm_link_imported_package_store", store_15 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__debug__github.com_ngokevin_debug_9742c5f383a6f8046241920156236ade8ec30d53__links//:defs.bzl", link_16 = "npm_link_imported_package_store", store_16 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_17 = "npm_link_imported_package_store", store_17 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_19 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_20 = "npm_link_imported_package_store", store_20 = "npm_imported_package_store") _LINK_PACKAGES = ["", "projects/a", "projects/b", "projects/c", "projects/d"] @@ -55,13 +58,16 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): store_8(name = "{}/kleur".format(name)) store_9(name = "{}/meaning-of-life".format(name)) store_10(name = "{}/mri".format(name)) - store_11(name = "{}/rollup".format(name)) - store_12(name = "{}/sade".format(name)) - store_13(name = "{}/uvu".format(name)) - store_14(name = "{}/@types/archiver".format(name)) - store_15(name = "{}/@types/glob".format(name)) - store_16(name = "{}/@types/minimatch".format(name)) - store_17(name = "{}/@types/node".format(name)) + store_11(name = "{}/ms".format(name)) + store_12(name = "{}/rollup".format(name)) + store_13(name = "{}/sade".format(name)) + store_14(name = "{}/uvu".format(name)) + store_15(name = "{}/hello".format(name)) + store_16(name = "{}/debug".format(name)) + store_17(name = "{}/@types/archiver".format(name)) + store_18(name = "{}/@types/glob".format(name)) + store_19(name = "{}/@types/minimatch".format(name)) + store_20(name = "{}/@types/node".format(name)) if link: if bazel_package == "": link_0(name = "{}/@aspect-test/a".format(name)) @@ -75,14 +81,18 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): scope_targets["@aspect-test"] = scope_targets["@aspect-test"] + [link_targets[-1]] if "@aspect-test" in scope_targets else [link_targets[-1]] link_9(name = "{}/meaning-of-life".format(name)) link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) - link_11(name = "{}/rollup".format(name)) + link_12(name = "{}/rollup".format(name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) - link_13(name = "{}/uvu".format(name)) + link_14(name = "{}/uvu".format(name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) - link_14(name = "{}/@types/archiver".format(name)) + link_15(name = "{}/hello".format(name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_16(name = "{}/debug".format(name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) + link_17(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]] - link_17(name = "{}/@types/node".format(name)) + link_20(name = "{}/@types/node".format(name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) scope_targets["@types"] = scope_targets["@types"] + [link_targets[-1]] if "@types" in scope_targets else [link_targets[-1]] @@ -254,6 +264,8 @@ def npm_link_targets(name = "node_modules", package = None): link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) link_targets.append("//{}:{}/@types/archiver".format(bazel_package, name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) diff --git a/e2e/pnpm_lockfiles/v60/pnpm-lock.yaml b/e2e/pnpm_lockfiles/v60/pnpm-lock.yaml index 2bf0d590f9..78b4dce811 100644 --- a/e2e/pnpm_lockfiles/v60/pnpm-lock.yaml +++ b/e2e/pnpm_lockfiles/v60/pnpm-lock.yaml @@ -27,6 +27,12 @@ importers: '@scoped/d': specifier: ../projects/d version: link:../projects/d + debug: + specifier: ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53 + version: github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53 + hello: + specifier: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello + version: '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello' meaning-of-life: specifier: 1.0.0 version: 1.0.0(patch_hash=o3deharooos255qt5xdujc3cuq) @@ -147,6 +153,10 @@ packages: engines: {node: '>=4'} dev: false + /ms@0.7.3: + resolution: {integrity: sha512-lrKNzMWqQZgwJahtrtrM+9NgOoDUveDrVmm5aGXrf3BdtL0mq7X6IVzoZaw+TfNti29eHd1/8GI+h45K5cQ6/w==} + dev: false + /rollup@3.2.5: resolution: {integrity: sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -173,6 +183,12 @@ packages: sade: 1.8.1 dev: false + '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello': + resolution: {tarball: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello} + name: hello + version: 1.0.0 + dev: false + file:../projects/c: resolution: {directory: ../projects/c, type: directory} name: '@scoped/c' @@ -180,6 +196,19 @@ packages: '@scoped/a': link:../a dev: false + github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53: + resolution: {tarball: https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53} + name: debug + version: 2.6.3 + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 0.7.3 + dev: false + registry.npmjs.org/@types/archiver@5.3.1: resolution: {integrity: sha512-wKYZaSXaDvTZuInAWjCeGG7BEAgTWG2zZW0/f7IYFcoHB2X2d9lkVFnrOlXl3W6NrvO6Ml3FLLu8Uksyymcpnw==, registry: https://registry.yarnpkg.com/, tarball: https://registry.npmjs.org/@types/archiver/-/archiver-5.3.1.tgz} name: '@types/archiver' diff --git a/e2e/pnpm_lockfiles/v60/snapshots/defs.bzl b/e2e/pnpm_lockfiles/v60/snapshots/defs.bzl index dd2d129ee2..d41da5b4a3 100644 --- a/e2e/pnpm_lockfiles/v60/snapshots/defs.bzl +++ b/e2e/pnpm_lockfiles/v60/snapshots/defs.bzl @@ -16,13 +16,16 @@ load("@@aspect_rules_js~~npm~lock-__fsevents__2.3.3__links//:defs.b load("@@aspect_rules_js~~npm~lock-__kleur__4.1.5__links//:defs.bzl", store_9 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq__links//:defs.bzl", link_10 = "npm_link_imported_package_store", store_10 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__mri__1.2.0__links//:defs.bzl", store_11 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_12 = "npm_link_imported_package_store", store_12 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_13 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_14 = "npm_link_imported_package_store", store_14 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_15 = "npm_link_imported_package_store", store_15 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_16 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_17 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_18 = "npm_link_imported_package_store", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__ms__0.7.3__links//:defs.bzl", store_12 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_13 = "npm_link_imported_package_store", store_13 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_14 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_15 = "npm_link_imported_package_store", store_15 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__hello__at_gitpkg.vercel.app_EqualMa_gitpkg-hello_packages_hello__links//:defs.bzl", link_16 = "npm_link_imported_package_store", store_16 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__debug__github.com_ngokevin_debug_9742c5f383a6f8046241920156236ade8ec30d53__links//:defs.bzl", link_17 = "npm_link_imported_package_store", store_17 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_18 = "npm_link_imported_package_store", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_19 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_20 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_21 = "npm_link_imported_package_store", store_21 = "npm_imported_package_store") _LINK_PACKAGES = ["", "projects/a", "projects/b", "projects/c", "projects/d"] @@ -57,13 +60,16 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): store_9(name = "{}/kleur".format(name)) store_10(name = "{}/meaning-of-life".format(name)) store_11(name = "{}/mri".format(name)) - store_12(name = "{}/rollup".format(name)) - store_13(name = "{}/sade".format(name)) - store_14(name = "{}/uvu".format(name)) - store_15(name = "{}/@types/archiver".format(name)) - store_16(name = "{}/@types/glob".format(name)) - store_17(name = "{}/@types/minimatch".format(name)) - store_18(name = "{}/@types/node".format(name)) + store_12(name = "{}/ms".format(name)) + store_13(name = "{}/rollup".format(name)) + store_14(name = "{}/sade".format(name)) + store_15(name = "{}/uvu".format(name)) + store_16(name = "{}/hello".format(name)) + store_17(name = "{}/debug".format(name)) + store_18(name = "{}/@types/archiver".format(name)) + store_19(name = "{}/@types/glob".format(name)) + store_20(name = "{}/@types/minimatch".format(name)) + store_21(name = "{}/@types/node".format(name)) if link: if bazel_package == "": link_0(name = "{}/@aspect-test/a".format(name)) @@ -80,14 +86,18 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): scope_targets["@aspect-test"] = scope_targets["@aspect-test"] + [link_targets[-1]] if "@aspect-test" in scope_targets else [link_targets[-1]] link_10(name = "{}/meaning-of-life".format(name)) link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) - link_12(name = "{}/rollup".format(name)) + link_13(name = "{}/rollup".format(name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) - link_14(name = "{}/uvu".format(name)) + link_15(name = "{}/uvu".format(name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) - link_15(name = "{}/@types/archiver".format(name)) + link_16(name = "{}/hello".format(name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_17(name = "{}/debug".format(name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) + link_18(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]] - link_18(name = "{}/@types/node".format(name)) + link_21(name = "{}/@types/node".format(name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) scope_targets["@types"] = scope_targets["@types"] + [link_targets[-1]] if "@types" in scope_targets else [link_targets[-1]] @@ -260,6 +270,8 @@ def npm_link_targets(name = "node_modules", package = None): link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) link_targets.append("//{}:{}/@types/archiver".format(bazel_package, name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) diff --git a/e2e/pnpm_lockfiles/v61/pnpm-lock.yaml b/e2e/pnpm_lockfiles/v61/pnpm-lock.yaml index 69d53e9428..7b5886e7de 100644 --- a/e2e/pnpm_lockfiles/v61/pnpm-lock.yaml +++ b/e2e/pnpm_lockfiles/v61/pnpm-lock.yaml @@ -31,6 +31,12 @@ importers: '@scoped/d': specifier: ../projects/d version: link:../projects/d + debug: + specifier: ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53 + version: github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53 + hello: + specifier: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello + version: '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello' meaning-of-life: specifier: 1.0.0 version: 1.0.0(patch_hash=o3deharooos255qt5xdujc3cuq) @@ -151,6 +157,10 @@ packages: engines: {node: '>=4'} dev: false + /ms@0.7.3: + resolution: {integrity: sha512-lrKNzMWqQZgwJahtrtrM+9NgOoDUveDrVmm5aGXrf3BdtL0mq7X6IVzoZaw+TfNti29eHd1/8GI+h45K5cQ6/w==} + dev: false + /rollup@3.2.5: resolution: {integrity: sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -177,6 +187,12 @@ packages: sade: 1.8.1 dev: false + '@gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello': + resolution: {tarball: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello} + name: hello + version: 1.0.0 + dev: false + file:../projects/c: resolution: {directory: ../projects/c, type: directory} name: '@scoped/c' @@ -184,6 +200,19 @@ packages: '@scoped/a': link:../a dev: false + github.com/ngokevin/debug/9742c5f383a6f8046241920156236ade8ec30d53: + resolution: {tarball: https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53} + name: debug + version: 2.6.3 + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 0.7.3 + dev: false + registry.npmjs.org/@types/archiver@5.3.1: resolution: {integrity: sha512-wKYZaSXaDvTZuInAWjCeGG7BEAgTWG2zZW0/f7IYFcoHB2X2d9lkVFnrOlXl3W6NrvO6Ml3FLLu8Uksyymcpnw==, registry: https://registry.yarnpkg.com/, tarball: https://registry.npmjs.org/@types/archiver/-/archiver-5.3.1.tgz} name: '@types/archiver' diff --git a/e2e/pnpm_lockfiles/v61/snapshots/defs.bzl b/e2e/pnpm_lockfiles/v61/snapshots/defs.bzl index dd2d129ee2..d41da5b4a3 100644 --- a/e2e/pnpm_lockfiles/v61/snapshots/defs.bzl +++ b/e2e/pnpm_lockfiles/v61/snapshots/defs.bzl @@ -16,13 +16,16 @@ load("@@aspect_rules_js~~npm~lock-__fsevents__2.3.3__links//:defs.b load("@@aspect_rules_js~~npm~lock-__kleur__4.1.5__links//:defs.bzl", store_9 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq__links//:defs.bzl", link_10 = "npm_link_imported_package_store", store_10 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__mri__1.2.0__links//:defs.bzl", store_11 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_12 = "npm_link_imported_package_store", store_12 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_13 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_14 = "npm_link_imported_package_store", store_14 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_15 = "npm_link_imported_package_store", store_15 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_16 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_17 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_18 = "npm_link_imported_package_store", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__ms__0.7.3__links//:defs.bzl", store_12 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_13 = "npm_link_imported_package_store", store_13 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_14 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_15 = "npm_link_imported_package_store", store_15 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__hello__at_gitpkg.vercel.app_EqualMa_gitpkg-hello_packages_hello__links//:defs.bzl", link_16 = "npm_link_imported_package_store", store_16 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__debug__github.com_ngokevin_debug_9742c5f383a6f8046241920156236ade8ec30d53__links//:defs.bzl", link_17 = "npm_link_imported_package_store", store_17 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_archiver__registry.npmjs.org_at_types_archiver_5.3.1__links//:defs.bzl", link_18 = "npm_link_imported_package_store", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_glob__registry.npmjs.org_at_types_glob_8.1.0__links//:defs.bzl", store_19 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__registry.npmjs.org_at_types_minimatch_5.1.2__links//:defs.bzl", store_20 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__at_types_node__registry.npmjs.org_at_types_node_16.18.11__links//:defs.bzl", link_21 = "npm_link_imported_package_store", store_21 = "npm_imported_package_store") _LINK_PACKAGES = ["", "projects/a", "projects/b", "projects/c", "projects/d"] @@ -57,13 +60,16 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): store_9(name = "{}/kleur".format(name)) store_10(name = "{}/meaning-of-life".format(name)) store_11(name = "{}/mri".format(name)) - store_12(name = "{}/rollup".format(name)) - store_13(name = "{}/sade".format(name)) - store_14(name = "{}/uvu".format(name)) - store_15(name = "{}/@types/archiver".format(name)) - store_16(name = "{}/@types/glob".format(name)) - store_17(name = "{}/@types/minimatch".format(name)) - store_18(name = "{}/@types/node".format(name)) + store_12(name = "{}/ms".format(name)) + store_13(name = "{}/rollup".format(name)) + store_14(name = "{}/sade".format(name)) + store_15(name = "{}/uvu".format(name)) + store_16(name = "{}/hello".format(name)) + store_17(name = "{}/debug".format(name)) + store_18(name = "{}/@types/archiver".format(name)) + store_19(name = "{}/@types/glob".format(name)) + store_20(name = "{}/@types/minimatch".format(name)) + store_21(name = "{}/@types/node".format(name)) if link: if bazel_package == "": link_0(name = "{}/@aspect-test/a".format(name)) @@ -80,14 +86,18 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): scope_targets["@aspect-test"] = scope_targets["@aspect-test"] + [link_targets[-1]] if "@aspect-test" in scope_targets else [link_targets[-1]] link_10(name = "{}/meaning-of-life".format(name)) link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) - link_12(name = "{}/rollup".format(name)) + link_13(name = "{}/rollup".format(name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) - link_14(name = "{}/uvu".format(name)) + link_15(name = "{}/uvu".format(name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) - link_15(name = "{}/@types/archiver".format(name)) + link_16(name = "{}/hello".format(name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_17(name = "{}/debug".format(name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) + link_18(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]] - link_18(name = "{}/@types/node".format(name)) + link_21(name = "{}/@types/node".format(name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) scope_targets["@types"] = scope_targets["@types"] + [link_targets[-1]] if "@types" in scope_targets else [link_targets[-1]] @@ -260,6 +270,8 @@ def npm_link_targets(name = "node_modules", package = None): link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) + link_targets.append("//{}:{}/hello".format(bazel_package, name)) + link_targets.append("//{}:{}/debug".format(bazel_package, name)) link_targets.append("//{}:{}/@types/archiver".format(bazel_package, name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) diff --git a/e2e/pnpm_lockfiles/v90/pnpm-lock.yaml b/e2e/pnpm_lockfiles/v90/pnpm-lock.yaml index c6e63753d9..1e5f4e367c 100644 --- a/e2e/pnpm_lockfiles/v90/pnpm-lock.yaml +++ b/e2e/pnpm_lockfiles/v90/pnpm-lock.yaml @@ -31,6 +31,12 @@ importers: '@scoped/d': specifier: ../projects/d version: link:../projects/d + debug: + specifier: ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53 + version: https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53 + hello: + specifier: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello + version: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello meaning-of-life: specifier: 1.0.0 version: 1.0.0(patch_hash=o3deharooos255qt5xdujc3cuq) @@ -118,6 +124,15 @@ packages: '@types/node@16.18.11': resolution: {integrity: sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==, tarball: https://registry.npmjs.org/@types/node/-/node-16.18.11.tgz} + debug@https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53: + resolution: {tarball: https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53} + version: 2.6.3 + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -131,6 +146,10 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + hello@https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello: + resolution: {tarball: https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello} + version: 1.0.0 + kleur@4.1.5: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} @@ -142,6 +161,9 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} + ms@0.7.3: + resolution: {integrity: sha512-lrKNzMWqQZgwJahtrtrM+9NgOoDUveDrVmm5aGXrf3BdtL0mq7X6IVzoZaw+TfNti29eHd1/8GI+h45K5cQ6/w==} + rollup@3.2.5: resolution: {integrity: sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -198,6 +220,10 @@ snapshots: '@types/node@16.18.11': {} + debug@https://codeload.github.com/ngokevin/debug/tar.gz/9742c5f383a6f8046241920156236ade8ec30d53: + dependencies: + ms: 0.7.3 + dequal@2.0.3: {} diff@5.2.0: {} @@ -205,12 +231,16 @@ snapshots: fsevents@2.3.3: optional: true + hello@https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello: {} + kleur@4.1.5: {} meaning-of-life@1.0.0(patch_hash=o3deharooos255qt5xdujc3cuq): {} mri@1.2.0: {} + ms@0.7.3: {} + rollup@3.2.5: optionalDependencies: fsevents: 2.3.3 diff --git a/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl b/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl index 4f53ca7a9a..b7b1ff8742 100644 --- a/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl +++ b/e2e/pnpm_lockfiles/v90/snapshots/defs.bzl @@ -14,15 +14,18 @@ load("@@aspect_rules_js~~npm~lock-__at_types_archiver__5.3.1__links load("@@aspect_rules_js~~npm~lock-__at_types_glob__8.1.0__links//:defs.bzl", store_7 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_types_minimatch__5.1.2__links//:defs.bzl", store_8 = "npm_imported_package_store") load("@@aspect_rules_js~~npm~lock-__at_types_node__16.18.11__links//:defs.bzl", link_9 = "npm_link_imported_package_store", store_9 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__dequal__2.0.3__links//:defs.bzl", store_10 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__diff__5.2.0__links//:defs.bzl", store_11 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__fsevents__2.3.3__links//:defs.bzl", store_12 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__kleur__4.1.5__links//:defs.bzl", store_13 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq__links//:defs.bzl", link_14 = "npm_link_imported_package_store", store_14 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__mri__1.2.0__links//:defs.bzl", store_15 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_16 = "npm_link_imported_package_store", store_16 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_17 = "npm_imported_package_store") -load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_18 = "npm_link_imported_package_store", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__debug__codeload.github.com_ngokevin_debug_tar.gz_9742c5f383a6f8046241920156236ade8ec30d53__links//:defs.bzl", store_10 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__dequal__2.0.3__links//:defs.bzl", store_11 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__diff__5.2.0__links//:defs.bzl", store_12 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__fsevents__2.3.3__links//:defs.bzl", store_13 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__hello__gitpkg.vercel.app_EqualMa_gitpkg-hello_packages_hello__links//:defs.bzl", store_14 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__kleur__4.1.5__links//:defs.bzl", store_15 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq__links//:defs.bzl", link_16 = "npm_link_imported_package_store", store_16 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__mri__1.2.0__links//:defs.bzl", store_17 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__ms__0.7.3__links//:defs.bzl", store_18 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__rollup__3.2.5__links//:defs.bzl", link_19 = "npm_link_imported_package_store", store_19 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__sade__1.8.1__links//:defs.bzl", store_20 = "npm_imported_package_store") +load("@@aspect_rules_js~~npm~lock-__uvu__0.5.6__links//:defs.bzl", link_21 = "npm_link_imported_package_store", store_21 = "npm_imported_package_store") _LINK_PACKAGES = ["", "projects/a", "projects/b", "projects/c", "projects/d"] @@ -55,15 +58,18 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): store_7(name = "{}/@types/glob".format(name)) store_8(name = "{}/@types/minimatch".format(name)) store_9(name = "{}/@types/node".format(name)) - store_10(name = "{}/dequal".format(name)) - store_11(name = "{}/diff".format(name)) - store_12(name = "{}/fsevents".format(name)) - store_13(name = "{}/kleur".format(name)) - store_14(name = "{}/meaning-of-life".format(name)) - store_15(name = "{}/mri".format(name)) - store_16(name = "{}/rollup".format(name)) - store_17(name = "{}/sade".format(name)) - store_18(name = "{}/uvu".format(name)) + store_10(name = "{}/debug".format(name)) + store_11(name = "{}/dequal".format(name)) + store_12(name = "{}/diff".format(name)) + store_13(name = "{}/fsevents".format(name)) + store_14(name = "{}/hello".format(name)) + store_15(name = "{}/kleur".format(name)) + store_16(name = "{}/meaning-of-life".format(name)) + store_17(name = "{}/mri".format(name)) + store_18(name = "{}/ms".format(name)) + store_19(name = "{}/rollup".format(name)) + store_20(name = "{}/sade".format(name)) + store_21(name = "{}/uvu".format(name)) if link: if bazel_package == "": link_0(name = "{}/@aspect-test/a".format(name)) @@ -84,11 +90,11 @@ def npm_link_all_packages(name = "node_modules", imported_links = []): link_9(name = "{}/@types/node".format(name)) link_targets.append("//{}:{}/@types/node".format(bazel_package, name)) scope_targets["@types"] = scope_targets["@types"] + [link_targets[-1]] if "@types" in scope_targets else [link_targets[-1]] - link_14(name = "{}/meaning-of-life".format(name)) + link_16(name = "{}/meaning-of-life".format(name)) link_targets.append("//{}:{}/meaning-of-life".format(bazel_package, name)) - link_16(name = "{}/rollup".format(name)) + link_19(name = "{}/rollup".format(name)) link_targets.append("//{}:{}/rollup".format(bazel_package, name)) - link_18(name = "{}/uvu".format(name)) + link_21(name = "{}/uvu".format(name)) link_targets.append("//{}:{}/uvu".format(bazel_package, name)) if is_root: diff --git a/npm/private/utils.bzl b/npm/private/utils.bzl index 6cfdba684f..1d5b85e561 100644 --- a/npm/private/utils.bzl +++ b/npm/private/utils.bzl @@ -242,7 +242,7 @@ def _convert_pnpm_v6_v9_version_peer_dep(version): # "File name too long) build failures. peer_dep = "_" + _hash(peer_dep) version = version[0:peer_dep_index] + _sanitize_string(peer_dep) - version = version.rstrip("_") + version = version.strip("_") return version def _convert_pnpm_v6_importer_dependency_map(deps): @@ -371,6 +371,19 @@ def _convert_pnpm_v9_package_dependency_map(deps): # v9 importers are the same as v6 importers _convert_v9_importers = _convert_v6_importers +def _parse_v9_snapshot_key(key): + peers = None + + # Split a snapshot key of the form name@version[(scoped-data)] + if key[-1] == ")": + peer_meta_index = key.index("(") + peers = _convert_pnpm_v6_v9_version_peer_dep(key[peer_meta_index:]) + key = key[:peer_meta_index] + + name, version = key.rsplit("@", 1) + + return name, version, peers + def _convert_v9_packages(packages, snapshots): # Convert pnpm lockfile v9 importers to a rules_js compatible format. @@ -402,8 +415,9 @@ def _convert_v9_packages(packages, snapshots): # Snapshots contains the packages with the keys (which include peers) to return for package_key, package_snapshot in snapshots.items(): - peer_meta_index = package_key.find("(") - static_key = package_key[:peer_meta_index] if peer_meta_index > 0 else package_key + name, version, peers_key = _parse_v9_snapshot_key(package_key) + static_key = "{}@{}".format(name, version) + if not static_key in packages: msg = "package {} not found in pnpm 'packages'".format(static_key) fail(msg) @@ -414,16 +428,20 @@ def _convert_v9_packages(packages, snapshots): msg = "package {} has no resolution field".format(static_key) fail(msg) - # the raw name + version are the key, not including peerDeps+patch - name, friendly_version = static_key.rsplit("@", 1) - package_key = _convert_pnpm_v6_v9_version_peer_dep(package_key) - - # Extract the version including peerDeps+patch from the key - version = package_key.rsplit("@", 1)[1] + # Strip URL-style protocols from version to align more with pnpm