Socket
Socket
Sign inDemoInstall

ts-proto

Package Overview
Dependencies
Maintainers
1
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-proto - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

15

build/main.js

@@ -12,3 +12,14 @@ "use strict";

function generateFile(typeMap, fileDesc) {
const moduleName = fileDesc.name.replace('.proto', '.ts').replace(/\//g, '_');
// Google's protofiles are organized like Java, where package == the folder the file
// is in, and file == a specific service within the package. I.e. you can have multiple
// company/foo.proto and company/bar.proto files, where package would be 'company'.
//
// We'll match that stucture by setting up the module path as:
//
// company/foo.proto --> company/foo.ts
// company/bar.proto --> company/bar.ts
//
// We'll also assume that the fileDesc.name is already the `company/foo.proto` path, with
// the package already implicitly in it, so we won't re-append/strip/etc. it out/back in.
const moduleName = fileDesc.name.replace('\.proto', '.ts');
let file = ts_poet_1.FileSpec.create(moduleName);

@@ -183,3 +194,3 @@ // first make all the type declarations

.addParameter('message', fullName)
.addParameter('writer', 'Writer@protobufjs/minimal', { defaultValueField: ts_poet_1.CodeBlock.of('new Writer()') })
.addParameter('writer', 'Writer@protobufjs/minimal', { defaultValueField: ts_poet_1.CodeBlock.of('Writer.create()') })
.returns('Writer@protobufjs/minimal');

@@ -186,0 +197,0 @@ // then add a case for each field

4

build/types.js

@@ -186,3 +186,5 @@ "use strict";

for (const file of request.protoFile) {
const moduleName = file.name.replace('.proto', '').replace(/\//g, '_');
// We assume a file.name of google/protobuf/wrappers.proto --> a module path of google/protobuf/wrapper.ts
const moduleName = file.name.replace('.proto', '');
// So given a fullName like FooMessage_InnerMessage, proto will see that as package.name.FooMessage.InnerMessage
function saveMapping(fullName) {

@@ -189,0 +191,0 @@ typeMap.set(file.package + '.' + fullName.replace(/_/g, '.'), [moduleName, fullName]);

{
"name": "ts-proto",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/plugin.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc