@gql.tada/cli-utils 1.6.0 → 1.6.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 +9 -0
- package/dist/chunks/index-chunk.js +555 -552
- package/dist/chunks/index-chunk.js.map +1 -1
- package/dist/chunks/index-chunk.mjs +564 -561
- package/dist/chunks/index-chunk.mjs.map +1 -1
- package/dist/chunks/thread-chunk2.js +1 -1
- package/dist/chunks/thread-chunk2.js.map +1 -1
- package/dist/chunks/thread-chunk2.mjs +1 -1
- package/dist/chunks/thread-chunk2.mjs.map +1 -1
- package/dist/chunks/thread-chunk3.js.map +1 -1
- package/dist/chunks/thread-chunk3.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -63,7 +63,7 @@ var t = i.expose((async function* _runTurbo(i) {
|
|
|
63
63
|
});
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
var q = "value" in b && "string" == typeof b.value &&
|
|
66
|
+
var q = "value" in b && "string" == typeof b.value && !(b.flags & e.TypeFlags.StringLiteral) ? JSON.stringify(b.value) : g.typeToString(b, F, o);
|
|
67
67
|
var _ = g.typeToString(S, F, o);
|
|
68
68
|
y.push({
|
|
69
69
|
schemaName: h.schema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-chunk2.js","sources":["../../src/commands/turbo/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\n\nimport { getSchemaNamesFromConfig } from '@gql.tada/internal';\nimport { findAllCallExpressions } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { TurboSignal, TurboWarning, TurboDocument } 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 schemaNames = getSchemaNamesFromConfig(params.pluginConfig);\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 pluginInfo = container.buildPluginInfo(params.pluginConfig);\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 documents: TurboDocument[] = [];\n const warnings: TurboWarning[] = [];\n\n const calls = findAllCallExpressions(sourceFile, pluginInfo, false).nodes;\n for (const call of calls) {\n const callExpression = call.node.parent;\n if (!ts.isCallExpression(callExpression)) {\n continue;\n }\n\n const position = container.getSourcePosition(sourceFile, callExpression.getStart());\n filePath = position.fileName;\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 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 const returnType = checker.getTypeAtLocation(callExpression);\n const argumentType = checker.getTypeAtLocation(call.node);\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 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 argumentKey: 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, callExpression, BUILDER_FLAGS);\n const documentType = checker.typeToString(returnType, callExpression, BUILDER_FLAGS);\n\n documents.push({\n schemaName: call.schema,\n argumentKey,\n documentType,\n });\n }\n\n yield {\n kind: 'FILE_TURBO',\n filePath,\n documents,\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"],"names":["runTurbo","expose","async","_runTurbo","params","schemaNames","getSchemaNamesFromConfig","pluginConfig","factory","programFactory","addSourceFile","fileId","sourceText","DECLARATION_OVERRIDE","scriptKind","ts","ScriptKind","TS","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","checker","program","getTypeChecker","sourceFile","filePath","fileName","documents","warnings","calls","findAllCallExpressions","nodes","call","callExpression","node","parent","isCallExpression","position","getSourcePosition","getStart","has","schema","push","message","size","file","line","col","returnType","getTypeAtLocation","argumentType","symbol","getEscapedName","argumentKey","value","flags","TypeFlags","StringLiteral","JSON","stringify","typeToString","BUILDER_FLAGS","documentType","schemaName","TypeFormatFlags","NoTruncation","NoTypeReduction","InTypeAlias","UseFullyQualifiedType","GenerateNamesForShadowedTypeParams","UseAliasDefinedOutsideCurrentScope","AllowUniqueESSymbolType","WriteTypeArgumentsOfSignature","trim"],"mappings":";;;;;;;;;;IAkHaA,IAAWC,EAAMA,QAjG9BC,gBAAgBC,UAAUC;EACxB,IAAMC,IAAcC,EAAAA,yBAAyBF,EAAOG;EACpD,IAAMC,IAAUC,iBAAeL;EAK/BI,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,IAAaF,EAAUG,gBAAgBtB,EAAOG;EACpD,IAAMoB,IAAcJ,EAAUK;QAExB;IACJP,MAAM;IACNQ,WAAWF,EAAYP;;EAGzB,IAAMU,IAAUP,EAAUQ,QAAQC;EAClC,KAAK,IAAMC,KAAcN,GAAa;IACpC,IAAIO,IAAWD,EAAWE;IAC1B,IAAMC,IAA6B;IACnC,IAAMC,IAA2B;IAEjC,IAAMC,IAAQC,EAAAA,uBAAuBN,GAAYR,IAAY,GAAOe;IACpE,KAAK,IAAMC,KAAQH,GAAO;MACxB,IAAMI,IAAiBD,EAAKE,KAAKC;MACjC,KAAK7B,EAAG8B,iBAAiBH;QACvB;;MAGF,IAAMI,IAAWvB,EAAUwB,kBAAkBd,GAAYS,EAAeM;MACxEd,IAAWY,EAASX;MACpB,KAAK9B,EAAY4C,IAAIR,EAAKS,SAAS;QACjCb,EAASc,KAAK;UACZC,SAASX,EAAKS,SACV,QAAQT,EAAKS,+EACb7C,EAAYgD,OAAO,IACjB,mFACA;UACNC,MAAMR,EAASX;UACfoB,MAAMT,EAASS;UACfC,KAAKV,EAASU;;QAEhB;AACF;MAEA,IAAMC,IAAa3B,EAAQ4B,kBAAkBhB;MAC7C,IAAMiB,IAAe7B,EAAQ4B,kBAAkBjB,EAAKE;MAGpD,KAAKc,EAAWG,UAAiD,uBAAvCH,EAAWG,OAAOC,kBAAyC;QACnFxB,EAASc,KAAK;UACZC,SACE;UAEFE,MAAMR,EAASX;UACfoB,MAAMT,EAASS;UACfC,KAAKV,EAASU;;QAEhB;AACF;MAEA,IAAMM,IACJ,WAAWH,KACmB,mBAAvBA,EAAaI,
|
|
1
|
+
{"version":3,"file":"thread-chunk2.js","sources":["../../src/commands/turbo/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\n\nimport { getSchemaNamesFromConfig } from '@gql.tada/internal';\nimport { findAllCallExpressions } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { TurboSignal, TurboWarning, TurboDocument } 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 schemaNames = getSchemaNamesFromConfig(params.pluginConfig);\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 pluginInfo = container.buildPluginInfo(params.pluginConfig);\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 documents: TurboDocument[] = [];\n const warnings: TurboWarning[] = [];\n\n const calls = findAllCallExpressions(sourceFile, pluginInfo, false).nodes;\n for (const call of calls) {\n const callExpression = call.node.parent;\n if (!ts.isCallExpression(callExpression)) {\n continue;\n }\n\n const position = container.getSourcePosition(sourceFile, callExpression.getStart());\n filePath = position.fileName;\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 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 const returnType = checker.getTypeAtLocation(callExpression);\n const argumentType = checker.getTypeAtLocation(call.node);\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 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 argumentKey: 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, callExpression, BUILDER_FLAGS);\n const documentType = checker.typeToString(returnType, callExpression, BUILDER_FLAGS);\n\n documents.push({\n schemaName: call.schema,\n argumentKey,\n documentType,\n });\n }\n\n yield {\n kind: 'FILE_TURBO',\n filePath,\n documents,\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"],"names":["runTurbo","expose","async","_runTurbo","params","schemaNames","getSchemaNamesFromConfig","pluginConfig","factory","programFactory","addSourceFile","fileId","sourceText","DECLARATION_OVERRIDE","scriptKind","ts","ScriptKind","TS","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","checker","program","getTypeChecker","sourceFile","filePath","fileName","documents","warnings","calls","findAllCallExpressions","nodes","call","callExpression","node","parent","isCallExpression","position","getSourcePosition","getStart","has","schema","push","message","size","file","line","col","returnType","getTypeAtLocation","argumentType","symbol","getEscapedName","argumentKey","value","flags","TypeFlags","StringLiteral","JSON","stringify","typeToString","BUILDER_FLAGS","documentType","schemaName","TypeFormatFlags","NoTruncation","NoTypeReduction","InTypeAlias","UseFullyQualifiedType","GenerateNamesForShadowedTypeParams","UseAliasDefinedOutsideCurrentScope","AllowUniqueESSymbolType","WriteTypeArgumentsOfSignature","trim"],"mappings":";;;;;;;;;;IAkHaA,IAAWC,EAAMA,QAjG9BC,gBAAgBC,UAAUC;EACxB,IAAMC,IAAcC,EAAAA,yBAAyBF,EAAOG;EACpD,IAAMC,IAAUC,iBAAeL;EAK/BI,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,IAAaF,EAAUG,gBAAgBtB,EAAOG;EACpD,IAAMoB,IAAcJ,EAAUK;QAExB;IACJP,MAAM;IACNQ,WAAWF,EAAYP;;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,EAAG0D,gBAAgBE,kBACnB5D,EAAG0D,gBAAgBG,cACnB7D,EAAG0D,gBAAgBI,wBACnB9D,EAAG0D,gBAAgBK,qCACnB/D,EAAG0D,gBAAgBM,qCACnBhE,EAAG0D,gBAAgBO,0BACnBjE,EAAG0D,gBAAgBQ;;AAErB,IAAMpE,IAAuB,gJAO3BqE;;"}
|
|
@@ -63,7 +63,7 @@ var o = r((async function* _runTurbo(r) {
|
|
|
63
63
|
});
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
var _ = "value" in b && "string" == typeof b.value &&
|
|
66
|
+
var _ = "value" in b && "string" == typeof b.value && !(b.flags & e.TypeFlags.StringLiteral) ? JSON.stringify(b.value) : p.typeToString(b, F, n);
|
|
67
67
|
var A = p.typeToString(S, F, n);
|
|
68
68
|
y.push({
|
|
69
69
|
schemaName: v.schema,
|
|
@@ -1 +1 @@
|
|
|
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 { getSchemaNamesFromConfig } from '@gql.tada/internal';\nimport { findAllCallExpressions } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { TurboSignal, TurboWarning, TurboDocument } 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 schemaNames = getSchemaNamesFromConfig(params.pluginConfig);\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 pluginInfo = container.buildPluginInfo(params.pluginConfig);\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 documents: TurboDocument[] = [];\n const warnings: TurboWarning[] = [];\n\n const calls = findAllCallExpressions(sourceFile, pluginInfo, false).nodes;\n for (const call of calls) {\n const callExpression = call.node.parent;\n if (!ts.isCallExpression(callExpression)) {\n continue;\n }\n\n const position = container.getSourcePosition(sourceFile, callExpression.getStart());\n filePath = position.fileName;\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 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 const returnType = checker.getTypeAtLocation(callExpression);\n const argumentType = checker.getTypeAtLocation(call.node);\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 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 argumentKey: 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, callExpression, BUILDER_FLAGS);\n const documentType = checker.typeToString(returnType, callExpression, BUILDER_FLAGS);\n\n documents.push({\n schemaName: call.schema,\n argumentKey,\n documentType,\n });\n }\n\n yield {\n kind: 'FILE_TURBO',\n filePath,\n documents,\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"],"names":["runTurbo","expose","async","_runTurbo","params","schemaNames","getSchemaNamesFromConfig","pluginConfig","factory","programFactory","addSourceFile","fileId","sourceText","DECLARATION_OVERRIDE","scriptKind","ts","ScriptKind","TS","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","checker","program","getTypeChecker","sourceFile","filePath","fileName","documents","warnings","calls","findAllCallExpressions","nodes","call","callExpression","node","parent","isCallExpression","position","getSourcePosition","getStart","has","schema","push","message","size","file","line","col","returnType","getTypeAtLocation","argumentType","symbol","getEscapedName","argumentKey","value","flags","TypeFlags","StringLiteral","JSON","stringify","typeToString","BUILDER_FLAGS","documentType","schemaName","TypeFormatFlags","NoTruncation","NoTypeReduction","InTypeAlias","UseFullyQualifiedType","GenerateNamesForShadowedTypeParams","UseAliasDefinedOutsideCurrentScope","AllowUniqueESSymbolType","WriteTypeArgumentsOfSignature","trim"],"mappings":";;;;;;;;;;IAkHaA,IAAWC,GAjGxBC,gBAAgBC,UAAUC;EACxB,IAAMC,IAAcC,EAAyBF,EAAOG;EACpD,IAAMC,IAAUC,EAAeL;EAK/BI,EAAQE,cAAc;IACpB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mjs","sources":["../../src/commands/turbo/thread.ts"],"sourcesContent":["import ts from 'typescript';\nimport type { GraphQLSPConfig } from '@gql.tada/internal';\n\nimport { getSchemaNamesFromConfig } from '@gql.tada/internal';\nimport { findAllCallExpressions } from '@0no-co/graphqlsp/api';\n\nimport { programFactory } from '../../ts';\nimport { expose } from '../../threads';\n\nimport type { TurboSignal, TurboWarning, TurboDocument } 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 schemaNames = getSchemaNamesFromConfig(params.pluginConfig);\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 pluginInfo = container.buildPluginInfo(params.pluginConfig);\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 documents: TurboDocument[] = [];\n const warnings: TurboWarning[] = [];\n\n const calls = findAllCallExpressions(sourceFile, pluginInfo, false).nodes;\n for (const call of calls) {\n const callExpression = call.node.parent;\n if (!ts.isCallExpression(callExpression)) {\n continue;\n }\n\n const position = container.getSourcePosition(sourceFile, callExpression.getStart());\n filePath = position.fileName;\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 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 const returnType = checker.getTypeAtLocation(callExpression);\n const argumentType = checker.getTypeAtLocation(call.node);\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 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 argumentKey: 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, callExpression, BUILDER_FLAGS);\n const documentType = checker.typeToString(returnType, callExpression, BUILDER_FLAGS);\n\n documents.push({\n schemaName: call.schema,\n argumentKey,\n documentType,\n });\n }\n\n yield {\n kind: 'FILE_TURBO',\n filePath,\n documents,\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"],"names":["runTurbo","expose","async","_runTurbo","params","schemaNames","getSchemaNamesFromConfig","pluginConfig","factory","programFactory","addSourceFile","fileId","sourceText","DECLARATION_OVERRIDE","scriptKind","ts","ScriptKind","TS","externalFiles","createExternalFiles","length","kind","addVirtualFiles","container","build","pluginInfo","buildPluginInfo","sourceFiles","getSourceFiles","fileCount","checker","program","getTypeChecker","sourceFile","filePath","fileName","documents","warnings","calls","findAllCallExpressions","nodes","call","callExpression","node","parent","isCallExpression","position","getSourcePosition","getStart","has","schema","push","message","size","file","line","col","returnType","getTypeAtLocation","argumentType","symbol","getEscapedName","argumentKey","value","flags","TypeFlags","StringLiteral","JSON","stringify","typeToString","BUILDER_FLAGS","documentType","schemaName","TypeFormatFlags","NoTruncation","NoTypeReduction","InTypeAlias","UseFullyQualifiedType","GenerateNamesForShadowedTypeParams","UseAliasDefinedOutsideCurrentScope","AllowUniqueESSymbolType","WriteTypeArgumentsOfSignature","trim"],"mappings":";;;;;;;;;;IAkHaA,IAAWC,GAjGxBC,gBAAgBC,UAAUC;EACxB,IAAMC,IAAcC,EAAyBF,EAAOG;EACpD,IAAMC,IAAUC,EAAeL;EAK/BI,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,IAAaF,EAAUG,gBAAgBtB,EAAOG;EACpD,IAAMoB,IAAcJ,EAAUK;QAExB;IACJP,MAAM;IACNQ,WAAWF,EAAYP;;EAGzB,IAAMU,IAAUP,EAAUQ,QAAQC;EAClC,KAAK,IAAMC,KAAcN,GAAa;IACpC,IAAIO,IAAWD,EAAWE;IAC1B,IAAMC,IAA6B;IACnC,IAAMC,IAA2B;IAEjC,IAAMC,IAAQC,EAAuBN,GAAYR,IAAY,GAAOe;IACpE,KAAK,IAAMC,KAAQH,GAAO;MACxB,IAAMI,IAAiBD,EAAKE,KAAKC;MACjC,KAAK7B,EAAG8B,i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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,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,
|
|
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,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 +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 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,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,
|
|
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,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;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gql.tada/cli-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"public": true,
|
|
5
5
|
"description": "Main logic for gql.tada’s CLI tool.",
|
|
6
6
|
"author": "0no.co <hi@0no.co>",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@clack/prompts": "^0.7.0",
|
|
39
39
|
"@types/node": "^20.11.0",
|
|
40
|
-
"@volar/source-map": "
|
|
40
|
+
"@volar/source-map": "~2.1.6",
|
|
41
41
|
"clipanion": "4.0.0-rc.3",
|
|
42
42
|
"execa": "^8.0.1",
|
|
43
43
|
"rollup": "^4.9.4",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"wonka": "^6.3.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@0no-co/graphqlsp": "^1.12.
|
|
52
|
+
"@0no-co/graphqlsp": "^1.12.13",
|
|
53
53
|
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
|
|
54
|
-
"@gql.tada/internal": "1.0.
|
|
54
|
+
"@gql.tada/internal": "1.0.7"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@gql.tada/svelte-support": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@0no-co/graphqlsp": "^1.12.
|
|
65
|
+
"@0no-co/graphqlsp": "^1.12.13",
|
|
66
66
|
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
|
|
67
67
|
"typescript": "^5.0.0",
|
|
68
68
|
"@gql.tada/svelte-support": "1.0.1",
|