UNPKG

@ts-bridge/cli

Version:

Bridge the gap between ES modules and CommonJS modules with an easy-to-use alternative to `tsc`.

40 lines 1.95 kB
import type { DependencyGraph } from './project-references.js'; /** * Check if a value is an object (and not an array or `null`). * * @param value - The value to check. * @returns `true` if the value is an object, `false` otherwise. */ export declare function isObject(value: unknown): value is Record<PropertyKey, unknown>; /** * Convert a string value to a safe identifier name. This basically removes any * characters that can be invalid for identifiers. * * @param value - The value to convert to camelCase. * @returns The identifier name. */ export declare function getIdentifierName(value: string): string; /** * Get the defined values from an array, removing all `undefined` values. If the * array itself is `undefined`, an empty array is returned. * * @param array - The array to get the defined values from. * @returns The array with all `undefined` values removed. */ export declare function getDefinedArray<Type>(array: readonly (Type | undefined)[] | undefined): Type[]; /** * Run a function in parallel for each value in the graph. This means that the * function is run for each value in the graph, but the order in which the * values are processed is determined by the topological sort of the graph. * Values that are not dependent on each other, or that are dependent on each * other, but the dependencies have been resolved, are processed in parallel. * * @param sortedValues - The sorted values from the graph. * @param graph - The dependency graph. * @param fn - The function to run for each value. This function is expected to * spawn a new process or thread for each value, to properly parallelise the * work. * @param maxConcurrency - The maximum number of concurrent functions to run. */ export declare function parallelise<Value>(sortedValues: Value[], graph: DependencyGraph<Value>, fn: (value: Value) => Promise<void>, maxConcurrency?: number): Promise<void>; //# sourceMappingURL=utils.d.ts.map