You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| full | [dist][dist-full] | `require("protobufjs")` | All features. Works with everything.
85
+
| light | [dist/light][dist-light] | `require("protobufjs/light")` | All features except tokenizer, parser and bundled common types. Works with reflection, JSON definitions and static code.
86
+
| minimal | [dist/minimal][dist-minimal] | `require("protobufjs/minimal")` | Just enough to run statically generated code. Works with static code only.
87
+
80
88
Examples
81
89
--------
82
90
@@ -162,7 +170,7 @@ Custom classes are automatically populated with static `encode`, `encodeDelimite
162
170
163
171
### Using the Reader/Writer interface directly
164
172
165
-
While only useful for the adventurous cherishing an aversion to [generated static code](https://github.com/dcodeIO/protobuf.js#command-line), it's also possible to use the Reader/Writer interface directly depending just on the [minimal runtime](https://github.com/dcodeIO/protobuf.js/tree/master/dist/runtime) ([basic example](https://github.com/dcodeIO/protobuf.js/blob/master/examples/reader-writer.js)).
173
+
While only useful for the adventurous cherishing an aversion to [generated static code](https://github.com/dcodeIO/protobuf.js#command-line), it's also possible to use the Reader/Writer interface directly depending just on the [minimal library][dist-minimal] ([basic example](https://github.com/dcodeIO/protobuf.js/blob/master/examples/reader-writer.js)).
166
174
167
175
Easy ways to obtain example code snippets are either setting `protobuf.util.codegen.verbose = true` while watching the magic as it happens, or simply inspecting generated static code.
168
176
@@ -308,7 +316,7 @@ As you might have noticed, `pbjs` is also capable of generating static code. For
will generate static code for definitions within `file1.proto` and `file2.proto` to a CommonJS module `compiled.js`, which then can be used with just the [minimal runtime](https://github.com/dcodeIO/protobuf.js/tree/master/dist/runtime).
319
+
will generate static code for definitions within `file1.proto` and `file2.proto` to a CommonJS module `compiled.js`, which then can be used with just the [minimal library][dist-minimal].
312
320
313
321
**ProTip!** Documenting your .proto files with `/** ... */`-blocks or (trailing) `/// ...` lines translates to generated static code.
While using .proto files requires the [full library](https://github.com/dcodeIO/protobuf.js/tree/master/dist) (about 18.5kb gzipped) or JSON just the [noparse library](https://github.com/dcodeIO/protobuf.js/tree/master/dist/noparse) (about 15.5kb gzipped), pretty much all code but the relatively short descriptors is shared and all features including reflection and the parser are available.
365
+
While using .proto files requires the [full library][dist-full] (about 18.5kb gzipped) or JSON at least the [light library][dist-light] (about 15.5kb gzipped), pretty much all code but the relatively short descriptors is shared and all features including reflection and the parser are available.
358
366
359
-
Static code, on the other hand, requires just the [minimal runtime](https://github.com/dcodeIO/protobuf.js/tree/master/dist/runtime) (about 5.5kb gzipped), but generates additional, albeit editable, source code without any reflection features.
367
+
Static code, on the other hand, requires just the [minimal library][dist-minimal] (about 5.5kb gzipped), but generates additional, albeit editable, source code without any reflection features.
360
368
361
369
There is no significant difference performance-wise as the code generated statically is pretty much the same as generated at runtime and both are largely interchangeable as seen in the previous section.
362
370
@@ -467,7 +475,7 @@ $> cd protobuf.js
467
475
$> npm install
468
476
```
469
477
470
-
Building the development and production versions with their respective source maps to `dist/`:
478
+
Building the respective development and production versions with their respective source maps to `dist/`:
471
479
472
480
```
473
481
$> npm run build
@@ -493,3 +501,7 @@ By default, protobuf.js integrates into your browserify build-process without re
493
501
* If you have any special requirements, there is [the bundler](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/bundle.js) as a reference.
Copy file name to clipboardExpand all lines: dist/README.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,4 @@
1
-
This folder contains prebuilt browser versions of [protobuf.js](https://github.com/dcodeIO/protobuf.js). When sending pull requests, it is not required to update these.
2
-
3
-
Alternatively, you can also use [the minimal runtime](./runtime) when working with statically generated code or [the noparse build](./noparse) when working with JSON generated by `pbjs`*only*.
1
+
This folder contains prebuilt browser versions of the full library. When sending pull requests, it is not required to update these.
4
2
5
3
Prebuilt files are in source control to enable pain-free frontend respectively CDN usage:
This folder contains prebuilt browser versions of the light library suitable for use with reflection, static code and JSON descriptors / modules. When sending pull requests, it is not required to update these.
2
+
3
+
Prebuilt files are in source control to enable pain-free frontend respectively CDN usage:
**NOTE:** Remember to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon.
0 commit comments