@gql.tada/cli-utils 1.8.2 → 1.9.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 +21 -0
- package/dist/chunks/index-chunk.js +3105 -1653
- package/dist/chunks/index-chunk.js.map +1 -1
- package/dist/chunks/index-chunk.mjs +3127 -1681
- package/dist/chunks/index-chunk.mjs.map +1 -1
- package/dist/chunks/scan-chunk.js +74 -0
- package/dist/chunks/scan-chunk.js.map +1 -0
- package/dist/chunks/scan-chunk.mjs +55 -0
- package/dist/chunks/scan-chunk.mjs.map +1 -0
- package/dist/chunks/thread-chunk2.js +79 -124
- package/dist/chunks/thread-chunk2.js.map +1 -1
- package/dist/chunks/thread-chunk2.mjs +194 -239
- package/dist/chunks/thread-chunk2.mjs.map +1 -1
- package/dist/chunks/thread-chunk3.js +124 -81
- package/dist/chunks/thread-chunk3.js.map +1 -1
- package/dist/chunks/thread-chunk3.mjs +131 -67
- package/dist/chunks/thread-chunk3.mjs.map +1 -1
- package/dist/chunks/thread-chunk4.js +112 -0
- package/dist/chunks/thread-chunk4.js.map +1 -0
- package/dist/chunks/thread-chunk4.mjs +91 -0
- package/dist/chunks/thread-chunk4.mjs.map +1 -0
- package/dist/gql-tada-cli.d.ts +25 -1
- package/dist/gql-tada-cli.js +2 -0
- package/dist/gql-tada-cli.js.map +1 -1
- package/dist/gql-tada-cli.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,91 +1,155 @@
|
|
|
1
1
|
import e from "typescript";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import i from "node:v8";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import r from "node:vm";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { getSchemaNamesFromConfig as n } from "@gql.tada/internal";
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { findAllCallExpressions as o } from "@0no-co/graphqlsp/api";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { e as t } from "./index-chunk2.mjs";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
import { h as a } from "./scan-chunk.mjs";
|
|
14
|
+
|
|
15
|
+
import { p as s } from "./index-chunk.mjs";
|
|
16
|
+
|
|
17
|
+
var l = 262144e4;
|
|
18
|
+
|
|
19
|
+
function shouldScanFile(e) {
|
|
20
|
+
if (e.endsWith(".d.ts") || e.endsWith(".d.mts") || e.endsWith(".d.cts")) {
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
return !/(^|[/\\])node_modules([/\\]|$)/.test(e);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var c;
|
|
27
|
+
|
|
28
|
+
function forceGc() {
|
|
29
|
+
if (void 0 === c) {
|
|
30
|
+
var e = globalThis.gc;
|
|
31
|
+
if ("function" == typeof e) {
|
|
32
|
+
c = e;
|
|
33
|
+
} else {
|
|
34
|
+
try {
|
|
35
|
+
i.setFlagsFromString("--expose-gc");
|
|
36
|
+
c = r.runInNewContext("gc");
|
|
37
|
+
i.setFlagsFromString("--no-expose-gc");
|
|
38
|
+
} catch {
|
|
39
|
+
c = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (c) {
|
|
44
|
+
c();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var f = t((async function* _runScan(i) {
|
|
49
|
+
var r = n(i.pluginConfig);
|
|
50
|
+
var t = s(i);
|
|
51
|
+
var c = t.createExternalFiles();
|
|
52
|
+
if (c.length) {
|
|
18
53
|
yield {
|
|
19
54
|
kind: "EXTERNAL_WARNING"
|
|
20
55
|
};
|
|
21
|
-
await
|
|
56
|
+
await t.addVirtualFiles(c);
|
|
22
57
|
}
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
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();
|
|
58
|
+
var f = t.build();
|
|
59
|
+
var m = f.buildPluginInfo(i.pluginConfig);
|
|
60
|
+
var u = t.rootFileNames.filter(shouldScanFile);
|
|
41
61
|
yield {
|
|
42
62
|
kind: "FILE_COUNT",
|
|
43
|
-
fileCount:
|
|
63
|
+
fileCount: u.length
|
|
44
64
|
};
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
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";
|
|
65
|
+
var processSourceFile = (i, n, s) => {
|
|
66
|
+
var l = i.fileName;
|
|
67
|
+
var c = [];
|
|
68
|
+
var f = [];
|
|
69
|
+
var m = function collectModuleImports(i, r) {
|
|
70
|
+
var n = [];
|
|
71
|
+
for (var o of i.statements) {
|
|
72
|
+
if (e.isImportDeclaration(o) && e.isStringLiteral(o.moduleSpecifier)) {
|
|
73
|
+
var t = r(o.moduleSpecifier.text, i.fileName);
|
|
74
|
+
if (t && shouldScanFile(t)) {
|
|
75
|
+
n.push(t);
|
|
76
|
+
}
|
|
65
77
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
}
|
|
79
|
+
return n;
|
|
80
|
+
}(i, t.resolveModulePath.bind(t));
|
|
81
|
+
if (!a(i)) {
|
|
82
|
+
return {
|
|
83
|
+
filePath: l,
|
|
84
|
+
documents: c,
|
|
85
|
+
imports: m,
|
|
86
|
+
warnings: f
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
var u = o(i, s, {
|
|
90
|
+
searchExternal: !1,
|
|
91
|
+
collectFragments: !1
|
|
92
|
+
}).nodes;
|
|
93
|
+
for (var d of u) {
|
|
94
|
+
var h = d.node.parent;
|
|
95
|
+
if (!e.isCallExpression(h)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
var p = n.getSourcePosition(i, h.getStart());
|
|
99
|
+
l = p.fileName;
|
|
100
|
+
if (!r.has(d.schema)) {
|
|
101
|
+
f.push({
|
|
102
|
+
message: d.schema ? `The '${d.schema}' schema is not in the configuration but was referenced by a document.` : r.size > 1 ? "The document is not for a known schema. Have you re-generated the output file?" : "Multiple schemas are configured, but the document is not for a specific schema.",
|
|
103
|
+
file: p.fileName,
|
|
104
|
+
line: p.line,
|
|
105
|
+
col: p.col
|
|
79
106
|
});
|
|
107
|
+
continue;
|
|
80
108
|
}
|
|
109
|
+
c.push({
|
|
110
|
+
schemaName: d.schema,
|
|
111
|
+
document: d.node.text,
|
|
112
|
+
filePath: p.fileName,
|
|
113
|
+
line: p.line,
|
|
114
|
+
col: p.col
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
filePath: l,
|
|
119
|
+
documents: c,
|
|
120
|
+
imports: m,
|
|
121
|
+
warnings: f
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
var isHeapOverSoftLimit = () => {
|
|
125
|
+
if (process.memoryUsage().heapUsed < l) {
|
|
126
|
+
return !1;
|
|
127
|
+
}
|
|
128
|
+
forceGc();
|
|
129
|
+
return process.memoryUsage().heapUsed >= l;
|
|
130
|
+
};
|
|
131
|
+
var d = 0;
|
|
132
|
+
for (var h of u) {
|
|
133
|
+
if (d > 0 && (d >= 1e3 || isHeapOverSoftLimit())) {
|
|
134
|
+
m = (f = t.build()).buildPluginInfo(i.pluginConfig);
|
|
135
|
+
forceGc();
|
|
136
|
+
d = 0;
|
|
137
|
+
}
|
|
138
|
+
var p = f.getSourceFile(h);
|
|
139
|
+
if (!p) {
|
|
140
|
+
continue;
|
|
81
141
|
}
|
|
142
|
+
var {filePath: g, documents: v, imports: F, warnings: N} = processSourceFile(p, f, m);
|
|
143
|
+
d++;
|
|
82
144
|
yield {
|
|
83
|
-
kind: "
|
|
84
|
-
filePath:
|
|
85
|
-
|
|
145
|
+
kind: "FILE_SCAN",
|
|
146
|
+
filePath: g,
|
|
147
|
+
documents: v,
|
|
148
|
+
imports: F,
|
|
149
|
+
warnings: N
|
|
86
150
|
};
|
|
87
151
|
}
|
|
88
152
|
}));
|
|
89
153
|
|
|
90
|
-
export {
|
|
154
|
+
export { f as runScan };
|
|
91
155
|
//# sourceMappingURL=thread-chunk3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-chunk3.mjs","sources":["../../src/commands/
|
|
1
|
+
{"version":3,"file":"thread-chunk3.mjs","sources":["../../src/commands/scan/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport v8 from 'node:v8';\nimport vm from 'node:vm';\nimport { getSchemaNamesFromConfig } from '@gql.tada/internal';\nimport { findAllCallExpressions } from '@0no-co/graphqlsp/api';\n\nimport type { ProgramContainer, PluginCreateInfo } from '../../ts';\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\nimport { hasGraphQLDocumentCandidate } from '../turbo/scan';\n\nimport type { ScanParams, ScanSignal, RawScanDocument, ScanWarning } from './types';\n\nconst HEAP_SOFT_LIMIT_BYTES = 2_500 * 1_024 * 1_024;\nconst SCAN_MAX_BATCH = 1_000;\n\nfunction shouldScanFile(fileName: string): boolean {\n if (fileName.endsWith('.d.ts') || fileName.endsWith('.d.mts') || fileName.endsWith('.d.cts')) {\n return false;\n }\n return !/(^|[/\\\\])node_modules([/\\\\]|$)/.test(fileName);\n}\n\nfunction collectModuleImports(\n sourceFile: ts.SourceFile,\n resolveModulePath: (importSpecifier: string, fromPath: string) => string | undefined\n): string[] {\n const imports: string[] = [];\n for (const node of sourceFile.statements) {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {\n const resolved = resolveModulePath(node.moduleSpecifier.text, sourceFile.fileName);\n if (resolved && shouldScanFile(resolved)) imports.push(resolved);\n }\n }\n return imports;\n}\n\nasync function* _runScan(params: ScanParams): AsyncIterableIterator<ScanSignal> {\n const schemaNames = getSchemaNamesFromConfig(params.pluginConfig);\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 let container = factory.build();\n let pluginInfo = container.buildPluginInfo(params.pluginConfig);\n const fileNames = factory.rootFileNames.filter(shouldScanFile);\n\n yield { kind: 'FILE_COUNT', fileCount: fileNames.length };\n\n const processSourceFile = (\n sourceFile: ts.SourceFile,\n container: ProgramContainer,\n pluginInfo: PluginCreateInfo\n ): {\n filePath: string;\n documents: RawScanDocument[];\n imports: string[];\n warnings: ScanWarning[];\n } => {\n let filePath = sourceFile.fileName;\n const documents: RawScanDocument[] = [];\n const warnings: ScanWarning[] = [];\n\n // The full import graph is emitted for every project file (not just those\n // with documents), so the analysis layer can compute reachability.\n const imports = collectModuleImports(sourceFile, factory.resolveModulePath.bind(factory));\n\n if (!hasGraphQLDocumentCandidate(sourceFile)) {\n return { filePath, documents, imports, warnings };\n }\n\n const calls = findAllCallExpressions(sourceFile, pluginInfo, {\n searchExternal: false,\n collectFragments: false,\n }).nodes;\n\n for (const call of calls) {\n const callExpression = call.node.parent;\n if (!ts.isCallExpression(callExpression)) continue;\n\n const position = container.getSourcePosition(sourceFile, callExpression.getStart());\n filePath = position.fileName;\n\n if (!schemaNames.has(call.schema)) {\n warnings.push({\n message: call.schema\n ? `The '${call.schema}' schema is not in the configuration but was referenced by a document.`\n : schemaNames.size > 1\n ? 'The document is not for a known schema. Have you re-generated the output file?'\n : 'Multiple schemas are configured, but the document is not for a specific schema.',\n file: position.fileName,\n line: position.line,\n col: position.col,\n });\n continue;\n }\n\n documents.push({\n schemaName: call.schema,\n document: call.node.text,\n filePath: position.fileName,\n line: position.line,\n col: position.col,\n });\n }\n\n return { filePath, documents, imports, warnings };\n };\n\n const isHeapOverSoftLimit = (): boolean => {\n if (process.memoryUsage().heapUsed < HEAP_SOFT_LIMIT_BYTES) return false;\n forceGc();\n return process.memoryUsage().heapUsed >= HEAP_SOFT_LIMIT_BYTES;\n };\n\n let filesInBatch = 0;\n\n for (const fileName of fileNames) {\n // When heap or batch limit is reached, rotate the program to free source files.\n if (filesInBatch > 0 && (filesInBatch >= SCAN_MAX_BATCH || isHeapOverSoftLimit())) {\n container = factory.build();\n pluginInfo = container.buildPluginInfo(params.pluginConfig);\n forceGc();\n filesInBatch = 0;\n }\n\n const sourceFile = container.getSourceFile(fileName);\n if (!sourceFile) continue;\n\n const { filePath, documents, imports, warnings } = processSourceFile(\n sourceFile,\n container,\n pluginInfo\n );\n filesInBatch++;\n\n yield { kind: 'FILE_SCAN', filePath, documents, imports, warnings };\n }\n}\n\nlet cachedGc: (() => void) | null | undefined;\n\nfunction forceGc(): void {\n if (cachedGc === undefined) {\n const existing = (globalThis as { gc?: () => void }).gc;\n if (typeof existing === 'function') {\n cachedGc = existing;\n } else {\n try {\n v8.setFlagsFromString('--expose-gc');\n cachedGc = vm.runInNewContext('gc') as () => void;\n v8.setFlagsFromString('--no-expose-gc');\n } catch {\n cachedGc = null;\n }\n }\n }\n if (cachedGc) cachedGc();\n}\n\nexport const runScan = expose(_runScan);\n"],"names":["HEAP_SOFT_LIMIT_BYTES","shouldScanFile","fileName","endsWith","test","cachedGc","forceGc","undefined","existing","globalThis","gc","v8","setFlagsFromString","vm","runInNewContext","runScan","expose","async","_runScan","params","schemaNames","getSchemaNamesFromConfig","pluginConfig","factory","programFactory","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","fileNames","rootFileNames","filter","fileCount","processSourceFile","sourceFile","filePath","documents","warnings","imports","collectModuleImports","resolveModulePath","node","statements","ts","isImportDeclaration","isStringLiteral","moduleSpecifier","resolved","text","push","bind","hasGraphQLDocumentCandidate","calls","findAllCallExpressions","searchExternal","collectFragments","nodes","call","callExpression","parent","isCallExpression","position","getSourcePosition","getStart","has","schema","message","size","file","line","col","schemaName","document","isHeapOverSoftLimit","process","memoryUsage","heapUsed","filesInBatch","getSourceFile"],"mappings":"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"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var e = require("typescript");
|
|
2
|
+
|
|
3
|
+
var r = require("node:path");
|
|
4
|
+
|
|
5
|
+
var a = require("@gql.tada/internal");
|
|
6
|
+
|
|
7
|
+
var i = require("@0no-co/graphqlsp/api");
|
|
8
|
+
|
|
9
|
+
var t = require("./index-chunk2.js");
|
|
10
|
+
|
|
11
|
+
var n = require("./index-chunk.js");
|
|
12
|
+
|
|
13
|
+
function _interopNamespaceDefault(e) {
|
|
14
|
+
var r = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach((function(a) {
|
|
17
|
+
if ("default" !== a) {
|
|
18
|
+
var i = Object.getOwnPropertyDescriptor(e, a);
|
|
19
|
+
Object.defineProperty(r, a, i.get ? i : {
|
|
20
|
+
enumerable: !0,
|
|
21
|
+
get: function() {
|
|
22
|
+
return e[a];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
r.default = e;
|
|
29
|
+
return r;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var o = _interopNamespaceDefault(r);
|
|
33
|
+
|
|
34
|
+
var l = t.expose((async function* _runDiagnostics(r) {
|
|
35
|
+
var t = o.dirname(r.configPath);
|
|
36
|
+
var l = n.programFactory(r);
|
|
37
|
+
var s = l.createExternalFiles();
|
|
38
|
+
if (s.length) {
|
|
39
|
+
yield {
|
|
40
|
+
kind: "EXTERNAL_WARNING"
|
|
41
|
+
};
|
|
42
|
+
await l.addVirtualFiles(s);
|
|
43
|
+
}
|
|
44
|
+
var c = await a.loadRef(r.pluginConfig).load({
|
|
45
|
+
rootPath: t
|
|
46
|
+
});
|
|
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();
|
|
62
|
+
yield {
|
|
63
|
+
kind: "FILE_COUNT",
|
|
64
|
+
fileCount: d.length
|
|
65
|
+
};
|
|
66
|
+
for (var v of d) {
|
|
67
|
+
var p = v.fileName.endsWith(".vue.ts") || v.fileName.endsWith(".svelte.ts");
|
|
68
|
+
var h = v.fileName;
|
|
69
|
+
f.config = {
|
|
70
|
+
...f.config,
|
|
71
|
+
shouldCheckForColocatedFragments: p ? !1 : f.config.shouldCheckForColocatedFragments ?? !1,
|
|
72
|
+
trackFieldUsage: p ? !1 : f.config.trackFieldUsage ?? !1
|
|
73
|
+
};
|
|
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) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
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";
|
|
86
|
+
}
|
|
87
|
+
var N = u.getSourcePosition(v, {
|
|
88
|
+
start: C.start || 1,
|
|
89
|
+
length: C.length || 1
|
|
90
|
+
});
|
|
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
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
yield {
|
|
104
|
+
kind: "FILE_DIAGNOSTICS",
|
|
105
|
+
filePath: h,
|
|
106
|
+
messages: y
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
exports.runDiagnostics = l;
|
|
112
|
+
//# sourceMappingURL=thread-chunk4.js.map
|
|
@@ -0,0 +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,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;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import e from "typescript";
|
|
2
|
+
|
|
3
|
+
import * as i from "node:path";
|
|
4
|
+
|
|
5
|
+
import { loadRef as a } from "@gql.tada/internal";
|
|
6
|
+
|
|
7
|
+
import { getGraphQLDiagnostics as r } from "@0no-co/graphqlsp/api";
|
|
8
|
+
|
|
9
|
+
import { e as n } from "./index-chunk2.mjs";
|
|
10
|
+
|
|
11
|
+
import { p as o } from "./index-chunk.mjs";
|
|
12
|
+
|
|
13
|
+
var t = n((async function* _runDiagnostics(n) {
|
|
14
|
+
var t = i.dirname(n.configPath);
|
|
15
|
+
var l = o(n);
|
|
16
|
+
var s = l.createExternalFiles();
|
|
17
|
+
if (s.length) {
|
|
18
|
+
yield {
|
|
19
|
+
kind: "EXTERNAL_WARNING"
|
|
20
|
+
};
|
|
21
|
+
await l.addVirtualFiles(s);
|
|
22
|
+
}
|
|
23
|
+
var g = await a(n.pluginConfig).load({
|
|
24
|
+
rootPath: t
|
|
25
|
+
});
|
|
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();
|
|
41
|
+
yield {
|
|
42
|
+
kind: "FILE_COUNT",
|
|
43
|
+
fileCount: d.length
|
|
44
|
+
};
|
|
45
|
+
for (var u of d) {
|
|
46
|
+
var p = u.fileName.endsWith(".vue.ts") || u.fileName.endsWith(".svelte.ts");
|
|
47
|
+
var v = u.fileName;
|
|
48
|
+
m.config = {
|
|
49
|
+
...m.config,
|
|
50
|
+
shouldCheckForColocatedFragments: p ? !1 : m.config.shouldCheckForColocatedFragments ?? !1,
|
|
51
|
+
trackFieldUsage: p ? !1 : m.config.trackFieldUsage ?? !1
|
|
52
|
+
};
|
|
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) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
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";
|
|
65
|
+
}
|
|
66
|
+
var k = c.getSourcePosition(u, {
|
|
67
|
+
start: y.start || 1,
|
|
68
|
+
length: y.length || 1
|
|
69
|
+
});
|
|
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
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
yield {
|
|
83
|
+
kind: "FILE_DIAGNOSTICS",
|
|
84
|
+
filePath: v,
|
|
85
|
+
messages: C
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
export { t as runDiagnostics };
|
|
91
|
+
//# sourceMappingURL=thread-chunk4.mjs.map
|
|
@@ -0,0 +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;;"}
|
package/dist/gql-tada-cli.d.ts
CHANGED
|
@@ -103,16 +103,40 @@ interface TurboOptions {
|
|
|
103
103
|
*/
|
|
104
104
|
declare function generateTurbo(opts: TurboOptions): Promise<void>;
|
|
105
105
|
|
|
106
|
+
type ScanFormat = 'json';
|
|
107
|
+
interface ScanOptions {
|
|
108
|
+
/** The `tsconfig.json` to use for configurations and the TypeScript program. */
|
|
109
|
+
tsconfig: string | undefined;
|
|
110
|
+
/** When `json`, write the JSON report; otherwise show the terminal report. */
|
|
111
|
+
format: ScanFormat | undefined;
|
|
112
|
+
/** When set, output the pure relationship graph (implies machine output). */
|
|
113
|
+
graph: boolean;
|
|
114
|
+
/** Where to write machine output to. Defaults to standard output. */
|
|
115
|
+
output: string | undefined;
|
|
116
|
+
/** Whether to fail with a non-zero exit code if any warnings are reported. */
|
|
117
|
+
failOnWarn: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Scans a project for all GraphQL documents and fragments, keys them to the
|
|
121
|
+
* schema, and emits a JSON report (when piped or given `--output`) or a
|
|
122
|
+
* human-readable terminal report.
|
|
123
|
+
*
|
|
124
|
+
* @see {@link https://gql-tada.0no.co/reference/gql-tada-cli#scan}
|
|
125
|
+
*/
|
|
126
|
+
declare function scan(opts: ScanOptions): Promise<void>;
|
|
127
|
+
|
|
106
128
|
declare const api_generateOutput: typeof generateOutput;
|
|
107
129
|
declare const api_generatePersisted: typeof generatePersisted;
|
|
108
130
|
declare const api_generateSchema: typeof generateSchema;
|
|
109
131
|
declare const api_generateTurbo: typeof generateTurbo;
|
|
132
|
+
declare const api_scan: typeof scan;
|
|
110
133
|
declare namespace api {
|
|
111
134
|
export {
|
|
112
135
|
api_generateOutput as generateOutput,
|
|
113
136
|
api_generatePersisted as generatePersisted,
|
|
114
137
|
api_generateSchema as generateSchema,
|
|
115
138
|
api_generateTurbo as generateTurbo,
|
|
139
|
+
api_scan as scan,
|
|
116
140
|
};
|
|
117
141
|
}
|
|
118
142
|
|
|
@@ -120,4 +144,4 @@ declare function _main(): Promise<void>;
|
|
|
120
144
|
type MainFn = typeof _main & typeof api;
|
|
121
145
|
declare const main: MainFn;
|
|
122
146
|
|
|
123
|
-
export { main as default, generateOutput, generatePersisted, generateSchema, generateTurbo };
|
|
147
|
+
export { main as default, generateOutput, generatePersisted, generateSchema, generateTurbo, scan };
|
package/dist/gql-tada-cli.js
CHANGED
package/dist/gql-tada-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql-tada-cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gql-tada-cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/gql-tada-cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { m as default, g as generateOutput, a as generatePersisted, b as generateSchema, c as generateTurbo } from "./chunks/index-chunk.mjs";
|
|
1
|
+
export { m as default, g as generateOutput, a as generatePersisted, b as generateSchema, c as generateTurbo, d as scan } from "./chunks/index-chunk.mjs";
|
|
2
2
|
//# sourceMappingURL=gql-tada-cli.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gql.tada/cli-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.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,9 +49,9 @@
|
|
|
49
49
|
"wonka": "^6.3.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@0no-co/graphqlsp": "^1.17.
|
|
52
|
+
"@0no-co/graphqlsp": "^1.17.2",
|
|
53
53
|
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
|
|
54
|
-
"@gql.tada/internal": "1.
|
|
54
|
+
"@gql.tada/internal": "1.2.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@gql.tada/svelte-support": {
|