Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grpc-code-gen

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-code-gen - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

16

build/base.d.ts

@@ -7,3 +7,19 @@ import { IOption } from 'load-proto';

serviceCode?: boolean;
loaderOptions?: {
/** Keeps field casing instead of converting to camel case */
keepCase?: boolean;
/** Recognize double-slash comments in addition to doc-block comments. */
alternateCommentMode?: boolean;
/** Also sets default values on the resulting object */
defaults?: boolean;
/** Sets empty arrays for missing repeated fields even if `defaults=false` */
arrays?: boolean;
/** Sets empty objects for missing map fields even if `defaults=false` */
objects?: boolean;
/** Includes virtual oneof properties set to the present field's name, if any */
oneofs?: boolean;
/** Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings */
json?: boolean;
};
}
export declare function gen(opt: Options): Promise<string>;

4

build/base.js

@@ -217,3 +217,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const { baseDir = BASE_DIR, target = 'typescript', serviceCode = true, jsonSemanticTypes = false, } = opt;
const { baseDir = BASE_DIR, target = 'typescript', serviceCode = true, jsonSemanticTypes = false, loaderOptions = { defaults: true }, } = opt;
const typescript = target === 'typescript';

@@ -243,3 +243,3 @@ fs.removeSync(baseDir);

`const root = require('${getImportPath(grpcObjPath, jsonPath)}');\n`,
`const grpcObject = grpc.loadPackageDefinition(loadFromJson(root));`,
`const grpcObject = grpc.loadPackageDefinition(loadFromJson(root, ${JSON.stringify(loaderOptions)}));`,
`export default grpcObject;`,

@@ -246,0 +246,0 @@ ].join('\n'));

{
"name": "grpc-code-gen",
"version": "3.0.1",
"version": "3.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": "https://github.com/yunkeCN/grpc-code-gen.git",

@@ -54,3 +54,3 @@ # grpc-code-gen

---|---|---|---
gitUrls | string[] | 仓库地址数组 | `null`
gitUrls | Array<string \| {url: string, branch?: string, accessToken?: string}> | 仓库地址数组 | `null`
branch | string | 分支 | `null`

@@ -62,4 +62,17 @@ accessToken | string | git access token | `null`

serviceCode? | boolean | 生成客户端代码 | `true`
loaderOptions? | [LoaderOptions](#LoaderOptions) | loader生成配置 | `{ defaults: true }`
### LoaderOptions
参数 | 类型 | 说明 | 默认值
---|---|---|---
keepCase? | boolean | Keeps field casing instead of converting to camel case | true
alternateCommentMode? | boolean | Recognize double-slash comments in addition to doc-block comments. | false
defaults? | boolean | Also sets default values on the resulting object | true
arrays? | boolean | Sets empty arrays for missing repeated fields even if `defaults=false` | true
objects? | boolean | Sets empty objects for missing map fields even if `defaults=false` | true
oneofs? | boolean | Includes virtual oneof properties set to the present field's name, if any | true
json? | boolean | Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings | true
## Program usage

@@ -66,0 +79,0 @@ ```js

@@ -252,2 +252,24 @@ import * as fs from 'fs-extra';

serviceCode?: boolean;
loaderOptions?: {
/** Keeps field casing instead of converting to camel case */
keepCase?: boolean;
/** Recognize double-slash comments in addition to doc-block comments. */
alternateCommentMode?: boolean;
/** Also sets default values on the resulting object */
defaults?: boolean;
/** Sets empty arrays for missing repeated fields even if `defaults=false` */
arrays?: boolean;
/** Sets empty objects for missing map fields even if `defaults=false` */
objects?: boolean;
/** Includes virtual oneof properties set to the present field's name, if any */
oneofs?: boolean;
/** Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings */
json?: boolean;
};
}

@@ -261,2 +283,3 @@

jsonSemanticTypes = false,
loaderOptions = { defaults: true },
} = opt;

@@ -296,3 +319,3 @@

`const root = require('${getImportPath(grpcObjPath, jsonPath)}');\n`,
`const grpcObject = grpc.loadPackageDefinition(loadFromJson(root));`,
`const grpcObject = grpc.loadPackageDefinition(loadFromJson(root, ${JSON.stringify(loaderOptions)}));`,
`export default grpcObject;`,

@@ -299,0 +322,0 @@ ].join('\n'));

Sorry, the diff of this file is not supported yet

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