Skip to content

Commit

Permalink
Support CommonJS in protoc-gen-connect-es
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Dec 7, 2023
1 parent b3ff7c8 commit a0d4a3e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/protoc-gen-connect-es/src/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function generateDts(schema: Schema) {
function generateService(schema: Schema, f: GeneratedFile, service: DescService) {
const { MethodKind: rtMethodKind, MethodIdempotency: rtMethodIdempotency } = schema.runtime;
f.print(makeJsDoc(service));
f.print("export declare const ", localName(service), ": {");
f.print(f.exportDecl("declare const", localName(service)), ": {");
f.print(` readonly typeName: `, literalString(service.typeName), `,`);
f.print(" readonly methods: {");
for (const method of service.methods) {
Expand Down
2 changes: 1 addition & 1 deletion packages/protoc-gen-connect-es/src/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function generateJs(schema: Schema) {
function generateService(schema: Schema, f: GeneratedFile, service: DescService) {
const { MethodKind: rtMethodKind, MethodIdempotency: rtMethodIdempotency } = schema.runtime;
f.print(makeJsDoc(service));
f.print("export const ", localName(service), " = {");
f.print(f.exportDecl("const", localName(service)), " = {");
f.print(` typeName: `, literalString(service.typeName), `,`);
f.print(" methods: {");
for (const method of service.methods) {
Expand Down
2 changes: 1 addition & 1 deletion packages/protoc-gen-connect-es/src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function generateService(
const { MethodKind: rtMethodKind, MethodIdempotency: rtMethodIdempotency } =
schema.runtime;
f.print(makeJsDoc(service));
f.print("export const ", localName(service), " = {");
f.print(f.exportDecl("const", localName(service)), " = {");
f.print(` typeName: `, literalString(service.typeName), `,`);
f.print(" methods: {");
for (const method of service.methods) {
Expand Down

0 comments on commit a0d4a3e

Please sign in to comment.