@gql.tada/cli-utils 1.7.3 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,212 +1,614 @@
1
1
  import e from "typescript";
2
2
 
3
- import * as r from "node:path";
3
+ import r from "node:v8";
4
4
 
5
- import { getSchemaNamesFromConfig as a } from "@gql.tada/internal";
5
+ import t from "node:vm";
6
6
 
7
- import { findAllCallExpressions as t } from "@0no-co/graphqlsp/api";
7
+ import * as a from "node:fs";
8
8
 
9
- import { e as i } from "./index-chunk2.mjs";
9
+ import * as i from "node:path";
10
10
 
11
- import { p as o } from "./index-chunk.mjs";
11
+ import * as n from "node:crypto";
12
12
 
13
- function traceCallToImportSource(r, a, t) {
14
- var i = t.getTypeChecker();
15
- var o = r.expression;
16
- var s;
17
- if (e.isIdentifier(o)) {
18
- s = o;
19
- } else if (e.isPropertyAccessExpression(o) && e.isIdentifier(o.expression)) {
20
- s = o.expression;
13
+ import { getSchemaNamesFromConfig as o, getSchemaConfigForName as s } from "@gql.tada/internal";
14
+
15
+ import { findAllCallExpressions as u } from "@0no-co/graphqlsp/api";
16
+
17
+ import { e as l } from "./index-chunk2.mjs";
18
+
19
+ import { p as c } from "./index-chunk.mjs";
20
+
21
+ var f = /@gql\.tada\/hash\s+([^\s*]+)/;
22
+
23
+ function getHashComment(r, t) {
24
+ var a = e.getLeadingCommentRanges(r, t.pos) || [];
25
+ for (var i = a.length - 1; i >= 0; i--) {
26
+ var n = r.slice(a[i].pos, a[i].end);
27
+ var o = f.exec(n);
28
+ if (o) {
29
+ return o[1];
30
+ }
21
31
  }
22
- if (!s) {
23
- return;
32
+ return;
33
+ }
34
+
35
+ var p = "turbo-document-hash-v1";
36
+
37
+ function createDocumentHasher(r) {
38
+ var t = new WeakMap;
39
+ var a = new Map;
40
+ var i = new WeakSet;
41
+ var hashCallExpression = (e, r) => {
42
+ var a = r || "";
43
+ var n = t.get(e)?.get(a);
44
+ if (n) {
45
+ return n;
46
+ } else if (i.has(e)) {
47
+ return {
48
+ hashable: !1
49
+ };
50
+ }
51
+ i.add(e);
52
+ var o = computeCallExpressionHash(e, r);
53
+ i.delete(e);
54
+ var s = t.get(e);
55
+ if (!s) {
56
+ s = new Map;
57
+ t.set(e, s);
58
+ }
59
+ s.set(a, o);
60
+ return o;
61
+ };
62
+ var computeCallExpressionHash = (t, a) => {
63
+ var i = function getStaticStringValue(r) {
64
+ if (!r) {
65
+ return;
66
+ }
67
+ r = unwrapExpression(r);
68
+ if (e.isStringLiteral(r) || e.isNoSubstitutionTemplateLiteral(r)) {
69
+ return r.text;
70
+ }
71
+ return;
72
+ }(t.arguments[0]);
73
+ if (null == i) {
74
+ return {
75
+ hashable: !1
76
+ };
77
+ }
78
+ var o = getFragmentHashes(t.arguments[1], a);
79
+ if (!o) {
80
+ return {
81
+ hashable: !1
82
+ };
83
+ }
84
+ var s = n.createHash("sha256");
85
+ addHashPart(s, p);
86
+ addHashPart(s, a || "");
87
+ addHashPart(s, r.schemaFingerprints.get(a) || "");
88
+ addHashPart(s, i);
89
+ for (var u of o) {
90
+ addHashPart(s, u);
91
+ }
92
+ return {
93
+ hashable: !0,
94
+ documentHash: `sha256:${s.digest("hex").slice(0, 32)}`
95
+ };
96
+ };
97
+ var getFragmentHashes = (r, t) => {
98
+ if (!r) {
99
+ return [];
100
+ }
101
+ r = unwrapExpression(r);
102
+ if (e.isArrayLiteralExpression(r)) {
103
+ var a = [];
104
+ for (var i of r.elements) {
105
+ if (e.isSpreadElement(i)) {
106
+ var n = getFragmentHashes(i.expression, t);
107
+ if (!n) {
108
+ return null;
109
+ }
110
+ a.push(...n);
111
+ continue;
112
+ }
113
+ var o = resolveDocumentCallExpression(i);
114
+ if (!o) {
115
+ return null;
116
+ }
117
+ var s = hashCallExpression(o, t);
118
+ if (!s.hashable || !s.documentHash) {
119
+ return null;
120
+ }
121
+ a.push(s.documentHash);
122
+ }
123
+ return a;
124
+ }
125
+ var u = resolveDeclarationInitializer(r);
126
+ if (u && u !== r) {
127
+ return getFragmentHashes(u, t);
128
+ }
129
+ return null;
130
+ };
131
+ var resolveDocumentCallExpression = r => {
132
+ r = unwrapExpression(r);
133
+ if (e.isCallExpression(r)) {
134
+ return r;
135
+ }
136
+ var t = getSymbol(r);
137
+ if (!t) {
138
+ return null;
139
+ }
140
+ var i = a.get(t);
141
+ if (void 0 !== i) {
142
+ return i;
143
+ }
144
+ var n = resolveSymbolCallExpression(t);
145
+ a.set(t, n);
146
+ return n;
147
+ };
148
+ var resolveDeclarationInitializer = r => {
149
+ var t = getSymbol(r);
150
+ if (!t) {
151
+ return null;
152
+ }
153
+ for (var a of t.declarations || []) {
154
+ if (e.isVariableDeclaration(a) && a.initializer) {
155
+ return a.initializer;
156
+ }
157
+ }
158
+ return null;
159
+ };
160
+ var resolveSymbolCallExpression = r => {
161
+ for (var t of r.declarations || []) {
162
+ if (e.isVariableDeclaration(t) && t.initializer) {
163
+ var a = unwrapExpression(t.initializer);
164
+ if (e.isCallExpression(a)) {
165
+ return a;
166
+ }
167
+ }
168
+ }
169
+ return null;
170
+ };
171
+ var getSymbol = t => {
172
+ var a = r.checker.getSymbolAtLocation(t);
173
+ if (a && a.flags & e.SymbolFlags.Alias) {
174
+ a = r.checker.getAliasedSymbol(a);
175
+ }
176
+ return a;
177
+ };
178
+ return {
179
+ hashCallExpression
180
+ };
181
+ }
182
+
183
+ function unwrapExpression(r) {
184
+ while (e.isParenthesizedExpression(r) || e.isAsExpression(r) || e.isTypeAssertionExpression(r) || e.isSatisfiesExpression(r) || e.isNonNullExpression(r)) {
185
+ r = r.expression;
186
+ }
187
+ return r;
188
+ }
189
+
190
+ function addHashPart(e, r) {
191
+ e.update(`${r.length}:`);
192
+ e.update(r);
193
+ e.update("\0");
194
+ }
195
+
196
+ var d = /(?:^|[^\w])(query|mutation|subscription|fragment)\b/;
197
+
198
+ function hasGraphQLDocumentCandidate(r) {
199
+ if (!r.text.includes("{")) {
200
+ return !1;
201
+ }
202
+ var t = !1;
203
+ var visit = r => {
204
+ if (t) {
205
+ return;
206
+ }
207
+ if (e.isCallExpression(r)) {
208
+ var a = r.arguments[0];
209
+ if (a && e.isStringLiteralLike(a)) {
210
+ var i = a.text;
211
+ if (i.includes("{") && function isGraphQLDocumentCandidateText(e) {
212
+ if (d.test(e)) {
213
+ return !0;
214
+ }
215
+ for (var r of e.split("\n")) {
216
+ var t = r.trimStart();
217
+ if (!t || t.startsWith("#")) {
218
+ continue;
219
+ }
220
+ return t.startsWith("{");
221
+ }
222
+ return !1;
223
+ }(i)) {
224
+ t = !0;
225
+ return;
226
+ }
227
+ }
228
+ }
229
+ e.forEachChild(r, visit);
230
+ };
231
+ visit(r);
232
+ return t;
233
+ }
234
+
235
+ var m = 262144e4;
236
+
237
+ function traceCallToImportSource(r, t, a, i) {
238
+ var n = r.expression;
239
+ var o;
240
+ if (e.isIdentifier(n)) {
241
+ o = n;
242
+ } else if (e.isPropertyAccessExpression(n) && e.isIdentifier(n.expression)) {
243
+ o = n.expression;
24
244
  }
25
- var n = i.getSymbolAtLocation(s);
26
- if (!n || !n.declarations) {
245
+ if (!o) {
27
246
  return;
28
247
  }
29
- for (var l of n.declarations) {
30
- var u = findImportDeclaration(l);
31
- if (u && e.isStringLiteral(u.moduleSpecifier)) {
32
- return resolveModulePath(u.moduleSpecifier.text, a, t);
248
+ var s = `${t.fileName}\0${o.text}`;
249
+ if (i.traces.has(s)) {
250
+ return i.traces.get(s);
251
+ }
252
+ var u;
253
+ var l = a.getTypeChecker().getSymbolAtLocation(o);
254
+ if (l && l.declarations) {
255
+ for (var c of l.declarations) {
256
+ var f = findImportDeclaration(c);
257
+ if (f && e.isStringLiteral(f.moduleSpecifier)) {
258
+ u = resolveModulePath(f.moduleSpecifier.text, t, a, i);
259
+ break;
260
+ }
33
261
  }
34
262
  }
35
- return;
263
+ i.traces.set(s, u);
264
+ return u;
36
265
  }
37
266
 
38
267
  function findImportDeclaration(r) {
39
- var a = r;
40
- while (a) {
41
- if (e.isImportDeclaration(a)) {
42
- return a;
268
+ var t = r;
269
+ while (t) {
270
+ if (e.isImportDeclaration(t)) {
271
+ return t;
43
272
  }
44
- a = a.parent;
273
+ t = t.parent;
45
274
  }
46
275
  return;
47
276
  }
48
277
 
49
- function resolveModulePath(r, a, t) {
50
- var i = t.getCompilerOptions();
51
- var o = e.createCompilerHost(i);
52
- var s = e.resolveModuleName(r, a.fileName, i, o);
53
- if (s.resolvedModule) {
54
- return s.resolvedModule.resolvedFileName;
278
+ function resolveModulePath(r, t, a, i) {
279
+ var n = a.getCompilerOptions();
280
+ var o = i.host || (i.host = e.createCompilerHost(n));
281
+ var s = i.resolutionCache || (i.resolutionCache = e.createModuleResolutionCache(o.getCurrentDirectory(), o.getCanonicalFileName.bind(o), n));
282
+ var u = e.resolveModuleName(r, t.fileName, n, o, s);
283
+ if (u.resolvedModule) {
284
+ return u.resolvedModule.resolvedFileName;
55
285
  }
56
286
  return;
57
287
  }
58
288
 
59
- function collectImportsFromSourceFile(a, t, i, o, s) {
60
- var n = [];
61
- var l = function getTadaOutputPaths(e) {
62
- var r = [];
289
+ function collectImportsFromSourceFile(r, t, a, n, o, s, u) {
290
+ var l = [];
291
+ var c = function getTadaOutputPaths(e, r) {
292
+ var t = [];
63
293
  if ("schema" in e && e.tadaOutputLocation) {
64
- r.push(e.tadaOutputLocation);
65
- }
66
- return r;
67
- }(t);
68
- !function visit(t) {
69
- if (e.isImportDeclaration(t) && e.isStringLiteral(t.moduleSpecifier)) {
70
- var u = t.moduleSpecifier.text;
71
- if (!function isTadaImport(e, a, t) {
72
- if (e.startsWith(".")) {
73
- var i = r.dirname(a);
74
- var o = r.resolve(i, e);
75
- return t.some((e => {
76
- var a = r.resolve(e);
77
- return o === a || o.startsWith(a + r.sep);
78
- }));
294
+ t.push(i.resolve(r, e.tadaOutputLocation));
295
+ } else if ("schemas" in e) {
296
+ for (var a of e.schemas) {
297
+ if (a.tadaOutputLocation) {
298
+ t.push(i.resolve(r, a.tadaOutputLocation));
79
299
  }
80
- return t.some((r => e === r || e.startsWith(r + "/")));
81
- }(u, a.fileName, l)) {
82
- var c = t.getFullText().trim();
83
- if (o) {
84
- var p = i(u, a.fileName, o);
85
- if (s) {
86
- if (p.endsWith(".ts") || p.endsWith(".tsx")) {
87
- p = p.replace(/\.ts$/, ".js").replace(/\.tsx$/, ".js");
300
+ }
301
+ }
302
+ return t;
303
+ }(t, o);
304
+ for (var f of r.statements) {
305
+ if (e.isImportDeclaration(f) && e.isStringLiteral(f.moduleSpecifier)) {
306
+ var p = f.moduleSpecifier.text;
307
+ if (!isTadaImport(p, r.fileName, c, n)) {
308
+ var d = f.getFullText().trim();
309
+ if (s) {
310
+ var m = a(p, r.fileName, s);
311
+ if (u) {
312
+ if (m.endsWith(".ts") || m.endsWith(".tsx")) {
313
+ m = m.replace(/\.ts$/, ".js").replace(/\.tsx$/, ".js");
88
314
  }
89
315
  } else {
90
- p = p.replace(/\.ts$/, "").replace(/\.tsx$/, "");
316
+ m = m.replace(/\.ts$/, "").replace(/\.tsx$/, "");
91
317
  }
92
- if (p && !p.includes("gql.tada")) {
93
- n.push({
94
- specifier: p,
95
- importClause: c.replace(u, p)
318
+ if (m && !m.includes("gql.tada")) {
319
+ l.push({
320
+ specifier: m,
321
+ importClause: d.replace(p, m)
96
322
  });
97
323
  }
98
324
  } else {
99
- n.push({
100
- specifier: u,
101
- importClause: c
325
+ l.push({
326
+ specifier: p,
327
+ importClause: d
102
328
  });
103
329
  }
104
330
  }
105
331
  }
106
- e.forEachChild(t, visit);
107
- }(a);
108
- return n;
332
+ }
333
+ return l;
334
+ }
335
+
336
+ function isTadaImport(e, r, t, a) {
337
+ var n = a(e, r);
338
+ if (n) {
339
+ return t.some((e => n === e));
340
+ }
341
+ if (e.startsWith(".")) {
342
+ var o = i.dirname(r);
343
+ var s = i.resolve(o, e);
344
+ return t.some((e => s === e));
345
+ }
346
+ return t.some((r => e === r || e.startsWith(r + "/")));
109
347
  }
110
348
 
111
- var s = i((async function* _runTurbo(r) {
112
- var i = a(r.pluginConfig);
113
- var s = o(r);
114
- s.addSourceFile({
349
+ async function* _runTurbo(r) {
350
+ var t = o(r.pluginConfig);
351
+ var n = c(r);
352
+ var s = new Map;
353
+ var getCachedDocuments = t => {
354
+ var i = getTurboOutputPath(r.turboOutputPath, t);
355
+ if (!i) {
356
+ return new Map;
357
+ }
358
+ var n = s.get(i);
359
+ if (!n) {
360
+ n = function readCachedTurboDocuments(r) {
361
+ var t = new Map;
362
+ if (!r || !a.existsSync(r)) {
363
+ return t;
364
+ }
365
+ var i;
366
+ try {
367
+ i = a.readFileSync(r, "utf8");
368
+ } catch {
369
+ return t;
370
+ }
371
+ var n = e.createSourceFile(r, i, e.ScriptTarget.Latest, !0, e.ScriptKind.TS);
372
+ var visit = r => {
373
+ if (e.isInterfaceDeclaration(r) && "setupCache" === r.name.text) {
374
+ for (var a of r.members) {
375
+ if (!e.isPropertySignature(a) || !a.type) {
376
+ continue;
377
+ }
378
+ if (!e.isStringLiteral(a.name) && !e.isNumericLiteral(a.name)) {
379
+ continue;
380
+ }
381
+ var o = getHashComment(i, a);
382
+ if (!o) {
383
+ continue;
384
+ }
385
+ t.set(JSON.stringify(a.name.text), {
386
+ documentHash: o,
387
+ documentType: a.type.getText(n)
388
+ });
389
+ }
390
+ }
391
+ e.forEachChild(r, visit);
392
+ };
393
+ visit(n);
394
+ return t;
395
+ }(i);
396
+ s.set(i, n);
397
+ }
398
+ return n;
399
+ };
400
+ n.addSourceFile({
115
401
  fileId: "__gql-tada-override__.d.ts",
116
- sourceText: l,
402
+ sourceText: y,
117
403
  scriptKind: e.ScriptKind.TS
118
404
  });
119
- var u = s.createExternalFiles();
120
- if (u.length) {
405
+ var l = n.createExternalFiles();
406
+ if (l.length) {
121
407
  yield {
122
408
  kind: "EXTERNAL_WARNING"
123
409
  };
124
- await s.addVirtualFiles(u);
410
+ await n.addVirtualFiles(l);
125
411
  }
126
- var c = s.build();
127
- var p = c.buildPluginInfo(r.pluginConfig);
128
- var m = c.getSourceFiles();
412
+ var f = n.build();
413
+ var p = f.buildPluginInfo(r.pluginConfig);
414
+ var d = new Set(function getTurboOutputPaths(e) {
415
+ return "string" == typeof e ? [ e ] : e.map((e => e.path));
416
+ }(r.turboOutputPath).map((e => i.resolve(e))));
417
+ var h = n.rootFileNames.filter((e => function shouldScanTurboFile(e, r) {
418
+ if (r.has(i.resolve(e))) {
419
+ return !1;
420
+ }
421
+ if (e.endsWith(".d.ts") || e.endsWith(".d.mts") || e.endsWith(".d.cts")) {
422
+ return !1;
423
+ }
424
+ return !/(^|[/\\])node_modules([/\\]|$)/.test(e);
425
+ }(e, d)));
129
426
  yield {
130
427
  kind: "FILE_COUNT",
131
- fileCount: m.length
428
+ fileCount: h.length
132
429
  };
133
- var d = c.program.getTypeChecker();
134
- var f = new Map;
135
- for (var v of m) {
136
- var g = v.fileName;
137
- var h = [];
138
- var y = [];
139
- var T = t(v, p, !1).nodes;
140
- var _loop = async function*(a) {
141
- var t = a.node.parent;
142
- if (!e.isCallExpression(t)) {
143
- return 0;
430
+ var v = new Map;
431
+ var S = {
432
+ traces: new Map,
433
+ host: void 0,
434
+ resolutionCache: void 0
435
+ };
436
+ var processSourceFile = (a, i, o, s) => {
437
+ var l = a.fileName;
438
+ var c = [];
439
+ var f = [];
440
+ if (!hasGraphQLDocumentCandidate(a)) {
441
+ return {
442
+ filePath: l,
443
+ documents: c,
444
+ warnings: f
445
+ };
446
+ }
447
+ var p = u(a, o, {
448
+ searchExternal: !1,
449
+ collectFragments: !1
450
+ }).nodes;
451
+ for (var d of p) {
452
+ var m = d.node.parent;
453
+ if (!e.isCallExpression(m)) {
454
+ continue;
144
455
  }
145
- var o = c.getSourcePosition(v, t.getStart());
146
- g = o.fileName;
147
- if (!i.has(a.schema)) {
148
- y.push({
149
- message: a.schema ? `The '${a.schema}' schema is not in the configuration but was referenced by document.` : i.size > 1 ? "The document is not for a known schema. Have you re-generated the output file?" : "Multiple schemas are configured, but the document is not for a specific schema.",
150
- file: o.fileName,
151
- line: o.line,
152
- col: o.col
456
+ var h = i.getSourcePosition(a, m.getStart());
457
+ l = h.fileName;
458
+ if (!t.has(d.schema)) {
459
+ f.push({
460
+ message: d.schema ? `The '${d.schema}' schema is not in the configuration but was referenced by document.` : t.size > 1 ? "The document is not for a known schema. Have you re-generated the output file?" : "Multiple schemas are configured, but the document is not for a specific schema.",
461
+ file: h.fileName,
462
+ line: h.line,
463
+ col: h.col
153
464
  });
154
- return 0;
465
+ continue;
155
466
  }
156
- var l = traceCallToImportSource(t, v, c.program);
157
- if (l && !f.has(l)) {
158
- var u = c.program.getSourceFile(l);
159
- if (u) {
160
- var p = Array.isArray(r.turboOutputPath) ? r.turboOutputPath.find((e => e.schemaName === a.schema))?.path : r.turboOutputPath;
161
- var m = collectImportsFromSourceFile(u, r.pluginConfig, s.resolveModuleName.bind(s), p, !!s.wasOriginallyNodeNext);
162
- f.set(l, {
163
- absolutePath: l,
164
- imports: m
467
+ var y = traceCallToImportSource(m, a, i.program, S);
468
+ if (y && !v.has(y)) {
469
+ var T = i.program.getSourceFile(y);
470
+ if (T) {
471
+ var F = getTurboOutputPath(r.turboOutputPath, d.schema);
472
+ var b = collectImportsFromSourceFile(T, r.pluginConfig, n.resolveModuleName.bind(n), n.resolveModulePath.bind(n), r.rootPath, F, !!n.wasOriginallyNodeNext);
473
+ v.set(y, {
474
+ absolutePath: y,
475
+ imports: b
165
476
  });
166
477
  }
167
478
  }
168
- var T = d.getTypeAtLocation(t);
169
- var F = d.getTypeAtLocation(a.node);
170
- if (!T.symbol || "TadaDocumentNode" !== T.symbol.getEscapedName()) {
171
- y.push({
172
- message: 'The discovered document is not of type "TadaDocumentNode".\nIf this is unexpected, please file an issue describing your case.',
173
- file: o.fileName,
174
- line: o.line,
175
- col: o.col
176
- });
177
- return 0;
479
+ var C = JSON.stringify(d.node.text);
480
+ var N = x.hashCallExpression(m, d.schema);
481
+ var P = N.hashable && N.documentHash ? getCachedDocuments(d.schema).get(C) : void 0;
482
+ var w = void 0;
483
+ var E = !1;
484
+ if (P && P.documentHash === N.documentHash) {
485
+ w = P.documentType;
486
+ E = !0;
487
+ } else {
488
+ var L = s.getTypeAtLocation(m);
489
+ if (!L.symbol || "TadaDocumentNode" !== L.symbol.getEscapedName()) {
490
+ f.push({
491
+ message: 'The discovered document is not of type "TadaDocumentNode".\nIf this is unexpected, please file an issue describing your case.',
492
+ file: h.fileName,
493
+ line: h.line,
494
+ col: h.col
495
+ });
496
+ continue;
497
+ }
498
+ w = s.typeToString(L, m, g);
178
499
  }
179
- var S = "value" in F && "string" == typeof F.value && !(F.flags & e.TypeFlags.StringLiteral) ? JSON.stringify(F.value) : d.typeToString(F, t, n);
180
- var N = d.typeToString(T, t, n);
181
- h.push({
182
- schemaName: a.schema,
183
- argumentKey: S,
184
- documentType: N
500
+ c.push({
501
+ schemaName: d.schema,
502
+ argumentKey: C,
503
+ documentType: w,
504
+ documentHash: N.documentHash,
505
+ isCached: E
185
506
  });
507
+ }
508
+ return {
509
+ filePath: l,
510
+ documents: c,
511
+ warnings: f
186
512
  };
187
- for (var F of T) {
188
- if (0 === (yield* _loop(F))) {
189
- continue;
190
- }
513
+ };
514
+ var isHeapOverSoftLimit = () => {
515
+ if (process.memoryUsage().heapUsed < m) {
516
+ return !1;
191
517
  }
518
+ forceGc();
519
+ return process.memoryUsage().heapUsed >= m;
520
+ };
521
+ var T = f.program.getTypeChecker();
522
+ var x = createDocumentHasher({
523
+ get checker() {
524
+ return T;
525
+ },
526
+ schemaFingerprints: computeSchemaFingerprints(r)
527
+ });
528
+ var F = 0;
529
+ for (var b of h) {
530
+ if (F > 0 && (F >= 1e3 || isHeapOverSoftLimit())) {
531
+ p = (f = n.build()).buildPluginInfo(r.pluginConfig);
532
+ forceGc();
533
+ T = f.program.getTypeChecker();
534
+ F = 0;
535
+ }
536
+ var C = f.getSourceFile(b);
537
+ if (!C) {
538
+ continue;
539
+ }
540
+ var {filePath: N, documents: P, warnings: w} = processSourceFile(C, f, p, T);
541
+ F++;
192
542
  yield {
193
543
  kind: "FILE_TURBO",
194
- filePath: g,
195
- documents: h,
196
- warnings: y
544
+ filePath: N,
545
+ documents: P,
546
+ warnings: w
197
547
  };
198
548
  }
199
- if (f.size > 0) {
549
+ if (v.size > 0) {
200
550
  yield {
201
551
  kind: "GRAPHQL_SOURCES",
202
- sources: Array.from(f.values())
552
+ sources: Array.from(v.values())
203
553
  };
204
554
  }
205
- }));
555
+ }
556
+
557
+ function computeSchemaFingerprints(e) {
558
+ var r = new Map;
559
+ var t = i.dirname(e.configPath);
560
+ for (var u of o(e.pluginConfig)) {
561
+ var l = s(e.pluginConfig, u || void 0);
562
+ var c = l && l.tadaOutputLocation;
563
+ if (!c) {
564
+ continue;
565
+ }
566
+ var f = void 0;
567
+ try {
568
+ f = a.readFileSync(i.resolve(t, c), "utf8");
569
+ } catch {
570
+ continue;
571
+ }
572
+ var p = n.createHash("sha256").update(f).digest("hex");
573
+ r.set(u, `sha256:${p.slice(0, 32)}`);
574
+ }
575
+ return r;
576
+ }
577
+
578
+ function getTurboOutputPath(e, r) {
579
+ if ("string" == typeof e) {
580
+ return e;
581
+ }
582
+ return e.find((e => e.schemaName === r))?.path;
583
+ }
584
+
585
+ var h;
586
+
587
+ function forceGc() {
588
+ if (void 0 === h) {
589
+ var e = globalThis.gc;
590
+ if ("function" == typeof e) {
591
+ h = e;
592
+ } else {
593
+ try {
594
+ r.setFlagsFromString("--expose-gc");
595
+ h = t.runInNewContext("gc");
596
+ r.setFlagsFromString("--no-expose-gc");
597
+ } catch {
598
+ h = null;
599
+ }
600
+ }
601
+ }
602
+ if (h) {
603
+ h();
604
+ }
605
+ }
606
+
607
+ var v = l(_runTurbo);
206
608
 
207
- var n = e.TypeFormatFlags.NoTruncation | e.TypeFormatFlags.NoTypeReduction | e.TypeFormatFlags.InTypeAlias | e.TypeFormatFlags.UseFullyQualifiedType | e.TypeFormatFlags.GenerateNamesForShadowedTypeParams | e.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | e.TypeFormatFlags.AllowUniqueESSymbolType | e.TypeFormatFlags.WriteTypeArgumentsOfSignature;
609
+ var g = e.TypeFormatFlags.NoTruncation | e.TypeFormatFlags.NoTypeReduction | e.TypeFormatFlags.InTypeAlias | e.TypeFormatFlags.UseFullyQualifiedType | e.TypeFormatFlags.GenerateNamesForShadowedTypeParams | e.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | e.TypeFormatFlags.AllowUniqueESSymbolType | e.TypeFormatFlags.WriteTypeArgumentsOfSignature;
208
610
 
209
- var l = "\nimport * as _gqlTada from 'gql.tada';\ndeclare module 'gql.tada' {\n interface setupCache {\n readonly __cacheDisabled: true;\n }\n}\n".trim();
611
+ var y = "\nimport * as _gqlTada from 'gql.tada';\ndeclare module 'gql.tada' {\n interface setupCache {\n readonly __cacheDisabled: true;\n }\n}\n".trim();
210
612
 
211
- export { s as runTurbo };
613
+ export { _runTurbo, collectImportsFromSourceFile, v as runTurbo };
212
614
  //# sourceMappingURL=thread-chunk2.mjs.map