From afafd206a32e960deaa57b3746b466bf74dfe96d Mon Sep 17 00:00:00 2001 From: Max Burke Date: Sun, 20 Aug 2023 01:28:47 -0700 Subject: [PATCH 1/3] Optional omission of Typescript entrypoint (#8057) --- include/flatbuffers/idl.h | 2 ++ src/flatc.cpp | 4 ++++ src/idl_gen_ts.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index bb3dd503e..dd13918c1 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -706,6 +706,7 @@ struct IDLOptions { bool keep_proto_id; bool python_no_type_prefix_suffix; bool python_typing; + bool ts_omit_entrypoint; ProtoIdGapAction proto_id_gap_action; // Possible options for the more general generator below. @@ -818,6 +819,7 @@ struct IDLOptions { keep_proto_id(false), python_no_type_prefix_suffix(false), python_typing(false), + ts_omit_entrypoint(false), proto_id_gap_action(ProtoIdGapAction::WARNING), mini_reflect(IDLOptions::kNone), require_explicit_ids(false), diff --git a/src/flatc.cpp b/src/flatc.cpp index 202c3d644..d493c5eb3 100644 --- a/src/flatc.cpp +++ b/src/flatc.cpp @@ -253,6 +253,8 @@ const static FlatCOption flatc_options[] = { { "", "python-no-type-prefix-suffix", "", "Skip emission of Python functions that are prefixed with typenames" }, { "", "python-typing", "", "Generate Python type annotations" }, + { "", "ts-omit-entrypoint", "", + "Omit emission of namespace entrypoint file" }, { "", "file-names-only", "", "Print out generated file names without writing to the files" }, }; @@ -659,6 +661,8 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc, opts.python_no_type_prefix_suffix = true; } else if (arg == "--python-typing") { opts.python_typing = true; + } else if (arg == "--ts-omit-entrypoint") { + opts.ts_omit_entrypoint = true; } else if (arg == "--annotate-sparse-vectors") { options.annotate_include_vector_contents = false; } else if (arg == "--annotate") { diff --git a/src/idl_gen_ts.cpp b/src/idl_gen_ts.cpp index e06dc1181..008193100 100644 --- a/src/idl_gen_ts.cpp +++ b/src/idl_gen_ts.cpp @@ -113,7 +113,7 @@ class TsGenerator : public BaseGenerator { bool generate() { generateEnums(); generateStructs(); - generateEntry(); + if (!parser_.opts.ts_omit_entrypoint) { generateEntry(); } if (!generateBundle()) return false; return true; } From 5a8a3957562050c10822bb2ef2e3794bfca8772e Mon Sep 17 00:00:00 2001 From: Philipp Schrader Date: Fri, 25 Aug 2023 09:15:12 -0700 Subject: [PATCH 2/3] Upgrade the bazel-related dependencies (#8078) This patch updates all the bazel-related dependencies to their latest available versions. All tests still pass. Fixes: #8076 --- WORKSPACE | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index d7a8b2ca7..3dad6a2c3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -79,9 +79,9 @@ grpc_extra_deps() http_archive( name = "aspect_rules_js", - sha256 = "124ed29fb0b3d0cba5b44f8f8e07897cf61b34e35e33b1f83d1a943dfd91b193", - strip_prefix = "rules_js-1.24.0", - url = "https://github.com/aspect-build/rules_js/releases/download/v1.24.0/rules_js-v1.24.0.tar.gz", + sha256 = "bdbd6df52fc7963f55281fe0a140e21de8ec587ab711a8a2fff0715b6710a4f8", + strip_prefix = "rules_js-1.32.0", + url = "https://github.com/aspect-build/rules_js/releases/download/v1.32.0/rules_js-v1.32.0.tar.gz", ) load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") @@ -94,9 +94,9 @@ pnpm_repository(name = "pnpm") http_archive( name = "aspect_rules_ts", - sha256 = "8eb25d1fdafc0836f5778d33fb8eaac37c64176481d67872b54b0a05de5be5c0", - strip_prefix = "rules_ts-1.3.3", - url = "https://github.com/aspect-build/rules_ts/releases/download/v1.3.3/rules_ts-v1.3.3.tar.gz", + sha256 = "4c3f34fff9f96ffc9c26635d8235a32a23a6797324486c7d23c1dfa477e8b451", + strip_prefix = "rules_ts-1.4.5", + url = "https://github.com/aspect-build/rules_ts/releases/download/v1.4.5/rules_ts-v1.4.5.tar.gz", ) load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") @@ -132,25 +132,25 @@ npm_repositories() http_archive( name = "aspect_rules_esbuild", - sha256 = "2ea31bd97181a315e048be693ddc2815fddda0f3a12ca7b7cc6e91e80f31bac7", - strip_prefix = "rules_esbuild-0.14.4", - url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.14.4/rules_esbuild-v0.14.4.tar.gz", + sha256 = "098e38e5ee868c14a6484ba263b79e57d48afacfc361ba30137c757a9c4716d6", + strip_prefix = "rules_esbuild-0.15.0", + url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.15.0/rules_esbuild-v0.15.0.tar.gz", ) # Register a toolchain containing esbuild npm package and native bindings -load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_VERSION", "esbuild_register_toolchains") +load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains") esbuild_register_toolchains( name = "esbuild", - esbuild_version = LATEST_VERSION, + esbuild_version = LATEST_ESBUILD_VERSION, ) http_file( name = "bazel_linux_x86_64", downloaded_file_path = "bazel", executable = True, - sha256 = "e89747d63443e225b140d7d37ded952dacea73aaed896bca01ccd745827c6289", + sha256 = "e78fc3394deae5408d6f49a15c7b1e615901969ecf6e50d55ef899996b0b8458", urls = [ - "https://github.com/bazelbuild/bazel/releases/download/6.1.2/bazel-6.1.2-linux-x86_64", + "https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-x86_64", ], ) From 362dd663f873dee7d6c1d15abf8b914d6a6b0000 Mon Sep 17 00:00:00 2001 From: Philipp Schrader Date: Mon, 28 Aug 2023 00:20:10 -0700 Subject: [PATCH 3/3] Fix BUILD.bazel style violations (#8081) `buildifier` was complaining as follows: #### :bazel: buildifier: found 2 lint issues in your WORKSPACE, BUILD and *.bzl files
tests/ts/bazel_repository_test_dir/BUILD:3:1: out-of-order-load: Load statement is out of its lexicographical order.
    ts/BUILD.bazel:2:1: out-of-order-load: Load statement is out of its lexicographical order.
This can be fixed locally like so: $ buildifier -lint fix $(git ls-files | grep -e '/BUILD.bazel$' -e '/BUILD$' -e '\ BUILD.bazel} | 2 +- ts/BUILD.bazel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/ts/bazel_repository_test_dir/{BUILD => BUILD.bazel} (100%) diff --git a/tests/ts/bazel_repository_test_dir/BUILD b/tests/ts/bazel_repository_test_dir/BUILD.bazel similarity index 100% rename from tests/ts/bazel_repository_test_dir/BUILD rename to tests/ts/bazel_repository_test_dir/BUILD.bazel index f4e89a602..f6b01c5ec 100644 --- a/tests/ts/bazel_repository_test_dir/BUILD +++ b/tests/ts/bazel_repository_test_dir/BUILD.bazel @@ -1,6 +1,6 @@ load("@aspect_rules_js//js:defs.bzl", "js_test") -load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") load("@aspect_rules_js//npm:defs.bzl", "npm_link_package") +load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") load("@npm//:defs.bzl", "npm_link_all_packages") npm_link_all_packages(name = "node_modules") diff --git a/ts/BUILD.bazel b/ts/BUILD.bazel index 4b86fe3d3..9bd9f4be3 100644 --- a/ts/BUILD.bazel +++ b/ts/BUILD.bazel @@ -1,5 +1,5 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") load("@aspect_rules_js//npm:defs.bzl", "npm_package") +load("@aspect_rules_ts//ts:defs.bzl", "ts_project") filegroup( name = "distribution",