"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processJsFile = void 0;
const esm_1 = require("../../esm");
/**
 * Processes a JavaScript file to import and execute a module function as a prompt.
 * @param filePath - Path to the JavaScript file.
 * @param functionName - Optional function name to execute.
 * @returns Promise resolving to an array of prompts.
 */
async function processJsFile(filePath, prompt, functionName) {
    const promptFunction = await (0, esm_1.importModule)(filePath, functionName);
    return [
        {
            raw: String(promptFunction),
            label: prompt.label ? prompt.label : functionName ? `${filePath}:${functionName}` : filePath,
            function: promptFunction,
        },
    ];
}
exports.processJsFile = processJsFile;
//# sourceMappingURL=javascript.js.map