@contractkit/plugin-bruno 1.2.0 → 1.3.0

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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @contractkit/plugin-bruno@1.2.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
2
+ > @contractkit/plugin-bruno@1.3.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
3
3
  > eslint --max-warnings=0 && pnpm run build
4
4
 
5
5
 
6
- > @contractkit/plugin-bruno@1.2.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
6
+ > @contractkit/plugin-bruno@1.3.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
7
7
  > tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -11,9 +11,9 @@
11
11
  CLI tsup v8.5.1
12
12
  CLI Target: esnext
13
13
  ESM Build start
14
- ESM dist/index.js 22.42 KB
15
- ESM dist/index.js.map 54.71 KB
16
- ESM ⚡️ Build success in 130ms
14
+ ESM dist/index.js 23.43 KB
15
+ ESM dist/index.js.map 56.92 KB
16
+ ESM ⚡️ Build success in 174ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 3824ms
19
- DTS dist/index.d.ts 2.52 KB
18
+ DTS ⚡️ Build success in 3925ms
19
+ DTS dist/index.d.ts 2.95 KB
@@ -1,25 +1,26 @@
1
1
 
2
- > @contractkit/plugin-bruno@1.2.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
2
+ > @contractkit/plugin-bruno@1.3.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
3
3
  > vitest run --coverage
4
4
 
5
5
 
6
6
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/codegen-bruno.test.ts (102 tests) 424ms
9
+ ✓ tests/codegen-bruno.test.ts (108 tests) 207ms
10
10
 
11
11
   Test Files  1 passed (1)
12
-  Tests  102 passed (102)
13
-  Start at  19:55:22
14
-  Duration  5.19s (transform 1.36s, setup 0ms, import 3.56s, tests 424ms, environment 0ms)
12
+  Tests  108 passed (108)
13
+  Start at  12:37:07
14
+  Duration  5.13s (transform 1.70s, setup 0ms, import 3.83s, tests 207ms, environment 0ms)
15
15
 
16
16
   % Coverage report from v8
17
17
  -------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
18
18
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
19
19
  -------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
20
- All files | 85.82 | 76.41 | 86.84 | 87.42 |
21
- src | 87.27 | 76.29 | 92.15 | 88.54 |
22
- codegen-bruno.ts | 87.27 | 76.29 | 92.15 | 88.54 | 98,334-335,419,427,480-483,490-497,517,523,527-529,545,555,579,589-591,597-599,604,608-616,625,629
20
+ All files | 78.68 | 72.17 | 82.92 | 79.46 |
21
+ src | 79.11 | 71.65 | 85.96 | 79.52 |
22
+ codegen-bruno.ts | 87.31 | 76.72 | 92.15 | 88.58 | 98,337-338,422,430,483-486,493-500,520,526,530-532,548,558,582,592-594,600-602,607,611-619,628,632
23
+ index.ts | 26.92 | 35.89 | 33.33 | 25 | 73-178
23
24
  tests | 75 | 77.41 | 76 | 78.94 |
24
25
  helpers.ts | 75 | 77.41 | 76 | 78.94 | 43-47,55-59,71,113,133,145
25
26
  -------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @contractkit/contractkit-plugin-bruno
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a9e9ec0: Replace per-operation `pluginFiles` with structured `pluginExtensions`. The `plugins:` block on an operation now accepts JSON-like values (string, number, boolean, null, object, array) so each plugin owns its own schema for its entry. `file://` URLs in any string position are resolved relative to the `.ck` source file before plugins run, and `http://` / `https://` URLs are fetched via GET. `op.pluginExtensions` carries the resolved tree; the raw form lives at `op.plugins`. The Bruno plugin now expects `{ template: "file://..." }` (was a bare path string) and ships a `validateBrunoExtension` hook that fails compilation on unknown fields or non-string `template`.
8
+
9
+ Plugins can now implement `validateExtension(value)` on the `ContractKitPlugin` interface to surface compilation-time errors/warnings on their entry.
10
+
11
+ All CLI caching is unified under `<rootDir>/.contractkit/cache/` via a new `CacheService` class: `build.json` for file/plugin hashes and `http/<sha256(url)>` for fetched HTTP response bodies. The `cache: string` config field is reinterpreted as a custom cache **directory** (was a custom build-cache filename); previous file paths under `.contractkit-cache` and `.contractkit-http-cache/` are abandoned. Add `.contractkit/` to `.gitignore`.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [a9e9ec0]
16
+ - @contractkit/core@0.14.0
17
+
3
18
  ## 1.2.0
4
19
 
5
20
  ### Minor Changes
package/README.md CHANGED
@@ -66,18 +66,18 @@ The output directory is fully replaced on each run — stale request files from
66
66
 
67
67
  ## Per-operation overrides
68
68
 
69
- Add a `plugins` block to any operation in a `.ck` file to deep-merge a YAML file into the generated request:
69
+ Add a `plugins` block to any operation in a `.ck` file to deep-merge a YAML fragment into the generated request. The Bruno plugin reads `plugins.bruno.template`; the value is either an inline YAML string or a `file://`/`http(s)://` URL that the CLI resolves to the file/response body before the plugin runs:
70
70
 
71
71
  ```
72
72
  post: {
73
73
  plugins: {
74
- bruno: "overrides/auth-token.yml"
74
+ bruno: { template: "file://overrides/auth-token.yml" }
75
75
  }
76
76
  response: { 200: AuthResponse }
77
77
  }
78
78
  ```
79
79
 
80
- The file path is relative to the `.ck` source file. Its content is deep-merged into the generated request YAML — objects recurse, arrays replace entirely:
80
+ The `file://` path is relative to the `.ck` source file. The resolved content is deep-merged into the generated request YAML — objects recurse, arrays replace entirely:
81
81
 
82
82
  ```yaml
83
83
  # overrides/auth-token.yml
@@ -87,7 +87,9 @@ runtime:
87
87
  bru.setVar("token", bru.getEnvVar("adminToken"));
88
88
  ```
89
89
 
90
- Authoring tip: combine per-operation `plugins.bruno` paths with `{{var}}` substitution to factor out a shared override directory:
90
+ `validateBrunoExtension` (run during compilation) enforces the shape: the value must be an object whose only allowed key is `template: string`. Anything else fails the build with a precise error.
91
+
92
+ Authoring tip: combine per-operation `template` URLs with `{{var}}` substitution to factor out a shared override directory:
91
93
 
92
94
  ```
93
95
  options {
@@ -96,7 +98,7 @@ options {
96
98
 
97
99
  operation /payments/{id}: {
98
100
  get: {
99
- plugins: { bruno: "{{bruno}}/payments/get-payment.yml" }
101
+ plugins: { bruno: { template: "file://{{bruno}}/payments/get-payment.yml" } }
100
102
  response: { 200: { application/json: Payment } }
101
103
  }
102
104
  }