
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
grpc-loader
Advanced tools
Converts .proto files into autogenerated js files for use with gRPC
yarn add --dev grpc-loader
static: true
You can ignore protobufjs
peer dependency if you use this option.
P.S. I don't really like this api. It's too verbose. google-protobuf
const proto = require('./test.proto');
console.log(proto);
// {
// services: {
// GreeterService: {
// sayHello: [Object]
// },
// GreeterClient: {
// [Function: ServiceClient] super_: [Function: Client],
// service: [Object]
// }
// },
// messages: {
// HelloReply: {
// [Function]
// superClass_: [Object],
// base: [Function],
// toObject: [Function],
// deserializeBinary: [Function],
// deserializeBinaryFromReader: [Function],
// serializeBinaryToWriter: [Function]
// },
// HelloRequest: {
// [Function]
// superClass_: [Object],
// base: [Function],
// toObject: [Function],
// deserializeBinary: [Function],
// deserializeBinaryFromReader: [Function],
// serializeBinaryToWriter: [Function]
// }
// }
// }
static: false
You can ignore google-protobuf
peer dependency if you use this option.
same as grpc.load
you can also pass any properties that grpc.load
accepts
const proto = require('./test.proto');
console.log(proto);
// {
// helloworld: {
// Greeter: {
// [
// Function: ServiceClient
// ]super_: [
// Function: Client
// ],
// service: [
// Object
// ]
// },
// HelloRequest: {
//
// },
// HelloReply: {
//
// }
// }
// }
For usage checkout test
folder
npm run test
module.exports = {
module: {
rules: [
{
test: /\.proto$/,
loader: 'grpc-loader',
options: {
// both methods are static internally
// but result api differs
// https://github.com/grpc/grpc/tree/master/examples/node
static: false,
// grpc props
// https://github.com/grpc/grpc-node/blob/master/packages/grpc-protobufjs/index.js#L37-L42
// convertFieldsToCamelCase,
// binaryAsBase64,
// longsAsStrings,
// enumsAsStrings,
},
}
]
}
};
FAQs
gRPC loader module for webpack
The npm package grpc-loader receives a total of 7 weekly downloads. As such, grpc-loader popularity was classified as not popular.
We found that grpc-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.