export const load = function()

in src/utils/UserFunction.ts [140:165]


export const load = function (
  appRoot: string,
  fullHandlerString: string
): HandlerFunction {
  _throwIfInvalidHandler(fullHandlerString);

  const [moduleRoot, moduleAndHandler] = _moduleRootAndHandler(
    fullHandlerString
  );
  const [module, handlerPath] = _splitHandlerString(moduleAndHandler);

  const userApp = _loadUserApp(appRoot, moduleRoot, module);
  const handlerFunc = _resolveHandler(userApp, handlerPath);

  if (!handlerFunc) {
    throw new HandlerNotFound(
      `${fullHandlerString} is undefined or not exported`
    );
  }

  if (typeof handlerFunc !== "function") {
    throw new HandlerNotFound(`${fullHandlerString} is not a function`);
  }

  return handlerFunc;
};