Skip to content

Commit

Permalink
V2: Fix Registry exports (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored May 17, 2024
1 parent 0be4cb1 commit 5aa2c10
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/protobuf-conformance/src/conformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
type MessageShape,
toBinary,
toJsonString,
createRegistry,
} from "@bufbuild/protobuf";
import { createRegistry } from "@bufbuild/protobuf/reflect";
import {
type ConformanceRequest,
type ConformanceResponse,
Expand Down
2 changes: 1 addition & 1 deletion packages/protobuf-test/src/codegenv1/embed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { describe, expect, test } from "@jest/globals";
import { compileFile, compileFileDescriptorSet } from "../helpers.js";
import { embedFileDesc } from "@bufbuild/protobuf/codegenv1";
import assert from "node:assert";
import { createFileRegistry } from "@bufbuild/protobuf/reflect";
import { createFileRegistry } from "@bufbuild/protobuf";

describe("embedFileDesc()", () => {
test("embeds file descriptor", async () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/protobuf-test/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
// limitations under the License.

import { UpstreamProtobuf } from "upstream-protobuf";
import { createFileRegistry } from "@bufbuild/protobuf/reflect";
import { fromBinary } from "@bufbuild/protobuf";
import { fromBinary, createFileRegistry } from "@bufbuild/protobuf";
import type { FileDescriptorSet } from "@bufbuild/protobuf/wkt";
import { FileDescriptorSetDesc } from "@bufbuild/protobuf/wkt";
import assert from "node:assert";
Expand Down
10 changes: 4 additions & 6 deletions packages/protobuf-test/src/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@

import { describe, expect, test } from "@jest/globals";
import {
type MessageInitShape,
type DescMessage,
type JsonValue,
createRegistry,
create,
toJson,
fromJson,
fromJsonString,
setExtension,
getExtension,
} from "@bufbuild/protobuf";
import type {
MessageInitShape,
DescMessage,
JsonValue,
} from "@bufbuild/protobuf";
import { createRegistry } from "@bufbuild/protobuf/reflect";
import {
RepeatedScalarValuesMessageDesc,
ScalarValuesMessageDesc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import {
type FileRegistry,
createFileRegistry,
createRegistry,
protoCamelCase,
} from "@bufbuild/protobuf/reflect";
import {
type DescEnum,
type DescExtension,
type DescFile,
Expand All @@ -30,6 +27,7 @@ import {
LongType,
ScalarType,
} from "@bufbuild/protobuf";
import { protoCamelCase } from "@bufbuild/protobuf/reflect";
import {
type FileDescriptorSet,
Edition,
Expand All @@ -45,7 +43,7 @@ import {
compileMessage,
compileMethod,
compileService,
} from "../helpers.js";
} from "./helpers.js";

describe("createRegistry()", function () {
let testReg: FileRegistry;
Expand Down
3 changes: 1 addition & 2 deletions packages/protobuf-test/src/wkt/any.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import {
ValueDesc,
} from "@bufbuild/protobuf/wkt";
import type { Value } from "@bufbuild/protobuf/wkt";
import { create } from "@bufbuild/protobuf";
import { createRegistry } from "@bufbuild/protobuf/reflect";
import { create, createRegistry } from "@bufbuild/protobuf";

describe("google.protobuf.Any", () => {
test(`is correctly identifies by message and type name`, () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/protobuf/scripts/bootstrap-inject.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { join as joinPath } from "node:path";
import assert from "node:assert";
import { stdout, stderr, argv } from "node:process";
import { UpstreamProtobuf } from "upstream-protobuf";
import { createFileRegistry, reflect } from "@bufbuild/protobuf/reflect";
import { fromBinary } from "@bufbuild/protobuf";
import { fromBinary, createFileRegistry } from "@bufbuild/protobuf";
import { reflect } from "@bufbuild/protobuf/reflect";
import {
Edition,
FeatureSetDefaultsDesc,
Expand Down
1 change: 1 addition & 0 deletions packages/protobuf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from "./clone.js";
export * from "./descriptors.js";
export * from "./equals.js";
export * from "./fields.js";
export * from "./registry.js";
export type { JsonValue, JsonObject } from "./json-value.js";
export { toBinary } from "./to-binary.js";
export type { BinaryWriteOptions } from "./to-binary.js";
Expand Down
1 change: 0 additions & 1 deletion packages/protobuf/src/reflect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ export * from "./names.js";
export * from "./nested-types.js";
export * from "./reflect.js";
export * from "./reflect-types.js";
export * from "../registry.js";
export * from "./scalar.js";
export { isReflectList, isReflectMap, isReflectMessage } from "./guard.js";
2 changes: 1 addition & 1 deletion packages/protobuf/src/wkt/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { Message, MessageShape } from "../types.js";
import type { Any } from "./gen/google/protobuf/any_pb.js";
import { AnyDesc } from "./gen/google/protobuf/any_pb.js";
import type { DescMessage } from "../descriptors.js";
import type { Registry } from "../reflect/index.js";
import type { Registry } from "../registry.js";
import { create } from "../create.js";
import { toBinary } from "../to-binary.js";
import { fromBinary, mergeFromBinary } from "../from-binary.js";
Expand Down
6 changes: 2 additions & 4 deletions packages/protoplugin-test/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import {
CodeGeneratorRequestDesc,
FileDescriptorSetDesc,
} from "@bufbuild/protobuf/wkt";
import { fromBinary } from "@bufbuild/protobuf";
import { createFileRegistry } from "@bufbuild/protobuf/reflect";
import type { Plugin } from "@bufbuild/protoplugin";
import { createEcmaScriptPlugin } from "@bufbuild/protoplugin";
import { fromBinary, createFileRegistry } from "@bufbuild/protobuf";
import { type Plugin, createEcmaScriptPlugin } from "@bufbuild/protoplugin";
import type {
GeneratedFile,
Schema,
Expand Down
3 changes: 1 addition & 2 deletions packages/protoplugin-test/src/plugin-edition-support.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import { describe, expect, test } from "@jest/globals";
import { fromBinary } from "@bufbuild/protobuf";
import { fromBinary, minimumEdition } from "@bufbuild/protobuf";
import {
CodeGeneratorRequestDesc,
CodeGeneratorResponse_Feature,
Expand All @@ -22,7 +22,6 @@ import {
import { createTestPluginAndRun } from "./helpers.js";
import { UpstreamProtobuf } from "upstream-protobuf";
import { createEcmaScriptPlugin } from "@bufbuild/protoplugin";
import { minimumEdition } from "@bufbuild/protobuf/reflect";
import type { SupportedEdition } from "@bufbuild/protobuf";

async function runPlugin(
Expand Down
4 changes: 2 additions & 2 deletions packages/protoplugin/src/create-es-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// limitations under the License.

import { create, protoInt64 } from "@bufbuild/protobuf";
import type { SupportedEdition } from "@bufbuild/protobuf";
import {
type SupportedEdition,
minimumEdition as minimumEditionUpstream,
maximumEdition as maximumEditionUpstream,
} from "@bufbuild/protobuf/reflect";
} from "@bufbuild/protobuf";
import type { CodeGeneratorResponse } from "@bufbuild/protobuf/wkt";
import {
CodeGeneratorResponse_Feature,
Expand Down
4 changes: 2 additions & 2 deletions packages/protoplugin/src/ecmascript/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import type {
DescMessage,
DescService,
} from "@bufbuild/protobuf";
import { create } from "@bufbuild/protobuf";
import { create, createFileRegistry } from "@bufbuild/protobuf";
import type { CodeGeneratorRequest } from "@bufbuild/protobuf/wkt";
import { Edition, FileDescriptorSetDesc } from "@bufbuild/protobuf/wkt";
import { createFileRegistry, nestedTypes } from "@bufbuild/protobuf/reflect";
import { nestedTypes } from "@bufbuild/protobuf/reflect";
import type {
CreatePreambleFn,
FileInfo,
Expand Down

0 comments on commit 5aa2c10

Please sign in to comment.