@hailstails/hone 0.0.0-stage → 0.1.0-pre.2

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.
Files changed (186) hide show
  1. package/ADOPTING.md +314 -0
  2. package/LICENSE +17 -0
  3. package/MIGRATING.md +238 -0
  4. package/README.md +216 -2
  5. package/THIRD-PARTY-NOTICES.md +354 -0
  6. package/chunks/chunk-233U4FBA.js +42 -0
  7. package/chunks/chunk-7ZJZZBSS.js +14909 -0
  8. package/chunks/chunk-HBY4ZWSP.js +79 -0
  9. package/chunks/chunk-HJA4CX7C.js +24 -0
  10. package/chunks/chunk-NZLE2WMY.js +35 -0
  11. package/chunks/chunk-QWA6OVLC.js +11 -0
  12. package/chunks/chunk-TRCB27ET.js +202 -0
  13. package/core/check/tool-command.js +2305 -0
  14. package/docs/adding-a-discipline-or-mechanism.md +195 -0
  15. package/docs/why-chain-contract.md +78 -0
  16. package/mechanisms/audit/CD-1/any-cast.js +81 -0
  17. package/mechanisms/audit/CD-1/piece.json +13 -0
  18. package/mechanisms/audit/CD-10/piece.json +13 -0
  19. package/mechanisms/audit/CD-10/throws-in-tests.js +49 -0
  20. package/mechanisms/audit/CD-14/class-syntax.js +70 -0
  21. package/mechanisms/audit/CD-14/piece.json +13 -0
  22. package/mechanisms/audit/CD-15/loops.js +40 -0
  23. package/mechanisms/audit/CD-15/piece.json +13 -0
  24. package/mechanisms/audit/CD-17/clock-sources.js +29 -0
  25. package/mechanisms/audit/CD-17/piece.json +13 -0
  26. package/mechanisms/audit/CD-19/import-boundaries.js +80 -0
  27. package/mechanisms/audit/CD-19/piece.json +13 -0
  28. package/mechanisms/audit/CD-2/cast-expressions.js +81 -0
  29. package/mechanisms/audit/CD-2/piece.json +13 -0
  30. package/mechanisms/audit/CD-23/export-test-sibling.js +56 -0
  31. package/mechanisms/audit/CD-23/piece.json +13 -0
  32. package/mechanisms/audit/CD-25/dependency-isolation.js +53 -0
  33. package/mechanisms/audit/CD-25/piece.json +13 -0
  34. package/mechanisms/audit/CD-26/module-mocking.js +51 -0
  35. package/mechanisms/audit/CD-26/piece.json +13 -0
  36. package/mechanisms/audit/CD-27/piece.json +13 -0
  37. package/mechanisms/audit/CD-27/test-body-logic.js +107 -0
  38. package/mechanisms/audit/CD-3/compiler-overrides.js +955 -0
  39. package/mechanisms/audit/CD-3/piece.json +49 -0
  40. package/mechanisms/audit/CD-43/boolean-signatures.js +55 -0
  41. package/mechanisms/audit/CD-43/piece.json +13 -0
  42. package/mechanisms/audit/CD-44/parameter-mutation.js +92 -0
  43. package/mechanisms/audit/CD-44/piece.json +13 -0
  44. package/mechanisms/audit/CD-47/hermetic-git-spawns.js +44 -0
  45. package/mechanisms/audit/CD-47/piece.json +13 -0
  46. package/mechanisms/audit/CD-5/comments-directives.js +73 -0
  47. package/mechanisms/audit/CD-5/piece.json +13 -0
  48. package/mechanisms/audit/CD-6/identifier-names.js +132 -0
  49. package/mechanisms/audit/CD-6/piece.json +13 -0
  50. package/mechanisms/audit/CD-7/categorical-paths.js +55 -0
  51. package/mechanisms/audit/CD-7/piece.json +13 -0
  52. package/mechanisms/audit/CD-7a/factory-return-types.js +42 -0
  53. package/mechanisms/audit/CD-7a/piece.json +13 -0
  54. package/mechanisms/audit/CD-8/piece.json +13 -0
  55. package/mechanisms/audit/CD-8/switch-defaults.js +43 -0
  56. package/mechanisms/audit/runner/README.md +38 -0
  57. package/mechanisms/audit/runner/runner.js +546 -0
  58. package/mechanisms/eslint/CD-1/README.md +12 -0
  59. package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +50 -0
  60. package/mechanisms/eslint/CD-1/piece.json +23 -0
  61. package/mechanisms/eslint/CD-10/README.md +9 -0
  62. package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +55 -0
  63. package/mechanisms/eslint/CD-10/piece.json +15 -0
  64. package/mechanisms/eslint/CD-14/README.md +11 -0
  65. package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +88 -0
  66. package/mechanisms/eslint/CD-14/piece.json +31 -0
  67. package/mechanisms/eslint/CD-27/README.md +12 -0
  68. package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +83 -0
  69. package/mechanisms/eslint/CD-27/piece.json +23 -0
  70. package/mechanisms/eslint/CD-40/README.md +7 -0
  71. package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +16 -0
  72. package/mechanisms/eslint/CD-40/piece.json +21 -0
  73. package/mechanisms/eslint/CD-41/README.md +12 -0
  74. package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +228 -0
  75. package/mechanisms/eslint/CD-41/piece.json +23 -0
  76. package/mechanisms/eslint/CD-42/README.md +9 -0
  77. package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +75 -0
  78. package/mechanisms/eslint/CD-42/piece.json +15 -0
  79. package/mechanisms/eslint/CD-44/README.md +7 -0
  80. package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +16 -0
  81. package/mechanisms/eslint/CD-44/piece.json +20 -0
  82. package/mechanisms/eslint/CD-6/README.md +9 -0
  83. package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +16 -0
  84. package/mechanisms/eslint/CD-6/piece.json +217 -0
  85. package/mechanisms/eslint/CD-7/README.md +9 -0
  86. package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +52 -0
  87. package/mechanisms/eslint/CD-7/piece.json +15 -0
  88. package/mechanisms/eslint/runner/README.md +43 -0
  89. package/mechanisms/eslint/runner/runner.js +4248 -0
  90. package/methods/README.md +18 -0
  91. package/methods/lenses/clean-architecture.md +167 -0
  92. package/methods/lenses/decomposition.md +159 -0
  93. package/methods/lenses/defended-on-intent.md +178 -0
  94. package/methods/lenses/di-discipline.md +156 -0
  95. package/methods/lenses/errors-as-data.md +88 -0
  96. package/methods/lenses/function-first.md +193 -0
  97. package/methods/lenses/naming.md +127 -0
  98. package/methods/lenses/test-discipline.md +166 -0
  99. package/methods/lenses/type-soundness.md +135 -0
  100. package/methods/lenses/zod-boundary.md +158 -0
  101. package/package.json +65 -4
  102. package/rules/CD-1/README.md +43 -0
  103. package/rules/CD-1/discipline.json +185 -0
  104. package/rules/CD-10/README.md +55 -0
  105. package/rules/CD-10/discipline.json +133 -0
  106. package/rules/CD-11/README.md +19 -0
  107. package/rules/CD-11/discipline.json +12 -0
  108. package/rules/CD-12/README.md +19 -0
  109. package/rules/CD-12/discipline.json +12 -0
  110. package/rules/CD-13/README.md +19 -0
  111. package/rules/CD-13/discipline.json +12 -0
  112. package/rules/CD-14/README.md +54 -0
  113. package/rules/CD-14/discipline.json +173 -0
  114. package/rules/CD-15/README.md +48 -0
  115. package/rules/CD-15/discipline.json +73 -0
  116. package/rules/CD-16/README.md +17 -0
  117. package/rules/CD-17/README.md +42 -0
  118. package/rules/CD-17/discipline.json +51 -0
  119. package/rules/CD-18/README.md +19 -0
  120. package/rules/CD-18/discipline.json +12 -0
  121. package/rules/CD-19/README.md +45 -0
  122. package/rules/CD-19/discipline.json +65 -0
  123. package/rules/CD-2/README.md +43 -0
  124. package/rules/CD-2/discipline.json +65 -0
  125. package/rules/CD-20/README.md +17 -0
  126. package/rules/CD-21/README.md +19 -0
  127. package/rules/CD-21/discipline.json +12 -0
  128. package/rules/CD-22/README.md +19 -0
  129. package/rules/CD-22/discipline.json +12 -0
  130. package/rules/CD-23/README.md +41 -0
  131. package/rules/CD-23/discipline.json +57 -0
  132. package/rules/CD-24/README.md +17 -0
  133. package/rules/CD-25/README.md +43 -0
  134. package/rules/CD-25/discipline.json +57 -0
  135. package/rules/CD-26/README.md +42 -0
  136. package/rules/CD-26/discipline.json +57 -0
  137. package/rules/CD-27/README.md +51 -0
  138. package/rules/CD-27/discipline.json +233 -0
  139. package/rules/CD-28/README.md +19 -0
  140. package/rules/CD-28/discipline.json +12 -0
  141. package/rules/CD-29/README.md +19 -0
  142. package/rules/CD-29/discipline.json +12 -0
  143. package/rules/CD-3/README.md +48 -0
  144. package/rules/CD-3/discipline.json +363 -0
  145. package/rules/CD-30/README.md +19 -0
  146. package/rules/CD-30/discipline.json +12 -0
  147. package/rules/CD-31/README.md +19 -0
  148. package/rules/CD-31/discipline.json +12 -0
  149. package/rules/CD-32/README.md +19 -0
  150. package/rules/CD-32/discipline.json +12 -0
  151. package/rules/CD-33/README.md +19 -0
  152. package/rules/CD-33/discipline.json +12 -0
  153. package/rules/CD-34/README.md +19 -0
  154. package/rules/CD-34/discipline.json +12 -0
  155. package/rules/CD-39/README.md +19 -0
  156. package/rules/CD-39/discipline.json +12 -0
  157. package/rules/CD-4/README.md +19 -0
  158. package/rules/CD-4/discipline.json +12 -0
  159. package/rules/CD-40/README.md +45 -0
  160. package/rules/CD-40/discipline.json +58 -0
  161. package/rules/CD-41/README.md +60 -0
  162. package/rules/CD-41/discipline.json +124 -0
  163. package/rules/CD-42/README.md +53 -0
  164. package/rules/CD-42/discipline.json +61 -0
  165. package/rules/CD-43/README.md +43 -0
  166. package/rules/CD-43/discipline.json +65 -0
  167. package/rules/CD-44/README.md +54 -0
  168. package/rules/CD-44/discipline.json +111 -0
  169. package/rules/CD-45/README.md +19 -0
  170. package/rules/CD-45/discipline.json +12 -0
  171. package/rules/CD-46/README.md +13 -0
  172. package/rules/CD-47/README.md +47 -0
  173. package/rules/CD-47/discipline.json +57 -0
  174. package/rules/CD-5/README.md +46 -0
  175. package/rules/CD-5/discipline.json +65 -0
  176. package/rules/CD-6/README.md +57 -0
  177. package/rules/CD-6/discipline.json +165 -0
  178. package/rules/CD-7/README.md +52 -0
  179. package/rules/CD-7/discipline.json +142 -0
  180. package/rules/CD-7a/README.md +44 -0
  181. package/rules/CD-7a/discipline.json +57 -0
  182. package/rules/CD-8/README.md +48 -0
  183. package/rules/CD-8/discipline.json +57 -0
  184. package/rules/CD-9/README.md +19 -0
  185. package/rules/CD-9/discipline.json +12 -0
  186. package/rules/README.md +52 -0
