@contractkit/prettier-plugin 0.10.0 → 0.11.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 -13
- package/.turbo/turbo-test$colon$ci.log +6 -9
- package/CHANGELOG.md +49 -0
- package/coverage/clover.xml +45 -44
- package/coverage/coverage-final.json +1 -1
- package/coverage/indent.ts.html +1 -1
- package/coverage/index.html +14 -14
- package/coverage/print-ck.ts.html +1 -1
- package/coverage/print-contract.ts.html +1 -1
- package/coverage/print-operation.ts.html +15 -12
- package/coverage/print-type.ts.html +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/print-operation.d.ts +1 -1
- package/dist/print-operation.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/print-operation.ts +5 -4
- package/tests/print-ck.test.ts +9 -9
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> eslint --max-warnings=0 && pnpm run build
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> @contractkit/prettier-plugin@0.10.0 build /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
|
|
7
|
-
> tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
|
|
8
|
-
|
|
1
|
+
$ eslint --max-warnings=0 && pnpm run build
|
|
2
|
+
$ tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
|
|
9
3
|
[34mCLI[39m Building entry: src/index.ts
|
|
10
4
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
11
5
|
[34mCLI[39m tsup v8.5.1
|
|
12
6
|
[34mCLI[39m Target: esnext
|
|
13
7
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m20.
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m49.
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
8
|
+
[32mESM[39m [1mdist/index.js [22m[32m20.55 KB[39m
|
|
9
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m49.22 KB[39m
|
|
10
|
+
[32mESM[39m ⚡️ Build success in 142ms
|
|
17
11
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
12
|
+
[32mDTS[39m ⚡️ Build success in 3981ms
|
|
13
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m630.00 B[39m
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
> @contractkit/prettier-plugin@0.10.0 test:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
|
|
3
|
-
> vitest run --coverage
|
|
4
|
-
|
|
1
|
+
$ vitest run --coverage
|
|
5
2
|
|
|
6
3
|
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.5 [39m[90m/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin[39m
|
|
7
4
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
8
5
|
|
|
9
|
-
[32m✓[39m tests/print-ck.test.ts [2m([22m[2m60 tests[22m[2m)[22m[32m
|
|
6
|
+
[32m✓[39m tests/print-ck.test.ts [2m([22m[2m60 tests[22m[2m)[22m[32m 242[2mms[22m[39m
|
|
10
7
|
|
|
11
8
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
9
|
[2m Tests [22m [1m[32m60 passed[39m[22m[90m (60)[39m
|
|
13
|
-
[2m Start at [22m
|
|
14
|
-
[2m Duration [22m 5.
|
|
10
|
+
[2m Start at [22m 11:53:22
|
|
11
|
+
[2m Duration [22m 5.06s[2m (transform 1.59s, setup 0ms, import 3.43s, tests 242ms, environment 0ms)[22m
|
|
15
12
|
|
|
16
13
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
17
14
|
-------------------|---------|----------|---------|---------|-------------------
|
|
18
15
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
19
16
|
-------------------|---------|----------|---------|---------|-------------------
|
|
20
|
-
All files | 68.
|
|
17
|
+
All files | 68.47 | 58.91 | 74.19 | 74.69 |
|
|
21
18
|
indent.ts | 100 | 100 | 100 | 100 |
|
|
22
19
|
print-ck.ts | 89.85 | 80 | 100 | 98.03 | 59
|
|
23
20
|
print-contract.ts | 41.93 | 30.35 | 50 | 42.85 | 10,37-68
|
|
24
|
-
...t-operation.ts |
|
|
21
|
+
...t-operation.ts | 73.41 | 64.35 | 92.85 | 83.33 | ...67,275-286,318
|
|
25
22
|
print-type.ts | 47.12 | 46.87 | 45.45 | 48.61 | ...10,139,142-145
|
|
26
23
|
-------------------|---------|----------|---------|---------|-------------------
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @contractkit/prettier-plugin-contractkit
|
|
2
2
|
|
|
3
|
+
## 0.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [a049895]
|
|
8
|
+
- @contractkit/core@0.19.0
|
|
9
|
+
|
|
10
|
+
## 0.11.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- dd8197b: **Breaking:** Replace the `requireMfa: boolean` field in `security: { ... }` blocks with `policy: <ident|none>`, and switch the generated Koa router middleware from `requireSecurity` to ServerKit's new `requirePolicy`.
|
|
15
|
+
|
|
16
|
+
The `security` declaration on operations, routes, and the file-level `options { security: { ... } }` block no longer accepts a `requireMfa:` line. The new field is `policy:` and takes a bare identifier (the named policy) or the keyword `none` to explicitly bypass policy enforcement. Existing `.ck` files that use `requireMfa:` will fail to parse.
|
|
17
|
+
|
|
18
|
+
```ck
|
|
19
|
+
# Before
|
|
20
|
+
security: {
|
|
21
|
+
requireMfa: true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# After
|
|
25
|
+
security: {
|
|
26
|
+
policy: paymentsWrite
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Explicit bypass
|
|
30
|
+
security: {
|
|
31
|
+
policy: none
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**`@contractkit/core`** — `SecurityFields` interface drops `requireMfa` / `requireMfaDescription` and adds `policy?: string | false` / `policyDescription?: string`. The grammar's `SecurityRequireMfaLine` is replaced by `SecurityPolicyLine` (`policyKw ":" (noneKw | identifier)`). `security: none` (the route-level public sentinel) is unchanged.
|
|
36
|
+
|
|
37
|
+
**`@contractkit/plugin-typescript`** — Generated Koa routers now import `requirePolicy` from `@maroonedsoftware/koa` (previously `requireSecurity`) and emit `requirePolicy({ policy: 'name' })`, `requirePolicy({ policy: false })`, or bare `requirePolicy()`. Consumers must upgrade ServerKit alongside.
|
|
38
|
+
|
|
39
|
+
**`@contractkit/prettier-plugin`** — Formats `policy: <name>` and `policy: none` lines inside security blocks. Files containing `requireMfa:` will no longer round-trip and will surface as parse errors.
|
|
40
|
+
|
|
41
|
+
**`@contractkit/plugin-markdown`** — The "Security: authenticated" admonition now shows `policy: <name|none>` instead of `requireMfa: <bool>`.
|
|
42
|
+
|
|
43
|
+
**`@contractkit/openapi-to-ck`** — Non-empty OpenAPI `security` requirements continue to collapse to an empty `security: {}` (authenticated, default policy); the serializer now emits `policy:` lines when the field is set.
|
|
44
|
+
|
|
45
|
+
**`contractkit-vscode-extension`** — TextMate grammar highlights `policy:` inside the security block; LSP completion offers `policy` instead of `requireMfa`. Re-run `pnpm run vscode:install` to pick up the change.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [dd8197b]
|
|
50
|
+
- @contractkit/core@0.18.0
|
|
51
|
+
|
|
3
52
|
## 0.10.0
|
|
4
53
|
|
|
5
54
|
### Minor Changes
|
package/coverage/clover.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
4
|
-
<metrics statements="
|
|
2
|
+
<coverage generated="1778846007745" clover="3.2.0">
|
|
3
|
+
<project timestamp="1778846007745" name="All files">
|
|
4
|
+
<metrics statements="332" coveredstatements="248" conditionals="443" coveredconditionals="261" methods="31" coveredmethods="23" elements="806" coveredelements="532" complexity="0" loc="332" ncloc="332" packages="1" files="5" classes="5"/>
|
|
5
5
|
<file name="indent.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/indent.ts">
|
|
6
6
|
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
7
7
|
<line num="1" count="1" type="stmt"/>
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
<line num="68" count="0" type="stmt"/>
|
|
93
93
|
</file>
|
|
94
94
|
<file name="print-operation.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-operation.ts">
|
|
95
|
-
<metrics statements="
|
|
95
|
+
<metrics statements="180" coveredstatements="150" conditionals="216" coveredconditionals="139" methods="14" coveredmethods="13"/>
|
|
96
96
|
<line num="16" count="1" type="stmt"/>
|
|
97
97
|
<line num="17" count="1" type="stmt"/>
|
|
98
98
|
<line num="18" count="1" type="stmt"/>
|
|
@@ -218,60 +218,61 @@
|
|
|
218
218
|
<line num="236" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
219
219
|
<line num="237" count="3" type="stmt"/>
|
|
220
220
|
<line num="238" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
221
|
-
<line num="239" count="5" type="
|
|
221
|
+
<line num="239" count="5" type="cond" truecount="2" falsecount="0"/>
|
|
222
222
|
<line num="240" count="5" type="stmt"/>
|
|
223
223
|
<line num="241" count="5" type="stmt"/>
|
|
224
|
-
<line num="
|
|
224
|
+
<line num="242" count="5" type="stmt"/>
|
|
225
225
|
<line num="248" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
226
|
-
<line num="249" count="
|
|
227
|
-
<line num="
|
|
226
|
+
<line num="249" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
227
|
+
<line num="250" count="0" type="stmt"/>
|
|
228
228
|
<line num="252" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
229
|
-
<line num="253" count="9" type="
|
|
230
|
-
<line num="254" count="9" type="
|
|
231
|
-
<line num="255" count="
|
|
232
|
-
<line num="256" count="11" type="
|
|
233
|
-
<line num="257" count="11" type="
|
|
229
|
+
<line num="253" count="9" type="cond" truecount="1" falsecount="1"/>
|
|
230
|
+
<line num="254" count="9" type="stmt"/>
|
|
231
|
+
<line num="255" count="9" type="cond" truecount="2" falsecount="2"/>
|
|
232
|
+
<line num="256" count="11" type="cond" truecount="2" falsecount="0"/>
|
|
233
|
+
<line num="257" count="11" type="stmt"/>
|
|
234
234
|
<line num="258" count="11" type="cond" truecount="2" falsecount="0"/>
|
|
235
235
|
<line num="259" count="11" type="cond" truecount="2" falsecount="0"/>
|
|
236
|
-
<line num="260" count="11" type="
|
|
237
|
-
<line num="
|
|
236
|
+
<line num="260" count="11" type="cond" truecount="2" falsecount="0"/>
|
|
237
|
+
<line num="261" count="11" type="stmt"/>
|
|
238
238
|
<line num="263" count="9" type="stmt"/>
|
|
239
|
-
<line num="
|
|
240
|
-
<line num="
|
|
241
|
-
<line num="274" count="
|
|
239
|
+
<line num="264" count="9" type="stmt"/>
|
|
240
|
+
<line num="267" count="0" type="stmt"/>
|
|
241
|
+
<line num="274" count="10" type="cond" truecount="1" falsecount="1"/>
|
|
242
242
|
<line num="275" count="0" type="stmt"/>
|
|
243
|
-
<line num="276" count="0" type="
|
|
244
|
-
<line num="277" count="0" type="cond" truecount="0" falsecount="
|
|
245
|
-
<line num="278" count="0" type="
|
|
246
|
-
<line num="279" count="0" type="
|
|
243
|
+
<line num="276" count="0" type="stmt"/>
|
|
244
|
+
<line num="277" count="0" type="cond" truecount="0" falsecount="4"/>
|
|
245
|
+
<line num="278" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
246
|
+
<line num="279" count="0" type="stmt"/>
|
|
247
247
|
<line num="280" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
248
248
|
<line num="281" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
249
|
-
<line num="282" count="0" type="
|
|
250
|
-
<line num="
|
|
249
|
+
<line num="282" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
250
|
+
<line num="283" count="0" type="stmt"/>
|
|
251
251
|
<line num="285" count="0" type="stmt"/>
|
|
252
|
-
<line num="
|
|
253
|
-
<line num="
|
|
254
|
-
<line num="
|
|
255
|
-
<line num="296" count="
|
|
252
|
+
<line num="286" count="0" type="stmt"/>
|
|
253
|
+
<line num="288" count="10" type="stmt"/>
|
|
254
|
+
<line num="294" count="7" type="stmt"/>
|
|
255
|
+
<line num="296" count="7" type="cond" truecount="2" falsecount="2"/>
|
|
256
256
|
<line num="297" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
257
|
-
<line num="298" count="8" type="
|
|
258
|
-
<line num="299" count="8" type="
|
|
259
|
-
<line num="300" count="8" type="
|
|
260
|
-
<line num="301" count="8" type="
|
|
261
|
-
<line num="302" count="
|
|
262
|
-
<line num="
|
|
263
|
-
<line num="305" count="
|
|
264
|
-
<line num="306" count="
|
|
265
|
-
<line num="307" count="
|
|
266
|
-
<line num="308" count="2" type="
|
|
267
|
-
<line num="309" count="
|
|
257
|
+
<line num="298" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
258
|
+
<line num="299" count="8" type="stmt"/>
|
|
259
|
+
<line num="300" count="8" type="cond" truecount="4" falsecount="1"/>
|
|
260
|
+
<line num="301" count="8" type="stmt"/>
|
|
261
|
+
<line num="302" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
262
|
+
<line num="303" count="6" type="stmt"/>
|
|
263
|
+
<line num="305" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
264
|
+
<line num="306" count="1" type="stmt"/>
|
|
265
|
+
<line num="307" count="7" type="cond" truecount="2" falsecount="0"/>
|
|
266
|
+
<line num="308" count="2" type="stmt"/>
|
|
267
|
+
<line num="309" count="2" type="cond" truecount="2" falsecount="2"/>
|
|
268
268
|
<line num="310" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
269
|
-
<line num="311" count="3" type="
|
|
270
|
-
<line num="
|
|
271
|
-
<line num="
|
|
272
|
-
<line num="
|
|
273
|
-
<line num="
|
|
269
|
+
<line num="311" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
270
|
+
<line num="312" count="3" type="stmt"/>
|
|
271
|
+
<line num="314" count="2" type="stmt"/>
|
|
272
|
+
<line num="316" count="8" type="stmt"/>
|
|
273
|
+
<line num="318" count="0" type="stmt"/>
|
|
274
274
|
<line num="322" count="7" type="stmt"/>
|
|
275
|
+
<line num="323" count="7" type="stmt"/>
|
|
275
276
|
</file>
|
|
276
277
|
<file name="print-type.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-type.ts">
|
|
277
278
|
<metrics statements="72" coveredstatements="35" conditionals="96" coveredconditionals="45" methods="11" coveredmethods="5"/>
|