import type { GetDependencies } from './createWorker.ts';
/**
 * In a given list of dependencies, it stringifies any functions to their javascript source code strings.
 * It could've used simple `.toString()` if it wasn't for "minification" process which eventually renames
 * all functions to random shortened names. Why do function names matter? Because the worker will have to
 * call those functions by name rather than by reference, because a worker can't share any runtime code
 * with the parent thread, hence the stringification to javascript source code.
 *
 * Alternatively, the code that is executed inside a worker could abstain from using global function references
 * and instead reference any functions from some kind of a `context` object. In that case, minifiers
 * won't touch the property names in that `context` object. The "pros" would be not having to use this "magic" function.
 * The "cons" would be having to prepend the `context.` prefix to every function being called,
 * and if any of those functions happen to call another functions, those would have to be called
 * from the `context` too, which could quickly turn the code into a context-passing "spaghetti" mess.
 * Not to mention having to define the `Context` type in case of TypeScript.
 * But otherwise, both approaches would work and there's no other difference between them.
 *
 * @param {function} getDependencies — Returns an array of dependencies. This function must adhere to a strict form: it has to be a "closure" that returns an array of named variables. The restriction is because the exact variable names have to be known from the stringified form of this function.
 * @returns {object} — An object of shape: `{ functions, values }` where `functions` contains the source code of any functions by their actual name, and `values` contains any "regular values" — strings, numbers, objects, arrays, etc — in their original (non-stringified) form.
 */
export default function stringifyFunctionReferences(getDependencies: GetDependencies): {
    functions: Record<string, string>;
    variables: Record<string, unknown>;
};
