windmill-utils-internal
Version:
Internal utility functions for Windmill
42 lines (41 loc) • 1.88 kB
TypeScript
import { PathAssigner } from "../path-utils/path-assigner";
import { FlowModule } from "../gen/types.gen";
/**
* Represents an inline script extracted from a flow module
*/
interface InlineScript {
/** File path where the script content should be written */
path: string;
/** The actual script content */
content: string;
}
/**
* Options for extractInlineScripts function
*/
export interface ExtractInlineScriptsOptions {
/** When true, skip the .inline_script. suffix in file names */
skipInlineScriptSuffix?: boolean;
}
/**
* Extracts inline scripts from flow modules, converting them to separate files
* and replacing the original content with file references.
*
* @param modules - Array of flow modules to process
* @param mapping - Optional mapping of module IDs to custom file paths
* @param separator - Path separator to use
* @param defaultTs - Default TypeScript runtime to use ("bun" or "deno")
* @param pathAssigner - Optional path assigner to reuse (for nested calls)
* @param options - Optional configuration options
* @returns Array of inline scripts with their paths and content
*/
export declare function extractInlineScripts(modules: FlowModule[], mapping?: Record<string, string>, separator?: string, defaultTs?: "bun" | "deno", pathAssigner?: PathAssigner, options?: ExtractInlineScriptsOptions): InlineScript[];
/**
* Extracts the current mapping of module IDs to file paths from flow modules
* by analyzing existing inline script references.
*
* @param modules - Array of flow modules to analyze (can be undefined)
* @param mapping - Existing mapping to extend (defaults to empty object)
* @returns Record mapping module IDs to their corresponding file paths
*/
export declare function extractCurrentMapping(modules: FlowModule[] | undefined, mapping?: Record<string, string>): Record<string, string>;
export {};