diff --git a/README.md b/README.md
index ef5aabeda..fa190add1 100644
--- a/README.md
+++ b/README.md
@@ -509,7 +509,9 @@ var buffer = AwesomeMessage.encode(message).finish();
...
```
-**Note:** When using [long.js](https://github.com/dcodeIO/long.js), make sure to add [@types/long](https://www.npmjs.com/package/@types/long) to your project's dependencies. Likewise, when building for node, make sure to add [@types/node](https://www.npmjs.com/package/@types/node). Alternatively, if you are not using one of these, there are two stubs available that can be referenced instead of the respective full type definition:
+**Note** that the npm package depends on [@types/node](https://www.npmjs.com/package/@types/node) because of `Buffer` and [@types/long](https://www.npmjs.com/package/@types/long) because of `Long`.
+
+If you are not building for node and/or not using long.js and want to exclude their full type definitions manually for whatever reason, there are two stubs available that can be referenced instead of the respective full type definition:
```ts
///
diff --git a/package.json b/package.json
index b71ad76c4..b3d7fd56a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "protobufjs",
- "version": "6.7.2",
+ "version": "6.7.3",
"versionScheme": "~",
"description": "Protocol Buffers for JavaScript (& TypeScript).",
"author": "Daniel Wirtz ",
@@ -44,6 +44,7 @@
"release": "npm run make && npm run changelog"
},
"dependencies": {
+ "long": "^3.2.0",
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/base64": "^1.1.1",
"@protobufjs/codegen": "^1.0.8",
@@ -53,14 +54,11 @@
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
- "@protobufjs/utf8": "^1.1.0"
- },
- "optionalDependencies": {
- "long": "^3.2.0"
+ "@protobufjs/utf8": "^1.1.0",
+ "@types/long": "^3.0.31",
+ "@types/node": "7.0.12"
},
"devDependencies": {
- "@types/long": "^3.0.31",
- "@types/node": "7.0.12",
"benchmark": "^2.1.4",
"browserify": "^14.3.0",
"browserify-wrap": "^1.0.2",
diff --git a/tests/data/package.js b/tests/data/package.js
index 356a88ea7..4843035e6 100644
--- a/tests/data/package.js
+++ b/tests/data/package.js
@@ -29,7 +29,6 @@ $root.Package = (function() {
* @property {Object.} [bin] Package bin.
* @property {Object.} [scripts] Package scripts.
* @property {Object.} [dependencies] Package dependencies.
- * @property {Object.} [optionalDependencies] Package optionalDependencies.
* @property {Object.} [devDependencies] Package devDependencies.
* @property {string} [types] Package types.
* @property {Array.} [cliDependencies] Package cliDependencies.
@@ -46,7 +45,6 @@ $root.Package = (function() {
this.bin = {};
this.scripts = {};
this.dependencies = {};
- this.optionalDependencies = {};
this.devDependencies = {};
this.cliDependencies = [];
if (properties)
@@ -139,12 +137,6 @@ $root.Package = (function() {
*/
Package.prototype.dependencies = $util.emptyObject;
- /**
- * Package optionalDependencies.
- * @type {Object.}
- */
- Package.prototype.optionalDependencies = $util.emptyObject;
-
/**
* Package devDependencies.
* @type {Object.}
@@ -211,9 +203,6 @@ $root.Package = (function() {
if (message.dependencies != null && message.hasOwnProperty("dependencies"))
for (var keys = Object.keys(message.dependencies), i = 0; i < keys.length; ++i)
writer.uint32(/* id 13, wireType 2 =*/106).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.dependencies[keys[i]]).ldelim();
- if (message.optionalDependencies != null && message.hasOwnProperty("optionalDependencies"))
- for (var keys = Object.keys(message.optionalDependencies), i = 0; i < keys.length; ++i)
- writer.uint32(/* id 14, wireType 2 =*/114).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.optionalDependencies[keys[i]]).ldelim();
if (message.devDependencies != null && message.hasOwnProperty("devDependencies"))
for (var keys = Object.keys(message.devDependencies), i = 0; i < keys.length; ++i)
writer.uint32(/* id 15, wireType 2 =*/122).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.devDependencies[keys[i]]).ldelim();
@@ -311,14 +300,6 @@ $root.Package = (function() {
reader.pos++;
message.dependencies[key] = reader.string();
break;
- case 14:
- reader.skip().pos++;
- if (message.optionalDependencies === $util.emptyObject)
- message.optionalDependencies = {};
- key = reader.string();
- reader.pos++;
- message.optionalDependencies[key] = reader.string();
- break;
case 15:
reader.skip().pos++;
if (message.devDependencies === $util.emptyObject)
@@ -427,14 +408,6 @@ $root.Package = (function() {
if (!$util.isString(message.dependencies[key[i]]))
return "dependencies: string{k:string} expected";
}
- if (message.optionalDependencies != null && message.hasOwnProperty("optionalDependencies")) {
- if (!$util.isObject(message.optionalDependencies))
- return "optionalDependencies: object expected";
- var key = Object.keys(message.optionalDependencies);
- for (var i = 0; i < key.length; ++i)
- if (!$util.isString(message.optionalDependencies[key[i]]))
- return "optionalDependencies: string{k:string} expected";
- }
if (message.devDependencies != null && message.hasOwnProperty("devDependencies")) {
if (!$util.isObject(message.devDependencies))
return "devDependencies: object expected";
@@ -516,13 +489,6 @@ $root.Package = (function() {
for (var keys = Object.keys(object.dependencies), i = 0; i < keys.length; ++i)
message.dependencies[keys[i]] = String(object.dependencies[keys[i]]);
}
- if (object.optionalDependencies) {
- if (typeof object.optionalDependencies !== "object")
- throw TypeError(".Package.optionalDependencies: object expected");
- message.optionalDependencies = {};
- for (var keys = Object.keys(object.optionalDependencies), i = 0; i < keys.length; ++i)
- message.optionalDependencies[keys[i]] = String(object.optionalDependencies[keys[i]]);
- }
if (object.devDependencies) {
if (typeof object.devDependencies !== "object")
throw TypeError(".Package.devDependencies: object expected");
@@ -569,7 +535,6 @@ $root.Package = (function() {
object.bin = {};
object.scripts = {};
object.dependencies = {};
- object.optionalDependencies = {};
object.devDependencies = {};
}
if (options.defaults) {
@@ -624,11 +589,6 @@ $root.Package = (function() {
for (var j = 0; j < keys2.length; ++j)
object.dependencies[keys2[j]] = message.dependencies[keys2[j]];
}
- if (message.optionalDependencies && (keys2 = Object.keys(message.optionalDependencies)).length) {
- object.optionalDependencies = {};
- for (var j = 0; j < keys2.length; ++j)
- object.optionalDependencies[keys2[j]] = message.optionalDependencies[keys2[j]];
- }
if (message.devDependencies && (keys2 = Object.keys(message.devDependencies)).length) {
object.devDependencies = {};
for (var j = 0; j < keys2.length; ++j)
diff --git a/tests/data/package.proto b/tests/data/package.proto
index 675f8b65e..cf441c520 100644
--- a/tests/data/package.proto
+++ b/tests/data/package.proto
@@ -21,7 +21,7 @@ message Package {
map bin = 11;
map scripts = 12;
map dependencies = 13;
- map optionalDependencies = 14;
+ // map optionalDependencies = 14;
map devDependencies = 15;
// map browser = 16;
string types = 17;