diff --git a/example/BUILD.bazel b/example/BUILD.bazel index 8b17ce7..5eb9edf 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -1,13 +1,14 @@ load("@aspect_rules_rollup//rollup:rollup_bundle.bzl", "rollup_bundle") load("@aspect_rules_js//js:defs.bzl", "link_js_package") -load("@npm//:defs.bzl", "link_js_packages", "package") +load("@npm//:defs.bzl", "link_js_packages") load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") link_js_packages() link_js_package( - name = package("@rollup_example/lib").name, + name = "link_lib", src = "//example/lib", + root_package = "example", ) rollup_bundle( @@ -16,8 +17,8 @@ rollup_bundle( entry_point = "main.js", sourcemap = "false", deps = [ - package("@rollup_example/lib"), - "@npm//@rollup/plugin-node-resolve", + ":link_lib", + "@npm//example/@rollup/plugin-node-resolve", ], ) diff --git a/rollup/dependencies.bzl b/rollup/dependencies.bzl index ce4e1ab..2d6d22f 100644 --- a/rollup/dependencies.bzl +++ b/rollup/dependencies.bzl @@ -32,9 +32,9 @@ def rules_rollup_dependencies(): maybe( http_archive, name = "aspect_rules_js", - sha256 = "7bce67d6bfc7992f29f55405a6e750075987c9fc142fdb5d4f452a4b669c3faf", - strip_prefix = "rules_js-0.6.2", - url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v0.6.2.tar.gz", + sha256 = "06dd11130f05df3e8b9aa8cc1b93577e88f540cd4ece8f00035109cc17dcf5ff", + strip_prefix = "rules_js-0.8.0", + url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v0.8.0.tar.gz", ) maybe( diff --git a/rollup/private/v2.70.2/defs.bzl b/rollup/private/v2.70.2/defs.bzl index f120c61..6ea2155 100755 --- a/rollup/private/v2.70.2/defs.bzl +++ b/rollup/private/v2.70.2/defs.bzl @@ -1,18 +1,17 @@ "@generated by @aspect_rules_js//js/private:translate_pnpm_lock.bzl from pnpm lock file @//:pnpm-lock.yaml" -load("@aspect_rules_js//js/private:pnpm_utils.bzl", _pnpm_utils = "pnpm_utils") load("@bazel_skylib//lib:paths.bzl", _paths = "paths") load("@npm__rollup__2.70.2__links//:link_js_package.bzl", link_1 = "link_js_package") # buildifier: disable=unnamed-macro def link_js_packages(): - "Generated list of link_js_package() target generators and first party linked packages corresponding to the packages in @//:pnpm-lock.yaml" - root_path = "" + "Generated list of link_js_package() target generators and first-party linked packages corresponding to the packages in @//:pnpm-lock.yaml" + root_package = "" importer_paths = ["."] - is_root = native.package_name() == root_path + is_root = native.package_name() == root_package is_direct = False for import_path in importer_paths: - importer_package_path = _paths.normalize(_paths.join(root_path, import_path)) + importer_package_path = _paths.normalize(_paths.join(root_package, import_path)) if importer_package_path == ".": importer_package_path = "" if importer_package_path == native.package_name(): @@ -21,22 +20,4 @@ def link_js_packages(): msg = "The link_js_packages() macro loaded from @npm//:defs.bzl and called in bazel package '%s' may only be called in the bazel package(s) corresponding to the root package '' and packages corresponding to importer paths ['.']" % native.package_name() fail(msg) - link_1(False) - -def package(name, import_path = "."): - package_path = _paths.normalize(_paths.join("", import_path)) - if package_path == ".": - package_path = "" - return Label("@//{package_path}:jsp__{bazel_name}".format( - package_path = package_path, - bazel_name = _pnpm_utils.bazel_name(name), - )) - -def package_dir(name, import_path = "."): - package_path = _paths.normalize(_paths.join("", import_path)) - if package_path == ".": - package_path = "" - return Label("@//{package_path}:jsp__{bazel_name}__dir".format( - package_path = package_path, - bazel_name = _pnpm_utils.bazel_name(name), - )) + link_1(name = "direct__rollup", direct = None, fail_if_no_link = False) diff --git a/rollup/private/v2.70.2/repositories.bzl b/rollup/private/v2.70.2/repositories.bzl index 8a44254..d3e485f 100755 --- a/rollup/private/v2.70.2/repositories.bzl +++ b/rollup/private/v2.70.2/repositories.bzl @@ -7,8 +7,9 @@ def npm_repositories(): npm_import( name = "npm__rollup__2.70.2", integrity = "sha512-EitogNZnfku65I1DD5Mxe8JYRUCy0hkK5X84IlDtUs+O6JRMpRciXTzyCUuX11b5L5pvjH+OmFXiQ3XjabcXgg==", - root_path = "", - link_paths = ["."], + root_package = "", + link_workspace = "", + link_packages = [""], package = "rollup", version = "2.70.2", transitive_closure = { diff --git a/rollup/repositories.bzl b/rollup/repositories.bzl index 756f2ec..3b71ea5 100644 --- a/rollup/repositories.bzl +++ b/rollup/repositories.bzl @@ -24,13 +24,13 @@ link_js_packages() directory_path( name = "rollup_entrypoint", - directory = ":jsp__rollup__dir", + directory = ":direct__rollup__dir", path = "dist/bin/rollup", ) js_binary( name = "{name}", - data = ["//:jsp__rollup"], + data = ["//:direct__rollup"], entry_point = ":rollup_entrypoint", visibility = ["//visibility:public"], ) diff --git a/scripts/mirror_release.sh b/scripts/mirror_release.sh index 863a36a..19ebc3d 100755 --- a/scripts/mirror_release.sh +++ b/scripts/mirror_release.sh @@ -2,21 +2,21 @@ set -o errexit -o nounset SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -version="$(curl --silent "https://registry.npmjs.org/rollup/latest" | jq --raw-output ".version")" +version="${1:-$(curl --silent "https://registry.npmjs.org/rollup/latest" | jq --raw-output ".version")}" out="$SCRIPT_DIR/../rollup/private/v${version}" mkdir -p "$out" cd $(mktemp -d) -npx pnpm install rollup --lockfile-only +npx pnpm install "rollup@$version" --lockfile-only touch BUILD cat >WORKSPACE <