@connectrpc/protoc-gen-connect-query
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@connectrpc/protoc-gen-connect-query", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Code generator for connect-query", | ||
@@ -25,3 +25,3 @@ "license": "Apache-2.0", | ||
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header", | ||
"generate": "rm -rf snapshots/gen && cd snapshots && buf generate buf.build/connectrpc/eliza:8b8b971d6fde4dc8ba5d96f9fda7d53c", | ||
"generate": "rm -rf snapshots/gen* && cd snapshots && buf generate buf.build/connectrpc/eliza:8b8b971d6fde4dc8ba5d96f9fda7d53c", | ||
"test": "tsc --declaration --declarationDir .type-dump --emitDeclarationOnly" | ||
@@ -31,13 +31,13 @@ }, | ||
"devDependencies": { | ||
"@bufbuild/buf": "1.27.2", | ||
"@bufbuild/protoc-gen-es": "^1.4.1", | ||
"@connectrpc/connect": "^1.1.3", | ||
"@bufbuild/buf": "1.28.1", | ||
"@bufbuild/protoc-gen-es": "^1.6.0", | ||
"@connectrpc/connect": "^1.1.4", | ||
"@connectrpc/connect-query": "workspace:*", | ||
"@connectrpc/protoc-gen-connect-es": "^1.1.3", | ||
"@connectrpc/protoc-gen-connect-es": "^1.1.4", | ||
"@tanstack/react-query": "^5.4.3", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"@bufbuild/protobuf": "^1.4.1", | ||
"@bufbuild/protoplugin": "^1.4.1" | ||
"@bufbuild/protobuf": "^1.6.0", | ||
"@bufbuild/protoplugin": "^1.6.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "peerDependencies": { |
@@ -1,2 +0,2 @@ | ||
import type { PluginInit } from "./utils"; | ||
import type { PluginInit } from "./utils.js"; | ||
/** | ||
@@ -3,0 +3,0 @@ * This function generates the TypeScript Definition output files |
@@ -32,5 +32,5 @@ "use strict"; | ||
{ | ||
f.print((0, ecmascript_1.makeJsDoc)(method)); | ||
f.print(`export const `, safeIdentifier((0, ecmascript_1.localName)(method)), `: {`); | ||
f.print(` readonly name: `, (0, ecmascript_1.literalString)(method.name), `,`); | ||
f.print(f.jsDoc(method)); | ||
f.print(f.exportDecl("const", safeIdentifier((0, ecmascript_1.localName)(method))), ": {"); | ||
f.print(" readonly name: ", f.string(method.name), ","); | ||
f.print(" readonly I: typeof ", method.input, ","); | ||
@@ -42,5 +42,5 @@ f.print(" readonly O: typeof ", method.output, ","); | ||
} | ||
f.print(` readonly service: {`); | ||
f.print(` readonly typeName: ${(0, ecmascript_1.literalString)(service.typeName)}`); | ||
f.print(` }`); | ||
f.print(" readonly service: {"); | ||
f.print(" readonly typeName: ", f.string(service.typeName)); | ||
f.print(" }"); | ||
f.print("};"); | ||
@@ -47,0 +47,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { PluginInit } from "./utils"; | ||
import type { PluginInit } from "./utils.js"; | ||
/** | ||
@@ -3,0 +3,0 @@ * This function generates the TypeScript output files |
@@ -34,16 +34,16 @@ "use strict"; | ||
.forEach((method, index, filteredMethods) => { | ||
f.print((0, ecmascript_1.makeJsDoc)(method)); | ||
f.print(`export const ${safeIdentifier((0, ecmascript_1.localName)(method))} = { `); | ||
f.print(` localName: ${(0, ecmascript_1.literalString)((0, ecmascript_1.localName)(method))},`); | ||
f.print(` name: ${(0, ecmascript_1.literalString)(method.name)},`); | ||
f.print(` kind: `, rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ","); | ||
f.print(` I: `, method.input, `,`); | ||
f.print(` O: `, method.output, `,`); | ||
f.print(f.jsDoc(method)); | ||
f.print(f.exportDecl("const", safeIdentifier((0, ecmascript_1.localName)(method))), " = {"); | ||
f.print(" localName: ", f.string((0, ecmascript_1.localName)(method)), ","); | ||
f.print(" name: ", f.string(method.name), ","); | ||
f.print(" kind: ", rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ","); | ||
f.print(" I: ", method.input, ","); | ||
f.print(" O: ", method.output, ","); | ||
if (method.idempotency !== undefined) { | ||
f.print(" idempotency: ", rtMethodIdempotency, ".", protobuf_1.MethodIdempotency[method.idempotency], ","); | ||
} | ||
f.print(` service: {`); | ||
f.print(` typeName: ${(0, ecmascript_1.literalString)(service.typeName)}`); | ||
f.print(` }`); | ||
f.print(`}`, isTs ? ` as const` : ``, `;`); | ||
f.print(" service: {"); | ||
f.print(" typeName: ", f.string(service.typeName)); | ||
f.print(" }"); | ||
f.print("}", isTs ? " as const" : "", ";"); | ||
const lastIndex = index === filteredMethods.length - 1; | ||
@@ -50,0 +50,0 @@ if (!lastIndex) { |
{ | ||
"name": "@connectrpc/protoc-gen-connect-query", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Code generator for connect-query", | ||
@@ -23,13 +23,13 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@bufbuild/buf": "1.27.2", | ||
"@bufbuild/protoc-gen-es": "^1.4.1", | ||
"@connectrpc/connect": "^1.1.3", | ||
"@connectrpc/protoc-gen-connect-es": "^1.1.3", | ||
"@bufbuild/buf": "1.28.1", | ||
"@bufbuild/protoc-gen-es": "^1.6.0", | ||
"@connectrpc/connect": "^1.1.4", | ||
"@connectrpc/protoc-gen-connect-es": "^1.1.4", | ||
"@tanstack/react-query": "^5.4.3", | ||
"typescript": "^5.2.2", | ||
"@connectrpc/connect-query": "1.0.0" | ||
"typescript": "^5.3.3", | ||
"@connectrpc/connect-query": "1.1.0" | ||
}, | ||
"dependencies": { | ||
"@bufbuild/protobuf": "^1.4.1", | ||
"@bufbuild/protoplugin": "^1.4.1" | ||
"@bufbuild/protobuf": "^1.6.0", | ||
"@bufbuild/protoplugin": "^1.6.0" | ||
}, | ||
@@ -48,5 +48,5 @@ "peerDependencies": { | ||
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header", | ||
"generate": "rm -rf snapshots/gen && cd snapshots && buf generate buf.build/connectrpc/eliza:8b8b971d6fde4dc8ba5d96f9fda7d53c", | ||
"generate": "rm -rf snapshots/gen* && cd snapshots && buf generate buf.build/connectrpc/eliza:8b8b971d6fde4dc8ba5d96f9fda7d53c", | ||
"test": "tsc --declaration --declarationDir .type-dump --emitDeclarationOnly" | ||
} | ||
} |
@@ -16,2 +16,3 @@ # @connectrpc/protoc-gen-connect-query | ||
- [`keep_empty_files=true`](#keep_empty_filestrue) | ||
- [`js_import_style`](#js_import_style) | ||
- [Example Generated Code](#example-generated-code) | ||
@@ -202,4 +203,18 @@ | ||
### `js_import_style` | ||
By default, [protoc-gen-connect-query](https://www.npmjs.com/package/@connectrpc/protoc-gen-connect-query) | ||
(and all other plugins based on [@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin)) | ||
generate ECMAScript `import` and `export` statements. For use cases where | ||
CommonJS is difficult to avoid, this option can be used to generate CommonJS | ||
`require()` calls. | ||
Possible values: | ||
- `js_import_style=module` generate ECMAScript `import` / `export` statements - | ||
the default behavior. | ||
- `js_import_style=legacy_commonjs` generate CommonJS `require()` calls. | ||
## Example Generated Code | ||
See [`eliza.proto`](../../examples/react/basic/eliza.proto) for example inputs, and look [here](../../examples/react/basic/src/gen) to see the outputs those files generate. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37832
219
Updated@bufbuild/protobuf@^1.6.0
Updated@bufbuild/protoplugin@^1.6.0