forked from aspect-build/rules_js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MODULE.bazel
197 lines (186 loc) · 7.64 KB
/
MODULE.bazel
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
"aspect-build/rules_js"
module(
name = "aspect_rules_js",
version = "0.0.0",
compatibility_level = 1,
)
# Lower-bounds for runtime dependencies.
# Do not bump these unless rules_js requires a newer version to function.
bazel_dep(name = "aspect_bazel_lib", version = "1.31.2")
bazel_dep(name = "bazel_features", version = "0.1.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_nodejs", version = "5.8.2")
bazel_dep(name = "platforms", version = "0.0.4")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
use_repo(node, "nodejs_linux_amd64")
use_repo(node, "nodejs_darwin_arm64")
use_repo(node, "nodejs_darwin_amd64")
use_repo(node, "nodejs_linux_arm64")
use_repo(node, "nodejs_linux_s390x")
use_repo(node, "nodejs_linux_ppc64le")
use_repo(node, "nodejs_windows_amd64")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
name = "pnpm",
pnpm_version = "8.6.7",
pnpm_version_integrity = "sha512-vRIWpD/L4phf9Bk2o/O2TDR8fFoJnpYrp2TKqTIZF/qZ2/rgL3qKXzHofHgbXsinwMoSEigz28sqk3pQ+yMEQQ==",
)
use_repo(pnpm, "pnpm", "pnpm__links")
####### Dev dependencies ########
bazel_dep(name = "gazelle", version = "0.32.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "buildifier_prebuilt", version = "6.1.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
ext = use_extension(
"@aspect_bazel_lib//lib:extensions.bzl",
"ext",
dev_dependency = True,
)
ext.host()
use_repo(ext, "aspect_bazel_lib_host")
use_repo(ext, "coreutils_toolchains")
node_dev = use_extension(
"@rules_nodejs//nodejs:extensions.bzl",
"node",
dev_dependency = True,
)
use_repo(node_dev, "nodejs_toolchains")
use_repo(node_dev, "node18_linux_amd64")
use_repo(node_dev, "node18_darwin_arm64")
use_repo(node_dev, "node18_darwin_amd64")
use_repo(node_dev, "node18_linux_arm64")
use_repo(node_dev, "node18_linux_s390x")
use_repo(node_dev, "node18_linux_ppc64le")
use_repo(node_dev, "node18_windows_amd64")
use_repo(node_dev, "node16_linux_amd64")
use_repo(node_dev, "node16_darwin_arm64")
use_repo(node_dev, "node16_darwin_amd64")
use_repo(node_dev, "node16_linux_arm64")
use_repo(node_dev, "node16_linux_s390x")
use_repo(node_dev, "node16_linux_ppc64le")
use_repo(node_dev, "node16_windows_amd64")
node_dev.toolchain(node_version = "16.14.2")
node_dev.toolchain(
name = "node16",
node_version = "16.13.1",
)
node_dev.toolchain(
name = "node18",
node_version = "18.13.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",
},
data = [
"//:examples/npm_deps/patches/[email protected]",
"//:package.json",
"//:pnpm-workspace.yaml",
"//examples/js_binary:package.json",
"//examples/macro:package.json",
"//examples/npm_deps:package.json",
"//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/webpack_cli:package.json",
"//js/private/coverage/bundle:package.json",
"//js/private/worker/src: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/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
"@kubernetes/client-node": ["prepare"],
# '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-sandbox",
"requires-network",
],
},
npmrc = "//:.npmrc",
patch_args = {
"*": ["-p1"],
"@gregmagolan/test-a": ["-p4"],
},
patches = {
"@gregmagolan/test-a": ["//examples/npm_deps:patches/test-a.patch"],
"@gregmagolan/[email protected]": ["//examples/npm_deps:patches/[email protected]"],
"@gregmagolan/test-b": ["//examples/npm_deps:patches/test-b.patch"],
"[email protected]": ["//examples/npm_deps:patches/[email protected]_pnpm.patch"],
},
pnpm_lock = "//:pnpm-lock.yaml",
# NB: this is a no-op because we already installed a pnpm repo above
pnpm_version = "7.25.0",
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,
verify_node_modules_ignored = "//:.bazelignore",
verify_patches = "//examples/npm_deps/patches:patches",
)
use_repo(npm, "npm", "npm__rollup__2.70.2", "npm__webpack-bundle-analyzer__4.5.0__bufferutil_4.0.7")
# 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 virtual store
root_package = "",
version = "8.4.0",
)
use_repo(npm, "acorn__8.4.0")
use_repo(npm, "acorn__8.4.0__links")