-
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathMODULE.bazel
More file actions
329 lines (308 loc) · 12.4 KB
/
MODULE.bazel
File metadata and controls
329 lines (308 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
"aspect-build/rules_js"
module(
name = "aspect_rules_js",
bazel_compatibility = [">=7.6.0"],
compatibility_level = 1,
)
# Lower-bounds (minimum) versions for direct runtime dependencies.
# Do not bump these unless rules_js requires a newer version to function.
bazel_dep(name = "diff.bzl", version = "0.4.3")
bazel_dep(name = "tar.bzl", version = "0.6.0")
bazel_dep(name = "yq.bzl", version = "0.3.2")
bazel_dep(name = "jq.bzl", version = "0.4.0")
bazel_dep(name = "aspect_tools_telemetry", version = "0.3.3")
bazel_dep(name = "bazel_features", version = "1.41.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_nodejs", version = "6.7.3")
# Changes ensured by rules_js:
# 3.2.2: https://github.com/bazel-contrib/bazel-lib/commit/cac2d7855949d1b222fa26888892fbbe1d31015d
bazel_dep(name = "bazel_lib", version = "3.2.2")
# NB: LOWER BOUND on earliest BCR release of protobuf module, to avoid upgrading the root module by accident
bazel_dep(name = "protobuf", version = "3.19.6")
# Ensure any version of aspect_bazel_lib used includes:
# https://github.com/bazel-contrib/bazel-lib/commit/371362199e5e5bde58aeb15b54ea6cfb164af337
# https://github.com/bazel-contrib/bazel-lib/commit/ceaff54210291292f35d03bd4bbc0b6ceb40e77a
# https://github.com/bazel-contrib/bazel-lib/commit/27a9e7af51c0f806f823425a03283ae487d3a953
# https://github.com/bazel-contrib/bazel-lib/commit/e56aa707b72364bb1cc6f92580cb12ff88dfc1b4
# https://github.com/bazel-contrib/bazel-lib/commit/2befef614904d0ebe5161beb271ac31c83e82fd2
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5", repo_name = None)
tel = use_extension("@aspect_tools_telemetry//:extension.bzl", "telemetry")
use_repo(tel, "aspect_tools_telemetry_report")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
use_repo(node, "nodejs_toolchains")
use_repo(node, "nodejs_darwin_amd64")
use_repo(node, "nodejs_darwin_arm64")
use_repo(node, "nodejs_linux_amd64")
use_repo(node, "nodejs_linux_arm64")
use_repo(node, "nodejs_linux_ppc64le")
use_repo(node, "nodejs_linux_s390x")
use_repo(node, "nodejs_windows_amd64")
# The default + public version of pnpm used by default.
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(name = "pnpm")
use_repo(pnpm, "pnpm", "pnpm__links")
bazel_lib_toolchains = use_extension("@bazel_lib//lib:extensions.bzl", "toolchains")
use_repo(
bazel_lib_toolchains,
"coreutils_darwin_amd64",
"coreutils_darwin_arm64",
"coreutils_linux_amd64",
"coreutils_linux_arm64",
"coreutils_toolchains",
"coreutils_windows_amd64",
"coreutils_windows_arm64",
)
yq_toolchain = use_extension("@yq.bzl//yq:extensions.bzl", "yq")
use_repo(
yq_toolchain,
"yq_darwin_amd64",
"yq_darwin_arm64",
"yq_linux_amd64",
"yq_linux_arm64",
"yq_linux_ppc64le",
"yq_linux_s390x",
"yq_windows_amd64",
)
tar_toolchains = use_extension("@tar.bzl//tar:extensions.bzl", "toolchains")
use_repo(
tar_toolchains,
"bsd_tar_toolchains",
"bsd_tar_toolchains_darwin_amd64",
"bsd_tar_toolchains_darwin_arm64",
"bsd_tar_toolchains_linux_amd64",
"bsd_tar_toolchains_linux_arm64",
"bsd_tar_toolchains_windows_amd64",
"bsd_tar_toolchains_windows_arm64",
)
####### Dev dependencies ########
# Dev-only pnpm used for local testing
pnpm10 = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm", dev_dependency = True)
pnpm10.pnpm(
name = "pnpm10",
pnpm_version = "10.22.0",
pnpm_version_integrity = "sha512-vwSe/plbKPUn/StBrgR0zikYb37cs79UUIe9Yfu+uyv3U2LRMH/aCcLSiOHkmXh6wS1Py2F6l0cYpgUfLu50HA==",
)
use_repo(pnpm10, "pnpm10")
bazel_dep(name = "bazelrc-preset.bzl", version = "1.3.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "1.13.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1", dev_dependency = True)
bazel_dep(name = "rules_shell", version = "0.6.1", dev_dependency = True)
host = use_extension(
"@bazel_lib//lib:extensions.bzl",
"host",
dev_dependency = True,
)
host.host()
use_repo(host, "bazel_lib_host")
node_dev = use_extension(
"@rules_nodejs//nodejs:extensions.bzl",
"node",
dev_dependency = True,
)
use_repo(node_dev, "node20_linux_amd64")
use_repo(node_dev, "node20_darwin_arm64")
use_repo(node_dev, "node20_darwin_amd64")
use_repo(node_dev, "node20_linux_arm64")
use_repo(node_dev, "node20_linux_s390x")
use_repo(node_dev, "node20_linux_ppc64le")
use_repo(node_dev, "node20_windows_amd64")
use_repo(node_dev, "node22_linux_amd64")
use_repo(node_dev, "node22_darwin_arm64")
use_repo(node_dev, "node22_darwin_amd64")
use_repo(node_dev, "node22_linux_arm64")
use_repo(node_dev, "node22_linux_s390x")
use_repo(node_dev, "node22_linux_ppc64le")
use_repo(node_dev, "node22_windows_amd64")
use_repo(node_dev, "node24_linux_amd64")
use_repo(node_dev, "node24_darwin_arm64")
use_repo(node_dev, "node24_darwin_amd64")
use_repo(node_dev, "node24_linux_arm64")
use_repo(node_dev, "node24_linux_s390x")
use_repo(node_dev, "node24_linux_ppc64le")
use_repo(node_dev, "node24_windows_amd64")
# default name+version
node_dev.toolchain()
# additional custom name+versions
node_dev.toolchain(
name = "node20",
node_version = "20.17.0",
)
node_dev.toolchain(
name = "node22",
node_version = "22.20.0",
)
node_dev.toolchain(
name = "node24",
node_version = "24.9.0",
)
############################################
# npm dependencies used by examples
npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
bins = {
# derived from "bin" attribute in node_modules/typescript/package.json
"typescript": [
"tsc=./bin/tsc",
"tsserver=./bin/tsserver",
],
},
custom_postinstalls = {
"@aspect-test/c": "echo moo > cow.txt",
"@aspect-test/[email protected]": "echo mooo >> cow.txt",
"pngjs": "chmod -R a+X *", # fixes malformed tarball content file permissions in this package after extraction (see https://github.com/aspect-build/rules_js/issues/1637 for more details)
},
data = [
"//:package.json",
"//:pnpm-workspace.yaml",
"//examples/js_binary:package.json",
"//examples/js_lib_pkg/a:package.json",
"//examples/js_lib_pkg/b:package.json",
"//examples/linked_consumer:package.json",
"//examples/linked_empty_node_modules:package.json",
"//examples/linked_lib:package.json",
"//examples/linked_pkg:package.json",
"//examples/macro:package.json",
"//examples/nextjs:package.json",
"//examples/npm_deps:package.json",
"//examples/npm_deps/patches:[email protected]",
"//examples/npm_package/libs/lib_a:package.json",
"//examples/npm_package/packages/pkg_a:package.json",
"//examples/npm_package/packages/pkg_b:package.json",
"//examples/npm_package/packages/pkg_d:package.json",
"//examples/npm_package/packages/pkg_e:package.json",
"//examples/runfiles:package.json",
"//examples/stack_traces:package.json",
"//examples/vite3:package.json",
"//examples/vite6:package.json",
"//examples/webpack_cli:package.json",
"//js/private/coverage/bundle:package.json",
"//js/private/devserver/src:package.json",
"//js/private/test/image:package.json",
"//js/private/test/js_run_devserver:package.json",
"//js/private/test/node-patches:package.json",
"//js/private/worker/src:package.json",
"//npm/private/lifecycle:package.json",
"//npm/private/test:package.json",
"//npm/private/test:vendored/lodash-4.17.21.tgz",
"//npm/private/test/npm_package:package.json",
"//npm/private/test/npm_package_publish:package.json",
"//npm/private/test/subs:package.json",
"//npm/private/test/vendored/is-odd:package.json",
"//npm/private/test/vendored/semver-max:package.json",
],
generate_bzl_library_targets = True,
lifecycle_hooks = {
# We fetch @kubernetes/client-node from source and it has a `prepare` lifecycle hook that needs to be run
# which runs the `build` package.json script: https://github.com/kubernetes-client/javascript/blob/fc681991e61c6808dd26012a2331f83671a11218/package.json#L28.
# Here we run run build so we just run `tsc` instead of `npm run build` which ends up just running `tsc`.
"@kubernetes/client-node": ["build"],
# 'install' hook fails as it assumes the following path to `node-pre-gyp`: ./node_modules/.bin/node-pre-gyp
# https://github.com/stultuss/protoc-gen-grpc-ts/blob/53d52a9d0e1fe3cbe930dec5581eca89b3dde807/package.json#L28
"[email protected]": [],
},
lifecycle_hooks_execution_requirements = {
"*": [
"no-sandbox",
],
# If @kubernetes/client-node is not sandboxed, will fail with
# ```
# src/azure_auth.ts(97,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/azure_auth.ts(98,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/gcp_auth.ts(93,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/gcp_auth.ts(94,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# ```
# since a `[email protected]` that is newer then the transitive dep `[email protected]` is found outside of the sandbox that
# includes typings that don't match the 0.19.0 "any" usage.
"@kubernetes/client-node": [],
"@figma/nodegit": [
"no-sandbox",
"requires-network",
],
"esbuild": [
"no-sandbox",
"requires-network",
],
"segfault-handler": [
"no-sandbox",
"requires-network",
],
"puppeteer": [
"no-remote",
"no-sandbox",
"requires-network",
],
},
npmrc = "//:.npmrc",
package_visibility = {
"unused": ["//npm/private/test:__subpackages__"],
"@mycorp/pkg-a": [
"//examples:__subpackages__",
"//js/private/test/image:__subpackages__",
],
"@mycorp/pkg-d": [
"//examples:__subpackages__",
"//js/private/test/image:__subpackages__",
],
"@mycorp/pkg-e": ["//examples:__subpackages__"],
},
pnpm_lock = "//:pnpm-lock.yaml",
public_hoist_packages = {
# Instructs the linker to hoist the [email protected] npm package to `node_modules/ms` in the `examples/npm_deps` package.
# Similar to adding `public-hoist-pattern[]=ms` in .npmrc but with control over which version to hoist and where
# to hoist it. This hoisted package can be referenced by the label `//examples/npm_deps:node_modules/ms` same as
# other direct dependencies in the `examples/npm_deps/package.json`.
"[email protected]": ["examples/npm_deps"],
},
update_pnpm_lock = True,
use_pnpm = "@pnpm10//:package/bin/pnpm.cjs",
verify_node_modules_ignored = "//:.bazelignore",
verify_patches = "//examples/npm_deps/patches:patches",
)
npm.npm_translate_lock(
name = "npm-no_optional",
no_optional = True,
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
)
npm.npm_translate_lock(
name = "npm-no_dev",
no_dev = True,
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
)
use_repo(
npm,
"npm",
"npm-no_dev",
"npm-no_optional",
"npm__es5-ext__0.10.64__links",
"npm__fsevents__2.3.3__links",
"npm__google-closure-compiler__20251111.0.0__links",
"npm__next__15.2.6_1642820312__links",
"npm__rollup__4.55.2",
"npm__rollup__4.55.2__links",
"npm__unused__0.2.2__links",
"npm__webpack-bundle-analyzer__4.5.0_bufferutil_4.0.8",
)
# As an example, manually import a package using explicit coordinates.
# Just a demonstration of the syntax de-sugaring.
npm.npm_import(
name = "acorn__8.4.0",
bins = {"acorn": "./bin/acorn"},
integrity = "sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==",
package = "acorn",
# Root package where to link the package store
root_package = "",
version = "8.4.0",
)
use_repo(
npm,
"acorn__8.4.0",
"acorn__8.4.0__links",
)