@atlaspack/validator-typescript 2.14.5-canary.48 → 2.14.5-canary.481

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,550 @@
1
1
  # @atlaspack/validator-typescript
2
2
 
3
+ ## 2.14.63
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@3.4.5
9
+ - @atlaspack/plugin@2.14.63
10
+ - @atlaspack/types@2.15.53
11
+ - @atlaspack/ts-utils@2.14.42
12
+
13
+ ## 2.14.62
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies []:
18
+ - @atlaspack/utils@3.4.4
19
+ - @atlaspack/plugin@2.14.62
20
+ - @atlaspack/types@2.15.52
21
+ - @atlaspack/ts-utils@2.14.41
22
+
23
+ ## 2.14.61
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [[`e898fda`](https://github.com/atlassian-labs/atlaspack/commit/e898fda7511d98e5597d847c4a32c028a8a24d6c)]:
28
+ - @atlaspack/utils@3.4.3
29
+ - @atlaspack/types@2.15.51
30
+ - @atlaspack/plugin@2.14.61
31
+ - @atlaspack/ts-utils@2.14.40
32
+
33
+ ## 2.14.60
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies []:
38
+ - @atlaspack/utils@3.4.2
39
+ - @atlaspack/types@2.15.50
40
+ - @atlaspack/plugin@2.14.60
41
+ - @atlaspack/ts-utils@2.14.39
42
+
43
+ ## 2.14.59
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies []:
48
+ - @atlaspack/utils@3.4.1
49
+ - @atlaspack/types@2.15.49
50
+ - @atlaspack/plugin@2.14.59
51
+ - @atlaspack/ts-utils@2.14.38
52
+
53
+ ## 2.14.58
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [[`71981ea`](https://github.com/atlassian-labs/atlaspack/commit/71981eac258f7e6dfb40ec4b202d194f71c64ff1)]:
58
+ - @atlaspack/utils@3.4.0
59
+ - @atlaspack/plugin@2.14.58
60
+ - @atlaspack/types@2.15.48
61
+ - @atlaspack/ts-utils@2.14.37
62
+
63
+ ## 2.14.57
64
+
65
+ ### Patch Changes
66
+
67
+ - Updated dependencies []:
68
+ - @atlaspack/utils@3.3.9
69
+ - @atlaspack/plugin@2.14.57
70
+ - @atlaspack/types@2.15.47
71
+ - @atlaspack/ts-utils@2.14.36
72
+
73
+ ## 2.14.56
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies []:
78
+ - @atlaspack/utils@3.3.8
79
+ - @atlaspack/plugin@2.14.56
80
+ - @atlaspack/types@2.15.46
81
+ - @atlaspack/ts-utils@2.14.35
82
+
83
+ ## 2.14.55
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies []:
88
+ - @atlaspack/utils@3.3.7
89
+ - @atlaspack/plugin@2.14.55
90
+ - @atlaspack/types@2.15.45
91
+ - @atlaspack/ts-utils@2.14.34
92
+
93
+ ## 2.14.54
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [[`d8e984b`](https://github.com/atlassian-labs/atlaspack/commit/d8e984b7f6d04fa03707fa299bfd8b8bf9f58280)]:
98
+ - @atlaspack/utils@3.3.6
99
+ - @atlaspack/plugin@2.14.54
100
+ - @atlaspack/types@2.15.44
101
+ - @atlaspack/ts-utils@2.14.33
102
+
103
+ ## 2.14.53
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies []:
108
+ - @atlaspack/utils@3.3.5
109
+ - @atlaspack/plugin@2.14.53
110
+ - @atlaspack/types@2.15.43
111
+ - @atlaspack/ts-utils@2.14.32
112
+
113
+ ## 2.14.52
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies []:
118
+ - @atlaspack/plugin@2.14.52
119
+ - @atlaspack/types@2.15.42
120
+ - @atlaspack/utils@3.3.4
121
+ - @atlaspack/ts-utils@2.14.31
122
+
123
+ ## 2.14.51
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies []:
128
+ - @atlaspack/utils@3.3.3
129
+ - @atlaspack/types@2.15.41
130
+ - @atlaspack/plugin@2.14.51
131
+ - @atlaspack/ts-utils@2.14.30
132
+
133
+ ## 2.14.50
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies []:
138
+ - @atlaspack/utils@3.3.2
139
+ - @atlaspack/plugin@2.14.50
140
+ - @atlaspack/types@2.15.40
141
+ - @atlaspack/ts-utils@2.14.29
142
+
143
+ ## 2.14.49
144
+
145
+ ### Patch Changes
146
+
147
+ - Updated dependencies []:
148
+ - @atlaspack/utils@3.3.1
149
+ - @atlaspack/plugin@2.14.49
150
+ - @atlaspack/types@2.15.39
151
+ - @atlaspack/ts-utils@2.14.28
152
+
153
+ ## 2.14.48
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [[`47aa84e`](https://github.com/atlassian-labs/atlaspack/commit/47aa84e44c61066072a5bf3d57678565b9d2c5a3)]:
158
+ - @atlaspack/utils@3.3.0
159
+ - @atlaspack/types@2.15.38
160
+ - @atlaspack/plugin@2.14.48
161
+ - @atlaspack/ts-utils@2.14.27
162
+
163
+ ## 2.14.47
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies []:
168
+ - @atlaspack/utils@3.2.8
169
+ - @atlaspack/types@2.15.37
170
+ - @atlaspack/plugin@2.14.47
171
+ - @atlaspack/ts-utils@2.14.26
172
+
173
+ ## 2.14.46
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies []:
178
+ - @atlaspack/utils@3.2.7
179
+ - @atlaspack/plugin@2.14.46
180
+ - @atlaspack/types@2.15.36
181
+ - @atlaspack/ts-utils@2.14.25
182
+
183
+ ## 2.14.45
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies []:
188
+ - @atlaspack/utils@3.2.6
189
+ - @atlaspack/plugin@2.14.45
190
+ - @atlaspack/types@2.15.35
191
+ - @atlaspack/ts-utils@2.14.24
192
+
193
+ ## 2.14.44
194
+
195
+ ### Patch Changes
196
+
197
+ - Updated dependencies []:
198
+ - @atlaspack/utils@3.2.5
199
+ - @atlaspack/plugin@2.14.44
200
+ - @atlaspack/types@2.15.34
201
+ - @atlaspack/ts-utils@2.14.23
202
+
203
+ ## 2.14.43
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies []:
208
+ - @atlaspack/plugin@2.14.43
209
+ - @atlaspack/types@2.15.33
210
+ - @atlaspack/utils@3.2.4
211
+ - @atlaspack/ts-utils@2.14.22
212
+
213
+ ## 2.14.42
214
+
215
+ ### Patch Changes
216
+
217
+ - Updated dependencies []:
218
+ - @atlaspack/utils@3.2.3
219
+ - @atlaspack/plugin@2.14.42
220
+ - @atlaspack/types@2.15.32
221
+ - @atlaspack/ts-utils@2.14.21
222
+
223
+ ## 2.14.41
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies []:
228
+ - @atlaspack/utils@3.2.2
229
+ - @atlaspack/plugin@2.14.41
230
+ - @atlaspack/types@2.15.31
231
+ - @atlaspack/ts-utils@2.14.20
232
+
233
+ ## 2.14.40
234
+
235
+ ### Patch Changes
236
+
237
+ - Updated dependencies []:
238
+ - @atlaspack/utils@3.2.1
239
+ - @atlaspack/plugin@2.14.40
240
+ - @atlaspack/types@2.15.30
241
+ - @atlaspack/ts-utils@2.14.19
242
+
243
+ ## 2.14.39
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [[`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13)]:
248
+ - @atlaspack/utils@3.2.0
249
+ - @atlaspack/plugin@2.14.39
250
+ - @atlaspack/types@2.15.29
251
+ - @atlaspack/ts-utils@2.14.18
252
+
253
+ ## 2.14.38
254
+
255
+ ### Patch Changes
256
+
257
+ - Updated dependencies [[`7d7a55d`](https://github.com/atlassian-labs/atlaspack/commit/7d7a55dd6395ec391a2e4c33b3dec0d1ea477d4c)]:
258
+ - @atlaspack/utils@3.1.2
259
+ - @atlaspack/plugin@2.14.38
260
+ - @atlaspack/types@2.15.28
261
+ - @atlaspack/ts-utils@2.14.17
262
+
263
+ ## 2.14.37
264
+
265
+ ### Patch Changes
266
+
267
+ - Updated dependencies []:
268
+ - @atlaspack/utils@3.1.1
269
+ - @atlaspack/plugin@2.14.37
270
+ - @atlaspack/types@2.15.27
271
+ - @atlaspack/ts-utils@2.14.16
272
+
273
+ ## 2.14.36
274
+
275
+ ### Patch Changes
276
+
277
+ - Updated dependencies [[`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a)]:
278
+ - @atlaspack/utils@3.1.0
279
+ - @atlaspack/plugin@2.14.36
280
+ - @atlaspack/types@2.15.26
281
+ - @atlaspack/ts-utils@2.14.15
282
+
283
+ ## 2.14.35
284
+
285
+ ### Patch Changes
286
+
287
+ - Updated dependencies [[`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10)]:
288
+ - @atlaspack/utils@3.0.3
289
+ - @atlaspack/plugin@2.14.35
290
+ - @atlaspack/types@2.15.25
291
+ - @atlaspack/ts-utils@2.14.14
292
+
293
+ ## 2.14.34
294
+
295
+ ### Patch Changes
296
+
297
+ - Updated dependencies []:
298
+ - @atlaspack/types@2.15.24
299
+ - @atlaspack/utils@3.0.2
300
+ - @atlaspack/plugin@2.14.34
301
+ - @atlaspack/ts-utils@2.14.13
302
+
303
+ ## 2.14.33
304
+
305
+ ### Patch Changes
306
+
307
+ - Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e)]:
308
+ - @atlaspack/utils@3.0.1
309
+ - @atlaspack/types@2.15.23
310
+ - @atlaspack/plugin@2.14.33
311
+ - @atlaspack/ts-utils@2.14.12
312
+
313
+ ## 2.14.32
314
+
315
+ ### Patch Changes
316
+
317
+ - Updated dependencies [[`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933)]:
318
+ - @atlaspack/utils@3.0.0
319
+ - @atlaspack/plugin@2.14.32
320
+ - @atlaspack/types@2.15.22
321
+ - @atlaspack/ts-utils@2.14.11
322
+
323
+ ## 2.14.31
324
+
325
+ ### Patch Changes
326
+
327
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
328
+
329
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
330
+ - @atlaspack/diagnostic@2.14.4
331
+ - @atlaspack/plugin@2.14.31
332
+ - @atlaspack/types@2.15.21
333
+ - @atlaspack/utils@2.19.3
334
+ - @atlaspack/ts-utils@2.14.10
335
+
336
+ ## 2.14.30
337
+
338
+ ### Patch Changes
339
+
340
+ - Updated dependencies []:
341
+ - @atlaspack/utils@2.19.2
342
+ - @atlaspack/plugin@2.14.30
343
+ - @atlaspack/types@2.15.20
344
+ - @atlaspack/ts-utils@2.14.9
345
+
346
+ ## 2.14.29
347
+
348
+ ### Patch Changes
349
+
350
+ - Updated dependencies []:
351
+ - @atlaspack/utils@2.19.1
352
+ - @atlaspack/plugin@2.14.29
353
+ - @atlaspack/types@2.15.19
354
+ - @atlaspack/ts-utils@2.14.8
355
+
356
+ ## 2.14.28
357
+
358
+ ### Patch Changes
359
+
360
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
361
+ - @atlaspack/utils@2.19.0
362
+ - @atlaspack/plugin@2.14.28
363
+ - @atlaspack/types@2.15.18
364
+ - @atlaspack/ts-utils@2.14.7
365
+
366
+ ## 2.14.27
367
+
368
+ ### Patch Changes
369
+
370
+ - Updated dependencies []:
371
+ - @atlaspack/utils@2.18.4
372
+ - @atlaspack/plugin@2.14.27
373
+ - @atlaspack/types@2.15.17
374
+ - @atlaspack/ts-utils@2.14.6
375
+
376
+ ## 2.14.26
377
+
378
+ ### Patch Changes
379
+
380
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
381
+
382
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
383
+ - @atlaspack/diagnostic@2.14.3
384
+ - @atlaspack/ts-utils@2.14.5
385
+ - @atlaspack/plugin@2.14.26
386
+ - @atlaspack/types@2.15.16
387
+ - @atlaspack/utils@2.18.3
388
+
389
+ ## 2.14.25
390
+
391
+ ### Patch Changes
392
+
393
+ - Updated dependencies []:
394
+ - @atlaspack/utils@2.18.2
395
+ - @atlaspack/plugin@2.14.25
396
+ - @atlaspack/types@2.15.15
397
+ - @atlaspack/ts-utils@2.14.4
398
+
399
+ ## 2.14.24
400
+
401
+ ### Patch Changes
402
+
403
+ - Updated dependencies []:
404
+ - @atlaspack/utils@2.18.1
405
+ - @atlaspack/plugin@2.14.24
406
+ - @atlaspack/types@2.15.14
407
+ - @atlaspack/ts-utils@2.14.3
408
+
409
+ ## 2.14.23
410
+
411
+ ### Patch Changes
412
+
413
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
414
+ - @atlaspack/utils@2.18.0
415
+ - @atlaspack/types@2.15.13
416
+ - @atlaspack/plugin@2.14.23
417
+
418
+ ## 2.14.22
419
+
420
+ ### Patch Changes
421
+
422
+ - [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
423
+
424
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
425
+ - @atlaspack/diagnostic@2.14.2
426
+ - @atlaspack/ts-utils@2.14.2
427
+ - @atlaspack/plugin@2.14.22
428
+ - @atlaspack/types@2.15.12
429
+ - @atlaspack/utils@2.17.4
430
+
431
+ ## 2.14.21
432
+
433
+ ### Patch Changes
434
+
435
+ - Updated dependencies []:
436
+ - @atlaspack/types@2.15.11
437
+ - @atlaspack/utils@2.17.3
438
+ - @atlaspack/plugin@2.14.21
439
+
440
+ ## 2.14.20
441
+
442
+ ### Patch Changes
443
+
444
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
445
+ - @atlaspack/plugin@2.14.20
446
+ - @atlaspack/utils@2.17.2
447
+ - @atlaspack/types@2.15.10
448
+
449
+ ## 2.14.19
450
+
451
+ ### Patch Changes
452
+
453
+ - Updated dependencies []:
454
+ - @atlaspack/utils@2.17.1
455
+ - @atlaspack/types@2.15.9
456
+ - @atlaspack/plugin@2.14.19
457
+
458
+ ## 2.14.18
459
+
460
+ ### Patch Changes
461
+
462
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
463
+ - @atlaspack/utils@2.17.0
464
+ - @atlaspack/types@2.15.8
465
+ - @atlaspack/plugin@2.14.18
466
+
467
+ ## 2.14.17
468
+
469
+ ### Patch Changes
470
+
471
+ - Updated dependencies []:
472
+ - @atlaspack/utils@2.16.1
473
+ - @atlaspack/types@2.15.7
474
+ - @atlaspack/plugin@2.14.17
475
+
476
+ ## 2.14.16
477
+
478
+ ### Patch Changes
479
+
480
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
481
+ - @atlaspack/utils@2.16.0
482
+ - @atlaspack/types@2.15.6
483
+ - @atlaspack/plugin@2.14.16
484
+
485
+ ## 2.14.15
486
+
487
+ ### Patch Changes
488
+
489
+ - Updated dependencies []:
490
+ - @atlaspack/utils@2.15.3
491
+ - @atlaspack/types@2.15.5
492
+ - @atlaspack/plugin@2.14.15
493
+
494
+ ## 2.14.14
495
+
496
+ ### Patch Changes
497
+
498
+ - Updated dependencies []:
499
+ - @atlaspack/utils@2.15.2
500
+ - @atlaspack/types@2.15.4
501
+ - @atlaspack/plugin@2.14.14
502
+
503
+ ## 2.14.13
504
+
505
+ ### Patch Changes
506
+
507
+ - Updated dependencies []:
508
+ - @atlaspack/types@2.15.3
509
+ - @atlaspack/utils@2.15.1
510
+ - @atlaspack/plugin@2.14.13
511
+
512
+ ## 2.14.12
513
+
514
+ ### Patch Changes
515
+
516
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
517
+ - @atlaspack/utils@2.15.0
518
+ - @atlaspack/types@2.15.2
519
+ - @atlaspack/plugin@2.14.12
520
+
521
+ ## 2.14.11
522
+
523
+ ### Patch Changes
524
+
525
+ - Updated dependencies []:
526
+ - @atlaspack/utils@2.14.11
527
+ - @atlaspack/types@2.15.1
528
+ - @atlaspack/plugin@2.14.11
529
+
530
+ ## 2.14.10
531
+
532
+ ### Patch Changes
533
+
534
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
535
+ - @atlaspack/types@2.15.0
536
+ - @atlaspack/plugin@2.14.10
537
+ - @atlaspack/utils@2.14.10
538
+
539
+ ## 2.14.9
540
+
541
+ ### Patch Changes
542
+
543
+ - Updated dependencies []:
544
+ - @atlaspack/utils@2.14.9
545
+ - @atlaspack/types@2.14.9
546
+ - @atlaspack/plugin@2.14.9
547
+
3
548
  ## 2.14.8
4
549
 
5
550
  ### Patch Changes
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const typescript_1 = __importDefault(require("typescript"));
8
+ const diagnostic_1 = require("@atlaspack/diagnostic");
9
+ const utils_1 = require("@atlaspack/utils");
10
+ const plugin_1 = require("@atlaspack/plugin");
11
+ const ts_utils_1 = require("@atlaspack/ts-utils");
12
+ let langServiceCache = {};
13
+ exports.default = new plugin_1.Validator({
14
+ async validateAll({ assets, options, resolveConfigWithPath, }) {
15
+ // Build a collection that of all the LanguageServices related to files that just changed.
16
+ let servicesToValidate = new Set();
17
+ await Promise.all(assets.map(async (asset) => {
18
+ let config = await getConfig(asset, options, resolveConfigWithPath);
19
+ let { configHash } = config;
20
+ // Create a languageService/host in the cache for the configuration if it doesn't already exist.
21
+ tryCreateLanguageService(config, asset, options);
22
+ if (!langServiceCache[configHash])
23
+ return;
24
+ // Invalidate the file with the LanguageServiceHost so Typescript knows it has changed.
25
+ langServiceCache[configHash].host.invalidate(asset.filePath);
26
+ servicesToValidate.add(configHash);
27
+ }));
28
+ // Ask typescript to analyze all changed programs and translate the results into ValidatorResult objects.
29
+ let validatorResults = [];
30
+ servicesToValidate.forEach((configHash) => {
31
+ // Make sure that the filesystem being used by the LanguageServiceHost and ParseConfigHost is up-to-date.
32
+ // (This could change in the context of re-running tests, and probably also for other reasons).
33
+ langServiceCache[configHash].host.fs = options.inputFS;
34
+ langServiceCache[configHash].configHost.fs = options.inputFS;
35
+ let program = langServiceCache[configHash].service.getProgram();
36
+ if (!program)
37
+ return;
38
+ let filesToCheck = program.getSourceFiles();
39
+ filesToCheck.forEach((sourceFile) => {
40
+ let diagnostics = program.getSemanticDiagnostics(sourceFile);
41
+ validatorResults.push(getValidateResultFromDiagnostics(sourceFile.fileName, diagnostics));
42
+ });
43
+ });
44
+ return validatorResults;
45
+ },
46
+ });
47
+ async function getConfig(asset, options,
48
+ // @ts-expect-error TS2304
49
+ resolveConfigWithPath) {
50
+ let configNames = ['tsconfig.json'];
51
+ let tsconfig = await (0, utils_1.loadConfig)(asset.fs, asset.filePath, configNames, options.projectRoot);
52
+ let configPath = await resolveConfigWithPath(configNames, asset.filePath);
53
+ let baseDir = configPath ? path_1.default.dirname(configPath) : options.projectRoot;
54
+ let configHash = (tsconfig ? (0, utils_1.hashObject)(tsconfig.config) : '') + '-' + baseDir;
55
+ return {
56
+ filepath: configPath,
57
+ baseDir,
58
+ configHash,
59
+ tsconfig: tsconfig?.config,
60
+ };
61
+ }
62
+ /** Tries to create a typescript language service instance in the cache if it doesn't already exist. */
63
+ function tryCreateLanguageService(config, asset, options) {
64
+ if (config.tsconfig && !langServiceCache[config.configHash]) {
65
+ // In order to prevent race conditions where we accidentally create two language services for the same config,
66
+ // we need to re-check the cache to see if a service has been created while we were awaiting 'ts'.
67
+ if (!langServiceCache[config.configHash]) {
68
+ let configHost = new ts_utils_1.ParseConfigHost(options.inputFS, typescript_1.default);
69
+ let parsedCommandLine = typescript_1.default.parseJsonConfigFileContent(config.tsconfig, configHost, config.baseDir);
70
+ const host = new ts_utils_1.LanguageServiceHost(options.inputFS, typescript_1.default, parsedCommandLine);
71
+ langServiceCache[config.configHash] = {
72
+ configHost,
73
+ host,
74
+ service: typescript_1.default.createLanguageService(host, typescript_1.default.createDocumentRegistry()),
75
+ };
76
+ }
77
+ }
78
+ }
79
+ /** Translates semantic diagnostics (from TypeScript) into a ValidateResult that Parcel understands. */
80
+ function getValidateResultFromDiagnostics(filePath, diagnostics) {
81
+ let validatorResult = {
82
+ warnings: [],
83
+ errors: [],
84
+ };
85
+ if (diagnostics.length > 0) {
86
+ for (let diagnostic of diagnostics) {
87
+ let filename = filePath;
88
+ let { file } = diagnostic;
89
+ let diagnosticMessage = (0, diagnostic_1.escapeMarkdown)(typeof diagnostic.messageText === 'string'
90
+ ? diagnostic.messageText
91
+ : diagnostic.messageText.messageText);
92
+ let codeframe;
93
+ if (file != null && diagnostic.start != null) {
94
+ let source = file.text || diagnostic.source;
95
+ if (file.fileName) {
96
+ filename = file.fileName;
97
+ }
98
+ if (source) {
99
+ let lineChar = file.getLineAndCharacterOfPosition(diagnostic.start);
100
+ let start = {
101
+ line: lineChar.line + 1,
102
+ column: lineChar.character + 1,
103
+ };
104
+ let end = {
105
+ line: start.line,
106
+ column: start.column + 1,
107
+ };
108
+ if (typeof diagnostic.start === 'number' &&
109
+ typeof diagnostic.length === 'number') {
110
+ let endCharPosition = file.getLineAndCharacterOfPosition(diagnostic.start + diagnostic.length);
111
+ end = {
112
+ line: endCharPosition.line + 1,
113
+ column: endCharPosition.character + 1,
114
+ };
115
+ }
116
+ codeframe = {
117
+ filePath: filename,
118
+ code: source,
119
+ codeHighlights: [
120
+ {
121
+ start,
122
+ end,
123
+ message: diagnosticMessage,
124
+ },
125
+ ],
126
+ };
127
+ }
128
+ }
129
+ // @ts-expect-error TS2345
130
+ validatorResult.errors.push({
131
+ origin: '@atlaspack/validator-typescript',
132
+ message: diagnosticMessage,
133
+ codeFrames: codeframe ? [codeframe] : undefined,
134
+ });
135
+ }
136
+ }
137
+ return validatorResult;
138
+ }