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