@typeslayer/analyze-trace 0.1.12 → 0.1.14
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/dist/index.js +1037 -115
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/tsup.config.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -2,19 +2,480 @@
|
|
|
2
2
|
import { existsSync as existsSync3 } from "fs";
|
|
3
3
|
import { readFile as readFile2, writeFile } from "fs/promises";
|
|
4
4
|
import { join as join2 } from "path";
|
|
5
|
-
import {
|
|
6
|
-
TRACE_JSON_FILENAME,
|
|
7
|
-
TYPES_JSON_FILENAME,
|
|
8
|
-
traceJsonSchema,
|
|
9
|
-
typesJsonSchema
|
|
10
|
-
} from "@typeslayer/validate";
|
|
11
5
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
// ../validate/dist/index.js
|
|
7
|
+
import { z as z2 } from "zod/v4";
|
|
8
|
+
import { z } from "zod/v4";
|
|
9
|
+
import { z as z3 } from "zod/v4";
|
|
10
|
+
var packageNameRegex = /\/node_modules\/((?:[^@][^/]+)|(?:@[^/]+\/[^/]+))/g;
|
|
11
|
+
var typeId = z.number().int().positive().or(z.literal(-1));
|
|
12
|
+
var position = z.object({
|
|
13
|
+
line: typeId,
|
|
14
|
+
character: z.number()
|
|
15
|
+
});
|
|
16
|
+
var absolutePath = z.string();
|
|
17
|
+
var location = z.object({
|
|
18
|
+
path: absolutePath,
|
|
19
|
+
start: position,
|
|
20
|
+
end: position
|
|
21
|
+
});
|
|
22
|
+
var TRACE_JSON_FILENAME = "trace.json";
|
|
23
|
+
var eventPhase = {
|
|
24
|
+
begin: "B",
|
|
25
|
+
end: "E",
|
|
26
|
+
complete: "X",
|
|
27
|
+
metadata: "M",
|
|
28
|
+
instantGlobal: "I"
|
|
29
|
+
// 'i' is instantThread
|
|
30
|
+
};
|
|
31
|
+
var instantScope = {
|
|
32
|
+
thread: "t",
|
|
33
|
+
global: "g",
|
|
34
|
+
process: "p"
|
|
35
|
+
};
|
|
36
|
+
var durationEvent = {
|
|
37
|
+
ph: z2.union([z2.literal(eventPhase.begin), z2.literal(eventPhase.end)])
|
|
38
|
+
};
|
|
39
|
+
var completeEvent = {
|
|
40
|
+
ph: z2.literal(eventPhase.complete),
|
|
41
|
+
dur: z2.number().positive()
|
|
42
|
+
};
|
|
43
|
+
var instantEvent = {
|
|
44
|
+
ph: z2.literal(eventPhase.instantGlobal)
|
|
45
|
+
};
|
|
46
|
+
var category = {
|
|
47
|
+
parse: {
|
|
48
|
+
cat: z2.literal("parse")
|
|
49
|
+
},
|
|
50
|
+
program: {
|
|
51
|
+
cat: z2.literal("program")
|
|
52
|
+
},
|
|
53
|
+
bind: {
|
|
54
|
+
cat: z2.literal("bind")
|
|
55
|
+
},
|
|
56
|
+
check: {
|
|
57
|
+
cat: z2.literal("check")
|
|
58
|
+
},
|
|
59
|
+
checkTypes: {
|
|
60
|
+
cat: z2.literal("checkTypes")
|
|
61
|
+
},
|
|
62
|
+
emit: {
|
|
63
|
+
cat: z2.literal("emit")
|
|
64
|
+
},
|
|
65
|
+
session: {
|
|
66
|
+
cat: z2.literal("session")
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var eventCommon = {
|
|
70
|
+
pid: z2.number().int().positive(),
|
|
71
|
+
tid: z2.number().int().positive(),
|
|
72
|
+
ts: z2.number().positive()
|
|
73
|
+
};
|
|
74
|
+
var event_metadata__TracingStartedInBrowser = z2.object({
|
|
75
|
+
...eventCommon,
|
|
76
|
+
cat: z2.literal("disabled-by-default-devtools.timeline"),
|
|
77
|
+
name: z2.literal("TracingStartedInBrowser"),
|
|
78
|
+
ph: z2.literal(eventPhase.metadata)
|
|
79
|
+
}).strict();
|
|
80
|
+
var event_metadata__process_name = z2.object({
|
|
81
|
+
...eventCommon,
|
|
82
|
+
ph: z2.literal(eventPhase.metadata),
|
|
83
|
+
args: z2.object({
|
|
84
|
+
name: z2.literal("tsc")
|
|
85
|
+
}),
|
|
86
|
+
cat: z2.literal("__metadata"),
|
|
87
|
+
name: z2.literal("process_name")
|
|
88
|
+
}).strict();
|
|
89
|
+
var event_metadata__thread_name = z2.object({
|
|
90
|
+
...eventCommon,
|
|
91
|
+
name: z2.literal("thread_name"),
|
|
92
|
+
cat: z2.literal("__metadata"),
|
|
93
|
+
ph: z2.literal(eventPhase.metadata),
|
|
94
|
+
args: z2.object({
|
|
95
|
+
name: z2.literal("Main")
|
|
96
|
+
})
|
|
97
|
+
}).strict();
|
|
98
|
+
var event_parse__createSourceFile = z2.object({
|
|
99
|
+
...eventCommon,
|
|
100
|
+
...category.parse,
|
|
101
|
+
...durationEvent,
|
|
102
|
+
name: z2.literal("createSourceFile"),
|
|
103
|
+
args: z2.object({
|
|
104
|
+
path: absolutePath
|
|
105
|
+
})
|
|
106
|
+
}).strict();
|
|
107
|
+
var event_parse__parseJsonSourceFileConfigFileContent = z2.object({
|
|
108
|
+
...eventCommon,
|
|
109
|
+
...category.parse,
|
|
110
|
+
...completeEvent,
|
|
111
|
+
name: z2.literal("parseJsonSourceFileConfigFileContent"),
|
|
112
|
+
args: z2.object({
|
|
113
|
+
path: absolutePath
|
|
114
|
+
})
|
|
115
|
+
}).strict();
|
|
116
|
+
var event_program__createProgram = z2.object({
|
|
117
|
+
...eventCommon,
|
|
118
|
+
...category.program,
|
|
119
|
+
...durationEvent,
|
|
120
|
+
name: z2.literal("createProgram"),
|
|
121
|
+
args: z2.object({
|
|
122
|
+
configFilePath: absolutePath
|
|
123
|
+
// path to the tsconfig.json file
|
|
124
|
+
})
|
|
125
|
+
}).strict();
|
|
126
|
+
var event_program__findSourceFile = z2.object({
|
|
127
|
+
...eventCommon,
|
|
128
|
+
...category.program,
|
|
129
|
+
...completeEvent,
|
|
130
|
+
name: z2.literal("findSourceFile"),
|
|
131
|
+
dur: z2.number(),
|
|
132
|
+
args: z2.object({
|
|
133
|
+
fileName: absolutePath,
|
|
134
|
+
fileIncludeKind: z2.union([
|
|
135
|
+
z2.literal("RootFile"),
|
|
136
|
+
z2.literal("Import"),
|
|
137
|
+
z2.literal("TypeReferenceDirective"),
|
|
138
|
+
z2.literal("LibFile"),
|
|
139
|
+
z2.literal("LibReferenceDirective"),
|
|
140
|
+
z2.literal("AutomaticTypeDirectiveFile"),
|
|
141
|
+
z2.literal("ReferenceFile")
|
|
142
|
+
])
|
|
143
|
+
})
|
|
144
|
+
}).strict();
|
|
145
|
+
var event_program__processRootFiles = z2.object({
|
|
146
|
+
...eventCommon,
|
|
147
|
+
...category.program,
|
|
148
|
+
...completeEvent,
|
|
149
|
+
name: z2.literal("processRootFiles"),
|
|
150
|
+
dur: z2.number(),
|
|
151
|
+
args: z2.object({ count: z2.number().int().positive() })
|
|
152
|
+
}).strict();
|
|
153
|
+
var event_program__processTypeReferenceDirective = z2.object({
|
|
154
|
+
...eventCommon,
|
|
155
|
+
...category.program,
|
|
156
|
+
...completeEvent,
|
|
157
|
+
name: z2.literal("processTypeReferenceDirective"),
|
|
158
|
+
dur: z2.number(),
|
|
159
|
+
args: z2.object({
|
|
160
|
+
directive: z2.string(),
|
|
161
|
+
hasResolved: z2.literal(true),
|
|
162
|
+
refKind: z2.number().int().positive(),
|
|
163
|
+
refPath: absolutePath.optional()
|
|
164
|
+
})
|
|
165
|
+
}).strict();
|
|
166
|
+
var event_program__processTypeReferences = z2.object({
|
|
167
|
+
...eventCommon,
|
|
168
|
+
...category.program,
|
|
169
|
+
...completeEvent,
|
|
170
|
+
name: z2.literal("processTypeReferences"),
|
|
171
|
+
dur: z2.number(),
|
|
172
|
+
args: z2.object({
|
|
173
|
+
count: z2.number().int().positive()
|
|
174
|
+
})
|
|
175
|
+
}).strict();
|
|
176
|
+
var event_program__resolveLibrary = z2.object({
|
|
177
|
+
...eventCommon,
|
|
178
|
+
...category.program,
|
|
179
|
+
...completeEvent,
|
|
180
|
+
name: z2.literal("resolveLibrary"),
|
|
181
|
+
args: z2.object({
|
|
182
|
+
resolveFrom: absolutePath
|
|
183
|
+
})
|
|
184
|
+
}).strict();
|
|
185
|
+
var event_program__resolveModuleNamesWorker = z2.object({
|
|
186
|
+
...eventCommon,
|
|
187
|
+
...category.program,
|
|
188
|
+
...completeEvent,
|
|
189
|
+
name: z2.literal("resolveModuleNamesWorker"),
|
|
190
|
+
args: z2.object({
|
|
191
|
+
containingFileName: absolutePath
|
|
192
|
+
})
|
|
193
|
+
}).strict();
|
|
194
|
+
var event_program__resolveTypeReferenceDirectiveNamesWorker = z2.object({
|
|
195
|
+
...eventCommon,
|
|
196
|
+
...category.program,
|
|
197
|
+
...completeEvent,
|
|
198
|
+
name: z2.literal("resolveTypeReferenceDirectiveNamesWorker"),
|
|
199
|
+
args: z2.object({
|
|
200
|
+
containingFileName: absolutePath
|
|
201
|
+
})
|
|
202
|
+
}).strict();
|
|
203
|
+
var event_program__shouldProgramCreateNewSourceFiles = z2.object({
|
|
204
|
+
...eventCommon,
|
|
205
|
+
...category.program,
|
|
206
|
+
...instantEvent,
|
|
207
|
+
name: z2.literal("shouldProgramCreateNewSourceFiles"),
|
|
208
|
+
s: z2.union([
|
|
209
|
+
z2.literal(instantScope.global),
|
|
210
|
+
z2.literal(instantScope.thread),
|
|
211
|
+
z2.literal(instantScope.process)
|
|
212
|
+
]),
|
|
213
|
+
args: z2.object({
|
|
214
|
+
hasOldProgram: z2.boolean()
|
|
215
|
+
})
|
|
216
|
+
}).strict();
|
|
217
|
+
var event_program__tryReuseStructureFromOldProgram = z2.object({
|
|
218
|
+
...eventCommon,
|
|
219
|
+
...category.program,
|
|
220
|
+
...completeEvent,
|
|
221
|
+
name: z2.literal("tryReuseStructureFromOldProgram"),
|
|
222
|
+
dur: z2.number(),
|
|
223
|
+
args: z2.object({})
|
|
224
|
+
}).strict();
|
|
225
|
+
var event_bind__bindSourceFile = z2.object({
|
|
226
|
+
...eventCommon,
|
|
227
|
+
...category.bind,
|
|
228
|
+
...durationEvent,
|
|
229
|
+
name: z2.literal("bindSourceFile"),
|
|
230
|
+
args: z2.object({
|
|
231
|
+
path: absolutePath
|
|
232
|
+
})
|
|
233
|
+
}).strict();
|
|
234
|
+
var event_check__checkExpression = z2.object({
|
|
235
|
+
...eventCommon,
|
|
236
|
+
...category.check,
|
|
237
|
+
...completeEvent,
|
|
238
|
+
name: z2.literal("checkExpression"),
|
|
239
|
+
dur: z2.number(),
|
|
240
|
+
args: z2.object({
|
|
241
|
+
kind: z2.number(),
|
|
242
|
+
pos: z2.number(),
|
|
243
|
+
end: z2.number(),
|
|
244
|
+
path: absolutePath.optional()
|
|
245
|
+
})
|
|
246
|
+
}).strict();
|
|
247
|
+
var event_check__checkSourceFile = z2.object({
|
|
248
|
+
...eventCommon,
|
|
249
|
+
...category.check,
|
|
250
|
+
...durationEvent,
|
|
251
|
+
name: z2.literal("checkSourceFile"),
|
|
252
|
+
args: z2.object({
|
|
253
|
+
path: absolutePath
|
|
254
|
+
})
|
|
255
|
+
}).strict();
|
|
256
|
+
var event_check__checkVariableDeclaration = z2.object({
|
|
257
|
+
...eventCommon,
|
|
258
|
+
...category.check,
|
|
259
|
+
...completeEvent,
|
|
260
|
+
name: z2.literal("checkVariableDeclaration"),
|
|
261
|
+
dur: z2.number(),
|
|
262
|
+
args: z2.object({
|
|
263
|
+
kind: z2.number(),
|
|
264
|
+
pos: z2.number(),
|
|
265
|
+
end: z2.number(),
|
|
266
|
+
path: absolutePath
|
|
267
|
+
})
|
|
268
|
+
}).strict();
|
|
269
|
+
var event_check__checkDeferredNode = z2.object({
|
|
270
|
+
...eventCommon,
|
|
271
|
+
...category.check,
|
|
272
|
+
...completeEvent,
|
|
273
|
+
name: z2.literal("checkDeferredNode"),
|
|
274
|
+
dur: z2.number(),
|
|
275
|
+
args: z2.object({
|
|
276
|
+
kind: z2.number(),
|
|
277
|
+
pos: z2.number(),
|
|
278
|
+
end: z2.number(),
|
|
279
|
+
path: absolutePath
|
|
280
|
+
})
|
|
281
|
+
}).strict();
|
|
282
|
+
var event_check__checkSourceFileNodes = z2.object({
|
|
283
|
+
...eventCommon,
|
|
284
|
+
...category.check,
|
|
285
|
+
...completeEvent,
|
|
286
|
+
name: z2.literal("checkSourceFileNodes"),
|
|
287
|
+
dur: z2.number(),
|
|
288
|
+
args: z2.object({
|
|
289
|
+
path: absolutePath
|
|
290
|
+
})
|
|
291
|
+
}).strict();
|
|
292
|
+
var event_checktypes__checkTypeParameterDeferred = z2.object({
|
|
293
|
+
...eventCommon,
|
|
294
|
+
...category.checkTypes,
|
|
295
|
+
...completeEvent,
|
|
296
|
+
name: z2.literal("checkTypeParameterDeferred"),
|
|
297
|
+
dur: z2.number(),
|
|
298
|
+
args: z2.object({
|
|
299
|
+
parent: typeId,
|
|
300
|
+
id: typeId
|
|
301
|
+
})
|
|
302
|
+
}).strict();
|
|
303
|
+
var event_checktypes__getVariancesWorker = z2.object({
|
|
304
|
+
...eventCommon,
|
|
305
|
+
...category.checkTypes,
|
|
306
|
+
...completeEvent,
|
|
307
|
+
name: z2.literal("getVariancesWorker"),
|
|
308
|
+
dur: z2.number(),
|
|
309
|
+
args: z2.object({
|
|
310
|
+
arity: z2.number().int().nonnegative(),
|
|
311
|
+
id: z2.number().int().positive(),
|
|
312
|
+
results: z2.object({
|
|
313
|
+
variances: z2.array(
|
|
314
|
+
z2.union([
|
|
315
|
+
z2.literal("[independent]"),
|
|
316
|
+
z2.literal("[independent] (unreliable)"),
|
|
317
|
+
z2.literal("[independent] (unmeasurable)"),
|
|
318
|
+
z2.literal("[bivariant]"),
|
|
319
|
+
z2.literal("[bivariant] (unreliable)"),
|
|
320
|
+
z2.literal("[bivariant] (unmeasurable)"),
|
|
321
|
+
z2.literal("in"),
|
|
322
|
+
z2.literal("in (unreliable)"),
|
|
323
|
+
z2.literal("in (unmeasurable)"),
|
|
324
|
+
z2.literal("out"),
|
|
325
|
+
z2.literal("out (unreliable)"),
|
|
326
|
+
z2.literal("out (unmeasurable)"),
|
|
327
|
+
z2.literal(
|
|
328
|
+
"in out"
|
|
329
|
+
/*burger*/
|
|
330
|
+
),
|
|
331
|
+
z2.literal("in out (unreliable)"),
|
|
332
|
+
z2.literal("in out (unmeasurable)")
|
|
333
|
+
])
|
|
334
|
+
)
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
}).strict();
|
|
338
|
+
var event_checktypes__structuredTypeRelatedTo = z2.object({
|
|
339
|
+
...eventCommon,
|
|
340
|
+
...category.checkTypes,
|
|
341
|
+
...completeEvent,
|
|
342
|
+
name: z2.literal("structuredTypeRelatedTo"),
|
|
343
|
+
args: z2.object({
|
|
344
|
+
sourceId: typeId,
|
|
345
|
+
targetId: typeId
|
|
346
|
+
})
|
|
347
|
+
}).strict();
|
|
348
|
+
var event_checktypes__checkCrossProductUnion_DepthLimit = z2.object({
|
|
349
|
+
...eventCommon,
|
|
350
|
+
...category.checkTypes,
|
|
351
|
+
...instantEvent,
|
|
352
|
+
name: z2.literal("checkCrossProductUnion_DepthLimit"),
|
|
353
|
+
s: z2.union([
|
|
354
|
+
z2.literal(instantScope.global),
|
|
355
|
+
z2.literal(instantScope.thread),
|
|
356
|
+
z2.literal(instantScope.process)
|
|
357
|
+
]),
|
|
358
|
+
args: z2.object({
|
|
359
|
+
types: z2.array(typeId),
|
|
360
|
+
size: z2.number().int().positive()
|
|
361
|
+
})
|
|
362
|
+
}).strict();
|
|
363
|
+
var event_checktypes__checkTypeRelatedTo_DepthLimit = z2.object({
|
|
364
|
+
...eventCommon,
|
|
365
|
+
...category.checkTypes,
|
|
366
|
+
...instantEvent,
|
|
367
|
+
name: z2.literal("checkTypeRelatedTo_DepthLimit"),
|
|
368
|
+
s: z2.union([
|
|
369
|
+
z2.literal(instantScope.global),
|
|
370
|
+
z2.literal(instantScope.thread),
|
|
371
|
+
z2.literal(instantScope.process)
|
|
372
|
+
]),
|
|
373
|
+
args: z2.object({
|
|
374
|
+
sourceId: typeId,
|
|
375
|
+
targetId: typeId,
|
|
376
|
+
depth: z2.number().int().positive(),
|
|
377
|
+
targetDepth: z2.number().int().positive()
|
|
378
|
+
})
|
|
379
|
+
}).strict();
|
|
380
|
+
var event_checktypes__getTypeAtFlowNode_DepthLimit = z2.object({
|
|
381
|
+
...eventCommon,
|
|
382
|
+
...category.checkTypes,
|
|
383
|
+
...instantEvent,
|
|
384
|
+
name: z2.literal("getTypeAtFlowNode_DepthLimit"),
|
|
385
|
+
s: z2.union([
|
|
386
|
+
z2.literal(instantScope.global),
|
|
387
|
+
z2.literal(instantScope.thread),
|
|
388
|
+
z2.literal(instantScope.process)
|
|
389
|
+
]),
|
|
390
|
+
args: z2.object({
|
|
391
|
+
flowId: z2.number().int().positive()
|
|
392
|
+
})
|
|
393
|
+
}).strict();
|
|
394
|
+
var event_checktypes__instantiateType_DepthLimit = z2.object({
|
|
395
|
+
...eventCommon,
|
|
396
|
+
...category.checkTypes,
|
|
397
|
+
...instantEvent,
|
|
398
|
+
name: z2.literal("instantiateType_DepthLimit"),
|
|
399
|
+
s: z2.union([
|
|
400
|
+
z2.literal(instantScope.global),
|
|
401
|
+
z2.literal(instantScope.thread),
|
|
402
|
+
z2.literal(instantScope.process)
|
|
403
|
+
]),
|
|
404
|
+
args: z2.object({
|
|
405
|
+
typeId,
|
|
406
|
+
instantiationDepth: z2.number().int(),
|
|
407
|
+
instantiationCount: z2.number().int().positive()
|
|
408
|
+
})
|
|
409
|
+
}).strict();
|
|
410
|
+
var event_checktypes__recursiveTypeRelatedTo_DepthLimit = z2.object({
|
|
411
|
+
...eventCommon,
|
|
412
|
+
...category.checkTypes,
|
|
413
|
+
...instantEvent,
|
|
414
|
+
name: z2.literal("recursiveTypeRelatedTo_DepthLimit"),
|
|
415
|
+
s: z2.union([
|
|
416
|
+
z2.literal(instantScope.global),
|
|
417
|
+
z2.literal(instantScope.thread),
|
|
418
|
+
z2.literal(instantScope.process)
|
|
419
|
+
]),
|
|
420
|
+
args: z2.object({
|
|
421
|
+
sourceId: typeId,
|
|
422
|
+
sourceIdStack: z2.array(typeId),
|
|
423
|
+
targetId: typeId,
|
|
424
|
+
targetIdStack: z2.array(typeId),
|
|
425
|
+
depth: z2.number().int().positive(),
|
|
426
|
+
targetDepth: z2.number().int().positive()
|
|
427
|
+
})
|
|
428
|
+
}).strict();
|
|
429
|
+
var event_checktypes__removeSubtypes_DepthLimit = z2.object({
|
|
430
|
+
...eventCommon,
|
|
431
|
+
...category.checkTypes,
|
|
432
|
+
...instantEvent,
|
|
433
|
+
name: z2.literal("removeSubtypes_DepthLimit"),
|
|
434
|
+
s: z2.union([
|
|
435
|
+
z2.literal(instantScope.global),
|
|
436
|
+
z2.literal(instantScope.thread),
|
|
437
|
+
z2.literal(instantScope.process)
|
|
438
|
+
]),
|
|
439
|
+
args: z2.object({
|
|
440
|
+
typeIds: z2.array(typeId)
|
|
441
|
+
})
|
|
442
|
+
}).strict();
|
|
443
|
+
var event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit = z2.object({
|
|
444
|
+
...eventCommon,
|
|
445
|
+
...category.checkTypes,
|
|
446
|
+
...instantEvent,
|
|
447
|
+
name: z2.literal("traceUnionsOrIntersectionsTooLarge_DepthLimit"),
|
|
448
|
+
s: z2.union([
|
|
449
|
+
z2.literal(instantScope.global),
|
|
450
|
+
z2.literal(instantScope.thread),
|
|
451
|
+
z2.literal(instantScope.process)
|
|
452
|
+
]),
|
|
453
|
+
args: z2.object({
|
|
454
|
+
sourceId: typeId,
|
|
455
|
+
sourceSize: z2.number().int().positive(),
|
|
456
|
+
targetId: typeId,
|
|
457
|
+
targetSize: z2.number().int().positive(),
|
|
458
|
+
pos: z2.number().int().nonnegative().optional(),
|
|
459
|
+
end: z2.number().int().positive().optional()
|
|
460
|
+
})
|
|
461
|
+
}).strict();
|
|
462
|
+
var event_checktypes__typeRelatedToDiscriminatedType_DepthLimit = z2.object({
|
|
463
|
+
...eventCommon,
|
|
464
|
+
...category.checkTypes,
|
|
465
|
+
...instantEvent,
|
|
466
|
+
name: z2.literal("typeRelatedToDiscriminatedType_DepthLimit"),
|
|
467
|
+
s: z2.union([
|
|
468
|
+
z2.literal(instantScope.global),
|
|
469
|
+
z2.literal(instantScope.thread),
|
|
470
|
+
z2.literal(instantScope.process)
|
|
471
|
+
]),
|
|
472
|
+
args: z2.object({
|
|
473
|
+
sourceId: typeId,
|
|
474
|
+
targetId: typeId,
|
|
475
|
+
numCombinations: z2.number().int().positive()
|
|
476
|
+
})
|
|
477
|
+
}).strict();
|
|
478
|
+
var depthLimits = [
|
|
18
479
|
event_checktypes__checkCrossProductUnion_DepthLimit,
|
|
19
480
|
event_checktypes__checkTypeRelatedTo_DepthLimit,
|
|
20
481
|
event_checktypes__getTypeAtFlowNode_DepthLimit,
|
|
@@ -23,7 +484,489 @@ import {
|
|
|
23
484
|
event_checktypes__removeSubtypes_DepthLimit,
|
|
24
485
|
event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit,
|
|
25
486
|
event_checktypes__typeRelatedToDiscriminatedType_DepthLimit
|
|
26
|
-
|
|
487
|
+
];
|
|
488
|
+
var event_emit__emit = z2.object({
|
|
489
|
+
...eventCommon,
|
|
490
|
+
...category.emit,
|
|
491
|
+
...durationEvent,
|
|
492
|
+
name: z2.literal("emit"),
|
|
493
|
+
args: z2.object({})
|
|
494
|
+
// for some reason, this is empty
|
|
495
|
+
}).strict();
|
|
496
|
+
var event_emit__emitBuildInfo = z2.object({
|
|
497
|
+
...eventCommon,
|
|
498
|
+
...category.emit,
|
|
499
|
+
ph: z2.union([
|
|
500
|
+
z2.literal(eventPhase.begin),
|
|
501
|
+
z2.literal(eventPhase.end),
|
|
502
|
+
z2.literal(eventPhase.complete)
|
|
503
|
+
]),
|
|
504
|
+
dur: z2.number().positive().optional(),
|
|
505
|
+
name: z2.literal("emitBuildInfo"),
|
|
506
|
+
args: z2.union([
|
|
507
|
+
z2.object({}),
|
|
508
|
+
z2.object({
|
|
509
|
+
buildInfoPath: absolutePath
|
|
510
|
+
})
|
|
511
|
+
])
|
|
512
|
+
}).strict();
|
|
513
|
+
var event_emit__emitDeclarationFileOrBundle = z2.object({
|
|
514
|
+
...eventCommon,
|
|
515
|
+
...category.emit,
|
|
516
|
+
...completeEvent,
|
|
517
|
+
name: z2.literal("emitDeclarationFileOrBundle"),
|
|
518
|
+
dur: z2.number(),
|
|
519
|
+
args: z2.object({
|
|
520
|
+
declarationFilePath: absolutePath
|
|
521
|
+
})
|
|
522
|
+
}).strict();
|
|
523
|
+
var event_emit__emitJsFileOrBundle = z2.object({
|
|
524
|
+
...eventCommon,
|
|
525
|
+
...category.emit,
|
|
526
|
+
...completeEvent,
|
|
527
|
+
name: z2.literal("emitJsFileOrBundle"),
|
|
528
|
+
dur: z2.number(),
|
|
529
|
+
args: z2.object({
|
|
530
|
+
jsFilePath: absolutePath
|
|
531
|
+
})
|
|
532
|
+
}).strict();
|
|
533
|
+
var event_emit__transformNodes = z2.object({
|
|
534
|
+
...eventCommon,
|
|
535
|
+
...category.emit,
|
|
536
|
+
...completeEvent,
|
|
537
|
+
name: z2.literal("transformNodes"),
|
|
538
|
+
args: z2.object({
|
|
539
|
+
path: absolutePath
|
|
540
|
+
})
|
|
541
|
+
}).strict();
|
|
542
|
+
var event_session__cancellationThrown = z2.object({
|
|
543
|
+
...eventCommon,
|
|
544
|
+
...category.session,
|
|
545
|
+
...instantEvent,
|
|
546
|
+
name: z2.literal("cancellationThrown"),
|
|
547
|
+
args: z2.object({
|
|
548
|
+
kind: z2.union([
|
|
549
|
+
z2.literal("CancellationTokenObject"),
|
|
550
|
+
z2.literal("ThrotledCancellationToken")
|
|
551
|
+
])
|
|
552
|
+
})
|
|
553
|
+
}).strict();
|
|
554
|
+
var event_session__commandCanceled = z2.object({
|
|
555
|
+
...eventCommon,
|
|
556
|
+
...category.session,
|
|
557
|
+
...instantEvent,
|
|
558
|
+
name: z2.literal("commandCanceled"),
|
|
559
|
+
args: z2.object({
|
|
560
|
+
seq: z2.number().int().nonnegative(),
|
|
561
|
+
command: z2.string()
|
|
562
|
+
})
|
|
563
|
+
}).strict();
|
|
564
|
+
var event_session__commandError = z2.object({
|
|
565
|
+
...eventCommon,
|
|
566
|
+
...category.session,
|
|
567
|
+
...instantEvent,
|
|
568
|
+
name: z2.literal("commandError"),
|
|
569
|
+
args: z2.object({
|
|
570
|
+
seq: z2.number().int().nonnegative(),
|
|
571
|
+
command: z2.string(),
|
|
572
|
+
message: z2.string()
|
|
573
|
+
})
|
|
574
|
+
}).strict();
|
|
575
|
+
var event_session__createConfiguredProject = z2.object({
|
|
576
|
+
...eventCommon,
|
|
577
|
+
...category.session,
|
|
578
|
+
...instantEvent,
|
|
579
|
+
name: z2.literal("createConfiguredProject"),
|
|
580
|
+
args: z2.object({
|
|
581
|
+
configFilePath: absolutePath
|
|
582
|
+
})
|
|
583
|
+
}).strict();
|
|
584
|
+
var event_session__createdDocumentRegistryBucket = z2.object({
|
|
585
|
+
...eventCommon,
|
|
586
|
+
...category.session,
|
|
587
|
+
...instantEvent,
|
|
588
|
+
name: z2.literal("createdDocumentRegistryBucket"),
|
|
589
|
+
args: z2.object({
|
|
590
|
+
configFilePath: absolutePath,
|
|
591
|
+
key: z2.string()
|
|
592
|
+
})
|
|
593
|
+
}).strict();
|
|
594
|
+
var event_session__documentRegistryBucketOverlap = z2.object({
|
|
595
|
+
...eventCommon,
|
|
596
|
+
...category.session,
|
|
597
|
+
...instantEvent,
|
|
598
|
+
name: z2.literal("documentRegistryBucketOverlap"),
|
|
599
|
+
args: z2.object({
|
|
600
|
+
path: absolutePath,
|
|
601
|
+
key1: z2.string(),
|
|
602
|
+
key2: z2.string()
|
|
603
|
+
})
|
|
604
|
+
}).strict();
|
|
605
|
+
var event_session__executeCommand = z2.object({
|
|
606
|
+
...eventCommon,
|
|
607
|
+
...category.session,
|
|
608
|
+
...durationEvent,
|
|
609
|
+
name: z2.literal("executeCommand"),
|
|
610
|
+
args: z2.object({
|
|
611
|
+
seq: z2.number().int().nonnegative(),
|
|
612
|
+
command: z2.string()
|
|
613
|
+
})
|
|
614
|
+
}).strict();
|
|
615
|
+
var event_session__finishCachingPerDirectoryResolution = z2.object({
|
|
616
|
+
...eventCommon,
|
|
617
|
+
...category.session,
|
|
618
|
+
...instantEvent,
|
|
619
|
+
name: z2.literal("finishCachingPerDirectoryResolution"),
|
|
620
|
+
s: z2.union([
|
|
621
|
+
z2.literal(instantScope.global),
|
|
622
|
+
z2.literal(instantScope.thread),
|
|
623
|
+
z2.literal(instantScope.process)
|
|
624
|
+
])
|
|
625
|
+
}).strict();
|
|
626
|
+
var event_session__getPackageJsonAutoImportProvider = z2.object({
|
|
627
|
+
...eventCommon,
|
|
628
|
+
...category.session,
|
|
629
|
+
...completeEvent,
|
|
630
|
+
name: z2.literal("getPackageJsonAutoImportProvider")
|
|
631
|
+
}).strict();
|
|
632
|
+
var event_session__getUnresolvedImports = z2.object({
|
|
633
|
+
...eventCommon,
|
|
634
|
+
...category.session,
|
|
635
|
+
...completeEvent,
|
|
636
|
+
name: z2.literal("getUnresolvedImports"),
|
|
637
|
+
args: z2.object({
|
|
638
|
+
count: z2.number().int().nonnegative()
|
|
639
|
+
})
|
|
640
|
+
}).strict();
|
|
641
|
+
var event_session__loadConfiguredProject = z2.object({
|
|
642
|
+
...eventCommon,
|
|
643
|
+
...category.session,
|
|
644
|
+
...durationEvent,
|
|
645
|
+
name: z2.literal("loadConfiguredProject"),
|
|
646
|
+
args: z2.object({
|
|
647
|
+
configFilePath: absolutePath
|
|
648
|
+
})
|
|
649
|
+
}).strict();
|
|
650
|
+
var event_session__regionSemanticCheck = z2.object({
|
|
651
|
+
...eventCommon,
|
|
652
|
+
...category.session,
|
|
653
|
+
...durationEvent,
|
|
654
|
+
name: z2.literal("regionSemanticCheck"),
|
|
655
|
+
args: z2.object({
|
|
656
|
+
file: absolutePath,
|
|
657
|
+
configFilePath: absolutePath
|
|
658
|
+
})
|
|
659
|
+
}).strict();
|
|
660
|
+
var event_session__request = z2.object({
|
|
661
|
+
...eventCommon,
|
|
662
|
+
...category.session,
|
|
663
|
+
...instantEvent,
|
|
664
|
+
name: z2.literal("request"),
|
|
665
|
+
args: z2.object({
|
|
666
|
+
seq: z2.number().int().nonnegative(),
|
|
667
|
+
command: z2.string()
|
|
668
|
+
})
|
|
669
|
+
}).strict();
|
|
670
|
+
var event_session__response = z2.object({
|
|
671
|
+
...eventCommon,
|
|
672
|
+
...category.session,
|
|
673
|
+
...instantEvent,
|
|
674
|
+
name: z2.literal("response"),
|
|
675
|
+
args: z2.object({
|
|
676
|
+
seq: z2.number().int().nonnegative(),
|
|
677
|
+
command: z2.string(),
|
|
678
|
+
success: z2.boolean()
|
|
679
|
+
})
|
|
680
|
+
}).strict();
|
|
681
|
+
var event_session__semanticCheck = z2.object({
|
|
682
|
+
...eventCommon,
|
|
683
|
+
...category.session,
|
|
684
|
+
...durationEvent,
|
|
685
|
+
name: z2.literal("semanticCheck"),
|
|
686
|
+
args: z2.object({
|
|
687
|
+
file: absolutePath,
|
|
688
|
+
configFilePath: absolutePath
|
|
689
|
+
})
|
|
690
|
+
}).strict();
|
|
691
|
+
var event_session__stepAction = z2.object({
|
|
692
|
+
...eventCommon,
|
|
693
|
+
...category.session,
|
|
694
|
+
...instantEvent,
|
|
695
|
+
name: z2.literal("stepAction"),
|
|
696
|
+
s: z2.union([
|
|
697
|
+
z2.literal(instantScope.global),
|
|
698
|
+
z2.literal(instantScope.thread),
|
|
699
|
+
z2.literal(instantScope.process)
|
|
700
|
+
]),
|
|
701
|
+
args: z2.object({
|
|
702
|
+
seq: z2.number().int().nonnegative()
|
|
703
|
+
})
|
|
704
|
+
}).strict();
|
|
705
|
+
var event_session__stepCanceled = z2.object({
|
|
706
|
+
...eventCommon,
|
|
707
|
+
...category.session,
|
|
708
|
+
...instantEvent,
|
|
709
|
+
name: z2.literal("stepCanceled"),
|
|
710
|
+
args: z2.object({
|
|
711
|
+
seq: z2.number().int().nonnegative(),
|
|
712
|
+
early: z2.literal(true).optional()
|
|
713
|
+
})
|
|
714
|
+
}).strict();
|
|
715
|
+
var event_session__stepError = z2.object({
|
|
716
|
+
...eventCommon,
|
|
717
|
+
...category.session,
|
|
718
|
+
...instantEvent,
|
|
719
|
+
name: z2.literal("stepError"),
|
|
720
|
+
args: z2.object({
|
|
721
|
+
seq: z2.number().int().nonnegative(),
|
|
722
|
+
message: z2.string()
|
|
723
|
+
})
|
|
724
|
+
}).strict();
|
|
725
|
+
var event_session__suggestionCheck = z2.object({
|
|
726
|
+
...eventCommon,
|
|
727
|
+
...category.session,
|
|
728
|
+
...durationEvent,
|
|
729
|
+
name: z2.literal("suggestionCheck"),
|
|
730
|
+
args: z2.object({
|
|
731
|
+
file: absolutePath,
|
|
732
|
+
configFilePath: absolutePath
|
|
733
|
+
})
|
|
734
|
+
}).strict();
|
|
735
|
+
var event_session__syntacticCheck = z2.object({
|
|
736
|
+
...eventCommon,
|
|
737
|
+
...category.session,
|
|
738
|
+
...durationEvent,
|
|
739
|
+
name: z2.literal("syntacticCheck"),
|
|
740
|
+
args: z2.object({
|
|
741
|
+
file: absolutePath,
|
|
742
|
+
configFilePath: absolutePath
|
|
743
|
+
})
|
|
744
|
+
}).strict();
|
|
745
|
+
var event_session__updateGraph = z2.object({
|
|
746
|
+
...eventCommon,
|
|
747
|
+
...category.session,
|
|
748
|
+
...durationEvent,
|
|
749
|
+
name: z2.literal("updateGraph"),
|
|
750
|
+
args: z2.object({
|
|
751
|
+
name: z2.string(),
|
|
752
|
+
kind: z2.union([
|
|
753
|
+
z2.literal(0),
|
|
754
|
+
//"Inferred
|
|
755
|
+
z2.literal(1),
|
|
756
|
+
// Configured"
|
|
757
|
+
z2.literal(2),
|
|
758
|
+
// "Inferred"
|
|
759
|
+
z2.literal(3),
|
|
760
|
+
// "External"
|
|
761
|
+
z2.literal(4),
|
|
762
|
+
// "AutoImportProvider"
|
|
763
|
+
z2.literal(5)
|
|
764
|
+
// "Auxiliary"
|
|
765
|
+
])
|
|
766
|
+
})
|
|
767
|
+
}).strict();
|
|
768
|
+
var traceEvent = z2.discriminatedUnion(
|
|
769
|
+
"name",
|
|
770
|
+
[
|
|
771
|
+
event_metadata__TracingStartedInBrowser,
|
|
772
|
+
event_metadata__process_name,
|
|
773
|
+
event_metadata__thread_name,
|
|
774
|
+
event_parse__createSourceFile,
|
|
775
|
+
event_parse__parseJsonSourceFileConfigFileContent,
|
|
776
|
+
event_program__createProgram,
|
|
777
|
+
event_program__findSourceFile,
|
|
778
|
+
event_program__processRootFiles,
|
|
779
|
+
event_program__processTypeReferenceDirective,
|
|
780
|
+
event_program__processTypeReferences,
|
|
781
|
+
event_program__resolveLibrary,
|
|
782
|
+
event_program__resolveModuleNamesWorker,
|
|
783
|
+
event_program__resolveTypeReferenceDirectiveNamesWorker,
|
|
784
|
+
event_program__shouldProgramCreateNewSourceFiles,
|
|
785
|
+
event_program__tryReuseStructureFromOldProgram,
|
|
786
|
+
event_bind__bindSourceFile,
|
|
787
|
+
event_check__checkExpression,
|
|
788
|
+
event_check__checkSourceFile,
|
|
789
|
+
event_check__checkVariableDeclaration,
|
|
790
|
+
event_check__checkDeferredNode,
|
|
791
|
+
event_check__checkSourceFileNodes,
|
|
792
|
+
event_checktypes__checkTypeParameterDeferred,
|
|
793
|
+
event_checktypes__getVariancesWorker,
|
|
794
|
+
event_checktypes__structuredTypeRelatedTo,
|
|
795
|
+
...depthLimits,
|
|
796
|
+
event_emit__emit,
|
|
797
|
+
event_emit__emitBuildInfo,
|
|
798
|
+
event_emit__emitDeclarationFileOrBundle,
|
|
799
|
+
event_emit__emitJsFileOrBundle,
|
|
800
|
+
event_emit__transformNodes,
|
|
801
|
+
event_session__cancellationThrown,
|
|
802
|
+
event_session__commandCanceled,
|
|
803
|
+
event_session__commandError,
|
|
804
|
+
event_session__createConfiguredProject,
|
|
805
|
+
event_session__createdDocumentRegistryBucket,
|
|
806
|
+
event_session__documentRegistryBucketOverlap,
|
|
807
|
+
event_session__executeCommand,
|
|
808
|
+
event_session__finishCachingPerDirectoryResolution,
|
|
809
|
+
event_session__getPackageJsonAutoImportProvider,
|
|
810
|
+
event_session__getUnresolvedImports,
|
|
811
|
+
event_session__loadConfiguredProject,
|
|
812
|
+
event_session__regionSemanticCheck,
|
|
813
|
+
event_session__request,
|
|
814
|
+
event_session__response,
|
|
815
|
+
event_session__semanticCheck,
|
|
816
|
+
event_session__stepAction,
|
|
817
|
+
event_session__stepCanceled,
|
|
818
|
+
event_session__stepError,
|
|
819
|
+
event_session__suggestionCheck,
|
|
820
|
+
event_session__syntacticCheck,
|
|
821
|
+
event_session__updateGraph
|
|
822
|
+
],
|
|
823
|
+
{
|
|
824
|
+
// errorMap: (issue, ctx) => ({
|
|
825
|
+
// // prettier-ignore
|
|
826
|
+
// message: issue.code === "invalid_union_discriminator" ?
|
|
827
|
+
// `Invalid discriminator value. Expected ${issue.options.map(opt => `'${String(opt)}'`).join(' | ')}, got '${ctx.data.type}'.`
|
|
828
|
+
// : ctx.defaultError,
|
|
829
|
+
// }),
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
var traceJsonSchema = z2.array(traceEvent);
|
|
833
|
+
var ALL_LIFE_IS_SUFFERING_THAT_BASKS_IN_NOTHINGNESS___ALL_LIFE_IS_TEMPORARY___WHAT_LASTS_IS_CONSCIOUSNESS = [{ id: 0, recursionId: -1, flags: [] }];
|
|
834
|
+
var createTypeRegistry = (typesJson) => {
|
|
835
|
+
return ALL_LIFE_IS_SUFFERING_THAT_BASKS_IN_NOTHINGNESS___ALL_LIFE_IS_TEMPORARY___WHAT_LASTS_IS_CONSCIOUSNESS.concat(
|
|
836
|
+
typesJson
|
|
837
|
+
);
|
|
838
|
+
};
|
|
839
|
+
var TYPES_JSON_FILENAME = "types.json";
|
|
840
|
+
var flag = z3.enum([
|
|
841
|
+
"Any",
|
|
842
|
+
"Unknown",
|
|
843
|
+
"String",
|
|
844
|
+
"Number",
|
|
845
|
+
"Boolean",
|
|
846
|
+
"Enum",
|
|
847
|
+
"BigInt",
|
|
848
|
+
"StringLiteral",
|
|
849
|
+
"NumberLiteral",
|
|
850
|
+
"BooleanLiteral",
|
|
851
|
+
"EnumLiteral",
|
|
852
|
+
"BigIntLiteral",
|
|
853
|
+
"ESSymbol",
|
|
854
|
+
"UniqueESSymbol",
|
|
855
|
+
"Void",
|
|
856
|
+
"Undefined",
|
|
857
|
+
"Null",
|
|
858
|
+
"Never",
|
|
859
|
+
"TypeParameter",
|
|
860
|
+
"Object",
|
|
861
|
+
"Union",
|
|
862
|
+
"Intersection",
|
|
863
|
+
"Index",
|
|
864
|
+
"IndexedAccess",
|
|
865
|
+
"Conditional",
|
|
866
|
+
"Substitution",
|
|
867
|
+
"NonPrimitive",
|
|
868
|
+
"TemplateLiteral",
|
|
869
|
+
"StringMapping",
|
|
870
|
+
"Reserved1",
|
|
871
|
+
"Reserved2",
|
|
872
|
+
"AnyOrUnknown",
|
|
873
|
+
"Nullable",
|
|
874
|
+
"Literal",
|
|
875
|
+
"Unit",
|
|
876
|
+
"Freshable",
|
|
877
|
+
"StringOrNumberLiteral",
|
|
878
|
+
"StringOrNumberLiteralOrUnique",
|
|
879
|
+
"DefinitelyFalsy",
|
|
880
|
+
"PossiblyFalsy",
|
|
881
|
+
"Intrinsic",
|
|
882
|
+
"StringLike",
|
|
883
|
+
"NumberLike",
|
|
884
|
+
"BigIntLike",
|
|
885
|
+
"BooleanLike",
|
|
886
|
+
"EnumLike",
|
|
887
|
+
"ESSymbolLike",
|
|
888
|
+
"VoidLike",
|
|
889
|
+
"Primitive",
|
|
890
|
+
"DefinitelyNonNullable",
|
|
891
|
+
"DisjointDomains",
|
|
892
|
+
"UnionOrIntersection",
|
|
893
|
+
"StructuredType",
|
|
894
|
+
"TypeVariable",
|
|
895
|
+
"InstantiableNonPrimitive",
|
|
896
|
+
"InstantiablePrimitive",
|
|
897
|
+
"Instantiable",
|
|
898
|
+
"StructuredOrInstantiable",
|
|
899
|
+
"ObjectFlagsType",
|
|
900
|
+
"Simplifiable",
|
|
901
|
+
"Singleton",
|
|
902
|
+
"Narrowable",
|
|
903
|
+
"IncludesMask",
|
|
904
|
+
"IncludesMissingType",
|
|
905
|
+
"IncludesNonWideningType",
|
|
906
|
+
"IncludesWildcard",
|
|
907
|
+
"IncludesEmptyObject",
|
|
908
|
+
"IncludesInstantiable",
|
|
909
|
+
"IncludesConstrainedTypeVariable",
|
|
910
|
+
"IncludesError",
|
|
911
|
+
"NotPrimitiveUnion"
|
|
912
|
+
]);
|
|
913
|
+
var resolvedType = z3.object({
|
|
914
|
+
id: typeId,
|
|
915
|
+
flags: z3.array(flag),
|
|
916
|
+
recursionId: z3.number().optional(),
|
|
917
|
+
intrinsicName: z3.enum([
|
|
918
|
+
"any",
|
|
919
|
+
"error",
|
|
920
|
+
"unresolved",
|
|
921
|
+
"unknown",
|
|
922
|
+
"true",
|
|
923
|
+
"false",
|
|
924
|
+
"never",
|
|
925
|
+
"void",
|
|
926
|
+
"symbol",
|
|
927
|
+
"bigint",
|
|
928
|
+
"null",
|
|
929
|
+
"undefined",
|
|
930
|
+
"intrinsic",
|
|
931
|
+
"object",
|
|
932
|
+
"boolean",
|
|
933
|
+
"number",
|
|
934
|
+
"string"
|
|
935
|
+
]).optional(),
|
|
936
|
+
firstDeclaration: location.optional(),
|
|
937
|
+
referenceLocation: location.optional(),
|
|
938
|
+
destructuringPattern: location.optional(),
|
|
939
|
+
// TODO, awards for all of these
|
|
940
|
+
typeArguments: z3.array(typeId).optional(),
|
|
941
|
+
unionTypes: z3.array(typeId).optional(),
|
|
942
|
+
intersectionTypes: z3.array(typeId).optional(),
|
|
943
|
+
aliasTypeArguments: z3.array(typeId).optional(),
|
|
944
|
+
instantiatedType: typeId.optional(),
|
|
945
|
+
substitutionBaseType: typeId.optional(),
|
|
946
|
+
constraintType: typeId.optional(),
|
|
947
|
+
indexedAccessObjectType: typeId.optional(),
|
|
948
|
+
indexedAccessIndexType: typeId.optional(),
|
|
949
|
+
conditionalCheckType: typeId.optional(),
|
|
950
|
+
conditionalExtendsType: typeId.optional(),
|
|
951
|
+
conditionalTrueType: typeId.optional(),
|
|
952
|
+
conditionalFalseType: typeId.optional(),
|
|
953
|
+
keyofType: typeId.optional(),
|
|
954
|
+
aliasType: typeId.optional(),
|
|
955
|
+
evolvingArrayElementType: typeId.optional(),
|
|
956
|
+
evolvingArrayFinalType: typeId.optional(),
|
|
957
|
+
reverseMappedSourceType: typeId.optional(),
|
|
958
|
+
reverseMappedMappedType: typeId.optional(),
|
|
959
|
+
reverseMappedConstraintType: typeId.optional(),
|
|
960
|
+
isTuple: z3.literal(true).optional(),
|
|
961
|
+
symbolName: z3.string().optional(),
|
|
962
|
+
display: z3.string().optional()
|
|
963
|
+
}).strict();
|
|
964
|
+
var typesJsonSchema = z3.array(resolvedType);
|
|
965
|
+
|
|
966
|
+
// src/constants.ts
|
|
967
|
+
var ANALYZE_TRACE_FILENAME = "analyze-trace.json";
|
|
968
|
+
|
|
969
|
+
// src/depth-limits.ts
|
|
27
970
|
var createDepthLimits = (traceFile) => {
|
|
28
971
|
const limitNamesSet = new Set(
|
|
29
972
|
depthLimits.map((d) => d.shape.name)
|
|
@@ -103,9 +1046,6 @@ var getDuplicateNodeModules = async (nodeModulePaths2) => {
|
|
|
103
1046
|
|
|
104
1047
|
// src/get-hotspots.ts
|
|
105
1048
|
import { normalize } from "path";
|
|
106
|
-
import {
|
|
107
|
-
createTypeRegistry
|
|
108
|
-
} from "@typeslayer/validate";
|
|
109
1049
|
var getHotspots = async (hotPathsTree, typesFile, options) => getHotspotsWorker({
|
|
110
1050
|
span: hotPathsTree,
|
|
111
1051
|
currentFile: void 0,
|
|
@@ -183,8 +1123,8 @@ function getHotType({
|
|
|
183
1123
|
if (!Array.isArray(typeIds)) {
|
|
184
1124
|
throw new Error(`Expected array for ${property}`);
|
|
185
1125
|
}
|
|
186
|
-
for (const
|
|
187
|
-
const child = worker(
|
|
1126
|
+
for (const typeId2 of typeIds) {
|
|
1127
|
+
const child = worker(typeId2, ancestorIds);
|
|
188
1128
|
if (child) {
|
|
189
1129
|
children.push(child);
|
|
190
1130
|
}
|
|
@@ -207,8 +1147,8 @@ function getHotType({
|
|
|
207
1147
|
case "reverseMappedMappedType":
|
|
208
1148
|
case "reverseMappedSourceType":
|
|
209
1149
|
case "substitutionBaseType": {
|
|
210
|
-
const
|
|
211
|
-
const child = worker(
|
|
1150
|
+
const typeId2 = resolvedType2[property];
|
|
1151
|
+
const child = worker(typeId2, ancestorIds);
|
|
212
1152
|
if (child) {
|
|
213
1153
|
children.push(child);
|
|
214
1154
|
}
|
|
@@ -300,9 +1240,6 @@ async function makeHotFrame({
|
|
|
300
1240
|
}
|
|
301
1241
|
|
|
302
1242
|
// src/node-module-paths.ts
|
|
303
|
-
import {
|
|
304
|
-
packageNameRegex
|
|
305
|
-
} from "@typeslayer/validate";
|
|
306
1243
|
function getNodeModulePaths(traceJson) {
|
|
307
1244
|
const nodeModulePaths2 = {};
|
|
308
1245
|
traceJson.forEach((event) => {
|
|
@@ -336,9 +1273,6 @@ function getNodeModulePaths(traceJson) {
|
|
|
336
1273
|
}
|
|
337
1274
|
|
|
338
1275
|
// src/spans.ts
|
|
339
|
-
import {
|
|
340
|
-
eventPhase
|
|
341
|
-
} from "@typeslayer/validate";
|
|
342
1276
|
function createSpans(traceFile) {
|
|
343
1277
|
const unclosedStack = [];
|
|
344
1278
|
const spans = [];
|
|
@@ -439,20 +1373,8 @@ function createSpanTree(parseResult2, options) {
|
|
|
439
1373
|
// src/utils.ts
|
|
440
1374
|
import { existsSync as existsSync2 } from "fs";
|
|
441
1375
|
import { stat } from "fs/promises";
|
|
442
|
-
import {
|
|
443
|
-
|
|
444
|
-
event_checktypes__checkTypeRelatedTo_DepthLimit as event_checktypes__checkTypeRelatedTo_DepthLimit2,
|
|
445
|
-
event_checktypes__getTypeAtFlowNode_DepthLimit as event_checktypes__getTypeAtFlowNode_DepthLimit2,
|
|
446
|
-
event_checktypes__instantiateType_DepthLimit as event_checktypes__instantiateType_DepthLimit2,
|
|
447
|
-
event_checktypes__recursiveTypeRelatedTo_DepthLimit as event_checktypes__recursiveTypeRelatedTo_DepthLimit2,
|
|
448
|
-
event_checktypes__removeSubtypes_DepthLimit as event_checktypes__removeSubtypes_DepthLimit2,
|
|
449
|
-
event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit as event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit2,
|
|
450
|
-
event_checktypes__typeRelatedToDiscriminatedType_DepthLimit as event_checktypes__typeRelatedToDiscriminatedType_DepthLimit2,
|
|
451
|
-
resolvedType,
|
|
452
|
-
traceEvent
|
|
453
|
-
} from "@typeslayer/validate";
|
|
454
|
-
import { z } from "zod/v4";
|
|
455
|
-
var absolutePath = z.string().refine(
|
|
1376
|
+
import { z as z4 } from "zod/v4";
|
|
1377
|
+
var absolutePath2 = z4.string().refine(
|
|
456
1378
|
(path) => {
|
|
457
1379
|
return path.startsWith("/") || path.startsWith("C:\\") || path.startsWith("D:\\");
|
|
458
1380
|
},
|
|
@@ -460,81 +1382,81 @@ var absolutePath = z.string().refine(
|
|
|
460
1382
|
message: "Path must be absolute"
|
|
461
1383
|
}
|
|
462
1384
|
);
|
|
463
|
-
var project =
|
|
464
|
-
configFilePath:
|
|
465
|
-
tracePath:
|
|
466
|
-
typesPath:
|
|
1385
|
+
var project = z4.object({
|
|
1386
|
+
configFilePath: absolutePath2.optional(),
|
|
1387
|
+
tracePath: absolutePath2,
|
|
1388
|
+
typesPath: absolutePath2
|
|
467
1389
|
});
|
|
468
|
-
var projectResult =
|
|
1390
|
+
var projectResult = z4.object({
|
|
469
1391
|
project,
|
|
470
|
-
stdout:
|
|
471
|
-
stderr:
|
|
472
|
-
exitCode:
|
|
473
|
-
signal:
|
|
1392
|
+
stdout: z4.string(),
|
|
1393
|
+
stderr: z4.string(),
|
|
1394
|
+
exitCode: z4.number().optional(),
|
|
1395
|
+
signal: z4.enum(["SIGINT", "SIGTERM"]).optional()
|
|
474
1396
|
});
|
|
475
|
-
var hotType =
|
|
1397
|
+
var hotType = z4.object({
|
|
476
1398
|
resolvedType,
|
|
477
1399
|
get children() {
|
|
478
|
-
return
|
|
1400
|
+
return z4.array(hotType);
|
|
479
1401
|
}
|
|
480
1402
|
});
|
|
481
|
-
var hotSpot =
|
|
482
|
-
description:
|
|
483
|
-
timeMs:
|
|
1403
|
+
var hotSpot = z4.object({
|
|
1404
|
+
description: z4.string(),
|
|
1405
|
+
timeMs: z4.number(),
|
|
484
1406
|
get children() {
|
|
485
|
-
return
|
|
1407
|
+
return z4.array(hotSpot);
|
|
486
1408
|
},
|
|
487
|
-
path:
|
|
488
|
-
types:
|
|
489
|
-
startLine:
|
|
490
|
-
startChar:
|
|
491
|
-
startOffset:
|
|
492
|
-
endLine:
|
|
493
|
-
endChar:
|
|
494
|
-
endOffset:
|
|
1409
|
+
path: absolutePath2.optional(),
|
|
1410
|
+
types: z4.array(hotType).optional(),
|
|
1411
|
+
startLine: z4.number().optional(),
|
|
1412
|
+
startChar: z4.number().optional(),
|
|
1413
|
+
startOffset: z4.number().optional(),
|
|
1414
|
+
endLine: z4.number().optional(),
|
|
1415
|
+
endChar: z4.number().optional(),
|
|
1416
|
+
endOffset: z4.number().optional()
|
|
495
1417
|
});
|
|
496
|
-
var duplicatedPackageInstance =
|
|
497
|
-
path:
|
|
498
|
-
version:
|
|
1418
|
+
var duplicatedPackageInstance = z4.object({
|
|
1419
|
+
path: absolutePath2,
|
|
1420
|
+
version: z4.string()
|
|
499
1421
|
});
|
|
500
|
-
var duplicatedPackage =
|
|
501
|
-
name:
|
|
502
|
-
instances:
|
|
1422
|
+
var duplicatedPackage = z4.object({
|
|
1423
|
+
name: z4.string(),
|
|
1424
|
+
instances: z4.array(duplicatedPackageInstance)
|
|
503
1425
|
});
|
|
504
|
-
var rootSpan =
|
|
505
|
-
name:
|
|
506
|
-
cat:
|
|
1426
|
+
var rootSpan = z4.object({
|
|
1427
|
+
name: z4.literal("root"),
|
|
1428
|
+
cat: z4.literal("program")
|
|
507
1429
|
});
|
|
508
|
-
var eventSpan =
|
|
509
|
-
event:
|
|
510
|
-
start:
|
|
511
|
-
end:
|
|
512
|
-
duration:
|
|
1430
|
+
var eventSpan = z4.object({
|
|
1431
|
+
event: z4.union([traceEvent, rootSpan]),
|
|
1432
|
+
start: z4.number(),
|
|
1433
|
+
end: z4.number(),
|
|
1434
|
+
duration: z4.number(),
|
|
513
1435
|
get children() {
|
|
514
|
-
return
|
|
1436
|
+
return z4.array(eventSpan);
|
|
515
1437
|
}
|
|
516
1438
|
});
|
|
517
|
-
var microseconds =
|
|
518
|
-
var packageName =
|
|
519
|
-
var packagePath =
|
|
520
|
-
var nodeModulePaths =
|
|
521
|
-
var parseResult =
|
|
522
|
-
firstSpanStart:
|
|
523
|
-
lastSpanEnd:
|
|
524
|
-
spans:
|
|
525
|
-
unclosedStack:
|
|
1439
|
+
var microseconds = z4.number();
|
|
1440
|
+
var packageName = z4.string();
|
|
1441
|
+
var packagePath = z4.string();
|
|
1442
|
+
var nodeModulePaths = z4.record(packageName, z4.array(packagePath));
|
|
1443
|
+
var parseResult = z4.object({
|
|
1444
|
+
firstSpanStart: z4.number(),
|
|
1445
|
+
lastSpanEnd: z4.number(),
|
|
1446
|
+
spans: z4.array(eventSpan),
|
|
1447
|
+
unclosedStack: z4.array(traceEvent)
|
|
526
1448
|
});
|
|
527
|
-
var analyzeTraceOptions =
|
|
1449
|
+
var analyzeTraceOptions = z4.object({
|
|
528
1450
|
/** Events of at least this duration (in milliseconds) will reported unconditionally */
|
|
529
|
-
forceMillis:
|
|
1451
|
+
forceMillis: z4.number(),
|
|
530
1452
|
/** Events of less than this duration (in milliseconds) will suppressed unconditionally */
|
|
531
|
-
skipMillis:
|
|
1453
|
+
skipMillis: z4.number(),
|
|
532
1454
|
/** Expand types when printing */
|
|
533
|
-
expandTypes:
|
|
1455
|
+
expandTypes: z4.boolean(),
|
|
534
1456
|
/** force showing spans that are some percentage of their parent, independent of parent time */
|
|
535
|
-
minSpanParentPercentage:
|
|
1457
|
+
minSpanParentPercentage: z4.number(),
|
|
536
1458
|
/** the minimum number of emitted imports from a declaration file or bundle */
|
|
537
|
-
importExpressionThreshold:
|
|
1459
|
+
importExpressionThreshold: z4.number()
|
|
538
1460
|
});
|
|
539
1461
|
var isFile = async (path) => {
|
|
540
1462
|
return stat(path).then((stats) => stats.isFile()).catch((_) => false);
|
|
@@ -545,40 +1467,40 @@ var throwIfNotDirectory = async (path) => {
|
|
|
545
1467
|
}
|
|
546
1468
|
return path;
|
|
547
1469
|
};
|
|
548
|
-
var analyzeTraceResult =
|
|
1470
|
+
var analyzeTraceResult = z4.object({
|
|
549
1471
|
/** Events that were not closed */
|
|
550
|
-
unterminatedEvents:
|
|
1472
|
+
unterminatedEvents: z4.array(traceEvent),
|
|
551
1473
|
/** Hot spots in the trace */
|
|
552
|
-
hotSpots:
|
|
1474
|
+
hotSpots: z4.array(hotSpot),
|
|
553
1475
|
/** Packages that are duplicated in the trace */
|
|
554
|
-
duplicatePackages:
|
|
1476
|
+
duplicatePackages: z4.array(duplicatedPackage),
|
|
555
1477
|
/** Paths to all node modules used in the trace */
|
|
556
1478
|
nodeModulePaths,
|
|
557
1479
|
/** Depth limit events grouped by their event name */
|
|
558
|
-
depthLimits:
|
|
559
|
-
checkCrossProductUnion_DepthLimit:
|
|
560
|
-
|
|
1480
|
+
depthLimits: z4.object({
|
|
1481
|
+
checkCrossProductUnion_DepthLimit: z4.array(
|
|
1482
|
+
event_checktypes__checkCrossProductUnion_DepthLimit
|
|
561
1483
|
),
|
|
562
|
-
checkTypeRelatedTo_DepthLimit:
|
|
563
|
-
|
|
1484
|
+
checkTypeRelatedTo_DepthLimit: z4.array(
|
|
1485
|
+
event_checktypes__checkTypeRelatedTo_DepthLimit
|
|
564
1486
|
),
|
|
565
|
-
getTypeAtFlowNode_DepthLimit:
|
|
566
|
-
|
|
1487
|
+
getTypeAtFlowNode_DepthLimit: z4.array(
|
|
1488
|
+
event_checktypes__getTypeAtFlowNode_DepthLimit
|
|
567
1489
|
),
|
|
568
|
-
instantiateType_DepthLimit:
|
|
569
|
-
|
|
1490
|
+
instantiateType_DepthLimit: z4.array(
|
|
1491
|
+
event_checktypes__instantiateType_DepthLimit
|
|
570
1492
|
),
|
|
571
|
-
recursiveTypeRelatedTo_DepthLimit:
|
|
572
|
-
|
|
1493
|
+
recursiveTypeRelatedTo_DepthLimit: z4.array(
|
|
1494
|
+
event_checktypes__recursiveTypeRelatedTo_DepthLimit
|
|
573
1495
|
),
|
|
574
|
-
removeSubtypes_DepthLimit:
|
|
575
|
-
|
|
1496
|
+
removeSubtypes_DepthLimit: z4.array(
|
|
1497
|
+
event_checktypes__removeSubtypes_DepthLimit
|
|
576
1498
|
),
|
|
577
|
-
traceUnionsOrIntersectionsTooLarge_DepthLimit:
|
|
578
|
-
|
|
1499
|
+
traceUnionsOrIntersectionsTooLarge_DepthLimit: z4.array(
|
|
1500
|
+
event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit
|
|
579
1501
|
),
|
|
580
|
-
typeRelatedToDiscriminatedType_DepthLimit:
|
|
581
|
-
|
|
1502
|
+
typeRelatedToDiscriminatedType_DepthLimit: z4.array(
|
|
1503
|
+
event_checktypes__typeRelatedToDiscriminatedType_DepthLimit
|
|
582
1504
|
)
|
|
583
1505
|
})
|
|
584
1506
|
});
|
|
@@ -643,7 +1565,7 @@ var analyzeTrace = async ({
|
|
|
643
1565
|
};
|
|
644
1566
|
export {
|
|
645
1567
|
ANALYZE_TRACE_FILENAME,
|
|
646
|
-
absolutePath,
|
|
1568
|
+
absolutePath2 as absolutePath,
|
|
647
1569
|
analyzeTrace,
|
|
648
1570
|
analyzeTraceOptions,
|
|
649
1571
|
analyzeTraceResult,
|