Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2: Mark all exports from codegenv1 private #806

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/protobuf/src/codegenv1/restore-json-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
9 changes: 9 additions & 0 deletions packages/protobuf/src/codegenv1/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Record<string, string>> = {
"google/protobuf/compiler/plugin.proto": packageName + "/wkt",
"google/protobuf/any.proto": packageName + "/wkt",
Expand All @@ -29,6 +35,9 @@ export const wktPublicImportPaths: Readonly<Record<string, string>> = {
"google/protobuf/wrappers.proto": packageName + "/wkt",
};

/**
* @private
*/
// prettier-ignore
export const symbols = {
isMessage: {typeOnly: false, bootstrapWktFrom: "../../is-message.js", from: packageName },
Expand Down
40 changes: 40 additions & 0 deletions packages/protobuf/src/codegenv1/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RuntimeShape extends Message> = DescMessage &
brand<RuntimeShape>;

/**
* Describes an enumeration in a protobuf source file.
*
* This type is identical to DescEnum, but carries additional type
* information.
*
* @private
*/
export type GenDescEnum<RuntimeShape> = DescEnum & brand<RuntimeShape>;

/**
* 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<Extendee, RuntimeShape>;

/**
* Describes a service declaration in a protobuf source file.
*
* This type is identical to DescService, but carries additional type
* information.
*
* @private
*/
export type GenDescService<RuntimeShape extends GenDescServiceShape> =
DescService & brand<RuntimeShape>;

/**
* @private
*/
export type GenDescServiceShape = {
[localName: string]: {
kind: "unary" | "server_streaming" | "client_streaming" | "bidi_streaming";
Expand Down
Loading