ts-proto 1.176.1 → 1.176.3
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.
- package/README.markdown +3 -4
- package/build/case.js +6 -1
- package/build/main.js +3 -1
- package/package.json +4 -6
package/README.markdown
CHANGED
|
@@ -687,8 +687,7 @@ The commands below assume you have **Docker** installed. If you are using OS X,
|
|
|
687
687
|
- Run `yarn build:test` to generate the test files.
|
|
688
688
|
> _This runs the following commands:_
|
|
689
689
|
>
|
|
690
|
-
> - `
|
|
691
|
-
> - `bin2ts` — Runs `ts-proto` on the `.bin` files to generate `.ts` files.
|
|
690
|
+
> - `proto2ts` — Runs `ts-proto` on the `integration/**/*.proto` files to generate `.ts` files.
|
|
692
691
|
> - `proto2pbjs` — Generates a reference implementation using `pbjs` for testing compatibility.
|
|
693
692
|
- Run `yarn test`
|
|
694
693
|
|
|
@@ -704,8 +703,8 @@ The commands below assume you have **Docker** installed. If you are using OS X,
|
|
|
704
703
|
- Add/update a `integration/your-new-test/some-test.ts` unit test, even if it's as trivial as just making sure the generated code compiles
|
|
705
704
|
- Modify the `ts-proto` code generation logic:
|
|
706
705
|
- Most important logic is found in [src/main.ts](src/main.ts).
|
|
707
|
-
- After any changes to `src/*.ts` files, run `yarn
|
|
708
|
-
- Or `yarn
|
|
706
|
+
- After any changes to `src/*.ts` files, run `yarn proto2ts` to re-codegen all integration tests
|
|
707
|
+
- Or `yarn proto2ts your-new-test` to re-codegen a specific test
|
|
709
708
|
- Again leaving `yarn watch` running should "just do the right thing"
|
|
710
709
|
- Run `yarn test` to verify your changes pass all existing tests
|
|
711
710
|
- Commit and submit a PR
|
package/build/case.js
CHANGED
|
@@ -25,7 +25,12 @@ function snakeToCamel(s) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.snakeToCamel = snakeToCamel;
|
|
27
27
|
function camelToSnake(s) {
|
|
28
|
-
return (
|
|
28
|
+
return (s
|
|
29
|
+
// any number or little-char -> big char
|
|
30
|
+
.replace(/[a-z0-9]([A-Z])/g, (m) => m[0] + "_" + m[1])
|
|
31
|
+
// any multiple big char -> next word
|
|
32
|
+
.replace(/[A-Z]([A-Z][a-z])/g, (m) => m[0] + "_" + m.substring(1))
|
|
33
|
+
.toUpperCase());
|
|
29
34
|
}
|
|
30
35
|
exports.camelToSnake = camelToSnake;
|
|
31
36
|
function capitalize(s) {
|
package/build/main.js
CHANGED
|
@@ -334,7 +334,6 @@ function makeLongUtils(options, bytes) {
|
|
|
334
334
|
${configure}();
|
|
335
335
|
}
|
|
336
336
|
`);
|
|
337
|
-
// TODO This is unused?
|
|
338
337
|
const numberToLong = (0, ts_poet_1.conditionalOutput)("numberToLong", (0, ts_poet_1.code) `
|
|
339
338
|
function numberToLong(number: number) {
|
|
340
339
|
return ${Long}.fromNumber(number);
|
|
@@ -355,6 +354,9 @@ function makeLongUtils(options, bytes) {
|
|
|
355
354
|
if (long.gt(${bytes.globalThis}.Number.MAX_SAFE_INTEGER)) {
|
|
356
355
|
throw new ${bytes.globalThis}.Error("Value is larger than Number.MAX_SAFE_INTEGER")
|
|
357
356
|
}
|
|
357
|
+
if (long.lt(${bytes.globalThis}.Number.MIN_SAFE_INTEGER)) {
|
|
358
|
+
throw new ${bytes.globalThis}.Error("Value is smaller than Number.MIN_SAFE_INTEGER")
|
|
359
|
+
}
|
|
358
360
|
return long.toNumber();
|
|
359
361
|
}
|
|
360
362
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-proto",
|
|
3
|
-
"version": "1.176.
|
|
3
|
+
"version": "1.176.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/plugin.js",
|
|
6
6
|
"repository": "github:stephenh/ts-proto",
|
|
@@ -10,12 +10,10 @@
|
|
|
10
10
|
"types": "build/index.d.ts",
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "yarn tsc",
|
|
13
|
-
"build:test": "yarn
|
|
13
|
+
"build:test": "yarn proto2ts && yarn proto2pbjs",
|
|
14
14
|
"prepare": "yarn build",
|
|
15
|
-
"
|
|
16
|
-
"proto2bin-node": "docker compose run --rm node update-bins.sh",
|
|
15
|
+
"proto2ts": "docker compose run --rm protoc update-code.sh",
|
|
17
16
|
"proto2pbjs": "docker compose run --rm protoc pbjs.sh",
|
|
18
|
-
"bin2ts": "docker compose run --rm protoc codegen.sh",
|
|
19
17
|
"test": "yarn jest -c jest.config.js",
|
|
20
18
|
"tsc:check": "./tsc-check.sh tsconfig.json tests/tsconfig.json integration/tsconfig.json integration/tsconfig.proto.json protos/tsconfig.json",
|
|
21
19
|
"format": "prettier --write {src,tests}/**/*.ts integration/*.ts",
|
|
@@ -62,7 +60,7 @@
|
|
|
62
60
|
"rxjs": "^7.8.1",
|
|
63
61
|
"semantic-release": "^21.0.7",
|
|
64
62
|
"ts-jest": "^29.1.1",
|
|
65
|
-
"tsx": "^
|
|
63
|
+
"tsx": "^4.11.2",
|
|
66
64
|
"typescript": "^5.1.6",
|
|
67
65
|
"uglify-js": "^3.17.4"
|
|
68
66
|
},
|