From 9b8a1564920743ddcbb95212d76ecd856594bd4e Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Thu, 28 Sep 2023 13:19:27 +0200 Subject: [PATCH 1/8] Add ESM wrapper for @connectrpc/connect Needs testing before we can continue. --- packages/connect/package.json | 65 +++++----------- packages/connect/scripts/gen-proxy.mjs | 101 +++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 44 deletions(-) create mode 100644 packages/connect/scripts/gen-proxy.mjs diff --git a/packages/connect/package.json b/packages/connect/package.json index 14d90894a..8119e5e25 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -8,67 +8,44 @@ "url": "https://github.com/connectrpc/connect-es.git", "directory": "packages/connect" }, - "sideEffects": false, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", + "clean": "rm -rf ./dist/*", "generate": "buf generate src/protocol-grpc/proto", - "build": "npm run build:cjs && npm run build:esm && node scripts/update-user-agent.mjs", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy && node scripts/update-user-agent.mjs", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm && echo >./dist/esm/package.json '{\"type\":\"module\", \"sideEffects\":false}'", + "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:proxy": "node scripts/gen-proxy.mjs . protocol protocol-connect protocol-grpc protocol-grpc-web", "jasmine": "jasmine --config=jasmine.json", "attw": "attw --pack" }, + "type": "module", + "sideEffects": false, "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" }, "./protocol": { - "import": { - "types": "./dist/esm/protocol/index.d.ts", - "default": "./dist/esm/protocol/index.js" - }, - "require": { - "types": "./dist/cjs/protocol/index.d.ts", - "default": "./dist/cjs/protocol/index.js" - } + "module": "./dist/esm/protocol/index.js", + "require": "./dist/cjs/protocol/index.js", + "import": "./dist/proxy/protocol/index.js" }, "./protocol-connect": { - "import": { - "types": "./dist/esm/protocol-connect/index.d.ts", - "default": "./dist/esm/protocol-connect/index.js" - }, - "require": { - "types": "./dist/cjs/protocol-connect/index.d.ts", - "default": "./dist/cjs/protocol-connect/index.js" - } + "module": "./dist/esm/protocol-connect/index.js", + "require": "./dist/cjs/protocol-connect/index.js", + "import": "./dist/proxy/protocol-connect/index.js" }, "./protocol-grpc": { - "import": { - "types": "./dist/esm/protocol-grpc/index.d.ts", - "default": "./dist/esm/protocol-grpc/index.js" - }, - "require": { - "types": "./dist/cjs/protocol-grpc/index.d.ts", - "default": "./dist/cjs/protocol-grpc/index.js" - } + "module": "./dist/esm/protocol-grpc/index.js", + "require": "./dist/cjs/protocol-grpc/index.js", + "import": "./dist/proxy/protocol-grpc/index.js" }, "./protocol-grpc-web": { - "import": { - "types": "./dist/esm/protocol-grpc-web/index.d.ts", - "default": "./dist/esm/protocol-grpc-web/index.js" - }, - "require": { - "types": "./dist/cjs/protocol-grpc-web/index.d.ts", - "default": "./dist/cjs/protocol-grpc-web/index.js" - } + "module": "./dist/esm/protocol-grpc-web/index.js", + "require": "./dist/cjs/protocol-grpc-web/index.js", + "import": "./dist/proxy/protocol-grpc-web/index.js" } }, "typesVersions": { diff --git a/packages/connect/scripts/gen-proxy.mjs b/packages/connect/scripts/gen-proxy.mjs new file mode 100644 index 000000000..492aad42d --- /dev/null +++ b/packages/connect/scripts/gen-proxy.mjs @@ -0,0 +1,101 @@ +import {existsSync, mkdirSync, readFileSync, writeFileSync} from "node:fs"; +import * as path from "node:path"; +import {exit, stderr, stdout, argv} from "node:process"; + +const args = argv.slice(2); + +if (args.length === 0) { + stdout.write(`USAGE: ${path.basename(argv[1])} [...path] +path: One or more subpath exports. A dot (.) is valid. + +Generates ESM wrappers for dual packages. + +Example: + + ${path.basename(argv[1])} . foo + +Assumes that the following CJS artifacts exist: + + dist/cjs + ├── index.d.ts + ├── index.js + └── foo + ├── index.d.ts + └── index.js + +Generates the following ESM wrappers: + + dist/proxy + ├── index.d.ts + ├── index.js + └── foo + ├── index.d.ts + └── index.js + +package.json must contain: + + "type": "module", + "exports": { + ".": { + "require": "./dist/cjs/index.js", + "import": "./dist/esmfake/index.js" + }, + "./protocol": { + "require": "./dist/cjs/foo/index.js", + "import": "./dist/esmfake/foo/index.js" + }, + +Known limitations: +- expects CJS files with a .js extension, not .cjs +- does not support default exports +- supports only simple subpath directory exports, assuming a index.js file +- does not support export patterns +`); + exit(1); +} + +const cjsDist = "dist/cjs"; +const proxyDist = "dist/proxy"; + +const packageType = readPackageJsonType(); +if (packageType !== "module") { + stderr.write(`package.json is missing "type": "module" field.\n`); + exit(1); +} + +for (const subpath of args) { + const cjsPath = path.join(cjsDist, subpath, "index.js"); + if (!existsSync(cjsPath)) { + stderr.write(`CommonJS artifact for subpath "${subpath}" not found at expected path ${cjsPath}\n`); + exit(1); + } + const proxyDir = path.join(proxyDist, subpath); + if (!existsSync(proxyDir)) { + mkdirSync(proxyDir, { recursive: true }); + } + const cjsImportPath = path.relative(proxyDir, cjsPath) + writeFileSync( + path.join(proxyDir, "index.js"), + `export * from "${cjsImportPath}";\n`, + ); + writeFileSync( + path.join(proxyDir, "index.d.ts"), + `export * from "${cjsImportPath}";\n`, + ); +} + +/** + * @return {"commonjs"|"module"} + */ +function readPackageJsonType() { + const pkgString = readFileSync("package.json", "utf-8"); + const pkg = JSON.parse(pkgString); + const t = pkg.type; + if (typeof t !== "string") { + return "commonjs"; + } + if (t.toLowerCase() === "module") { + return "module"; + } + return "commonjs"; +} From 93d5d32571ae8b352e1629c7becaf93d924880a8 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 29 Sep 2023 12:56:05 +0200 Subject: [PATCH 2/8] Move script --- packages/connect/package.json | 2 +- .../connect/scripts/gen-proxy.mjs => scripts/gen-esm-proxy.mjs | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/connect/scripts/gen-proxy.mjs => scripts/gen-esm-proxy.mjs (100%) diff --git a/packages/connect/package.json b/packages/connect/package.json index 8119e5e25..3132921c9 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -14,7 +14,7 @@ "build": "npm run build:cjs && npm run build:esm && npm run build:proxy && node scripts/update-user-agent.mjs", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", - "build:proxy": "node scripts/gen-proxy.mjs . protocol protocol-connect protocol-grpc protocol-grpc-web", + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs . protocol protocol-connect protocol-grpc protocol-grpc-web", "jasmine": "jasmine --config=jasmine.json", "attw": "attw --pack" }, diff --git a/packages/connect/scripts/gen-proxy.mjs b/scripts/gen-esm-proxy.mjs similarity index 100% rename from packages/connect/scripts/gen-proxy.mjs rename to scripts/gen-esm-proxy.mjs From b57115ce70005b256530815db2917fb6e4604984 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 29 Sep 2023 15:02:21 +0200 Subject: [PATCH 3/8] Add temporary workaround for protobuf-es dual package hazard --- packages/connect-web-bench/README.md | 2 +- packages/connect/src/connect-error.ts | 3 +- packages/connect/src/http-headers.ts | 3 +- .../src/protocol-connect/error-json.ts | 5 +-- .../src/protocol-grpc/trailer-status.ts | 5 +-- packages/connect/src/protocol/index.ts | 1 + .../src/protocol/is-protobuf-message.ts | 34 +++++++++++++++++++ packages/connect/src/protocol/normalize.ts | 3 +- 8 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 packages/connect/src/protocol/is-protobuf-message.ts diff --git a/packages/connect-web-bench/README.md b/packages/connect-web-bench/README.md index 2e8158d24..90b3123d2 100644 --- a/packages/connect-web-bench/README.md +++ b/packages/connect-web-bench/README.md @@ -10,5 +10,5 @@ it like a web server would usually do. | code generator | bundle size | minified | compressed | |----------------|-------------------:|-----------------------:|---------------------:| -| connect | 113,448 b | 49,872 b | 13,465 b | +| connect | 113,741 b | 50,030 b | 13,533 b | | grpc-web | 414,071 b | 300,352 b | 53,255 b | diff --git a/packages/connect/src/connect-error.ts b/packages/connect/src/connect-error.ts index 4f7220283..9cf12d841 100644 --- a/packages/connect/src/connect-error.ts +++ b/packages/connect/src/connect-error.ts @@ -21,6 +21,7 @@ import type { } from "@bufbuild/protobuf"; import { Message } from "@bufbuild/protobuf"; import { codeToString } from "./protocol-connect/code-string.js"; +import { isProtobufMessage } from "./protocol/is-protobuf-message.js"; /** * ConnectError captures four pieces of information: a Code, an error @@ -152,7 +153,7 @@ export class ConnectError extends Error { : typeOrRegistry; const details: AnyMessage[] = []; for (const data of this.details) { - if (data instanceof Message) { + if (isProtobufMessage(data)) { if (registry.findMessage(data.getType().typeName)) { details.push(data); } diff --git a/packages/connect/src/http-headers.ts b/packages/connect/src/http-headers.ts index 78fd83d64..113af5254 100644 --- a/packages/connect/src/http-headers.ts +++ b/packages/connect/src/http-headers.ts @@ -16,6 +16,7 @@ import type { BinaryReadOptions, MessageType } from "@bufbuild/protobuf"; import { Message, protoBase64 } from "@bufbuild/protobuf"; import { ConnectError } from "./connect-error.js"; import { Code } from "./code.js"; +import { isProtobufMessage } from "./protocol/is-protobuf-message.js"; /** * Encode a single binary header value according to the Connect @@ -30,7 +31,7 @@ export function encodeBinaryHeader( value: Uint8Array | ArrayBufferLike | Message | string, ): string { let bytes: Uint8Array; - if (value instanceof Message) { + if (isProtobufMessage(value)) { bytes = value.toBinary(); } else if (typeof value == "string") { bytes = new TextEncoder().encode(value); diff --git a/packages/connect/src/protocol-connect/error-json.ts b/packages/connect/src/protocol-connect/error-json.ts index 457371f1c..c8e443078 100644 --- a/packages/connect/src/protocol-connect/error-json.ts +++ b/packages/connect/src/protocol-connect/error-json.ts @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Message, protoBase64 } from "@bufbuild/protobuf"; import type { JsonObject, JsonValue, JsonWriteOptions, } from "@bufbuild/protobuf"; +import { protoBase64 } from "@bufbuild/protobuf"; import { Code } from "../code.js"; import { ConnectError } from "../connect-error.js"; import { codeFromString, codeToString } from "./code-string.js"; +import { isProtobufMessage } from "../protocol/is-protobuf-message.js"; /** * Parse a Connect error from a JSON value. @@ -132,7 +133,7 @@ export function errorToJson( }; o.details = error.details .map((value) => { - if (value instanceof Message) { + if (isProtobufMessage(value)) { const i: IncomingDetail = { type: value.getType().typeName, value: value.toBinary(), diff --git a/packages/connect/src/protocol-grpc/trailer-status.ts b/packages/connect/src/protocol-grpc/trailer-status.ts index 62a7214be..100810c59 100644 --- a/packages/connect/src/protocol-grpc/trailer-status.ts +++ b/packages/connect/src/protocol-grpc/trailer-status.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Any, Message } from "@bufbuild/protobuf"; +import { Any } from "@bufbuild/protobuf"; import { Status } from "./gen/status_pb.js"; import { ConnectError } from "../connect-error.js"; import { decodeBinaryHeader, encodeBinaryHeader } from "../http-headers.js"; @@ -22,6 +22,7 @@ import { headerGrpcStatus, headerStatusDetailsBin, } from "./headers.js"; +import { isProtobufMessage } from "../protocol/is-protobuf-message.js"; /** * The value of the Grpc-Status header or trailer in case of success. @@ -52,7 +53,7 @@ export function setTrailerStatus( code: error.code, message: error.rawMessage, details: error.details.map((value) => - value instanceof Message + isProtobufMessage(value) ? Any.pack(value) : new Any({ typeUrl: `type.googleapis.com/${value.type}`, diff --git a/packages/connect/src/protocol/index.ts b/packages/connect/src/protocol/index.ts index 78ce46aa7..22e621392 100644 --- a/packages/connect/src/protocol/index.ts +++ b/packages/connect/src/protocol/index.ts @@ -33,6 +33,7 @@ export { runUnaryCall, runStreamingCall } from "./run-call.js"; // following exports, we recommend that you do so with an exact version // constraint (no ~ or ^). +export { isProtobufMessage } from "./is-protobuf-message.js"; export { createMethodSerializationLookup, createClientMethodSerializers, diff --git a/packages/connect/src/protocol/is-protobuf-message.ts b/packages/connect/src/protocol/is-protobuf-message.ts new file mode 100644 index 000000000..fccc5825d --- /dev/null +++ b/packages/connect/src/protocol/is-protobuf-message.ts @@ -0,0 +1,34 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Message } from "@bufbuild/protobuf"; + +/** + * Temporary workaround for dual package hazard caused by @bufbuild/protobuf + * + * @private Internal code, does not follow semantic versioning. + */ +export function isProtobufMessage>( + arg: string | Uint8Array | ArrayBufferLike | Message | object, +): arg is Message { + return ( + typeof arg == "object" && + "toJson" in arg && + typeof arg.toJson == "function" && + "toBinary" in arg && + typeof arg.toBinary == "function" && + "getType" in arg && + typeof arg.getType == "function" + ); +} diff --git a/packages/connect/src/protocol/normalize.ts b/packages/connect/src/protocol/normalize.ts index efe96b7cd..649c17798 100644 --- a/packages/connect/src/protocol/normalize.ts +++ b/packages/connect/src/protocol/normalize.ts @@ -14,6 +14,7 @@ import type { PartialMessage, MessageType } from "@bufbuild/protobuf"; import { Message } from "@bufbuild/protobuf"; +import { isProtobufMessage } from "./is-protobuf-message.js"; /** * Takes a partial protobuf messages of the @@ -23,7 +24,7 @@ export function normalize>( type: MessageType, message: T | PartialMessage, ) { - return message instanceof Message ? message : new type(message); + return isProtobufMessage(message) ? message : new type(message); } /** From 35d524629040320f7cc5ddb3d6912f6e4de2ae18 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 29 Sep 2023 15:27:42 +0200 Subject: [PATCH 4/8] Add ESM wrapper to all remaining packages --- packages/connect-express/package.json | 20 ++++++++------------ packages/connect-fastify/package.json | 20 ++++++++------------ packages/connect-next/package.json | 20 ++++++++------------ packages/connect-node/package.json | 22 +++++++++------------- packages/connect-web/package.json | 20 ++++++++------------ 5 files changed, 41 insertions(+), 61 deletions(-) diff --git a/packages/connect-express/package.json b/packages/connect-express/package.json index 47cac7c4e..85dadfc4f 100644 --- a/packages/connect-express/package.json +++ b/packages/connect-express/package.json @@ -7,26 +7,22 @@ "url": "https://github.com/connectrpc/connect-es.git", "directory": "packages/connect-express" }, - "sideEffects": false, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", - "build": "npm run build:cjs && npm run build:esm", + "clean": "rm -rf ./dist/*", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .", "attw": "attw --pack" }, - "main": "./dist/cjs/index.js", "type": "module", + "sideEffects": false, + "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" } }, "engines": { diff --git a/packages/connect-fastify/package.json b/packages/connect-fastify/package.json index 86d07a53f..4b4834d0d 100644 --- a/packages/connect-fastify/package.json +++ b/packages/connect-fastify/package.json @@ -7,26 +7,22 @@ "url": "https://github.com/connectrpc/connect-es.git", "directory": "packages/connect-fastify" }, - "sideEffects": false, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", - "build": "npm run build:cjs && npm run build:esm", + "clean": "rm -rf ./dist/*", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .", "attw": "attw --pack" }, - "main": "./dist/cjs/index.js", "type": "module", + "sideEffects": false, + "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" } }, "engines": { diff --git a/packages/connect-next/package.json b/packages/connect-next/package.json index 571e02ef2..73476e9ea 100644 --- a/packages/connect-next/package.json +++ b/packages/connect-next/package.json @@ -7,26 +7,22 @@ "url": "https://github.com/connectrpc/connect-es.git", "directory": "packages/connect-next" }, - "sideEffects": false, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", - "build": "npm run build:cjs && npm run build:esm", + "clean": "rm -rf ./dist/*", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .", "attw": "attw --pack" }, - "main": "./dist/cjs/index.js", "type": "module", + "sideEffects": false, + "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" } }, "engines": { diff --git a/packages/connect-node/package.json b/packages/connect-node/package.json index 6c69d5ddb..6221c4cce 100644 --- a/packages/connect-node/package.json +++ b/packages/connect-node/package.json @@ -8,25 +8,21 @@ "directory": "packages/connect-node" }, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", - "build": "npm run build:cjs && npm run build:esm", + "clean": "rm -rf ./dist/*", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", - "jasmine": "jasmine --config=jasmine.json", - "attw": "attw --pack" + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .", + "attw": "attw --pack", + "jasmine": "jasmine --config=jasmine.json" }, - "main": "./dist/cjs/index.js", "type": "module", + "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" } }, "engines": { diff --git a/packages/connect-web/package.json b/packages/connect-web/package.json index cc868a6d7..28e733d47 100644 --- a/packages/connect-web/package.json +++ b/packages/connect-web/package.json @@ -7,26 +7,22 @@ "url": "https://github.com/connectrpc/connect-es.git", "directory": "packages/connect-web" }, - "sideEffects": false, "scripts": { - "clean": "rm -rf ./dist/cjs/* ./dist/esm/*", - "build": "npm run build:cjs && npm run build:esm", + "clean": "rm -rf ./dist/*", + "build": "npm run build:cjs && npm run build:esm && npm run build:proxy", "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", "build:esm": "tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/esm", + "build:proxy": "node ../../scripts/gen-esm-proxy.mjs .", "attw": "attw --pack" }, - "main": "./dist/cjs/index.js", "type": "module", + "sideEffects": false, + "main": "./dist/cjs/index.js", "exports": { ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" - } + "module": "./dist/esm/index.js", + "require": "./dist/cjs/index.js", + "import": "./dist/proxy/index.js" } }, "peerDependencies": { From 18def88b25625c60808bd4fbffa7a67b635f25a4 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 29 Sep 2023 16:35:36 +0200 Subject: [PATCH 5/8] ignore scripts/update-user-agent.mjs from npm pack --- packages/connect/.npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/connect/.npmignore b/packages/connect/.npmignore index 44d9961d5..95869e1c7 100644 --- a/packages/connect/.npmignore +++ b/packages/connect/.npmignore @@ -3,3 +3,4 @@ /dist/*/**/*.spec.js /dist/*/**/*.spec.d.ts /buf.gen.yaml +/scripts/update-user-agent.mjs From a2d3dbb393034bc26cf8e806914505b9ea29eeea Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 29 Sep 2023 16:54:52 +0200 Subject: [PATCH 6/8] Fix spelling in scripts/gen-esm-proxy.mjs --- scripts/gen-esm-proxy.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gen-esm-proxy.mjs b/scripts/gen-esm-proxy.mjs index 492aad42d..4aed56c3d 100644 --- a/scripts/gen-esm-proxy.mjs +++ b/scripts/gen-esm-proxy.mjs @@ -38,11 +38,11 @@ package.json must contain: "exports": { ".": { "require": "./dist/cjs/index.js", - "import": "./dist/esmfake/index.js" + "import": "./dist/proxy/index.js" }, "./protocol": { "require": "./dist/cjs/foo/index.js", - "import": "./dist/esmfake/foo/index.js" + "import": "./dist/proxy/foo/index.js" }, Known limitations: From 598f1e40ae24b770366677e067680c090e80cd60 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 6 Oct 2023 16:32:40 +0200 Subject: [PATCH 7/8] Revert "Add temporary workaround for protobuf-es dual package hazard" This reverts commit b57115ce --- packages/connect/src/connect-error.ts | 3 +- packages/connect/src/http-headers.ts | 3 +- .../src/protocol-connect/error-json.ts | 5 ++- .../src/protocol-grpc/trailer-status.ts | 5 ++- packages/connect/src/protocol/index.ts | 1 - .../src/protocol/is-protobuf-message.ts | 34 ------------------- packages/connect/src/protocol/normalize.ts | 3 +- 7 files changed, 7 insertions(+), 47 deletions(-) delete mode 100644 packages/connect/src/protocol/is-protobuf-message.ts diff --git a/packages/connect/src/connect-error.ts b/packages/connect/src/connect-error.ts index 9cf12d841..4f7220283 100644 --- a/packages/connect/src/connect-error.ts +++ b/packages/connect/src/connect-error.ts @@ -21,7 +21,6 @@ import type { } from "@bufbuild/protobuf"; import { Message } from "@bufbuild/protobuf"; import { codeToString } from "./protocol-connect/code-string.js"; -import { isProtobufMessage } from "./protocol/is-protobuf-message.js"; /** * ConnectError captures four pieces of information: a Code, an error @@ -153,7 +152,7 @@ export class ConnectError extends Error { : typeOrRegistry; const details: AnyMessage[] = []; for (const data of this.details) { - if (isProtobufMessage(data)) { + if (data instanceof Message) { if (registry.findMessage(data.getType().typeName)) { details.push(data); } diff --git a/packages/connect/src/http-headers.ts b/packages/connect/src/http-headers.ts index 113af5254..78fd83d64 100644 --- a/packages/connect/src/http-headers.ts +++ b/packages/connect/src/http-headers.ts @@ -16,7 +16,6 @@ import type { BinaryReadOptions, MessageType } from "@bufbuild/protobuf"; import { Message, protoBase64 } from "@bufbuild/protobuf"; import { ConnectError } from "./connect-error.js"; import { Code } from "./code.js"; -import { isProtobufMessage } from "./protocol/is-protobuf-message.js"; /** * Encode a single binary header value according to the Connect @@ -31,7 +30,7 @@ export function encodeBinaryHeader( value: Uint8Array | ArrayBufferLike | Message | string, ): string { let bytes: Uint8Array; - if (isProtobufMessage(value)) { + if (value instanceof Message) { bytes = value.toBinary(); } else if (typeof value == "string") { bytes = new TextEncoder().encode(value); diff --git a/packages/connect/src/protocol-connect/error-json.ts b/packages/connect/src/protocol-connect/error-json.ts index c8e443078..457371f1c 100644 --- a/packages/connect/src/protocol-connect/error-json.ts +++ b/packages/connect/src/protocol-connect/error-json.ts @@ -12,16 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { Message, protoBase64 } from "@bufbuild/protobuf"; import type { JsonObject, JsonValue, JsonWriteOptions, } from "@bufbuild/protobuf"; -import { protoBase64 } from "@bufbuild/protobuf"; import { Code } from "../code.js"; import { ConnectError } from "../connect-error.js"; import { codeFromString, codeToString } from "./code-string.js"; -import { isProtobufMessage } from "../protocol/is-protobuf-message.js"; /** * Parse a Connect error from a JSON value. @@ -133,7 +132,7 @@ export function errorToJson( }; o.details = error.details .map((value) => { - if (isProtobufMessage(value)) { + if (value instanceof Message) { const i: IncomingDetail = { type: value.getType().typeName, value: value.toBinary(), diff --git a/packages/connect/src/protocol-grpc/trailer-status.ts b/packages/connect/src/protocol-grpc/trailer-status.ts index 100810c59..62a7214be 100644 --- a/packages/connect/src/protocol-grpc/trailer-status.ts +++ b/packages/connect/src/protocol-grpc/trailer-status.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Any } from "@bufbuild/protobuf"; +import { Any, Message } from "@bufbuild/protobuf"; import { Status } from "./gen/status_pb.js"; import { ConnectError } from "../connect-error.js"; import { decodeBinaryHeader, encodeBinaryHeader } from "../http-headers.js"; @@ -22,7 +22,6 @@ import { headerGrpcStatus, headerStatusDetailsBin, } from "./headers.js"; -import { isProtobufMessage } from "../protocol/is-protobuf-message.js"; /** * The value of the Grpc-Status header or trailer in case of success. @@ -53,7 +52,7 @@ export function setTrailerStatus( code: error.code, message: error.rawMessage, details: error.details.map((value) => - isProtobufMessage(value) + value instanceof Message ? Any.pack(value) : new Any({ typeUrl: `type.googleapis.com/${value.type}`, diff --git a/packages/connect/src/protocol/index.ts b/packages/connect/src/protocol/index.ts index 111d762df..429e74ba4 100644 --- a/packages/connect/src/protocol/index.ts +++ b/packages/connect/src/protocol/index.ts @@ -40,7 +40,6 @@ export { runUnaryCall, runStreamingCall } from "./run-call.js"; // following exports, we recommend that you do so with an exact version // constraint (no ~ or ^). -export { isProtobufMessage } from "./is-protobuf-message.js"; export { createMethodSerializationLookup, createClientMethodSerializers, diff --git a/packages/connect/src/protocol/is-protobuf-message.ts b/packages/connect/src/protocol/is-protobuf-message.ts deleted file mode 100644 index fccc5825d..000000000 --- a/packages/connect/src/protocol/is-protobuf-message.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import { Message } from "@bufbuild/protobuf"; - -/** - * Temporary workaround for dual package hazard caused by @bufbuild/protobuf - * - * @private Internal code, does not follow semantic versioning. - */ -export function isProtobufMessage>( - arg: string | Uint8Array | ArrayBufferLike | Message | object, -): arg is Message { - return ( - typeof arg == "object" && - "toJson" in arg && - typeof arg.toJson == "function" && - "toBinary" in arg && - typeof arg.toBinary == "function" && - "getType" in arg && - typeof arg.getType == "function" - ); -} diff --git a/packages/connect/src/protocol/normalize.ts b/packages/connect/src/protocol/normalize.ts index 649c17798..efe96b7cd 100644 --- a/packages/connect/src/protocol/normalize.ts +++ b/packages/connect/src/protocol/normalize.ts @@ -14,7 +14,6 @@ import type { PartialMessage, MessageType } from "@bufbuild/protobuf"; import { Message } from "@bufbuild/protobuf"; -import { isProtobufMessage } from "./is-protobuf-message.js"; /** * Takes a partial protobuf messages of the @@ -24,7 +23,7 @@ export function normalize>( type: MessageType, message: T | PartialMessage, ) { - return isProtobufMessage(message) ? message : new type(message); + return message instanceof Message ? message : new type(message); } /** From 567b5c99933daf62175ac4cbe1e74db874842025 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Fri, 6 Oct 2023 16:43:23 +0200 Subject: [PATCH 8/8] Update deps on @bufbuild/protobuf and @bufbuild/protoc-gen-es to ^1.3.3 --- package-lock.json | 62 +++++++++---------- packages/connect-express/package.json | 2 +- packages/connect-fastify/package.json | 2 +- packages/connect-next/package.json | 2 +- .../connectrpc/conformance/v1/messages_pb.ts | 2 +- .../src/gen/server/v1/server_pb.ts | 2 +- packages/connect-node/package.json | 2 +- packages/connect-web-bench/README.md | 2 +- packages/connect-web-bench/package.json | 2 +- .../connectrpc/eliza/v1/eliza_pb.ts | 2 +- .../connectrpc/conformance/v1/messages_pb.ts | 2 +- .../src/gen/connectrpc/eliza/v1/eliza_pb.ts | 2 +- .../src/gen/server/v1/server_pb.ts | 2 +- packages/connect-web/package.json | 2 +- packages/connect/package.json | 4 +- .../src/protocol-grpc/gen/status_pb.ts | 2 +- packages/example/package.json | 2 +- packages/example/src/gen/eliza_pb.ts | 2 +- packages/protoc-gen-connect-es/package.json | 6 +- 19 files changed, 52 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 418b98173..e989647b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "connect-web", + "name": "connect-es", "lockfileVersion": 3, "requires": true, "packages": { @@ -968,16 +968,16 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.2.tgz", - "integrity": "sha512-Hw8ZzJEaT3JkMqeWCUfTJwB6H05b8q/xsw2k/BsXBiUCaTpDKd3pxXR3Vss2R1b+OEzRHXDeiO35M0BvVk2Sgg==" + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.3.3.tgz", + "integrity": "sha512-AoHSiIpTFF97SQgmQni4c+Tyr0CDhkaRaR2qGEJTEbauqQwLRpLrd9yVv//wVHOSxr/b4FJcL54VchhY6710xA==" }, "node_modules/@bufbuild/protoc-gen-es": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.2.tgz", - "integrity": "sha512-m/vMlbX4CQ24vJ1LEhrYW4pF04Psvox4cejcjiuGM121CHgpMdkd2tEOEY9xggvjbMsTNF+ZoIhfxIWBRKnh2Q==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.3.3.tgz", + "integrity": "sha512-waqpvdFyqcrrmoAW9c8VCtDmT4+NYDQg/W8DAsMC2/+rXKGQYy3YbxobOuwVm3g/MJC1Gvv6ON/arxq4gYHXYw==", "dependencies": { - "@bufbuild/protoplugin": "1.3.2" + "@bufbuild/protoplugin": "1.3.3" }, "bin": { "protoc-gen-es": "bin/protoc-gen-es" @@ -986,7 +986,7 @@ "node": ">=14" }, "peerDependencies": { - "@bufbuild/protobuf": "1.3.2" + "@bufbuild/protobuf": "1.3.3" }, "peerDependenciesMeta": { "@bufbuild/protobuf": { @@ -995,11 +995,11 @@ } }, "node_modules/@bufbuild/protoplugin": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.2.tgz", - "integrity": "sha512-d6YWD1nKaH5jA0tPY0mfdAcg5rCqCeVw7zLfReMIS8WW/aYtShPwmWS71XpTFMP0LQWlbUiTyYjvNGR35a4hWQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.3.3.tgz", + "integrity": "sha512-sxalYoj+fWxUakknePKfqRpcGlxz45Gcjpth2M274ZvQN+XKwMLVLevArsZWFzGcPoAkiDWMFHhfeQXfjsu+uA==", "dependencies": { - "@bufbuild/protobuf": "1.3.2", + "@bufbuild/protobuf": "1.3.3", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" } @@ -3357,9 +3357,9 @@ } }, "node_modules/engine.io": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", - "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.3.tgz", + "integrity": "sha512-IML/R4eG/pUS5w7OfcDE0jKrljWS9nwnEfsxWCIJF5eO6AHo6+Hlv+lQbdlAYsiJPHzUthLm1RUjnBzWOs45cw==", "dependencies": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", @@ -7107,9 +7107,9 @@ } }, "node_modules/sonic-boom": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.6.0.tgz", - "integrity": "sha512-5Rs7m4IO/mW1WHouC6q6PGJsXO6hSAduwB3ltTsKaDU0Bd7sc5QEUK/jF0YL583g3BG7QV0Dg0rQNZrwZhY6Xg==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.6.1.tgz", + "integrity": "sha512-QV+p5nXPiUiSMxn/k5bOL+hzCpafdj1voL+hywPZhheRSYyYp7CF15rNdz1evOXCUn/tFb7R62PDX1yJmtoTgg==", "dependencies": { "atomic-sleep": "^1.0.0" } @@ -8378,13 +8378,13 @@ "version": "1.1.1", "license": "Apache-2.0", "devDependencies": { - "@bufbuild/protoc-gen-es": "^1.3.1", + "@bufbuild/protoc-gen-es": "^1.3.3", "@types/jasmine": "^4.3.5", "jasmine": "^5.0.0", "undici": "^5.25.4" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1" + "@bufbuild/protobuf": "^1.3.3" } }, "packages/connect-express": { @@ -8398,7 +8398,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1" } @@ -8411,7 +8411,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1", "fastify": "^4.22.1" @@ -8444,7 +8444,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1", "next": "^13.2.4" @@ -8465,7 +8465,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1" } }, @@ -8491,14 +8491,14 @@ "version": "1.1.1", "license": "Apache-2.0", "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1" } }, "packages/connect-web-bench": { "name": "@connectrpc/connect-web-bench", "dependencies": { - "@bufbuild/protobuf": "^1.3.1", + "@bufbuild/protobuf": "^1.3.3", "@bufbuild/protoc-gen-es": "^1.3.1", "@connectrpc/connect-web": "1.1.1", "brotli": "^1.3.3", @@ -8525,7 +8525,7 @@ "packages/example": { "name": "@connectrpc/example", "dependencies": { - "@bufbuild/protobuf": "^1.3.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect-node": "^1.1.1", "@connectrpc/connect-web": "^1.1.1", "tsx": "^3.13.0" @@ -8547,8 +8547,8 @@ "version": "1.1.1", "license": "Apache-2.0", "dependencies": { - "@bufbuild/protobuf": "^1.3.1", - "@bufbuild/protoplugin": "^1.3.1" + "@bufbuild/protobuf": "^1.3.3", + "@bufbuild/protoplugin": "^1.3.3" }, "bin": { "protoc-gen-connect-es": "bin/protoc-gen-connect-es" @@ -8557,7 +8557,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protoc-gen-es": "^1.2.1", + "@bufbuild/protoc-gen-es": "^1.3.3", "@connectrpc/connect": "1.1.1" }, "peerDependenciesMeta": { diff --git a/packages/connect-express/package.json b/packages/connect-express/package.json index ce0cbf999..b15516a5f 100644 --- a/packages/connect-express/package.json +++ b/packages/connect-express/package.json @@ -32,7 +32,7 @@ "@types/express": "^4.17.18" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1" }, diff --git a/packages/connect-fastify/package.json b/packages/connect-fastify/package.json index 3f55ea66e..b3c1ade79 100644 --- a/packages/connect-fastify/package.json +++ b/packages/connect-fastify/package.json @@ -29,7 +29,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "fastify": "^4.22.1", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1" diff --git a/packages/connect-next/package.json b/packages/connect-next/package.json index 209c0c307..a432dde51 100644 --- a/packages/connect-next/package.json +++ b/packages/connect-next/package.json @@ -29,7 +29,7 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "next": "^13.2.4", "@connectrpc/connect": "1.1.1", "@connectrpc/connect-node": "1.1.1" diff --git a/packages/connect-node-test/src/gen/connectrpc/conformance/v1/messages_pb.ts b/packages/connect-node-test/src/gen/connectrpc/conformance/v1/messages_pb.ts index 07f5f0749..7279b05cd 100644 --- a/packages/connect-node-test/src/gen/connectrpc/conformance/v1/messages_pb.ts +++ b/packages/connect-node-test/src/gen/connectrpc/conformance/v1/messages_pb.ts @@ -30,7 +30,7 @@ // Message definitions to be used by integration test service definitions. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file connectrpc/conformance/v1/messages.proto (package connectrpc.conformance.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-node-test/src/gen/server/v1/server_pb.ts b/packages/connect-node-test/src/gen/server/v1/server_pb.ts index ac4d0a788..00128aada 100644 --- a/packages/connect-node-test/src/gen/server/v1/server_pb.ts +++ b/packages/connect-node-test/src/gen/server/v1/server_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file server/v1/server.proto (package server.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-node/package.json b/packages/connect-node/package.json index e264be0d4..a6010c863 100644 --- a/packages/connect-node/package.json +++ b/packages/connect-node/package.json @@ -32,7 +32,7 @@ "undici": "^5.25.4" }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1" }, "devDependencies": { diff --git a/packages/connect-web-bench/README.md b/packages/connect-web-bench/README.md index 5463c9aff..75474da04 100644 --- a/packages/connect-web-bench/README.md +++ b/packages/connect-web-bench/README.md @@ -10,5 +10,5 @@ it like a web server would usually do. | code generator | bundle size | minified | compressed | |----------------|-------------------:|-----------------------:|---------------------:| -| connect | 114,831 b | 50,466 b | 13,630 b | +| connect | 114,538 b | 50,308 b | 13,586 b | | grpc-web | 414,071 b | 300,352 b | 53,255 b | diff --git a/packages/connect-web-bench/package.json b/packages/connect-web-bench/package.json index 7e5178d70..43a0f5902 100644 --- a/packages/connect-web-bench/package.json +++ b/packages/connect-web-bench/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "@connectrpc/connect-web": "1.1.1", - "@bufbuild/protobuf": "^1.3.1", + "@bufbuild/protobuf": "^1.3.3", "@bufbuild/protoc-gen-es": "^1.3.1", "brotli": "^1.3.3", "esbuild": "^0.16.12", diff --git a/packages/connect-web-bench/src/gen/connectweb/connectrpc/eliza/v1/eliza_pb.ts b/packages/connect-web-bench/src/gen/connectweb/connectrpc/eliza/v1/eliza_pb.ts index f4dd1d9da..b46b4876c 100644 --- a/packages/connect-web-bench/src/gen/connectweb/connectrpc/eliza/v1/eliza_pb.ts +++ b/packages/connect-web-bench/src/gen/connectweb/connectrpc/eliza/v1/eliza_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file connectrpc/eliza/v1/eliza.proto (package connectrpc.eliza.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-web-test/src/gen/connectrpc/conformance/v1/messages_pb.ts b/packages/connect-web-test/src/gen/connectrpc/conformance/v1/messages_pb.ts index 07f5f0749..7279b05cd 100644 --- a/packages/connect-web-test/src/gen/connectrpc/conformance/v1/messages_pb.ts +++ b/packages/connect-web-test/src/gen/connectrpc/conformance/v1/messages_pb.ts @@ -30,7 +30,7 @@ // Message definitions to be used by integration test service definitions. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file connectrpc/conformance/v1/messages.proto (package connectrpc.conformance.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-web-test/src/gen/connectrpc/eliza/v1/eliza_pb.ts b/packages/connect-web-test/src/gen/connectrpc/eliza/v1/eliza_pb.ts index f4dd1d9da..b46b4876c 100644 --- a/packages/connect-web-test/src/gen/connectrpc/eliza/v1/eliza_pb.ts +++ b/packages/connect-web-test/src/gen/connectrpc/eliza/v1/eliza_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file connectrpc/eliza/v1/eliza.proto (package connectrpc.eliza.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-web-test/src/gen/server/v1/server_pb.ts b/packages/connect-web-test/src/gen/server/v1/server_pb.ts index ac4d0a788..00128aada 100644 --- a/packages/connect-web-test/src/gen/server/v1/server_pb.ts +++ b/packages/connect-web-test/src/gen/server/v1/server_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "ts_nocheck=false,target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "ts_nocheck=false,target=ts" // @generated from file server/v1/server.proto (package server.v1, syntax proto3) /* eslint-disable */ diff --git a/packages/connect-web/package.json b/packages/connect-web/package.json index 3aed47d26..0c988b4ca 100644 --- a/packages/connect-web/package.json +++ b/packages/connect-web/package.json @@ -26,7 +26,7 @@ } }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1", + "@bufbuild/protobuf": "^1.3.3", "@connectrpc/connect": "1.1.1" }, "files": [ diff --git a/packages/connect/package.json b/packages/connect/package.json index 128da8a53..de12b30f8 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -65,10 +65,10 @@ } }, "peerDependencies": { - "@bufbuild/protobuf": "^1.2.1" + "@bufbuild/protobuf": "^1.3.3" }, "devDependencies": { - "@bufbuild/protoc-gen-es": "^1.3.1", + "@bufbuild/protoc-gen-es": "^1.3.3", "@types/jasmine": "^4.3.5", "jasmine": "^5.0.0", "undici": "^5.25.4" diff --git a/packages/connect/src/protocol-grpc/gen/status_pb.ts b/packages/connect/src/protocol-grpc/gen/status_pb.ts index f16339cc4..0063b5698 100644 --- a/packages/connect/src/protocol-grpc/gen/status_pb.ts +++ b/packages/connect/src/protocol-grpc/gen/status_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "target=ts" // @generated from file status.proto (package google.rpc, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/packages/example/package.json b/packages/example/package.json index 5943009c3..ecf95948e 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -14,7 +14,7 @@ "dependencies": { "@connectrpc/connect-node": "^1.1.1", "@connectrpc/connect-web": "^1.1.1", - "@bufbuild/protobuf": "^1.3.1", + "@bufbuild/protobuf": "^1.3.3", "tsx": "^3.13.0" }, "devDependencies": { diff --git a/packages/example/src/gen/eliza_pb.ts b/packages/example/src/gen/eliza_pb.ts index b6a75e226..7c3b2ed21 100644 --- a/packages/example/src/gen/eliza_pb.ts +++ b/packages/example/src/gen/eliza_pb.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.3.2 with parameter "target=ts" +// @generated by protoc-gen-es v1.3.3 with parameter "target=ts" // @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/packages/protoc-gen-connect-es/package.json b/packages/protoc-gen-connect-es/package.json index 3edbd2bd4..c1af7a56a 100644 --- a/packages/protoc-gen-connect-es/package.json +++ b/packages/protoc-gen-connect-es/package.json @@ -20,12 +20,12 @@ }, "preferUnplugged": true, "dependencies": { - "@bufbuild/protobuf": "^1.3.1", - "@bufbuild/protoplugin": "^1.3.1" + "@bufbuild/protobuf": "^1.3.3", + "@bufbuild/protoplugin": "^1.3.3" }, "peerDependencies": { "@connectrpc/connect": "1.1.1", - "@bufbuild/protoc-gen-es": "^1.2.1" + "@bufbuild/protoc-gen-es": "^1.3.3" }, "peerDependenciesMeta": { "@connectrpc/connect": {