setup-php/dist/index.js

1 line
96 KiB
JavaScript
Raw Normal View History

2024-06-02 09:02:16 +07:00
(()=>{var e={88:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var i=Object.getOwnPropertyDescriptor(t,r);if(!i||("get"in i?!t.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,i)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.addINIValues=t.addINIValuesWindows=t.addINIValuesUnix=void 0;const o=s(r(918));async function addINIValuesUnix(e){const t=await o.CSVArray(e);let r="";await o.asyncForEach(t,(async function(e){r+="\n"+await o.addLog("$tick",e,"Added to php.ini","linux")}));return'echo "'+t.join("\n")+'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1'+r}t.addINIValuesUnix=addINIValuesUnix;async function addINIValuesWindows(e){const t=await o.CSVArray(e);let r="\n";await o.asyncForEach(t,(async function(e){r+=await o.addLog("$tick",e,"Added to php.ini","win32")+"\n"}));return'Add-Content "$php_dir\\php.ini" "'+t.join("\n")+'"'+r}t.addINIValuesWindows=addINIValuesWindows;async function addINIValues(e,t,r=false){let n="\n";switch(r){case true:n+=await o.stepLog("Add php.ini values",t)+await o.suppressOutput(t)+"\n";break;case false:default:n+=await o.stepLog("Add php.ini values",t)+"\n";break}switch(t){case"win32":return n+await addINIValuesWindows(e);case"darwin":case"linux":return n+await addINIValuesUnix(e);default:return await o.log("Platform "+t+" is not supported",t,"error")}}t.addINIValues=addINIValues},5730:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var i=Object.getOwnPropertyDescriptor(t,r);if(!i||("get"in i?!t.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,i)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.addCoverage=t.disableCoverage=t.addCoveragePCOV=t.addCoverageXdebug=t.checkXdebugError=void 0;const o=s(r(918));const a=s(r(3390));const u=s(r(88));async function checkXdebugError(e,t){if(/^5\.[3-6]$|^7\.[0-1]$/.test(t)&&e=="xdebug3"||/^8\.[0-9]$/.test(t)&&e=="xdebug2"){return e+" is not supported on PHP "+t}return""}t.checkXdebugError=checkXdebugError;async function addCoverageXdebug(e,t,r,n){let i="\n";const s=await checkXdebugError(e,t);if(!s){i+=await a.addExtension(":pcov:false",t,r,true)+n;e=e=="xdebug3"?"xdebug":e;i+=await a.addExtension(e,t,r,true)+n;i+=await o.setVariable("xdebug_version","php -r \"echo phpversion('xdebug');\"",r);i+=await o.getCommand(r,"extension_log")+'xdebug "Xdebug $xdebug_version enabled as coverage driver"'}else{i+=await o.addLog("$cross",e,s,r)}return i}t.addCoverageXdebug=addCoverageXdebug;async function addCoveragePCOV(e,t,r){let n="\n";switch(true){default:n+=await a.addExtension(":xdebug:false",e,t,true)+r;n+=await a.addExtension("pcov",e,t,true)+r;n+=await u.addINIValues("pcov.enabled=1",t,true)+"\n";n+=await o.setVariable("pcov_version","php -r \"echo phpversion('pcov');\"",t);n+=await o.getCommand(t,"extension_log")+'pcov "PCOV $pcov_version enabled as coverage driver"';break;case/5\.[3-6]|7\.0/.test(e):n+=await o.addLog("$cross","pcov","PHP 7.1 or newer is required",t);break}return n}t.addCoveragePCOV=addCoveragePCOV;async function disableCoverage(e,t,r){let n="\n";n+=await a.addE