protobuf2flowtype
Advanced tools
+16
-3
@@ -7,3 +7,2 @@ const ProtoBuf = require('protobufjs'); | ||
| const generate = require('babel-generator').default; | ||
| const jsonOutputter = require('protobufjs/cli/pbjs/targets/json'); | ||
@@ -495,2 +494,16 @@ /** | ||
| try { | ||
| class ImportBuilder extends ProtoBuf.Builder { | ||
| import(json, filename) { | ||
| this._imported = this._imported || []; | ||
| this._imported.push({ | ||
| filename: filename, | ||
| json: json | ||
| }); | ||
| super['import'](json, filename); | ||
| } | ||
| } | ||
| const importBuilder = new ImportBuilder(); | ||
| // This validates that proto is parsable | ||
@@ -500,4 +513,4 @@ const builder = ProtoBuf.loadProtoFile({ | ||
| file: inputProto | ||
| }); | ||
| jsonDescriptor = jsonOutputter(builder, {min: true}); | ||
| }, importBuilder); | ||
| jsonDescriptor = JSON.stringify(builder._imported, undefined, 2); | ||
| } catch (e) { | ||
@@ -504,0 +517,0 @@ console.error('Proto Parsing Failed', e); |
+2
-2
| { | ||
| "name": "protobuf2flowtype", | ||
| "version": "2.0.8", | ||
| "version": "2.0.9", | ||
| "description": "Given protobuf file will generate node packages which export protobufjs builders annotated with flowtype type anotations", | ||
@@ -14,3 +14,3 @@ "main": "runtime/index.js", | ||
| "mustache": "^2.2.1", | ||
| "protobuf2flowtype-runtime": "2.0.8", | ||
| "protobuf2flowtype-runtime": "2.0.9", | ||
| "yargs": "^6.0.0" | ||
@@ -17,0 +17,0 @@ }, |
| { | ||
| "name": "protobuf2flowtype-runtime", | ||
| "version": "2.0.8", | ||
| "version": "2.0.9", | ||
| "description": "Base flowtype type annotations for protobuf", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
38385
1.14%721
1.41%+ Added
- Removed