MCPcopy Index your code
hub / github.com/QwikDev/qwik / validateTypeScriptFile

Function validateTypeScriptFile

scripts/validate-build.ts:153–182  ·  view source on GitHub ↗
(config: BuildConfig, tsFilePath: string)

Source from the content-addressed store, hash-verified

151 * well formed and relative import paths are correct.
152 */
153export function validateTypeScriptFile(config: BuildConfig, tsFilePath: string) {
154 const tsconfigPath = join(config.rootDir, 'tsconfig.json');
155 const tsconfigResults = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
156 const tsconfig = ts.parseJsonConfigFileContent(
157 tsconfigResults.config,
158 ts.sys,
159 config.rootDir,
160 undefined,
161 tsconfigPath
162 );
163 const program = ts.createProgram([tsFilePath], tsconfig.options);
164
165 const tsDiagnostics = [
166 ...program.getSemanticDiagnostics(),
167 ...program.getSyntacticDiagnostics(),
168 ...program.getDeclarationDiagnostics(),
169 ...program.getGlobalDiagnostics(),
170 ...program.getConfigFileParsingDiagnostics(),
171 ...program.getOptionsDiagnostics(),
172 ];
173
174 if (tsDiagnostics.length > 0) {
175 const host = {
176 getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
177 getNewLine: () => ts.sys.newLine,
178 getCanonicalFileName: (f: string) => f,
179 };
180 throw new Error(ts.formatDiagnostics(tsDiagnostics, host));
181 }
182}
183
184async function validatePackageJson(config: BuildConfig, pkg: PackageJSON, errors: string[]) {
185 async function validatePath(path: string) {

Callers 1

validateBuildFunction · 0.85

Calls 1

joinFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…