"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _escapeGoat=require("escape-goat");
var git=_interopRequireWildcard(require("@corenode/git-lib"));var _default=

(url,to,from)=>{
if(!url){
throw new Error(`Please provide an git url`);
}

const lastest=git.latestTagOrFirstCommit();
const log=git.commitLogBetweenTags(from!==null&&from!==void 0?from:lastest,to);

if(!log){
throw new Error(`Get changelog failed, no new commits was found.`);
}

const commits=log.split("\n").map(commit=>{
const splitIndex=commit.lastIndexOf(" ");
return{
message:commit.slice(0,splitIndex),
id:commit.slice(splitIndex+1)};

});

return commits.map(commit=>`- ${(0,_escapeGoat.htmlEscape)(commit.message)}  ${commit.id}`).join("\n");
};exports.default=_default;