Skip to content

Commit

Permalink
Annotate namespaces generated by static target, see #550
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Dec 13, 2016
1 parent d31590b commit e3e77d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) + " = {};");
}

Expand Down

0 comments on commit e3e77d0

Please sign in to comment.