@contractkit/plugin-typescript 0.17.4 → 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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @contractkit/plugin-typescript@0.17.4 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
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.17.4 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
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
  CLI Building entry: src/index.ts
@@ -11,9 +11,9 @@
11
11
  CLI tsup v8.5.1
12
12
  CLI Target: esnext
13
13
  ESM Build start
14
- ESM dist/index.js 126.39 KB
15
- ESM dist/index.js.map 274.93 KB
16
- ESM ⚡️ Build success in 216ms
14
+ ESM dist/index.js 135.58 KB
15
+ ESM dist/index.js.map 298.86 KB
16
+ ESM ⚡️ Build success in 308ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 5850ms
19
- DTS dist/index.d.ts 3.44 KB
18
+ DTS ⚡️ Build success in 5090ms
19
+ DTS dist/index.d.ts 3.67 KB
@@ -1,35 +1,35 @@
1
1
 
2
- > @contractkit/plugin-typescript@0.17.4 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
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
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/codegen-operation.test.ts (88 tests) 98ms
10
- ✓ tests/codegen-contract.test.ts (124 tests) 242ms
11
- ✓ tests/codegen-sdk.test.ts (123 tests) 282ms
12
- ✓ tests/codegen-plain-types.test.ts (61 tests) 45ms
13
- ✓ tests/codegen-server.test.ts (15 tests) 22ms
14
- ✓ tests/pipeline.test.ts (25 tests) 120ms
9
+ ✓ tests/codegen-operation.test.ts (88 tests) 53ms
10
+ ✓ tests/codegen-contract.test.ts (124 tests) 120ms
11
+ ✓ tests/codegen-sdk.test.ts (131 tests) 76ms
12
+ ✓ tests/codegen-plain-types.test.ts (61 tests) 37ms
13
+ ✓ tests/pipeline.test.ts (25 tests) 142ms
14
+ ✓ tests/codegen-server.test.ts (19 tests) 24ms
15
15
 
16
16
   Test Files  6 passed (6)
17
-  Tests  436 passed (436)
18
-  Start at  15:55:13
19
-  Duration  6.81s (transform 3.80s, setup 0ms, import 13.43s, tests 808ms, environment 1ms)
17
+  Tests  448 passed (448)
18
+  Start at  16:22:10
19
+  Duration  6.11s (transform 5.19s, setup 0ms, import 12.92s, tests 452ms, environment 1ms)
20
20
 
21
21
   % Coverage report from v8
22
22
  -------------------|---------|----------|---------|---------|-------------------
23
23
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
24
24
  -------------------|---------|----------|---------|---------|-------------------
25
- All files | 77.84 | 74.45 | 82.5 | 79.74 |
26
- src | 77.54 | 74.08 | 81.92 | 79.4 |
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.75 | 83.6 | 85 | 91.49 | ...23,678,712-729
31
- index.ts | 23.35 | 19.51 | 33.33 | 25.69 | ...97,415,418,421
32
- path-utils.ts | 23.47 | 18.84 | 58.33 | 23.71 | ...1,54-55,80-187
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,22 @@
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
+
13
+ ## 0.17.5
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [a9e9ec0]
18
+ - @contractkit/core@0.14.0
19
+
3
20
  ## 0.17.4
4
21
 
5
22
  ### 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
- Each operation file generates one client class. The aggregator SDK class (in `output.sdk`) instantiates all clients and exposes them as properties.
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