1
0
Fork 0
mirror of https://github.com/docker/setup-buildx-action.git synced 2024-11-23 04:10:48 +00:00
setup-buildx-action/dist/index.js

30 lines
1.6 MiB
JavaScript
Raw Normal View History

require('./sourcemap-register.js');(()=>{var __webpack_modules__={7799:function(r,i,a){"use strict";var s=this&&this.__createBinding||(Object.create?function(r,i,a,s){if(s===undefined)s=a;var p=Object.getOwnPropertyDescriptor(i,a);if(!p||("get"in p?!i.__esModule:p.writable||p.configurable)){p={enumerable:true,get:function(){return i[a]}}}Object.defineProperty(r,s,p)}:function(r,i,a,s){if(s===undefined)s=a;r[s]=i[a]});var p=this&&this.__setModuleDefault||(Object.create?function(r,i){Object.defineProperty(r,"default",{enumerable:true,value:i})}:function(r,i){r["default"]=i});var l=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a))s(i,r,a);p(i,r);return i};var c=this&&this.__awaiter||function(r,i,a,s){function adopt(r){return r instanceof a?r:new a((function(i){i(r)}))}return new(a||(a=Promise))((function(a,p){function fulfilled(r){try{step(s.next(r))}catch(r){p(r)}}function rejected(r){try{step(s["throw"](r))}catch(r){p(r)}}function step(r){r.done?a(r.value):adopt(r.value).then(fulfilled,rejected)}step((s=s.apply(r,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:true});i.saveCache=i.restoreCache=i.isFeatureAvailable=i.ReserveCacheError=i.ValidationError=void 0;const d=l(a(2186));const u=l(a(1017));const m=l(a(1518));const h=l(a(8245));const g=a(3434);class ValidationError extends Error{constructor(r){super(r);this.name="ValidationError";Object.setPrototypeOf(this,ValidationError.prototype)}}i.ValidationError=ValidationError;class ReserveCacheError extends Error{constructor(r){super(r);this.name="ReserveCacheError";Object.setPrototypeOf(this,ReserveCacheError.prototype)}}i.ReserveCacheError=ReserveCacheError;function checkPaths(r){if(!r||r.length===0){throw new ValidationError(`Path Validation Error: At least one directory or file path is required`)}}function checkKey(r){if(r.length>512){throw new ValidationError(`Key Validation Error: ${r} cannot be larger than 512 characters.`)}const i=/^[^,]*$/;if(!i.test(r)){throw new ValidationError(`Key Validation Error: ${r} cannot contain commas.`)}}function isFeatureAvailable(){return!!process.env["ACTIONS_CACHE_URL"]}i.isFeatureAvailable=isFeatureAvailable;function restoreCache(r,i,a,s,p=false){return c(this,void 0,void 0,(function*(){checkPaths(r);a=a||[];const l=[i,...a];d.debug("Resolved Keys:");d.debug(JSON.stringify(l));if(l.length>10){throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`)}for(const r of l){checkKey(r)}const c=yield m.getCompressionMethod();let y="";try{const i=yield h.getCacheEntry(l,r,{compressionMethod:c,enableCrossOsArchive:p});if(!(i===null||i===void 0?void 0:i.archiveLocation)){return undefined}if(s===null||s===void 0?void 0:s.lookupOnly){d.info("Lookup only - skipping download");return i.cacheKey}y=u.join(yield m.createTempDirectory(),m.getCacheFileName(c));d.debug(`Archive Path: ${y}`);yield h.downloadCache(i.archiveLocation,y,s);if(d.isDebug()){yield(0,g.listTar)(y,c)}const a=m.getArchiveFileSizeInBytes(y);d.info(`Cache Size: ~${Math.round(a/(1024*1024))} MB (${a} B)`);yield(0,g.extractTar)(y,c);d.info("Cache restored successfully");return i.cacheKey}catch(r){const i=r;if(i.name===ValidationError.name){throw r}else{d.warning(`Failed to restore: ${r.message}`)}}finally{try{yield m.unlinkFile(y)}catch(r){d.debug(`Failed to delete archive: ${r}`)}}return undefined}))}i.restoreCache=restoreCache;function saveCache(r,i,a,s=false){var p,l,y,v,b;return c(this,void 0,void 0,(function*(){checkPaths(r);checkKey(i);const c=yield m.getCompressionMethod();let x=-1;const w=yield m.resolvePaths(r);d.debug("Cache Paths:");d.debug(`${JSON.stringify(w)}`);if(w.length===0){throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`)}const S=yield m.createTempDirectory();const E=u.join(S,m.getCacheFileName(c));d.debug(`Archive Path: ${E}`);try{yield(0,g.createTar)(S,w,c);if(d.isDebug()){yield(0,g.listTar)(E,c)}const u=10*1024*1024*1024;cons
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(r){return Object.prototype.toString.call(r)==="[object Object]"}function isPlainObject(r){var i,a;if(isObject(r)===false)return false;i=r.constructor;if(i===undefined)return true;a=i.prototype;if(isObject(a)===false)return false;if(a.hasOwnProperty("isPrototypeOf")===false){return false}return true}i.isPlainObject=isPlainObject},1917:(r,i,a)=>{"use strict";var s=a(1161);var p=a(8866);function renamed(r,i){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. "+"Use yaml."+i+" instead, which is now safe by default.")}}r.exports.Type=a(6073);r.exports.Schema=a(1082);r.exports.FAILSAFE_SCHEMA=a(8562);r.exports.JSON_SCHEMA=a(1035);r.exports.CORE_SCHEMA=a(2011);r.exports.DEFAULT_SCHEMA=a(8759);r.exports.load=s.load;r.exports.loadAll=s.loadAll;r.exports.dump=p.dump;r.exports.YAMLException=a(8179);r.exports.types={binary:a(7900),float:a(2705),map:a(6150),null:a(721),pairs:a(6860),set:a(9548),timestamp:a(9212),bool:a(4993),int:a(1615),merge:a(6104),omap:a(9046),seq:a(7283),str:a(3619)};r.exports.safeLoad=renamed("safeLoad","load");r.exports.safeLoadAll=renamed("safeLoadAll","loadAll");r.exports.safeDump=renamed("safeDump","dump")},6829:r=>{"use strict";function isNothing(r){return typeof r==="undefined"||r===null}function isObject(r){return typeof r==="object"&&r!==null}function toArray(r){if(Array.isArray(r))return r;else if(isNothing(r))return[];return[r]}function extend(r,i){var a,s,p,l;if(i){l=Object.keys(i);for(a=0,s=l.length;a<s;a+=1){p=l[a];r[p]=i[p]}}return r}function repeat(r,i){var a="",s;for(s=0;s<i;s+=1){a+=r}return a}function isNegativeZero(r){return r===0&&Number.NEGATIVE_INFINITY===1/r}r.exports.isNothing=isNothing;r.exports.isObject=isObject;r.exports.toArray=toArray;r.exports.repeat=repeat;r.exports.isNegativeZero=isNegativeZero;r.exports.extend=extend},8866:(r,i,a)=>{"use strict";var s=a(6829);var p=a(8179);var l=a(8759);var c=Object.prototype.toString;var d=Object.prototype.hasOwnProperty;var u=65279;var m=9;var h=10;var g=13;var y=32;var v=33;var b=34;var x=35;var w=37;var S=38;var E=39;var _=42;var T=44;var N=45;var P=58;var O=61;var C=62;var R=63;var A=64;var D=91;var k=93;var I=96;var L=123;var M=124;var B=125;var j={};j[0]="\\0";j[7]="\\a";j[8]="\\b";j[9]="\\t";j[10]="\\n";j[11]="\\v";j[12]="\\f";j[13]="\\r";j[27]="\\e";j[34]='\\"';j[92]="\\\\";j[133]="\\N";j[160]="\\_";j[8232]="\\L";j[8233]="\\P";var z=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];var q=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function compileStyleMap(r,i){var a,s,p,l,c,u,m;if(i===null)return{};a={};s=Object.keys(i);for(p=0,l=s.length;p<l;p+=1){c=s[p];u=String(i[c]);if(c.slice(0,2)==="!!"){c="tag:yaml.org,2002:"+c.slice(2)}m=r.compiledTypeMap["fallback"][c];if(m&&d.call(m.styleAliases,u)){u=m.styleAliases[u]}a[c]=u}return a}function encodeHex(r){var i,a,l;i=r.toString(16).toUpperCase();if(r<=255){a="x";l=2}else if(r<=65535){a="u";l=4}else if(r<=4294967295){a="U";l=8}else{throw new p("code point within a string may not be greater than 0xFFFFFFFF")}return"\\"+a+s.repeat("0",l-i.length)+i}var U=1,G=2;function State(r){this.schema=r["schema"]||l;this.indent=Math.max(1,r["indent"]||2);this.noArrayIndent=r["noArrayIndent"]||false;this.skipInvalid=r["skipInvalid"]||false;this.flowLevel=s.isNothing(r["flowLevel"])?-1:r["flowLevel"];this.styleMap=compileStyleMap(this.schema,r["styles"]||null);this.sortKeys=r["sortKeys"]||false;this.lineWidth=r["lineWidth"]||80;this.noRefs=r["noRefs"]||false;this.noCompatMode=r["noCompatMode"]||false;this.condenseFlow=r["condenseFlow"]||false;this.quotingType=r["quotingType"]==='"'?G:U;this.forceQuotes=r["forceQuotes"]||false;this.replacer=typeof r["replacer"]==="function"?r["replacer"]:null;this.implicitTypes=this.schema.compiledImplicit;this.explicitTypes=this.schema.compiledExplicit;this.tag=null;this.result="";this.duplicates=[];this.usedDuplicates=null}function indentString(r,i){var a=s.repeat(" ",i),p=0,l=-1,c="",d,u=r.length;while(p<u){l=r.indexOf("\n",p);if(l===-1){d=r.slice(p);p=u}else{d=r.slice(p,l+1);p=l+1}if(d.leng
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*/
r.exports=a(3765)},3583:(r,i,a)=>{"use strict";
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var s=a(7426);var p=a(1017).extname;var l=/^\s*([^;\s]*)(?:;|\s|$)/;var c=/^text\//i;i.charset=charset;i.charsets={lookup:charset};i.contentType=contentType;i.extension=extension;i.extensions=Object.create(null);i.lookup=lookup;i.types=Object.create(null);populateMaps(i.extensions,i.types);function charset(r){if(!r||typeof r!=="string"){return false}var i=l.exec(r);var a=i&&s[i[1].toLowerCase()];if(a&&a.charset){return a.charset}if(i&&c.test(i[1])){return"UTF-8"}return false}function contentType(r){if(!r||typeof r!=="string"){return false}var a=r.indexOf("/")===-1?i.lookup(r):r;if(!a){return false}if(a.indexOf("charset")===-1){var s=i.charset(a);if(s)a+="; charset="+s.toLowerCase()}return a}function extension(r){if(!r||typeof r!=="string"){return false}var a=l.exec(r);var s=a&&i.extensions[a[1].toLowerCase()];if(!s||!s.length){return false}return s[0]}function lookup(r){if(!r||typeof r!=="string"){return false}var a=p("x."+r).toLowerCase().substr(1);if(!a){return false}return i.types[a]||false}function populateMaps(r,i){var a=["nginx","apache",undefined,"iana"];Object.keys(s).forEach((function forEachMimeType(p){var l=s[p];var c=l.extensions;if(!c||!c.length){return}r[p]=c;for(var d=0;d<c.length;d++){var u=c[d];if(i[u]){var m=a.indexOf(s[i[u]].source);var h=a.indexOf(l.source);if(i[u]!=="application/octet-stream"&&(m>h||m===h&&i[u].substr(0,12)==="application/")){continue}}i[u]=p}}))}},3973:(r,i,a)=>{r.exports=minimatch;minimatch.Minimatch=Minimatch;var s=function(){try{return a(1017)}catch(r){}}()||{sep:"/"};minimatch.sep=s.sep;var p=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var l=a(3717);var c={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var d="[^/]";var u=d+"*?";var m="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var h="(?:(?!(?:\\/|^)\\.).)*?";var g=charSet("().*{}+?[]^$\\!");function charSet(r){return r.split("").reduce((function(r,i){r[i]=true;return r}),{})}var y=/\/+/;minimatch.filter=filter;function filter(r,i){i=i||{};return function(a,s,p){return minimatch(a,r,i)}}function ext(r,i){i=i||{};var a={};Object.keys(r).forEach((function(i){a[i]=r[i]}));Object.keys(i).forEach((function(r){a[r]=i[r]}));return a}minimatch.defaults=function(r){if(!r||typeof r!=="object"||!Object.keys(r).length){return minimatch}var i=minimatch;var a=function minimatch(a,s,p){return i(a,s,ext(r,p))};a.Minimatch=function Minimatch(a,s){return new i.Minimatch(a,ext(r,s))};a.Minimatch.defaults=function defaults(a){return i.defaults(ext(r,a)).Minimatch};a.filter=function filter(a,s){return i.filter(a,ext(r,s))};a.defaults=function defaults(a){return i.defaults(ext(r,a))};a.makeRe=function makeRe(a,s){return i.makeRe(a,ext(r,s))};a.braceExpand=function braceExpand(a,s){return i.braceExpand(a,ext(r,s))};a.match=function(a,s,p){return i.match(a,s,ext(r,p))};return a};Minimatch.defaults=function(r){return minimatch.defaults(r).Minimatch};function minimatch(r,i,a){assertValidPattern(i);if(!a)a={};if(!a.nocomment&&i.charAt(0)==="#"){return false}return new Minimatch(i,a).match(r)}function Minimatch(r,i){if(!(this instanceof Minimatch)){return new Minimatch(r,i)}assertValidPattern(r);if(!i)i={};r=r.trim();if(!i.allowWindowsEscape&&s.sep!=="/"){r=r.split(s.sep).join("/")}this.options=i;this.set=[];this.pattern=r;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!i.partial;this.make()}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){var r=this.pattern;var i=this.options;if(!i.nocomment&&r.charAt(0)==="#"){this.comment=true;return}if(!r){this.empty=true;return}this.parseNegate();var a=this.globSet=this.braceExpand();if(i.debug)this.debug=function debug(){console.error.apply(console,arguments)};this.debug(this.pattern,a);a=this.globParts=a.map((function(r){return r.split(y)}));this.debug(this.pattern,a);a=a.map((function(r,i,a){return r.map(this.parse,this)}),this);this.debug(this.pattern,a);a=a.filter((function(r){return r.indexOf(false)===-1}));this.debug(this.pattern,a);thi
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var r=String.fromCharCode;var i=Math.floor;var fromCodePoint=function(){var a=16384;var s=[];var p;var l;var c=-1;var d=arguments.length;if(!d){return""}var u="";while(++c<d){var m=Number(arguments[c]);if(!isFinite(m)||m<0||m>1114111||i(m)!==m){throw RangeError("Invalid code point: "+m)}if(m<=65535){s.push(m)}else{m-=65536;p=(m>>10)+55296;l=m%1024+56320;s.push(p,l)}if(c+1===d||s.length>a){u+=r.apply(null,s);s.length=0}}return u};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:true,writable:true})}else{String.fromCodePoint=fromCodePoint}})()}})(false?0:i)},5911:(r,i)=>{i=r.exports=SemVer;var a;if(typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)){a=function(){var r=Array.prototype.slice.call(arguments,0);r.unshift("SEMVER");console.log.apply(console,r)}}else{a=function(){}}i.SEMVER_SPEC_VERSION="2.0.0";var s=256;var p=Number.MAX_SAFE_INTEGER||9007199254740991;var l=16;var c=i.re=[];var d=i.src=[];var u=i.tokens={};var m=0;function tok(r){u[r]=m++}tok("NUMERICIDENTIFIER");d[u.NUMERICIDENTIFIER]="0|[1-9]\\d*";tok("NUMERICIDENTIFIERLOOSE");d[u.NUMERICIDENTIFIERLOOSE]="[0-9]+";tok("NONNUMERICIDENTIFIER");d[u.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";tok("MAINVERSION");d[u.MAINVERSION]="("+d[u.NUMERICIDENTIFIER]+")\\."+"("+d[u.NUMERICIDENTIFIER]+")\\."+"("+d[u.NUMERICIDENTIFIER]+")";tok("MAINVERSIONLOOSE");d[u.MAINVERSIONLOOSE]="("+d[u.NUMERICIDENTIFIERLOOSE]+")\\."+"("+d[u.NUMERICIDENTIFIERLOOSE]+")\\."+"("+d[u.NUMERICIDENTIFIERLOOSE]+")";tok("PRERELEASEIDENTIFIER");d[u.PRERELEASEIDENTIFIER]="(?:"+d[u.NUMERICIDENTIFIER]+"|"+d[u.NONNUMERICIDENTIFIER]+")";tok("PRERELEASEIDENTIFIERLOOSE");d[u.PRERELEASEIDENTIFIERLOOSE]="(?:"+d[u.NUMERICIDENTIFIERLOOSE]+"|"+d[u.NONNUMERICIDENTIFIER]+")";tok("PRERELEASE");d[u.PRERELEASE]="(?:-("+d[u.PRERELEASEIDENTIFIER]+"(?:\\."+d[u.PRERELEASEIDENTIFIER]+")*))";tok("PRERELEASELOOSE");d[u.PRERELEASELOOSE]="(?:-?("+d[u.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+d[u.PRERELEASEIDENTIFIERLOOSE]+")*))";tok("BUILDIDENTIFIER");d[u.BUILDIDENTIFIER]="[0-9A-Za-z-]+";tok("BUILD");d[u.BUILD]="(?:\\+("+d[u.BUILDIDENTIFIER]+"(?:\\."+d[u.BUILDIDENTIFIER]+")*))";tok("FULL");tok("FULLPLAIN");d[u.FULLPLAIN]="v?"+d[u.MAINVERSION]+d[u.PRERELEASE]+"?"+d[u.BUILD]+"?";d[u.FULL]="^"+d[u.FULLPLAIN]+"$";tok("LOOSEPLAIN");d[u.LOOSEPLAIN]="[v=\\s]*"+d[u.MAINVERSIONLOOSE]+d[u.PRERELEASELOOSE]+"?"+d[u.BUILD]+"?";tok("LOOSE");d[u.LOOSE]="^"+d[u.LOOSEPLAIN]+"$";tok("GTLT");d[u.GTLT]="((?:<|>)?=?)";tok("XRANGEIDENTIFIERLOOSE");d[u.XRANGEIDENTIFIERLOOSE]=d[u.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";tok("XRANGEIDENTIFIER");d[u.XRANGEIDENTIFIER]=d[u.NUMERICIDENTIFIER]+"|x|X|\\*";tok("XRANGEPLAIN");d[u.XRANGEPLAIN]="[v=\\s]*("+d[u.XRANGEIDENTIFIER]+")"+"(?:\\.("+d[u.XRANGEIDENTIFIER]+")"+"(?:\\.("+d[u.XRANGEIDENTIFIER]+")"+"(?:"+d[u.PRERELEASE]+")?"+d[u.BUILD]+"?"+")?)?";tok("XRANGEPLAINLOOSE");d[u.XRANGEPLAINLOOSE]="[v=\\s]*("+d[u.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+d[u.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+d[u.XRANGEIDENTIFIERLOOSE]+")"+"(?:"+d[u.PRERELEASELOOSE]+")?"+d[u.BUILD]+"?"+")?)?";tok("XRANGE");d[u.XRANGE]="^"+d[u.GTLT]+"\\s*"+d[u.XRANGEPLAIN]+"$";tok("XRANGELOOSE");d[u.XRANGELOOSE]="^"+d[u.GTLT]+"\\s*"+d[u.XRANGEPLAINLOOSE]+"$";tok("COERCE");d[u.COERCE]="(^|[^\\d])"+"(\\d{1,"+l+"})"+"(?:\\.(\\d{1,"+l+"}))?"+"(?:\\.(\\d{1,"+l+"}))?"+"(?:$|[^\\d])";tok("COERCERTL");c[u.COERCERTL]=new RegExp(d[u.COERCE],"g");tok("LONETILDE");d[u.LONETILDE]="(?:~>?)";tok("TILDETRIM");d[u.TILDETRIM]="(\\s*)"+d[u.LONETILDE]+"\\s+";c[u.TILDETRIM]=new RegExp(d[u.TILDETRIM],"g");var h="$1~";tok("TILDE");d[u.TILDE]="^"+d[u.LONETILDE]+d[u.XRANGEPLAIN]+"$";tok("TILDELOOSE");d[u.TILDELOOSE]="^"+d[u.LONETILDE]+d[u.XRANGEPLAINLOOSE]+"$";tok("LONECARET");d[u.LONECARET]="(?:\\^)";tok("CARETTRIM");d[u.CARETTRIM]="(\\s*)"+d[u.LONECARET]+"\\s+";c[u.CARETTRIM]=new RegExp(d[u.CARETTRIM],"g");var g="$1^";tok("CARET");d[u.CARET]="^"+d[u.LONECARET]+d[u.XRANGEPLAIN
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
const s=a(7147);const p=a(2037);const l=a(1017);const c=a(6113);const d={fs:s.constants,os:p.constants};const u=a(4959);const m="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",h=/XXXXXX/,g=3,y=(d.O_CREAT||d.fs.O_CREAT)|(d.O_EXCL||d.fs.O_EXCL)|(d.O_RDWR||d.fs.O_RDWR),v=p.platform()==="win32",b=d.EBADF||d.os.errno.EBADF,x=d.ENOENT||d.os.errno.ENOENT,w=448,S=384,E="exit",_=[],T=s.rmdirSync.bind(s),N=u.sync;let P=false;function tmpName(r,i){const a=_parseArguments(r,i),p=a[0],l=a[1];try{_assertAndSanitizeOptions(p)}catch(r){return l(r)}let c=p.tries;(function _getUniqueName(){try{const r=_generateTmpName(p);s.stat(r,(function(i){if(!i){if(c-- >0)return _getUniqueName();return l(new Error("Could not get a unique tmp filename, max tries reached "+r))}l(null,r)}))}catch(r){l(r)}})()}function tmpNameSync(r){const i=_parseArguments(r),a=i[0];_assertAndSanitizeOptions(a);let p=a.tries;do{const r=_generateTmpName(a);try{s.statSync(r)}catch(i){return r}}while(p-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(r,i){const a=_parseArguments(r,i),p=a[0],l=a[1];tmpName(p,(function _tmpNameCreated(r,i){if(r)return l(r);s.open(i,y,p.mode||S,(function _fileCreated(r,a){if(r)return l(r);if(p.discardDescriptor){return s.close(a,(function _discardCallback(r){return l(r,i,undefined,_prepareTmpFileRemoveCallback(i,-1,p,false))}))}else{const r=p.discardDescriptor||p.detachDescriptor;l(null,i,a,_prepareTmpFileRemoveCallback(i,r?-1:a,p,false))}}))}))}function fileSync(r){const i=_parseArguments(r),a=i[0];const p=a.discardDescriptor||a.detachDescriptor;const l=tmpNameSync(a);var c=s.openSync(l,y,a.mode||S);if(a.discardDescriptor){s.closeSync(c);c=undefined}return{name:l,fd:c,removeCallback:_prepareTmpFileRemoveCallback(l,p?-1:c,a,true)}}function dir(r,i){const a=_parseArguments(r,i),p=a[0],l=a[1];tmpName(p,(function _tmpNameCreated(r,i){if(r)return l(r);s.mkdir(i,p.mode||w,(function _dirCreated(r){if(r)return l(r);l(null,i,_prepareTmpDirRemoveCallback(i,p,false))}))}))}function dirSync(r){const i=_parseArguments(r),a=i[0];const p=tmpNameSync(a);s.mkdirSync(p,a.mode||w);return{name:p,removeCallback:_prepareTmpDirRemoveCallback(p,a,true)}}function _removeFileAsync(r,i){const _handler=function(r){if(r&&!_isENOENT(r)){return i(r)}i()};if(0<=r[0])s.close(r[0],(function(){s.unlink(r[1],_handler)}));else s.unlink(r[1],_handler)}function _removeFileSync(r){let i=null;try{if(0<=r[0])s.closeSync(r[0])}catch(r){if(!_isEBADF(r)&&!_isENOENT(r))throw r}finally{try{s.unlinkSync(r[1])}catch(r){if(!_isENOENT(r))i=r}}if(i!==null){throw i}}function _prepareTmpFileRemoveCallback(r,i,a,s){const p=_prepareRemoveCallback(_removeFileSync,[i,r],s);const l=_prepareRemoveCallback(_removeFileAsync,[i,r],s,p);if(!a.keep)_.unshift(p);return s?p:l}function _prepareTmpDirRemoveCallback(r,i,a){const p=i.unsafeCleanup?u:s.rmdir.bind(s);const l=i.unsafeCleanup?N:T;const c=_prepareRemoveCallback(l,r,a);const d=_prepareRemoveCallback(p,r,a,c);if(!i.keep)_.unshift(c);return a?c:d}function _prepareRemoveCallback(r,i,a,s){let p=false;return function _cleanupCallback(l){if(!p){const c=s||_cleanupCallback;const d=_.indexOf(c);if(d>=0)_.splice(d,1);p=true;if(a||r===T||r===N){return r(i)}else{return r(i,l||function(){})}}}}function _garbageCollector(){if(!P)return;while(_.length){try{_[0]()}catch(r){}}}function _randomChars(r){let i=[],a=null;try{a=c.randomBytes(r)}catch(i){a=c.pseudoRandomBytes(r)}for(var s=0;s<r;s++){i.push(m[a[s]%m.length])}return i.join("")}function _isBlank(r){return r===null||_isUndefined(r)||!r.trim()}function _isUndefined(r){return typeof r==="undefined"}function _parseArguments(r,i){if(typeof r==="function"){return[{},r]}if(_isUndefined(r)){return[{},i]}const a={};for(const i of Object.getOwnPropertyNames(r)){a[i]=r[i]}return[a,i]}function _generateTmpName(r){const i=r.tmpdir;if(!_isUndefined(r.name))return l.join(i,r.dir,r.name);if(!_isUndefined(r.template))return l.join(i,r.dir,r.template).replace(h,_randomChars(6));const a=[r.prefix?r.prefix:"tmp","-",process.pid,"-",_randomChars(12),r.postfix?"-"+r.po
//# sourceMappingURL=index.js.map