@gql.tada/cli-utils 1.4.0 → 1.5.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @gql.tada/cli-utils
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Disable field-usage tracking and the co-located fragment checking for vue/svelte
|
|
8
|
+
Submitted by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#334](https://github.com/0no-co/gql.tada/pull/334))
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies (See [#334](https://github.com/0no-co/gql.tada/pull/334))
|
|
13
|
+
- @gql.tada/internal@1.0.3
|
|
14
|
+
|
|
3
15
|
## 1.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
var e = require("typescript");
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var a = require("node:path");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var r = require("@gql.tada/internal");
|
|
6
6
|
|
|
7
7
|
var i = require("@0no-co/graphqlsp/api");
|
|
8
8
|
|
|
9
9
|
var t = require("./index-chunk.js");
|
|
10
10
|
|
|
11
11
|
function _interopNamespaceDefault(e) {
|
|
12
|
-
var
|
|
12
|
+
var a = Object.create(null);
|
|
13
13
|
if (e) {
|
|
14
|
-
Object.keys(e).forEach((function(
|
|
15
|
-
if ("default" !==
|
|
16
|
-
var i = Object.getOwnPropertyDescriptor(e,
|
|
17
|
-
Object.defineProperty(
|
|
14
|
+
Object.keys(e).forEach((function(r) {
|
|
15
|
+
if ("default" !== r) {
|
|
16
|
+
var i = Object.getOwnPropertyDescriptor(e, r);
|
|
17
|
+
Object.defineProperty(a, r, i.get ? i : {
|
|
18
18
|
enumerable: !0,
|
|
19
19
|
get: function() {
|
|
20
|
-
return e[
|
|
20
|
+
return e[r];
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
26
|
+
a.default = e;
|
|
27
|
+
return a;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var n = _interopNamespaceDefault(
|
|
30
|
+
var n = _interopNamespaceDefault(a);
|
|
31
31
|
|
|
32
|
-
var o = t.expose((async function* _runDiagnostics(
|
|
33
|
-
var o = n.dirname(
|
|
34
|
-
var l = t.programFactory(
|
|
32
|
+
var o = t.expose((async function* _runDiagnostics(a) {
|
|
33
|
+
var o = n.dirname(a.configPath);
|
|
34
|
+
var l = t.programFactory(a);
|
|
35
35
|
var s = l.createExternalFiles();
|
|
36
36
|
if (s.length) {
|
|
37
37
|
yield {
|
|
@@ -39,50 +39,56 @@ var o = t.expose((async function* _runDiagnostics(r) {
|
|
|
39
39
|
};
|
|
40
40
|
await l.addVirtualFiles(s);
|
|
41
41
|
}
|
|
42
|
-
var g = await
|
|
42
|
+
var g = await r.loadRef(a.pluginConfig).load({
|
|
43
43
|
rootPath: o
|
|
44
44
|
});
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
45
|
+
var c = l.build();
|
|
46
|
+
var f = c.buildPluginInfo(a.pluginConfig);
|
|
47
|
+
var u = c.getSourceFiles();
|
|
48
48
|
yield {
|
|
49
49
|
kind: "FILE_COUNT",
|
|
50
|
-
fileCount:
|
|
50
|
+
fileCount: u.length
|
|
51
51
|
};
|
|
52
|
-
for (var
|
|
53
|
-
var
|
|
54
|
-
var p =
|
|
52
|
+
for (var d of u) {
|
|
53
|
+
var v = d.fileName.endsWith(".vue.ts") || d.fileName.endsWith(".svelte.ts");
|
|
54
|
+
var p = d.fileName;
|
|
55
|
+
f.config = {
|
|
56
|
+
...f.config,
|
|
57
|
+
shouldCheckForColocatedFragments: v ? !1 : f.config.shouldCheckForColocatedFragments ?? !1,
|
|
58
|
+
trackFieldUsage: v ? !1 : f.config.trackFieldUsage ?? !1
|
|
59
|
+
};
|
|
60
|
+
var h = i.getGraphQLDiagnostics(p, g, f);
|
|
55
61
|
var m = [];
|
|
56
|
-
if (
|
|
57
|
-
for (var y of
|
|
62
|
+
if (h && h.length) {
|
|
63
|
+
for (var y of h) {
|
|
58
64
|
if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
|
|
59
65
|
continue;
|
|
60
66
|
}
|
|
61
|
-
var
|
|
67
|
+
var C = "info";
|
|
62
68
|
if (y.category === e.DiagnosticCategory.Error) {
|
|
63
|
-
|
|
69
|
+
C = "error";
|
|
64
70
|
} else if (y.category === e.DiagnosticCategory.Warning) {
|
|
65
|
-
|
|
71
|
+
C = "warn";
|
|
66
72
|
}
|
|
67
|
-
var
|
|
73
|
+
var F = c.getSourcePosition(d, {
|
|
68
74
|
start: y.start || 1,
|
|
69
75
|
length: y.length || 1
|
|
70
76
|
});
|
|
71
|
-
|
|
77
|
+
p = F.fileName;
|
|
72
78
|
m.push({
|
|
73
|
-
severity:
|
|
79
|
+
severity: C,
|
|
74
80
|
message: y.messageText,
|
|
75
|
-
file:
|
|
76
|
-
line:
|
|
77
|
-
col:
|
|
78
|
-
endLine:
|
|
79
|
-
endColumn:
|
|
81
|
+
file: F.fileName,
|
|
82
|
+
line: F.line,
|
|
83
|
+
col: F.col,
|
|
84
|
+
endLine: F.endLine,
|
|
85
|
+
endColumn: F.endColumn
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
yield {
|
|
84
90
|
kind: "FILE_DIAGNOSTICS",
|
|
85
|
-
filePath:
|
|
91
|
+
filePath: p,
|
|
86
92
|
messages: m
|
|
87
93
|
};
|
|
88
94
|
}
|
|
@@ -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 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 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","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","schemaRef","loadRef","pluginConfig","load","rootPath","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","
|
|
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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6FaA,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,gBAAg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internal";
|
|
|
6
6
|
|
|
7
7
|
import { getGraphQLDiagnostics as r } from "@0no-co/graphqlsp/api";
|
|
8
8
|
|
|
9
|
-
import { e as
|
|
9
|
+
import { e as o, p as t } from "./index-chunk.mjs";
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var l = t(
|
|
11
|
+
var n = o((async function* _runDiagnostics(o) {
|
|
12
|
+
var n = i.dirname(o.configPath);
|
|
13
|
+
var l = t(o);
|
|
14
14
|
var s = l.createExternalFiles();
|
|
15
15
|
if (s.length) {
|
|
16
16
|
yield {
|
|
@@ -18,54 +18,60 @@ var o = n((async function* _runDiagnostics(n) {
|
|
|
18
18
|
};
|
|
19
19
|
await l.addVirtualFiles(s);
|
|
20
20
|
}
|
|
21
|
-
var g = await a(
|
|
22
|
-
rootPath:
|
|
21
|
+
var g = await a(o.pluginConfig).load({
|
|
22
|
+
rootPath: n
|
|
23
23
|
});
|
|
24
24
|
var f = l.build();
|
|
25
|
-
var
|
|
25
|
+
var c = f.buildPluginInfo(o.pluginConfig);
|
|
26
26
|
var d = f.getSourceFiles();
|
|
27
27
|
yield {
|
|
28
28
|
kind: "FILE_COUNT",
|
|
29
29
|
fileCount: d.length
|
|
30
30
|
};
|
|
31
|
-
for (var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
for (var m of d) {
|
|
32
|
+
var u = m.fileName.endsWith(".vue.ts") || m.fileName.endsWith(".svelte.ts");
|
|
33
|
+
var v = m.fileName;
|
|
34
|
+
c.config = {
|
|
35
|
+
...c.config,
|
|
36
|
+
shouldCheckForColocatedFragments: u ? !1 : c.config.shouldCheckForColocatedFragments ?? !1,
|
|
37
|
+
trackFieldUsage: u ? !1 : c.config.trackFieldUsage ?? !1
|
|
38
|
+
};
|
|
39
|
+
var h = r(v, g, c);
|
|
40
|
+
var p = [];
|
|
41
|
+
if (h && h.length) {
|
|
42
|
+
for (var C of h) {
|
|
43
|
+
if (!("messageText" in C) || "string" != typeof C.messageText || !C.file) {
|
|
38
44
|
continue;
|
|
39
45
|
}
|
|
40
46
|
var y = "info";
|
|
41
|
-
if (
|
|
47
|
+
if (C.category === e.DiagnosticCategory.Error) {
|
|
42
48
|
y = "error";
|
|
43
|
-
} else if (
|
|
49
|
+
} else if (C.category === e.DiagnosticCategory.Warning) {
|
|
44
50
|
y = "warn";
|
|
45
51
|
}
|
|
46
|
-
var
|
|
47
|
-
start:
|
|
48
|
-
length:
|
|
52
|
+
var F = f.getSourcePosition(m, {
|
|
53
|
+
start: C.start || 1,
|
|
54
|
+
length: C.length || 1
|
|
49
55
|
});
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
v = F.fileName;
|
|
57
|
+
p.push({
|
|
52
58
|
severity: y,
|
|
53
|
-
message:
|
|
54
|
-
file:
|
|
55
|
-
line:
|
|
56
|
-
col:
|
|
57
|
-
endLine:
|
|
58
|
-
endColumn:
|
|
59
|
+
message: C.messageText,
|
|
60
|
+
file: F.fileName,
|
|
61
|
+
line: F.line,
|
|
62
|
+
col: F.col,
|
|
63
|
+
endLine: F.endLine,
|
|
64
|
+
endColumn: F.endColumn
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
yield {
|
|
63
69
|
kind: "FILE_DIAGNOSTICS",
|
|
64
|
-
filePath:
|
|
65
|
-
messages:
|
|
70
|
+
filePath: v,
|
|
71
|
+
messages: p
|
|
66
72
|
};
|
|
67
73
|
}
|
|
68
74
|
}));
|
|
69
75
|
|
|
70
|
-
export {
|
|
76
|
+
export { n as runDiagnostics };
|
|
71
77
|
//# 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 { 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 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 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","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","schemaRef","loadRef","pluginConfig","load","rootPath","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","sourceFile","
|
|
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 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":";;;;;;;;;;IA6FaA,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,I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,
|
|
5
5
|
"description": "Main logic for gql.tada’s CLI tool.",
|
|
6
6
|
"author": "0no.co <hi@0no.co>",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@vue/language-core": "^2.0.17",
|
|
57
57
|
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
|
|
58
58
|
"svelte2tsx": "^0.7.6",
|
|
59
|
-
"@gql.tada/internal": "1.0.
|
|
59
|
+
"@gql.tada/internal": "1.0.3"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@0no-co/graphqlsp": "^1.12.9",
|