Files
flatbuffers/ts/BUILD.bazel
Marcel 026c243dc5 Add support for Bazel 7 and 8 in Bazel CI (#8505)
* Add missing file to filegroup for bazel integration tests

Fixup after a9257b6963.

* Align versions in bazel_respository_test_dir with root

* Update XCode version to 15.2

This is the oldest available version.

* Add WORKSPACE.bzlmod

* Add support for Bazel 7

* Add support for Bazel 8 in CI
2025-01-23 14:59:14 -08:00

84 lines
2.0 KiB
Python

load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@flatbuffers_npm//:defs.bzl", "npm_link_all_packages")
filegroup(
name = "distribution",
srcs = [
"BUILD.bazel",
"compile_flat_file.sh",
"pnpm-lock.yaml",
"repositories.bzl",
] + glob([
"*.ts",
]),
visibility = ["//visibility:public"],
)
npm_link_all_packages(name = "node_modules")
# Add an index to emulate the top-level package.json's "main" entry.
genrule(
name = "generate_index.ts",
outs = ["index.ts"],
cmd = """echo "export * from './flatbuffers.js'" > $(OUTS)""",
)
ts_project(
name = "flatbuffers_ts",
srcs = [
"builder.ts",
"byte-buffer.ts",
"constants.ts",
"encoding.ts",
"flatbuffers.ts",
"types.ts",
"utils.ts",
":index.ts",
],
declaration = True,
tsconfig = {
"compilerOptions": {
"module": "commonjs",
"declaration": True,
"moduleResolution": "node",
"lib": [
"ES2015",
"ES2020.BigInt",
"DOM",
],
"types": ["node"],
"strict": True,
},
},
visibility = ["//visibility:public"],
deps = [
":node_modules/@types/node",
],
)
npm_package(
name = "flatbuffers",
srcs = [":flatbuffers_ts"],
include_external_repositories = ["*"],
package = "flatbuffers",
visibility = ["//visibility:public"],
)
sh_binary(
name = "compile_flat_file",
srcs = ["compile_flat_file.sh"],
data = [
"//:flatc",
"@nodejs_linux_amd64//:node_bin",
],
# 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"],
)