mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 06:02:19 +00:00
deprecate the two options which have no effect of their own (#8831)
This commit is contained in:
@@ -707,8 +707,6 @@ struct IDLOptions {
|
|||||||
bool json_nested_flatbuffers;
|
bool json_nested_flatbuffers;
|
||||||
bool json_nested_flexbuffers;
|
bool json_nested_flexbuffers;
|
||||||
bool json_nested_legacy_flatbuffers;
|
bool json_nested_legacy_flatbuffers;
|
||||||
bool ts_flat_files;
|
|
||||||
bool ts_entry_points;
|
|
||||||
bool ts_no_import_ext;
|
bool ts_no_import_ext;
|
||||||
bool no_leak_private_annotations;
|
bool no_leak_private_annotations;
|
||||||
bool require_json_eof;
|
bool require_json_eof;
|
||||||
@@ -852,8 +850,6 @@ struct IDLOptions {
|
|||||||
json_nested_flatbuffers(true),
|
json_nested_flatbuffers(true),
|
||||||
json_nested_flexbuffers(true),
|
json_nested_flexbuffers(true),
|
||||||
json_nested_legacy_flatbuffers(false),
|
json_nested_legacy_flatbuffers(false),
|
||||||
ts_flat_files(false),
|
|
||||||
ts_entry_points(false),
|
|
||||||
ts_no_import_ext(false),
|
ts_no_import_ext(false),
|
||||||
no_leak_private_annotations(false),
|
no_leak_private_annotations(false),
|
||||||
require_json_eof(true),
|
require_json_eof(true),
|
||||||
|
|||||||
@@ -248,11 +248,8 @@ const static FlatCOption flatc_options[] = {
|
|||||||
{"", "json-nested-bytes", "",
|
{"", "json-nested-bytes", "",
|
||||||
"Allow a nested_flatbuffer field to be parsed as a vector of bytes "
|
"Allow a nested_flatbuffer field to be parsed as a vector of bytes "
|
||||||
"in JSON, which is unsafe unless checked by a verifier afterwards."},
|
"in JSON, which is unsafe unless checked by a verifier afterwards."},
|
||||||
{"", "ts-flat-files", "",
|
{"", "ts-flat-files", "", "(deprecated) Alias for --gen-all."},
|
||||||
"Generate a single typescript file per .fbs file. Implies "
|
{"", "ts-entry-points", "", "(deprecated) Alias for --gen-all."},
|
||||||
"ts_entry_points."},
|
|
||||||
{"", "ts-entry-points", "",
|
|
||||||
"Generate entry point typescript per namespace. Implies gen-all."},
|
|
||||||
{"", "annotate-sparse-vectors", "", "Don't annotate every vector element."},
|
{"", "annotate-sparse-vectors", "", "Don't annotate every vector element."},
|
||||||
{"", "annotate", "SCHEMA",
|
{"", "annotate", "SCHEMA",
|
||||||
"Annotate the provided BINARY_FILE with the specified SCHEMA file."},
|
"Annotate the provided BINARY_FILE with the specified SCHEMA file."},
|
||||||
@@ -680,11 +677,12 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
|
|||||||
} else if (arg == "--json-nested-bytes") {
|
} else if (arg == "--json-nested-bytes") {
|
||||||
opts.json_nested_legacy_flatbuffers = true;
|
opts.json_nested_legacy_flatbuffers = true;
|
||||||
} else if (arg == "--ts-flat-files") {
|
} else if (arg == "--ts-flat-files") {
|
||||||
opts.ts_flat_files = true;
|
// deprecated -- just enables generate_all
|
||||||
opts.ts_entry_points = true;
|
Warn("--ts-flat-files is deprecated; use --gen-all instead.\n");
|
||||||
opts.generate_all = true;
|
opts.generate_all = true;
|
||||||
} else if (arg == "--ts-entry-points") {
|
} else if (arg == "--ts-entry-points") {
|
||||||
opts.ts_entry_points = true;
|
// deprecated -- just enables generate_all
|
||||||
|
Warn("--ts-entry-points is deprecated; use --gen-all instead.\n");
|
||||||
opts.generate_all = true;
|
opts.generate_all = true;
|
||||||
} else if (arg == "--ts-no-import-ext") {
|
} else if (arg == "--ts-no-import-ext") {
|
||||||
opts.ts_no_import_ext = true;
|
opts.ts_no_import_ext = true;
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ class TsGenerator : public BaseGenerator {
|
|||||||
if (!parser_.opts.ts_omit_entrypoint) {
|
if (!parser_.opts.ts_omit_entrypoint) {
|
||||||
generateEntry();
|
generateEntry();
|
||||||
}
|
}
|
||||||
if (!generateBundle()) return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,29 +324,6 @@ class TsGenerator : public BaseGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool generateBundle() {
|
|
||||||
if (parser_.opts.ts_flat_files) {
|
|
||||||
std::string inputpath;
|
|
||||||
std::string symbolic_name = file_name_;
|
|
||||||
inputpath = path_ + file_name_ + ".ts";
|
|
||||||
std::string bundlepath =
|
|
||||||
GeneratedFileName(path_, file_name_, parser_.opts);
|
|
||||||
bundlepath = bundlepath.substr(0, bundlepath.size() - 3) + ".js";
|
|
||||||
std::string cmd = "esbuild";
|
|
||||||
cmd += " ";
|
|
||||||
cmd += inputpath;
|
|
||||||
// cmd += " --minify";
|
|
||||||
cmd += " --format=cjs --bundle --outfile=";
|
|
||||||
cmd += bundlepath;
|
|
||||||
cmd += " --external:flatbuffers";
|
|
||||||
std::cout << "Entry point " << inputpath << " generated." << std::endl;
|
|
||||||
std::cout << "A single file bundle can be created using fx. esbuild with:"
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << "> " << cmd << std::endl;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate a documentation comment, if available.
|
// Generate a documentation comment, if available.
|
||||||
static void GenDocComment(const std::vector<std::string>& dc,
|
static void GenDocComment(const std::vector<std::string>& dc,
|
||||||
std::string* code_ptr,
|
std::string* code_ptr,
|
||||||
|
|||||||
Reference in New Issue
Block a user