Paul Gschwendtner 762e057e85 build: update to rules_nodejs v4.0.0-beta.0 (#42760)
Updates the Bazel NodeJS rules to v4.0.0-beta.0. This is necessary
so that the Angular components repo can update, and it's generally
good to stay as up-to-date as possible with the Bazel rules as it's
easy to fall behind, and updating early allows us to discover issues
affecting our tooling earlier (where they are easier to address due to
e.g. potential breaking change policy).

PR Close #42760
2021-07-09 14:50:15 -07:00

35 lines
1.3 KiB
Python

# Copyright Google LLC All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.io/license
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
# This file continues to serve as indicator for `rules_nodejs` and instructs it preserve the
# content output in the NPM install workspace. This allows consumers to use rules and targets from
# within Bazel. e.g. by using `@npm//@angular/dev-infra-private/<..>`.
# See: https://github.com/bazelbuild/rules_nodejs/commit/4f508b1a0be1f5444e9c13b0439e649449792fef.
def ng_dev_rolled_up_generated_file(name, entry_point, deps = [], rollup_args = []):
"""Rollup and generated file test macro.
This provides a single macro to create a rollup bundled script and a generated file test for the
created script to ensure it stays up to date in the repository.
"""
rollup_bundle(
name = "%s_bundle" % name,
args = rollup_args,
entry_point = entry_point,
format = "cjs",
silent = True,
sourcemap = "false",
deps = deps,
)
generated_file_test(
name = name,
src = "%s.js" % name,
generated = "%s_bundle" % name,
)