def esbuild_binary()

in aws_lambda_builders/workflows/nodejs_npm_esbuild/esbuild.py [0:0]


    def esbuild_binary(self):
        """
        Finds the esbuild binary at runtime.

        The utility may be present as a package dependency of the Lambda project,
        or in the global path. If there is one in the Lambda project, it should
        be preferred over a global utility. The check has to be executed
        at runtime, since NPM dependencies will be installed by the workflow
        using one of the previous actions.
        """

        LOG.debug("checking for esbuild in: %s", self.executable_search_paths)
        binaries = self.which("esbuild", executable_search_paths=self.executable_search_paths)
        LOG.debug("potential esbuild binaries: %s", binaries)

        if binaries:
            return binaries[0]
        else:
            raise EsbuildExecutionError(
                message="Cannot find esbuild. esbuild must be installed on the host machine to use this feature. "
                "It is recommended to be installed on the PATH, "
                "but can also be included as a project dependency."
            )