@gql.tada/cli-utils 1.9.1 → 1.9.3

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.
@@ -44,7 +44,7 @@ var l = t.expose((async function* _runDiagnostics(r) {
44
44
  var c = await a.loadRef(r.pluginConfig).load({
45
45
  rootPath: t
46
46
  });
47
- var g = {
47
+ var u = {
48
48
  current: c.current,
49
49
  multi: c.multi,
50
50
  version: c.version,
@@ -54,11 +54,13 @@ var l = t.expose((async function* _runDiagnostics(r) {
54
54
  write: new Map
55
55
  },
56
56
  outputLocations: new Map,
57
+ sourceLocations: new Map,
58
+ turboLocations: new Map,
57
59
  checkStale() {}
58
60
  };
59
- var u = l.build();
60
- var f = u.buildPluginInfo(r.pluginConfig);
61
- var d = u.getSourceFiles();
61
+ var g = l.build();
62
+ var f = g.buildPluginInfo(r.pluginConfig);
63
+ var d = g.getSourceFiles();
62
64
  yield {
63
65
  kind: "FILE_COUNT",
64
66
  fileCount: d.length
@@ -71,7 +73,7 @@ var l = t.expose((async function* _runDiagnostics(r) {
71
73
  shouldCheckForColocatedFragments: p ? !1 : f.config.shouldCheckForColocatedFragments ?? !1,
72
74
  trackFieldUsage: p ? !1 : f.config.trackFieldUsage ?? !1
73
75
  };
74
- var m = i.getGraphQLDiagnostics(h, g, f);
76
+ var m = i.getGraphQLDiagnostics(h, u, f);
75
77
  var y = [];
76
78
  if (m && m.length) {
77
79
  for (var C of m) {
@@ -84,7 +86,7 @@ var l = t.expose((async function* _runDiagnostics(r) {
84
86
  } else if (C.category === e.DiagnosticCategory.Warning) {
85
87
  F = "warn";
86
88
  }
87
- var N = u.getSourcePosition(v, {
89
+ var N = g.getSourcePosition(v, {
88
90
  start: C.start || 1,
89
91
  length: C.length || 1
90
92
  });
@@ -1 +1 @@
1
- {"version":3,"file":"thread-chunk4.js","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport * as path from 'node:path';\n\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\nimport { loadRef } from '@gql.tada/internal';\nimport { getGraphQLDiagnostics } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { Severity, DiagnosticMessage, DiagnosticSignal } from './types';\n\nexport interface DiagnosticsParams {\n rootPath: string;\n tsconfigPath?: string;\n configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n const projectPath = path.dirname(params.configPath);\n const factory = programFactory(params);\n\n const externalFiles = factory.createExternalFiles();\n if (externalFiles.length) {\n yield { kind: 'EXTERNAL_WARNING' };\n await factory.addVirtualFiles(externalFiles);\n }\n\n const loadedRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\n\n // TODO(@kitten): Align `SchemaRef` in `@0no-co/graphqlsp` back with `@gql.tada/internal`\n const schemaRef = {\n current: loadedRef.current,\n multi: loadedRef.multi,\n version: loadedRef.version,\n errors: {\n config: null,\n load: new Map<string | null, string>(),\n write: new Map<string, string>(),\n },\n outputLocations: new Map<string, number>(),\n checkStale() {},\n };\n\n const container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const sourceFiles = container.getSourceFiles();\n\n yield {\n kind: 'FILE_COUNT',\n fileCount: sourceFiles.length,\n };\n\n for (const sourceFile of sourceFiles) {\n const isVueOrSvelte =\n sourceFile.fileName.endsWith('.vue.ts') || sourceFile.fileName.endsWith('.svelte.ts');\n let filePath = sourceFile.fileName;\n pluginInfo.config = {\n ...pluginInfo.config,\n shouldCheckForColocatedFragments: isVueOrSvelte\n ? false\n : (pluginInfo.config.shouldCheckForColocatedFragments ?? false),\n trackFieldUsage: isVueOrSvelte ? false : (pluginInfo.config.trackFieldUsage ?? false),\n };\n const diagnostics = getGraphQLDiagnostics(filePath, schemaRef, pluginInfo);\n const messages: DiagnosticMessage[] = [];\n\n if (diagnostics && diagnostics.length) {\n for (const diagnostic of diagnostics) {\n if (\n !('messageText' in diagnostic) ||\n typeof diagnostic.messageText !== 'string' ||\n !diagnostic.file\n ) {\n continue;\n }\n let severity: Severity = 'info';\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n severity = 'error';\n } else if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n severity = 'warn';\n }\n const span = { start: diagnostic.start || 1, length: diagnostic.length || 1 };\n const position = container.getSourcePosition(sourceFile, span);\n filePath = position.fileName;\n messages.push({\n severity,\n message: diagnostic.messageText,\n file: position.fileName,\n line: position.line,\n col: position.col,\n endLine: position.endLine,\n endColumn: position.endColumn,\n });\n }\n }\n\n yield {\n kind: 'FILE_DIAGNOSTICS',\n filePath,\n messages,\n };\n }\n}\n\nexport const runDiagnostics = expose(_runDiagnostics);\n"],"names":["runDiagnostics","expose","async","_runDiagnostics","params","projectPath","path","dirname","configPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","loadedRef","loadRef","pluginConfig","load","rootPath","schemaRef","current","multi","version","errors","config","Map","write","outputLocations","checkStale","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4GaA,IAAiBC,EAAMA,QAzFpCC,gBAAgBC,gBACdC;EAEA,IAAMC,IAAcC,EAAKC,QAAQH,EAAOI;EACxC,IAAMC,IAAUC,iBAAeN;EAE/B,IAAMO,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,gBAAgBJ;AAChC;EAEA,IAAMK,UAAkBC,EAAOA,QAACb,EAAOc,cAAcC,KAAK;IAAEC,UAAUf;;EAGtE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,EAASQ;;AAExB;;UAGI;MACJnD,MAAM;MACN4B;MACAK;;AAEJ;AACF;;"}
1
+ {"version":3,"file":"thread-chunk4.js","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport * as path from 'node:path';\n\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\nimport { loadRef } from '@gql.tada/internal';\nimport { getGraphQLDiagnostics } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { Severity, DiagnosticMessage, DiagnosticSignal } from './types';\n\nexport interface DiagnosticsParams {\n rootPath: string;\n tsconfigPath?: string;\n configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n const projectPath = path.dirname(params.configPath);\n const factory = programFactory(params);\n\n const externalFiles = factory.createExternalFiles();\n if (externalFiles.length) {\n yield { kind: 'EXTERNAL_WARNING' };\n await factory.addVirtualFiles(externalFiles);\n }\n\n const loadedRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\n\n // TODO(@kitten): Align `SchemaRef` in `@0no-co/graphqlsp` back with `@gql.tada/internal`\n const schemaRef = {\n current: loadedRef.current,\n multi: loadedRef.multi,\n version: loadedRef.version,\n errors: {\n config: null,\n load: new Map<string | null, string>(),\n write: new Map<string, string>(),\n },\n outputLocations: new Map<string, number>(),\n sourceLocations: new Map<string | null, string>(),\n turboLocations: new Map<string | null, string>(),\n checkStale() {},\n };\n\n const container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const sourceFiles = container.getSourceFiles();\n\n yield {\n kind: 'FILE_COUNT',\n fileCount: sourceFiles.length,\n };\n\n for (const sourceFile of sourceFiles) {\n const isVueOrSvelte =\n sourceFile.fileName.endsWith('.vue.ts') || sourceFile.fileName.endsWith('.svelte.ts');\n let filePath = sourceFile.fileName;\n pluginInfo.config = {\n ...pluginInfo.config,\n shouldCheckForColocatedFragments: isVueOrSvelte\n ? false\n : (pluginInfo.config.shouldCheckForColocatedFragments ?? false),\n trackFieldUsage: isVueOrSvelte ? false : (pluginInfo.config.trackFieldUsage ?? false),\n };\n const diagnostics = getGraphQLDiagnostics(filePath, schemaRef, pluginInfo);\n const messages: DiagnosticMessage[] = [];\n\n if (diagnostics && diagnostics.length) {\n for (const diagnostic of diagnostics) {\n if (\n !('messageText' in diagnostic) ||\n typeof diagnostic.messageText !== 'string' ||\n !diagnostic.file\n ) {\n continue;\n }\n let severity: Severity = 'info';\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n severity = 'error';\n } else if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n severity = 'warn';\n }\n const span = { start: diagnostic.start || 1, length: diagnostic.length || 1 };\n const position = container.getSourcePosition(sourceFile, span);\n filePath = position.fileName;\n messages.push({\n severity,\n message: diagnostic.messageText,\n file: position.fileName,\n line: position.line,\n col: position.col,\n endLine: position.endLine,\n endColumn: position.endColumn,\n });\n }\n }\n\n yield {\n kind: 'FILE_DIAGNOSTICS',\n filePath,\n messages,\n };\n }\n}\n\nexport const runDiagnostics = expose(_runDiagnostics);\n"],"names":["runDiagnostics","expose","async","_runDiagnostics","params","projectPath","path","dirname","configPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","loadedRef","loadRef","pluginConfig","load","rootPath","schemaRef","current","multi","version","errors","config","Map","write","outputLocations","sourceLocations","turboLocations","checkStale","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8GaA,IAAiBC,EAAMA,QA3FpCC,gBAAgBC,gBACdC;EAEA,IAAMC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BAAmBE;UACvDL,IAAW;;QAGb,IAAMM,IAAW1B,EAAU2B,kBAAkBpB,GADhC;UAAEqB,OAAOX,EAAWW,SAAS;UAAGhD,QAAQqC,EAAWrC,UAAU;;QAE1E+B,IAAWe,EAASjB;QACpBO,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASjB;UACfsB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJrD,MAAM;MACN8B;MACAK;;AAEJ;AACF;;"}
@@ -6,13 +6,13 @@ import { loadRef as a } from "@gql.tada/internal";
6
6
 
7
7
  import { getGraphQLDiagnostics as r } from "@0no-co/graphqlsp/api";
8
8
 
9
- import { e as n } from "./index-chunk2.mjs";
9
+ import { e as o } from "./index-chunk2.mjs";
10
10
 
11
- import { p as o } from "./index-chunk.mjs";
11
+ import { p as n } from "./index-chunk.mjs";
12
12
 
13
- var t = n((async function* _runDiagnostics(n) {
14
- var t = i.dirname(n.configPath);
15
- var l = o(n);
13
+ var t = o((async function* _runDiagnostics(o) {
14
+ var t = i.dirname(o.configPath);
15
+ var l = n(o);
16
16
  var s = l.createExternalFiles();
17
17
  if (s.length) {
18
18
  yield {
@@ -20,10 +20,10 @@ var t = n((async function* _runDiagnostics(n) {
20
20
  };
21
21
  await l.addVirtualFiles(s);
22
22
  }
23
- var g = await a(n.pluginConfig).load({
23
+ var g = await a(o.pluginConfig).load({
24
24
  rootPath: t
25
25
  });
26
- var f = {
26
+ var c = {
27
27
  current: g.current,
28
28
  multi: g.multi,
29
29
  version: g.version,
@@ -33,11 +33,13 @@ var t = n((async function* _runDiagnostics(n) {
33
33
  write: new Map
34
34
  },
35
35
  outputLocations: new Map,
36
+ sourceLocations: new Map,
37
+ turboLocations: new Map,
36
38
  checkStale() {}
37
39
  };
38
- var c = l.build();
39
- var m = c.buildPluginInfo(n.pluginConfig);
40
- var d = c.getSourceFiles();
40
+ var f = l.build();
41
+ var m = f.buildPluginInfo(o.pluginConfig);
42
+ var d = f.getSourceFiles();
41
43
  yield {
42
44
  kind: "FILE_COUNT",
43
45
  fileCount: d.length
@@ -50,7 +52,7 @@ var t = n((async function* _runDiagnostics(n) {
50
52
  shouldCheckForColocatedFragments: p ? !1 : m.config.shouldCheckForColocatedFragments ?? !1,
51
53
  trackFieldUsage: p ? !1 : m.config.trackFieldUsage ?? !1
52
54
  };
53
- var h = r(v, f, m);
55
+ var h = r(v, c, m);
54
56
  var C = [];
55
57
  if (h && h.length) {
56
58
  for (var y of h) {
@@ -63,7 +65,7 @@ var t = n((async function* _runDiagnostics(n) {
63
65
  } else if (y.category === e.DiagnosticCategory.Warning) {
64
66
  F = "warn";
65
67
  }
66
- var k = c.getSourcePosition(u, {
68
+ var k = f.getSourcePosition(u, {
67
69
  start: y.start || 1,
68
70
  length: y.length || 1
69
71
  });
@@ -1 +1 @@
1
- {"version":3,"file":"thread-chunk4.mjs","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport * as path from 'node:path';\n\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\nimport { loadRef } from '@gql.tada/internal';\nimport { getGraphQLDiagnostics } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { Severity, DiagnosticMessage, DiagnosticSignal } from './types';\n\nexport interface DiagnosticsParams {\n rootPath: string;\n tsconfigPath?: string;\n configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n const projectPath = path.dirname(params.configPath);\n const factory = programFactory(params);\n\n const externalFiles = factory.createExternalFiles();\n if (externalFiles.length) {\n yield { kind: 'EXTERNAL_WARNING' };\n await factory.addVirtualFiles(externalFiles);\n }\n\n const loadedRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\n\n // TODO(@kitten): Align `SchemaRef` in `@0no-co/graphqlsp` back with `@gql.tada/internal`\n const schemaRef = {\n current: loadedRef.current,\n multi: loadedRef.multi,\n version: loadedRef.version,\n errors: {\n config: null,\n load: new Map<string | null, string>(),\n write: new Map<string, string>(),\n },\n outputLocations: new Map<string, number>(),\n checkStale() {},\n };\n\n const container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const sourceFiles = container.getSourceFiles();\n\n yield {\n kind: 'FILE_COUNT',\n fileCount: sourceFiles.length,\n };\n\n for (const sourceFile of sourceFiles) {\n const isVueOrSvelte =\n sourceFile.fileName.endsWith('.vue.ts') || sourceFile.fileName.endsWith('.svelte.ts');\n let filePath = sourceFile.fileName;\n pluginInfo.config = {\n ...pluginInfo.config,\n shouldCheckForColocatedFragments: isVueOrSvelte\n ? false\n : (pluginInfo.config.shouldCheckForColocatedFragments ?? false),\n trackFieldUsage: isVueOrSvelte ? false : (pluginInfo.config.trackFieldUsage ?? false),\n };\n const diagnostics = getGraphQLDiagnostics(filePath, schemaRef, pluginInfo);\n const messages: DiagnosticMessage[] = [];\n\n if (diagnostics && diagnostics.length) {\n for (const diagnostic of diagnostics) {\n if (\n !('messageText' in diagnostic) ||\n typeof diagnostic.messageText !== 'string' ||\n !diagnostic.file\n ) {\n continue;\n }\n let severity: Severity = 'info';\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n severity = 'error';\n } else if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n severity = 'warn';\n }\n const span = { start: diagnostic.start || 1, length: diagnostic.length || 1 };\n const position = container.getSourcePosition(sourceFile, span);\n filePath = position.fileName;\n messages.push({\n severity,\n message: diagnostic.messageText,\n file: position.fileName,\n line: position.line,\n col: position.col,\n endLine: position.endLine,\n endColumn: position.endColumn,\n });\n }\n }\n\n yield {\n kind: 'FILE_DIAGNOSTICS',\n filePath,\n messages,\n };\n }\n}\n\nexport const runDiagnostics = expose(_runDiagnostics);\n"],"names":["runDiagnostics","expose","async","_runDiagnostics","params","projectPath","path","dirname","configPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","loadedRef","loadRef","pluginConfig","load","rootPath","schemaRef","current","multi","version","errors","config","Map","write","outputLocations","checkStale","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;IA4GaA,IAAiBC,GAzF9BC,gBAAgBC,gBACdC;EAEA,IAAMC,IAAcC,EAAKC,QAAQH,EAAOI;EACxC,IAAMC,IAAUC,EAAeN;EAE/B,IAAMO,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,gBAAgBJ;AAChC;EAEA,IAAMK,UAAkBC,EAAQb,EAAOc,cAAcC,KAAK;IAAEC,UAAUf;;EAGtE,IAAMgB,IAAY;IAChBC,SAASN,EAAUM;IACnBC,OAAOP,EAAUO;IACjBC,SAASR,EAAUQ;IACnBC,QAAQ;MACNC,QAAQ;MACRP,MAAM,IAAIQ;MACVC,OAAO,IAAID;;IAEbE,iBAAiB,IAAIF;IACrBG,UAAAA,IAAc;;EAGhB,IAAMC,IAAYtB,EAAQuB;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgB9B,EAAOc;EACpD,IAAMiB,IAAcJ,EAAUK;QAExB;IACJtB,MAAM;IACNuB,WAAWF,EAAYtB;;EAGzB,KAAK,IAAMyB,KAAcH,GAAa;IACpC,IAAMI,IACJD,EAAWE,SAASC,SAAS,cAAcH,EAAWE,SAASC,SAAS;IAC1E,IAAIC,IAAWJ,EAAWE;IAC1BP,EAAWP,SAAS;SACfO,EAAWP;MACdiB,kCAAkCJ,KAC9B,IACCN,EAAWP,OAAOiB,qCAAoC;MAC3DC,iBAAiBL,KAAgB,IAASN,EAAWP,OAAOkB,oBAAmB;;IAEjF,IAAMC,IAAcC,EAAsBJ,GAAUrB,GAAWY;IAC/D,IAAMc,IAAgC;IAEtC,IAAIF,KAAeA,EAAYhC;MAC7B,KAAK,IAAMmC,KAAcH,GAAa;QACpC,MACI,iBAAiBG,MACe,mBAA3BA,EAAWC,gBACjBD,EAAWE;UAEZ;;QAEF,IAAIC,IAAqB;QACzB,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBC;UAChDJ,IAAW;eACN,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBE;UACvDL,IAAW;;QAGb,IAAMM,IAAW1B,EAAU2B,kBAAkBpB,GADhC;UAAEqB,OAAOX,EAAWW,SAAS;UAAG9C,QAAQmC,EAAWnC,UAAU;;QAE1E6B,IAAWe,EAASjB;QACpBO,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASjB;UACfsB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJnD,MAAM;MACN4B;MACAK;;AAEJ;AACF;;"}
1
+ {"version":3,"file":"thread-chunk4.mjs","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport * as path from 'node:path';\n\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\nimport { loadRef } from '@gql.tada/internal';\nimport { getGraphQLDiagnostics } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { Severity, DiagnosticMessage, DiagnosticSignal } from './types';\n\nexport interface DiagnosticsParams {\n rootPath: string;\n tsconfigPath?: string;\n configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n const projectPath = path.dirname(params.configPath);\n const factory = programFactory(params);\n\n const externalFiles = factory.createExternalFiles();\n if (externalFiles.length) {\n yield { kind: 'EXTERNAL_WARNING' };\n await factory.addVirtualFiles(externalFiles);\n }\n\n const loadedRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\n\n // TODO(@kitten): Align `SchemaRef` in `@0no-co/graphqlsp` back with `@gql.tada/internal`\n const schemaRef = {\n current: loadedRef.current,\n multi: loadedRef.multi,\n version: loadedRef.version,\n errors: {\n config: null,\n load: new Map<string | null, string>(),\n write: new Map<string, string>(),\n },\n outputLocations: new Map<string, number>(),\n sourceLocations: new Map<string | null, string>(),\n turboLocations: new Map<string | null, string>(),\n checkStale() {},\n };\n\n const container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const sourceFiles = container.getSourceFiles();\n\n yield {\n kind: 'FILE_COUNT',\n fileCount: sourceFiles.length,\n };\n\n for (const sourceFile of sourceFiles) {\n const isVueOrSvelte =\n sourceFile.fileName.endsWith('.vue.ts') || sourceFile.fileName.endsWith('.svelte.ts');\n let filePath = sourceFile.fileName;\n pluginInfo.config = {\n ...pluginInfo.config,\n shouldCheckForColocatedFragments: isVueOrSvelte\n ? false\n : (pluginInfo.config.shouldCheckForColocatedFragments ?? false),\n trackFieldUsage: isVueOrSvelte ? false : (pluginInfo.config.trackFieldUsage ?? false),\n };\n const diagnostics = getGraphQLDiagnostics(filePath, schemaRef, pluginInfo);\n const messages: DiagnosticMessage[] = [];\n\n if (diagnostics && diagnostics.length) {\n for (const diagnostic of diagnostics) {\n if (\n !('messageText' in diagnostic) ||\n typeof diagnostic.messageText !== 'string' ||\n !diagnostic.file\n ) {\n continue;\n }\n let severity: Severity = 'info';\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n severity = 'error';\n } else if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n severity = 'warn';\n }\n const span = { start: diagnostic.start || 1, length: diagnostic.length || 1 };\n const position = container.getSourcePosition(sourceFile, span);\n filePath = position.fileName;\n messages.push({\n severity,\n message: diagnostic.messageText,\n file: position.fileName,\n line: position.line,\n col: position.col,\n endLine: position.endLine,\n endColumn: position.endColumn,\n });\n }\n }\n\n yield {\n kind: 'FILE_DIAGNOSTICS',\n filePath,\n messages,\n };\n }\n}\n\nexport const runDiagnostics = expose(_runDiagnostics);\n"],"names":["runDiagnostics","expose","async","_runDiagnostics","params","projectPath","path","dirname","configPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","loadedRef","loadRef","pluginConfig","load","rootPath","schemaRef","current","multi","version","errors","config","Map","write","outputLocations","sourceLocations","turboLocations","checkStale","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;IA8GaA,IAAiBC,GA3F9BC,gBAAgBC,gBACdC;EAEA,IAAMC,IAAcC,EAAKC,QAAQH,EAAOI;EACxC,IAAMC,IAAUC,EAAeN;EAE/B,IAAMO,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,gBAAgBJ;AAChC;EAEA,IAAMK,UAAkBC,EAAQb,EAAOc,cAAcC,KAAK;IAAEC,UAAUf;;EAGtE,IAAMgB,IAAY;IAChBC,SAASN,EAAUM;IACnBC,OAAOP,EAAUO;IACjBC,SAASR,EAAUQ;IACnBC,QAAQ;MACNC,QAAQ;MACRP,MAAM,IAAIQ;MACVC,OAAO,IAAID;;IAEbE,iBAAiB,IAAIF;IACrBG,iBAAiB,IAAIH;IACrBI,gBAAgB,IAAIJ;IACpBK,UAAAA,IAAc;;EAGhB,IAAMC,IAAYxB,EAAQyB;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgBhC,EAAOc;EACpD,IAAMmB,IAAcJ,EAAUK;QAExB;IACJxB,MAAM;IACNyB,WAAWF,EAAYxB;;EAGzB,KAAK,IAAM2B,KAAcH,GAAa;IACpC,IAAMI,IACJD,EAAWE,SAASC,SAAS,cAAcH,EAAWE,SAASC,SAAS;IAC1E,IAAIC,IAAWJ,EAAWE;IAC1BP,EAAWT,SAAS;SACfS,EAAWT;MACdmB,kCAAkCJ,KAC9B,IACCN,EAAWT,OAAOmB,qCAAoC;MAC3DC,iBAAiBL,KAAgB,IAASN,EAAWT,OAAOoB,oBAAmB;;IAEjF,IAAMC,IAAcC,EAAsBJ,GAAUvB,GAAWc;IAC/D,IAAMc,IAAgC;IAEtC,IAAIF,KAAeA,EAAYlC;MAC7B,KAAK,IAAMqC,KAAcH,GAAa;QACpC,MACI,iBAAiBG,MACe,mBAA3BA,EAAWC,gBACjBD,EAAWE;UAEZ;;QAEF,IAAIC,IAAqB;QACzB,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBC;UAChDJ,IAAW;eACN,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBE;UACvDL,IAAW;;QAGb,IAAMM,IAAW1B,EAAU2B,kBAAkBpB,GADhC;UAAEqB,OAAOX,EAAWW,SAAS;UAAGhD,QAAQqC,EAAWrC,UAAU;;QAE1E+B,IAAWe,EAASjB;QACpBO,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASjB;UACfsB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJrD,MAAM;MACN8B;MACAK;;AAEJ;AACF;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gql.tada/cli-utils",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "public": true,
5
5
  "description": "Main logic for gql.tada’s CLI tool.",
6
6
  "author": "0no.co <hi@0no.co>",
@@ -49,9 +49,9 @@
49
49
  "wonka": "^6.3.4"
50
50
  },
51
51
  "dependencies": {
52
- "@0no-co/graphqlsp": "^1.17.2",
52
+ "@0no-co/graphqlsp": "^1.17.3",
53
53
  "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
54
- "@gql.tada/internal": "1.2.0"
54
+ "@gql.tada/internal": "1.2.2"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@gql.tada/svelte-support": {