Skip to content

Commit a54fbc9

Browse files
committed
Provide prebuilt browser versions of the static runtime
1 parent e3e77d0 commit a54fbc9

12 files changed

Lines changed: 2103 additions & 15 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ protobuf.load("bundle.json", function(err, root) {
340340

341341
While .proto and JSON files require the full library (about 20kb gzipped), pretty much all code but the relatively short descriptors is shared.
342342

343-
Static code, on the other hand, requires just the runtime library (final size TBA), but generates relatively large code bases without any reflection features.
343+
Static code, on the other hand, requires just the runtime library (about 5kb gzipped), but generates relatively large code bases without any reflection features.
344344

345-
There is no difference performance-wise as the code that is generated statically is the same generated at runtime.
345+
When `new Function` is supported (and it usually is), there is no difference performance-wise as the code generated statically is the same generated at runtime.
346346

347347
### Generating TypeScript definitions from static modules
348348

dist/runtime/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
This folder contains prebuilt browser versions of [protobuf.js](https://github.com/dcodeIO/protobuf.js)'s runtime for statically generated code. When sending pull requests, it is not required to update these.
2+
3+
**NOTE:** The static code runtime includes just the bare minimum required to work with statically generated modules - and *nothing else*. Where applicable, it can be used as a drop-in replacement for the full library as it has the same general structure.
4+
5+
Prebuilt files are in source control to enable pain-free frontend respectively CDN usage:
6+
7+
CDN usage
8+
---------
9+
10+
Development:
11+
```
12+
<script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.1.0/dist/runtime/protobuf.js"></script>
13+
```
14+
15+
Production:
16+
```
17+
<script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.1.0/dist/runtime/protobuf.min.js"></script>
18+
```
19+
20+
**NOTE:** Remember to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/releases) your project depends upon.
21+
22+
Frontend usage
23+
--------------
24+
25+
Development:
26+
```
27+
<script src="node_modules/protobufjs/dist/runtime/protobuf.js"></script>
28+
```
29+
30+
Production:
31+
```
32+
<script src="node_modules/protobufjs/dist/runtime/protobuf.min.js"></script>
33+
```

0 commit comments

Comments
 (0)