How to use the @ts-tools/transpile.createCachedFn 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 / webpack-loader / src / typescript-loader.ts View on Github external
getNewLine,
    transpileCached,
    findCacheDirectory,
    ensureDirectorySync,
    compilerOptionsToCacheName,
    createCachedFn
} from '@ts-tools/transpile';

const { fileExists } = ts.sys;
const identity = (value: string) => value;

const [cachedFindConfigFile] = createCachedFn(
    ts.findConfigFile,
    (searchPath, _, configName) => searchPath + delimiter + configName
);
const [cachedReadAndParseConfigFile] = createCachedFn(readAndParseConfigFile, identity);
const [cachedFindCacheDirectory] = createCachedFn(findCacheDirectory, identity);
const ensuredDirectories = new Set();

/**
 * Loader options which can be provided via webpack configuration
 * or a specific request query string
 */
export interface ITypeScriptLoaderOptions {
    /**
     * Keys to override in the `compilerOptions` section of the
     * `tsconfig.json` file.
     */
    compilerOptions?: object;

    /**
     * Turn persistent caching on/off.
github AviVahl / ts-tools / packages / webpack-loader / src / typescript-loader.ts View on Github external
transpileCached,
    findCacheDirectory,
    ensureDirectorySync,
    compilerOptionsToCacheName,
    createCachedFn
} from '@ts-tools/transpile';

const { fileExists } = ts.sys;
const identity = (value: string) => value;

const [cachedFindConfigFile] = createCachedFn(
    ts.findConfigFile,
    (searchPath, _, configName) => searchPath + delimiter + configName
);
const [cachedReadAndParseConfigFile] = createCachedFn(readAndParseConfigFile, identity);
const [cachedFindCacheDirectory] = createCachedFn(findCacheDirectory, identity);
const ensuredDirectories = new Set();

/**
 * Loader options which can be provided via webpack configuration
 * or a specific request query string
 */
export interface ITypeScriptLoaderOptions {
    /**
     * Keys to override in the `compilerOptions` section of the
     * `tsconfig.json` file.
     */
    compilerOptions?: object;

    /**
     * Turn persistent caching on/off.
     *
github AviVahl / ts-tools / packages / webpack-loader / src / typescript-loader.ts View on Github external
import {
    externalSourceMapPrefix,
    readAndParseConfigFile,
    getCanonicalPath,
    getNewLine,
    transpileCached,
    findCacheDirectory,
    ensureDirectorySync,
    compilerOptionsToCacheName,
    createCachedFn
} from '@ts-tools/transpile';

const { fileExists } = ts.sys;
const identity = (value: string) => value;

const [cachedFindConfigFile] = createCachedFn(
    ts.findConfigFile,
    (searchPath, _, configName) => searchPath + delimiter + configName
);
const [cachedReadAndParseConfigFile] = createCachedFn(readAndParseConfigFile, identity);
const [cachedFindCacheDirectory] = createCachedFn(findCacheDirectory, identity);
const ensuredDirectories = new Set();

/**
 * Loader options which can be provided via webpack configuration
 * or a specific request query string
 */
export interface ITypeScriptLoaderOptions {
    /**
     * Keys to override in the `compilerOptions` section of the
     * `tsconfig.json` file.
     */