@contractkit/prettier-plugin 0.14.1 → 0.14.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.
@@ -5,9 +5,9 @@ $ tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly
5
5
  CLI tsup v8.5.1
6
6
  CLI Target: esnext
7
7
  ESM Build start
8
- ESM dist/index.js 27.08 KB
9
- ESM dist/index.js.map 69.36 KB
10
- ESM ⚡️ Build success in 174ms
8
+ ESM dist/index.js 1.37 KB
9
+ ESM dist/index.js.map 3.18 KB
10
+ ESM ⚡️ Build success in 90ms
11
11
  DTS Build start
12
- DTS ⚡️ Build success in 5639ms
13
- DTS dist/index.d.ts 1.65 KB
12
+ DTS ⚡️ Build success in 1985ms
13
+ DTS dist/index.d.ts 622.00 B
@@ -4,25 +4,16 @@ $ vitest run --coverage
4
4
  Coverage enabled with v8
5
5
 
6
6
  ✓ tests/format-plugin.test.ts (3 tests) 136ms
7
- ✓ tests/print-ck.test.ts (81 tests) 1049ms
8
- ✓ tests/round-trip.test.ts (49 tests) 2210ms
9
- ✓ formats test.ck to itself  918ms
10
- ✓ formatting is a fixed point for source #0  515ms
11
7
 
12
-  Test Files  3 passed (3)
13
-  Tests  133 passed (133)
14
-  Start at  17:32:00
15
-  Duration  8.78s (transform 4.30s, setup 0ms, import 15.52s, tests 3.40s, environment 1ms)
8
+  Test Files  1 passed (1)
9
+  Tests  3 passed (3)
10
+  Start at  16:35:30
11
+  Duration  4.67s (transform 1.44s, setup 0ms, import 3.46s, tests 136ms, environment 0ms)
16
12
 
17
13
   % Coverage report from v8
18
- -------------------|---------|----------|---------|---------|-------------------
19
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
20
- -------------------|---------|----------|---------|---------|-------------------
21
- All files | 79.5 | 74.08 | 93.47 | 86.44 |
22
- indent.ts | 100 | 100 | 100 | 100 |
23
- index.ts | 81.81 | 100 | 100 | 80 | 47-48
24
- print-ck.ts | 90.59 | 88.26 | 100 | 100 | ...57-158,172,176
25
- print-contract.ts | 74.28 | 60.29 | 100 | 80 | 70-76,83
26
- ...t-operation.ts | 78.77 | 71.42 | 95 | 87.55 | ...63,380,388-399
27
- print-type.ts | 69.56 | 64.42 | 81.81 | 72 | ...,45-61,148-151
28
- -------------------|---------|----------|---------|---------|-------------------
14
+ ----------|---------|----------|---------|---------|-------------------
15
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
16
+ ----------|---------|----------|---------|---------|-------------------
17
+ All files | 81.81 | 100 | 100 | 80 |
18
+ index.ts | 81.81 | 100 | 100 | 80 | 46-47
19
+ ----------|---------|----------|---------|---------|-------------------
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @contractkit/prettier-plugin-contractkit
2
2
 
3
+ ## 0.14.3
4
+
5
+ ### Patch Changes
6
+
7
+ - aea5e21: Move the `.ck` printer into core, so the language has exactly one
8
+
9
+ `.ck` had two printers: the prettier plugin's `printCk` and a hand-rolled one inside
10
+ `openapi-to-ck`. Only the prettier copy was covered by the round-trip tests that the grammar
11
+ checklist points at, so the other silently fell behind the grammar — it ignored `hasBlock` and
12
+ the `(documented)` response modifier, could not emit `mcp:`, `plugins:`, `name:`, `override`,
13
+ `format(output=)` or options-level header globals, and emitted source that does not parse for a
14
+ regex containing `/` or an enum value carrying both quote styles.
15
+
16
+ `printCk` now lives in `@contractkit/core` next to `parseCk` and is exported from it. The
17
+ prettier plugin re-exports it unchanged, and `openapi-to-ck`'s `astToCk` is a thin adapter over
18
+ it, so all of the above now print correctly.
19
+
20
+ Three printing fixes come with the move, all of which affect `pnpm format` on existing files:
21
+ - A regex containing `/` prints as `regex="…"` instead of an unterminated regex literal.
22
+ - A string containing `"` prints single-quoted; one carrying both quote styles is degraded
23
+ rather than emitted unparseable (use the new `isUnquotable` to warn before printing).
24
+ - A description containing newlines is flattened when it prints as a trailing `# …` comment,
25
+ instead of leaking the remainder as raw source.
26
+
27
+ Files containing any of these currently cannot round-trip at all, so this is a fix rather than a
28
+ break. `openapi-to-ck` output changes shape in two ways: model descriptions now print as a
29
+ doc-comment block above the `contract` rather than as a trailing comment, and scalar constraints
30
+ use the canonical `len=` / positional `format` spellings.
31
+
32
+ - Updated dependencies [aea5e21]
33
+ - Updated dependencies [5dc2693]
34
+ - @contractkit/core@0.27.0
35
+
36
+ ## 0.14.2
37
+
38
+ ### Patch Changes
39
+
40
+ - ca1c139: Declare the MIT license explicitly: every package now ships a `LICENSE` file in its published tarball and sets `"license": "MIT"` in its manifest, so license scanners and registries report the terms correctly.
41
+ - Updated dependencies [ca1c139]
42
+ - @contractkit/core@0.26.1
43
+
3
44
  ## 0.14.1
4
45
 
5
46
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marooned Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -3,12 +3,12 @@ import type { CkRootNode } from '@contractkit/core';
3
3
  /**
4
4
  * Prettier plugin registering the `.ck` language, its parser, and its printer.
5
5
  *
6
- * The parser is `parseCk` and the printer is `printCk`, so formatting behaviour lives in
7
- * `@contractkit/core` and `print-ck.ts` rather than here — this module only adapts them to
6
+ * The parser is `parseCk` and the printer is `printCk`, both from `@contractkit/core`, so all
7
+ * formatting behaviour lives there rather than here — this module only adapts them to
8
8
  * prettier's interface. `tests/format-plugin.test.ts` covers that adapter layer, which a
9
9
  * printer-level test cannot reach.
10
10
  */
11
11
  declare const plugin: Plugin<CkRootNode>;
12
12
  export default plugin;
13
- export { printCk, DEFAULT_PRINT_WIDTH } from './print-ck.js';
13
+ export { printCk, DEFAULT_PRINT_WIDTH } from '@contractkit/core';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAkBpD;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,UAAU,CA8B9B,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiBpD;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,UAAU,CA8B9B,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}