Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional omission of Typescript entrypoint #8057

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/flatbuffers/idl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions src/flatc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
};
Expand Down Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion src/idl_gen_ts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down