@contractkit/prettier-plugin 0.14.2 → 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 205ms
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 4778ms
13
- DTS dist/index.d.ts 1.65 KB
12
+ DTS ⚡️ Build success in 1985ms
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) 136ms
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  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,38 @@
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
+
3
36
  ## 0.14.2
4
37
 
5
38
  ### 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"}