@contractkit/plugin-typescript 0.17.5 → 0.18.0
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/.turbo/turbo-build$colon$ci.log +7 -7
- package/.turbo/turbo-test$colon$ci.log +15 -15
- package/CHANGELOG.md +10 -0
- package/README.md +10 -1
- package/coverage/clover.xml +695 -566
- package/coverage/coverage-final.json +6 -6
- package/coverage/index.html +21 -21
- package/coverage/src/codegen-contract.ts.html +3 -3
- package/coverage/src/codegen-operation.ts.html +1 -1
- package/coverage/src/codegen-plain-types.ts.html +1 -1
- package/coverage/src/codegen-sdk.ts.html +989 -236
- package/coverage/src/index.html +40 -40
- package/coverage/src/index.ts.html +415 -112
- package/coverage/src/path-utils.ts.html +51 -51
- package/coverage/src/ts-render.ts.html +4 -4
- package/coverage/tests/helpers.ts.html +15 -15
- package/coverage/tests/index.html +1 -1
- package/dist/codegen-sdk.d.ts +96 -2
- package/dist/codegen-sdk.d.ts.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +270 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/codegen-sdk.ts +258 -7
- package/src/index.ts +118 -17
- package/tests/codegen-sdk.test.ts +188 -16
- package/tests/codegen-server.test.ts +98 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-typescript@0.
|
|
2
|
+
> @contractkit/plugin-typescript@0.18.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
|
|
3
3
|
> eslint --max-warnings=0 && pnpm run build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @contractkit/plugin-typescript@0.
|
|
6
|
+
> @contractkit/plugin-typescript@0.18.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
|
|
7
7
|
> tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
[34mCLI[39m tsup v8.5.1
|
|
12
12
|
[34mCLI[39m Target: esnext
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m135.58 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m298.86 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 308ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 5090ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.67 KB[39m
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-typescript@0.
|
|
2
|
+
> @contractkit/plugin-typescript@0.18.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
|
|
3
3
|
> vitest run --coverage
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.5 [39m[90m/home/runner/work/ContractKit/ContractKit/packages/plugin-typescript[39m
|
|
7
7
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m tests/codegen-
|
|
10
|
-
[32m✓[39m tests/codegen-
|
|
11
|
-
[32m✓[39m tests/codegen-sdk.test.ts [2m([22m[
|
|
12
|
-
[32m✓[39m tests/codegen-
|
|
13
|
-
[32m✓[39m tests/
|
|
14
|
-
[32m✓[39m tests/
|
|
9
|
+
[32m✓[39m tests/codegen-operation.test.ts [2m([22m[2m88 tests[22m[2m)[22m[32m 53[2mms[22m[39m
|
|
10
|
+
[32m✓[39m tests/codegen-contract.test.ts [2m([22m[2m124 tests[22m[2m)[22m[32m 120[2mms[22m[39m
|
|
11
|
+
[32m✓[39m tests/codegen-sdk.test.ts [2m([22m[2m131 tests[22m[2m)[22m[32m 76[2mms[22m[39m
|
|
12
|
+
[32m✓[39m tests/codegen-plain-types.test.ts [2m([22m[2m61 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
13
|
+
[32m✓[39m tests/pipeline.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 142[2mms[22m[39m
|
|
14
|
+
[32m✓[39m tests/codegen-server.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m 24[2mms[22m[39m
|
|
15
15
|
|
|
16
16
|
[2m Test Files [22m [1m[32m6 passed[39m[22m[90m (6)[39m
|
|
17
|
-
[2m Tests [22m [1m[
|
|
18
|
-
[2m Start at [22m
|
|
19
|
-
[2m Duration [22m 6.
|
|
17
|
+
[2m Tests [22m [1m[32m448 passed[39m[22m[90m (448)[39m
|
|
18
|
+
[2m Start at [22m 16:22:10
|
|
19
|
+
[2m Duration [22m 6.11s[2m (transform 5.19s, setup 0ms, import 12.92s, tests 452ms, environment 1ms)[22m
|
|
20
20
|
|
|
21
21
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
22
22
|
-------------------|---------|----------|---------|---------|-------------------
|
|
23
23
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
24
24
|
-------------------|---------|----------|---------|---------|-------------------
|
|
25
|
-
All files |
|
|
26
|
-
src | 77
|
|
25
|
+
All files | 80.98 | 76.16 | 84.16 | 83.21 |
|
|
26
|
+
src | 80.77 | 75.84 | 83.76 | 82.97 |
|
|
27
27
|
...n-contract.ts | 87.83 | 82.12 | 90.08 | 88.96 | ...1069,1074-1075
|
|
28
28
|
...-operation.ts | 78.18 | 74.26 | 78.08 | 79.69 | ...68-679,684-685
|
|
29
29
|
...lain-types.ts | 89.08 | 78.37 | 96.66 | 92.3 | ...31,243,249,301
|
|
30
|
-
codegen-sdk.ts | 88.
|
|
31
|
-
index.ts |
|
|
32
|
-
path-utils.ts |
|
|
30
|
+
codegen-sdk.ts | 88.26 | 83.01 | 87.14 | 91.22 | ...1087-1088,1091
|
|
31
|
+
index.ts | 57.28 | 46.93 | 59.25 | 61.27 | ...90,493,519,522
|
|
32
|
+
path-utils.ts | 36.52 | 27.53 | 75 | 38.14 | ...32-136,147-187
|
|
33
33
|
ts-render.ts | 82.19 | 85.39 | 72.22 | 87.09 | 56,90,126,157-165
|
|
34
34
|
tests | 90.38 | 90.9 | 89.28 | 93.47 |
|
|
35
35
|
helpers.ts | 90.38 | 90.9 | 89.28 | 93.47 | 110-118
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @contractkit/contractkit-plugin-typescript
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6f8e3b6: Group TypeScript SDK clients by `keys.area` and `keys.subarea`. Files declaring `subarea` produce a leaf `<Area><Subarea>Client` exposed at `sdk.<area>.<subarea>`; area-only files (no subarea) inline their methods directly onto a synthesized `<Area>Client` and surface as `sdk.<area>.<method>`. Files with no area keep the legacy flat `sdk.<filename>` shape.
|
|
8
|
+
|
|
9
|
+
`{subarea}` is a new path-template variable on `output.clients` and `output.types`, enabling layouts like `src/{area}/{subarea}.client.ts`. Multiple area-level files merging into one client throw a codegen-time error if any method names collide — disambiguate with `sdk:` or move into a subarea.
|
|
10
|
+
|
|
11
|
+
Breaking: area-level files no longer emit a standalone `*.client.ts` (their methods live on the area client in `sdk.ts`). The `generateSdkAggregator` signature now takes a structured `SdkAggregatorInput` rather than `(clients, importPath?, className?)`.
|
|
12
|
+
|
|
3
13
|
## 0.17.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ Output paths support the following variables:
|
|
|
104
104
|
| `{filename}` | Base name of the `.ck` source file (without extension) |
|
|
105
105
|
| `{dir}` | Relative directory of the `.ck` source file |
|
|
106
106
|
| `{area}` | Value of the `area` key from the `options` block |
|
|
107
|
+
| `{subarea}` | Value of the `subarea` key from the `options` block |
|
|
107
108
|
| `{name}` | The `name` option from the SDK sub-config |
|
|
108
109
|
|
|
109
110
|
## What gets generated
|
|
@@ -124,7 +125,15 @@ Each operation file generates one Koa router. Request bodies and path/query para
|
|
|
124
125
|
|
|
125
126
|
### SDK client shape (from `operation`)
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
Operation files cluster on the SDK based on `keys.area` and `keys.subarea` (set in each file's `options { keys: { ... } }` block):
|
|
129
|
+
|
|
130
|
+
| File metadata | Generated layout |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `area: identity, subarea: invitations` | leaf `IdentityInvitationsClient` emitted as `<output.clients>` (path can use `{subarea}`); aggregator wires it as `sdk.identity.invitations` |
|
|
133
|
+
| `area: identity` (no subarea) | methods inlined directly on `IdentityClient` (no standalone `*.client.ts`); exposed as `sdk.identity.<method>` |
|
|
134
|
+
| neither | flat `<Filename>Client` exposed as `sdk.<filename>` (legacy behavior) |
|
|
135
|
+
|
|
136
|
+
Multiple files mapping to the same `(area, subarea)` are merged into one leaf class. Multiple area-level files merge into a single `<Area>Client`; duplicate method names across them throw at codegen — disambiguate with `sdk:` or move one into a subarea.
|
|
128
137
|
|
|
129
138
|
Method names follow this priority:
|
|
130
139
|
|