@@ -0,0 +1,955 @@
1
+ import {
2
+ folderScope
3
+ } from "../../../chunks/chunk-QWA6OVLC.js";
4
+ import "../../../chunks/chunk-NZLE2WMY.js";
5
+
6
+ // node_modules/jsonc-parser/lib/esm/impl/scanner.js
7
+ function createScanner(text, ignoreTrivia = false) {
8
+ const len = text.length;
9
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
10
+ function scanHexDigits(count, exact) {
11
+ let digits = 0;
12
+ let value2 = 0;
13
+ while (digits < count || !exact) {
14
+ let ch = text.charCodeAt(pos);
15
+ if (ch >= 48 && ch <= 57) {
16
+ value2 = value2 * 16 + ch - 48;
17
+ } else if (ch >= 65 && ch <= 70) {
18
+ value2 = value2 * 16 + ch - 65 + 10;
19
+ } else if (ch >= 97 && ch <= 102) {
20
+ value2 = value2 * 16 + ch - 97 + 10;
21
+ } else {
22
+ break;
23
+ }
24
+ pos++;
25
+ digits++;
26
+ }
27
+ if (digits < count) {
28
+ value2 = -1;
29
+ }
30
+ return value2;
31
+ }
32
+ function setPosition(newPosition) {
33
+ pos = newPosition;
34
+ value = "";
35
+ tokenOffset = 0;
36
+ token = 16;
37
+ scanError = 0;
38
+ }
39
+ function scanNumber() {
40
+ let start = pos;
41
+ if (text.charCodeAt(pos) === 48) {
42
+ pos++;
43
+ } else {
44
+ pos++;
45
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
46
+ pos++;
47
+ }
48
+ }
49
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
50
+ pos++;
51
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
52
+ pos++;
53
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
54
+ pos++;
55
+ }
56
+ } else {
57
+ scanError = 3;
58
+ return text.substring(start, pos);
59
+ }
60
+ }
61
+ let end = pos;
62
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
63
+ pos++;
64
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
65
+ pos++;
66
+ }
67
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
68
+ pos++;
69
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
70
+ pos++;
71
+ }
72
+ end = pos;
73
+ } else {
74
+ scanError = 3;
75
+ }
76
+ }
77
+ return text.substring(start, end);
78
+ }
79
+ function scanString() {
80
+ let result = "", start = pos;
81
+ while (true) {
82
+ if (pos >= len) {
83
+ result += text.substring(start, pos);
84
+ scanError = 2;
85
+ break;
86
+ }
87
+ const ch = text.charCodeAt(pos);
88
+ if (ch === 34) {
89
+ result += text.substring(start, pos);
90
+ pos++;
91
+ break;
92
+ }
93
+ if (ch === 92) {
94
+ result += text.substring(start, pos);
95
+ pos++;
96
+ if (pos >= len) {
97
+ scanError = 2;
98
+ break;
99
+ }
100
+ const ch2 = text.charCodeAt(pos++);
101
+ switch (ch2) {
102
+ case 34:
103
+ result += '"';
104
+ break;
105
+ case 92:
106
+ result += "\\";
107
+ break;
108
+ case 47:
109
+ result += "/";
110
+ break;
111
+ case 98:
112
+ result += "\b";
113
+ break;
114
+ case 102:
115
+ result += "\f";
116
+ break;
117
+ case 110:
118
+ result += "\n";
119
+ break;
120
+ case 114:
121
+ result += "\r";
122
+ break;
123
+ case 116:
124
+ result += " ";
125
+ break;
126
+ case 117:
127
+ const ch3 = scanHexDigits(4, true);
128
+ if (ch3 >= 0) {
129
+ result += String.fromCharCode(ch3);
130
+ } else {
131
+ scanError = 4;
132
+ }
133
+ break;
134
+ default:
135
+ scanError = 5;
136
+ }
137
+ start = pos;
138
+ continue;
139
+ }
140
+ if (ch >= 0 && ch <= 31) {
141
+ if (isLineBreak(ch)) {
142
+ result += text.substring(start, pos);
143
+ scanError = 2;
144
+ break;
145
+ } else {
146
+ scanError = 6;
147
+ }
148
+ }
149
+ pos++;
150
+ }
151
+ return result;
152
+ }
153
+ function scanNext() {
154
+ value = "";
155
+ scanError = 0;
156
+ tokenOffset = pos;
157
+ lineStartOffset = lineNumber;
158
+ prevTokenLineStartOffset = tokenLineStartOffset;
159
+ if (pos >= len) {
160
+ tokenOffset = len;
161
+ return token = 17;
162
+ }
163
+ let code = text.charCodeAt(pos);
164
+ if (isWhiteSpace(code)) {
165
+ do {
166
+ pos++;
167
+ value += String.fromCharCode(code);
168
+ code = text.charCodeAt(pos);
169
+ } while (isWhiteSpace(code));
170
+ return token = 15;
171
+ }
172
+ if (isLineBreak(code)) {
173
+ pos++;
174
+ value += String.fromCharCode(code);
175
+ if (code === 13 && text.charCodeAt(pos) === 10) {
176
+ pos++;
177
+ value += "\n";
178
+ }
179
+ lineNumber++;
180
+ tokenLineStartOffset = pos;
181
+ return token = 14;
182
+ }
183
+ switch (code) {
184
+ // tokens: []{}:,
185
+ case 123:
186
+ pos++;
187
+ return token = 1;
188
+ case 125:
189
+ pos++;
190
+ return token = 2;
191
+ case 91:
192
+ pos++;
193
+ return token = 3;
194
+ case 93:
195
+ pos++;
196
+ return token = 4;
197
+ case 58:
198
+ pos++;
199
+ return token = 6;
200
+ case 44:
201
+ pos++;
202
+ return token = 5;
203
+ // strings
204
+ case 34:
205
+ pos++;
206
+ value = scanString();
207
+ return token = 10;
208
+ // comments
209
+ case 47:
210
+ const start = pos - 1;
211
+ if (text.charCodeAt(pos + 1) === 47) {
212
+ pos += 2;
213
+ while (pos < len) {
214
+ if (isLineBreak(text.charCodeAt(pos))) {
215
+ break;
216
+ }
217
+ pos++;
218
+ }
219
+ value = text.substring(start, pos);
220
+ return token = 12;
221
+ }
222
+ if (text.charCodeAt(pos + 1) === 42) {
223
+ pos += 2;
224
+ const safeLength = len - 1;
225
+ let commentClosed = false;
226
+ while (pos < safeLength) {
227
+ const ch = text.charCodeAt(pos);
228
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
229
+ pos += 2;
230
+ commentClosed = true;
231
+ break;
232
+ }
233
+ pos++;
234
+ if (isLineBreak(ch)) {
235
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
236
+ pos++;
237
+ }
238
+ lineNumber++;
239
+ tokenLineStartOffset = pos;
240
+ }
241
+ }
242
+ if (!commentClosed) {
243
+ pos++;
244
+ scanError = 1;
245
+ }
246
+ value = text.substring(start, pos);
247
+ return token = 13;
248
+ }
249
+ value += String.fromCharCode(code);
250
+ pos++;
251
+ return token = 16;
252
+ // numbers
253
+ case 45:
254
+ value += String.fromCharCode(code);
255
+ pos++;
256
+ if (pos === len || !isDigit(text.charCodeAt(pos))) {
257
+ return token = 16;
258
+ }
259
+ // found a minus, followed by a number so
260
+ // we fall through to proceed with scanning
261
+ // numbers
262
+ case 48:
263
+ case 49:
264
+ case 50:
265
+ case 51:
266
+ case 52:
267
+ case 53:
268
+ case 54:
269
+ case 55:
270
+ case 56:
271
+ case 57:
272
+ value += scanNumber();
273
+ return token = 11;
274
+ // literals and unknown symbols
275
+ default:
276
+ while (pos < len && isUnknownContentCharacter(code)) {
277
+ pos++;
278
+ code = text.charCodeAt(pos);
279
+ }
280
+ if (tokenOffset !== pos) {
281
+ value = text.substring(tokenOffset, pos);
282
+ switch (value) {
283
+ case "true":
284
+ return token = 8;
285
+ case "false":
286
+ return token = 9;
287
+ case "null":
288
+ return token = 7;
289
+ }
290
+ return token = 16;
291
+ }
292
+ value += String.fromCharCode(code);
293
+ pos++;
294
+ return token = 16;
295
+ }
296
+ }
297
+ function isUnknownContentCharacter(code) {
298
+ if (isWhiteSpace(code) || isLineBreak(code)) {
299
+ return false;
300
+ }
301
+ switch (code) {
302
+ case 125:
303
+ case 93:
304
+ case 123:
305
+ case 91:
306
+ case 34:
307
+ case 58:
308
+ case 44:
309
+ case 47:
310
+ return false;
311
+ }
312
+ return true;
313
+ }
314
+ function scanNextNonTrivia() {
315
+ let result;
316
+ do {
317
+ result = scanNext();
318
+ } while (result >= 12 && result <= 15);
319
+ return result;
320
+ }
321
+ return {
322
+ setPosition,
323
+ getPosition: () => pos,
324
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
325
+ getToken: () => token,
326
+ getTokenValue: () => value,
327
+ getTokenOffset: () => tokenOffset,
328
+ getTokenLength: () => pos - tokenOffset,
329
+ getTokenStartLine: () => lineStartOffset,
330
+ getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
331
+ getTokenError: () => scanError
332
+ };
333
+ }
334
+ function isWhiteSpace(ch) {
335
+ return ch === 32 || ch === 9;
336
+ }
337
+ function isLineBreak(ch) {
338
+ return ch === 10 || ch === 13;
339
+ }
340
+ function isDigit(ch) {
341
+ return ch >= 48 && ch <= 57;
342
+ }
343
+ var CharacterCodes;
344
+ (function(CharacterCodes2) {
345
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
346
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
347
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
348
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
349
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
350
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
351
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
352
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
353
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
354
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
355
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
356
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
357
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
358
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
359
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
360
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
361
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
362
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
363
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
364
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
365
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
366
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
367
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
368
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
369
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
370
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
371
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
372
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
373
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
374
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
375
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
376
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
377
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
378
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
379
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
380
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
381
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
382
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
383
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
384
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
385
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
386
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
387
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
388
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
389
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
390
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
391
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
392
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
393
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
394
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
395
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
396
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
397
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
398
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
399
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
400
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
401
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
402
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
403
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
404
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
405
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
406
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
407
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
408
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
409
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
410
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
411
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
412
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
413
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
414
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
415
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
416
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
417
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
418
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
419
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
420
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
421
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
422
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
423
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
424
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
425
+ })(CharacterCodes || (CharacterCodes = {}));
426
+
427
+ // node_modules/jsonc-parser/lib/esm/impl/string-intern.js
428
+ var cachedSpaces = new Array(20).fill(0).map((_, index) => {
429
+ return " ".repeat(index);
430
+ });
431
+ var maxCachedValues = 200;
432
+ var cachedBreakLinesWithSpaces = {
433
+ " ": {
434
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
435
+ return "\n" + " ".repeat(index);
436
+ }),
437
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
438
+ return "\r" + " ".repeat(index);
439
+ }),
440
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
441
+ return "\r\n" + " ".repeat(index);
442
+ })
443
+ },
444
+ " ": {
445
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
446
+ return "\n" + " ".repeat(index);
447
+ }),
448
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
449
+ return "\r" + " ".repeat(index);
450
+ }),
451
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
452
+ return "\r\n" + " ".repeat(index);
453
+ })
454
+ }
455
+ };
456
+
457
+ // node_modules/jsonc-parser/lib/esm/impl/parser.js
458
+ var ParseOptions;
459
+ (function(ParseOptions2) {
460
+ ParseOptions2.DEFAULT = {
461
+ allowTrailingComma: false
462
+ };
463
+ })(ParseOptions || (ParseOptions = {}));
464
+ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
465
+ let currentProperty = null;
466
+ let currentParent = [];
467
+ const previousParents = [];
468
+ function onValue(value) {
469
+ if (Array.isArray(currentParent)) {
470
+ currentParent.push(value);
471
+ } else if (currentProperty !== null) {
472
+ currentParent[currentProperty] = value;
473
+ }
474
+ }
475
+ const visitor = {
476
+ onObjectBegin: () => {
477
+ const object = {};
478
+ onValue(object);
479
+ previousParents.push(currentParent);
480
+ currentParent = object;
481
+ currentProperty = null;
482
+ },
483
+ onObjectProperty: (name) => {
484
+ currentProperty = name;
485
+ },
486
+ onObjectEnd: () => {
487
+ currentParent = previousParents.pop();
488
+ },
489
+ onArrayBegin: () => {
490
+ const array = [];
491
+ onValue(array);
492
+ previousParents.push(currentParent);
493
+ currentParent = array;
494
+ currentProperty = null;
495
+ },
496
+ onArrayEnd: () => {
497
+ currentParent = previousParents.pop();
498
+ },
499
+ onLiteralValue: onValue,
500
+ onError: (error, offset, length) => {
501
+ errors.push({ error, offset, length });
502
+ }
503
+ };
504
+ visit(text, visitor, options);
505
+ return currentParent[0];
506
+ }
507
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
508
+ const _scanner = createScanner(text, false);
509
+ const _jsonPath = [];
510
+ let suppressedCallbacks = 0;
511
+ function toNoArgVisit(visitFunction) {
512
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
513
+ }
514
+ function toOneArgVisit(visitFunction) {
515
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
516
+ }
517
+ function toOneArgVisitWithPath(visitFunction) {
518
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
519
+ }
520
+ function toBeginVisit(visitFunction) {
521
+ return visitFunction ? () => {
522
+ if (suppressedCallbacks > 0) {
523
+ suppressedCallbacks++;
524
+ } else {
525
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
526
+ if (cbReturn === false) {
527
+ suppressedCallbacks = 1;
528
+ }
529
+ }
530
+ } : () => true;
531
+ }
532
+ function toEndVisit(visitFunction) {
533
+ return visitFunction ? () => {
534
+ if (suppressedCallbacks > 0) {
535
+ suppressedCallbacks--;
536
+ }
537
+ if (suppressedCallbacks === 0) {
538
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
539
+ }
540
+ } : () => true;
541
+ }
542
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
543
+ const disallowComments = options && options.disallowComments;
544
+ const allowTrailingComma = options && options.allowTrailingComma;
545
+ function scanNext() {
546
+ while (true) {
547
+ const token = _scanner.scan();
548
+ switch (_scanner.getTokenError()) {
549
+ case 4:
550
+ handleError(
551
+ 14
552
+ /* ParseErrorCode.InvalidUnicode */
553
+ );
554
+ break;
555
+ case 5:
556
+ handleError(
557
+ 15
558
+ /* ParseErrorCode.InvalidEscapeCharacter */
559
+ );
560
+ break;
561
+ case 3:
562
+ handleError(
563
+ 13
564
+ /* ParseErrorCode.UnexpectedEndOfNumber */
565
+ );
566
+ break;
567
+ case 1:
568
+ if (!disallowComments) {
569
+ handleError(
570
+ 11
571
+ /* ParseErrorCode.UnexpectedEndOfComment */
572
+ );
573
+ }
574
+ break;
575
+ case 2:
576
+ handleError(
577
+ 12
578
+ /* ParseErrorCode.UnexpectedEndOfString */
579
+ );
580
+ break;
581
+ case 6:
582
+ handleError(
583
+ 16
584
+ /* ParseErrorCode.InvalidCharacter */
585
+ );
586
+ break;
587
+ }
588
+ switch (token) {
589
+ case 12:
590
+ case 13:
591
+ if (disallowComments) {
592
+ handleError(
593
+ 10
594
+ /* ParseErrorCode.InvalidCommentToken */
595
+ );
596
+ } else {
597
+ onComment();
598
+ }
599
+ break;
600
+ case 16:
601
+ handleError(
602
+ 1
603
+ /* ParseErrorCode.InvalidSymbol */
604
+ );
605
+ break;
606
+ case 15:
607
+ case 14:
608
+ break;
609
+ default:
610
+ return token;
611
+ }
612
+ }
613
+ }
614
+ function handleError(error, skipUntilAfter = [], skipUntil = []) {
615
+ onError(error);
616
+ if (skipUntilAfter.length + skipUntil.length > 0) {
617
+ let token = _scanner.getToken();
618
+ while (token !== 17) {
619
+ if (skipUntilAfter.indexOf(token) !== -1) {
620
+ scanNext();
621
+ break;
622
+ } else if (skipUntil.indexOf(token) !== -1) {
623
+ break;
624
+ }
625
+ token = scanNext();
626
+ }
627
+ }
628
+ }
629
+ function parseString(isValue) {
630
+ const value = _scanner.getTokenValue();
631
+ if (isValue) {
632
+ onLiteralValue(value);
633
+ } else {
634
+ onObjectProperty(value);
635
+ _jsonPath.push(value);
636
+ }
637
+ scanNext();
638
+ return true;
639
+ }
640
+ function parseLiteral() {
641
+ switch (_scanner.getToken()) {
642
+ case 11:
643
+ const tokenValue = _scanner.getTokenValue();
644
+ let value = Number(tokenValue);
645
+ if (isNaN(value)) {
646
+ handleError(
647
+ 2
648
+ /* ParseErrorCode.InvalidNumberFormat */
649
+ );
650
+ value = 0;
651
+ }
652
+ onLiteralValue(value);
653
+ break;
654
+ case 7:
655
+ onLiteralValue(null);
656
+ break;
657
+ case 8:
658
+ onLiteralValue(true);
659
+ break;
660
+ case 9:
661
+ onLiteralValue(false);
662
+ break;
663
+ default:
664
+ return false;
665
+ }
666
+ scanNext();
667
+ return true;
668
+ }
669
+ function parseProperty() {
670
+ if (_scanner.getToken() !== 10) {
671
+ handleError(3, [], [
672
+ 2,
673
+ 5
674
+ /* SyntaxKind.CommaToken */
675
+ ]);
676
+ return false;
677
+ }
678
+ parseString(false);
679
+ if (_scanner.getToken() === 6) {
680
+ onSeparator(":");
681
+ scanNext();
682
+ if (!parseValue()) {
683
+ handleError(4, [], [
684
+ 2,
685
+ 5
686
+ /* SyntaxKind.CommaToken */
687
+ ]);
688
+ }
689
+ } else {
690
+ handleError(5, [], [
691
+ 2,
692
+ 5
693
+ /* SyntaxKind.CommaToken */
694
+ ]);
695
+ }
696
+ _jsonPath.pop();
697
+ return true;
698
+ }
699
+ function parseObject() {
700
+ onObjectBegin();
701
+ scanNext();
702
+ let needsComma = false;
703
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
704
+ if (_scanner.getToken() === 5) {
705
+ if (!needsComma) {
706
+ handleError(4, [], []);
707
+ }
708
+ onSeparator(",");
709
+ scanNext();
710
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
711
+ break;
712
+ }
713
+ } else if (needsComma) {
714
+ handleError(6, [], []);
715
+ }
716
+ if (!parseProperty()) {
717
+ handleError(4, [], [
718
+ 2,
719
+ 5
720
+ /* SyntaxKind.CommaToken */
721
+ ]);
722
+ }
723
+ needsComma = true;
724
+ }
725
+ onObjectEnd();
726
+ if (_scanner.getToken() !== 2) {
727
+ handleError(7, [
728
+ 2
729
+ /* SyntaxKind.CloseBraceToken */
730
+ ], []);
731
+ } else {
732
+ scanNext();
733
+ }
734
+ return true;
735
+ }
736
+ function parseArray() {
737
+ onArrayBegin();
738
+ scanNext();
739
+ let isFirstElement = true;
740
+ let needsComma = false;
741
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
742
+ if (_scanner.getToken() === 5) {
743
+ if (!needsComma) {
744
+ handleError(4, [], []);
745
+ }
746
+ onSeparator(",");
747
+ scanNext();
748
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
749
+ break;
750
+ }
751
+ } else if (needsComma) {
752
+ handleError(6, [], []);
753
+ }
754
+ if (isFirstElement) {
755
+ _jsonPath.push(0);
756
+ isFirstElement = false;
757
+ } else {
758
+ _jsonPath[_jsonPath.length - 1]++;
759
+ }
760
+ if (!parseValue()) {
761
+ handleError(4, [], [
762
+ 4,
763
+ 5
764
+ /* SyntaxKind.CommaToken */
765
+ ]);
766
+ }
767
+ needsComma = true;
768
+ }
769
+ onArrayEnd();
770
+ if (!isFirstElement) {
771
+ _jsonPath.pop();
772
+ }
773
+ if (_scanner.getToken() !== 4) {
774
+ handleError(8, [
775
+ 4
776
+ /* SyntaxKind.CloseBracketToken */
777
+ ], []);
778
+ } else {
779
+ scanNext();
780
+ }
781
+ return true;
782
+ }
783
+ function parseValue() {
784
+ switch (_scanner.getToken()) {
785
+ case 3:
786
+ return parseArray();
787
+ case 1:
788
+ return parseObject();
789
+ case 10:
790
+ return parseString(true);
791
+ default:
792
+ return parseLiteral();
793
+ }
794
+ }
795
+ scanNext();
796
+ if (_scanner.getToken() === 17) {
797
+ if (options.allowEmptyContent) {
798
+ return true;
799
+ }
800
+ handleError(4, [], []);
801
+ return false;
802
+ }
803
+ if (!parseValue()) {
804
+ handleError(4, [], []);
805
+ return false;
806
+ }
807
+ if (_scanner.getToken() !== 17) {
808
+ handleError(9, [], []);
809
+ }
810
+ return true;
811
+ }
812
+
813
+ // node_modules/jsonc-parser/lib/esm/main.js
814
+ var ScanError;
815
+ (function(ScanError2) {
816
+ ScanError2[ScanError2["None"] = 0] = "None";
817
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
818
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
819
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
820
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
821
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
822
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
823
+ })(ScanError || (ScanError = {}));
824
+ var SyntaxKind;
825
+ (function(SyntaxKind2) {
826
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
827
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
828
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
829
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
830
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
831
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
832
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
833
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
834
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
835
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
836
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
837
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
838
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
839
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
840
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
841
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
842
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
843
+ })(SyntaxKind || (SyntaxKind = {}));
844
+ var parse2 = parse;
845
+ var ParseErrorCode;
846
+ (function(ParseErrorCode2) {
847
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
848
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
849
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
850
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
851
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
852
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
853
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
854
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
855
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
856
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
857
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
858
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
859
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
860
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
861
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
862
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
863
+ })(ParseErrorCode || (ParseErrorCode = {}));
864
+
865
+ // mechanisms/audit/runner/jsonc-parse.ts
866
+ var createJsoncParsePort = (options) => ({
867
+ parse: (request) => {
868
+ try {
869
+ const providerParse = options.parseProvider({ source: request.source });
870
+ const firstDiagnostic = providerParse.errors[0];
871
+ if (firstDiagnostic !== void 0) {
872
+ return {
873
+ outcome: "failed",
874
+ error: {
875
+ detail: `JSONC parse error ${firstDiagnostic.error} at offset ${firstDiagnostic.offset} (length ${firstDiagnostic.length})`
876
+ }
877
+ };
878
+ }
879
+ return { outcome: "ok", value: providerParse.value };
880
+ } catch (thrown) {
881
+ return {
882
+ outcome: "failed",
883
+ error: { detail: thrown instanceof Error ? thrown.message : String(thrown) }
884
+ };
885
+ }
886
+ }
887
+ });
888
+ var defaultProviderCallOf = (options) => (request) => {
889
+ const errors = [];
890
+ const parsedValue = parse2(request.source, errors, { allowTrailingComma: options.trailingCommas === "allowed" });
891
+ return { value: parsedValue, errors };
892
+ };
893
+ var createDefaultJsoncParsePort = (options) => createJsoncParsePort({
894
+ parseProvider: defaultProviderCallOf(options)
895
+ });
896
+
897
+ // mechanisms/audit/CD-3/compiler-overrides.ts
898
+ var configEligibility = (request) => {
899
+ if (request.file.split("/").at(-1) !== "tsconfig.json") return "excluded";
900
+ if (folderScope({ file: request.file }) === "generated") return "excluded";
901
+ return "eligible";
902
+ };
903
+ var STRICT_FLAGS = [
904
+ { clause: "strict", option: "strict" },
905
+ { clause: "no-unchecked-indexed-access", option: "noUncheckedIndexedAccess" },
906
+ { clause: "exact-optional-property-types", option: "exactOptionalPropertyTypes" },
907
+ { clause: "no-implicit-override", option: "noImplicitOverride" },
908
+ { clause: "no-fallthrough-cases-in-switch", option: "noFallthroughCasesInSwitch" },
909
+ { clause: "no-property-access-from-index-signature", option: "noPropertyAccessFromIndexSignature" },
910
+ { clause: "use-unknown-in-catch-variables", option: "useUnknownInCatchVariables" }
911
+ ];
912
+ var createCompilerOverridesCheck = (options) => ({
913
+ prepare: ({ clauses }) => {
914
+ const selectedFlags = STRICT_FLAGS.flatMap((flag) => clauses.filter((clause) => clause.address.discipline === "CD-3" && clause.address.clause === flag.clause).map((clause) => ({ address: clause.address, option: flag.option })));
915
+ return {
916
+ outcome: "ok",
917
+ value: {
918
+ prepareFile: ({ file, readText }) => {
919
+ if (configEligibility({ file }) === "excluded") return { outcome: "ok", value: { kind: "skipped" } };
920
+ const text = readText();
921
+ if (text.outcome === "failed") return text;
922
+ const parsed = options.jsonc.parse({ source: text.value });
923
+ if (parsed.outcome === "failed") {
924
+ return { outcome: "failed", error: { kind: "file-unparseable", file, detail: parsed.error.detail } };
925
+ }
926
+ const config = parsed.value;
927
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
928
+ return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "configuration root must be an object" } };
929
+ }
930
+ if (!("compilerOptions" in config)) return { outcome: "ok", value: { kind: "complete", hits: [] } };
931
+ const compilerOptions = config.compilerOptions;
932
+ if (typeof compilerOptions !== "object" || compilerOptions === null || Array.isArray(compilerOptions)) {
933
+ return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "compilerOptions must be an object" } };
934
+ }
935
+ const entries = Object.entries(compilerOptions);
936
+ const hits = selectedFlags.flatMap((flag) => {
937
+ const entry = entries.find(([key]) => key === flag.option);
938
+ return entry === void 0 ? [] : [{
939
+ clause: flag.address,
940
+ anchor: { line: 1, column: 0 },
941
+ snippet: `compilerOptions.${flag.option} = ${JSON.stringify(entry[1])}`
942
+ }];
943
+ });
944
+ return { outcome: "ok", value: { kind: "complete", hits } };
945
+ },
946
+ finish: () => ({ outcome: "ok", value: [] })
947
+ }
948
+ };
949
+ }
950
+ });
951
+ var check = createCompilerOverridesCheck({ jsonc: createDefaultJsoncParsePort({ trailingCommas: "refused" }) });
952
+ export {
953
+ check,
954
+ createCompilerOverridesCheck
955
+ };