@contractkit/plugin-typescript 0.18.0 → 0.19.1
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 +12 -12
- package/CHANGELOG.md +19 -0
- package/coverage/clover.xml +260 -167
- package/coverage/coverage-final.json +1 -1
- package/coverage/index.html +20 -20
- package/coverage/src/codegen-contract.ts.html +1 -1
- 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 +1 -1
- package/coverage/src/index.html +20 -20
- package/coverage/src/index.ts.html +1052 -275
- package/coverage/src/path-utils.ts.html +1 -1
- package/coverage/src/ts-render.ts.html +1 -1
- package/coverage/tests/helpers.ts.html +1 -1
- package/coverage/tests/index.html +1 -1
- package/dist/index.d.ts +8 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +446 -149
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +481 -222
- package/tests/codegen-server.test.ts +3 -1
|
@@ -634,7 +634,7 @@ export function <span class="fstat-no" title="function not covered" >computePubl
|
|
|
634
634
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
635
635
|
Code coverage generated by
|
|
636
636
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
637
|
-
at 2026-05-
|
|
637
|
+
at 2026-05-07T11:16:43.674Z
|
|
638
638
|
</div>
|
|
639
639
|
<script src="../prettify.js"></script>
|
|
640
640
|
<script>
|
|
@@ -577,7 +577,7 @@ export function renderOutputTsType(type: ContractTypeNode, modelsWithOutput?: Se
|
|
|
577
577
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
578
578
|
Code coverage generated by
|
|
579
579
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
580
|
-
at 2026-05-
|
|
580
|
+
at 2026-05-07T11:16:43.674Z
|
|
581
581
|
</div>
|
|
582
582
|
<script src="../prettify.js"></script>
|
|
583
583
|
<script>
|
|
@@ -811,7 +811,7 @@ operation /users/{id}: {
|
|
|
811
811
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
812
812
|
Code coverage generated by
|
|
813
813
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
814
|
-
at 2026-05-
|
|
814
|
+
at 2026-05-07T11:16:43.674Z
|
|
815
815
|
</div>
|
|
816
816
|
<script src="../prettify.js"></script>
|
|
817
817
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2026-05-
|
|
104
|
+
at 2026-05-07T11:16:43.674Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
package/dist/index.d.ts
CHANGED
|
@@ -2,81 +2,48 @@ import type { ContractKitPlugin } from '@contractkit/core';
|
|
|
2
2
|
export interface ServerConfig {
|
|
3
3
|
/** Directory (relative to rootDir) where server files are written. Default: rootDir. */
|
|
4
4
|
baseDir?: string;
|
|
5
|
-
/**
|
|
6
|
-
* When true, `output.types` emits Zod schema files (via `generateContract`).
|
|
7
|
-
* When false/omitted, `output.types` emits plain TypeScript interfaces.
|
|
8
|
-
*/
|
|
5
|
+
/** When true, `output.types` emits Zod schema files (via `generateContract`). When false/omitted, emits plain TypeScript. */
|
|
9
6
|
zod?: boolean;
|
|
10
7
|
output?: {
|
|
11
|
-
/** Path template for Koa router files. Supports {filename}, {dir}, {area}.
|
|
8
|
+
/** Path template for Koa router files. Supports {filename}, {dir}, {area}. */
|
|
12
9
|
routes?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Path template for type/schema files. Supports {filename}, {dir}, {area}.
|
|
15
|
-
* Generates Zod schemas when `zod: true`, otherwise plain TypeScript interfaces.
|
|
16
|
-
*/
|
|
10
|
+
/** Path template for type/schema files. Supports {filename}, {dir}, {area}. */
|
|
17
11
|
types?: string;
|
|
18
12
|
};
|
|
19
|
-
/** Import path template for service implementations.
|
|
13
|
+
/** Import path template for service implementations. */
|
|
20
14
|
servicePathTemplate?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to emit handlers for operations marked `internal`. Defaults to `true` —
|
|
23
|
-
* the server still needs routes for internal endpoints. Set to `false` to omit them.
|
|
24
|
-
*/
|
|
15
|
+
/** Whether to emit handlers for `internal` operations. Default true. */
|
|
25
16
|
includeInternal?: boolean;
|
|
26
17
|
}
|
|
27
18
|
export interface SdkConfig {
|
|
28
|
-
/** Directory (relative to rootDir) where SDK files are written. Default: rootDir. */
|
|
29
19
|
baseDir?: string;
|
|
30
|
-
/** Name used for the aggregator SDK class (e.g. "homegrown" → `HomegrownSdk`). */
|
|
31
20
|
name?: string;
|
|
32
|
-
/**
|
|
33
|
-
* When true, `output.types` emits Zod schema files (via `generateContract`).
|
|
34
|
-
* When false/omitted, `output.types` emits plain TypeScript interfaces.
|
|
35
|
-
*/
|
|
36
21
|
zod?: boolean;
|
|
37
22
|
output?: {
|
|
38
|
-
/** Path template for the SDK aggregator file. Supports {name}. Default: `sdk.ts`. */
|
|
39
23
|
sdk?: string;
|
|
40
|
-
/** Path template for SDK type files. Supports {filename}, {dir}, {area}, {subarea}. */
|
|
41
24
|
types?: string;
|
|
42
|
-
/** Path template for client class files. Supports {filename}, {dir}, {area}, {subarea}. */
|
|
43
25
|
clients?: string;
|
|
44
26
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Whether to emit SDK methods for operations marked `internal`. Defaults to `false` —
|
|
47
|
-
* internal ops are omitted from the SDK so consumers don't pick them up. Set to `true`
|
|
48
|
-
* for an internal-use SDK that should expose them.
|
|
49
|
-
*/
|
|
50
27
|
includeInternal?: boolean;
|
|
51
28
|
}
|
|
52
29
|
export interface ZodConfig {
|
|
53
|
-
/** Directory (relative to rootDir) where Zod schema files are written. Default: rootDir. */
|
|
54
30
|
baseDir?: string;
|
|
55
|
-
/** Output path template. Supports {filename}, {dir}. Default: `{filename}.schema.ts` alongside source. */
|
|
56
31
|
output?: string;
|
|
57
32
|
}
|
|
58
33
|
export interface TypesConfig {
|
|
59
|
-
/** Directory (relative to rootDir) where plain TypeScript type files are written. Default: rootDir. */
|
|
60
34
|
baseDir?: string;
|
|
61
|
-
/** Output path template. Supports {filename}, {dir}. Default: `{filename}.types.ts` alongside source. */
|
|
62
35
|
output?: string;
|
|
63
36
|
}
|
|
64
37
|
export interface TypescriptPluginConfig {
|
|
65
|
-
/** Generate Koa router files from `operation` declarations. */
|
|
66
38
|
server?: ServerConfig;
|
|
67
|
-
/** Generate TypeScript SDK client files from `operation` declarations. */
|
|
68
39
|
sdk?: SdkConfig;
|
|
69
|
-
/** Generate Zod schema files from `contract` declarations. */
|
|
70
40
|
zod?: ZodConfig;
|
|
71
|
-
/** Generate plain TypeScript interface/type files from `contract` declarations (no Zod runtime). */
|
|
72
41
|
types?: TypesConfig;
|
|
73
42
|
}
|
|
43
|
+
/** Bumped when the codegen output shape changes in a way that should bust every per-file fingerprint. */
|
|
44
|
+
export declare const TYPESCRIPT_CODEGEN_VERSION = "1";
|
|
74
45
|
declare const plugin: ContractKitPlugin;
|
|
75
46
|
export default plugin;
|
|
76
|
-
/**
|
|
77
|
-
* Build a `@contractkit/plugin-typescript` instance with explicit configuration, for
|
|
78
|
-
* programmatic use (tests, custom build scripts). Prefer the default export when loading
|
|
79
|
-
* via `contractkit.config.json`.
|
|
80
|
-
*/
|
|
47
|
+
/** Build a `@contractkit/plugin-typescript` instance with explicit configuration, for programmatic use. */
|
|
81
48
|
export declare function createTypescriptPlugin(config: TypescriptPluginConfig, rootDir: string): ContractKitPlugin;
|
|
82
49
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,iBAAiB,EAQpB,MAAM,mBAAmB,CAAC;AAqC3B,MAAM,WAAW,YAAY;IACzB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6HAA6H;IAC7H,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE;QACL,8EAA8E;QAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,+EAA+E;QAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB;AAID,yGAAyG;AACzG,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAM9C,QAAA,MAAM,MAAM,EAAE,iBAMb,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,2GAA2G;AAC3G,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAOzG"}
|