Skip to content

Commit

Permalink
Merge branch 'main' into tstamm/deprecate-jsdocblock-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Feb 19, 2024
2 parents 4aa7c8a + 3db07bb commit e2ed796
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 6 deletions.
10 changes: 10 additions & 0 deletions packages/protobuf-test/extra/name-clash.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ message case {
message return {
}

// reserved object property
message constructor {
}
message toString {
}
message toJSON {
}
message valueOf {
}

// used by runtime
message Message {
}
Expand Down
78 changes: 78 additions & 0 deletions packages/protobuf-test/src/gen/js/extra/name-clash_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions packages/protobuf-test/src/gen/js/extra/name-clash_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 126 additions & 0 deletions packages/protobuf-test/src/gen/ts/extra/name-clash_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions packages/protobuf/src/private/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ export function localName(
const pkg = desc.file.proto.package;
const offset = pkg.length > 0 ? pkg.length + 1 : 0;
const name = desc.typeName.substring(offset).replace(/\./g, "_");
// For services, we only care about safe identifiers, not safe object properties,
// but we have shipped v1 with a bug that respected object properties, and we
// do not want to introduce a breaking change, so we continue to escape for
// safe object properties.
// See https://github.com/bufbuild/protobuf-es/pull/391
return safeObjectProperty(safeIdentifier(name));
return safeIdentifier(name);
}
case "enum_value": {
const sharedPrefix = desc.parent.sharedPrefix;
Expand Down

0 comments on commit e2ed796

Please sign in to comment.