@gql.tada/cli-utils 1.8.0 → 1.8.1

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.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Upgrade `@0no-co/graphqlsp`
8
+ Submitted by [@kitten](https://github.com/kitten) (See [#549](https://github.com/0no-co/gql.tada/pull/549))
9
+
3
10
  ## 1.8.0
4
11
 
5
12
  ### Minor Changes
@@ -41,57 +41,69 @@ var l = t.expose((async function* _runDiagnostics(r) {
41
41
  };
42
42
  await l.addVirtualFiles(s);
43
43
  }
44
- var g = await a.loadRef(r.pluginConfig).load({
44
+ var c = await a.loadRef(r.pluginConfig).load({
45
45
  rootPath: t
46
46
  });
47
- var c = l.build();
48
- var f = c.buildPluginInfo(r.pluginConfig);
49
- var u = c.getSourceFiles();
47
+ var g = {
48
+ current: c.current,
49
+ multi: c.multi,
50
+ version: c.version,
51
+ errors: {
52
+ config: null,
53
+ load: new Map,
54
+ write: new Map
55
+ },
56
+ outputLocations: new Map,
57
+ checkStale() {}
58
+ };
59
+ var u = l.build();
60
+ var f = u.buildPluginInfo(r.pluginConfig);
61
+ var d = u.getSourceFiles();
50
62
  yield {
51
63
  kind: "FILE_COUNT",
52
- fileCount: u.length
64
+ fileCount: d.length
53
65
  };
54
- for (var d of u) {
55
- var v = d.fileName.endsWith(".vue.ts") || d.fileName.endsWith(".svelte.ts");
56
- var h = d.fileName;
66
+ for (var v of d) {
67
+ var p = v.fileName.endsWith(".vue.ts") || v.fileName.endsWith(".svelte.ts");
68
+ var h = v.fileName;
57
69
  f.config = {
58
70
  ...f.config,
59
- shouldCheckForColocatedFragments: v ? !1 : f.config.shouldCheckForColocatedFragments ?? !1,
60
- trackFieldUsage: v ? !1 : f.config.trackFieldUsage ?? !1
71
+ shouldCheckForColocatedFragments: p ? !1 : f.config.shouldCheckForColocatedFragments ?? !1,
72
+ trackFieldUsage: p ? !1 : f.config.trackFieldUsage ?? !1
61
73
  };
62
- var p = i.getGraphQLDiagnostics(h, g, f);
63
- var m = [];
64
- if (p && p.length) {
65
- for (var y of p) {
66
- if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
74
+ var m = i.getGraphQLDiagnostics(h, g, f);
75
+ var y = [];
76
+ if (m && m.length) {
77
+ for (var C of m) {
78
+ if (!("messageText" in C) || "string" != typeof C.messageText || !C.file) {
67
79
  continue;
68
80
  }
69
- var C = "info";
70
- if (y.category === e.DiagnosticCategory.Error) {
71
- C = "error";
72
- } else if (y.category === e.DiagnosticCategory.Warning) {
73
- C = "warn";
81
+ var F = "info";
82
+ if (C.category === e.DiagnosticCategory.Error) {
83
+ F = "error";
84
+ } else if (C.category === e.DiagnosticCategory.Warning) {
85
+ F = "warn";
74
86
  }
75
- var F = c.getSourcePosition(d, {
76
- start: y.start || 1,
77
- length: y.length || 1
87
+ var N = u.getSourcePosition(v, {
88
+ start: C.start || 1,
89
+ length: C.length || 1
78
90
  });
79
- h = F.fileName;
80
- m.push({
81
- severity: C,
82
- message: y.messageText,
83
- file: F.fileName,
84
- line: F.line,
85
- col: F.col,
86
- endLine: F.endLine,
87
- endColumn: F.endColumn
91
+ h = N.fileName;
92
+ y.push({
93
+ severity: F,
94
+ message: C.messageText,
95
+ file: N.fileName,
96
+ line: N.line,
97
+ col: N.col,
98
+ endLine: N.endLine,
99
+ endColumn: N.endColumn
88
100
  });
89
101
  }
90
102
  }
91
103
  yield {
92
104
  kind: "FILE_DIAGNOSTICS",
93
105
  filePath: h,
94
- messages: m
106
+ messages: y
95
107
  };
96
108
  }
97
109
  }));
@@ -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 { 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 schemaRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\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","schemaRef","loadRef","pluginConfig","load","rootPath","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","config","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8FaA,IAAiBC,EAAMA,QA3EpCC,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;;EAEtE,IAAMgB,IAAYZ,EAAQa;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgBpB,EAAOc;EACpD,IAAMO,IAAcJ,EAAUK;QAExB;IACJZ,MAAM;IACNa,WAAWF,EAAYZ;;EAGzB,KAAK,IAAMe,KAAcH,GAAa;IACpC,IAAMI,IACJD,EAAWE,SAASC,SAAS,cAAcH,EAAWE,SAASC,SAAS;IAC1E,IAAIC,IAAWJ,EAAWE;IAC1BP,EAAWU,SAAS;SACfV,EAAWU;MACdC,kCAAkCL,KAC9B,IACCN,EAAWU,OAAOC,qCAAoC;MAC3DC,iBAAiBN,KAAgB,IAASN,EAAWU,OAAOE,oBAAmB;;IAEjF,IAAMC,IAAcC,EAAqBA,sBAACL,GAAUhB,GAAWO;IAC/D,IAAMe,IAAgC;IAEtC,IAAIF,KAAeA,EAAYvB;MAC7B,KAAK,IAAM0B,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,IAAW3B,EAAU4B,kBAAkBrB,GADhC;UAAEsB,OAAOX,EAAWW,SAAS;UAAGrC,QAAQ0B,EAAW1B,UAAU;;QAE1EmB,IAAWgB,EAASlB;QACpBQ,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASlB;UACfuB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJ1C,MAAM;MACNkB;MACAM;;AAEJ;AACF;;"}
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 { 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,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,EAAqBA,sBAACJ,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;;"}
@@ -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 o } from "./index-chunk2.mjs";
9
+ import { e as n } from "./index-chunk2.mjs";
10
10
 
11
- import { p as n } from "./index-chunk.mjs";
11
+ import { p as o } from "./index-chunk.mjs";
12
12
 
13
- var t = o((async function* _runDiagnostics(o) {
14
- var t = i.dirname(o.configPath);
15
- var l = n(o);
13
+ var t = n((async function* _runDiagnostics(n) {
14
+ var t = i.dirname(n.configPath);
15
+ var l = o(n);
16
16
  var s = l.createExternalFiles();
17
17
  if (s.length) {
18
18
  yield {
@@ -20,57 +20,69 @@ var t = o((async function* _runDiagnostics(o) {
20
20
  };
21
21
  await l.addVirtualFiles(s);
22
22
  }
23
- var g = await a(o.pluginConfig).load({
23
+ var g = await a(n.pluginConfig).load({
24
24
  rootPath: t
25
25
  });
26
- var f = l.build();
27
- var m = f.buildPluginInfo(o.pluginConfig);
28
- var c = f.getSourceFiles();
26
+ var f = {
27
+ current: g.current,
28
+ multi: g.multi,
29
+ version: g.version,
30
+ errors: {
31
+ config: null,
32
+ load: new Map,
33
+ write: new Map
34
+ },
35
+ outputLocations: new Map,
36
+ checkStale() {}
37
+ };
38
+ var c = l.build();
39
+ var m = c.buildPluginInfo(n.pluginConfig);
40
+ var d = c.getSourceFiles();
29
41
  yield {
30
42
  kind: "FILE_COUNT",
31
- fileCount: c.length
43
+ fileCount: d.length
32
44
  };
33
- for (var d of c) {
34
- var u = d.fileName.endsWith(".vue.ts") || d.fileName.endsWith(".svelte.ts");
35
- var h = d.fileName;
45
+ for (var u of d) {
46
+ var p = u.fileName.endsWith(".vue.ts") || u.fileName.endsWith(".svelte.ts");
47
+ var v = u.fileName;
36
48
  m.config = {
37
49
  ...m.config,
38
- shouldCheckForColocatedFragments: u ? !1 : m.config.shouldCheckForColocatedFragments ?? !1,
39
- trackFieldUsage: u ? !1 : m.config.trackFieldUsage ?? !1
50
+ shouldCheckForColocatedFragments: p ? !1 : m.config.shouldCheckForColocatedFragments ?? !1,
51
+ trackFieldUsage: p ? !1 : m.config.trackFieldUsage ?? !1
40
52
  };
41
- var v = r(h, g, m);
42
- var p = [];
43
- if (v && v.length) {
44
- for (var C of v) {
45
- if (!("messageText" in C) || "string" != typeof C.messageText || !C.file) {
53
+ var h = r(v, f, m);
54
+ var C = [];
55
+ if (h && h.length) {
56
+ for (var y of h) {
57
+ if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
46
58
  continue;
47
59
  }
48
- var y = "info";
49
- if (C.category === e.DiagnosticCategory.Error) {
50
- y = "error";
51
- } else if (C.category === e.DiagnosticCategory.Warning) {
52
- y = "warn";
60
+ var F = "info";
61
+ if (y.category === e.DiagnosticCategory.Error) {
62
+ F = "error";
63
+ } else if (y.category === e.DiagnosticCategory.Warning) {
64
+ F = "warn";
53
65
  }
54
- var F = f.getSourcePosition(d, {
55
- start: C.start || 1,
56
- length: C.length || 1
66
+ var k = c.getSourcePosition(u, {
67
+ start: y.start || 1,
68
+ length: y.length || 1
57
69
  });
58
- h = F.fileName;
59
- p.push({
60
- severity: y,
61
- message: C.messageText,
62
- file: F.fileName,
63
- line: F.line,
64
- col: F.col,
65
- endLine: F.endLine,
66
- endColumn: F.endColumn
70
+ v = k.fileName;
71
+ C.push({
72
+ severity: F,
73
+ message: y.messageText,
74
+ file: k.fileName,
75
+ line: k.line,
76
+ col: k.col,
77
+ endLine: k.endLine,
78
+ endColumn: k.endColumn
67
79
  });
68
80
  }
69
81
  }
70
82
  yield {
71
83
  kind: "FILE_DIAGNOSTICS",
72
- filePath: h,
73
- messages: p
84
+ filePath: v,
85
+ messages: C
74
86
  };
75
87
  }
76
88
  }));
@@ -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 { 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 schemaRef = await loadRef(params.pluginConfig).load({ rootPath: projectPath });\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","schemaRef","loadRef","pluginConfig","load","rootPath","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","isVueOrSvelte","fileName","endsWith","filePath","config","shouldCheckForColocatedFragments","trackFieldUsage","diagnostics","getGraphQLDiagnostics","messages","diagnostic","messageText","file","severity","category","ts","DiagnosticCategory","Error","Warning","position","getSourcePosition","start","push","message","line","col","endLine","endColumn"],"mappings":";;;;;;;;;;;;IA8FaA,IAAiBC,GA3E9BC,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;;EAEtE,IAAMgB,IAAYZ,EAAQa;EAC1B,IAAMC,IAAaF,EAAUG,gBAAgBpB,EAAOc;EACpD,IAAMO,IAAcJ,EAAUK;QAExB;IACJZ,MAAM;IACNa,WAAWF,EAAYZ;;EAGzB,KAAK,IAAMe,KAAcH,GAAa;IACpC,IAAMI,IACJD,EAAWE,SAASC,SAAS,cAAcH,EAAWE,SAASC,SAAS;IAC1E,IAAIC,IAAWJ,EAAWE;IAC1BP,EAAWU,SAAS;SACfV,EAAWU;MACdC,kCAAkCL,KAC9B,IACCN,EAAWU,OAAOC,qCAAoC;MAC3DC,iBAAiBN,KAAgB,IAASN,EAAWU,OAAOE,oBAAmB;;IAEjF,IAAMC,IAAcC,EAAsBL,GAAUhB,GAAWO;IAC/D,IAAMe,IAAgC;IAEtC,IAAIF,KAAeA,EAAYvB;MAC7B,KAAK,IAAM0B,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,IAAW3B,EAAU4B,kBAAkBrB,GADhC;UAAEsB,OAAOX,EAAWW,SAAS;UAAGrC,QAAQ0B,EAAW1B,UAAU;;QAE1EmB,IAAWgB,EAASlB;QACpBQ,EAASa,KAAK;UACZT;UACAU,SAASb,EAAWC;UACpBC,MAAMO,EAASlB;UACfuB,MAAML,EAASK;UACfC,KAAKN,EAASM;UACdC,SAASP,EAASO;UAClBC,WAAWR,EAASQ;;AAExB;;UAGI;MACJ1C,MAAM;MACNkB;MACAM;;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 { 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;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gql.tada/cli-utils",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "public": true,
5
5
  "description": "Main logic for gql.tada’s CLI tool.",
6
6
  "author": "0no.co <hi@0no.co>",
@@ -49,7 +49,7 @@
49
49
  "wonka": "^6.3.4"
50
50
  },
51
51
  "dependencies": {
52
- "@0no-co/graphqlsp": "^1.16.0",
52
+ "@0no-co/graphqlsp": "^1.17.0",
53
53
  "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
54
54
  "@gql.tada/internal": "1.1.0"
55
55
  },
@@ -65,8 +65,8 @@
65
65
  "@0no-co/graphqlsp": "^1.16.0",
66
66
  "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
67
67
  "typescript": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
68
- "@gql.tada/vue-support": "1.0.3",
69
- "@gql.tada/svelte-support": "1.0.3"
68
+ "@gql.tada/svelte-support": "1.0.3",
69
+ "@gql.tada/vue-support": "1.0.3"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public",