eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
62 lines • 2.71 kB
TypeScript
/**
* Shared utilities for detecting files that need workflow transformation.
* Used by builders, rollup plugin, Next.js loader, and vite plugin.
*/
export declare const useWorkflowPattern: RegExp;
export declare const useStepPattern: RegExp;
export declare const workflowSerdeImportPattern: RegExp;
export declare const workflowSerdeSymbolPattern: RegExp;
export declare const workflowSerdeComputedPropertyPattern: RegExp;
export declare const generatedWorkflowPathPattern: RegExp;
/**
* Detects workflow-related patterns in source code.
*/
export interface WorkflowPatternMatch {
/** File contains 'use workflow' directive */
hasUseWorkflow: boolean;
/** File contains 'use step' directive */
hasUseStep: boolean;
/** File contains @workflow/serde import */
hasSerdeImport: boolean;
/** File contains Symbol.for('workflow-serialize') or Symbol.for('workflow-deserialize') */
hasSerdeSymbol: boolean;
/** File contains any directive ('use workflow' or 'use step') */
hasDirective: boolean;
/** File contains any serde pattern (import or Symbol.for) */
hasSerde: boolean;
}
/**
* Detects workflow-related patterns in source code.
* @param source - The source code to analyze
* @returns Object with flags for each detected pattern
*/
export declare function detectWorkflowPatterns(source: string): WorkflowPatternMatch;
/**
* Determines if a file path is a generated workflow route file.
* @param filePath - The file path to check
* @returns true if the file is a generated workflow route
*/
export declare function isGeneratedWorkflowFile(filePath: string): boolean;
/**
* Determines if a file should be transformed based on its path and content patterns.
*
* Logic:
* - Generated workflow route files are never transformed
* - Files with directives ('use workflow' or 'use step') are always transformed
* - Files with serde patterns are always transformed; the SWC plugin performs
* AST-level extraction/filtering to determine whether they actually define
* serde classes
*
* @param filePath - The file path to check
* @param patterns - The detected patterns from detectWorkflowPatterns()
* @returns true if the file should be transformed
*/
export declare function shouldTransformFile(filePath: string, patterns: WorkflowPatternMatch): boolean;
/**
* Combined regex pattern for turbopack content matching.
* Uses backreferences to ensure matching quote types.
* Matches: 'use workflow', 'use step', @workflow/serde imports, Symbol.for serialization symbols,
* and WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE computed property usage
*/
export declare const turbopackContentPattern: RegExp;
//# sourceMappingURL=transform-utils.d.ts.map