mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 12:34:32 +08:00
This commit bundles the Critters library to ensure compatibility with Nodeless environments. Additionally, all licenses for bundled libraries, including Critters, are now included in the package. This helps maintain compliance with open-source license requirements.
56 lines
1.4 KiB
Python
56 lines
1.4 KiB
Python
load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", "esbuild", "esbuild_config")
|
|
load("//tools:defaults.bzl", "js_library")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
esbuild(
|
|
name = "bundled_critters",
|
|
config = ":esbuild_config",
|
|
entry_point = "@npm//:node_modules/critters/dist/critters.mjs",
|
|
metafile = True,
|
|
splitting = True,
|
|
deps = [
|
|
"@npm//critters",
|
|
"@npm//unenv",
|
|
],
|
|
)
|
|
|
|
esbuild_config(
|
|
name = "esbuild_config",
|
|
config_file = "esbuild.config.mjs",
|
|
)
|
|
|
|
js_library(
|
|
name = "bundled_critters_lib",
|
|
srcs = [
|
|
"index.d.ts",
|
|
":bundled_critters_files",
|
|
],
|
|
deps = [
|
|
"@npm//critters",
|
|
],
|
|
)
|
|
|
|
# Filter out esbuild metadata files and only copy the necessary files
|
|
genrule(
|
|
name = "bundled_critters_files",
|
|
srcs = [
|
|
":bundled_critters",
|
|
],
|
|
outs = [
|
|
"index.js",
|
|
"index.js.map",
|
|
"THIRD_PARTY_LICENSES.txt",
|
|
],
|
|
cmd = """
|
|
for f in $(locations :bundled_critters); do
|
|
# Only process files inside the bundled_critters directory
|
|
if [[ "$${f}" == *bundled_critters ]]; then
|
|
cp "$${f}/index.js" $(location :index.js)
|
|
cp "$${f}/index.js.map" $(location :index.js.map)
|
|
cp "$${f}/THIRD_PARTY_LICENSES.txt" $(location :THIRD_PARTY_LICENSES.txt)
|
|
fi
|
|
done
|
|
""",
|
|
)
|