@contractkit/prettier-plugin 0.14.2 → 0.14.4

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 205ms
8
+ ESM dist/index.js 1.37 KB
9
+ ESM dist/index.js.map 3.18 KB
10
+ ESM ⚡️ Build success in 65ms
11
11
  DTS Build start
12
- DTS ⚡️ Build success in 4778ms
13
- DTS dist/index.d.ts 1.65 KB
12
+ DTS ⚡️ Build success in 2885ms
13
+ DTS dist/index.d.ts 622.00 B
@@ -3,26 +3,17 @@ $ vitest run --coverage
3
3
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
4
4
  Coverage enabled with v8
5
5
 
6
- ✓ tests/format-plugin.test.ts (3 tests) 124ms
7
- ✓ tests/print-ck.test.ts (81 tests) 600ms
8
- ✓ tests/round-trip.test.ts (49 tests) 1974ms
9
- ✓ formats test.ck to itself  733ms
10
- ✓ formatting is a fixed point for source #0  602ms
6
+ ✓ tests/format-plugin.test.ts (3 tests) 103ms
11
7
 
12
-  Test Files  3 passed (3)
13
-  Tests  133 passed (133)
14
-  Start at  13:44:24
15
-  Duration  8.12s (transform 4.45s, setup 0ms, import 13.69s, tests 2.70s, environment 0ms)
8
+  Test Files  1 passed (1)
9
+  Tests  3 passed (3)
10
+  Start at  17:30:03
11
+  Duration  3.90s (transform 1.38s, setup 0ms, import 2.83s, tests 103ms, 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,45 @@
1
1
  # @contractkit/prettier-plugin-contractkit
2
2
 
3
+ ## 0.14.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e102a2c]
8
+ - @contractkit/core@0.28.0
9
+
10
+ ## 0.14.3
11
+
12
+ ### Patch Changes
13
+
14
+ - aea5e21: Move the `.ck` printer into core, so the language has exactly one
15
+
16
+ `.ck` had two printers: the prettier plugin's `printCk` and a hand-rolled one inside
17
+ `openapi-to-ck`. Only the prettier copy was covered by the round-trip tests that the grammar
18
+ checklist points at, so the other silently fell behind the grammar — it ignored `hasBlock` and
19
+ the `(documented)` response modifier, could not emit `mcp:`, `plugins:`, `name:`, `override`,
20
+ `format(output=)` or options-level header globals, and emitted source that does not parse for a
21
+ regex containing `/` or an enum value carrying both quote styles.
22
+
23
+ `printCk` now lives in `@contractkit/core` next to `parseCk` and is exported from it. The
24
+ prettier plugin re-exports it unchanged, and `openapi-to-ck`'s `astToCk` is a thin adapter over
25
+ it, so all of the above now print correctly.
26
+
27
+ Three printing fixes come with the move, all of which affect `pnpm format` on existing files:
28
+ - A regex containing `/` prints as `regex="…"` instead of an unterminated regex literal.
29
+ - A string containing `"` prints single-quoted; one carrying both quote styles is degraded
30
+ rather than emitted unparseable (use the new `isUnquotable` to warn before printing).
31
+ - A description containing newlines is flattened when it prints as a trailing `# …` comment,
32
+ instead of leaking the remainder as raw source.
33
+
34
+ Files containing any of these currently cannot round-trip at all, so this is a fix rather than a
35
+ break. `openapi-to-ck` output changes shape in two ways: model descriptions now print as a
36
+ doc-comment block above the `contract` rather than as a trailing comment, and scalar constraints
37
+ use the canonical `len=` / positional `format` spellings.
38
+
39
+ - Updated dependencies [aea5e21]
40
+ - Updated dependencies [5dc2693]
41
+ - @contractkit/core@0.27.0
42
+
3
43
  ## 0.14.2
4
44
 
5
45
  ### Patch Changes
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"}