How to use the @ts-tools/transpile.getCanonicalPath function in @ts-tools/transpile

To help you get started, we’ve selected a few @ts-tools/transpile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AviVahl / ts-tools / packages / build / src / build.ts View on Github external
throw chalk.red(`Cannot find a ${configName} file for ${srcDirectoryPath}`);
    }

    const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {
        getCurrentDirectory,
        getCanonicalFileName: getCanonicalPath,
        getNewLine: getNewLine
    };

    const { errors, fileNames, options: tsconfigOptions } = readAndParseConfigFile(tsConfigPath);

    if (errors.length) {
        throw ts.formatDiagnosticsWithColorAndContext(errors, formatDiagnosticsHost);
    }

    const canonicalSrcPath = getCanonicalPath(srcDirectoryPath);
    const filesInSrcDirectory = fileNames
        .map(filePath => ({ filePath, normalizedPath: normalize(filePath) }))
        .filter(({ normalizedPath }) => getCanonicalPath(normalizedPath).startsWith(canonicalSrcPath));

    const programs: Array<{ folderName: string; program: ts.Program }> = [];

    for (const { folderName, getCompilerOptions } of formats) {
        const compilerOptions: ts.CompilerOptions = {
            ...getCompilerOptions(tsconfigOptions),
            outDir: undefined,
            outFile: undefined,
            out: undefined,
            noEmit: false
        };

        programs.push({
github AviVahl / ts-tools / packages / build / src / build.ts View on Github external
        .filter(({ normalizedPath }) => getCanonicalPath(normalizedPath).startsWith(canonicalSrcPath));