mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add types for protoc-plugin * Export simplePlugin as a namespace * Remove unused file * Use `require()` syntax in tests
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
// Type definitions for protoc-plugin 0.0
|
|
// Project: https://github.com/konsumer/node-protoc-plugin/
|
|
// Definitions by: Jonny Reeves <https://github.com/jonnyreeves>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference types="node" />
|
|
|
|
import * as stream from "stream";
|
|
import {
|
|
CodeGeneratorRequest as pb_CodeGeneratorRequest,
|
|
CodeGeneratorResponse as pb_CodeGeneratorResponse
|
|
} from "google-protobuf/google/protobuf/compiler/plugin_pb";
|
|
import { FileDescriptorProto, SourceCodeInfo } from "google-protobuf/google/protobuf/descriptor_pb";
|
|
import Location = SourceCodeInfo.Location;
|
|
|
|
type OutputFiles = pb_CodeGeneratorResponse.File.AsObject[];
|
|
type SimplePluginCallback = (filesToGenerate: ReadonlyArray<FileDescriptorProto.AsObject>) => (OutputFiles | Promise<OutputFiles>);
|
|
|
|
declare function simplePlugin(cb: SimplePluginCallback): Promise<void>;
|
|
declare namespace simplePlugin {
|
|
function CodeGeneratorRequest(stdin?: stream.Readable): Promise<pb_CodeGeneratorRequest>;
|
|
function CodeGeneratorResponse(stdout?: stream.Writable): (files: OutputFiles) => void;
|
|
function CodeGeneratorResponseError(stdout?: stream.Writable): (err: Error) => void;
|
|
function findCommentByPath(path: number[], locationList: Location.AsObject[]): string;
|
|
}
|
|
|
|
export = simplePlugin;
|