Skip to content

Instantly share code, notes, and snippets.

@alexeagle
Created August 12, 2017 01:14
Show Gist options
  • Save alexeagle/1dca506bcd8984827cccbc7a368a99b6 to your computer and use it in GitHub Desktop.
Save alexeagle/1dca506bcd8984827cccbc7a368a99b6 to your computer and use it in GitHub Desktop.
# Other ts_library rules will use this custom compiler, which calls the
# TypeScript APIs to act like tsc, but adds capabilities like Bazel workers.
nodejs_binary(
name = "tsc_wrapped_bin",
data = [
":tsc_wrapped",
"@//:node_modules",
"@bytebuffer//:pkg",
"@protobufjs//:pkg",
"@long//:pkg",
# How do we tell TS module resolution to look here??
"@types_node//:pkg",
# Should be @bazel_tools//src/main/protobuf:worker_protocol.proto
# see https://github.com/bazelbuild/bazel/issues/3155#issuecomment-308156976
"//internal:worker_protocol.proto",
],
args = ["--node_options=--expose-gc"],
entry_point = "build_bazel_rules_typescript/internal/tsc_wrapped/tsc_wrapped.js",
visibility = ["//visibility:public"],
)
# Runtime deps of the bazel TypeScript compiler (tsc_wrapped)
npm_pkg_build = """package(default_visibility=["//visibility:public"])
filegroup(name="pkg", srcs=glob(["**/*.js"]) + [
"package.json"
])"""
native.new_http_archive(
name = "protobufjs",
url = "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.0.tgz",
sha256 = "04643f371b954e91fcf6d7550cc59120dbed675202f80a08b6b278486b0259ac",
strip_prefix = "package",
build_file_content = npm_pkg_build)
native.new_http_archive(
name = "bytebuffer",
url = "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz",
sha256 = "84667a6bc80943e9ea346dfc073e55b55127ef787b4b5293532755da452025a0",
strip_prefix = "package",
build_file_content = npm_pkg_build)
native.new_http_archive(
name = "long",
url = "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
sha256 = "a5b10daf8eaa2e6507a3e9e648016cdc9777857ad501917316a5228aa5f3d9cb",
strip_prefix = "package",
build_file_content = npm_pkg_build)
native.new_http_archive(
name = "types_node",
url = "https://registry.npmjs.org/@types/node/-/node-6.0.85.tgz",
sha256 = "573292873b031f1022469c800f22c9ab17c1795b7bfe468e4fb6e4bbf93ac83a",
strip_prefix = "node v6",
build_file_content = npm_pkg_build)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment