2023-04-28 19:58:49 +00:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_project")
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
2022-03-10 18:08:13 +00:00
|
|
|
|
|
|
|
ts_project(
|
|
|
|
name = "flatbuffers_ts",
|
|
|
|
srcs = [
|
|
|
|
"builder.ts",
|
|
|
|
"byte-buffer.ts",
|
|
|
|
"constants.ts",
|
|
|
|
"encoding.ts",
|
2023-01-21 20:22:22 +00:00
|
|
|
"flatbuffers.ts",
|
2022-03-10 18:08:13 +00:00
|
|
|
"types.ts",
|
|
|
|
"utils.ts",
|
|
|
|
],
|
|
|
|
declaration = True,
|
|
|
|
tsconfig = {
|
|
|
|
"compilerOptions": {
|
|
|
|
"module": "commonjs",
|
|
|
|
"declaration": True,
|
|
|
|
"moduleResolution": "node",
|
|
|
|
"lib": [
|
|
|
|
"ES2015",
|
|
|
|
"ES2020.BigInt",
|
|
|
|
"DOM",
|
|
|
|
],
|
|
|
|
"types": ["node"],
|
|
|
|
"strict": True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
visibility = ["//visibility:public"],
|
2023-04-28 19:58:49 +00:00
|
|
|
deps = ["@npm//@types/node"],
|
2022-03-10 18:08:13 +00:00
|
|
|
)
|
|
|
|
|
2023-04-28 19:58:49 +00:00
|
|
|
js_library(
|
2022-03-10 18:08:13 +00:00
|
|
|
name = "flatbuffers",
|
2023-04-28 19:58:49 +00:00
|
|
|
package_name = "flatbuffers",
|
2022-03-10 18:08:13 +00:00
|
|
|
visibility = ["//visibility:public"],
|
2023-04-28 19:58:49 +00:00
|
|
|
deps = [":flatbuffers_ts"],
|
2022-03-10 18:08:13 +00:00
|
|
|
)
|
2023-01-21 20:22:22 +00:00
|
|
|
|
|
|
|
sh_binary(
|
|
|
|
name = "compile_flat_file",
|
|
|
|
srcs = ["compile_flat_file.sh"],
|
|
|
|
data = [
|
|
|
|
"@com_github_google_flatbuffers//:flatc",
|
|
|
|
"@nodejs_linux_amd64//:node_bin",
|
2023-04-28 19:58:49 +00:00
|
|
|
"@npm//esbuild/bin:esbuild",
|
2023-01-21 20:22:22 +00:00
|
|
|
],
|
|
|
|
# We just depend directly on the linux amd64 nodejs binary, so only support
|
|
|
|
# running this script on amd64 for now.
|
|
|
|
target_compatible_with = [
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
"@platforms//os:linux",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = ["@bazel_tools//tools/bash/runfiles"],
|
|
|
|
)
|