@gql.tada/cli-utils 1.2.2 → 1.2.3-canary-baf20632e4ea2bf02987848b116d4d9ab5d2174d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @gql.tada/cli-utils
2
2
 
3
+ ## 1.2.3-canary-baf20632e4ea2bf02987848b116d4d9ab5d2174d
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies (See [#257](https://github.com/0no-co/gql.tada/pull/257) and [#259](https://github.com/0no-co/gql.tada/pull/259))
8
+ - @gql.tada/internal@0.3.0-canary-baf20632e4ea2bf02987848b116d4d9ab5d2174d
9
+
3
10
  ## 1.2.2
4
11
 
5
12
  ### Patch Changes
@@ -30,6 +30,9 @@ function _interopNamespaceDefault(e) {
30
30
  var t = _interopNamespaceDefault(r);
31
31
 
32
32
  var o = n.expose((async function* _runDiagnostics(r) {
33
+ if (!("schema" in r.pluginConfig)) {
34
+ throw new Error("Multi-schema support is not implemented yet");
35
+ }
33
36
  var o = t.dirname(r.configPath);
34
37
  var l = a.load({
35
38
  origin: r.pluginConfig.schema,
@@ -44,8 +47,8 @@ var o = n.expose((async function* _runDiagnostics(r) {
44
47
  await s.addVirtualFiles(g);
45
48
  }
46
49
  var c = s.build();
47
- var f = c.buildPluginInfo(r.pluginConfig);
48
- var u = {
50
+ var u = c.buildPluginInfo(r.pluginConfig);
51
+ var f = {
49
52
  current: (await l.load()).schema,
50
53
  version: 1
51
54
  };
@@ -54,40 +57,40 @@ var o = n.expose((async function* _runDiagnostics(r) {
54
57
  kind: "FILE_COUNT",
55
58
  fileCount: v.length
56
59
  };
57
- for (var d of v) {
58
- var p = d.fileName;
59
- var m = i.getGraphQLDiagnostics(p, u, f);
60
+ for (var p of v) {
61
+ var d = p.fileName;
62
+ var m = i.getGraphQLDiagnostics(d, f, u);
60
63
  var h = [];
61
64
  if (m && m.length) {
62
65
  for (var y of m) {
63
66
  if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
64
67
  continue;
65
68
  }
66
- var N = "info";
69
+ var C = "info";
67
70
  if (y.category === e.DiagnosticCategory.Error) {
68
- N = "error";
71
+ C = "error";
69
72
  } else if (y.category === e.DiagnosticCategory.Warning) {
70
- N = "warn";
73
+ C = "warn";
71
74
  }
72
- var C = c.getSourcePosition(d, {
75
+ var N = c.getSourcePosition(p, {
73
76
  start: y.start || 1,
74
77
  length: y.length || 1
75
78
  });
76
- p = C.fileName;
79
+ d = N.fileName;
77
80
  h.push({
78
- severity: N,
81
+ severity: C,
79
82
  message: y.messageText,
80
- file: C.fileName,
81
- line: C.line,
82
- col: C.col,
83
- endLine: C.endLine,
84
- endColumn: C.endColumn
83
+ file: N.fileName,
84
+ line: N.line,
85
+ col: N.col,
86
+ endLine: N.endLine,
87
+ endColumn: N.endColumn
85
88
  });
86
89
  }
87
90
  }
88
91
  yield {
89
92
  kind: "FILE_DIAGNOSTICS",
90
- filePath: p,
93
+ filePath: d,
91
94
  messages: h
92
95
  };
93
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"thread-chunk3.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 { load } 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 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 loader = load({ origin: params.pluginConfig.schema, rootPath: projectPath });\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 container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const loadResult = await loader.load();\n const schemaRef = { current: loadResult.schema, version: 1 };\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 let filePath = sourceFile.fileName;\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","loader","load","origin","pluginConfig","schema","rootPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","schemaRef","current","version","sourceFiles","getSourceFiles","fileCount","sourceFile","filePath","fileName","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqFaA,IAAiBC,EAAMA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+ {"version":3,"file":"thread-chunk3.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 { load } 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 configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n if (!('schema' in params.pluginConfig)) {\n // TODO: Implement multi-schema support\n throw new Error('Multi-schema support is not implemented yet');\n }\n\n const projectPath = path.dirname(params.configPath);\n const loader = load({ origin: params.pluginConfig.schema, rootPath: projectPath });\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 container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const loadResult = await loader.load();\n const schemaRef = { current: loadResult.schema, version: 1 };\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 let filePath = sourceFile.fileName;\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","pluginConfig","Error","projectPath","path","dirname","configPath","loader","load","origin","schema","rootPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","schemaRef","current","version","sourceFiles","getSourceFiles","fileCount","sourceFile","filePath","fileName","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0FaA,IAAiBC,EAAMA,QAxEpCC,gBAAgBC,gBACdC;EAEA,MAAM,YAAYA,EAAOC;IAEvB,MAAM,IAAIC,MAAM;;EAGlB,IAAMC,IAAcC,EAAKC,QAAQL,EAAOM;EACxC,IAAMC,IAASC,EAAAA,KAAK;IAAEC,QAAQT,EAAOC,aAAaS;IAAQC,UAAUR;;EACpE,IAAMS,IAAUC,iBAAeb;EAE/B,IAAMc,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,gBAAgBJ;AAChC;EAEA,IAAMK,IAAYP,EAAQQ;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgBtB,EAAOC;EAEpD,IAAMsB,IAAY;IAAEC,gBADKjB,EAAOC,QACQE;IAAQe,SAAS;;EACzD,IAAMC,IAAcP,EAAUQ;QAExB;IACJV,MAAM;IACNW,WAAWF,EAAYV;;EAGzB,KAAK,IAAMa,KAAcH,GAAa;IACpC,IAAII,IAAWD,EAAWE;IAC1B,IAAMC,IAAcC,EAAqBA,sBAACH,GAAUP,GAAWF;IAC/D,IAAMa,IAAgC;IAEtC,IAAIF,KAAeA,EAAYhB;MAC7B,KAAK,IAAMmB,KAAcH,GAAa;QACpC,MACI,iBAAiBG,MACe,mBAA3BA,EAAWC,gBACjBD,EAAWE;UAEZ;;QAEF,IAAIC,IAAqB;QACzB,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBvC;UAChDoC,IAAW;eACN,IAAIH,EAAWI,aAAaC,EAAGC,mBAAmBC;UACvDJ,IAAW;;QAGb,IAAMK,IAAWxB,EAAUyB,kBAAkBf,GADhC;UAAEgB,OAAOV,EAAWU,SAAS;UAAG7B,QAAQmB,EAAWnB,UAAU;;QAE1Ec,IAAWa,EAASZ;QACpBG,EAASY,KAAK;UACZR;UACAS,SAASZ,EAAWC;UACpBC,MAAMM,EAASZ;UACfiB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJlC,MAAM;MACNa;MACAI;;AAEJ;AACF;;"}
@@ -2,19 +2,22 @@ import e from "typescript";
2
2
 
3
3
  import * as i from "node:path";
4
4
 
5
- import { load as a } from "@gql.tada/internal";
5
+ import { load as r } from "@gql.tada/internal";
6
6
 
7
- import { getGraphQLDiagnostics as r } from "@0no-co/graphqlsp/api";
7
+ import { getGraphQLDiagnostics as a } from "@0no-co/graphqlsp/api";
8
8
 
9
- import { e as n, p as o } from "./index-chunk.mjs";
9
+ import { e as n, p as t } from "./index-chunk.mjs";
10
10
 
11
- var t = n((async function* _runDiagnostics(n) {
12
- var t = i.dirname(n.configPath);
13
- var l = a({
11
+ var o = n((async function* _runDiagnostics(n) {
12
+ if (!("schema" in n.pluginConfig)) {
13
+ throw new Error("Multi-schema support is not implemented yet");
14
+ }
15
+ var o = i.dirname(n.configPath);
16
+ var l = r({
14
17
  origin: n.pluginConfig.schema,
15
- rootPath: t
18
+ rootPath: o
16
19
  });
17
- var s = o(n);
20
+ var s = t(n);
18
21
  var g = s.createExternalFiles();
19
22
  if (g.length) {
20
23
  yield {
@@ -28,17 +31,17 @@ var t = n((async function* _runDiagnostics(n) {
28
31
  current: (await l.load()).schema,
29
32
  version: 1
30
33
  };
31
- var d = f.getSourceFiles();
34
+ var p = f.getSourceFiles();
32
35
  yield {
33
36
  kind: "FILE_COUNT",
34
- fileCount: d.length
37
+ fileCount: p.length
35
38
  };
36
- for (var v of d) {
37
- var p = v.fileName;
38
- var u = r(p, c, m);
39
+ for (var d of p) {
40
+ var u = d.fileName;
41
+ var v = a(u, c, m);
39
42
  var h = [];
40
- if (u && u.length) {
41
- for (var y of u) {
43
+ if (v && v.length) {
44
+ for (var y of v) {
42
45
  if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
43
46
  continue;
44
47
  }
@@ -48,11 +51,11 @@ var t = n((async function* _runDiagnostics(n) {
48
51
  } else if (y.category === e.DiagnosticCategory.Warning) {
49
52
  C = "warn";
50
53
  }
51
- var N = f.getSourcePosition(v, {
54
+ var N = f.getSourcePosition(d, {
52
55
  start: y.start || 1,
53
56
  length: y.length || 1
54
57
  });
55
- p = N.fileName;
58
+ u = N.fileName;
56
59
  h.push({
57
60
  severity: C,
58
61
  message: y.messageText,
@@ -66,11 +69,11 @@ var t = n((async function* _runDiagnostics(n) {
66
69
  }
67
70
  yield {
68
71
  kind: "FILE_DIAGNOSTICS",
69
- filePath: p,
72
+ filePath: u,
70
73
  messages: h
71
74
  };
72
75
  }
73
76
  }));
74
77
 
75
- export { t as runDiagnostics };
78
+ export { o as runDiagnostics };
76
79
  //# sourceMappingURL=thread-chunk3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"thread-chunk3.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 { load } 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 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 loader = load({ origin: params.pluginConfig.schema, rootPath: projectPath });\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 container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const loadResult = await loader.load();\n const schemaRef = { current: loadResult.schema, version: 1 };\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 let filePath = sourceFile.fileName;\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","loader","load","origin","pluginConfig","schema","rootPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","schemaRef","current","version","sourceFiles","getSourceFiles","fileCount","sourceFile","filePath","fileName","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;IAqFaA,IAAiBC,GAnE9BC,gBAAgBC,gBACdC;EAEA,IAAMC,IAAcC,EAAKC,QAAQH,EAAOI;EACxC,IAAMC,IAASC,EAAK;IAAEC,QAAQP,EAAOQ,aAAaC;IAAQC,UAAUT;;EACpE,IAAMU,IAAUC,EAAeZ;EAE/B,IAAMa,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,gBAAgBJ;AAChC;EAEA,IAAMK,IAAYP,EAAQQ;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgBrB,EAAOQ;EAEpD,IAAMc,IAAY;IAAEC,gBADKlB,EAAOC,QACQG;IAAQe,SAAS;;EACzD,IAAMC,IAAcP,EAAUQ;QAExB;IACJV,MAAM;IACNW,WAAWF,EAAYV;;EAGzB,KAAK,IAAMa,KAAcH,GAAa;IACpC,IAAII,IAAWD,EAAWE;IAC1B,IAAMC,IAAcC,EAAsBH,GAAUP,GAAWF;IAC/D,IAAMa,IAAgC;IAEtC,IAAIF,KAAeA,EAAYhB;MAC7B,KAAK,IAAMmB,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,IAAWzB,EAAU0B,kBAAkBhB,GADhC;UAAEiB,OAAOX,EAAWW,SAAS;UAAG9B,QAAQmB,EAAWnB,UAAU;;QAE1Ec,IAAWc,EAASb;QACpBG,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASb;UACfkB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJnC,MAAM;MACNa;MACAI;;AAEJ;AACF;;"}
1
+ {"version":3,"file":"thread-chunk3.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 { load } 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 configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runDiagnostics(\n params: DiagnosticsParams\n): AsyncIterableIterator<DiagnosticSignal> {\n if (!('schema' in params.pluginConfig)) {\n // TODO: Implement multi-schema support\n throw new Error('Multi-schema support is not implemented yet');\n }\n\n const projectPath = path.dirname(params.configPath);\n const loader = load({ origin: params.pluginConfig.schema, rootPath: projectPath });\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 container = factory.build();\n const pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const loadResult = await loader.load();\n const schemaRef = { current: loadResult.schema, version: 1 };\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 let filePath = sourceFile.fileName;\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","pluginConfig","Error","projectPath","path","dirname","configPath","loader","load","origin","schema","rootPath","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","schemaRef","current","version","sourceFiles","getSourceFiles","fileCount","sourceFile","filePath","fileName","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;IA0FaA,IAAiBC,GAxE9BC,gBAAgBC,gBACdC;EAEA,MAAM,YAAYA,EAAOC;IAEvB,MAAM,IAAIC,MAAM;;EAGlB,IAAMC,IAAcC,EAAKC,QAAQL,EAAOM;EACxC,IAAMC,IAASC,EAAK;IAAEC,QAAQT,EAAOC,aAAaS;IAAQC,UAAUR;;EACpE,IAAMS,IAAUC,EAAeb;EAE/B,IAAMc,IAAgBF,EAAQG;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRL,EAAQM,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