Skip to content

Commit e60c0ab

Browse files
authored
deprecate the two options which have no effect of their own (google#8831)
1 parent 541dd1a commit e60c0ab

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed

include/flatbuffers/idl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,6 @@ struct IDLOptions {
707707
bool json_nested_flatbuffers;
708708
bool json_nested_flexbuffers;
709709
bool json_nested_legacy_flatbuffers;
710-
bool ts_flat_files;
711-
bool ts_entry_points;
712710
bool ts_no_import_ext;
713711
bool no_leak_private_annotations;
714712
bool require_json_eof;
@@ -852,8 +850,6 @@ struct IDLOptions {
852850
json_nested_flatbuffers(true),
853851
json_nested_flexbuffers(true),
854852
json_nested_legacy_flatbuffers(false),
855-
ts_flat_files(false),
856-
ts_entry_points(false),
857853
ts_no_import_ext(false),
858854
no_leak_private_annotations(false),
859855
require_json_eof(true),

src/flatc.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,8 @@ const static FlatCOption flatc_options[] = {
248248
{"", "json-nested-bytes", "",
249249
"Allow a nested_flatbuffer field to be parsed as a vector of bytes "
250250
"in JSON, which is unsafe unless checked by a verifier afterwards."},
251-
{"", "ts-flat-files", "",
252-
"Generate a single typescript file per .fbs file. Implies "
253-
"ts_entry_points."},
254-
{"", "ts-entry-points", "",
255-
"Generate entry point typescript per namespace. Implies gen-all."},
251+
{"", "ts-flat-files", "", "(deprecated) Alias for --gen-all."},
252+
{"", "ts-entry-points", "", "(deprecated) Alias for --gen-all."},
256253
{"", "annotate-sparse-vectors", "", "Don't annotate every vector element."},
257254
{"", "annotate", "SCHEMA",
258255
"Annotate the provided BINARY_FILE with the specified SCHEMA file."},
@@ -680,11 +677,12 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
680677
} else if (arg == "--json-nested-bytes") {
681678
opts.json_nested_legacy_flatbuffers = true;
682679
} else if (arg == "--ts-flat-files") {
683-
opts.ts_flat_files = true;
684-
opts.ts_entry_points = true;
680+
// deprecated -- just enables generate_all
681+
Warn("--ts-flat-files is deprecated; use --gen-all instead.\n");
685682
opts.generate_all = true;
686683
} else if (arg == "--ts-entry-points") {
687-
opts.ts_entry_points = true;
684+
// deprecated -- just enables generate_all
685+
Warn("--ts-entry-points is deprecated; use --gen-all instead.\n");
688686
opts.generate_all = true;
689687
} else if (arg == "--ts-no-import-ext") {
690688
opts.ts_no_import_ext = true;

src/idl_gen_ts.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class TsGenerator : public BaseGenerator {
118118
if (!parser_.opts.ts_omit_entrypoint) {
119119
generateEntry();
120120
}
121-
if (!generateBundle()) return false;
122121
return true;
123122
}
124123

@@ -325,29 +324,6 @@ class TsGenerator : public BaseGenerator {
325324
}
326325
}
327326

328-
bool generateBundle() {
329-
if (parser_.opts.ts_flat_files) {
330-
std::string inputpath;
331-
std::string symbolic_name = file_name_;
332-
inputpath = path_ + file_name_ + ".ts";
333-
std::string bundlepath =
334-
GeneratedFileName(path_, file_name_, parser_.opts);
335-
bundlepath = bundlepath.substr(0, bundlepath.size() - 3) + ".js";
336-
std::string cmd = "esbuild";
337-
cmd += " ";
338-
cmd += inputpath;
339-
// cmd += " --minify";
340-
cmd += " --format=cjs --bundle --outfile=";
341-
cmd += bundlepath;
342-
cmd += " --external:flatbuffers";
343-
std::cout << "Entry point " << inputpath << " generated." << std::endl;
344-
std::cout << "A single file bundle can be created using fx. esbuild with:"
345-
<< std::endl;
346-
std::cout << "> " << cmd << std::endl;
347-
}
348-
return true;
349-
}
350-
351327
// Generate a documentation comment, if available.
352328
static void GenDocComment(const std::vector<std::string>& dc,
353329
std::string* code_ptr,

0 commit comments

Comments
 (0)