@forwardimpact/libcodegen 0.1.53 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/types.js +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libcodegen",
3
- "version": "0.1.53",
3
+ "version": "0.1.56",
4
4
  "description": "Protobuf code generation — keep types in sync with proto definitions without hand-writing.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -51,7 +51,7 @@
51
51
  "@forwardimpact/libutil": "^0.1.64",
52
52
  "@grpc/proto-loader": "^0.8.1",
53
53
  "mustache": "^4.2.0",
54
- "protobufjs": "^7.5.6",
54
+ "protobufjs": "^7.6.1",
55
55
  "protobufjs-cli": "1.2.2"
56
56
  },
57
57
  "devDependencies": {
package/src/types.js CHANGED
@@ -58,6 +58,14 @@ export class CodegenTypes {
58
58
  .replace(
59
59
  /import\s+\*\s+as\s+\$protobuf\s+from\s+"protobufjs\/minimal\.js";/,
60
60
  'import $protobuf from "protobufjs/minimal.js";',
61
+ )
62
+ // Statically bind protobufjs's $util.Long to the `long` package. Without
63
+ // this, `bun build --compile` tree-shakes `long` (only reached via
64
+ // protobufjs's lazy require) and module-init crashes on int64 prototype
65
+ // defaults like `Span.prototype.start_time_unix_nano = $util.Long.fromBits(...)`.
66
+ .replace(
67
+ /(import \$protobuf from "protobufjs\/minimal\.js";)/,
68
+ '$1\nimport Long from "long";\n$protobuf.util.Long = Long;\n$protobuf.configure();',
61
69
  );
62
70
 
63
71
  if (fixed !== content) {