@gql.tada/cli-utils 1.2.0 → 1.2.1-canary-e42804ea2a1e64b58239cd45b152b047b9afcd17
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 +11 -0
- package/dist/chunks/index-chunk.js +1050 -558
- package/dist/chunks/index-chunk.js.map +1 -1
- package/dist/chunks/index-chunk.mjs +919 -425
- package/dist/chunks/index-chunk.mjs.map +1 -1
- package/dist/chunks/svelte-chunk.js +53 -51
- package/dist/chunks/svelte-chunk.js.map +1 -1
- package/dist/chunks/svelte-chunk.mjs +58 -56
- package/dist/chunks/svelte-chunk.mjs.map +1 -1
- package/dist/chunks/thread-chunk.js +97 -130
- package/dist/chunks/thread-chunk.js.map +1 -1
- package/dist/chunks/thread-chunk.mjs +94 -106
- package/dist/chunks/thread-chunk.mjs.map +1 -1
- package/dist/chunks/thread-chunk2.js +46 -82
- package/dist/chunks/thread-chunk2.js.map +1 -1
- package/dist/chunks/thread-chunk2.mjs +44 -59
- package/dist/chunks/thread-chunk2.mjs.map +1 -1
- package/dist/chunks/thread-chunk3.js +45 -50
- package/dist/chunks/thread-chunk3.js.map +1 -1
- package/dist/chunks/thread-chunk3.mjs +45 -50
- package/dist/chunks/thread-chunk3.mjs.map +1 -1
- package/dist/chunks/vue-chunk.js +18 -15
- package/dist/chunks/vue-chunk.js.map +1 -1
- package/dist/chunks/vue-chunk.mjs +18 -15
- package/dist/chunks/vue-chunk.mjs.map +1 -1
- package/dist/gql-tada-cli.js +58 -49
- package/dist/gql-tada-cli.js.map +1 -1
- package/dist/gql-tada-cli.mjs +656 -647
- package/dist/gql-tada-cli.mjs.map +1 -1
- package/package.json +2 -3
- package/dist/chunks/project-chunk.js +0 -63
- package/dist/chunks/project-chunk.js.map +0 -1
- package/dist/chunks/project-chunk.mjs +0 -65
- package/dist/chunks/project-chunk.mjs.map +0 -1
|
@@ -1,90 +1,75 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "typescript";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { e as a, p as r } from "./index-chunk.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
typescript: r
|
|
12
|
-
});
|
|
13
|
-
var l = e.dirname(i.configPath);
|
|
14
|
-
var f = new a({
|
|
15
|
-
tsConfigFilePath: i.configPath,
|
|
16
|
-
skipAddingFilesFromTsConfig: !0
|
|
5
|
+
var i = a((async function* _runTurbo(a) {
|
|
6
|
+
var i = r(a);
|
|
7
|
+
i.addSourceFile({
|
|
8
|
+
fileId: "__gql-tada-override__.d.ts",
|
|
9
|
+
sourceText: n,
|
|
10
|
+
scriptKind: e.ScriptKind.TS
|
|
17
11
|
});
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
scriptKind: t.TS
|
|
21
|
-
});
|
|
22
|
-
if (u._markAsInProject) {
|
|
23
|
-
u._markAsInProject();
|
|
24
|
-
}
|
|
25
|
-
f.addSourceFilesFromTsConfig(i.configPath);
|
|
26
|
-
var g = await s(l, f, r);
|
|
27
|
-
if (g) {
|
|
12
|
+
var l = i.createExternalFiles();
|
|
13
|
+
if (l.length) {
|
|
28
14
|
yield {
|
|
29
15
|
kind: "EXTERNAL_WARNING"
|
|
30
16
|
};
|
|
17
|
+
await i.addVirtualFiles(l);
|
|
31
18
|
}
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
return !e.relative(i.rootPath, a).startsWith("..");
|
|
35
|
-
}));
|
|
19
|
+
var o = i.build();
|
|
20
|
+
var s = o.getSourceFiles();
|
|
36
21
|
yield {
|
|
37
22
|
kind: "FILE_COUNT",
|
|
38
|
-
fileCount:
|
|
23
|
+
fileCount: s.length
|
|
39
24
|
};
|
|
40
|
-
var
|
|
41
|
-
for (var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
for (var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
if (!
|
|
50
|
-
var F =
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
var d = o.program.getTypeChecker();
|
|
26
|
+
for (var p of s) {
|
|
27
|
+
var u = p.fileName;
|
|
28
|
+
var g = {};
|
|
29
|
+
var c = [];
|
|
30
|
+
var f = findAllCallExpressions(p, a.pluginConfig);
|
|
31
|
+
for (var m of f) {
|
|
32
|
+
var y = d.getTypeAtLocation(m);
|
|
33
|
+
var T = d.getTypeAtLocation(m.arguments[0]);
|
|
34
|
+
if (!y.symbol || "TadaDocumentNode" !== y.symbol.getEscapedName()) {
|
|
35
|
+
var F = o.getSourcePosition(p, m.getStart());
|
|
36
|
+
u = F.fileName;
|
|
37
|
+
c.push({
|
|
53
38
|
message: 'The discovered document is not of type "TadaDocumentNode".\nIf this is unexpected, please file an issue describing your case.',
|
|
54
|
-
file: F.
|
|
39
|
+
file: F.fileName,
|
|
55
40
|
line: F.line,
|
|
56
41
|
col: F.col
|
|
57
42
|
});
|
|
58
43
|
continue;
|
|
59
44
|
}
|
|
60
|
-
|
|
45
|
+
g["value" in T && "string" == typeof T.value && 0 == (T.flags & e.TypeFlags.StringLiteral) ? JSON.stringify(T.value) : d.typeToString(T, m, t)] = d.typeToString(y, m, t);
|
|
61
46
|
}
|
|
62
47
|
yield {
|
|
63
48
|
kind: "FILE_TURBO",
|
|
64
|
-
filePath:
|
|
65
|
-
cache:
|
|
66
|
-
warnings:
|
|
49
|
+
filePath: u,
|
|
50
|
+
cache: g,
|
|
51
|
+
warnings: c
|
|
67
52
|
};
|
|
68
53
|
}
|
|
69
54
|
}));
|
|
70
55
|
|
|
71
|
-
var
|
|
56
|
+
var t = e.TypeFormatFlags.NoTruncation | e.TypeFormatFlags.NoTypeReduction | e.TypeFormatFlags.InTypeAlias | e.TypeFormatFlags.UseFullyQualifiedType | e.TypeFormatFlags.GenerateNamesForShadowedTypeParams | e.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | e.TypeFormatFlags.AllowUniqueESSymbolType | e.TypeFormatFlags.WriteTypeArgumentsOfSignature;
|
|
72
57
|
|
|
73
|
-
var
|
|
58
|
+
var n = "\nimport * as _gqlTada from 'gql.tada';\ndeclare module 'gql.tada' {\n interface setupCache {\n readonly __cacheDisabled: true;\n }\n}\n".trim();
|
|
74
59
|
|
|
75
|
-
function findAllCallExpressions(
|
|
76
|
-
var
|
|
77
|
-
var t = new Set([
|
|
78
|
-
!function find(
|
|
79
|
-
if (
|
|
80
|
-
|
|
60
|
+
function findAllCallExpressions(a, r) {
|
|
61
|
+
var i = [];
|
|
62
|
+
var t = new Set([ r.template, "graphql", "gql" ].filter(Boolean));
|
|
63
|
+
!function find(a) {
|
|
64
|
+
if (e.isCallExpression(a) && t.has(a.expression.getText())) {
|
|
65
|
+
i.push(a);
|
|
81
66
|
return;
|
|
82
67
|
} else {
|
|
83
|
-
|
|
68
|
+
e.forEachChild(a, find);
|
|
84
69
|
}
|
|
85
|
-
}(
|
|
86
|
-
return
|
|
70
|
+
}(a);
|
|
71
|
+
return i;
|
|
87
72
|
}
|
|
88
73
|
|
|
89
|
-
export {
|
|
74
|
+
export { i as runTurbo };
|
|
90
75
|
//# sourceMappingURL=thread-chunk2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-chunk2.mjs","sources":["../../src/commands/turbo/thread.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"thread-chunk2.mjs","sources":["../../src/commands/turbo/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { TurboSignal, TurboWarning } from './types';\n\nexport interface TurboParams {\n rootPath: string;\n configPath: string;\n pluginConfig: GraphQLSPConfig;\n}\n\nasync function* _runTurbo(params: TurboParams): AsyncIterableIterator<TurboSignal> {\n const factory = programFactory(params);\n\n // NOTE: We add our override declaration here before loading all files\n // This sets `__cacheDisabled` on the turbo cache, which disables the cache temporarily\n // If we don't disable the cache then we couldn't regenerate it from inferred types\n factory.addSourceFile({\n fileId: '__gql-tada-override__.d.ts',\n sourceText: DECLARATION_OVERRIDE,\n scriptKind: ts.ScriptKind.TS,\n });\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 sourceFiles = container.getSourceFiles();\n\n yield {\n kind: 'FILE_COUNT',\n fileCount: sourceFiles.length,\n };\n\n const checker = container.program.getTypeChecker();\n for (const sourceFile of sourceFiles) {\n let filePath = sourceFile.fileName;\n const cache: Record<string, string> = {};\n const warnings: TurboWarning[] = [];\n\n const calls = findAllCallExpressions(sourceFile, params.pluginConfig);\n for (const call of calls) {\n const returnType = checker.getTypeAtLocation(call);\n const argumentType = checker.getTypeAtLocation(call.arguments[0]);\n // NOTE: `returnType.symbol` is incorrectly typed and is in fact\n // optional and not always present\n if (!returnType.symbol || returnType.symbol.getEscapedName() !== 'TadaDocumentNode') {\n const position = container.getSourcePosition(sourceFile, call.getStart());\n filePath = position.fileName;\n warnings.push({\n message:\n `The discovered document is not of type \"TadaDocumentNode\".\\n` +\n 'If this is unexpected, please file an issue describing your case.',\n file: position.fileName,\n line: position.line,\n col: position.col,\n });\n continue;\n }\n\n const key: string =\n 'value' in argumentType &&\n typeof argumentType.value === 'string' &&\n (argumentType.flags & ts.TypeFlags.StringLiteral) === 0\n ? JSON.stringify(argumentType.value)\n : checker.typeToString(argumentType, call, BUILDER_FLAGS);\n cache[key] = checker.typeToString(returnType, call, BUILDER_FLAGS);\n }\n\n yield {\n kind: 'FILE_TURBO',\n filePath,\n cache,\n warnings,\n };\n }\n}\n\nexport const runTurbo = expose(_runTurbo);\n\nconst BUILDER_FLAGS: ts.TypeFormatFlags =\n ts.TypeFormatFlags.NoTruncation |\n ts.TypeFormatFlags.NoTypeReduction |\n ts.TypeFormatFlags.InTypeAlias |\n ts.TypeFormatFlags.UseFullyQualifiedType |\n ts.TypeFormatFlags.GenerateNamesForShadowedTypeParams |\n ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope |\n ts.TypeFormatFlags.AllowUniqueESSymbolType |\n ts.TypeFormatFlags.WriteTypeArgumentsOfSignature;\n\nconst DECLARATION_OVERRIDE = `\nimport * as _gqlTada from 'gql.tada';\ndeclare module 'gql.tada' {\n interface setupCache {\n readonly __cacheDisabled: true;\n }\n}\n`.trim();\n\nfunction findAllCallExpressions(\n sourceFile: ts.SourceFile,\n config: GraphQLSPConfig\n): Array<ts.CallExpression> {\n const result: ts.CallExpression[] = [];\n const templates = new Set([config.template, 'graphql', 'gql'].filter(Boolean));\n function find(node: ts.Node) {\n if (ts.isCallExpression(node) && templates.has(node.expression.getText())) {\n result.push(node);\n return;\n } else {\n ts.forEachChild(node, find);\n }\n }\n find(sourceFile);\n return result;\n}\n"],"names":["runTurbo","expose","async","_runTurbo","params","factory","programFactory","addSourceFile","fileId","sourceText","DECLARATION_OVERRIDE","scriptKind","ts","ScriptKind","TS","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","sourceFiles","getSourceFiles","fileCount","checker","program","getTypeChecker","sourceFile","filePath","fileName","cache","warnings","calls","findAllCallExpressions","pluginConfig","call","returnType","getTypeAtLocation","argumentType","arguments","symbol","getEscapedName","position","getSourcePosition","getStart","push","message","file","line","col","value","flags","TypeFlags","StringLiteral","JSON","stringify","typeToString","BUILDER_FLAGS","TypeFormatFlags","NoTruncation","NoTypeReduction","InTypeAlias","UseFullyQualifiedType","GenerateNamesForShadowedTypeParams","UseAliasDefinedOutsideCurrentScope","AllowUniqueESSymbolType","WriteTypeArgumentsOfSignature","trim","config","result","templates","Set","template","filter","Boolean","find","node","isCallExpression","has","expression","getText","forEachChild"],"mappings":";;;;IAoFaA,IAAWC,GAtExBC,gBAAgBC,UAAUC;EACxB,IAAMC,IAAUC,EAAeF;EAK/BC,EAAQE,cAAc;IACpBC,QAAQ;IACRC,YAAYC;IACZC,YAAYC,EAAGC,WAAWC;;EAG5B,IAAMC,IAAgBV,EAAQW;EAC9B,IAAID,EAAcE,QAAQ;UAClB;MAAEC,MAAM;;UACRb,EAAQc,gBAAgBJ;AAChC;EAEA,IAAMK,IAAYf,EAAQgB;EAC1B,IAAMC,IAAcF,EAAUG;QAExB;IACJL,MAAM;IACNM,WAAWF,EAAYL;;EAGzB,IAAMQ,IAAUL,EAAUM,QAAQC;EAClC,KAAK,IAAMC,KAAcN,GAAa;IACpC,IAAIO,IAAWD,EAAWE;IAC1B,IAAMC,IAAgC,CAAA;IACtC,IAAMC,IAA2B;IAEjC,IAAMC,IAAQC,uBAAuBN,GAAYxB,EAAO+B;IACxD,KAAK,IAAMC,KAAQH,GAAO;MACxB,IAAMI,IAAaZ,EAAQa,kBAAkBF;MAC7C,IAAMG,IAAed,EAAQa,kBAAkBF,EAAKI,UAAU;MAG9D,KAAKH,EAAWI,UAAiD,uBAAvCJ,EAAWI,OAAOC,kBAAyC;QACnF,IAAMC,IAAWvB,EAAUwB,kBAAkBhB,GAAYQ,EAAKS;QAC9DhB,IAAWc,EAASb;QACpBE,EAASc,KAAK;UACZC,SACG;UAEHC,MAAML,EAASb;UACfmB,MAAMN,EAASM;UACfC,KAAKP,EAASO;;QAEhB;AACF;MAQAnB,EALE,WAAWQ,KACmB,mBAAvBA,EAAaY,SACkC,MAArDZ,EAAaa,QAAQxC,EAAGyC,UAAUC,iBAC/BC,KAAKC,UAAUjB,EAAaY,SAC5B1B,EAAQgC,aAAalB,GAAcH,GAAMsB,MAClCjC,EAAQgC,aAAapB,GAAYD,GAAMsB;AACtD;UAEM;MACJxC,MAAM;MACNW;MACAE;MACAC;;AAEJ;AACF;;AAIA,IAAM0B,IACJ9C,EAAG+C,gBAAgBC,eACnBhD,EAAG+C,gBAAgBE,kBACnBjD,EAAG+C,gBAAgBG,cACnBlD,EAAG+C,gBAAgBI,wBACnBnD,EAAG+C,gBAAgBK,qCACnBpD,EAAG+C,gBAAgBM,qCACnBrD,EAAG+C,gBAAgBO,0BACnBtD,EAAG+C,gBAAgBQ;;AAErB,IAAMzD,IAAwB,gJAO5B0D;;AAEF,SAASlC,uBACPN,GACAyC;EAEA,IAAMC,IAA8B;EACpC,IAAMC,IAAY,IAAIC,IAAI,EAACH,EAAOI,UAAU,WAAW,QAAOC,OAAOC;GACrE,SAASC,KAAKC;IACZ,IAAIjE,EAAGkE,iBAAiBD,MAASN,EAAUQ,IAAIF,EAAKG,WAAWC,YAAY;MACzEX,EAAOxB,KAAK+B;MACZ;AACF;MACEjE,EAAGsE,aAAaL,GAAMD;;AAE1B,GACAA,CAAKhD;EACL,OAAO0C;AACT;;"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
var e = require("
|
|
1
|
+
var e = require("typescript");
|
|
2
2
|
|
|
3
|
-
var r = require("
|
|
3
|
+
var r = require("node:path");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var a = require("@gql.tada/internal");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var i = require("@0no-co/graphqlsp/api");
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var n = require("./project-chunk.js");
|
|
9
|
+
var n = require("./index-chunk.js");
|
|
12
10
|
|
|
13
11
|
function _interopNamespaceDefault(e) {
|
|
14
12
|
var r = Object.create(null);
|
|
15
13
|
if (e) {
|
|
16
|
-
Object.keys(e).forEach((function(
|
|
17
|
-
if ("default" !==
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(r,
|
|
14
|
+
Object.keys(e).forEach((function(a) {
|
|
15
|
+
if ("default" !== a) {
|
|
16
|
+
var i = Object.getOwnPropertyDescriptor(e, a);
|
|
17
|
+
Object.defineProperty(r, a, i.get ? i : {
|
|
20
18
|
enumerable: !0,
|
|
21
19
|
get: function() {
|
|
22
|
-
return e[
|
|
20
|
+
return e[a];
|
|
23
21
|
}
|
|
24
22
|
});
|
|
25
23
|
}
|
|
@@ -29,60 +27,57 @@ function _interopNamespaceDefault(e) {
|
|
|
29
27
|
return r;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var t = _interopNamespaceDefault(r);
|
|
33
31
|
|
|
34
|
-
var
|
|
35
|
-
t.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var l = i.load({
|
|
40
|
-
origin: e.pluginConfig.schema,
|
|
41
|
-
rootPath: s
|
|
32
|
+
var o = n.expose((async function* _runDiagnostics(r) {
|
|
33
|
+
var o = t.dirname(r.configPath);
|
|
34
|
+
var l = a.load({
|
|
35
|
+
origin: r.pluginConfig.schema,
|
|
36
|
+
rootPath: o
|
|
42
37
|
});
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var f = await a.loadVirtualCode(s, c, r.ts);
|
|
47
|
-
if (f) {
|
|
38
|
+
var s = n.programFactory(r);
|
|
39
|
+
var g = s.createExternalFiles();
|
|
40
|
+
if (g.length) {
|
|
48
41
|
yield {
|
|
49
42
|
kind: "EXTERNAL_WARNING"
|
|
50
43
|
};
|
|
44
|
+
await s.addVirtualFiles(g);
|
|
51
45
|
}
|
|
52
|
-
var
|
|
46
|
+
var c = s.build();
|
|
47
|
+
var f = c.buildPluginInfo(r.pluginConfig);
|
|
53
48
|
var u = {
|
|
54
49
|
current: (await l.load()).schema,
|
|
55
50
|
version: 1
|
|
56
51
|
};
|
|
57
|
-
var v = c.getSourceFiles()
|
|
58
|
-
var i = o.resolve(s, r.getFilePath());
|
|
59
|
-
return !o.relative(e.rootPath, i).startsWith("..");
|
|
60
|
-
}));
|
|
52
|
+
var v = c.getSourceFiles();
|
|
61
53
|
yield {
|
|
62
54
|
kind: "FILE_COUNT",
|
|
63
55
|
fileCount: v.length
|
|
64
56
|
};
|
|
65
|
-
for (var
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
if (
|
|
70
|
-
for (var y of
|
|
57
|
+
for (var d of v) {
|
|
58
|
+
var p = d.fileName;
|
|
59
|
+
var m = i.getGraphQLDiagnostics(p, u, f);
|
|
60
|
+
var h = [];
|
|
61
|
+
if (m && m.length) {
|
|
62
|
+
for (var y of m) {
|
|
71
63
|
if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
|
|
72
64
|
continue;
|
|
73
65
|
}
|
|
74
|
-
var
|
|
75
|
-
if (y.category ===
|
|
76
|
-
|
|
77
|
-
} else if (y.category ===
|
|
78
|
-
|
|
66
|
+
var N = "info";
|
|
67
|
+
if (y.category === e.DiagnosticCategory.Error) {
|
|
68
|
+
N = "error";
|
|
69
|
+
} else if (y.category === e.DiagnosticCategory.Warning) {
|
|
70
|
+
N = "warn";
|
|
79
71
|
}
|
|
80
|
-
var C =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
var C = c.getSourcePosition(d, {
|
|
73
|
+
start: y.start || 1,
|
|
74
|
+
length: y.length || 1
|
|
75
|
+
});
|
|
76
|
+
p = C.fileName;
|
|
77
|
+
h.push({
|
|
78
|
+
severity: N,
|
|
84
79
|
message: y.messageText,
|
|
85
|
-
file: C.
|
|
80
|
+
file: C.fileName,
|
|
86
81
|
line: C.line,
|
|
87
82
|
col: C.col,
|
|
88
83
|
endLine: C.endLine,
|
|
@@ -92,11 +87,11 @@ var s = a.expose((async function* _runDiagnostics(e) {
|
|
|
92
87
|
}
|
|
93
88
|
yield {
|
|
94
89
|
kind: "FILE_DIAGNOSTICS",
|
|
95
|
-
filePath:
|
|
96
|
-
messages:
|
|
90
|
+
filePath: p,
|
|
91
|
+
messages: h
|
|
97
92
|
};
|
|
98
93
|
}
|
|
99
94
|
}));
|
|
100
95
|
|
|
101
|
-
exports.runDiagnostics =
|
|
96
|
+
exports.runDiagnostics = o;
|
|
102
97
|
//# sourceMappingURL=thread-chunk3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-chunk3.js","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import
|
|
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,QAnEpCC,gBAAgBC,gBACdC;EAEA,IAAMC,IAAcC,EAAKC,QAAQH,EAAOI;EACxC,IAAMC,IAASC,EAAAA,KAAK;IAAEC,QAAQP,EAAOQ,aAAaC;IAAQC,UAAUT;;EACpE,IAAMU,IAAUC,iBAAeZ;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,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,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,81 +1,76 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "typescript";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as i from "node:path";
|
|
4
4
|
|
|
5
5
|
import { load as a } from "@gql.tada/internal";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { getGraphQLDiagnostics as r } from "@0no-co/graphqlsp/api";
|
|
8
8
|
|
|
9
|
-
import { e as n,
|
|
9
|
+
import { e as n, p as o } from "./index-chunk.mjs";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
o({
|
|
15
|
-
typescript: r
|
|
16
|
-
});
|
|
17
|
-
var g = e.dirname(n.configPath);
|
|
18
|
-
var m = a({
|
|
11
|
+
var t = n((async function* _runDiagnostics(n) {
|
|
12
|
+
var t = i.dirname(n.configPath);
|
|
13
|
+
var l = a({
|
|
19
14
|
origin: n.pluginConfig.schema,
|
|
20
|
-
rootPath:
|
|
15
|
+
rootPath: t
|
|
21
16
|
});
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var p = await s(g, c, r);
|
|
26
|
-
if (p) {
|
|
17
|
+
var s = o(n);
|
|
18
|
+
var g = s.createExternalFiles();
|
|
19
|
+
if (g.length) {
|
|
27
20
|
yield {
|
|
28
21
|
kind: "EXTERNAL_WARNING"
|
|
29
22
|
};
|
|
23
|
+
await s.addVirtualFiles(g);
|
|
30
24
|
}
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
25
|
+
var f = s.build();
|
|
26
|
+
var m = f.buildPluginInfo(n.pluginConfig);
|
|
27
|
+
var c = {
|
|
28
|
+
current: (await l.load()).schema,
|
|
34
29
|
version: 1
|
|
35
30
|
};
|
|
36
|
-
var d =
|
|
37
|
-
var i = e.resolve(g, r.getFilePath());
|
|
38
|
-
return !e.relative(n.rootPath, i).startsWith("..");
|
|
39
|
-
}));
|
|
31
|
+
var d = f.getSourceFiles();
|
|
40
32
|
yield {
|
|
41
33
|
kind: "FILE_COUNT",
|
|
42
34
|
fileCount: d.length
|
|
43
35
|
};
|
|
44
|
-
for (var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
if (
|
|
49
|
-
for (var
|
|
50
|
-
if (!("messageText" in
|
|
36
|
+
for (var v of d) {
|
|
37
|
+
var p = v.fileName;
|
|
38
|
+
var u = r(p, c, m);
|
|
39
|
+
var h = [];
|
|
40
|
+
if (u && u.length) {
|
|
41
|
+
for (var y of u) {
|
|
42
|
+
if (!("messageText" in y) || "string" != typeof y.messageText || !y.file) {
|
|
51
43
|
continue;
|
|
52
44
|
}
|
|
53
|
-
var
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
} else if (
|
|
57
|
-
|
|
45
|
+
var C = "info";
|
|
46
|
+
if (y.category === e.DiagnosticCategory.Error) {
|
|
47
|
+
C = "error";
|
|
48
|
+
} else if (y.category === e.DiagnosticCategory.Warning) {
|
|
49
|
+
C = "warn";
|
|
58
50
|
}
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
var N = f.getSourcePosition(v, {
|
|
52
|
+
start: y.start || 1,
|
|
53
|
+
length: y.length || 1
|
|
54
|
+
});
|
|
55
|
+
p = N.fileName;
|
|
56
|
+
h.push({
|
|
57
|
+
severity: C,
|
|
58
|
+
message: y.messageText,
|
|
59
|
+
file: N.fileName,
|
|
60
|
+
line: N.line,
|
|
61
|
+
col: N.col,
|
|
62
|
+
endLine: N.endLine,
|
|
63
|
+
endColumn: N.endColumn
|
|
69
64
|
});
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
yield {
|
|
73
68
|
kind: "FILE_DIAGNOSTICS",
|
|
74
|
-
filePath:
|
|
75
|
-
messages:
|
|
69
|
+
filePath: p,
|
|
70
|
+
messages: h
|
|
76
71
|
};
|
|
77
72
|
}
|
|
78
73
|
}));
|
|
79
74
|
|
|
80
|
-
export {
|
|
75
|
+
export { t as runDiagnostics };
|
|
81
76
|
//# sourceMappingURL=thread-chunk3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-chunk3.mjs","sources":["../../src/commands/check/thread.ts"],"sourcesContent":["import
|
|
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;;"}
|
package/dist/chunks/vue-chunk.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
var e = require("
|
|
1
|
+
var e = require("typescript");
|
|
2
2
|
|
|
3
|
-
var r = require("@vue/
|
|
3
|
+
var r = require("@vue/language-core");
|
|
4
|
+
|
|
5
|
+
var t = require("@vue/compiler-dom");
|
|
4
6
|
|
|
5
7
|
function _interopNamespaceDefault(e) {
|
|
6
8
|
var r = Object.create(null);
|
|
@@ -21,31 +23,32 @@ function _interopNamespaceDefault(e) {
|
|
|
21
23
|
return r;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
var t = _interopNamespaceDefault(e);
|
|
25
|
-
|
|
26
26
|
var a = _interopNamespaceDefault(r);
|
|
27
27
|
|
|
28
|
-
var o = t
|
|
28
|
+
var o = _interopNamespaceDefault(t);
|
|
29
|
+
|
|
30
|
+
var i = a.VueGeneratedCode || a.VirtualCode;
|
|
29
31
|
|
|
30
|
-
var
|
|
32
|
+
var u = a.resolveVueCompilerOptions({});
|
|
31
33
|
|
|
32
|
-
var
|
|
34
|
+
var n;
|
|
33
35
|
|
|
34
|
-
exports.
|
|
35
|
-
if (!
|
|
36
|
-
|
|
36
|
+
exports.transform = t => {
|
|
37
|
+
if (!n) {
|
|
38
|
+
n = r.getDefaultVueLanguagePlugins({
|
|
37
39
|
modules: {
|
|
38
|
-
typescript:
|
|
39
|
-
"@vue/compiler-dom":
|
|
40
|
+
typescript: e,
|
|
41
|
+
"@vue/compiler-dom": o
|
|
40
42
|
},
|
|
41
43
|
compilerOptions: {},
|
|
42
44
|
codegenStack: !1,
|
|
43
45
|
globalTypesHolder: void 0,
|
|
44
|
-
vueCompilerOptions:
|
|
46
|
+
vueCompilerOptions: u
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
+
var a = e.ScriptSnapshot.fromString(t.getFullText());
|
|
50
|
+
var p = new i(t.fileName, "vue", a, u, n, e, !1);
|
|
51
|
+
for (var l of r.forEachEmbeddedCode(p)) {
|
|
49
52
|
if (l.id.startsWith("script_")) {
|
|
50
53
|
return l;
|
|
51
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-chunk.js","sources":["../../src/ts/
|
|
1
|
+
{"version":3,"file":"vue-chunk.js","sources":["../../src/ts/transformers/vue.ts"],"sourcesContent":["import ts from 'typescript';\nimport type { VirtualCode } from '@vue/language-core';\nimport { forEachEmbeddedCode, getDefaultVueLanguagePlugins } from '@vue/language-core';\nimport * as vueCompilerDOM from '@vue/compiler-dom';\nimport * as vue from '@vue/language-core';\n\nconst VueVirtualCode =\n vue.VueGeneratedCode || ((vue as any).VirtualCode as typeof vue.VueGeneratedCode);\n\nconst vueCompilerOptions = vue.resolveVueCompilerOptions({});\n\nlet plugins: ReturnType<typeof getDefaultVueLanguagePlugins> | undefined;\n\nexport const transform = (sourceFile: ts.SourceFile): VirtualCode | undefined => {\n if (!plugins) {\n plugins = getDefaultVueLanguagePlugins({\n modules: {\n typescript: ts,\n '@vue/compiler-dom': vueCompilerDOM,\n },\n compilerOptions: {},\n codegenStack: false,\n globalTypesHolder: undefined,\n vueCompilerOptions,\n });\n }\n\n const snapshot = ts.ScriptSnapshot.fromString(sourceFile.getFullText());\n const root = new VueVirtualCode(\n sourceFile.fileName,\n 'vue',\n snapshot,\n vueCompilerOptions,\n plugins,\n ts,\n false\n );\n for (const code of forEachEmbeddedCode(root)) if (code.id.startsWith('script_')) return code;\n};\n"],"names":["VueVirtualCode","vue","VueGeneratedCode","VirtualCode","vueCompilerOptions","resolveVueCompilerOptions","plugins","sourceFile","getDefaultVueLanguagePlugins","modules","typescript","ts","vueCompilerDOM","compilerOptions","codegenStack","globalTypesHolder","undefined","snapshot","ScriptSnapshot","fromString","getFullText","root","fileName","code","forEachEmbeddedCode","id","startsWith"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,IACJC,EAAIC,oBAAsBD,EAAYE;;AAExC,IAAMC,IAAqBH,EAAII,0BAA0B,CAAA;;AAEzD,IAAIC;;oBAEsBC;EACxB,KAAKD;IACHA,IAAUE,EAAAA,6BAA6B;MACrCC,SAAS;QACPC,YAAYC;QACZ,qBAAqBC;;MAEvBC,iBAAiB,CAAE;MACnBC,eAAc;MACdC,wBAAmBC;MACnBZ;;;EAIJ,IAAMa,IAAWN,EAAGO,eAAeC,WAAWZ,EAAWa;EACzD,IAAMC,IAAO,IAAIrB,EACfO,EAAWe,UACX,OACAL,GACAb,GACAE,GACAK,IACA;EAEF,KAAK,IAAMY,KAAQC,sBAAoBH;IAAO,IAAIE,EAAKE,GAAGC,WAAW;MAAY,OAAOH;;;AAAI"}
|