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