diff --git a/lib/jrpc.js b/lib/jrpc.js index a2cfbc3..92f7d85 100755 --- a/lib/jrpc.js +++ b/lib/jrpc.js @@ -10524,8 +10524,8 @@ var CSharpTarget = class extends CompileTarget { } else { return `${toCSharpType(inp.type)} ${inp.name}`; } - }).join(","); - const genParam = () => a(2, `var param = new JsonArray(${fnc.inputs.map((e) => `JsonSerializer.SerializeToNode(${e.name})`).join(",")});`); + }).join(", "); + const genParam = () => a(2, `var param = new JsonArray(${fnc.inputs.map((e) => `JsonSerializer.SerializeToNode(${e.name})`).join(", ")});`); if (fnc.return) { if (fnc.return.type == "void") { a(1, `public async Task ${fnc.name}(${params}) {`); @@ -10567,7 +10567,7 @@ var CSharpTarget = class extends CompileTarget { a(0, ``); a(0, `public abstract class ${definition.name}Server : JRpcService {`); a(0, ``); - a(1, `public ${definition.name}Server(JRpcClient client) {`); + a(1, `public ${definition.name}Server() {`); for (const fnc of definition.functions) { a(2, `this.RegisterFunction("${fnc.name}");`); } @@ -10575,7 +10575,7 @@ var CSharpTarget = class extends CompileTarget { a(0, ``); for (const fnc of definition.functions) { let params = [ - fnc.inputs.map((inp) => { + ...fnc.inputs.map((inp) => { if (inp.array) { return `List<${toCSharpType(inp.type)}> ${inp.name}`; } else { @@ -10583,7 +10583,7 @@ var CSharpTarget = class extends CompileTarget { } }), "TContext ctx" - ].join(","); + ].join(", "); if (fnc.return) { if (fnc.return.type == "void") { a(1, `public abstract Task ${fnc.name}(${params});`); @@ -10815,6 +10815,11 @@ yargs_default(hideBin(process.argv)).version("1.0.0").command("compile ", targets: argv.output, emitDefinitions: argv.definition }); +}).command("targets", "List all targets", (yargs) => yargs, () => { + console.log("Targets:"); + Targets.forEach((__dirname3, target) => { + console.log(" " + target); + }); }).option("verbose", { alias: "v", type: "boolean", diff --git a/package.json b/package.json index c613765..f5235a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/jrpcgen", - "version": "1.0.13", + "version": "1.0.14", "main": "lib/index.js", "license": "MIT", "packageManager": "yarn@3.1.1", diff --git a/src/index.ts b/src/index.ts index 2ef18ca..41b0f09 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import yargs from "yargs"; import { hideBin } from "yargs/helpers"; -import startCompile, { Target } from "./process"; +import startCompile, { Target, Targets } from "./process"; import dbg from "debug"; const log = dbg("app"); @@ -54,6 +54,12 @@ yargs(hideBin(process.argv)) }) } ) + .command("targets", "List all targets", (yargs)=>yargs, ()=>{ + console.log("Targets:") + Targets.forEach((__dirname, target) => { + console.log(" " + target); + }) + }) .option("verbose", { alias: "v", type: "boolean", diff --git a/src/process.ts b/src/process.ts index cfa9661..d8cc255 100644 --- a/src/process.ts +++ b/src/process.ts @@ -16,12 +16,13 @@ class CatchedError extends Error {} const log = dbg("app"); -const Targets = new Map(); +export const Targets = new Map(); Targets.set("ts-esm", ESMTypescriptTarget); Targets.set("ts-node", NodeJSTypescriptTarget); Targets.set("c#", CSharpTarget as typeof CompileTarget); + function indexToLineAndCol(src: string, index: number) { let line = 1; let col = 1;