From e3e77d0c7dc973d3a5948a49d123bdaf8a048030 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Tue, 13 Dec 2016 16:58:15 +0100 Subject: [PATCH] Annotate namespaces generated by static target, see #550 --- README.md | 2 ++ cli/targets/static.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c41ec857e..8dda94289 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,8 @@ While .proto and JSON files require the full library (about 20kb gzipped), prett Static code, on the other hand, requires just the runtime library (final size TBA), but generates relatively large code bases without any reflection features. +There is no difference performance-wise as the code that is generated statically is the same generated at runtime. + ### Generating TypeScript definitions from static modules Likewise, the `pbts` command line utility can be used to generate TypeScript definitions from `pbjs`-generated static modules. diff --git a/cli/targets/static.js b/cli/targets/static.js index 804cfeee3..ebff2f96d 100644 --- a/cli/targets/static.js +++ b/cli/targets/static.js @@ -93,7 +93,11 @@ function buildNamespace(ref, ns) { buildService(undefined, ns); else if (ns.name !== "") { push(""); - push("/** @alias " + (ns.name && ns.fullName.substring(1) || "exports") + " */"); + pushComment([ + "Namespace " + ns.name + ".", + "@exports " + ns.fullName.substring(1), + "@namespace" + ]); push("var " + name(ns.name) + " = {};"); }