From 05b81dad889b0ffccb2ec1821c2f99fbddbf6968 Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 23 Apr 2024 12:34:14 +0200 Subject: [PATCH] V2: Mark all exports from codegenv1 private --- .../src/codegenv1/restore-json-names.ts | 3 ++ packages/protobuf/src/codegenv1/symbols.ts | 9 +++++ packages/protobuf/src/codegenv1/types.ts | 40 +++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/packages/protobuf/src/codegenv1/restore-json-names.ts b/packages/protobuf/src/codegenv1/restore-json-names.ts index b8a4b76a3..32ebf16a8 100644 --- a/packages/protobuf/src/codegenv1/restore-json-names.ts +++ b/packages/protobuf/src/codegenv1/restore-json-names.ts @@ -16,6 +16,9 @@ import type { DescriptorProto } from "../wkt/gen/google/protobuf/descriptor_pb.j import { protoCamelCase } from "../reflect/names.js"; import { unsafeIsSetExplicit } from "../reflect/unsafe.js"; +/** + * @private + */ export function restoreJsonNames(message: DescriptorProto) { for (const f of message.field) { if (!unsafeIsSetExplicit(f, "jsonName")) { diff --git a/packages/protobuf/src/codegenv1/symbols.ts b/packages/protobuf/src/codegenv1/symbols.ts index 4825c66da..01d9080b3 100644 --- a/packages/protobuf/src/codegenv1/symbols.ts +++ b/packages/protobuf/src/codegenv1/symbols.ts @@ -12,8 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +/** + * @private + */ export const packageName = "@bufbuild/protobuf"; +/** + * @private + */ export const wktPublicImportPaths: Readonly> = { "google/protobuf/compiler/plugin.proto": packageName + "/wkt", "google/protobuf/any.proto": packageName + "/wkt", @@ -29,6 +35,9 @@ export const wktPublicImportPaths: Readonly> = { "google/protobuf/wrappers.proto": packageName + "/wkt", }; +/** + * @private + */ // prettier-ignore export const symbols = { isMessage: {typeOnly: false, bootstrapWktFrom: "../../is-message.js", from: packageName }, diff --git a/packages/protobuf/src/codegenv1/types.ts b/packages/protobuf/src/codegenv1/types.ts index 07d63cd2c..7fc91b453 100644 --- a/packages/protobuf/src/codegenv1/types.ts +++ b/packages/protobuf/src/codegenv1/types.ts @@ -21,21 +21,61 @@ import type { DescService, } from "../desc-types.js"; +/** + * Describes a protobuf source file. + * + * @private + */ export type GenDescFile = DescFile; +/** + * Describes a message declaration in a protobuf source file. + * + * This type is identical to DescMessage, but carries additional type + * information. + * + * @private + */ export type GenDescMessage = DescMessage & brand; +/** + * Describes an enumeration in a protobuf source file. + * + * This type is identical to DescEnum, but carries additional type + * information. + * + * @private + */ export type GenDescEnum = DescEnum & brand; +/** + * Describes an extension in a protobuf source file. + * + * This type is identical to DescExtension, but carries additional type + * information. + * + * @private + */ export type GenDescExtension< Extendee extends Message = Message, RuntimeShape = unknown, > = DescExtension & brand; +/** + * Describes a service declaration in a protobuf source file. + * + * This type is identical to DescService, but carries additional type + * information. + * + * @private + */ export type GenDescService = DescService & brand; +/** + * @private + */ export type GenDescServiceShape = { [localName: string]: { kind: "unary" | "server_streaming" | "client_streaming" | "bidi_streaming";