@gjsify/cli 0.64.0 → 0.64.1-next.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.gjs.mjs +3 -3
- package/lib/commands/ship.js +1 -0
- package/lib/types/config-data.d.ts +18 -1
- package/lib/utils/ship/discover.d.ts +15 -1
- package/lib/utils/ship/discover.js +24 -1
- package/package.json +22 -21
package/dist/cli.gjs.mjs
CHANGED
|
@@ -145,7 +145,7 @@ fi
|
|
|
145
145
|
`)}`:``;n.fail(N(`Missing required argument: %s`,`Missing required arguments: %s`,Object.keys(C).length,Object.keys(C).join(`, `)+S))}},F.unknownArguments=function unknownArguments(S,C,I,H,W=!0){let q=t.getInternalMethods().getCommandInstance().getCommands(),Y=[],X=t.getInternalMethods().getContext();if(Object.keys(S).forEach(n=>{!gp.includes(n)&&!Object.prototype.hasOwnProperty.call(I,n)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),n)&&!F.isValidAndSomeAliasIsNotNew(n,C)&&Y.push(n)}),W&&(X.commands.length>0||q.length>0||H)&&S._.slice(X.commands.length).forEach(t=>{q.includes(``+t)||Y.push(``+t)}),W){let n=t.getDemandedCommands()._?.max||0,C=X.commands.length+n;C<S._.length&&S._.slice(C).forEach(t=>{t=String(t),!X.commands.includes(t)&&!Y.includes(t)&&Y.push(t)})}Y.length&&n.fail(N(`Unknown argument: %s`,`Unknown arguments: %s`,Y.length,Y.map(t=>t.trim()?t:`"${t}"`).join(`, `)))},F.unknownCommands=function unknownCommands(S){let C=t.getInternalMethods().getCommandInstance().getCommands(),F=[],I=t.getInternalMethods().getContext();return(I.commands.length>0||C.length>0)&&S._.slice(I.commands.length).forEach(t=>{C.includes(``+t)||F.push(``+t)}),F.length>0?(n.fail(N(`Unknown command: %s`,`Unknown commands: %s`,F.length,F.join(`, `))),!0):!1},F.isValidAndSomeAliasIsNotNew=function isValidAndSomeAliasIsNotNew(n,S){if(!Object.prototype.hasOwnProperty.call(S,n))return!1;let C=t.parsed.newAliases;return[n,...S[n]].some(t=>!Object.prototype.hasOwnProperty.call(C,t)||!C[n])},F.limitedChoices=function limitedChoices(S){let N=t.getOptions(),F={};if(!Object.keys(N.choices).length)return;Object.keys(S).forEach(t=>{gp.indexOf(t)===-1&&Object.prototype.hasOwnProperty.call(N.choices,t)&&[].concat(S[t]).forEach(n=>{N.choices[t].indexOf(n)===-1&&n!==void 0&&(F[t]=(F[t]||[]).concat(n))})});let I=Object.keys(F);if(!I.length)return;let H=C(`Invalid values:`);I.forEach(t=>{H+=`\n ${C(`Argument: %s, Given: %s, Choices: %s`,t,n.stringifiedValues(F[t]),n.stringifiedValues(N.choices[t]))}`}),n.fail(H)};let I={};F.implies=function implies(n,C){argsert(`<string|object> [array|number|string]`,[n,C],arguments.length),typeof n==`object`?Object.keys(n).forEach(t=>{F.implies(t,n[t])}):(t.global(n),I[n]||(I[n]=[]),Array.isArray(C)?C.forEach(t=>F.implies(n,t)):(assertNotStrictEqual(C,void 0,S),I[n].push(C)))},F.getImplied=function getImplied(){return I};function keyExists(t,n){let S=Number(n);return n=isNaN(S)?n:S,typeof n==`number`?n=t._.length>=n:n.match(/^--no-.+/)?(n=n.match(/^--no-(.+)/)[1],n=!Object.prototype.hasOwnProperty.call(t,n)):n=Object.prototype.hasOwnProperty.call(t,n),n}F.implications=function implications(t){let S=[];if(Object.keys(I).forEach(n=>{let C=n;(I[n]||[]).forEach(n=>{let N=C,F=n;N=keyExists(t,N),n=keyExists(t,n),N&&!n&&S.push(` ${C} -> ${F}`)})}),S.length){let t=`${C(`Implications failed:`)}\n`;S.forEach(n=>{t+=n}),n.fail(t)}};let H={};F.conflicts=function conflicts(n,S){argsert(`<string|object> [array|string]`,[n,S],arguments.length),typeof n==`object`?Object.keys(n).forEach(t=>{F.conflicts(t,n[t])}):(t.global(n),H[n]||(H[n]=[]),Array.isArray(S)?S.forEach(t=>F.conflicts(n,t)):H[n].push(S))},F.getConflicting=()=>H,F.conflicting=function conflictingFn(N){Object.keys(N).forEach(t=>{H[t]&&H[t].forEach(S=>{S&&N[t]!==void 0&&N[S]!==void 0&&n.fail(C(`Arguments %s and %s are mutually exclusive`,t,S))})}),t.getInternalMethods().getParserConfiguration()[`strip-dashed`]&&Object.keys(H).forEach(t=>{H[t].forEach(F=>{F&&N[S.Parser.camelCase(t)]!==void 0&&N[S.Parser.camelCase(F)]!==void 0&&n.fail(C(`Arguments %s and %s are mutually exclusive`,t,F))})})},F.recommendCommands=function recommendCommands(t,S){S=S.sort((t,n)=>n.length-t.length);let N=null,F=1/0;for(let n=0,C;(C=S[n])!==void 0;n++){let n=levenshtein(t,C);n<=3&&n<F&&(F=n,N=C)}N&&n.fail(C(`Did you mean %s?`,N))},F.reset=function reset(t){return I=objFilter(I,n=>!t[n]),H=objFilter(H,n=>!t[n]),F};let W=[];return F.freeze=function freeze(){W.push({implied:I,conflicting:H})},F.unfreeze=function unfreeze(){let t=W.pop();assertNotStrictEqual(t,void 0,S),{implied:I,conflicting:H}=t},F}var gp,vp=__esmMin(()=>{np(),Qf(),hp(),sp(),gp=[`$0`,`--`,`_`]});function YargsFactory(t){return(n=[],S=t.process.cwd(),C)=>{let N=new YargsInstance(n,S,C,t);return Object.defineProperty(N,"argv",{get:()=>N.parse(),enumerable:!0}),N.help(),N.version(),N}}function isYargsInstance(t){return!!t&&typeof t.getInternalMethods==`function`}var __classPrivateFieldSet,__classPrivateFieldGet,yp,bp,xp,Sp,Cp,wp,Tp,Ep,Dp,Op,kp,Ap,jp,Mp,Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,YargsInstance,Rm=__esmMin(()=>{_e(),op(),Qf(),bl(),up(),np(),mp(),vp(),sp(),Cl(),rp(),$f(),ip(),lp(),__classPrivateFieldSet=function(t,n,S,C,N){if(C===`m`)throw TypeError(`Private method is not writable`);if(C===`a`&&!N)throw TypeError(`Private accessor was defined without a setter`);if(typeof n==`function`?t!==n||!N:!n.has(t))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return C===`a`?N.call(t,S):N?N.value=S:n.set(t,S),S},__classPrivateFieldGet=function(t,n,S,C){if(S===`a`&&!C)throw TypeError(`Private accessor was defined without a getter`);if(typeof n==`function`?t!==n||!C:!n.has(t))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return S===`m`?C:S===`a`?C.call(t):C?C.value:n.get(t)},em=Symbol(`copyDoubleDash`),tm=Symbol(`copyDoubleDash`),nm=Symbol(`deleteFromParserHintObject`),im=Symbol(`emitWarning`),am=Symbol(`freeze`),om=Symbol(`getDollarZero`),sm=Symbol(`getParserConfiguration`),cm=Symbol(`getUsageConfiguration`),lm=Symbol(`guessLocale`),um=Symbol(`guessVersion`),dm=Symbol(`parsePositionalNumbers`),fm=Symbol(`pkgUp`),pm=Symbol(`populateParserHintArray`),mm=Symbol(`populateParserHintSingleValueDictionary`),hm=Symbol(`populateParserHintArrayDictionary`),gm=Symbol(`populateParserHintDictionary`),_m=Symbol(`sanitizeKey`),vm=Symbol(`setKey`),ym=Symbol(`unfreeze`),bm=Symbol(`validateAsync`),xm=Symbol(`getCommandInstance`),Sm=Symbol(`getContext`),Cm=Symbol(`getHasOutput`),wm=Symbol(`getLoggerInstance`),Tm=Symbol(`getParseContext`),Em=Symbol(`getUsageInstance`),Dm=Symbol(`getValidationInstance`),Om=Symbol(`hasParseCallback`),km=Symbol(`isGlobalContext`),Am=Symbol(`postProcess`),jm=Symbol(`rebase`),Mm=Symbol(`reset`),Nm=Symbol(`runYargsParserAndExecuteCommands`),Pm=Symbol(`runValidation`),Fm=Symbol(`setHasOutput`),Im=Symbol(`kTrackManuallySetKeys`),Lm=`en_US`,YargsInstance=class{constructor(t=[],n,S,C){this.customScriptName=!1,this.parsed=!1,yp.set(this,void 0),bp.set(this,void 0),xp.set(this,{commands:[],fullCommands:[]}),Sp.set(this,null),Cp.set(this,null),wp.set(this,`show-hidden`),Tp.set(this,null),Ep.set(this,!0),Dp.set(this,{}),Op.set(this,!0),kp.set(this,[]),Ap.set(this,void 0),jp.set(this,{}),Mp.set(this,!1),Np.set(this,null),Pp.set(this,!0),Fp.set(this,void 0),Ip.set(this,``),Lp.set(this,void 0),Rp.set(this,void 0),zp.set(this,{}),Bp.set(this,null),Vp.set(this,null),Hp.set(this,{}),Up.set(this,{}),Wp.set(this,void 0),Gp.set(this,!1),Kp.set(this,void 0),qp.set(this,!1),Jp.set(this,!1),Yp.set(this,!1),Xp.set(this,void 0),Zp.set(this,{}),Qp.set(this,null),$p.set(this,void 0),__classPrivateFieldSet(this,Kp,C,`f`),__classPrivateFieldSet(this,Wp,t,`f`),__classPrivateFieldSet(this,bp,n,`f`),__classPrivateFieldSet(this,Rp,S,`f`),__classPrivateFieldSet(this,Ap,new GlobalMiddleware(this),`f`),this.$0=this[om](),this[Mm](),__classPrivateFieldSet(this,yp,__classPrivateFieldGet(this,yp,`f`),`f`),__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`),`f`),__classPrivateFieldSet(this,$p,__classPrivateFieldGet(this,$p,`f`),`f`),__classPrivateFieldSet(this,Lp,__classPrivateFieldGet(this,Lp,`f`),`f`),__classPrivateFieldGet(this,Lp,`f`).showHiddenOpt=__classPrivateFieldGet(this,wp,`f`),__classPrivateFieldSet(this,Fp,this[tm](),`f`),__classPrivateFieldGet(this,Kp,`f`).y18n.setLocale(Lm)}addHelpOpt(t,n){return argsert(`[string|boolean] [string]`,[t,n],arguments.length),__classPrivateFieldGet(this,Np,`f`)&&(this[nm](__classPrivateFieldGet(this,Np,`f`)),__classPrivateFieldSet(this,Np,null,`f`)),t===!1&&n===void 0?this:(__classPrivateFieldSet(this,Np,typeof t==`string`?t:`help`,`f`),this.boolean(__classPrivateFieldGet(this,Np,`f`)),this.describe(__classPrivateFieldGet(this,Np,`f`),n||__classPrivateFieldGet(this,Xp,`f`).deferY18nLookup(`Show help`)),this)}help(t,n){return this.addHelpOpt(t,n)}addShowHiddenOpt(t,n){if(argsert(`[string|boolean] [string]`,[t,n],arguments.length),t===!1&&n===void 0)return this;let S=typeof t==`string`?t:__classPrivateFieldGet(this,wp,`f`);return this.boolean(S),this.describe(S,n||__classPrivateFieldGet(this,Xp,`f`).deferY18nLookup(`Show hidden options`)),__classPrivateFieldGet(this,Lp,`f`).showHiddenOpt=S,this}showHidden(t,n){return this.addShowHiddenOpt(t,n)}alias(t,n){return argsert(`<object|string|array> [string|array]`,[t,n],arguments.length),this[hm](this.alias.bind(this),`alias`,t,n),this}array(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`array`,t),this[Im](t),this}boolean(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`boolean`,t),this[Im](t),this}check(t,n){return argsert(`<function> [boolean]`,[t,n],arguments.length),this.middleware((n,S)=>maybeAsyncResult(()=>t(n,S.getOptions()),S=>(S?(typeof S==`string`||S instanceof Error)&&__classPrivateFieldGet(this,Xp,`f`).fail(S.toString(),S):__classPrivateFieldGet(this,Xp,`f`).fail(__classPrivateFieldGet(this,Kp,`f`).y18n.__(`Argument check failed: %s`,t.toString())),n),t=>(__classPrivateFieldGet(this,Xp,`f`).fail(t.message?t.message:t.toString(),t),n)),!1,n),this}choices(t,n){return argsert(`<object|string|array> [string|array]`,[t,n],arguments.length),this[hm](this.choices.bind(this),`choices`,t,n),this}coerce(t,n){if(argsert(`<object|string|array> [function]`,[t,n],arguments.length),Array.isArray(t)){if(!n)throw new yl(`coerce callback must be provided`);for(let S of t)this.coerce(S,n);return this}else if(typeof t==`object`){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!n)throw new yl(`coerce callback must be provided`);let S=t;return __classPrivateFieldGet(this,Lp,`f`).key[S]=!0,__classPrivateFieldGet(this,Ap,`f`).addCoerceMiddleware((t,C)=>{let N=C.getAliases()[S]??[],F=[S,...N].filter(n=>Object.prototype.hasOwnProperty.call(t,n));return F.length===0?t:maybeAsyncResult(()=>n(t[F[0]]),n=>(F.forEach(S=>{t[S]=n}),t),t=>{throw new yl(t.message)})},S),this}conflicts(t,n){return argsert(`<string|object> [string|array]`,[t,n],arguments.length),__classPrivateFieldGet(this,$p,`f`).conflicts(t,n),this}config(t=`config`,n,S){return argsert(`[object|string] [string|function] [function]`,[t,n,S],arguments.length),typeof t==`object`&&!Array.isArray(t)?(t=applyExtends(t,__classPrivateFieldGet(this,bp,`f`),this[sm]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,Kp,`f`)),__classPrivateFieldGet(this,Lp,`f`).configObjects=(__classPrivateFieldGet(this,Lp,`f`).configObjects||[]).concat(t),this):(typeof n==`function`&&(S=n,n=void 0),this.describe(t,n||__classPrivateFieldGet(this,Xp,`f`).deferY18nLookup(`Path to JSON config file`)),(Array.isArray(t)?t:[t]).forEach(t=>{__classPrivateFieldGet(this,Lp,`f`).config[t]=S||!0}),this)}completion(t,n,S){return argsert(`[string] [string|boolean|function] [function]`,[t,n,S],arguments.length),typeof n==`function`&&(S=n,n=void 0),__classPrivateFieldSet(this,Cp,t||__classPrivateFieldGet(this,Cp,`f`)||`completion`,`f`),!n&&n!==!1&&(n=`generate completion script`),this.command(__classPrivateFieldGet(this,Cp,`f`),n),S&&__classPrivateFieldGet(this,Sp,`f`).registerFunction(S),this}command(t,n,S,C,N,F){return argsert(`<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]`,[t,n,S,C,N,F],arguments.length),__classPrivateFieldGet(this,yp,`f`).addHandler(t,n,S,C,N,F),this}commands(t,n,S,C,N,F){return this.command(t,n,S,C,N,F)}commandDir(t,n){argsert(`<string> [object]`,[t,n],arguments.length);let S=__classPrivateFieldGet(this,Rp,`f`)||__classPrivateFieldGet(this,Kp,`f`).require;return __classPrivateFieldGet(this,yp,`f`).addDirectory(t,S,__classPrivateFieldGet(this,Kp,`f`).getCallerFile(),n),this}count(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`count`,t),this[Im](t),this}default(t,n,S){return argsert(`<object|string|array> [*] [string]`,[t,n,S],arguments.length),S&&(assertSingleKey(t,__classPrivateFieldGet(this,Kp,`f`)),__classPrivateFieldGet(this,Lp,`f`).defaultDescription[t]=S),typeof n==`function`&&(assertSingleKey(t,__classPrivateFieldGet(this,Kp,`f`)),__classPrivateFieldGet(this,Lp,`f`).defaultDescription[t]||(__classPrivateFieldGet(this,Lp,`f`).defaultDescription[t]=__classPrivateFieldGet(this,Xp,`f`).functionDescription(n)),n=n.call()),this[mm](this.default.bind(this),`default`,t,n),this}defaults(t,n,S){return this.default(t,n,S)}demandCommand(t=1,n,S,C){return argsert(`[number] [number|string] [string|null|undefined] [string|null|undefined]`,[t,n,S,C],arguments.length),typeof n!=`number`&&(S=n,n=1/0),this.global(`_`,!1),__classPrivateFieldGet(this,Lp,`f`).demandedCommands._={min:t,max:n,minMsg:S,maxMsg:C},this}demand(t,n,S){return Array.isArray(n)?(n.forEach(t=>{assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,Kp,`f`)),this.demandOption(t,S)}),n=1/0):typeof n!=`number`&&(S=n,n=1/0),typeof t==`number`?(assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,Kp,`f`)),this.demandCommand(t,n,S,S)):Array.isArray(t)?t.forEach(t=>{assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,Kp,`f`)),this.demandOption(t,S)}):typeof S==`string`?this.demandOption(t,S):(S===!0||S===void 0)&&this.demandOption(t),this}demandOption(t,n){return argsert(`<object|string|array> [string]`,[t,n],arguments.length),this[mm](this.demandOption.bind(this),`demandedOptions`,t,n),this}deprecateOption(t,n){return argsert(`<string> [string|boolean]`,[t,n],arguments.length),__classPrivateFieldGet(this,Lp,`f`).deprecatedOptions[t]=n,this}describe(t,n){return argsert(`<object|string|array> [string]`,[t,n],arguments.length),this[vm](t,!0),__classPrivateFieldGet(this,Xp,`f`).describe(t,n),this}detectLocale(t){return argsert(`<boolean>`,[t],arguments.length),__classPrivateFieldSet(this,Ep,t,`f`),this}env(t){return argsert(`[string|boolean]`,[t],arguments.length),t===!1?delete __classPrivateFieldGet(this,Lp,`f`).envPrefix:__classPrivateFieldGet(this,Lp,`f`).envPrefix=t||``,this}epilogue(t){return argsert(`<string>`,[t],arguments.length),__classPrivateFieldGet(this,Xp,`f`).epilog(t),this}epilog(t){return this.epilogue(t)}example(t,n){return argsert(`<string|array> [string]`,[t,n],arguments.length),Array.isArray(t)?t.forEach(t=>this.example(...t)):__classPrivateFieldGet(this,Xp,`f`).example(t,n),this}exit(t,n){__classPrivateFieldSet(this,Mp,!0,`f`),__classPrivateFieldSet(this,Tp,n,`f`),__classPrivateFieldGet(this,Op,`f`)&&__classPrivateFieldGet(this,Kp,`f`).process.exit(t)}exitProcess(t=!0){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,Op,t,`f`),this}fail(t){if(argsert(`<function|boolean>`,[t],arguments.length),typeof t==`boolean`&&t!==!1)throw new yl(`Invalid first argument. Expected function or boolean 'false'`);return __classPrivateFieldGet(this,Xp,`f`).failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,n){return argsert(`<array> [function]`,[t,n],arguments.length),n?__classPrivateFieldGet(this,Sp,`f`).getCompletion(t,n):new Promise((n,S)=>{__classPrivateFieldGet(this,Sp,`f`).getCompletion(t,(t,C)=>{t?S(t):n(C)})})}getDemandedOptions(){return argsert([],0),__classPrivateFieldGet(this,Lp,`f`).demandedOptions}getDemandedCommands(){return argsert([],0),__classPrivateFieldGet(this,Lp,`f`).demandedCommands}getDeprecatedOptions(){return argsert([],0),__classPrivateFieldGet(this,Lp,`f`).deprecatedOptions}getDetectLocale(){return __classPrivateFieldGet(this,Ep,`f`)}getExitProcess(){return __classPrivateFieldGet(this,Op,`f`)}getGroups(){return Object.assign({},__classPrivateFieldGet(this,jp,`f`),__classPrivateFieldGet(this,Up,`f`))}getHelp(){if(__classPrivateFieldSet(this,Mp,!0,`f`),!__classPrivateFieldGet(this,Xp,`f`).hasCachedHelpMessage()){if(!this.parsed){let t=this[Nm](__classPrivateFieldGet(this,Wp,`f`),void 0,void 0,0,!0);if(isPromise(t))return t.then(()=>__classPrivateFieldGet(this,Xp,`f`).help())}let t=__classPrivateFieldGet(this,yp,`f`).runDefaultBuilderOn(this);if(isPromise(t))return t.then(()=>__classPrivateFieldGet(this,Xp,`f`).help())}return Promise.resolve(__classPrivateFieldGet(this,Xp,`f`).help())}getOptions(){return __classPrivateFieldGet(this,Lp,`f`)}getStrict(){return __classPrivateFieldGet(this,qp,`f`)}getStrictCommands(){return __classPrivateFieldGet(this,Jp,`f`)}getStrictOptions(){return __classPrivateFieldGet(this,Yp,`f`)}global(t,n){return argsert(`<string|array> [boolean]`,[t,n],arguments.length),t=[].concat(t),n===!1?t.forEach(t=>{__classPrivateFieldGet(this,Lp,`f`).local.includes(t)||__classPrivateFieldGet(this,Lp,`f`).local.push(t)}):__classPrivateFieldGet(this,Lp,`f`).local=__classPrivateFieldGet(this,Lp,`f`).local.filter(n=>t.indexOf(n)===-1),this}group(t,n){argsert(`<string|array> <string>`,[t,n],arguments.length);let S=__classPrivateFieldGet(this,Up,`f`)[n]||__classPrivateFieldGet(this,jp,`f`)[n];__classPrivateFieldGet(this,Up,`f`)[n]&&delete __classPrivateFieldGet(this,Up,`f`)[n];let C={};return __classPrivateFieldGet(this,jp,`f`)[n]=(S||[]).concat(t).filter(t=>C[t]?!1:C[t]=!0),this}hide(t){return argsert(`<string>`,[t],arguments.length),__classPrivateFieldGet(this,Lp,`f`).hiddenOptions.push(t),this}implies(t,n){return argsert(`<string|object> [number|string|array]`,[t,n],arguments.length),__classPrivateFieldGet(this,$p,`f`).implies(t,n),this}locale(t){return argsert(`[string]`,[t],arguments.length),t===void 0?(this[lm](),__classPrivateFieldGet(this,Kp,`f`).y18n.getLocale()):(__classPrivateFieldSet(this,Ep,!1,`f`),__classPrivateFieldGet(this,Kp,`f`).y18n.setLocale(t),this)}middleware(t,n,S){return __classPrivateFieldGet(this,Ap,`f`).addMiddleware(t,!!n,S)}nargs(t,n){return argsert(`<string|object|array> [number]`,[t,n],arguments.length),this[mm](this.nargs.bind(this),`narg`,t,n),this}normalize(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`normalize`,t),this}number(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`number`,t),this[Im](t),this}option(t,n){if(argsert(`<string|object> [object]`,[t,n],arguments.length),typeof t==`object`)Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof n!=`object`&&(n={}),this[Im](t),__classPrivateFieldGet(this,Qp,`f`)&&(t===`version`||n?.alias===`version`)&&this[im]([`"version" is a reserved word.`,`Please do one of the following:`,'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)",`- Use a different option key`,`https://yargs.js.org/docs/#api-reference-version`].join(`
|
|
146
146
|
`),void 0,`versionWarning`),__classPrivateFieldGet(this,Lp,`f`).key[t]=!0,n.alias&&this.alias(t,n.alias);let S=n.deprecate||n.deprecated;S&&this.deprecateOption(t,S);let C=n.demand||n.required||n.require;C&&this.demand(t,C),n.demandOption&&this.demandOption(t,typeof n.demandOption==`string`?n.demandOption:void 0),n.conflicts&&this.conflicts(t,n.conflicts),`default`in n&&this.default(t,n.default),n.implies!==void 0&&this.implies(t,n.implies),n.nargs!==void 0&&this.nargs(t,n.nargs),n.config&&this.config(t,n.configParser),n.normalize&&this.normalize(t),n.choices&&this.choices(t,n.choices),n.coerce&&this.coerce(t,n.coerce),n.group&&this.group(t,n.group),(n.boolean||n.type===`boolean`)&&(this.boolean(t),n.alias&&this.boolean(n.alias)),(n.array||n.type===`array`)&&(this.array(t),n.alias&&this.array(n.alias)),(n.number||n.type===`number`)&&(this.number(t),n.alias&&this.number(n.alias)),(n.string||n.type===`string`)&&(this.string(t),n.alias&&this.string(n.alias)),(n.count||n.type===`count`)&&this.count(t),typeof n.global==`boolean`&&this.global(t,n.global),n.defaultDescription&&(__classPrivateFieldGet(this,Lp,`f`).defaultDescription[t]=n.defaultDescription),n.skipValidation&&this.skipValidation(t);let N=n.describe||n.description||n.desc,F=__classPrivateFieldGet(this,Xp,`f`).getDescriptions();(!Object.prototype.hasOwnProperty.call(F,t)||typeof N==`string`)&&this.describe(t,N),n.hidden&&this.hide(t),n.requiresArg&&this.requiresArg(t)}return this}options(t,n){return this.option(t,n)}parse(t,n,S){argsert(`[string|array] [function|boolean|object] [function]`,[t,n,S],arguments.length),this[am](),t===void 0&&(t=__classPrivateFieldGet(this,Wp,`f`)),typeof n==`object`&&(__classPrivateFieldSet(this,Vp,n,`f`),n=S),typeof n==`function`&&(__classPrivateFieldSet(this,Bp,n,`f`),n=!1),n||__classPrivateFieldSet(this,Wp,t,`f`),__classPrivateFieldGet(this,Bp,`f`)&&__classPrivateFieldSet(this,Op,!1,`f`);let C=this[Nm](t,!!n),N=this.parsed;return __classPrivateFieldGet(this,Sp,`f`).setParsed(this.parsed),isPromise(C)?C.then(t=>(__classPrivateFieldGet(this,Bp,`f`)&&__classPrivateFieldGet(this,Bp,`f`).call(this,__classPrivateFieldGet(this,Tp,`f`),t,__classPrivateFieldGet(this,Ip,`f`)),t)).catch(t=>{throw __classPrivateFieldGet(this,Bp,`f`)&&__classPrivateFieldGet(this,Bp,`f`)(t,this.parsed.argv,__classPrivateFieldGet(this,Ip,`f`)),t}).finally(()=>{this[ym](),this.parsed=N}):(__classPrivateFieldGet(this,Bp,`f`)&&__classPrivateFieldGet(this,Bp,`f`).call(this,__classPrivateFieldGet(this,Tp,`f`),C,__classPrivateFieldGet(this,Ip,`f`)),this[ym](),this.parsed=N,C)}parseAsync(t,n,S){let C=this.parse(t,n,S);return isPromise(C)?C:Promise.resolve(C)}parseSync(t,n,S){let C=this.parse(t,n,S);if(isPromise(C))throw new yl(`.parseSync() must not be used with asynchronous builders, handlers, or middleware`);return C}parserConfiguration(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,zp,t,`f`),this}pkgConf(t,n){argsert(`<string> [string]`,[t,n],arguments.length);let S=null,C=this[fm](n||__classPrivateFieldGet(this,bp,`f`));return C[t]&&typeof C[t]==`object`&&(S=applyExtends(C[t],n||__classPrivateFieldGet(this,bp,`f`),this[sm]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,Kp,`f`)),__classPrivateFieldGet(this,Lp,`f`).configObjects=(__classPrivateFieldGet(this,Lp,`f`).configObjects||[]).concat(S)),this}positional(t,n){argsert(`<string> <object>`,[t,n],arguments.length);let S=[`default`,`defaultDescription`,`implies`,`normalize`,`choices`,`conflicts`,`coerce`,`type`,`describe`,`desc`,`description`,`alias`];n=objFilter(n,(t,n)=>t===`type`&&![`string`,`number`,`boolean`].includes(n)?!1:S.includes(t));let C=__classPrivateFieldGet(this,xp,`f`).fullCommands[__classPrivateFieldGet(this,xp,`f`).fullCommands.length-1],N=C?__classPrivateFieldGet(this,yp,`f`).cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return objectKeys(N).forEach(S=>{let C=N[S];Array.isArray(C)?C.indexOf(t)!==-1&&(n[S]=!0):C[t]&&!(S in n)&&(n[S]=C[t])}),this.group(t,__classPrivateFieldGet(this,Xp,`f`).getPositionalGroupName()),this.option(t,n)}recommendCommands(t=!0){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,Gp,t,`f`),this}required(t,n,S){return this.demand(t,n,S)}require(t,n,S){return this.demand(t,n,S)}requiresArg(t){return argsert(`<array|string|object> [number]`,[t],arguments.length),typeof t==`string`&&__classPrivateFieldGet(this,Lp,`f`).narg[t]||this[mm](this.requiresArg.bind(this),`narg`,t,NaN),this}showCompletionScript(t,n){return argsert(`[string] [string]`,[t,n],arguments.length),t||=this.$0,__classPrivateFieldGet(this,Fp,`f`).log(__classPrivateFieldGet(this,Sp,`f`).generateCompletionScript(t,n||__classPrivateFieldGet(this,Cp,`f`)||`completion`)),this}showHelp(t){if(argsert(`[string|function]`,[t],arguments.length),__classPrivateFieldSet(this,Mp,!0,`f`),!__classPrivateFieldGet(this,Xp,`f`).hasCachedHelpMessage()){if(!this.parsed){let n=this[Nm](__classPrivateFieldGet(this,Wp,`f`),void 0,void 0,0,!0);if(isPromise(n))return n.then(()=>{__classPrivateFieldGet(this,Xp,`f`).showHelp(t)}),this}let n=__classPrivateFieldGet(this,yp,`f`).runDefaultBuilderOn(this);if(isPromise(n))return n.then(()=>{__classPrivateFieldGet(this,Xp,`f`).showHelp(t)}),this}return __classPrivateFieldGet(this,Xp,`f`).showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,n){return argsert(`[boolean|string] [string]`,[t,n],arguments.length),__classPrivateFieldGet(this,Xp,`f`).showHelpOnFail(t,n),this}showVersion(t){return argsert(`[string|function]`,[t],arguments.length),__classPrivateFieldGet(this,Xp,`f`).showVersion(t),this}skipValidation(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`skipValidation`,t),this}strict(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,qp,t!==!1,`f`),this}strictCommands(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,Jp,t!==!1,`f`),this}strictOptions(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,Yp,t!==!1,`f`),this}string(t){return argsert(`<array|string>`,[t],arguments.length),this[pm](`string`,t),this[Im](t),this}terminalWidth(){return argsert([],0),__classPrivateFieldGet(this,Kp,`f`).process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,Ep,!1,`f`),__classPrivateFieldGet(this,Kp,`f`).y18n.updateLocale(t),this}usage(t,n,S,C){if(argsert(`<string|null|undefined> [string|boolean] [function|object] [function]`,[t,n,S,C],arguments.length),n!==void 0){if(assertNotStrictEqual(t,null,__classPrivateFieldGet(this,Kp,`f`)),(t||``).match(/^\$0( |$)/))return this.command(t,n,S,C);throw new yl(`.usage() description must start with $0 if being used as alias for .command()`)}else return __classPrivateFieldGet(this,Xp,`f`).usage(t),this}usageConfiguration(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,Zp,t,`f`),this}version(t,n,S){let C=`version`;if(argsert(`[boolean|string] [string] [string]`,[t,n,S],arguments.length),__classPrivateFieldGet(this,Qp,`f`)&&(this[nm](__classPrivateFieldGet(this,Qp,`f`)),__classPrivateFieldGet(this,Xp,`f`).version(void 0),__classPrivateFieldSet(this,Qp,null,`f`)),arguments.length===0)S=this[um](),t=C;else if(arguments.length===1){if(t===!1)return this;S=t,t=C}else arguments.length===2&&(S=n,n=void 0);return __classPrivateFieldSet(this,Qp,typeof t==`string`?t:C,`f`),n||=__classPrivateFieldGet(this,Xp,`f`).deferY18nLookup(`Show version number`),__classPrivateFieldGet(this,Xp,`f`).version(S||void 0),this.boolean(__classPrivateFieldGet(this,Qp,`f`)),this.describe(__classPrivateFieldGet(this,Qp,`f`),n),this}wrap(t){return argsert(`<number|null|undefined>`,[t],arguments.length),__classPrivateFieldGet(this,Xp,`f`).wrap(t),this}[(yp=new WeakMap,bp=new WeakMap,xp=new WeakMap,Sp=new WeakMap,Cp=new WeakMap,wp=new WeakMap,Tp=new WeakMap,Ep=new WeakMap,Dp=new WeakMap,Op=new WeakMap,kp=new WeakMap,Ap=new WeakMap,jp=new WeakMap,Mp=new WeakMap,Np=new WeakMap,Pp=new WeakMap,Fp=new WeakMap,Ip=new WeakMap,Lp=new WeakMap,Rp=new WeakMap,zp=new WeakMap,Bp=new WeakMap,Vp=new WeakMap,Hp=new WeakMap,Up=new WeakMap,Wp=new WeakMap,Gp=new WeakMap,Kp=new WeakMap,qp=new WeakMap,Jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,$p=new WeakMap,em)](t){if(!t._||!t[`--`])return t;t._.push.apply(t._,t[`--`]);try{delete t[`--`]}catch{}return t}[tm](){return{log:(...t)=>{this[Om]()||ge.log(...t),__classPrivateFieldSet(this,Mp,!0,`f`),__classPrivateFieldGet(this,Ip,`f`).length&&__classPrivateFieldSet(this,Ip,__classPrivateFieldGet(this,Ip,`f`)+`
|
|
147
147
|
`,`f`),__classPrivateFieldSet(this,Ip,__classPrivateFieldGet(this,Ip,`f`)+t.join(` `),`f`)},error:(...t)=>{this[Om]()||ge.error(...t),__classPrivateFieldSet(this,Mp,!0,`f`),__classPrivateFieldGet(this,Ip,`f`).length&&__classPrivateFieldSet(this,Ip,__classPrivateFieldGet(this,Ip,`f`)+`
|
|
148
|
-
`,`f`),__classPrivateFieldSet(this,Ip,__classPrivateFieldGet(this,Ip,`f`)+t.join(` `),`f`)}}}[nm](t){objectKeys(__classPrivateFieldGet(this,Lp,`f`)).forEach(n=>{if((t=>t===`configObjects`)(n))return;let S=__classPrivateFieldGet(this,Lp,`f`)[n];Array.isArray(S)?S.includes(t)&&S.splice(S.indexOf(t),1):typeof S==`object`&&delete S[t]}),delete __classPrivateFieldGet(this,Xp,`f`).getDescriptions()[t]}[im](t,n,S){__classPrivateFieldGet(this,Dp,`f`)[S]||(__classPrivateFieldGet(this,Kp,`f`).process.emitWarning(t,n),__classPrivateFieldGet(this,Dp,`f`)[S]=!0)}[am](){__classPrivateFieldGet(this,kp,`f`).push({options:__classPrivateFieldGet(this,Lp,`f`),configObjects:__classPrivateFieldGet(this,Lp,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,Op,`f`),groups:__classPrivateFieldGet(this,jp,`f`),strict:__classPrivateFieldGet(this,qp,`f`),strictCommands:__classPrivateFieldGet(this,Jp,`f`),strictOptions:__classPrivateFieldGet(this,Yp,`f`),completionCommand:__classPrivateFieldGet(this,Cp,`f`),output:__classPrivateFieldGet(this,Ip,`f`),exitError:__classPrivateFieldGet(this,Tp,`f`),hasOutput:__classPrivateFieldGet(this,Mp,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,Bp,`f`),parseContext:__classPrivateFieldGet(this,Vp,`f`)}),__classPrivateFieldGet(this,Xp,`f`).freeze(),__classPrivateFieldGet(this,$p,`f`).freeze(),__classPrivateFieldGet(this,yp,`f`).freeze(),__classPrivateFieldGet(this,Ap,`f`).freeze()}[om](){let t=``,n;return n=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,Kp,`f`).process.argv()[0])?__classPrivateFieldGet(this,Kp,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,Kp,`f`).process.argv().slice(0,1),t=n.map(t=>{let n=this[jm](__classPrivateFieldGet(this,bp,`f`),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&n.length<t.length?n:t}).join(` `).trim(),__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,Kp,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`)&&(t=__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,Kp,`f`).path.dirname(__classPrivateFieldGet(this,Kp,`f`).process.execPath())}/`,``)),t}[sm](){return __classPrivateFieldGet(this,zp,`f`)}[cm](){return __classPrivateFieldGet(this,Zp,`f`)}[lm](){if(!__classPrivateFieldGet(this,Ep,`f`))return;let t=__classPrivateFieldGet(this,Kp,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(t.replace(/[.:].*/,``))}[um](){return this[fm]().version||`unknown`}[dm](t){let n=t[`--`]?t[`--`]:t._;for(let t=0,S;(S=n[t])!==void 0;t++)__classPrivateFieldGet(this,Kp,`f`).Parser.looksLikeNumber(S)&&Number.isSafeInteger(Math.floor(parseFloat(`${S}`)))&&(n[t]=Number(S));return t}[fm](t){let n=t||`*`;if(__classPrivateFieldGet(this,Hp,`f`)[n])return __classPrivateFieldGet(this,Hp,`f`)[n];let S={};try{let n=t||__classPrivateFieldGet(this,Kp,`f`).mainFilename;__classPrivateFieldGet(this,Kp,`f`).path.extname(n)&&(n=__classPrivateFieldGet(this,Kp,`f`).path.dirname(n));let C=__classPrivateFieldGet(this,Kp,`f`).findUp(n,(t,n)=>{if(n.includes(`package.json`))return`package.json`});assertNotStrictEqual(C,void 0,__classPrivateFieldGet(this,Kp,`f`)),S=JSON.parse(__classPrivateFieldGet(this,Kp,`f`).readFileSync(C,`utf8`))}catch{}return __classPrivateFieldGet(this,Hp,`f`)[n]=S||{},__classPrivateFieldGet(this,Hp,`f`)[n]}[pm](t,n){n=[].concat(n),n.forEach(n=>{n=this[_m](n),__classPrivateFieldGet(this,Lp,`f`)[t].push(n)})}[mm](t,n,S,C){this[gm](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Lp,`f`)[t][n]=S})}[hm](t,n,S,C){this[gm](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Lp,`f`)[t][n]=(__classPrivateFieldGet(this,Lp,`f`)[t][n]||[]).concat(S)})}[gm](t,n,S,C,N){if(Array.isArray(S))S.forEach(n=>{t(n,C)});else if((t=>typeof t==`object`)(S))for(let n of objectKeys(S))t(n,S[n]);else N(n,this[_m](S),C)}[_m](t){return t===`__proto__`?`___proto___`:t}[vm](t,n){return this[mm](this[vm].bind(this),`key`,t,n),this}[ym](){var t,n,S,C,N,F,I,H,W,q,Y,X;let Z=__classPrivateFieldGet(this,kp,`f`).pop();assertNotStrictEqual(Z,void 0,__classPrivateFieldGet(this,Kp,`f`));let te;t=this,n=this,S=this,C=this,N=this,F=this,I=this,H=this,W=this,q=this,Y=this,X=this,{options:{set value(n){__classPrivateFieldSet(t,Lp,n,`f`)}}.value,configObjects:te,exitProcess:{set value(t){__classPrivateFieldSet(n,Op,t,`f`)}}.value,groups:{set value(t){__classPrivateFieldSet(S,jp,t,`f`)}}.value,output:{set value(t){__classPrivateFieldSet(C,Ip,t,`f`)}}.value,exitError:{set value(t){__classPrivateFieldSet(N,Tp,t,`f`)}}.value,hasOutput:{set value(t){__classPrivateFieldSet(F,Mp,t,`f`)}}.value,parsed:this.parsed,strict:{set value(t){__classPrivateFieldSet(I,qp,t,`f`)}}.value,strictCommands:{set value(t){__classPrivateFieldSet(H,Jp,t,`f`)}}.value,strictOptions:{set value(t){__classPrivateFieldSet(W,Yp,t,`f`)}}.value,completionCommand:{set value(t){__classPrivateFieldSet(q,Cp,t,`f`)}}.value,parseFn:{set value(t){__classPrivateFieldSet(Y,Bp,t,`f`)}}.value,parseContext:{set value(t){__classPrivateFieldSet(X,Vp,t,`f`)}}.value}=Z,__classPrivateFieldGet(this,Lp,`f`).configObjects=te,__classPrivateFieldGet(this,Xp,`f`).unfreeze(),__classPrivateFieldGet(this,$p,`f`).unfreeze(),__classPrivateFieldGet(this,yp,`f`).unfreeze(),__classPrivateFieldGet(this,Ap,`f`).unfreeze()}[bm](t,n){return maybeAsyncResult(n,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[xm].bind(this),getContext:this[Sm].bind(this),getHasOutput:this[Cm].bind(this),getLoggerInstance:this[wm].bind(this),getParseContext:this[Tm].bind(this),getParserConfiguration:this[sm].bind(this),getUsageConfiguration:this[cm].bind(this),getUsageInstance:this[Em].bind(this),getValidationInstance:this[Dm].bind(this),hasParseCallback:this[Om].bind(this),isGlobalContext:this[km].bind(this),postProcess:this[Am].bind(this),reset:this[Mm].bind(this),runValidation:this[Pm].bind(this),runYargsParserAndExecuteCommands:this[Nm].bind(this),setHasOutput:this[Fm].bind(this)}}[xm](){return __classPrivateFieldGet(this,yp,`f`)}[Sm](){return __classPrivateFieldGet(this,xp,`f`)}[Cm](){return __classPrivateFieldGet(this,Mp,`f`)}[wm](){return __classPrivateFieldGet(this,Fp,`f`)}[Tm](){return __classPrivateFieldGet(this,Vp,`f`)||{}}[Em](){return __classPrivateFieldGet(this,Xp,`f`)}[Dm](){return __classPrivateFieldGet(this,$p,`f`)}[Om](){return!!__classPrivateFieldGet(this,Bp,`f`)}[km](){return __classPrivateFieldGet(this,Pp,`f`)}[Am](t,n,S,C){return S||isPromise(t)?t:(n||(t=this[em](t)),(this[sm]()[`parse-positional-numbers`]||this[sm]()[`parse-positional-numbers`]===void 0)&&(t=this[dm](t)),C&&(t=applyMiddleware(t,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!1)),t)}[Mm](t={}){__classPrivateFieldSet(this,Lp,__classPrivateFieldGet(this,Lp,`f`)||{},`f`);let n={};n.local=__classPrivateFieldGet(this,Lp,`f`).local||[],n.configObjects=__classPrivateFieldGet(this,Lp,`f`).configObjects||[];let S={};return n.local.forEach(n=>{S[n]=!0,(t[n]||[]).forEach(t=>{S[t]=!0})}),Object.assign(__classPrivateFieldGet(this,Up,`f`),Object.keys(__classPrivateFieldGet(this,jp,`f`)).reduce((t,n)=>{let C=__classPrivateFieldGet(this,jp,`f`)[n].filter(t=>!(t in S));return C.length>0&&(t[n]=C),t},{})),__classPrivateFieldSet(this,jp,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(t=>{n[t]=(__classPrivateFieldGet(this,Lp,`f`)[t]||[]).filter(t=>!S[t])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(t=>{n[t]=objFilter(__classPrivateFieldGet(this,Lp,`f`)[t],t=>!S[t])}),n.envPrefix=__classPrivateFieldGet(this,Lp,`f`).envPrefix,__classPrivateFieldSet(this,Lp,n,`f`),__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`)?__classPrivateFieldGet(this,Xp,`f`).reset(S):usage(this,__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldSet(this,$p,__classPrivateFieldGet(this,$p,`f`)?__classPrivateFieldGet(this,$p,`f`).reset(S):validation(this,__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldSet(this,yp,__classPrivateFieldGet(this,yp,`f`)?__classPrivateFieldGet(this,yp,`f`).reset():command(__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,$p,`f`),__classPrivateFieldGet(this,Ap,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldGet(this,Sp,`f`)||__classPrivateFieldSet(this,Sp,completion(this,__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,yp,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldGet(this,Ap,`f`).reset(),__classPrivateFieldSet(this,Cp,null,`f`),__classPrivateFieldSet(this,Ip,``,`f`),__classPrivateFieldSet(this,Tp,null,`f`),__classPrivateFieldSet(this,Mp,!1,`f`),this.parsed=!1,this}[jm](t,n){return __classPrivateFieldGet(this,Kp,`f`).path.relative(t,n)}[Nm](t,n,S,C=0,N=!1){let F=!!S||N;t||=__classPrivateFieldGet(this,Wp,`f`),__classPrivateFieldGet(this,Lp,`f`).__=__classPrivateFieldGet(this,Kp,`f`).y18n.__,__classPrivateFieldGet(this,Lp,`f`).configuration=this[sm]();let I=!!__classPrivateFieldGet(this,Lp,`f`).configuration[`populate--`],H=Object.assign({},__classPrivateFieldGet(this,Lp,`f`).configuration,{"populate--":!0}),W=__classPrivateFieldGet(this,Kp,`f`).Parser.detailed(t,Object.assign({},__classPrivateFieldGet(this,Lp,`f`),{configuration:{"parse-positional-numbers":!1,...H}})),q=Object.assign(W.argv,__classPrivateFieldGet(this,Vp,`f`)),Y,X=W.aliases,Z=!1,te=!1;Object.keys(q).forEach(t=>{t===__classPrivateFieldGet(this,Np,`f`)&&q[t]?Z=!0:t===__classPrivateFieldGet(this,Qp,`f`)&&q[t]&&(te=!0)}),q.$0=this.$0,this.parsed=W,C===0&&__classPrivateFieldGet(this,Xp,`f`).clearCachedHelpMessage();try{if(this[lm](),n)return this[Am](q,I,!!S,!1);__classPrivateFieldGet(this,Np,`f`)&&[__classPrivateFieldGet(this,Np,`f`)].concat(X[__classPrivateFieldGet(this,Np,`f`)]||[]).filter(t=>t.length>1).includes(``+q._[q._.length-1])&&(q._.pop(),Z=!0),__classPrivateFieldSet(this,Pp,!1,`f`);let H=__classPrivateFieldGet(this,yp,`f`).getCommands(),ne=__classPrivateFieldGet(this,Sp,`f`)?.completionKey?[__classPrivateFieldGet(this,Sp,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,Sp,`f`)?.completionKey]??[]].some(t=>Object.prototype.hasOwnProperty.call(q,t)):!1,re=Z||ne||N;if(q._.length){if(H.length){let t;for(let n=C||0,F;q._[n]!==void 0;n++)if(F=String(q._[n]),H.includes(F)&&F!==__classPrivateFieldGet(this,Cp,`f`)){let t=__classPrivateFieldGet(this,yp,`f`).runCommand(F,this,W,n+1,N,Z||te||N);return this[Am](t,I,!!S,!1)}else if(!t&&F!==__classPrivateFieldGet(this,Cp,`f`)){t=F;break}!__classPrivateFieldGet(this,yp,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,Gp,`f`)&&t&&!re&&__classPrivateFieldGet(this,$p,`f`).recommendCommands(t,H)}__classPrivateFieldGet(this,Cp,`f`)&&q._.includes(__classPrivateFieldGet(this,Cp,`f`))&&!ne&&(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,yp,`f`).hasDefaultCommand()&&!re){let t=__classPrivateFieldGet(this,yp,`f`).runCommand(null,this,W,0,N,Z||te||N);return this[Am](t,I,!!S,!1)}if(ne){__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),t=[].concat(t);let n=t.slice(t.indexOf(`--${__classPrivateFieldGet(this,Sp,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,Sp,`f`).getCompletion(n,(t,n)=>{if(t)throw new yl(t.message);(n||[]).forEach(t=>{__classPrivateFieldGet(this,Fp,`f`).log(t)}),this.exit(0)}),this[Am](q,!I,!!S,!1)}if(__classPrivateFieldGet(this,Mp,`f`)||(Z?(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),F=!0,this.showHelp(t=>{__classPrivateFieldGet(this,Fp,`f`).log(t),this.exit(0)})):te&&(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),F=!0,__classPrivateFieldGet(this,Xp,`f`).showVersion(`log`),this.exit(0))),!F&&__classPrivateFieldGet(this,Lp,`f`).skipValidation.length>0&&(F=Object.keys(q).some(t=>__classPrivateFieldGet(this,Lp,`f`).skipValidation.indexOf(t)>=0&&q[t]===!0)),!F){if(W.error)throw new yl(W.error.message);if(!ne){let t=this[Pm](X,{},W.error);S||(Y=applyMiddleware(q,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!0)),Y=this[bm](t,Y??q),isPromise(Y)&&!S&&(Y=Y.then(()=>applyMiddleware(q,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!1)))}}}catch(t){if(t instanceof yl)__classPrivateFieldGet(this,Xp,`f`).fail(t.message,t);else throw t}return this[Am](Y??q,I,!!S,!0)}[Pm](t,n,S,C){let N={...this.getDemandedOptions()};return F=>{if(S)throw new yl(S.message);__classPrivateFieldGet(this,$p,`f`).nonOptionCount(F),__classPrivateFieldGet(this,$p,`f`).requiredArguments(F,N);let I=!1;__classPrivateFieldGet(this,Jp,`f`)&&(I=__classPrivateFieldGet(this,$p,`f`).unknownCommands(F)),__classPrivateFieldGet(this,qp,`f`)&&!I?__classPrivateFieldGet(this,$p,`f`).unknownArguments(F,t,n,!!C):__classPrivateFieldGet(this,Yp,`f`)&&__classPrivateFieldGet(this,$p,`f`).unknownArguments(F,t,{},!1,!1),__classPrivateFieldGet(this,$p,`f`).limitedChoices(F),__classPrivateFieldGet(this,$p,`f`).implications(F),__classPrivateFieldGet(this,$p,`f`).conflicting(F)}}[Fm](){__classPrivateFieldSet(this,Mp,!0,`f`)}[Im](t){if(typeof t==`string`)__classPrivateFieldGet(this,Lp,`f`).key[t]=!0;else for(let n of t)__classPrivateFieldGet(this,Lp,`f`).key[n]=!0}}}),zm,Bm=__esmMin(()=>{Zf(),Rm(),zm=YargsFactory(Xf)});function classifyCliFailure(t,n){return typeof t==`string`&&t.length>0?{kind:`usage`,message:t}:{kind:`runtime`}}var Vm=__esmMin(()=>{});function buildHeaders(t,n){let S={"user-agent":`gjsify-install/0.64.0`,"accept-encoding":n.acceptEncoding??`identity`};if(n.npmrc){let C=resolveAuthForUrl(t,n.npmrc);C&&(S.authorization=C)}if(n.headers)for(let[t,C]of Object.entries(n.headers))S[t.toLowerCase()]=C;return S}function resolveAuthForUrl(t,n){let S=pathPrefixes(new URL(t));for(let t of S){let S=n.authTokens[t];if(S)return`Bearer ${S}`;let C=n.basicAuth[t];if(C)return`Basic ${btoa(`${C.username}:${C.password}`)}`}return null}function pathPrefixes(t){let n=t.pathname.split(`/`).filter(Boolean),S=[];for(let C=n.length;C>=0;C--){let N=n.slice(0,C).join(`/`);S.push(N?`//${t.host}/${N}`:`//${t.host}`)}return S}var Hm=__esmMin(()=>{}),PackageNotFoundError,IntegrityError,RegistryTimeoutError,RegistryUnreachableError,Um=__esmMin(()=>{PackageNotFoundError=class extends Error{name;url;constructor(t,n){super(`Package not found in registry: ${t} (${n})`),this.name=t,this.url=n,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(t,n){super(`Tarball integrity mismatch for ${t} (expected ${n})`),this.url=t,this.integrity=n,this.name=`IntegrityError`}},RegistryTimeoutError=class extends Error{url;timeoutMs;attempts;constructor(t,n,S){let C=Math.round(n/100)/10,N=Math.round(n*S/100)/10;super(`@gjsify/npm-registry: GET ${t} timed out after ${C}s × ${S} attempt(s) (total ~${N}s). This usually means the registry CDN is slow or unreachable.`),this.url=t,this.timeoutMs=n,this.attempts=S,this.name=`RegistryTimeoutError`}},RegistryUnreachableError=class extends Error{url;attempts;elapsedMs;constructor(t,n,S,C){let N=Math.round(S/100)/10,F=C instanceof Error?C.message:String(C);super(`@gjsify/npm-registry: GET ${t} failed after ${n} attempt(s) over ~${N}s: ${F}. This usually means the registry or the network dropped out.`),this.url=t,this.attempts=n,this.elapsedMs=S,this.name=`RegistryUnreachableError`,this.cause=C}}});function registryFor(t,n){if(n&&t.startsWith(`@`)){let S=t.slice(0,t.indexOf(`/`)),C=n.scopes[S];if(C)return ensureTrailingSlash$1(C)}return n?.registry?ensureTrailingSlash$1(n.registry):Wm}function parseNpmrc(t){let n={registry:Wm,scopes:{},authTokens:{},basicAuth:{}},S=t.split(/\r?\n/),C={};for(let t of S){let S=t.replace(/^\s+|\s+$/g,``);if(!S||S.startsWith(`#`)||S.startsWith(`;`))continue;let N=S.indexOf(`=`);if(N<0)continue;let F=S.slice(0,N).trim(),I=expandEnv(stripQuotes(S.slice(N+1).trim()));if(F===`registry`){n.registry=ensureTrailingSlash$1(I);continue}let H=F.match(/^(@[^:]+):registry$/);if(H){n.scopes[H[1]]=ensureTrailingSlash$1(I);continue}let W=F.match(/^\/\/(.+):_authToken$/);if(W){n.authTokens[normalizeAuthHost(W[1])]=I;continue}let q=F.match(/^\/\/(.+):username$/);if(q){(C[normalizeAuthHost(q[1])]??={}).user=I;continue}let Y=F.match(/^\/\/(.+):_password$/);if(Y){let t=base64Decode$1(I);(C[normalizeAuthHost(Y[1])]??={}).pass=t;continue}}for(let[t,S]of Object.entries(C))S.user&&S.pass!==void 0&&(n.basicAuth[t]={username:S.user,password:S.pass});return n}function normalizeAuthHost(t){return`//${t.replace(/\/+$/,``)}`}function ensureTrailingSlash$1(t){return t.endsWith(`/`)?t:t+`/`}function stripQuotes(t){return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function expandEnv(t){return t.replace(/\$\{([A-Z0-9_]+)\}/gi,(t,n)=>globalThis.process?.env?.[n]??``)}function base64Decode$1(t){return atob(t)}var Wm,Gm=__esmMin(()=>{Wm=`https://registry.npmjs.org/`,__name$1(ensureTrailingSlash$1,`ensureTrailingSlash`),__name$1(base64Decode$1,`base64Decode`)});async function fetchWithRetry(t,n,S){let C=S.fetch??globalThis.fetch;if(!C)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let N=Math.max(0,S.retries??5),F=Math.max(0,S.retryDelayMs??1e3),I=Math.max(0,S.timeoutMs??3e4),H=S.retryNotFound??!1,W=Date.now(),q=0,Y,X=0;for(;;){if(n.signal?.aborted)throw signalAbortError(n.signal);let Z=I>0?new AbortController:null,te=Z===null?null:setTimeout(()=>Z.abort(Error(`@gjsify/npm-registry: per-request timeout ${I}ms`)),I),ne=composeSignals(n.signal,Z?.signal);try{let F=await C(t,{...n,signal:ne}),I=isRetryableStatus(F.status)||H&&F.status===404;if(F.ok||!I||q>=N)return S.read?await S.read(F):F;try{await F.arrayBuffer()}catch{}Y=Error(`HTTP ${F.status} ${F.statusText}`)}catch(S){let C=Z!==null&&Z.signal.aborted,F=n.signal?.aborted===!0;if(C&&!F){if(X++,q>=N)throw new RegistryTimeoutError(t,I,X);Y=S}else if(F)throw signalAbortError(n.signal);else{if(!isRetryableError(S))throw S;if(q>=N)throw new RegistryUnreachableError(t,q+1,Date.now()-W,S);Y=S}}finally{te!==null&&clearTimeout(te)}let re=Math.min(F*2**q,8e3);S.onRetry?.({attempt:q+1,error:Y,delayMs:re}),await delay$1(re,n.signal),q++}}function composeSignals(t,n){return t?n?AbortSignal.any([t,n]):t:n}function isRetryableStatus(t){return t===408||t===425||t===429||t===500||t===502||t===503||t===504||t===521||t===522||t===524||t===525}function isRetryableError(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return!1;if(t instanceof TypeError)return!0;if(t&&typeof t==`object`&&`name`in t){let n=t.name;if(n===`FetchError`)return!0;if(n===`AbortError`)return!1}let n=t?.cause;if(n&&typeof n==`object`&&`code`in n){let t=n.code;if(typeof t==`string`)return t===`ECONNRESET`||t===`ECONNREFUSED`||t===`ENETUNREACH`||t===`ENOTFOUND`||t===`ETIMEDOUT`||t===`EAI_AGAIN`||t===`UND_ERR_SOCKET`||t===`UND_ERR_CONNECT_TIMEOUT`}return!1}function delay$1(t,n){return t<=0?Promise.resolve():new Promise((S,C)=>{let N=setTimeout(()=>{n?.removeEventListener?.(`abort`,onAbort),S()},t),onAbort=()=>{clearTimeout(N),C(signalAbortError(n))};if(n?.aborted){clearTimeout(N),C(signalAbortError(n));return}n?.addEventListener?.(`abort`,onAbort,{once:!0})})}function signalAbortError(t){let n=t&&`reason`in t?t.reason:void 0;if(n instanceof Error)return n;let S=Error(`Aborted`);return S.name=`AbortError`,S}var Km=__esmMin(()=>{Um(),__name$1(delay$1,`delay`)});async function verifyIntegrity(t,n){let S=n.trim().split(/\s+/);for(let n of S){let S=n.indexOf(`-`);if(S<0)continue;let C=n.slice(0,S).toLowerCase(),N=n.slice(S+1),F=globalThis.crypto?.subtle;if(!F)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let I=subriToWebCryptoAlgo(C);if(!I)continue;let H=await F.digest(I,dataAsArrayBuffer(t));if(bytesToBase64(new Uint8Array(H))===N)return!0}return!1}function subriToWebCryptoAlgo(t){switch(t){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(t){if(t.byteOffset===0&&t.byteLength===t.buffer.byteLength)return t.buffer;let n=new Uint8Array(t.byteLength);return n.set(t),n.buffer}function bytesToBase64(t){let n=``;for(let S=0;S<t.length;S++)n+=String.fromCharCode(t[S]);return btoa(n)}var qm=__esmMin(()=>{});function assertPackument(t,n){if(!n||typeof n!=`object`)throw TypeError(`registry: ${t} packument is not an object`);let S=n;if(typeof S.name!=`string`)throw TypeError(`registry: ${t} packument missing string name`);if(!S.versions||typeof S.versions!=`object`)throw TypeError(`registry: ${t} packument missing versions map`)}function packumentUrl(t,n){let S=ensureTrailingSlash$1(n);if(t.startsWith(`@`)){let n=t.indexOf(`/`);if(n<0)throw TypeError(`Invalid scoped package name: ${t}`);let C=t.slice(0,n),N=t.slice(n+1);return`${S}${encodeURIComponent(C)}/${encodeURIComponent(N)}`}return`${S}${encodeURIComponent(t)}`}async function fetchPackumentConditional(t,n={}){let S=packumentUrl(t,n.registry??registryFor(t,n.npmrc)),C=buildHeaders(S,{...n,acceptEncoding:`gzip`});C.accept??=n.fullMetadata?`application/json`:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`,n.ifNoneMatch&&(C[`if-none-match`]=n.ifNoneMatch);let N=await fetchWithRetry(S,{headers:C,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,read:async n=>{if(n.status===304){try{await n.arrayBuffer()}catch{}return{status:`not-modified`}}if(!n.ok)throw n.status===404||n.status===406?new PackageNotFoundError(t,S):Error(`registry GET ${S} -> ${n.status} ${n.statusText}`);return{status:`fresh`,body:await decodeJsonBody(n),etag:n.headers.get(`etag`)??void 0}}});if(N.status===`not-modified`)return{status:`not-modified`,etag:n.ifNoneMatch};let F=N.body;return assertPackument(t,F),{status:`fresh`,packument:F,etag:N.etag}}async function decodeJsonBody(t){return t.json()}async function fetchPackument(t,n={}){let S=await fetchPackumentConditional(t,n);if(!S.packument)throw Error(`registry: ${t} returned 304 Not Modified to an unconditional request`);return S.packument}var Jm=__esmMin(()=>{Hm(),Um(),Gm(),Km()});async function fetchTarball(t,n={}){let S=buildHeaders(t,{...n,acceptEncoding:`identity`});S.accept??=`application/octet-stream`;let C=await fetchWithRetry(t,{headers:S,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,retryNotFound:n.retryNotFound??!0,read:async n=>{if(!n.ok)throw Error(`tarball GET ${t} -> ${n.status} ${n.statusText}`);return new Uint8Array(await n.arrayBuffer())}});if(n.integrity&&!await verifyIntegrity(C,n.integrity))throw new IntegrityError(t,n.integrity);return C}var Ym=__esmMin(()=>{Hm(),Um(),Km(),qm()});async function whoami(t,n){let S=`${ensureTrailingSlash$1(t)}-/whoami`,C=buildHeaders(S,{npmrc:n});C.accept=`application/json`;let N=globalThis.fetch;if(!N)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let F=await N(S,{method:`GET`,headers:C});if(!F.ok)throw Error(`whoami GET ${S} -> ${F.status} ${F.statusText}`);let I=await F.json();if(I&&typeof I==`object`&&`username`in I){let t=I.username;if(typeof t==`string`&&t.length>0)return{username:t}}return{}}var Xm=__esmMin(()=>{Hm(),Gm()}),Zm=__esmMin(()=>{Hm(),Um(),Gm(),qm(),Jm(),Ym(),Xm()});function escapePackageName(t){return t.replace(`/`,`%2f`)}function buildPublishHeaders(t,n){let S=buildHeaders(t,{npmrc:n.npmrc});return S[`content-type`]=`application/json`,S[`npm-command`]=`publish`,S[`npm-auth-type`]=n.otp?`legacy`:`web`,S[`user-agent`]=n.userAgent??defaultUserAgent(),n.otp&&(S[`npm-otp`]=n.otp),n.authorization&&(S.authorization=n.authorization),S}function cliVersion(){return Qm===void 0&&(Qm=`0.64.0`),Qm}function cliPackageDir(){let t=globalThis.process?.env?.GJSIFY_CLI_PACKAGE_JSON,n;try{n=wn(t||fileURLToPath(import.meta.url))}catch{return null}for(let t=0;t<12;t++){try{if(JSON.parse(readFileSync(`${n}/package.json`,`utf8`)).name===`@gjsify/cli`)return n}catch{}let t=wn(n);if(t===n)break;n=t}return null}function defaultUserAgent(){let t=globalThis.process,n=t?.arch??`x64`,S=t?.platform??`linux`;return`gjsify-publish/${cliVersion()} (${S} ${n})`}var Qm,$m=__esmMin(()=>{Fd(),jn(),Hn(),Zm()}),eh,th=__esmMin(()=>{eh=`gjsify`});function parseDeclaredChannel(t,n){if(!(t===void 0||t===``)){if(nh.includes(t))return t;throw Error(`${n}: "${String(t)}" is not a distribution channel. Known: ${nh.join(`, `)}.`)}}function channelAllowsDonations(t){return t!==void 0&&rh[t]===!0}var nh,rh,ih,ah=__esmMin(()=>{nh=[`flathub`,`web`,`microsoft-store`,`apple-app-store`],rh={flathub:!0,web:!0,"microsoft-store":!1,"apple-app-store":!1},ih=`GJSIFY_CHANNEL`}),oh=__commonJSMin(((t,n)=>{let S=(jn(),__toCommonJS(gn)),C=(Nl(),__toCommonJS(kl)),N=(Fd(),__toCommonJS(Nd)),resolveFrom=(t,n,F)=>{if(typeof t!=`string`)throw TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof t}\``);if(typeof n!=`string`)throw TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof n}\``);try{t=N.realpathSync(t)}catch(n){if(n.code===`ENOENT`)t=S.resolve(t);else if(F)return null;else throw n}let I=S.join(t,`noop.js`),resolveFileName=()=>C._resolveFilename(n,{id:I,filename:I,paths:C._nodeModulePaths(t)});if(F)try{return resolveFileName()}catch{return null}return resolveFileName()};n.exports=(t,n)=>resolveFrom(t,n),n.exports.silent=(t,n)=>resolveFrom(t,n,!0)})),sh=__commonJSMin(((t,n)=>{let callsites=()=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=(t,n)=>n;let n=Error().stack.slice(1);return Error.prepareStackTrace=t,n};n.exports=callsites,n.exports.default=callsites})),ch=__commonJSMin(((t,n)=>{let S=sh();n.exports=t=>{let n=S();if(!t)return n[2].getFileName();let C=!1;n.shift();for(let S of n){let n=S.getFileName();if(typeof n==`string`){if(n===t){C=!0;continue}if(n!==`module.js`&&C&&n!==t)return n}}}})),lh=__commonJSMin(((t,n)=>{var{__gjsifyModuleDir:S,__gjsifyModuleFile:C}=(Ll(),__toCommonJS(Pl)),N=S(`import-fresh/index.js`),F=C(`import-fresh/index.js`);let I=(jn(),__toCommonJS(gn)),H=oh(),W=ch();n.exports=t=>{if(typeof t!=`string`)throw TypeError(`Expected a string`);let n=W(F),S=n?I.dirname(n):N,C=H(S,t),q=Y.cache[C];if(q&&q.parent){let t=q.parent.children.length;for(;t--;)q.parent.children[t].id===C&&q.parent.children.splice(t,1)}delete Y.cache[C];let X=Y.cache[n];return X===void 0||X.require===void 0?Y(C):X.require(C)}})),uh=__commonJSMin(((t,n)=>{n.exports=function isArrayish(t){return t?t instanceof Array||Array.isArray(t)||t.length>=0&&t.splice instanceof Function:!1}})),dh=__commonJSMin(((t,n)=>{var S=(Su(),__toCommonJS(vu)),C=uh(),N=function errorEx(t,n){(!t||t.constructor!==String)&&(n=t||{},t=Error.name);var N=function ErrorEXError(S){if(!this)return new ErrorEXError(S);S=S instanceof Error?S.message:S||this.message,Error.call(this,S),Error.captureStackTrace(this,N),this.name=t,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var t=S.split(/\r?\n/g);for(var N in n)if(n.hasOwnProperty(N)){var F=n[N];`message`in F&&(t=F.message(this[N],t)||t,C(t)||(t=[t]))}return t.join(`
|
|
148
|
+
`,`f`),__classPrivateFieldSet(this,Ip,__classPrivateFieldGet(this,Ip,`f`)+t.join(` `),`f`)}}}[nm](t){objectKeys(__classPrivateFieldGet(this,Lp,`f`)).forEach(n=>{if((t=>t===`configObjects`)(n))return;let S=__classPrivateFieldGet(this,Lp,`f`)[n];Array.isArray(S)?S.includes(t)&&S.splice(S.indexOf(t),1):typeof S==`object`&&delete S[t]}),delete __classPrivateFieldGet(this,Xp,`f`).getDescriptions()[t]}[im](t,n,S){__classPrivateFieldGet(this,Dp,`f`)[S]||(__classPrivateFieldGet(this,Kp,`f`).process.emitWarning(t,n),__classPrivateFieldGet(this,Dp,`f`)[S]=!0)}[am](){__classPrivateFieldGet(this,kp,`f`).push({options:__classPrivateFieldGet(this,Lp,`f`),configObjects:__classPrivateFieldGet(this,Lp,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,Op,`f`),groups:__classPrivateFieldGet(this,jp,`f`),strict:__classPrivateFieldGet(this,qp,`f`),strictCommands:__classPrivateFieldGet(this,Jp,`f`),strictOptions:__classPrivateFieldGet(this,Yp,`f`),completionCommand:__classPrivateFieldGet(this,Cp,`f`),output:__classPrivateFieldGet(this,Ip,`f`),exitError:__classPrivateFieldGet(this,Tp,`f`),hasOutput:__classPrivateFieldGet(this,Mp,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,Bp,`f`),parseContext:__classPrivateFieldGet(this,Vp,`f`)}),__classPrivateFieldGet(this,Xp,`f`).freeze(),__classPrivateFieldGet(this,$p,`f`).freeze(),__classPrivateFieldGet(this,yp,`f`).freeze(),__classPrivateFieldGet(this,Ap,`f`).freeze()}[om](){let t=``,n;return n=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,Kp,`f`).process.argv()[0])?__classPrivateFieldGet(this,Kp,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,Kp,`f`).process.argv().slice(0,1),t=n.map(t=>{let n=this[jm](__classPrivateFieldGet(this,bp,`f`),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&n.length<t.length?n:t}).join(` `).trim(),__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,Kp,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`)&&(t=__classPrivateFieldGet(this,Kp,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,Kp,`f`).path.dirname(__classPrivateFieldGet(this,Kp,`f`).process.execPath())}/`,``)),t}[sm](){return __classPrivateFieldGet(this,zp,`f`)}[cm](){return __classPrivateFieldGet(this,Zp,`f`)}[lm](){if(!__classPrivateFieldGet(this,Ep,`f`))return;let t=__classPrivateFieldGet(this,Kp,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,Kp,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(t.replace(/[.:].*/,``))}[um](){return this[fm]().version||`unknown`}[dm](t){let n=t[`--`]?t[`--`]:t._;for(let t=0,S;(S=n[t])!==void 0;t++)__classPrivateFieldGet(this,Kp,`f`).Parser.looksLikeNumber(S)&&Number.isSafeInteger(Math.floor(parseFloat(`${S}`)))&&(n[t]=Number(S));return t}[fm](t){let n=t||`*`;if(__classPrivateFieldGet(this,Hp,`f`)[n])return __classPrivateFieldGet(this,Hp,`f`)[n];let S={};try{let n=t||__classPrivateFieldGet(this,Kp,`f`).mainFilename;__classPrivateFieldGet(this,Kp,`f`).path.extname(n)&&(n=__classPrivateFieldGet(this,Kp,`f`).path.dirname(n));let C=__classPrivateFieldGet(this,Kp,`f`).findUp(n,(t,n)=>{if(n.includes(`package.json`))return`package.json`});assertNotStrictEqual(C,void 0,__classPrivateFieldGet(this,Kp,`f`)),S=JSON.parse(__classPrivateFieldGet(this,Kp,`f`).readFileSync(C,`utf8`))}catch{}return __classPrivateFieldGet(this,Hp,`f`)[n]=S||{},__classPrivateFieldGet(this,Hp,`f`)[n]}[pm](t,n){n=[].concat(n),n.forEach(n=>{n=this[_m](n),__classPrivateFieldGet(this,Lp,`f`)[t].push(n)})}[mm](t,n,S,C){this[gm](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Lp,`f`)[t][n]=S})}[hm](t,n,S,C){this[gm](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Lp,`f`)[t][n]=(__classPrivateFieldGet(this,Lp,`f`)[t][n]||[]).concat(S)})}[gm](t,n,S,C,N){if(Array.isArray(S))S.forEach(n=>{t(n,C)});else if((t=>typeof t==`object`)(S))for(let n of objectKeys(S))t(n,S[n]);else N(n,this[_m](S),C)}[_m](t){return t===`__proto__`?`___proto___`:t}[vm](t,n){return this[mm](this[vm].bind(this),`key`,t,n),this}[ym](){var t,n,S,C,N,F,I,H,W,q,Y,X;let Z=__classPrivateFieldGet(this,kp,`f`).pop();assertNotStrictEqual(Z,void 0,__classPrivateFieldGet(this,Kp,`f`));let te;t=this,n=this,S=this,C=this,N=this,F=this,I=this,H=this,W=this,q=this,Y=this,X=this,{options:{set value(n){__classPrivateFieldSet(t,Lp,n,`f`)}}.value,configObjects:te,exitProcess:{set value(t){__classPrivateFieldSet(n,Op,t,`f`)}}.value,groups:{set value(t){__classPrivateFieldSet(S,jp,t,`f`)}}.value,output:{set value(t){__classPrivateFieldSet(C,Ip,t,`f`)}}.value,exitError:{set value(t){__classPrivateFieldSet(N,Tp,t,`f`)}}.value,hasOutput:{set value(t){__classPrivateFieldSet(F,Mp,t,`f`)}}.value,parsed:this.parsed,strict:{set value(t){__classPrivateFieldSet(I,qp,t,`f`)}}.value,strictCommands:{set value(t){__classPrivateFieldSet(H,Jp,t,`f`)}}.value,strictOptions:{set value(t){__classPrivateFieldSet(W,Yp,t,`f`)}}.value,completionCommand:{set value(t){__classPrivateFieldSet(q,Cp,t,`f`)}}.value,parseFn:{set value(t){__classPrivateFieldSet(Y,Bp,t,`f`)}}.value,parseContext:{set value(t){__classPrivateFieldSet(X,Vp,t,`f`)}}.value}=Z,__classPrivateFieldGet(this,Lp,`f`).configObjects=te,__classPrivateFieldGet(this,Xp,`f`).unfreeze(),__classPrivateFieldGet(this,$p,`f`).unfreeze(),__classPrivateFieldGet(this,yp,`f`).unfreeze(),__classPrivateFieldGet(this,Ap,`f`).unfreeze()}[bm](t,n){return maybeAsyncResult(n,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[xm].bind(this),getContext:this[Sm].bind(this),getHasOutput:this[Cm].bind(this),getLoggerInstance:this[wm].bind(this),getParseContext:this[Tm].bind(this),getParserConfiguration:this[sm].bind(this),getUsageConfiguration:this[cm].bind(this),getUsageInstance:this[Em].bind(this),getValidationInstance:this[Dm].bind(this),hasParseCallback:this[Om].bind(this),isGlobalContext:this[km].bind(this),postProcess:this[Am].bind(this),reset:this[Mm].bind(this),runValidation:this[Pm].bind(this),runYargsParserAndExecuteCommands:this[Nm].bind(this),setHasOutput:this[Fm].bind(this)}}[xm](){return __classPrivateFieldGet(this,yp,`f`)}[Sm](){return __classPrivateFieldGet(this,xp,`f`)}[Cm](){return __classPrivateFieldGet(this,Mp,`f`)}[wm](){return __classPrivateFieldGet(this,Fp,`f`)}[Tm](){return __classPrivateFieldGet(this,Vp,`f`)||{}}[Em](){return __classPrivateFieldGet(this,Xp,`f`)}[Dm](){return __classPrivateFieldGet(this,$p,`f`)}[Om](){return!!__classPrivateFieldGet(this,Bp,`f`)}[km](){return __classPrivateFieldGet(this,Pp,`f`)}[Am](t,n,S,C){return S||isPromise(t)?t:(n||(t=this[em](t)),(this[sm]()[`parse-positional-numbers`]||this[sm]()[`parse-positional-numbers`]===void 0)&&(t=this[dm](t)),C&&(t=applyMiddleware(t,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!1)),t)}[Mm](t={}){__classPrivateFieldSet(this,Lp,__classPrivateFieldGet(this,Lp,`f`)||{},`f`);let n={};n.local=__classPrivateFieldGet(this,Lp,`f`).local||[],n.configObjects=__classPrivateFieldGet(this,Lp,`f`).configObjects||[];let S={};return n.local.forEach(n=>{S[n]=!0,(t[n]||[]).forEach(t=>{S[t]=!0})}),Object.assign(__classPrivateFieldGet(this,Up,`f`),Object.keys(__classPrivateFieldGet(this,jp,`f`)).reduce((t,n)=>{let C=__classPrivateFieldGet(this,jp,`f`)[n].filter(t=>!(t in S));return C.length>0&&(t[n]=C),t},{})),__classPrivateFieldSet(this,jp,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(t=>{n[t]=(__classPrivateFieldGet(this,Lp,`f`)[t]||[]).filter(t=>!S[t])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(t=>{n[t]=objFilter(__classPrivateFieldGet(this,Lp,`f`)[t],t=>!S[t])}),n.envPrefix=__classPrivateFieldGet(this,Lp,`f`).envPrefix,__classPrivateFieldSet(this,Lp,n,`f`),__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`)?__classPrivateFieldGet(this,Xp,`f`).reset(S):usage(this,__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldSet(this,$p,__classPrivateFieldGet(this,$p,`f`)?__classPrivateFieldGet(this,$p,`f`).reset(S):validation(this,__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldSet(this,yp,__classPrivateFieldGet(this,yp,`f`)?__classPrivateFieldGet(this,yp,`f`).reset():command(__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,$p,`f`),__classPrivateFieldGet(this,Ap,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldGet(this,Sp,`f`)||__classPrivateFieldSet(this,Sp,completion(this,__classPrivateFieldGet(this,Xp,`f`),__classPrivateFieldGet(this,yp,`f`),__classPrivateFieldGet(this,Kp,`f`)),`f`),__classPrivateFieldGet(this,Ap,`f`).reset(),__classPrivateFieldSet(this,Cp,null,`f`),__classPrivateFieldSet(this,Ip,``,`f`),__classPrivateFieldSet(this,Tp,null,`f`),__classPrivateFieldSet(this,Mp,!1,`f`),this.parsed=!1,this}[jm](t,n){return __classPrivateFieldGet(this,Kp,`f`).path.relative(t,n)}[Nm](t,n,S,C=0,N=!1){let F=!!S||N;t||=__classPrivateFieldGet(this,Wp,`f`),__classPrivateFieldGet(this,Lp,`f`).__=__classPrivateFieldGet(this,Kp,`f`).y18n.__,__classPrivateFieldGet(this,Lp,`f`).configuration=this[sm]();let I=!!__classPrivateFieldGet(this,Lp,`f`).configuration[`populate--`],H=Object.assign({},__classPrivateFieldGet(this,Lp,`f`).configuration,{"populate--":!0}),W=__classPrivateFieldGet(this,Kp,`f`).Parser.detailed(t,Object.assign({},__classPrivateFieldGet(this,Lp,`f`),{configuration:{"parse-positional-numbers":!1,...H}})),q=Object.assign(W.argv,__classPrivateFieldGet(this,Vp,`f`)),Y,X=W.aliases,Z=!1,te=!1;Object.keys(q).forEach(t=>{t===__classPrivateFieldGet(this,Np,`f`)&&q[t]?Z=!0:t===__classPrivateFieldGet(this,Qp,`f`)&&q[t]&&(te=!0)}),q.$0=this.$0,this.parsed=W,C===0&&__classPrivateFieldGet(this,Xp,`f`).clearCachedHelpMessage();try{if(this[lm](),n)return this[Am](q,I,!!S,!1);__classPrivateFieldGet(this,Np,`f`)&&[__classPrivateFieldGet(this,Np,`f`)].concat(X[__classPrivateFieldGet(this,Np,`f`)]||[]).filter(t=>t.length>1).includes(``+q._[q._.length-1])&&(q._.pop(),Z=!0),__classPrivateFieldSet(this,Pp,!1,`f`);let H=__classPrivateFieldGet(this,yp,`f`).getCommands(),ne=__classPrivateFieldGet(this,Sp,`f`)?.completionKey?[__classPrivateFieldGet(this,Sp,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,Sp,`f`)?.completionKey]??[]].some(t=>Object.prototype.hasOwnProperty.call(q,t)):!1,re=Z||ne||N;if(q._.length){if(H.length){let t;for(let n=C||0,F;q._[n]!==void 0;n++)if(F=String(q._[n]),H.includes(F)&&F!==__classPrivateFieldGet(this,Cp,`f`)){let t=__classPrivateFieldGet(this,yp,`f`).runCommand(F,this,W,n+1,N,Z||te||N);return this[Am](t,I,!!S,!1)}else if(!t&&F!==__classPrivateFieldGet(this,Cp,`f`)){t=F;break}!__classPrivateFieldGet(this,yp,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,Gp,`f`)&&t&&!re&&__classPrivateFieldGet(this,$p,`f`).recommendCommands(t,H)}__classPrivateFieldGet(this,Cp,`f`)&&q._.includes(__classPrivateFieldGet(this,Cp,`f`))&&!ne&&(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,yp,`f`).hasDefaultCommand()&&!re){let t=__classPrivateFieldGet(this,yp,`f`).runCommand(null,this,W,0,N,Z||te||N);return this[Am](t,I,!!S,!1)}if(ne){__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),t=[].concat(t);let n=t.slice(t.indexOf(`--${__classPrivateFieldGet(this,Sp,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,Sp,`f`).getCompletion(n,(t,n)=>{if(t)throw new yl(t.message);(n||[]).forEach(t=>{__classPrivateFieldGet(this,Fp,`f`).log(t)}),this.exit(0)}),this[Am](q,!I,!!S,!1)}if(__classPrivateFieldGet(this,Mp,`f`)||(Z?(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),F=!0,this.showHelp(t=>{__classPrivateFieldGet(this,Fp,`f`).log(t),this.exit(0)})):te&&(__classPrivateFieldGet(this,Op,`f`)&&setBlocking(!0),F=!0,__classPrivateFieldGet(this,Xp,`f`).showVersion(`log`),this.exit(0))),!F&&__classPrivateFieldGet(this,Lp,`f`).skipValidation.length>0&&(F=Object.keys(q).some(t=>__classPrivateFieldGet(this,Lp,`f`).skipValidation.indexOf(t)>=0&&q[t]===!0)),!F){if(W.error)throw new yl(W.error.message);if(!ne){let t=this[Pm](X,{},W.error);S||(Y=applyMiddleware(q,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!0)),Y=this[bm](t,Y??q),isPromise(Y)&&!S&&(Y=Y.then(()=>applyMiddleware(q,this,__classPrivateFieldGet(this,Ap,`f`).getMiddleware(),!1)))}}}catch(t){if(t instanceof yl)__classPrivateFieldGet(this,Xp,`f`).fail(t.message,t);else throw t}return this[Am](Y??q,I,!!S,!0)}[Pm](t,n,S,C){let N={...this.getDemandedOptions()};return F=>{if(S)throw new yl(S.message);__classPrivateFieldGet(this,$p,`f`).nonOptionCount(F),__classPrivateFieldGet(this,$p,`f`).requiredArguments(F,N);let I=!1;__classPrivateFieldGet(this,Jp,`f`)&&(I=__classPrivateFieldGet(this,$p,`f`).unknownCommands(F)),__classPrivateFieldGet(this,qp,`f`)&&!I?__classPrivateFieldGet(this,$p,`f`).unknownArguments(F,t,n,!!C):__classPrivateFieldGet(this,Yp,`f`)&&__classPrivateFieldGet(this,$p,`f`).unknownArguments(F,t,{},!1,!1),__classPrivateFieldGet(this,$p,`f`).limitedChoices(F),__classPrivateFieldGet(this,$p,`f`).implications(F),__classPrivateFieldGet(this,$p,`f`).conflicting(F)}}[Fm](){__classPrivateFieldSet(this,Mp,!0,`f`)}[Im](t){if(typeof t==`string`)__classPrivateFieldGet(this,Lp,`f`).key[t]=!0;else for(let n of t)__classPrivateFieldGet(this,Lp,`f`).key[n]=!0}}}),zm,Bm=__esmMin(()=>{Zf(),Rm(),zm=YargsFactory(Xf)});function classifyCliFailure(t,n){return typeof t==`string`&&t.length>0?{kind:`usage`,message:t}:{kind:`runtime`}}var Vm=__esmMin(()=>{});function buildHeaders(t,n){let S={"user-agent":`gjsify-install/0.64.1-next.240`,"accept-encoding":n.acceptEncoding??`identity`};if(n.npmrc){let C=resolveAuthForUrl(t,n.npmrc);C&&(S.authorization=C)}if(n.headers)for(let[t,C]of Object.entries(n.headers))S[t.toLowerCase()]=C;return S}function resolveAuthForUrl(t,n){let S=pathPrefixes(new URL(t));for(let t of S){let S=n.authTokens[t];if(S)return`Bearer ${S}`;let C=n.basicAuth[t];if(C)return`Basic ${btoa(`${C.username}:${C.password}`)}`}return null}function pathPrefixes(t){let n=t.pathname.split(`/`).filter(Boolean),S=[];for(let C=n.length;C>=0;C--){let N=n.slice(0,C).join(`/`);S.push(N?`//${t.host}/${N}`:`//${t.host}`)}return S}var Hm=__esmMin(()=>{}),PackageNotFoundError,IntegrityError,RegistryTimeoutError,RegistryUnreachableError,Um=__esmMin(()=>{PackageNotFoundError=class extends Error{name;url;constructor(t,n){super(`Package not found in registry: ${t} (${n})`),this.name=t,this.url=n,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(t,n){super(`Tarball integrity mismatch for ${t} (expected ${n})`),this.url=t,this.integrity=n,this.name=`IntegrityError`}},RegistryTimeoutError=class extends Error{url;timeoutMs;attempts;constructor(t,n,S){let C=Math.round(n/100)/10,N=Math.round(n*S/100)/10;super(`@gjsify/npm-registry: GET ${t} timed out after ${C}s × ${S} attempt(s) (total ~${N}s). This usually means the registry CDN is slow or unreachable.`),this.url=t,this.timeoutMs=n,this.attempts=S,this.name=`RegistryTimeoutError`}},RegistryUnreachableError=class extends Error{url;attempts;elapsedMs;constructor(t,n,S,C){let N=Math.round(S/100)/10,F=C instanceof Error?C.message:String(C);super(`@gjsify/npm-registry: GET ${t} failed after ${n} attempt(s) over ~${N}s: ${F}. This usually means the registry or the network dropped out.`),this.url=t,this.attempts=n,this.elapsedMs=S,this.name=`RegistryUnreachableError`,this.cause=C}}});function registryFor(t,n){if(n&&t.startsWith(`@`)){let S=t.slice(0,t.indexOf(`/`)),C=n.scopes[S];if(C)return ensureTrailingSlash$1(C)}return n?.registry?ensureTrailingSlash$1(n.registry):Wm}function parseNpmrc(t){let n={registry:Wm,scopes:{},authTokens:{},basicAuth:{}},S=t.split(/\r?\n/),C={};for(let t of S){let S=t.replace(/^\s+|\s+$/g,``);if(!S||S.startsWith(`#`)||S.startsWith(`;`))continue;let N=S.indexOf(`=`);if(N<0)continue;let F=S.slice(0,N).trim(),I=expandEnv(stripQuotes(S.slice(N+1).trim()));if(F===`registry`){n.registry=ensureTrailingSlash$1(I);continue}let H=F.match(/^(@[^:]+):registry$/);if(H){n.scopes[H[1]]=ensureTrailingSlash$1(I);continue}let W=F.match(/^\/\/(.+):_authToken$/);if(W){n.authTokens[normalizeAuthHost(W[1])]=I;continue}let q=F.match(/^\/\/(.+):username$/);if(q){(C[normalizeAuthHost(q[1])]??={}).user=I;continue}let Y=F.match(/^\/\/(.+):_password$/);if(Y){let t=base64Decode$1(I);(C[normalizeAuthHost(Y[1])]??={}).pass=t;continue}}for(let[t,S]of Object.entries(C))S.user&&S.pass!==void 0&&(n.basicAuth[t]={username:S.user,password:S.pass});return n}function normalizeAuthHost(t){return`//${t.replace(/\/+$/,``)}`}function ensureTrailingSlash$1(t){return t.endsWith(`/`)?t:t+`/`}function stripQuotes(t){return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function expandEnv(t){return t.replace(/\$\{([A-Z0-9_]+)\}/gi,(t,n)=>globalThis.process?.env?.[n]??``)}function base64Decode$1(t){return atob(t)}var Wm,Gm=__esmMin(()=>{Wm=`https://registry.npmjs.org/`,__name$1(ensureTrailingSlash$1,`ensureTrailingSlash`),__name$1(base64Decode$1,`base64Decode`)});async function fetchWithRetry(t,n,S){let C=S.fetch??globalThis.fetch;if(!C)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let N=Math.max(0,S.retries??5),F=Math.max(0,S.retryDelayMs??1e3),I=Math.max(0,S.timeoutMs??3e4),H=S.retryNotFound??!1,W=Date.now(),q=0,Y,X=0;for(;;){if(n.signal?.aborted)throw signalAbortError(n.signal);let Z=I>0?new AbortController:null,te=Z===null?null:setTimeout(()=>Z.abort(Error(`@gjsify/npm-registry: per-request timeout ${I}ms`)),I),ne=composeSignals(n.signal,Z?.signal);try{let F=await C(t,{...n,signal:ne}),I=isRetryableStatus(F.status)||H&&F.status===404;if(F.ok||!I||q>=N)return S.read?await S.read(F):F;try{await F.arrayBuffer()}catch{}Y=Error(`HTTP ${F.status} ${F.statusText}`)}catch(S){let C=Z!==null&&Z.signal.aborted,F=n.signal?.aborted===!0;if(C&&!F){if(X++,q>=N)throw new RegistryTimeoutError(t,I,X);Y=S}else if(F)throw signalAbortError(n.signal);else{if(!isRetryableError(S))throw S;if(q>=N)throw new RegistryUnreachableError(t,q+1,Date.now()-W,S);Y=S}}finally{te!==null&&clearTimeout(te)}let re=Math.min(F*2**q,8e3);S.onRetry?.({attempt:q+1,error:Y,delayMs:re}),await delay$1(re,n.signal),q++}}function composeSignals(t,n){return t?n?AbortSignal.any([t,n]):t:n}function isRetryableStatus(t){return t===408||t===425||t===429||t===500||t===502||t===503||t===504||t===521||t===522||t===524||t===525}function isRetryableError(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return!1;if(t instanceof TypeError)return!0;if(t&&typeof t==`object`&&`name`in t){let n=t.name;if(n===`FetchError`)return!0;if(n===`AbortError`)return!1}let n=t?.cause;if(n&&typeof n==`object`&&`code`in n){let t=n.code;if(typeof t==`string`)return t===`ECONNRESET`||t===`ECONNREFUSED`||t===`ENETUNREACH`||t===`ENOTFOUND`||t===`ETIMEDOUT`||t===`EAI_AGAIN`||t===`UND_ERR_SOCKET`||t===`UND_ERR_CONNECT_TIMEOUT`}return!1}function delay$1(t,n){return t<=0?Promise.resolve():new Promise((S,C)=>{let N=setTimeout(()=>{n?.removeEventListener?.(`abort`,onAbort),S()},t),onAbort=()=>{clearTimeout(N),C(signalAbortError(n))};if(n?.aborted){clearTimeout(N),C(signalAbortError(n));return}n?.addEventListener?.(`abort`,onAbort,{once:!0})})}function signalAbortError(t){let n=t&&`reason`in t?t.reason:void 0;if(n instanceof Error)return n;let S=Error(`Aborted`);return S.name=`AbortError`,S}var Km=__esmMin(()=>{Um(),__name$1(delay$1,`delay`)});async function verifyIntegrity(t,n){let S=n.trim().split(/\s+/);for(let n of S){let S=n.indexOf(`-`);if(S<0)continue;let C=n.slice(0,S).toLowerCase(),N=n.slice(S+1),F=globalThis.crypto?.subtle;if(!F)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let I=subriToWebCryptoAlgo(C);if(!I)continue;let H=await F.digest(I,dataAsArrayBuffer(t));if(bytesToBase64(new Uint8Array(H))===N)return!0}return!1}function subriToWebCryptoAlgo(t){switch(t){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(t){if(t.byteOffset===0&&t.byteLength===t.buffer.byteLength)return t.buffer;let n=new Uint8Array(t.byteLength);return n.set(t),n.buffer}function bytesToBase64(t){let n=``;for(let S=0;S<t.length;S++)n+=String.fromCharCode(t[S]);return btoa(n)}var qm=__esmMin(()=>{});function assertPackument(t,n){if(!n||typeof n!=`object`)throw TypeError(`registry: ${t} packument is not an object`);let S=n;if(typeof S.name!=`string`)throw TypeError(`registry: ${t} packument missing string name`);if(!S.versions||typeof S.versions!=`object`)throw TypeError(`registry: ${t} packument missing versions map`)}function packumentUrl(t,n){let S=ensureTrailingSlash$1(n);if(t.startsWith(`@`)){let n=t.indexOf(`/`);if(n<0)throw TypeError(`Invalid scoped package name: ${t}`);let C=t.slice(0,n),N=t.slice(n+1);return`${S}${encodeURIComponent(C)}/${encodeURIComponent(N)}`}return`${S}${encodeURIComponent(t)}`}async function fetchPackumentConditional(t,n={}){let S=packumentUrl(t,n.registry??registryFor(t,n.npmrc)),C=buildHeaders(S,{...n,acceptEncoding:`gzip`});C.accept??=n.fullMetadata?`application/json`:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`,n.ifNoneMatch&&(C[`if-none-match`]=n.ifNoneMatch);let N=await fetchWithRetry(S,{headers:C,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,read:async n=>{if(n.status===304){try{await n.arrayBuffer()}catch{}return{status:`not-modified`}}if(!n.ok)throw n.status===404||n.status===406?new PackageNotFoundError(t,S):Error(`registry GET ${S} -> ${n.status} ${n.statusText}`);return{status:`fresh`,body:await decodeJsonBody(n),etag:n.headers.get(`etag`)??void 0}}});if(N.status===`not-modified`)return{status:`not-modified`,etag:n.ifNoneMatch};let F=N.body;return assertPackument(t,F),{status:`fresh`,packument:F,etag:N.etag}}async function decodeJsonBody(t){return t.json()}async function fetchPackument(t,n={}){let S=await fetchPackumentConditional(t,n);if(!S.packument)throw Error(`registry: ${t} returned 304 Not Modified to an unconditional request`);return S.packument}var Jm=__esmMin(()=>{Hm(),Um(),Gm(),Km()});async function fetchTarball(t,n={}){let S=buildHeaders(t,{...n,acceptEncoding:`identity`});S.accept??=`application/octet-stream`;let C=await fetchWithRetry(t,{headers:S,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,retryNotFound:n.retryNotFound??!0,read:async n=>{if(!n.ok)throw Error(`tarball GET ${t} -> ${n.status} ${n.statusText}`);return new Uint8Array(await n.arrayBuffer())}});if(n.integrity&&!await verifyIntegrity(C,n.integrity))throw new IntegrityError(t,n.integrity);return C}var Ym=__esmMin(()=>{Hm(),Um(),Km(),qm()});async function whoami(t,n){let S=`${ensureTrailingSlash$1(t)}-/whoami`,C=buildHeaders(S,{npmrc:n});C.accept=`application/json`;let N=globalThis.fetch;if(!N)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let F=await N(S,{method:`GET`,headers:C});if(!F.ok)throw Error(`whoami GET ${S} -> ${F.status} ${F.statusText}`);let I=await F.json();if(I&&typeof I==`object`&&`username`in I){let t=I.username;if(typeof t==`string`&&t.length>0)return{username:t}}return{}}var Xm=__esmMin(()=>{Hm(),Gm()}),Zm=__esmMin(()=>{Hm(),Um(),Gm(),qm(),Jm(),Ym(),Xm()});function escapePackageName(t){return t.replace(`/`,`%2f`)}function buildPublishHeaders(t,n){let S=buildHeaders(t,{npmrc:n.npmrc});return S[`content-type`]=`application/json`,S[`npm-command`]=`publish`,S[`npm-auth-type`]=n.otp?`legacy`:`web`,S[`user-agent`]=n.userAgent??defaultUserAgent(),n.otp&&(S[`npm-otp`]=n.otp),n.authorization&&(S.authorization=n.authorization),S}function cliVersion(){return Qm===void 0&&(Qm=`0.64.1-next.240`),Qm}function cliPackageDir(){let t=globalThis.process?.env?.GJSIFY_CLI_PACKAGE_JSON,n;try{n=wn(t||fileURLToPath(import.meta.url))}catch{return null}for(let t=0;t<12;t++){try{if(JSON.parse(readFileSync(`${n}/package.json`,`utf8`)).name===`@gjsify/cli`)return n}catch{}let t=wn(n);if(t===n)break;n=t}return null}function defaultUserAgent(){let t=globalThis.process,n=t?.arch??`x64`,S=t?.platform??`linux`;return`gjsify-publish/${cliVersion()} (${S} ${n})`}var Qm,$m=__esmMin(()=>{Fd(),jn(),Hn(),Zm()}),eh,th=__esmMin(()=>{eh=`gjsify`});function parseDeclaredChannel(t,n){if(!(t===void 0||t===``)){if(nh.includes(t))return t;throw Error(`${n}: "${String(t)}" is not a distribution channel. Known: ${nh.join(`, `)}.`)}}function channelAllowsDonations(t){return t!==void 0&&rh[t]===!0}var nh,rh,ih,ah=__esmMin(()=>{nh=[`flathub`,`web`,`microsoft-store`,`apple-app-store`],rh={flathub:!0,web:!0,"microsoft-store":!1,"apple-app-store":!1},ih=`GJSIFY_CHANNEL`}),oh=__commonJSMin(((t,n)=>{let S=(jn(),__toCommonJS(gn)),C=(Nl(),__toCommonJS(kl)),N=(Fd(),__toCommonJS(Nd)),resolveFrom=(t,n,F)=>{if(typeof t!=`string`)throw TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof t}\``);if(typeof n!=`string`)throw TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof n}\``);try{t=N.realpathSync(t)}catch(n){if(n.code===`ENOENT`)t=S.resolve(t);else if(F)return null;else throw n}let I=S.join(t,`noop.js`),resolveFileName=()=>C._resolveFilename(n,{id:I,filename:I,paths:C._nodeModulePaths(t)});if(F)try{return resolveFileName()}catch{return null}return resolveFileName()};n.exports=(t,n)=>resolveFrom(t,n),n.exports.silent=(t,n)=>resolveFrom(t,n,!0)})),sh=__commonJSMin(((t,n)=>{let callsites=()=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=(t,n)=>n;let n=Error().stack.slice(1);return Error.prepareStackTrace=t,n};n.exports=callsites,n.exports.default=callsites})),ch=__commonJSMin(((t,n)=>{let S=sh();n.exports=t=>{let n=S();if(!t)return n[2].getFileName();let C=!1;n.shift();for(let S of n){let n=S.getFileName();if(typeof n==`string`){if(n===t){C=!0;continue}if(n!==`module.js`&&C&&n!==t)return n}}}})),lh=__commonJSMin(((t,n)=>{var{__gjsifyModuleDir:S,__gjsifyModuleFile:C}=(Ll(),__toCommonJS(Pl)),N=S(`import-fresh/index.js`),F=C(`import-fresh/index.js`);let I=(jn(),__toCommonJS(gn)),H=oh(),W=ch();n.exports=t=>{if(typeof t!=`string`)throw TypeError(`Expected a string`);let n=W(F),S=n?I.dirname(n):N,C=H(S,t),q=Y.cache[C];if(q&&q.parent){let t=q.parent.children.length;for(;t--;)q.parent.children[t].id===C&&q.parent.children.splice(t,1)}delete Y.cache[C];let X=Y.cache[n];return X===void 0||X.require===void 0?Y(C):X.require(C)}})),uh=__commonJSMin(((t,n)=>{n.exports=function isArrayish(t){return t?t instanceof Array||Array.isArray(t)||t.length>=0&&t.splice instanceof Function:!1}})),dh=__commonJSMin(((t,n)=>{var S=(Su(),__toCommonJS(vu)),C=uh(),N=function errorEx(t,n){(!t||t.constructor!==String)&&(n=t||{},t=Error.name);var N=function ErrorEXError(S){if(!this)return new ErrorEXError(S);S=S instanceof Error?S.message:S||this.message,Error.call(this,S),Error.captureStackTrace(this,N),this.name=t,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var t=S.split(/\r?\n/g);for(var N in n)if(n.hasOwnProperty(N)){var F=n[N];`message`in F&&(t=F.message(this[N],t)||t,C(t)||(t=[t]))}return t.join(`
|
|
149
149
|
`)},set:function(t){S=t}});var F=null,I=Object.getOwnPropertyDescriptor(this,`stack`),H=I.get,W=I.value;delete I.value,delete I.writable,I.set=function(t){F=t},I.get=function(){var t=(F||(H?H.call(this):W)).split(/\r?\n+/g);F||(t[0]=this.name+`: `+this.message);var S=1;for(var C in n)if(n.hasOwnProperty(C)){var N=n[C];if(`line`in N){var I=N.line(this[C]);I&&t.splice(S++,0,` `+I)}`stack`in N&&N.stack(this[C],t)}return t.join(`
|
|
150
150
|
`)},Object.defineProperty(this,"stack",I)};return Object.setPrototypeOf?(Object.setPrototypeOf(N.prototype,Error.prototype),Object.setPrototypeOf(N,Error)):S.inherits(N,Error),N};N.append=function(t,n){return{message:function(S,C){return S||=n,S&&(C[0]+=` `+t.replace(`%s`,S.toString())),C}}},N.line=function(t,n){return{line:function(S){return S||=n,S?t.replace(`%s`,S.toString()):null}}},n.exports=N})),fh=__commonJSMin(((t,n)=>{let hexify=t=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return`0x`+(n.length%2?`0`:``)+n},parseError=(t,n,S)=>{if(!n)return{message:t.message+` while parsing empty string`,position:0};let C=t.message.match(/^Unexpected token (.) .*position\s+(\d+)/i),N=C?+C[2]:t.message.match(/^Unexpected end of JSON.*/i)?n.length-1:null,F=C?t.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(C[1])} (${hexify(C[1])})`):t.message;if(N!=null){let t=N<=S?0:N-S,C=N+S>=n.length?n.length:N+S,I=(t===0?``:`...`)+n.slice(t,C)+(C===n.length?``:`...`);return{message:F+` while parsing ${n===I?``:`near `}${JSON.stringify(I)}`,position:N}}else return{message:F+` while parsing '${n.slice(0,S*2)}'`,position:0}};var JSONParseError=class extends SyntaxError{constructor(t,n,S,C){S||=20;let N=parseError(t,n,S);super(N.message),Object.assign(this,N),this.code=`EJSONPARSE`,this.systemError=t,Error.captureStackTrace(this,C||this.constructor)}get name(){return this.constructor.name}set name(t){}get[Symbol.toStringTag](){return this.constructor.name}};let S=Symbol.for(`indent`),C=Symbol.for(`newline`),N=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,F=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,parseJson=(t,n,I)=>{let H=stripBOM(t);I||=20;try{let[,t=`
|
|
151
151
|
`,I=` `]=H.match(F)||H.match(N)||[,``,``],W=JSON.parse(H,n);return W&&typeof W==`object`&&(W[C]=t,W[S]=I),W}catch(n){if(typeof t!=`string`&&!Buffer.isBuffer(t)){let S=Array.isArray(t)&&t.length===0;throw Object.assign(TypeError(`Cannot parse ${S?`an empty array`:String(t)}`),{code:`EJSONPARSE`,systemError:n})}throw new JSONParseError(n,H,I,parseJson)}},stripBOM=t=>String(t).replace(/^\uFEFF/,``);n.exports=parseJson,parseJson.JSONParseError=JSONParseError,parseJson.noExceptions=(t,n)=>{try{return JSON.parse(stripBOM(t),n)}catch{}}})),ph=__commonJSMin((t=>{t.__esModule=!0,t.LinesAndColumns=void 0;var n=`
|
|
@@ -1137,7 +1137,7 @@ ${t.map(t=>{let n=[` <mime-type type="${xmlEscape(t.type)}">`,` <comment>${x
|
|
|
1137
1137
|
`)}).join(`
|
|
1138
1138
|
`)}
|
|
1139
1139
|
</mime-info>
|
|
1140
|
-
`}var rV,iV=__esmMin(()=>{nV(),rV=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/});function normaliseVersion(t){let n=[],S=t.trim();S.startsWith(`v`)&&(S=S.slice(1));let C=S.indexOf(`+`);C!==-1&&(n.push(`gjsify ship: dropped the build metadata "${S.slice(C)}" from version ${t} — neither dpkg nor rpm has a field for it. Set \`gjsify.ship.version\` to pin an exact package version.`),S=S.slice(0,C));let N=S.indexOf(`-`);if(N!==-1){let t=S.slice(N+1).replace(/-/g,`.`);S=`${S.slice(0,N)}~${t}`}if(!aV.test(S))throw Error(`gjsify ship: "${t}" is not a usable package version (normalised to "${S}"). It must start with a digit and contain only letters, digits, \`.\`, \`+\` and \`~\`. Set \`gjsify.ship.version\` in package.json to override it.`);return{version:S,warnings:n}}function assertRelease(t){if(!oV.test(t))throw Error(`gjsify ship: "${t}" is not a usable package release. It must start with a letter or digit and contain only letters, digits, \`.\`, \`+\` and \`~\`. Set \`gjsify.ship.release\` in package.json.`);return t}var aV,oV,sV=__esmMin(()=>{aV=/^\d[A-Za-z0-9.+~]*$/,oV=/^[A-Za-z0-9][A-Za-z0-9.+~]*$/});function resolveShipApp(t){let n=t.perTarget??{};for(let t of Object.keys(n))if(!Object.hasOwn(cV,t))throw Error(`gjsify ship: \`gjsify.ship.app.${t}\` is not an OS this command assembles for. Known: ${Object.keys(cV).join(`, `)} — the \`process.platform\` spelling, not the \`gjsify ship <os>\` positional's. A runtime under a key nothing reads leaves that target on \`gjsify.app\` with nothing to say so.`);let S=n[t.layoutOs],C=S!==void 0,N=C?`gjsify.ship.app.${t.layoutOs}`:`gjsify.app`,F=C?S:t.project;if(F!==void 0&&F!==`gjs`&&F!==`node`)throw Error(`gjsify ship: \`${N}\` is "${F}", and only \`gjs\` and \`node\` can be packaged. A browser bundle has no process to launch, and a NativeScript app ships as an APK/IPA through a different pipeline. ADR 0024 § 4 has the runtime-per-OS table.`);return{app:F===`node`?`node`:`gjs`,key:N,overridden:C}}function resolveShipKind(t,n){return t.kind??n.kind??`app`}function resolveShipSettings(t){let n=[],{pkg:S,ship:C,flatpak:N,discovered:F}=t,I={...N,...definedOnly(C)},H=C.mimeTypes??[];if(H.length>0){validateMimeTypes(H);let t=new Set([...I.provides?.mimetypes??[],...H.map(t=>t.type)]);I.provides={...I.provides,mimetypes:[...t]}}let W=C.binaryName??deriveBinaryName(S.name),q=C.appId??N.appId??reverseDnsOrThrow(S.name,W),Y=I.name??titleCase(W),X=resolveShipKind(C,N),Z=t.app,te=C.version??S.version;if(!te)throw Error("gjsify ship: no version — set `version` in package.json or `gjsify.ship.version`.");let ne=normaliseVersion(te);n.push(...ne.warnings);let re=I.license?.project??S.license;if(!re)throw Error('gjsify ship: no licence — set `license` in package.json (an SPDX id, e.g. "MIT") or `gjsify.ship.license.project`. Both deb and rpm carry it as a required field.');I.license={...I.license,project:re};let ie=C.maintainer??formatAuthor(S.author)??formatDeveloper(I);if(!ie)throw Error('gjsify ship: no maintainer — set `author` in package.json ("Name <you@example.com>"), `gjsify.ship.maintainer`, or `gjsify.ship.developer`. dpkg refuses a package without one.');let ae=I.summary??S.description??Y,oe=descriptionParagraphs(I.description)??[ae],Q=sectionsFor(I.categories);X===`app`&&F.iconFiles.length===0&&n.push("gjsify ship: no icon found — the installed app will show a placeholder in menus and app stores on Linux, and the darwin and windows layouts refuse to stage without one. Point `gjsify.ship.icon` at an SVG (or a directory of sized PNGs).");let se=resolveShipFlatpakSettings({ship:C,flatpak:N,kind:X});return n.push(...se.warnings),{settings:{projectDir:t.projectDir,appId:q,name:Y,binaryName:W,version:ne.version,release:assertRelease(C.release??`1`),maintainer:ie,summary:ae,description:oe,license:re,licenseFile:F.licenseFile,changelogFile:F.changelogFile,homepage:I.homepageUrl??S.homepage,section:C.section??Q.section,group:C.group??Q.group,kind:X,mimeTypes:H,extraDepends:{deb:C.depends?.deb??[],rpm:C.depends?.rpm??[]},typelibPackages:C.typelibPackages??{},bundlePath:F.bundlePath,bundleDir:F.bundleDir,iconFiles:F.iconFiles,schemaFiles:F.schemaFiles,typelibFiles:F.typelibFiles,localeFiles:F.localeFiles,fontFiles:F.fontFiles,extraFiles:C.extraFiles??{},execArgs:C.execArgs??[],outDir:t.cli.outDir??C.outDir??`ship`,arch:t.cli.arch??process.arch,app:Z,layoutOs:t.cli.layoutOs,minGjsVersion:C.minGjsVersion??`1.86`,minNodeVersion:C.minNodeVersion??`24`,flatpak:se.settings},metadata:I,warnings:n}}function resolveShipBundle(t){let n=t.ship.bundle,S=typeof n==`object`&&n?n:{};for(let t of Object.keys(S))if(!Object.hasOwn(cV,t))throw Error(`gjsify ship: \`gjsify.ship.bundle.${t}\` is not an OS this command assembles for. Known: ${Object.keys(cV).join(`, `)} — the \`process.platform\` spelling, not the \`gjsify ship <os>\` positional's. An entry under a key nothing reads leaves that target on \`gjsify.main\` with nothing to say so.`);let C=typeof n==`string`?n:void 0,N=t.pkg.gjsify?.main??t.pkg.main,entryFor=t=>S[t]??C??N,F=S[t.layoutOs],I=entryFor(t.layoutOs),H=F===void 0?C===void 0?t.pkg.gjsify?.main===void 0?`main`:`gjsify.main`:`gjsify.ship.bundle`:`gjsify.ship.bundle.${t.layoutOs}`,W=[...new Set(Object.keys(cV).filter(n=>n!==t.layoutOs).map(entryFor).filter(t=>t!==void 0&&t!==I))];return{declared:I,key:H,overridden:F!==void 0,foreign:W}}function deriveBinaryName(t){if(!t)throw Error("gjsify ship: no package name — set `name` in package.json or `gjsify.ship.binaryName`.");let n=(t.includes(`/`)?t.split(`/`).pop():t).toLowerCase().replace(/[^a-z\d+.-]+/g,`-`).replace(/^-+|-+$/g,``);if(!/^[a-z\d][a-z\d+.-]+$/.test(n))throw Error(`gjsify ship: cannot derive a package name from "${t}" (got "${n}"). Set \`gjsify.ship.binaryName\` to something matching \`[a-z0-9][a-z0-9+.-]+\`.`);return n}function reverseDnsOrThrow(t,n){if(t&&/^[A-Za-z][\w-]*(\.[A-Za-z][\w-]*){2,}$/.test(t))return t;throw Error(`gjsify ship: no application id. Set \`gjsify.ship.appId\` (or \`gjsify.flatpak.appId\`) to a reverse-DNS id such as "io.github.you.${titleCase(n).replace(/\s+/g,``)}". It names the desktop entry, the AppStream component and the installed icon, so it cannot be guessed.`)}function definedOnly(t){return Object.fromEntries(Object.entries(t).filter(([,t])=>t!==void 0))}function titleCase(t){return t.split(/[-_.]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(` `)}function sectionsFor(t){for(let[n,S]of lV)if(t?.includes(n))return S;return{section:`misc`,group:`Applications/System`}}function formatAuthor(t){if(typeof t==`string`)return t.replace(/\s*\([^)]*\)\s*$/,``).trim()||void 0;if(t?.name)return t.email?`${t.name} <${t.email}>`:t.name}function formatDeveloper(t){let n=t.developer;if(n?.name)return n.email?`${n.name} <${n.email}>`:n.name}function descriptionParagraphs(t){if(t===void 0)return;if(typeof t==`string`){let n=t.trim().split(/\n\n+/).map(t=>t.trim().replace(/\s+/g,` `)).filter(t=>t.length>0);return n.length>0?n:void 0}let n=[];for(let S of t)if(typeof S==`string`){let t=S.trim().replace(/\s+/g,` `);t&&n.push(t)}else if(`p`in S)n.push(S.p.trim().replace(/\s+/g,` `));else for(let t of S.ul)n.push(`* ${(typeof t==`string`?t:t.item).trim().replace(/\s+/g,` `)}`);return n.length>0?n:void 0}var cV,lV,uV,dV,fV=__esmMin(()=>{iV(),jn(),Xz(),rz(),sV(),cV={linux:!0,darwin:!0,win32:!0},lV=[[`Development`,{section:`devel`,group:`Development/Tools`}],[`Education`,{section:`education`,group:`Applications/Education`}],[`Game`,{section:`games`,group:`Amusements/Games`}],[`Graphics`,{section:`graphics`,group:`Applications/Multimedia`}],[`AudioVideo`,{section:`sound`,group:`Applications/Multimedia`}],[`Network`,{section:`net`,group:`Applications/Internet`}],[`Office`,{section:`text`,group:`Applications/Productivity`}],[`Science`,{section:`science`,group:`Applications/Engineering`}],[`System`,{section:`admin`,group:`Applications/System`}],[`Utility`,{section:`utils`,group:`Applications/System`}]],uV=[`LICENSE`,`LICENSE.md`,`LICENSE.txt`,`COPYING`,`COPYING.md`],dV=[`CHANGELOG.md`,`CHANGELOG`,`CHANGELOG.txt`,`NEWS.md`,`NEWS`]});function discoverPayload(t){let{projectDir:n,ship:S}=t,C=resolveBundle(t),N=vn(C,`..`),F=discoverLocales(n,S.localeDir);return{bundlePath:C,bundleDir:N,bundleFiles:withoutForeignEntries(withoutLocaleTree(listFilesRecursive(N),N,n,S.localeDir),N,n,t.foreignBundles??[],C),iconFiles:discoverIcons(n,S.icon??t.flatpakIcon),schemaFiles:discoverSchemas(n,S.schemas),typelibFiles:discoverTypelibs(n,S.bundledTypelibs),localeFiles:F,fontFiles:discoverFonts(n,S.fonts),licenseFile:discoverLicense(n,S.licenseFile),changelogFile:discoverChangelog(n,S.changelogFile)}}function discoverTypelibs(t,n){let S=[];for(let C of n??[]){let n=vn(t,C);if(!existsSync(n))throw Error(`gjsify ship: \`gjsify.ship.bundledTypelibs\` names ${C}, which does not exist. A missing directory here means the package would install without the typelib it promises.`);for(let t of listFilesRecursive(n))(/\.(typelib|dylib|dll)$/i.test(t)||/\.so(\.\d+)*$/.test(t))&&S.push(xn(n,t))}return S}function withoutLocaleTree(t,n,S,C){if(C===void 0)return t;let N=Sn(n,vn(S,C));if(N===``||N.startsWith(`..`)||bn(N))return t;let F=`${N.split(On).join(un.sep)}${un.sep}`;return t.filter(t=>!`${t}${un.sep}`.startsWith(F))}function discoverLocales(t,n){if(n===void 0)return[];let S=vn(t,n);if(!existsSync(S))throw Error(`gjsify ship: \`gjsify.ship.localeDir\` names ${n}, which does not exist. Compile the catalogues first (msgfmt, or @gjsify/vite-plugin-gettext) — a missing directory here means the package would install without the translations it promises.`);let C=[],N=[];for(let t of listFilesRecursive(S)){if(t.endsWith(`.po`)||t.endsWith(`.pot`)){N.push(`${t} (a .po source; bindtextdomain reads .mo only)`);continue}if(!t.endsWith(`.mo`))continue;let n=t.split(un.sep);if(n.length!==3||n[1]!==`LC_MESSAGES`){N.push(`${t} (expected <lang>/LC_MESSAGES/<domain>.mo)`);continue}C.push({rel:n.join(`/`),abs:xn(S,t)})}if(N.length>0)throw Error(`gjsify ship: \`gjsify.ship.localeDir\` (${n}) holds files no catalogue lookup will find:\n`+N.map(t=>` ${t}`).join(`
|
|
1140
|
+
`}var rV,iV=__esmMin(()=>{nV(),rV=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/});function normaliseVersion(t){let n=[],S=t.trim();S.startsWith(`v`)&&(S=S.slice(1));let C=S.indexOf(`+`);C!==-1&&(n.push(`gjsify ship: dropped the build metadata "${S.slice(C)}" from version ${t} — neither dpkg nor rpm has a field for it. Set \`gjsify.ship.version\` to pin an exact package version.`),S=S.slice(0,C));let N=S.indexOf(`-`);if(N!==-1){let t=S.slice(N+1).replace(/-/g,`.`);S=`${S.slice(0,N)}~${t}`}if(!aV.test(S))throw Error(`gjsify ship: "${t}" is not a usable package version (normalised to "${S}"). It must start with a digit and contain only letters, digits, \`.\`, \`+\` and \`~\`. Set \`gjsify.ship.version\` in package.json to override it.`);return{version:S,warnings:n}}function assertRelease(t){if(!oV.test(t))throw Error(`gjsify ship: "${t}" is not a usable package release. It must start with a letter or digit and contain only letters, digits, \`.\`, \`+\` and \`~\`. Set \`gjsify.ship.release\` in package.json.`);return t}var aV,oV,sV=__esmMin(()=>{aV=/^\d[A-Za-z0-9.+~]*$/,oV=/^[A-Za-z0-9][A-Za-z0-9.+~]*$/});function resolveShipApp(t){let n=t.perTarget??{};for(let t of Object.keys(n))if(!Object.hasOwn(cV,t))throw Error(`gjsify ship: \`gjsify.ship.app.${t}\` is not an OS this command assembles for. Known: ${Object.keys(cV).join(`, `)} — the \`process.platform\` spelling, not the \`gjsify ship <os>\` positional's. A runtime under a key nothing reads leaves that target on \`gjsify.app\` with nothing to say so.`);let S=n[t.layoutOs],C=S!==void 0,N=C?`gjsify.ship.app.${t.layoutOs}`:`gjsify.app`,F=C?S:t.project;if(F!==void 0&&F!==`gjs`&&F!==`node`)throw Error(`gjsify ship: \`${N}\` is "${F}", and only \`gjs\` and \`node\` can be packaged. A browser bundle has no process to launch, and a NativeScript app ships as an APK/IPA through a different pipeline. ADR 0024 § 4 has the runtime-per-OS table.`);return{app:F===`node`?`node`:`gjs`,key:N,overridden:C}}function resolveShipKind(t,n){return t.kind??n.kind??`app`}function resolveShipSettings(t){let n=[],{pkg:S,ship:C,flatpak:N,discovered:F}=t,I={...N,...definedOnly(C)},H=C.mimeTypes??[];if(H.length>0){validateMimeTypes(H);let t=new Set([...I.provides?.mimetypes??[],...H.map(t=>t.type)]);I.provides={...I.provides,mimetypes:[...t]}}let W=C.binaryName??deriveBinaryName(S.name),q=C.appId??N.appId??reverseDnsOrThrow(S.name,W),Y=I.name??titleCase(W),X=resolveShipKind(C,N),Z=t.app,te=C.version??S.version;if(!te)throw Error("gjsify ship: no version — set `version` in package.json or `gjsify.ship.version`.");let ne=normaliseVersion(te);n.push(...ne.warnings);let re=I.license?.project??S.license;if(!re)throw Error('gjsify ship: no licence — set `license` in package.json (an SPDX id, e.g. "MIT") or `gjsify.ship.license.project`. Both deb and rpm carry it as a required field.');I.license={...I.license,project:re};let ie=C.maintainer??formatAuthor(S.author)??formatDeveloper(I);if(!ie)throw Error('gjsify ship: no maintainer — set `author` in package.json ("Name <you@example.com>"), `gjsify.ship.maintainer`, or `gjsify.ship.developer`. dpkg refuses a package without one.');let ae=I.summary??S.description??Y,oe=descriptionParagraphs(I.description)??[ae],Q=sectionsFor(I.categories);X===`app`&&F.iconFiles.length===0&&n.push("gjsify ship: no icon found — the installed app will show a placeholder in menus and app stores on Linux, and the darwin and windows layouts refuse to stage without one. Point `gjsify.ship.icon` at an SVG (or a directory of sized PNGs).");let se=resolveShipFlatpakSettings({ship:C,flatpak:N,kind:X});return n.push(...se.warnings),{settings:{projectDir:t.projectDir,appId:q,name:Y,binaryName:W,version:ne.version,release:assertRelease(C.release??`1`),maintainer:ie,summary:ae,description:oe,license:re,licenseFile:F.licenseFile,changelogFile:F.changelogFile,homepage:I.homepageUrl??S.homepage,section:C.section??Q.section,group:C.group??Q.group,kind:X,mimeTypes:H,extraDepends:{deb:C.depends?.deb??[],rpm:C.depends?.rpm??[]},typelibPackages:C.typelibPackages??{},bundlePath:F.bundlePath,bundleDir:F.bundleDir,iconFiles:F.iconFiles,schemaFiles:F.schemaFiles,typelibFiles:F.typelibFiles,localeFiles:F.localeFiles,fontFiles:F.fontFiles,extraFiles:C.extraFiles??{},execArgs:C.execArgs??[],outDir:t.cli.outDir??C.outDir??`ship`,arch:t.cli.arch??process.arch,app:Z,layoutOs:t.cli.layoutOs,minGjsVersion:C.minGjsVersion??`1.86`,minNodeVersion:C.minNodeVersion??`24`,flatpak:se.settings},metadata:I,warnings:n}}function resolveShipBundle(t){let n=t.ship.bundle,S=typeof n==`object`&&n?n:{};for(let t of Object.keys(S))if(!Object.hasOwn(cV,t))throw Error(`gjsify ship: \`gjsify.ship.bundle.${t}\` is not an OS this command assembles for. Known: ${Object.keys(cV).join(`, `)} — the \`process.platform\` spelling, not the \`gjsify ship <os>\` positional's. An entry under a key nothing reads leaves that target on \`gjsify.main\` with nothing to say so.`);let C=typeof n==`string`?n:void 0,N=t.pkg.gjsify?.main??t.pkg.main,entryFor=t=>S[t]??C??N,F=S[t.layoutOs],I=entryFor(t.layoutOs),H=F===void 0?C===void 0?t.pkg.gjsify?.main===void 0?`main`:`gjsify.main`:`gjsify.ship.bundle`:`gjsify.ship.bundle.${t.layoutOs}`,W=[...new Set(Object.keys(cV).filter(n=>n!==t.layoutOs).map(entryFor).filter(t=>t!==void 0&&t!==I))];return{declared:I,key:H,overridden:F!==void 0,foreign:W}}function deriveBinaryName(t){if(!t)throw Error("gjsify ship: no package name — set `name` in package.json or `gjsify.ship.binaryName`.");let n=(t.includes(`/`)?t.split(`/`).pop():t).toLowerCase().replace(/[^a-z\d+.-]+/g,`-`).replace(/^-+|-+$/g,``);if(!/^[a-z\d][a-z\d+.-]+$/.test(n))throw Error(`gjsify ship: cannot derive a package name from "${t}" (got "${n}"). Set \`gjsify.ship.binaryName\` to something matching \`[a-z0-9][a-z0-9+.-]+\`.`);return n}function reverseDnsOrThrow(t,n){if(t&&/^[A-Za-z][\w-]*(\.[A-Za-z][\w-]*){2,}$/.test(t))return t;throw Error(`gjsify ship: no application id. Set \`gjsify.ship.appId\` (or \`gjsify.flatpak.appId\`) to a reverse-DNS id such as "io.github.you.${titleCase(n).replace(/\s+/g,``)}". It names the desktop entry, the AppStream component and the installed icon, so it cannot be guessed.`)}function definedOnly(t){return Object.fromEntries(Object.entries(t).filter(([,t])=>t!==void 0))}function titleCase(t){return t.split(/[-_.]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(` `)}function sectionsFor(t){for(let[n,S]of lV)if(t?.includes(n))return S;return{section:`misc`,group:`Applications/System`}}function formatAuthor(t){if(typeof t==`string`)return t.replace(/\s*\([^)]*\)\s*$/,``).trim()||void 0;if(t?.name)return t.email?`${t.name} <${t.email}>`:t.name}function formatDeveloper(t){let n=t.developer;if(n?.name)return n.email?`${n.name} <${n.email}>`:n.name}function descriptionParagraphs(t){if(t===void 0)return;if(typeof t==`string`){let n=t.trim().split(/\n\n+/).map(t=>t.trim().replace(/\s+/g,` `)).filter(t=>t.length>0);return n.length>0?n:void 0}let n=[];for(let S of t)if(typeof S==`string`){let t=S.trim().replace(/\s+/g,` `);t&&n.push(t)}else if(`p`in S)n.push(S.p.trim().replace(/\s+/g,` `));else for(let t of S.ul)n.push(`* ${(typeof t==`string`?t:t.item).trim().replace(/\s+/g,` `)}`);return n.length>0?n:void 0}var cV,lV,uV,dV,fV=__esmMin(()=>{iV(),jn(),Xz(),rz(),sV(),cV={linux:!0,darwin:!0,win32:!0},lV=[[`Development`,{section:`devel`,group:`Development/Tools`}],[`Education`,{section:`education`,group:`Applications/Education`}],[`Game`,{section:`games`,group:`Amusements/Games`}],[`Graphics`,{section:`graphics`,group:`Applications/Multimedia`}],[`AudioVideo`,{section:`sound`,group:`Applications/Multimedia`}],[`Network`,{section:`net`,group:`Applications/Internet`}],[`Office`,{section:`text`,group:`Applications/Productivity`}],[`Science`,{section:`science`,group:`Applications/Engineering`}],[`System`,{section:`admin`,group:`Applications/System`}],[`Utility`,{section:`utils`,group:`Applications/System`}]],uV=[`LICENSE`,`LICENSE.md`,`LICENSE.txt`,`COPYING`,`COPYING.md`],dV=[`CHANGELOG.md`,`CHANGELOG`,`CHANGELOG.txt`,`NEWS.md`,`NEWS`]});function discoverPayload(t){let{projectDir:n,ship:S}=t,C=resolveBundle(t),N=vn(C,`..`),F=discoverLocales(n,S.localeDir);return{bundlePath:C,bundleDir:N,bundleFiles:withoutForeignEntries(withoutLocaleTree(listFilesRecursive(N),N,n,S.localeDir),N,n,t.foreignBundles??[],C),iconFiles:discoverIcons(n,S.icon??t.flatpakIcon),schemaFiles:discoverSchemas(n,S.schemas),typelibFiles:discoverTypelibs(n,resolveBundledTypelibs(S.bundledTypelibs,t.layoutOs)),localeFiles:F,fontFiles:discoverFonts(n,S.fonts),licenseFile:discoverLicense(n,S.licenseFile),changelogFile:discoverChangelog(n,S.changelogFile)}}function resolveBundledTypelibs(t,n){if(t===void 0||Array.isArray(t))return t??[];let S=[`linux`,`darwin`,`win32`];for(let n of Object.keys(t))if(!S.includes(n))throw Error(`gjsify ship: \`gjsify.ship.bundledTypelibs.${n}\` is not an OS this command assembles for. Known: ${S.join(`, `)} — the \`process.platform\` spelling, not the \`gjsify ship <os>\` positional's.`);if(n===void 0)throw Error("gjsify ship: `gjsify.ship.bundledTypelibs` is a per-OS table but no layout OS was given.");return t[n]??[]}function discoverTypelibs(t,n){let S=[];for(let C of n??[]){let n=vn(t,C);if(!existsSync(n))throw Error(`gjsify ship: \`gjsify.ship.bundledTypelibs\` names ${C}, which does not exist. A missing directory here means the package would install without the typelib it promises.`);for(let t of listFilesRecursive(n))(/\.(typelib|dylib|dll)$/i.test(t)||/\.so(\.\d+)*$/.test(t))&&S.push(xn(n,t))}return S}function withoutLocaleTree(t,n,S,C){if(C===void 0)return t;let N=Sn(n,vn(S,C));if(N===``||N.startsWith(`..`)||bn(N))return t;let F=`${N.split(On).join(un.sep)}${un.sep}`;return t.filter(t=>!`${t}${un.sep}`.startsWith(F))}function discoverLocales(t,n){if(n===void 0)return[];let S=vn(t,n);if(!existsSync(S))throw Error(`gjsify ship: \`gjsify.ship.localeDir\` names ${n}, which does not exist. Compile the catalogues first (msgfmt, or @gjsify/vite-plugin-gettext) — a missing directory here means the package would install without the translations it promises.`);let C=[],N=[];for(let t of listFilesRecursive(S)){if(t.endsWith(`.po`)||t.endsWith(`.pot`)){N.push(`${t} (a .po source; bindtextdomain reads .mo only)`);continue}if(!t.endsWith(`.mo`))continue;let n=t.split(un.sep);if(n.length!==3||n[1]!==`LC_MESSAGES`){N.push(`${t} (expected <lang>/LC_MESSAGES/<domain>.mo)`);continue}C.push({rel:n.join(`/`),abs:xn(S,t)})}if(N.length>0)throw Error(`gjsify ship: \`gjsify.ship.localeDir\` (${n}) holds files no catalogue lookup will find:\n`+N.map(t=>` ${t}`).join(`
|
|
1141
1141
|
`)+`
|
|
1142
1142
|
A misplaced catalogue installs and then shows nothing, which reads exactly like having no translation at all. Lay them out as <lang>/LC_MESSAGES/<domain>.mo.`);if(C.length===0)throw Error(`gjsify ship: \`gjsify.ship.localeDir\` (${n}) contains no \`.mo\` catalogue. Declaring a locale directory that ships nothing is a promise the package does not keep.`);return C}function withoutForeignEntries(t,n,S,C,N){if(C.length===0)return t;let F=new Set;for(let t of C){let C=bn(t)?t:vn(S,t);if(C===N)continue;let I=Sn(n,C);I===``||I.startsWith(`..`)||bn(I)||F.add(I.split(On).join(un.sep))}return t.filter(t=>!F.has(t))}function resolveBundle(t){let n=t.declaredBundle;if(n===void 0)throw Error("gjsify ship: no bundle to ship. Set `gjsify.main` (or `main`) in package.json to the built bundle, or `gjsify.ship.bundle` to override it.");let S=bn(n)?n:vn(t.projectDir,n);if(!existsSync(S))throw Error(`gjsify ship: the bundle ${n} does not exist. Build it first (\`gjsify run build\`), or drop \`--skip-build\`.`);return S}function discoverIcons(t,n){if(n!==void 0){let S=vn(t,n);if(!existsSync(S))throw Error(`gjsify ship: the configured icon path ${n} does not exist.`);return statSync(S).isDirectory()?listIcons(S):[S]}for(let n of[`data/icons`,`data/icons/hicolor`]){let S=xn(t,n);if(existsSync(S)&&statSync(S).isDirectory()){let t=listIcons(S);if(t.length>0)return t}}return[]}function listIcons(t){return listFilesRecursive(t).filter(t=>pV.some(n=>t.toLowerCase().endsWith(n))).map(n=>xn(t,n.split(`/`).join(On))).sort()}function discoverFonts(t,n){let S=n??`data/fonts`,C=n===void 0?xn(t,`data`,`fonts`):vn(t,n);if(!existsSync(C)){if(n===void 0)return[];throw Error(`gjsify ship: the configured font path ${n} does not exist.`)}if(!statSync(C).isDirectory()){if(assertNotWebFont(C,S),!mV.some(t=>C.toLowerCase().endsWith(t)))throw Error(`gjsify ship: \`gjsify.ship.fonts\` names ${n}, which is not a font face fontconfig will open (${mV.join(`, `)}). A file it cannot read installs and is never found, and Pango substitutes a fallback family rather than reporting anything.`);return[C]}let N=[];for(let t of listFilesRecursive(C))assertNotWebFont(t,S),mV.some(n=>t.toLowerCase().endsWith(n))&&N.push(xn(C,t.split(`/`).join(On)));if(N.length===0&&n!==void 0)throw Error(`gjsify ship: \`gjsify.ship.fonts\` (${n}) holds no font face (${mV.join(`, `)}). Declaring fonts that ship nothing is a promise the package does not keep — and its symptom is a substituted family, not an error.`);return N.sort()}function assertNotWebFont(t,n){let S=t.toLowerCase(),C=hV.find(t=>S.endsWith(t));if(C!==void 0)throw Error(`gjsify ship: \`gjsify.ship.fonts\` (${n}) carries ${t}, and \`${C}\` is a web-font wrapper whose support is a FreeType BUILD option — brotli for woff2, zlib for woff. Whether it opens is therefore a property of the FreeType the SHIPPED artifact loads (inside \`@gjsify/gtk-runtime-<target>\` for a \`.app\` or a Windows program directory), not of the machine that packaged it. Ship the desktop face instead (${mV.join(`, `)}); a font that fails to open is not an error, it is Pango quietly substituting a different typeface.`)}function discoverSchemas(t,n){let S=n===void 0?[xn(t,`data`)]:[vn(t,n)];for(let t of S){if(!existsSync(t)){if(n!==void 0)throw Error(`gjsify ship: the configured schema path ${n} does not exist.`);continue}if(!statSync(t).isDirectory())return[t];let S=listFilesRecursive(t).filter(t=>t.endsWith(`.gschema.xml`)).map(n=>xn(t,n.split(`/`).join(On))).sort();if(S.length>0)return S}return[]}function discoverLicense(t,n){if(n!==void 0){let S=vn(t,n);if(!existsSync(S))throw Error(`gjsify ship: the configured licence file ${n} does not exist.`);return S}for(let n of licenseSearchDirs(t))for(let t of uV){let S=xn(n,t);if(existsSync(S))return S}}function discoverChangelog(t,n){if(n!==void 0){let S=vn(t,n);if(!existsSync(S))throw Error(`gjsify ship: the configured changelog file ${n} does not exist.`);return S}for(let n of licenseSearchDirs(t))for(let t of dV){let S=xn(n,t);if(existsSync(S))return S}}function licenseSearchDirs(t){let n=[];for(let S=t;;){if(n.push(S),isProjectRoot(S))return n;let C=wn(S);if(C===S)return[t];S=C}}function isProjectRoot(t){if(existsSync(xn(t,`.git`)))return!0;let n=xn(t,`package.json`);if(!existsSync(n))return!1;try{return JSON.parse(readFileSync(n,`utf-8`)).workspaces!==void 0}catch{return!1}}function listFilesRecursive(t){let n=[],walk=S=>{for(let C of readdirSync(S,{withFileTypes:!0}).sort((t,n)=>t.name<n.name?-1:1)){let N=xn(S,C.name);if(C.isDirectory())walk(N);else if(C.isSymbolicLink())throw Error(`gjsify ship: ${N} is a symlink. The payload has to be self-contained — replace it with the file it points at, or exclude it from the bundle directory.`);else C.isFile()&&n.push(un.join(...Sn(t,N).split(On)))}};return walk(t),n.sort()}var pV,mV,hV,gV=__esmMin(()=>{Fd(),jn(),fV(),pV=[`.svg`,`.png`],mV=[`.ttf`,`.otf`,`.ttc`,`.otc`],hV=[`.woff`,`.woff2`,`.eot`]});function isNodeRuntimeTarget(t){return _V.includes(t)}function nodeRuntimePackageName(t){return`@gjsify/node-runtime-${t}`}function nodeRuntimeBinaryName(t){return t.startsWith(`win32-`)?`node.exe`:`node`}function resolveNodeRuntime(t,n={}){let S=n.env??process.env,C=nodeRuntimeBinaryName(t),N=S.GJSIFY_NODE_RUNTIME;if(N){let t=complete(`GJSIFY_NODE_RUNTIME`,N,C);if(t)return t}let F=nodeRuntimePackageName(t),I=resolveInstalledPackage(F,{cwd:n.cwd,bundleUrl:import.meta.url});return I===null?null:complete(F,xn(wn(I),`bin`),C)}function complete(t,n,S){let C=xn(n,S),N=xn(n,`LICENSE`);return!existsSync(C)||!existsSync(N)?null:{source:t,binDir:n,nodePath:C,licensePath:N}}var _V,vV=__esmMin(()=>{Fd(),jn(),WP(),_V=[`darwin-arm64`,`darwin-x64`,`win32-x64`]});function rfc822(t){let n=new Date(t*1e3),pad=t=>String(t).padStart(2,`0`);return`${yV[n.getUTCDay()]}, ${pad(n.getUTCDate())} ${bV[n.getUTCMonth()]} ${n.getUTCFullYear()} ${pad(n.getUTCHours())}:${pad(n.getUTCMinutes())}:${pad(n.getUTCSeconds())} +0000`}function changelogEntriesFor(t,n){let S=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),C=RegExp(`^##+[ \\t]+\\[?${S}\\]?[^\\n]*$`,`m`).exec(n);if(C===null)return[];let N=n.slice(C.index+C[0].length),F=/^##[ \t]+\[?\d/m.exec(N),I=F===null?N:N.slice(0,F.index),H=[];for(let t of I.split(`
|
|
1143
1143
|
`)){let n=/^[*-][ \t]+(.*\S)\s*$/.exec(t);n!==null&&H.push(n[1].replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/\s+/g,` `).trim())}return H}function wrapEntry(t){let n=[],S=` *`;for(let C of t.split(/\s+/))C!==``&&(S.length+1+C.length>xV&&S!==` *`&&S!==` `&&(n.push(S),S=` `),S+=` ${C}`);return n.push(S),n}function renderDebianChangelog(t,n,S){let C=n===void 0?[]:changelogEntriesFor(t.version,n),N=t.homepage?`Release ${t.version}. See ${t.homepage} for the upstream changes.`:`Release ${t.version}.`,F=(C.length>0?C:[N]).flatMap(wrapEntry);return[`${t.binaryName} (${t.version}-${t.release}) unstable; urgency=medium`,``,...F,``,` -- ${t.maintainer} ${rfc822(S)}`,``].join(`
|
|
@@ -1160,7 +1160,7 @@ A misplaced catalogue installs and then shows nothing, which reads exactly like
|
|
|
1160
1160
|
`)}function renderWindowsLauncher(t,n,S,C){let N=S.dirs(t),at=t=>`%HERE%${windowsPath(t)}`,F=[`@echo off`,`rem Generated by "gjsify ship" - do not edit.`,`setlocal`,`set "HERE=%~dp0"`,prependVar(`XDG_DATA_DIRS`,at(N.data))];C.gtkRuntimeDir!==void 0&&F.push(`set "GJSIFY_GTK_RUNTIME=${at(C.gtkRuntimeDir)}"`),C.nodeGiAddon!==void 0&&F.push(`set "NODE_GI_NATIVE=${at(C.nodeGiAddon)}"`),t.typelibFiles.length>0&&F.push(prependVar(`GI_TYPELIB_PATH`,at(N.native)),prependVar(`PATH`,at(N.native))),t.localeFiles.length>0&&F.push(`set "GJSIFY_LOCALE_DIR=${at(N.data)}\\locale"`),t.fontFiles.length>0&&F.push(`set "GJSIFY_FONT_DIR=${at(stagedFontDir(N.data,t.appId))}"`);let I=C.interpreter===void 0?void 0:`"${at(C.interpreter)}"`;return F.push(`${execLine(S,`"${at(N.bundle)}\\${windowsPath(n)}"`,t,I)} %*`,``),F.join(`\r
|
|
1161
1161
|
`)}function prependVar(t,n){return`if defined ${t} (set "${t}=${n};%${t}%") else (set "${t}=${n}")`}function windowsPath(t){return t.split(`/`).filter(t=>t.length>0).join(`\\`)}function execLine(t,n,S,C){let N=t.name===`windows`?cmdQuote:shellQuote,F=S.execArgs.map(N).join(` `),I=C??(S.app===`node`?`node`:`gjs`);return`${S.app===`node`?I:`${I} -m`} ${n}${F?` ${F}`:``}`}var OH=__esmMin(()=>{jn(),$z()});function createCpioArchive(t){let n=[],S=0;t.forEach((t,C)=>{let N=t.linkTarget===void 0?t.data??new Uint8Array:encodeUtf8(t.linkTarget),F=encodeUtf8(`${t.name}\0`),I=buildHeader({ino:t.ino??C+1,mode:t.mode,nlink:t.nlink??1,mtime:t.mtime??0,filesize:N.byteLength,namesize:F.byteLength});S=push(n,I,S),S=push(n,F,S),S=padTo4(n,S),S=push(n,N,S),S=padTo4(n,S)});let C=encodeUtf8(`TRAILER!!!\0`);return S=push(n,buildHeader({ino:0,mode:0,nlink:1,mtime:0,filesize:0,namesize:C.byteLength}),S),S=push(n,C,S),padTo4(n,S),concatBytes(n)}function buildHeader(t){let n=kH+hex8(t.ino)+hex8(t.mode)+hex8(0)+hex8(0)+hex8(t.nlink)+hex8(t.mtime)+hex8(t.filesize)+hex8(0)+hex8(0)+hex8(0)+hex8(0)+hex8(t.namesize)+hex8(0);if(n.length!==AH)throw Error(`gjsify ship: internal error — cpio header is ${n.length} bytes, expected ${AH}.`);return encodeUtf8(n)}function hex8(t){if(t<0||!Number.isInteger(t))throw Error(`gjsify ship: cpio header field must be a non-negative integer, got ${t}.`);let n=t.toString(16).toUpperCase();if(n.length>8)throw Error(`gjsify ship: cpio header field ${t} does not fit in 8 hex digits.`);return n.padStart(8,`0`)}function push(t,n,S){return n.byteLength>0&&t.push(n),S+n.byteLength}function padTo4(t,n){let S=n%4;if(S===0)return n;let C=4-S;return t.push(new Uint8Array(C)),n+C}var kH,AH,jH,MH,NH=__esmMin(()=>{Rz(),kH=`070701`,AH=110,jH=32768,MH=16384});function buildRpmHeader(t,n){let S=[...t].sort((t,n)=>t.tag-n.tag),C=[],N=[],F=0;for(let t of S){if(t.tag<100)throw Error(`gjsify ship: rpm tag ${t.tag} is below 100 and would be rejected by hdrchkTag.`);let{data:n,count:S}=encodeValue(t.type,t.value,t.tag),I=LH[t.type],H=(I-F%I)%I;H>0&&(N.push(new Uint8Array(H)),F+=H),C.push({tag:t.tag,type:t.type,offset:F,count:S}),N.push(n),F+=n.byteLength}let I=F,H=C.length+1;N.push(indexEntry(n,7,-(FH*H),IH)),F+=FH;let W=new Uint8Array(PH.byteLength+8+H*FH+F),q=new DataView(W.buffer);W.set(PH,0),q.setUint32(8,H),q.setUint32(12,F);let Y=16;W.set(indexEntry(n,7,I,IH),Y),Y+=FH;for(let t of C)W.set(indexEntry(t.tag,t.type,t.offset,t.count),Y),Y+=FH;for(let t of N)W.set(t,Y),Y+=t.byteLength;return W}function indexEntry(t,n,S,C){let N=new Uint8Array(FH),F=new DataView(N.buffer);return F.setInt32(0,t),F.setInt32(4,n),F.setInt32(8,S),F.setInt32(12,C),N}function encodeValue(t,n,S){let C=new TextEncoder;switch(t){case 6:if(typeof n!=`string`)throw typeMismatch(S,`a string`);return{data:C.encode(`${n}\0`),count:1};case 8:case 9:{let t=typeof n==`string`?[n]:n;if(!Array.isArray(t))throw typeMismatch(S,`a string array`);if(t.length===0)throw Error(`gjsify ship: rpm tag ${S} has an empty array; omit it instead.`);return{data:C.encode(t.map(t=>`${t}\0`).join(``)),count:t.length}}case 7:if(!(n instanceof Uint8Array))throw typeMismatch(S,`binary data`);return{data:n,count:n.byteLength};case 3:case 4:{let C=typeof n==`number`?[n]:n;if(!Array.isArray(C))throw typeMismatch(S,`a number array`);if(C.length===0)throw Error(`gjsify ship: rpm tag ${S} has an empty array; omit it instead.`);let N=t===3?2:4,F=new Uint8Array(C.length*N),I=new DataView(F.buffer);return C.forEach((n,S)=>{t===3?I.setUint16(S*N,n&65535):I.setUint32(S*N,n>>>0)}),{data:F,count:C.length}}}}function typeMismatch(t,n){return Error(`gjsify ship: internal error — rpm tag ${t} expects ${n}.`)}function buildRpmLead(t){let n=new Uint8Array(96),S=new DataView(n.buffer);n.set([237,171,238,219],0),n[4]=3,n[5]=0,S.setInt16(6,0),S.setInt16(8,0);let C=new TextEncoder().encode(t).slice(0,65);return n.set(C,10),S.setInt16(76,0),S.setInt16(78,5),n}function padToEight(t){let n=(8-t.byteLength%8)%8;if(n===0)return t;let S=new Uint8Array(t.byteLength+n);return S.set(t,0),S}var PH,FH,IH,LH,RH=__esmMin(()=>{PH=Uint8Array.from([142,173,232,1,0,0,0,0]),FH=16,IH=16,LH={3:2,4:4,6:1,7:1,8:1,9:1}});async function buildRpm(t){let{settings:n,mtime:S}=t,C=collectFiles(t,`/${t.prefix.replace(/^\/+|\/+$/g,``)}`),N=createCpioArchive(C.map((t,n)=>({name:`.${t.path}`,mode:t.mode,data:t.data,mtime:S,ino:n+1}))),F=await gzipDeterministic(N),I=buildRpmHeader(mainHeaderEntries(t,C,N,F),63),H=concatBytes([I,F]),W=padToEight(buildRpmHeader([{tag:BH.SHA1HEADER,type:6,value:hashHex(`sha1`,I)},{tag:BH.SHA256HEADER,type:6,value:hashHex(`sha256`,I)},{tag:BH.SIZE,type:4,value:[H.byteLength]},{tag:BH.MD5,type:7,value:hashBytes(`md5`,H)},{tag:BH.PAYLOADSIZE,type:4,value:[N.byteLength]}],62));return concatBytes([buildRpmLead(`${n.binaryName}-${n.version}-${n.release}`),W,H])}function collectFiles(t,n){let S=t.payload.map(t=>{if(t.data.byteLength>4294967295)throw Error(`gjsify ship: ${t.path} is larger than 4 GiB, which needs rpm's LONGFILESIZES tag. That is not implemented — split the payload.`);return{path:`${n}/${t.path}`,mode:jH|t.mode&4095,data:t.data,isDirectory:!1}}),C=new Set;for(let t of S){let n=t.path.split(`/`).slice(1);n.pop();let S=``;for(let t of n)S=`${S}/${t}`,WH.has(S)||C.add(S)}for(let t of C)S.push({path:t,mode:MH|493,data:new Uint8Array,isDirectory:!0});return S.sort((t,n)=>t.path<n.path?-1:+(t.path>n.path))}function mainHeaderEntries(t,n,S,C){let{settings:N}=t,F=`${N.version}-${N.release}`,I=[],H=[],W=[];for(let t of n){let n=t.path.lastIndexOf(`/`),S=`${t.path.slice(0,n)}/`,C=I.indexOf(S);C===-1&&(C=I.push(S)-1),H.push(C),W.push(t.path.slice(n+1))}let q=renderRpmScriptlets(readPayloadFacts(t.payload),t.prefix),Y=buildRequires(t.depends,q,readShebangInterpreters(t.payload)),X=buildRecommends(t.recommends??[]),Z=[{tag:zH.HEADERI18NTABLE,type:8,value:[`C`]},{tag:zH.NAME,type:6,value:N.binaryName},{tag:zH.VERSION,type:6,value:N.version},{tag:zH.RELEASE,type:6,value:N.release},{tag:zH.SUMMARY,type:9,value:[N.summary]},{tag:zH.DESCRIPTION,type:9,value:[N.description.join(`
|
|
1162
1162
|
|
|
1163
|
-
`)]},{tag:zH.BUILDTIME,type:4,value:[t.mtime]},{tag:zH.BUILDHOST,type:6,value:`localhost`},{tag:zH.SIZE,type:4,value:[n.reduce((t,n)=>t+n.data.byteLength,0)]},{tag:zH.LICENSE,type:6,value:N.license},{tag:zH.GROUP,type:9,value:[N.group]},{tag:zH.OS,type:6,value:`linux`},{tag:zH.ARCH,type:6,value:t.archLabel},{tag:zH.SOURCERPM,type:6,value:`${N.binaryName}-${F}.src.rpm`},{tag:zH.RPMVERSION,type:6,value:`4.20.0`},{tag:zH.ENCODING,type:6,value:`utf-8`},{tag:zH.FILESIZES,type:4,value:n.map(t=>t.data.byteLength)},{tag:zH.FILEMODES,type:3,value:n.map(t=>t.mode)},{tag:zH.FILERDEVS,type:3,value:n.map(()=>0)},{tag:zH.FILEMTIMES,type:4,value:n.map(()=>t.mtime)},{tag:zH.FILEDIGESTS,type:8,value:n.map(t=>t.isDirectory?``:hashHex(`sha256`,t.data))},{tag:zH.FILELINKTOS,type:8,value:n.map(()=>``)},{tag:zH.FILEFLAGS,type:4,value:n.map(()=>0)},{tag:zH.FILEUSERNAME,type:8,value:n.map(()=>`root`)},{tag:zH.FILEGROUPNAME,type:8,value:n.map(()=>`root`)},{tag:zH.FILEVERIFYFLAGS,type:4,value:n.map(()=>4294967295)},{tag:zH.FILEDEVICES,type:4,value:n.map(()=>1)},{tag:zH.FILEINODES,type:4,value:n.map((t,n)=>n+1)},{tag:zH.FILELANGS,type:8,value:n.map(()=>``)},{tag:zH.FILEDIGESTALGO,type:4,value:[HH]},{tag:zH.DIRINDEXES,type:4,value:H},{tag:zH.BASENAMES,type:8,value:W},{tag:zH.DIRNAMES,type:8,value:I},{tag:zH.PROVIDENAME,type:8,value:[N.binaryName]},{tag:zH.PROVIDEFLAGS,type:4,value:[VH.EQUAL]},{tag:zH.PROVIDEVERSION,type:8,value:[F]},{tag:zH.REQUIRENAME,type:8,value:Y.names},{tag:zH.REQUIREFLAGS,type:4,value:Y.flags},{tag:zH.REQUIREVERSION,type:8,value:Y.versions},...X.names.length>0?[{tag:zH.RECOMMENDNAME,type:8,value:X.names},{tag:zH.RECOMMENDFLAGS,type:4,value:X.flags},{tag:zH.RECOMMENDVERSION,type:8,value:X.versions}]:[],{tag:zH.PAYLOADFORMAT,type:6,value:`cpio`},{tag:zH.PAYLOADCOMPRESSOR,type:6,value:`gzip`},{tag:zH.PAYLOADFLAGS,type:6,value:`9`},{tag:zH.PAYLOADDIGEST,type:8,value:[hashHex(`sha256`,C)]},{tag:zH.PAYLOADDIGESTALGO,type:4,value:[HH]},{tag:zH.PAYLOADDIGESTALT,type:8,value:[hashHex(`sha256`,S)]}];return assertParallelFileArrays(Z,n.length),N.homepage&&Z.push({tag:zH.URL,type:6,value:N.homepage}),q.post!==void 0&&(Z.push({tag:zH.POSTIN,type:6,value:q.post}),Z.push({tag:zH.POSTINPROG,type:6,value:`/bin/sh`})),q.postun!==void 0&&(Z.push({tag:zH.POSTUN,type:6,value:q.postun}),Z.push({tag:zH.POSTUNPROG,type:6,value:`/bin/sh`})),Z}function assertParallelFileArrays(t,n){let S=new Set([zH.FILESIZES,zH.FILEMODES,zH.FILERDEVS,zH.FILEMTIMES,zH.FILEDIGESTS,zH.FILELINKTOS,zH.FILEFLAGS,zH.FILEUSERNAME,zH.FILEGROUPNAME,zH.FILEVERIFYFLAGS,zH.FILEDEVICES,zH.FILEINODES,zH.FILELANGS,zH.DIRINDEXES,zH.BASENAMES]);for(let C of t){if(!S.has(C.tag))continue;let t=Array.isArray(C.value)?C.value.length:1;if(t!==n)throw Error(`gjsify ship: internal error — rpm tag ${C.tag} has ${t} values for ${n} files.`)}}function buildRequires(t,n,S){let C=[],N=[],F=[];for(let n of t){let t=parseDepend(n);C.push(t.name),N.push(senseFor(t.relation)),F.push(t.version??``)}n.post!==void 0&&(C.push(`/bin/sh`),N.push(VH.INTERP|VH.SCRIPT_POST),F.push(``)),n.postun!==void 0&&(C.push(`/bin/sh`),N.push(VH.INTERP|VH.SCRIPT_POSTUN),F.push(``));for(let t of S)C.push(t),N.push(VH.FIND_REQUIRES),F.push(``);for(let[t,n]of UH)C.push(t),N.push(VH.RPMLIB|VH.LESS|VH.EQUAL),F.push(n);return{names:C,flags:N,versions:F}}function buildRecommends(t){let n=[],S=[],C=[];for(let N of t){let t=parseDepend(N);n.push(t.name),S.push(senseFor(t.relation)),C.push(t.version??``)}return{names:n,flags:S,versions:C}}function senseFor(t){switch(t){case`>=`:return VH.GREATER|VH.EQUAL;case`>`:return VH.GREATER;case`<=`:return VH.LESS|VH.EQUAL;case`<`:return VH.LESS;case`=`:return VH.EQUAL;default:return 0}}function hashHex(t,n){return createHash(t).update(n).digest(`hex`)}function hashBytes(t,n){return new Uint8Array(createHash(t).update(n).digest())}var zH,BH,VH,HH,UH,WH,GH=__esmMin(()=>{Yc(),Rz(),NH(),Xz(),eV(),RH(),Zz(),eB(),$z(),zH={HEADERI18NTABLE:100,NAME:1e3,VERSION:1001,RELEASE:1002,SUMMARY:1004,DESCRIPTION:1005,BUILDTIME:1006,BUILDHOST:1007,SIZE:1009,LICENSE:1014,GROUP:1016,URL:1020,OS:1021,ARCH:1022,POSTIN:1024,POSTUN:1026,FILESIZES:1028,FILEMODES:1030,FILERDEVS:1033,FILEMTIMES:1034,FILEDIGESTS:1035,FILELINKTOS:1036,FILEFLAGS:1037,FILEUSERNAME:1039,FILEGROUPNAME:1040,SOURCERPM:1044,FILEVERIFYFLAGS:1045,PROVIDENAME:1047,REQUIREFLAGS:1048,REQUIRENAME:1049,REQUIREVERSION:1050,RECOMMENDNAME:5046,RECOMMENDVERSION:5047,RECOMMENDFLAGS:5048,RPMVERSION:1064,POSTINPROG:1086,POSTUNPROG:1088,FILEDEVICES:1095,FILEINODES:1096,FILELANGS:1097,PROVIDEFLAGS:1112,PROVIDEVERSION:1113,DIRINDEXES:1116,BASENAMES:1117,DIRNAMES:1118,PAYLOADFORMAT:1124,PAYLOADCOMPRESSOR:1125,PAYLOADFLAGS:1126,FILEDIGESTALGO:5011,ENCODING:5062,PAYLOADDIGEST:5092,PAYLOADDIGESTALGO:5093,PAYLOADDIGESTALT:5097},BH={SIZE:1e3,MD5:1004,PAYLOADSIZE:1007,SHA1HEADER:269,SHA256HEADER:273},VH={LESS:2,GREATER:4,EQUAL:8,INTERP:256,SCRIPT_POST:1024,SCRIPT_POSTUN:4096,FIND_REQUIRES:16384,RPMLIB:1<<24},HH=8,UH=[[`rpmlib(CompressedFileNames)`,`3.0.4-1`],[`rpmlib(FileDigests)`,`4.6.0-1`],[`rpmlib(PayloadFilesHavePrefix)`,`4.0-1`]],WH=new Set([`/usr`,`/usr/bin`,`/usr/lib`,`/usr/lib64`,`/usr/libexec`,`/usr/sbin`,`/usr/share`,`/usr/${Qz.applications}`,`/usr/share/doc`,`/usr/share/icons`,`/usr/share/licenses`,`/usr/share/man`,`/usr/${Qz.metainfo}`,`/usr/share/glib-2.0`,`/usr/${Qz.schemas}`,`/usr/${Qz.fonts}`,`/etc`,`/opt`,`/var`])});async function assemble(t){let n=process.cwd(),S=t.os===void 0?hostLayout():resolveLayout(t.os),C=await new Config().forCommand(n),N=C.ship??{},F=C.flatpak??{},I=resolveShipApp({project:C.app,perTarget:N.app,layoutOs:S.os}),H=I.app;I.overridden&&ge.log(`${KH} runtime for ${S.name}: ${H} — \`${I.key}\` overrides \`gjsify.app${C.app===void 0?``:`: "${C.app}"`}\`.`);let W=readPackageJson$2(xn(n,`package.json`))??{},q,Y=[];if(t.target!==void 0)q=resolveFormats(t.target,S);else if(N.targets!==void 0){let t=configuredFormats(N.targets,S);q=t.formats,t.dropped.length>0&&ge.log(`${KH} \`gjsify.ship.targets\` names ${t.dropped.join(`, `)}, which wrap another layout — not built for ${S.name}. Pass --target to ask for one explicitly.`)}else{let t=defaultFormatIds(S.os).map(t=>$V[t]);q=t.filter(t=>t.interpreters.includes(H)),Y=t.filter(t=>!t.interpreters.includes(H)),Y.length>0&&ge.log(`${KH} ${Y.map(t=>t.id).join(`, `)} wrap the ${S.name} layout but cannot run \`${H}\`, which \`${I.key}\` resolves to — ${Y[0]?.interpreterGap??``}. Set \`gjsify.ship.app.${S.os}\` to "${Y[0]?.interpreters.join(`" / "`)}" to ship this OS on that runtime; it leaves every other target on \`gjsify.app\`. Assembling the layout only; pass --target to be told the same thing as an error.`)}q.some(t=>t.id===`flatpak`)&&assertNoDroppedFlatpakModules(F),t.stage||assertPackable(q,S,t.os===void 0?`host`:`positional`,Y);let X=resolveSignPlan({flag:t.sign,config:N.sign,layoutOs:S.os}),Z=resolveNotaryPlan({flag:t.notarize,layoutOs:S.os,sign:X});if(t.stage&&assertNothingToSignYet(t),t.stage||(announceSigning(X,Z),X.kind===`sign`&&assertHostCanSign(X.signer)),t.stage||assertKindCanPack(q,resolveShipKind(N,F)),!t.stage)for(let t of q)assertCanPack(t);let te=parseDeclaredChannel(t.channel,`--channel`)??parseDeclaredChannel(N.channel,`gjsify.ship.channel`)??(q.some(t=>t.id===`flatpak`)?`flathub`:void 0);t[`skip-build`]||await runProjectBuild(n,te);let ne=resolveShipBundle({pkg:W,ship:N,layoutOs:S.os});ne.overridden&&ge.log(`${KH} entry for ${S.name}: ${ne.declared} — \`${ne.key}\` overrides \`gjsify.main\`.`);let re=discoverPayload({projectDir:n,pkg:W,ship:N,flatpakIcon:F.icon,declaredBundle:ne.declared,foreignBundles:ne.foreign}),{settings:ie,metadata:ae,warnings:oe}=resolveShipSettings({projectDir:n,pkg:W,ship:N,flatpak:F,cli:{outDir:t.out,arch:t.arch,layoutOs:S.os},discovered:re,app:H});for(let t of oe)ge.warn(`${KH} ${t}`);for(let t of q)assertFormatCanRunInterpreter(t,ie.app);let Q=readFileSync(ie.bundlePath,`utf-8`);assertEntryRunsUnder({interpreter:ie.app,source:Q,entry:Sn(n,ie.bundlePath)||ie.bundlePath,appKey:I.key,bundleKey:ne.key,layoutOs:S.os});let se=buildTimestamp(ie.bundlePath),ce={appId:ie.appId,name:ie.name,command:ie.binaryName,kind:ie.kind,metadata:ae,channel:te,configKey:`gjsify.ship`,copyrightYear:new Date(se*1e3).getUTCFullYear()};for(let t of validateAppMetadata(ce))ge.warn(`${KH} ${t.field} is not set — ${t.hint}`);ie.licenseFile!==void 0&&wn(ie.licenseFile)!==n&&ge.log(`${KH} licence text from ${Sn(n,ie.licenseFile)} (this package carries none of its own)`);let le=localizeMetadata({metainfo:ie.kind===`app`?renderMetainfoApp$1(ce):renderMetainfoCli$1(ce),desktopEntry:ie.kind===`app`?renderDesktopEntry(ce):void 0},ie.localeFiles),ue=resolveCarriedRuntime(S,ie,n),de={bundleFiles:re.bundleFiles,launcher:renderLauncher(ie,Tn(ie.bundlePath),S,ue.launcher),metainfo:le.metainfo,desktopEntry:le.desktopEntry,licenseText:ie.licenseFile===void 0?void 0:readFileSync(ie.licenseFile,`utf-8`),changelogText:ie.changelogFile===void 0?void 0:readFileSync(ie.changelogFile,`utf-8`),mtime:se},fe=vn(n,ie.outDir),pe=xn(fe,`stage`),me=[...planStage(ie,de),...S.os===`linux`?[]:await compileSchemasForStage({schemaFiles:ie.schemaFiles,workDir:xn(fe,`schemas`)})],he=ie.kind===`app`&&S.icon!==void 0?await resolveAppIcon({iconFiles:ie.iconFiles,appId:ie.appId,sizes:S.icon.sizes,target:S.icon.writes}):void 0;he!==void 0&&ge.log(`${KH} icon: ${iconSizes(he).join(`/`)} px, ${he.source}`);let _e=placeStage(S,{...ie,icon:he},me,ue.files);if(writeStage(pe,_e),ge.log(`${KH} staged ${_e.length} file(s) for ${S.name} in ${Sn(n,pe)}/`),t.verbose)for(let t of _e)ge.log(`${KH} ${t.path}`);if(assertPayloadMatchesArch(readStage([pe],_e),ie.arch),S.os!==`linux`){let t=linuxInstallDependent(me);if(t.length>0){ge.warn(`${KH} the ${S.name} layout carries ${t.length} file(s) whose Linux correctness comes from a package install step it has no equivalent for:`);let n={aborts:`ABORTS: `,unknown:`UNCLASSIFIED: `,inert:``};for(let{path:S,verdict:C,why:N}of t)ge.warn(`${KH} ${n[C]??``}${S} — ${N}`)}for(let t of ue.found)ge.log(`${KH} carries its own ${t}`);for(let t of ue.missing)ge.warn(`${KH} ${t}`);ue.launcher.interpreter===void 0&&S.runtimeGap!==void 0&&ge.warn(`${KH} ${S.runtimeGap}`),S.fontGap!==void 0&&me.some(t=>isUnder(t.path,Qz.fonts))&&ge.warn(`${KH} ${S.fontGap}`),S.arches!==null&&!S.arches.only.includes(ie.arch)&&ge.warn(`${KH} this stage is labelled ${ie.arch} and the ${S.name} layout has no runtime for it — ${S.arches.why}. Nothing can pack this stage; \`--arch ${S.arches.only.join(`|`)}\` is what produces an artifact.`)}let ve=scanGiRequirements(Q),ye=ve.namespaces,be=ve.optional;if(t.verbose){let t=ye.filter(t=>!be.includes(t));ge.log(`${KH} gi namespaces: ${ye.join(`, `)||`(none)`}`),be.length>0&&(ge.log(`${KH} gi optional namespaces: ${be.join(`, `)}`),ge.log(`${KH} gi required namespaces: ${t.join(`, `)||`(none)`}`))}let xe=new Map;for(let t of q)xe.set(t.id,(await planOverlay(ie,t,de)).map(t=>({...t,path:place(S,ie,t.path)})));let Se=readPayloadFacts(me);for(let t of q){if(t.depends===null)continue;let n=deriveDepends(t.depends,{namespaces:ye,optionalNamespaces:be,hasIcons:Se.hasIcons,hasSchemas:Se.hasSchemas,interpreter:ie.app,extra:ie.extraDepends[t.depends],typelibPackages:ie.typelibPackages,bundledTypelibs:Se.bundledTypelibs,minGjsVersion:ie.minGjsVersion,minNodeVersion:ie.minNodeVersion});for(let S of n.unmappedOptional)ge.warn(`${KH} gi://${S} is imported optionally, but no ${t.depends} package is known to ship its typelib, so no Recommends entry names it. The package builds and runs without it. Add the row if the namespace should be recommended: \`gjsify.ship.typelibPackages.${S} = { "${t.depends}": "…" }\`.`);let S=ie.app===`node`?warnAboutNodeFloor(t.depends,ie.minNodeVersion):warnAboutGjsFloor(t.depends,ie.minGjsVersion);for(let t of S)ge.warn(`${KH} ${t}`)}let Ce=writeStageManifest({stageDir:pe,settings:ie,formats:q,mtime:se,namespaces:ye,optionalNamespaces:be,staged:_e,overlay:xe});if(t.stage){let t=Y.length>0?`(none — ${Y.map(t=>t.id).join(` and `)} need \`gjsify.ship.app.${S.os}: "node"\`)`:formatIdsFor(S.os).length===0?`(none — no format wraps the ${S.name} layout)`:`(none asked for)`,n=Ce.formats.join(`, `)||t;ge.log(`${KH} stage manifest: ${formatTarget(Ce.target)}, formats ${n}`);return}let we=[];for(let n of q)we.push(await packOne({format:n,settings:ie,arch:ie.arch,staged:_e,overlay:xe.get(n.id)??[],stageDir:pe,outRoot:fe,namespaces:ye,optionalNamespaces:be,mtime:se,sign:X,notarize:Z,verbose:t.verbose}));printArtifacts(n,we)}function assertNothingToSignYet(t){let n=t.sign===void 0?t.notarize===void 0?void 0:`--notarize`:`--sign`;if(n!==void 0)throw Error(`gjsify ship: ${n} belongs to the finish phase, and --stage produces no artifact to sign — it writes the tree a packing host reads back. Assemble here, then run \`gjsify ship --from-stage <dir> --sign <identity>\` on the host that holds the identity (ADR 0024 § A2, § A14).`)}function announceSigning(t,n){t.kind===`skip`&&ge.warn(`${KH} ${t.message}`),n.kind===`skip`&&t.kind===`sign`&&ge.warn(`${KH} ${n.message}`)}function resolveCarriedRuntime(t,n,S){let C={files:[],launcher:{},found:[],missing:[]};if(t.os===`linux`||n.app!==`node`)return C;let N=`${t.os}-${n.arch}`;return isGtkRuntimeTarget(N)?stageAppRuntime({layout:t,identity:n,target:N,cwd:S,interpreter:isNodeRuntimeTarget(N)?resolveNodeRuntime(N,{cwd:S}):null}):C}async function finishFromStage(t,n){if(t.stage)throw Error("gjsify ship: --stage and --from-stage are the two halves of one split and cannot run together. `--stage` assembles a payload and stops; `--from-stage <dir>` packs one that is already assembled. Run them as two commands, on the host each belongs on (ADR 0024 § A2).");if(t[`skip-build`])throw Error(`gjsify ship: --from-stage never runs a build — the payload it packs was built and staged by an earlier run — so --skip-build has nothing to skip. Drop it.`);if(t.arch!==void 0)throw Error("gjsify ship: --arch is decided when the stage is assembled, not when it is packed: the launcher, the payload and the recorded target were all fixed then. Pass --arch to `gjsify ship --stage`, and use `--expect-target <os>-<arch>` here to assert which leg you are packing.");if(t.os!==void 0)throw Error(`gjsify ship: the layout is decided when the stage is assembled, so "${t.os}" has nothing to change here — the staged tree already IS one OS's layout. Use \`--expect-target <os>-<arch>\` to assert which one you are packing.`);let S=process.cwd(),C=vn(S,n),N=readStageManifest(C);assertExpectedTarget(N,t[`expect-target`]);let F=layoutForOs(N.target.os);t.target===void 0&&assertPackable(N.formats.map(t=>$V[t]),F,`stage`,defaultFormatIds(F.os).map(t=>$V[t]).filter(t=>!t.interpreters.includes(N.settings.app)));let I=resolveFormats(t.target??N.formats,F);assertFormatsStaged(N,I);for(let t of I)assertCanPack(t);let H=resolveSignPlan({flag:t.sign,layoutOs:F.os}),W=resolveNotaryPlan({flag:t.notarize,layoutOs:F.os,sign:H});announceSigning(H,W),H.kind===`sign`&&assertHostCanSign(H.signer);for(let t of warnOnToolSkew(N))ge.warn(`${KH} ${t}`);let{mtime:q,warnings:Y}=resolveStageMtime(N);for(let t of Y)ge.warn(`${KH} ${t}`);if(ge.log(`${KH} packing ${N.settings.binaryName} ${N.settings.version}-${N.settings.release} for ${formatTarget(N.target)} from ${Sn(S,C)||`.`}/`),t.verbose){for(let t of N.staged)ge.log(`${KH} ${t.path}`);ge.log(`${KH} gi namespaces: ${N.namespaces.join(`, `)||`(none)`}`),(N.optionalNamespaces??[]).length>0&&ge.log(`${KH} gi optional namespaces: ${N.optionalNamespaces?.join(`, `)}`)}let X=t.out===void 0?wn(C):vn(S,t.out),Z=[];for(let n of I){if(assertFormatCanRunInterpreter(n,N.settings.app),n.depends!==null){let t=N.settings.app===`node`?warnAboutNodeFloor(n.depends,N.settings.minNodeVersion):warnAboutGjsFloor(n.depends,N.settings.minGjsVersion);for(let n of t)ge.warn(`${KH} ${n}`)}Z.push(await packOne({format:n,settings:N.settings,arch:N.target.arch,staged:N.staged,overlay:overlayFiles(N,n.id),stageDir:C,outRoot:X,namespaces:N.namespaces,optionalNamespaces:N.optionalNamespaces??[],mtime:q,sign:H,notarize:W,verbose:t.verbose}))}printArtifacts(S,Z)}async function packOne(t){let{format:n,settings:S,stageDir:C,outRoot:N,mtime:F}=t;assertOverlayIsLicensed(n.id,S.binaryName,t.overlay);let I=xn(N,`overlay`,n.id);writeStage(I,t.overlay);let H=readStage([C,I],[...t.staged,...t.overlay]),W=readPayloadFacts(H),q=n.depends===null?{requires:[],recommends:[],unmappedOptional:[]}:deriveDepends(n.depends,{namespaces:t.namespaces,optionalNamespaces:t.optionalNamespaces,hasIcons:W.hasIcons,hasSchemas:W.hasSchemas,interpreter:S.app,extra:S.extraDepends[n.depends],typelibPackages:S.typelibPackages,bundledTypelibs:W.bundledTypelibs,minGjsVersion:S.minGjsVersion,minNodeVersion:S.minNodeVersion}),Y=q.requires,X=q.recommends;assertPayloadMatchesArch(H,t.arch);let Z=layoutForOs(n.layoutOs);assertLauncherMatchesInterpreter(H,Z,S,S.app),assertLayoutSupportsArch(Z,t.arch);let te=t.sign.kind===`sign`?await signPayload({payload:H,identity:t.sign.identity,signer:t.sign.signer,workDir:xn(N,`signed`,n.id),bundleRoot:Z.root(S),entitlementsPath:xn(N,`signed`,`${n.id}.entitlements.plist`),verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}):H,ne=n.archName(t.arch,isArchIndependent(te)),re={settings:S,payload:te,prefix:n.prefix,depends:Y,recommends:X,archLabel:ne,mtime:F},ie=xn(N,`out`);mkdirSync(ie,{recursive:!0});let ae=xn(ie,n.fileName(S,ne));switch(n.id){case`deb`:writeFileSync(ae,await buildDeb(re));break;case`rpm`:writeFileSync(ae,await buildRpm(re));break;case`flatpak`:await buildFlatpakBundle({settings:S,stageDir:C,overlayDir:I,stageManifestFile:SH,workDir:xn(N,`flatpak`),target:ae,archLabel:ne,verbose:t.verbose});break;case`appimage`:{let n=appImageHostRequirements({app:S.app,minGjsVersion:S.minGjsVersion,minNodeVersion:S.minNodeVersion,namespaces:t.namespaces,optionalNamespaces:t.optionalNamespaces,bundledTypelibs:W.bundledTypelibs}),C=appDirFor(N),I=appDirPayload(S,te,n,await compileSchemasForPayload({payload:te,workDir:xn(N,`appimage-schemas`)}));writePayload(C,I,``),stampAppDirTimes(C,I,F),ge.log(`${KH} the AppImage takes these from the host: ${n.join(`, `)}`);let H=findPinnedRuntime(ne);ge.log(`${KH} ${appImageRuntimeNotice(ne,H)}`),await buildAppImage({appDir:C,target:ae,archLabel:ne,runtimeFile:H,workDir:wn(C),verbose:t.verbose});break}case`macos-app`:case`windows-dir`:writePayload(ae,te,Z.root(S));break;case`macos-app-dmg`:{let n=dmgVolumeDir(N);writePayload(n,te,``),await buildDmgImage({volumeName:dmgVolumeName(S),sourceDir:n,target:ae,workDir:wn(n),verbose:t.verbose});break}case`macos-app-zip`:writeFileSync(ae,buildZip(zipEntriesFromPayload(te),F));break;case`windows-dir-zip`:writeFileSync(ae,buildZip(zipEntriesFromPayload(te,windowsProgramDirName(S)),F));break;case`msi`:{let n=xn(N,`msi`);writePayload(xn(n,aH),te,Z.root(S)),await buildMsi({settings:S,files:te.map(t=>({path:t.path,source:`${aH}/${t.path}`})),programDirName:windowsProgramDirName(S),archLabel:ne,workDir:n,target:ae,verbose:t.verbose});break}default:{let t=n.id;throw Error(`gjsify ship: no packer is wired for format "${String(t)}".`)}}let oe=n.artifactKind===`directory`?directorySize(ae):statSync(ae).size;return t.notarize.kind===`notarize`&&(n.artifactKind===`directory`?ge.warn(`${KH} ${n.id} is a directory, and notarytool submits an archive or an installer — not notarised. The container format beside it is what carries the ticket.`):(await notarizeArtifact({plan:t.notarize,artifact:ae,verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}),canCarryTicket(n.id)?await stapleArtifact({notary:t.notarize.notary,artifact:ae,verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}):ge.warn(`${KH} ${n.id} is notarised and NOT stapled: \`stapler\` takes a UDIF image, a signed flat package or a code-signed bundle, and an archive is none of them. Apple's remedy is to staple each item that went INTO the archive and re-create it — for this artifact that is the \`.app\`, which \`--target macos-app\` writes beside it.`))),{format:n.id,path:ae,size:oe}}function printArtifacts(t,n){for(let S of n)ge.log(`${KH} ${S.format}: ${Sn(t,S.path)} (${S.size} bytes)`)}function assertCanPack(t){assertHostCanFinish(t),assertToolsInstalled(t)}function assertPackable(t,n,S,C=[]){if(t.length>0)return;if(C.length>0)throw Error(`gjsify ship: ${C.map(t=>t.id).join(` and `)} wrap the ${n.name} layout, and neither can run this project — ${C[0]?.interpreterGap??``}.\n Set \`gjsify.ship.app.${n.os}\` to "${C[0]?.interpreters.join(`" / "`)}" — it overrides \`gjsify.app\` for THIS target and\n leaves every other one alone, which is what lets one project be GJS on Linux and Node here.
|
|
1163
|
+
`)]},{tag:zH.BUILDTIME,type:4,value:[t.mtime]},{tag:zH.BUILDHOST,type:6,value:`localhost`},{tag:zH.SIZE,type:4,value:[n.reduce((t,n)=>t+n.data.byteLength,0)]},{tag:zH.LICENSE,type:6,value:N.license},{tag:zH.GROUP,type:9,value:[N.group]},{tag:zH.OS,type:6,value:`linux`},{tag:zH.ARCH,type:6,value:t.archLabel},{tag:zH.SOURCERPM,type:6,value:`${N.binaryName}-${F}.src.rpm`},{tag:zH.RPMVERSION,type:6,value:`4.20.0`},{tag:zH.ENCODING,type:6,value:`utf-8`},{tag:zH.FILESIZES,type:4,value:n.map(t=>t.data.byteLength)},{tag:zH.FILEMODES,type:3,value:n.map(t=>t.mode)},{tag:zH.FILERDEVS,type:3,value:n.map(()=>0)},{tag:zH.FILEMTIMES,type:4,value:n.map(()=>t.mtime)},{tag:zH.FILEDIGESTS,type:8,value:n.map(t=>t.isDirectory?``:hashHex(`sha256`,t.data))},{tag:zH.FILELINKTOS,type:8,value:n.map(()=>``)},{tag:zH.FILEFLAGS,type:4,value:n.map(()=>0)},{tag:zH.FILEUSERNAME,type:8,value:n.map(()=>`root`)},{tag:zH.FILEGROUPNAME,type:8,value:n.map(()=>`root`)},{tag:zH.FILEVERIFYFLAGS,type:4,value:n.map(()=>4294967295)},{tag:zH.FILEDEVICES,type:4,value:n.map(()=>1)},{tag:zH.FILEINODES,type:4,value:n.map((t,n)=>n+1)},{tag:zH.FILELANGS,type:8,value:n.map(()=>``)},{tag:zH.FILEDIGESTALGO,type:4,value:[HH]},{tag:zH.DIRINDEXES,type:4,value:H},{tag:zH.BASENAMES,type:8,value:W},{tag:zH.DIRNAMES,type:8,value:I},{tag:zH.PROVIDENAME,type:8,value:[N.binaryName]},{tag:zH.PROVIDEFLAGS,type:4,value:[VH.EQUAL]},{tag:zH.PROVIDEVERSION,type:8,value:[F]},{tag:zH.REQUIRENAME,type:8,value:Y.names},{tag:zH.REQUIREFLAGS,type:4,value:Y.flags},{tag:zH.REQUIREVERSION,type:8,value:Y.versions},...X.names.length>0?[{tag:zH.RECOMMENDNAME,type:8,value:X.names},{tag:zH.RECOMMENDFLAGS,type:4,value:X.flags},{tag:zH.RECOMMENDVERSION,type:8,value:X.versions}]:[],{tag:zH.PAYLOADFORMAT,type:6,value:`cpio`},{tag:zH.PAYLOADCOMPRESSOR,type:6,value:`gzip`},{tag:zH.PAYLOADFLAGS,type:6,value:`9`},{tag:zH.PAYLOADDIGEST,type:8,value:[hashHex(`sha256`,C)]},{tag:zH.PAYLOADDIGESTALGO,type:4,value:[HH]},{tag:zH.PAYLOADDIGESTALT,type:8,value:[hashHex(`sha256`,S)]}];return assertParallelFileArrays(Z,n.length),N.homepage&&Z.push({tag:zH.URL,type:6,value:N.homepage}),q.post!==void 0&&(Z.push({tag:zH.POSTIN,type:6,value:q.post}),Z.push({tag:zH.POSTINPROG,type:6,value:`/bin/sh`})),q.postun!==void 0&&(Z.push({tag:zH.POSTUN,type:6,value:q.postun}),Z.push({tag:zH.POSTUNPROG,type:6,value:`/bin/sh`})),Z}function assertParallelFileArrays(t,n){let S=new Set([zH.FILESIZES,zH.FILEMODES,zH.FILERDEVS,zH.FILEMTIMES,zH.FILEDIGESTS,zH.FILELINKTOS,zH.FILEFLAGS,zH.FILEUSERNAME,zH.FILEGROUPNAME,zH.FILEVERIFYFLAGS,zH.FILEDEVICES,zH.FILEINODES,zH.FILELANGS,zH.DIRINDEXES,zH.BASENAMES]);for(let C of t){if(!S.has(C.tag))continue;let t=Array.isArray(C.value)?C.value.length:1;if(t!==n)throw Error(`gjsify ship: internal error — rpm tag ${C.tag} has ${t} values for ${n} files.`)}}function buildRequires(t,n,S){let C=[],N=[],F=[];for(let n of t){let t=parseDepend(n);C.push(t.name),N.push(senseFor(t.relation)),F.push(t.version??``)}n.post!==void 0&&(C.push(`/bin/sh`),N.push(VH.INTERP|VH.SCRIPT_POST),F.push(``)),n.postun!==void 0&&(C.push(`/bin/sh`),N.push(VH.INTERP|VH.SCRIPT_POSTUN),F.push(``));for(let t of S)C.push(t),N.push(VH.FIND_REQUIRES),F.push(``);for(let[t,n]of UH)C.push(t),N.push(VH.RPMLIB|VH.LESS|VH.EQUAL),F.push(n);return{names:C,flags:N,versions:F}}function buildRecommends(t){let n=[],S=[],C=[];for(let N of t){let t=parseDepend(N);n.push(t.name),S.push(senseFor(t.relation)),C.push(t.version??``)}return{names:n,flags:S,versions:C}}function senseFor(t){switch(t){case`>=`:return VH.GREATER|VH.EQUAL;case`>`:return VH.GREATER;case`<=`:return VH.LESS|VH.EQUAL;case`<`:return VH.LESS;case`=`:return VH.EQUAL;default:return 0}}function hashHex(t,n){return createHash(t).update(n).digest(`hex`)}function hashBytes(t,n){return new Uint8Array(createHash(t).update(n).digest())}var zH,BH,VH,HH,UH,WH,GH=__esmMin(()=>{Yc(),Rz(),NH(),Xz(),eV(),RH(),Zz(),eB(),$z(),zH={HEADERI18NTABLE:100,NAME:1e3,VERSION:1001,RELEASE:1002,SUMMARY:1004,DESCRIPTION:1005,BUILDTIME:1006,BUILDHOST:1007,SIZE:1009,LICENSE:1014,GROUP:1016,URL:1020,OS:1021,ARCH:1022,POSTIN:1024,POSTUN:1026,FILESIZES:1028,FILEMODES:1030,FILERDEVS:1033,FILEMTIMES:1034,FILEDIGESTS:1035,FILELINKTOS:1036,FILEFLAGS:1037,FILEUSERNAME:1039,FILEGROUPNAME:1040,SOURCERPM:1044,FILEVERIFYFLAGS:1045,PROVIDENAME:1047,REQUIREFLAGS:1048,REQUIRENAME:1049,REQUIREVERSION:1050,RECOMMENDNAME:5046,RECOMMENDVERSION:5047,RECOMMENDFLAGS:5048,RPMVERSION:1064,POSTINPROG:1086,POSTUNPROG:1088,FILEDEVICES:1095,FILEINODES:1096,FILELANGS:1097,PROVIDEFLAGS:1112,PROVIDEVERSION:1113,DIRINDEXES:1116,BASENAMES:1117,DIRNAMES:1118,PAYLOADFORMAT:1124,PAYLOADCOMPRESSOR:1125,PAYLOADFLAGS:1126,FILEDIGESTALGO:5011,ENCODING:5062,PAYLOADDIGEST:5092,PAYLOADDIGESTALGO:5093,PAYLOADDIGESTALT:5097},BH={SIZE:1e3,MD5:1004,PAYLOADSIZE:1007,SHA1HEADER:269,SHA256HEADER:273},VH={LESS:2,GREATER:4,EQUAL:8,INTERP:256,SCRIPT_POST:1024,SCRIPT_POSTUN:4096,FIND_REQUIRES:16384,RPMLIB:1<<24},HH=8,UH=[[`rpmlib(CompressedFileNames)`,`3.0.4-1`],[`rpmlib(FileDigests)`,`4.6.0-1`],[`rpmlib(PayloadFilesHavePrefix)`,`4.0-1`]],WH=new Set([`/usr`,`/usr/bin`,`/usr/lib`,`/usr/lib64`,`/usr/libexec`,`/usr/sbin`,`/usr/share`,`/usr/${Qz.applications}`,`/usr/share/doc`,`/usr/share/icons`,`/usr/share/licenses`,`/usr/share/man`,`/usr/${Qz.metainfo}`,`/usr/share/glib-2.0`,`/usr/${Qz.schemas}`,`/usr/${Qz.fonts}`,`/etc`,`/opt`,`/var`])});async function assemble(t){let n=process.cwd(),S=t.os===void 0?hostLayout():resolveLayout(t.os),C=await new Config().forCommand(n),N=C.ship??{},F=C.flatpak??{},I=resolveShipApp({project:C.app,perTarget:N.app,layoutOs:S.os}),H=I.app;I.overridden&&ge.log(`${KH} runtime for ${S.name}: ${H} — \`${I.key}\` overrides \`gjsify.app${C.app===void 0?``:`: "${C.app}"`}\`.`);let W=readPackageJson$2(xn(n,`package.json`))??{},q,Y=[];if(t.target!==void 0)q=resolveFormats(t.target,S);else if(N.targets!==void 0){let t=configuredFormats(N.targets,S);q=t.formats,t.dropped.length>0&&ge.log(`${KH} \`gjsify.ship.targets\` names ${t.dropped.join(`, `)}, which wrap another layout — not built for ${S.name}. Pass --target to ask for one explicitly.`)}else{let t=defaultFormatIds(S.os).map(t=>$V[t]);q=t.filter(t=>t.interpreters.includes(H)),Y=t.filter(t=>!t.interpreters.includes(H)),Y.length>0&&ge.log(`${KH} ${Y.map(t=>t.id).join(`, `)} wrap the ${S.name} layout but cannot run \`${H}\`, which \`${I.key}\` resolves to — ${Y[0]?.interpreterGap??``}. Set \`gjsify.ship.app.${S.os}\` to "${Y[0]?.interpreters.join(`" / "`)}" to ship this OS on that runtime; it leaves every other target on \`gjsify.app\`. Assembling the layout only; pass --target to be told the same thing as an error.`)}q.some(t=>t.id===`flatpak`)&&assertNoDroppedFlatpakModules(F),t.stage||assertPackable(q,S,t.os===void 0?`host`:`positional`,Y);let X=resolveSignPlan({flag:t.sign,config:N.sign,layoutOs:S.os}),Z=resolveNotaryPlan({flag:t.notarize,layoutOs:S.os,sign:X});if(t.stage&&assertNothingToSignYet(t),t.stage||(announceSigning(X,Z),X.kind===`sign`&&assertHostCanSign(X.signer)),t.stage||assertKindCanPack(q,resolveShipKind(N,F)),!t.stage)for(let t of q)assertCanPack(t);let te=parseDeclaredChannel(t.channel,`--channel`)??parseDeclaredChannel(N.channel,`gjsify.ship.channel`)??(q.some(t=>t.id===`flatpak`)?`flathub`:void 0);t[`skip-build`]||await runProjectBuild(n,te);let ne=resolveShipBundle({pkg:W,ship:N,layoutOs:S.os});ne.overridden&&ge.log(`${KH} entry for ${S.name}: ${ne.declared} — \`${ne.key}\` overrides \`gjsify.main\`.`);let re=discoverPayload({projectDir:n,pkg:W,ship:N,flatpakIcon:F.icon,declaredBundle:ne.declared,layoutOs:S.os,foreignBundles:ne.foreign}),{settings:ie,metadata:ae,warnings:oe}=resolveShipSettings({projectDir:n,pkg:W,ship:N,flatpak:F,cli:{outDir:t.out,arch:t.arch,layoutOs:S.os},discovered:re,app:H});for(let t of oe)ge.warn(`${KH} ${t}`);for(let t of q)assertFormatCanRunInterpreter(t,ie.app);let Q=readFileSync(ie.bundlePath,`utf-8`);assertEntryRunsUnder({interpreter:ie.app,source:Q,entry:Sn(n,ie.bundlePath)||ie.bundlePath,appKey:I.key,bundleKey:ne.key,layoutOs:S.os});let se=buildTimestamp(ie.bundlePath),ce={appId:ie.appId,name:ie.name,command:ie.binaryName,kind:ie.kind,metadata:ae,channel:te,configKey:`gjsify.ship`,copyrightYear:new Date(se*1e3).getUTCFullYear()};for(let t of validateAppMetadata(ce))ge.warn(`${KH} ${t.field} is not set — ${t.hint}`);ie.licenseFile!==void 0&&wn(ie.licenseFile)!==n&&ge.log(`${KH} licence text from ${Sn(n,ie.licenseFile)} (this package carries none of its own)`);let le=localizeMetadata({metainfo:ie.kind===`app`?renderMetainfoApp$1(ce):renderMetainfoCli$1(ce),desktopEntry:ie.kind===`app`?renderDesktopEntry(ce):void 0},ie.localeFiles),ue=resolveCarriedRuntime(S,ie,n),de={bundleFiles:re.bundleFiles,launcher:renderLauncher(ie,Tn(ie.bundlePath),S,ue.launcher),metainfo:le.metainfo,desktopEntry:le.desktopEntry,licenseText:ie.licenseFile===void 0?void 0:readFileSync(ie.licenseFile,`utf-8`),changelogText:ie.changelogFile===void 0?void 0:readFileSync(ie.changelogFile,`utf-8`),mtime:se},fe=vn(n,ie.outDir),pe=xn(fe,`stage`),me=[...planStage(ie,de),...S.os===`linux`?[]:await compileSchemasForStage({schemaFiles:ie.schemaFiles,workDir:xn(fe,`schemas`)})],he=ie.kind===`app`&&S.icon!==void 0?await resolveAppIcon({iconFiles:ie.iconFiles,appId:ie.appId,sizes:S.icon.sizes,target:S.icon.writes}):void 0;he!==void 0&&ge.log(`${KH} icon: ${iconSizes(he).join(`/`)} px, ${he.source}`);let _e=placeStage(S,{...ie,icon:he},me,ue.files);if(writeStage(pe,_e),ge.log(`${KH} staged ${_e.length} file(s) for ${S.name} in ${Sn(n,pe)}/`),t.verbose)for(let t of _e)ge.log(`${KH} ${t.path}`);if(assertPayloadMatchesArch(readStage([pe],_e),ie.arch),S.os!==`linux`){let t=linuxInstallDependent(me);if(t.length>0){ge.warn(`${KH} the ${S.name} layout carries ${t.length} file(s) whose Linux correctness comes from a package install step it has no equivalent for:`);let n={aborts:`ABORTS: `,unknown:`UNCLASSIFIED: `,inert:``};for(let{path:S,verdict:C,why:N}of t)ge.warn(`${KH} ${n[C]??``}${S} — ${N}`)}for(let t of ue.found)ge.log(`${KH} carries its own ${t}`);for(let t of ue.missing)ge.warn(`${KH} ${t}`);ue.launcher.interpreter===void 0&&S.runtimeGap!==void 0&&ge.warn(`${KH} ${S.runtimeGap}`),S.fontGap!==void 0&&me.some(t=>isUnder(t.path,Qz.fonts))&&ge.warn(`${KH} ${S.fontGap}`),S.arches!==null&&!S.arches.only.includes(ie.arch)&&ge.warn(`${KH} this stage is labelled ${ie.arch} and the ${S.name} layout has no runtime for it — ${S.arches.why}. Nothing can pack this stage; \`--arch ${S.arches.only.join(`|`)}\` is what produces an artifact.`)}let ve=scanGiRequirements(Q),ye=ve.namespaces,be=ve.optional;if(t.verbose){let t=ye.filter(t=>!be.includes(t));ge.log(`${KH} gi namespaces: ${ye.join(`, `)||`(none)`}`),be.length>0&&(ge.log(`${KH} gi optional namespaces: ${be.join(`, `)}`),ge.log(`${KH} gi required namespaces: ${t.join(`, `)||`(none)`}`))}let xe=new Map;for(let t of q)xe.set(t.id,(await planOverlay(ie,t,de)).map(t=>({...t,path:place(S,ie,t.path)})));let Se=readPayloadFacts(me);for(let t of q){if(t.depends===null)continue;let n=deriveDepends(t.depends,{namespaces:ye,optionalNamespaces:be,hasIcons:Se.hasIcons,hasSchemas:Se.hasSchemas,interpreter:ie.app,extra:ie.extraDepends[t.depends],typelibPackages:ie.typelibPackages,bundledTypelibs:Se.bundledTypelibs,minGjsVersion:ie.minGjsVersion,minNodeVersion:ie.minNodeVersion});for(let S of n.unmappedOptional)ge.warn(`${KH} gi://${S} is imported optionally, but no ${t.depends} package is known to ship its typelib, so no Recommends entry names it. The package builds and runs without it. Add the row if the namespace should be recommended: \`gjsify.ship.typelibPackages.${S} = { "${t.depends}": "…" }\`.`);let S=ie.app===`node`?warnAboutNodeFloor(t.depends,ie.minNodeVersion):warnAboutGjsFloor(t.depends,ie.minGjsVersion);for(let t of S)ge.warn(`${KH} ${t}`)}let Ce=writeStageManifest({stageDir:pe,settings:ie,formats:q,mtime:se,namespaces:ye,optionalNamespaces:be,staged:_e,overlay:xe});if(t.stage){let t=Y.length>0?`(none — ${Y.map(t=>t.id).join(` and `)} need \`gjsify.ship.app.${S.os}: "node"\`)`:formatIdsFor(S.os).length===0?`(none — no format wraps the ${S.name} layout)`:`(none asked for)`,n=Ce.formats.join(`, `)||t;ge.log(`${KH} stage manifest: ${formatTarget(Ce.target)}, formats ${n}`);return}let we=[];for(let n of q)we.push(await packOne({format:n,settings:ie,arch:ie.arch,staged:_e,overlay:xe.get(n.id)??[],stageDir:pe,outRoot:fe,namespaces:ye,optionalNamespaces:be,mtime:se,sign:X,notarize:Z,verbose:t.verbose}));printArtifacts(n,we)}function assertNothingToSignYet(t){let n=t.sign===void 0?t.notarize===void 0?void 0:`--notarize`:`--sign`;if(n!==void 0)throw Error(`gjsify ship: ${n} belongs to the finish phase, and --stage produces no artifact to sign — it writes the tree a packing host reads back. Assemble here, then run \`gjsify ship --from-stage <dir> --sign <identity>\` on the host that holds the identity (ADR 0024 § A2, § A14).`)}function announceSigning(t,n){t.kind===`skip`&&ge.warn(`${KH} ${t.message}`),n.kind===`skip`&&t.kind===`sign`&&ge.warn(`${KH} ${n.message}`)}function resolveCarriedRuntime(t,n,S){let C={files:[],launcher:{},found:[],missing:[]};if(t.os===`linux`||n.app!==`node`)return C;let N=`${t.os}-${n.arch}`;return isGtkRuntimeTarget(N)?stageAppRuntime({layout:t,identity:n,target:N,cwd:S,interpreter:isNodeRuntimeTarget(N)?resolveNodeRuntime(N,{cwd:S}):null}):C}async function finishFromStage(t,n){if(t.stage)throw Error("gjsify ship: --stage and --from-stage are the two halves of one split and cannot run together. `--stage` assembles a payload and stops; `--from-stage <dir>` packs one that is already assembled. Run them as two commands, on the host each belongs on (ADR 0024 § A2).");if(t[`skip-build`])throw Error(`gjsify ship: --from-stage never runs a build — the payload it packs was built and staged by an earlier run — so --skip-build has nothing to skip. Drop it.`);if(t.arch!==void 0)throw Error("gjsify ship: --arch is decided when the stage is assembled, not when it is packed: the launcher, the payload and the recorded target were all fixed then. Pass --arch to `gjsify ship --stage`, and use `--expect-target <os>-<arch>` here to assert which leg you are packing.");if(t.os!==void 0)throw Error(`gjsify ship: the layout is decided when the stage is assembled, so "${t.os}" has nothing to change here — the staged tree already IS one OS's layout. Use \`--expect-target <os>-<arch>\` to assert which one you are packing.`);let S=process.cwd(),C=vn(S,n),N=readStageManifest(C);assertExpectedTarget(N,t[`expect-target`]);let F=layoutForOs(N.target.os);t.target===void 0&&assertPackable(N.formats.map(t=>$V[t]),F,`stage`,defaultFormatIds(F.os).map(t=>$V[t]).filter(t=>!t.interpreters.includes(N.settings.app)));let I=resolveFormats(t.target??N.formats,F);assertFormatsStaged(N,I);for(let t of I)assertCanPack(t);let H=resolveSignPlan({flag:t.sign,layoutOs:F.os}),W=resolveNotaryPlan({flag:t.notarize,layoutOs:F.os,sign:H});announceSigning(H,W),H.kind===`sign`&&assertHostCanSign(H.signer);for(let t of warnOnToolSkew(N))ge.warn(`${KH} ${t}`);let{mtime:q,warnings:Y}=resolveStageMtime(N);for(let t of Y)ge.warn(`${KH} ${t}`);if(ge.log(`${KH} packing ${N.settings.binaryName} ${N.settings.version}-${N.settings.release} for ${formatTarget(N.target)} from ${Sn(S,C)||`.`}/`),t.verbose){for(let t of N.staged)ge.log(`${KH} ${t.path}`);ge.log(`${KH} gi namespaces: ${N.namespaces.join(`, `)||`(none)`}`),(N.optionalNamespaces??[]).length>0&&ge.log(`${KH} gi optional namespaces: ${N.optionalNamespaces?.join(`, `)}`)}let X=t.out===void 0?wn(C):vn(S,t.out),Z=[];for(let n of I){if(assertFormatCanRunInterpreter(n,N.settings.app),n.depends!==null){let t=N.settings.app===`node`?warnAboutNodeFloor(n.depends,N.settings.minNodeVersion):warnAboutGjsFloor(n.depends,N.settings.minGjsVersion);for(let n of t)ge.warn(`${KH} ${n}`)}Z.push(await packOne({format:n,settings:N.settings,arch:N.target.arch,staged:N.staged,overlay:overlayFiles(N,n.id),stageDir:C,outRoot:X,namespaces:N.namespaces,optionalNamespaces:N.optionalNamespaces??[],mtime:q,sign:H,notarize:W,verbose:t.verbose}))}printArtifacts(S,Z)}async function packOne(t){let{format:n,settings:S,stageDir:C,outRoot:N,mtime:F}=t;assertOverlayIsLicensed(n.id,S.binaryName,t.overlay);let I=xn(N,`overlay`,n.id);writeStage(I,t.overlay);let H=readStage([C,I],[...t.staged,...t.overlay]),W=readPayloadFacts(H),q=n.depends===null?{requires:[],recommends:[],unmappedOptional:[]}:deriveDepends(n.depends,{namespaces:t.namespaces,optionalNamespaces:t.optionalNamespaces,hasIcons:W.hasIcons,hasSchemas:W.hasSchemas,interpreter:S.app,extra:S.extraDepends[n.depends],typelibPackages:S.typelibPackages,bundledTypelibs:W.bundledTypelibs,minGjsVersion:S.minGjsVersion,minNodeVersion:S.minNodeVersion}),Y=q.requires,X=q.recommends;assertPayloadMatchesArch(H,t.arch);let Z=layoutForOs(n.layoutOs);assertLauncherMatchesInterpreter(H,Z,S,S.app),assertLayoutSupportsArch(Z,t.arch);let te=t.sign.kind===`sign`?await signPayload({payload:H,identity:t.sign.identity,signer:t.sign.signer,workDir:xn(N,`signed`,n.id),bundleRoot:Z.root(S),entitlementsPath:xn(N,`signed`,`${n.id}.entitlements.plist`),verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}):H,ne=n.archName(t.arch,isArchIndependent(te)),re={settings:S,payload:te,prefix:n.prefix,depends:Y,recommends:X,archLabel:ne,mtime:F},ie=xn(N,`out`);mkdirSync(ie,{recursive:!0});let ae=xn(ie,n.fileName(S,ne));switch(n.id){case`deb`:writeFileSync(ae,await buildDeb(re));break;case`rpm`:writeFileSync(ae,await buildRpm(re));break;case`flatpak`:await buildFlatpakBundle({settings:S,stageDir:C,overlayDir:I,stageManifestFile:SH,workDir:xn(N,`flatpak`),target:ae,archLabel:ne,verbose:t.verbose});break;case`appimage`:{let n=appImageHostRequirements({app:S.app,minGjsVersion:S.minGjsVersion,minNodeVersion:S.minNodeVersion,namespaces:t.namespaces,optionalNamespaces:t.optionalNamespaces,bundledTypelibs:W.bundledTypelibs}),C=appDirFor(N),I=appDirPayload(S,te,n,await compileSchemasForPayload({payload:te,workDir:xn(N,`appimage-schemas`)}));writePayload(C,I,``),stampAppDirTimes(C,I,F),ge.log(`${KH} the AppImage takes these from the host: ${n.join(`, `)}`);let H=findPinnedRuntime(ne);ge.log(`${KH} ${appImageRuntimeNotice(ne,H)}`),await buildAppImage({appDir:C,target:ae,archLabel:ne,runtimeFile:H,workDir:wn(C),verbose:t.verbose});break}case`macos-app`:case`windows-dir`:writePayload(ae,te,Z.root(S));break;case`macos-app-dmg`:{let n=dmgVolumeDir(N);writePayload(n,te,``),await buildDmgImage({volumeName:dmgVolumeName(S),sourceDir:n,target:ae,workDir:wn(n),verbose:t.verbose});break}case`macos-app-zip`:writeFileSync(ae,buildZip(zipEntriesFromPayload(te),F));break;case`windows-dir-zip`:writeFileSync(ae,buildZip(zipEntriesFromPayload(te,windowsProgramDirName(S)),F));break;case`msi`:{let n=xn(N,`msi`);writePayload(xn(n,aH),te,Z.root(S)),await buildMsi({settings:S,files:te.map(t=>({path:t.path,source:`${aH}/${t.path}`})),programDirName:windowsProgramDirName(S),archLabel:ne,workDir:n,target:ae,verbose:t.verbose});break}default:{let t=n.id;throw Error(`gjsify ship: no packer is wired for format "${String(t)}".`)}}let oe=n.artifactKind===`directory`?directorySize(ae):statSync(ae).size;return t.notarize.kind===`notarize`&&(n.artifactKind===`directory`?ge.warn(`${KH} ${n.id} is a directory, and notarytool submits an archive or an installer — not notarised. The container format beside it is what carries the ticket.`):(await notarizeArtifact({plan:t.notarize,artifact:ae,verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}),canCarryTicket(n.id)?await stapleArtifact({notary:t.notarize.notary,artifact:ae,verbose:t.verbose,log:t=>ge.log(`${KH} ${t}`)}):ge.warn(`${KH} ${n.id} is notarised and NOT stapled: \`stapler\` takes a UDIF image, a signed flat package or a code-signed bundle, and an archive is none of them. Apple's remedy is to staple each item that went INTO the archive and re-create it — for this artifact that is the \`.app\`, which \`--target macos-app\` writes beside it.`))),{format:n.id,path:ae,size:oe}}function printArtifacts(t,n){for(let S of n)ge.log(`${KH} ${S.format}: ${Sn(t,S.path)} (${S.size} bytes)`)}function assertCanPack(t){assertHostCanFinish(t),assertToolsInstalled(t)}function assertPackable(t,n,S,C=[]){if(t.length>0)return;if(C.length>0)throw Error(`gjsify ship: ${C.map(t=>t.id).join(` and `)} wrap the ${n.name} layout, and neither can run this project — ${C[0]?.interpreterGap??``}.\n Set \`gjsify.ship.app.${n.os}\` to "${C[0]?.interpreters.join(`" / "`)}" — it overrides \`gjsify.app\` for THIS target and\n leaves every other one alone, which is what lets one project be GJS on Linux and Node here.
|
|
1164
1164
|
\`gjsify ship ${n.name} --stage\` assembles the tree either way.`);let N=formatIdsFor(n.os).sort();if(N.length>0){let t=S===`stage`?`${n.name} --stage --target`:`${n.name} --target`;throw Error(`gjsify ship: this run records no formats for the ${n.name} layout, so there is nothing to pack — and it is not that none exist: ${N.join(`, `)} wrap it.\n An empty list means none were SELECTED. \`gjsify.ship.targets\` is filtered to the layout being assembled,
|
|
1165
1165
|
so a configured list naming only another OS's formats leaves this one empty and says so at stage time.
|
|
1166
1166
|
Name one where the payload is assembled: \`gjsify ship ${t} ${N[0]}\`.`)}let F=defaultFormatIds(`linux`).join(`,`),I={host:`This host is ${process.platform}, so \`gjsify ship\` assembled the ${n.name} layout. Assembly is not host-bound (ADR 0024 § A1), so the Linux packages are still one word away: \`gjsify ship linux\` builds ${F} from right here.`,positional:`\`gjsify ship ${n.name} --stage\` assembles the payload and stops, which is the whole of what this command does for that OS today.`,stage:`This stage carries the ${n.name} layout and nothing here can wrap it — a stage is a build intermediate, not an artifact. Keep it for the milestone that packs it, or re-assemble with \`gjsify ship linux --stage\` if a Linux package is what you wanted.`}[S];throw Error(`gjsify ship: no format wraps the ${n.name} layout, so there is nothing to pack. ${I} Every layout this gjsify knows has one (ADR 0024 stages 2-5), so this is a layout added without a \`FORMATS\` row.`)}function assertFormatCanRunInterpreter(t,n){if(!t.interpreters.includes(n))throw Error(`gjsify ship: this ${t.layoutOs} target runs \`${n}\`, and the ${t.id} runtime cannot run it — it provides ${t.interpreters.join(`, `)}.\n ${t.interpreterGap}.\n Build the formats that wrap this layout and can run it, or set \`gjsify.ship.app.${t.layoutOs}: "${t.interpreters.join(`" / "`)}"\` (which overrides \`gjsify.app\` for this target alone).`)}async function runProjectBuild(t,n){if(typeof readPackageJson$2(xn(t,`package.json`))?.scripts?.build!=`string`)throw Error("gjsify ship: this project has no `build` script to run. Add one, or pass --skip-build to package what is already built.");ge.log(`${KH} running the project's build script`);let S=await spawnToCompletion(`gjsify`,[`run`,`build`],{completion:`return`,cwd:t,stdio:`inherit`,env:n===void 0?void 0:{...process.env,[ih]:n},notFound:()=>Error("gjsify ship: `gjsify` is not on PATH, so the project build cannot be run. Build the project yourself and pass --skip-build.")});if(S.code!==0)throw Error(`gjsify ship: the project's build script failed with ${describeExit(S)}.`)}var KH,qH,JH=__esmMin(()=>{_e(),ah(),Fd(),jn(),sI(),az(),VP(),R_(),tV(),Xz(),DV(),gV(),IV(),zV(),rz(),BV(),aB(),VV(),nH(),zB(),vV(),$z(),WB(),oH(),mH(),_H(),bH(),eV(),CV(),DH(),OH(),GH(),fV(),CH(),wH(),KH=`[gjsify ship]`,qH={command:`ship [os]`,description:`Build installable artifacts (${eH.join(`, `)}) from the current project.`,builder:t=>t.positional(`os`,{type:`string`,description:`Operating system whose LAYOUT to assemble (${LB.join(`|`)}, ADR 0024 § A2). Default: this host. Assembly is not host-bound, so any of them can be staged anywhere.`}).option(`target`,{type:`string`,array:!0,description:`Formats to build, comma-separated or repeated. Default: every format wrapping the target OS's layout that needs no extra tooling — on linux, ${defaultFormatIds(`linux`).join(`,`)}. Also available for linux, and opt-in because it needs tooling this CLI does not carry: ${formatIdsFor(`linux`).filter(t=>!defaultFormatIds(`linux`).includes(t)).join(`, `)}.`}).option(`out`,{type:`string`,normalize:!0,description:"Output root, relative to the project. Default: `gjsify.ship.outDir`, else `ship`."}).option(`stage`,{type:`boolean`,default:!1,description:`Produce the staged payload and stop, without packing anything.`}).option(`from-stage`,{type:`string`,normalize:!0,description:"Pack a staged payload written by an earlier `--stage` run. Needs no project: the stage carries its own closure."}).option(`expect-target`,{type:`string`,description:"With --from-stage: refuse unless the stage was assembled for this `<os>-<arch>`, e.g. `linux-arm64`."}).option(`channel`,{type:`string`,choices:[...nh],description:"Distribution channel (ADR 0113). Overrides gjsify.ship.channel; `--target flatpak` implies flathub. Passed to the project build, and gates the metainfo donation URL."}).option(`skip-build`,{type:`boolean`,default:!1,description:"Package what is already built instead of running the project's `build` script."}).option(`arch`,{type:`string`,description:"Target architecture in `process.arch` spelling. Default: this host."}).option(`sign`,{type:`string`,requiresArg:!0,description:"Sign the payload with this identity, e.g. a Developer ID name or SHA-1 fingerprint. `-` signs ad-hoc and needs no developer identity. Default: `gjsify.ship.sign.<darwin|win32>.identity`; absent means unsigned, which is a legitimate output."}).option(`notarize`,{type:`string`,requiresArg:!0,description:"Submit the signed artifact to Apple with this `notarytool` keychain profile. Needs --sign; darwin only."}).option(`verbose`,{type:`boolean`,default:!1,description:`Print each staged file, the GI namespaces the bundle imports, and every tool a host-bound packer invokes.`}),handler:async t=>{if(t[`from-stage`]!==void 0)return await finishFromStage(t,t[`from-stage`]);await assemble(t)}}});function forceExit(t){if(process.exitCode=t,!gjsExit(t))return process.exit(t)}var YH=__esmMin(()=>{c_()});function workspaceLinkTarget(t,n){return XH===`junction`?vn(n):Sn(wn(t),n)}function applyPlatformConfigFromFlags(t){for(let[n,S]of[[`os`,`npm_config_os`],[`cpu`,`npm_config_cpu`],[`libc`,`npm_config_libc`]]){let C=t[n];if(typeof C!=`string`)continue;let N=C.trim();N!==``&&(process.env[S]=N)}t.force&&(process.env.npm_config_force=`true`)}function isAbortedFromOverallTimeout(t){if(!t||typeof t!=`object`)return!1;let n=t.name;if(n===`AbortError`)return!0;let S=t.message;return!!(typeof S==`string`&&S.includes(`install-overall-timeout`)||n===`RegistryTimeoutError`)}function readCliVersionFrom(t){try{if(!existsSync(t))return null;let n=JSON.parse(readFileSync(t,`utf-8`));if(n.name===$H&&typeof n.version==`string`)return n.version}catch{}return null}function readRunningCliVersion(){try{let t=wn(vn(fileURLToPath(import.meta.url)));for(let n=0;n<8&&t!==wn(t);n++){let n=readCliVersionFrom(xn(t,`package.json`));if(n)return n;t=wn(t)}}catch{}return null}function readWorkspaceCliVersion(t){let n=readPackageJson$1(xn(t,`package.json`)),S=!1;for(let t of[`dependencies`,`devDependencies`,`optionalDependencies`]){let C=n?.[t]?.[$H];typeof C==`string`&&(S=!0);let N=typeof C==`string`?/^[\^~=v]*(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/.exec(C.trim()):null;if(N)return N[1]}if(!S){let n=readCliVersionFrom(xn(t,`node_modules`,$H,`package.json`));if(n)return n}return readCliVersionFrom(xn(t,`packages`,`infra`,`cli`,`package.json`))}function warnOnCliVersionSkew(t){if(process.env.GJSIFY_NO_VERSION_SKEW_WARNING===`1`)return;let n=readRunningCliVersion(),S=readWorkspaceCliVersion(t);!n||!S||n===S||ge.warn(`gjsify install: version skew — you are running @gjsify/cli v${n}, but this workspace pins v${S}.\n A mismatched CLI can stall the install (lock discarded → full re-resolve) or silently produce a wrong build.\n Align them: run \`gjsify self-update\` (global CLI) or use the workspace-local \`node_modules/.bin/gjsify\`.\n Suppress this with GJSIFY_NO_VERSION_SKEW_WARNING=1.`)}function isWorkspaceRoot(t){let n=readPackageJson$1(xn(t,`package.json`));return n?n.workspaces!==void 0:!1}function optionalDependencyNames(t){let n=new Set,S=new Set;for(let C of t){let t=new Set(Object.keys(C.optionalDependencies??{}));for(let S of t)n.add(S);for(let n of[`dependencies`,`devDependencies`])for(let N of Object.keys(C[n]??{}))t.has(N)||S.add(N)}for(let t of S)n.delete(t);return n}function depKindFromArgs(t){return t[`save-dev`]?`devDependencies`:t[`save-peer`]?`peerDependencies`:t[`save-optional`]?`optionalDependencies`:`dependencies`}function activateDevLinks(t,n){let S=prepareDevLinks(devLinkRoot(t));if(!S)return null;let C=applyDevLinks(S.links);if(!n)return S;ge.log(`gjsify install: development link ACTIVE (${S.overridePath}) — ${S.links.length} package(s) come from ${S.checkout}, linked rather than fetched (${C.length} (re)written, ${S.links.length-C.length} already current):`);let N=S.links.map(t=>t.name),F=N.slice(0,12);return ge.log(` ${F.join(`, `)}${N.length>F.length?`, +${N.length-F.length} more`:``}`),ge.log(" `gjsify unlink` restores the registry copies; `gjsify install --immutable` refuses while it exists."),S}function reportRewiredDevLinks(t){if(!t)return;let n=applyDevLinks(t.links);n.length!==0&&ge.log(`gjsify install: re-applied ${n.length} development link(s) the install had replaced: ${n.map(t=>t.name).join(`, `)}`)}async function projectInstallNative(t,n){let S=process.cwd(),C=xn(S,`package.json`),N=[`.pnp.cjs`,`.pnp.loader.mjs`].filter(t=>existsSync(xn(S,t)));if(N.length>0)throw Error(`gjsify install uses the node_modules linker and cannot run in a Yarn PnP project (found ${N.join(`, `)} in ${S}).\n\n• If this project uses \`gjsify install\` to manage dependencies, these PnP files are stale residue from an earlier \`yarn install\` — remove them and re-run:\n rm -f .pnp.cjs .pnp.loader.mjs && rm -rf .yarn/cache .yarn/unplugged\n gjsify install\n\n• If instead you want Yarn to manage dependencies, set \`nodeLinker: node-modules\` in .yarnrc.yml and run \`yarn install\` (not \`gjsify install\`).`);if(!t.packages||t.packages.length===0){let C=isWorkspaceRoot(S)?S:findWorkspaceRoot(S);if(C){C!==S&&ge.log(`gjsify install: resolved workspace root ${C} (from ${S}); installing the workspace.`),await workspaceInstall(C,t,n);return}}let F,I=readPackageJson$1(C),H=I?projectSpecsFromPackageJson(I):[];if(t.packages&&t.packages.length>0){let n=new Set(t.packages.map(t=>parseSpec$2(t).name));F=[...H.filter(t=>!n.has(parseSpec$2(t).name)),...t.packages]}else{if(!I)throw Error(`gjsify install: no package.json in ${S}`);if(F=H,F.length===0){ge.log(`gjsify install: no dependencies declared in package.json — nothing to do.`);return}}mkdirSync(S,{recursive:!0});let W=makeProgressReporter({enabled:!t.verbose&&!t.quiet&&t.progress!==!1}),q=await acquireInstallLock(S,{signal:n});try{let N=activateDevLinks(S,!0),H=await installPackages({prefix:S,specs:F,verbose:t.verbose,lockfile:!t.immutable,frozen:t.immutable,refreshLockfile:t[`refresh-lockfile`],signal:n,progress:W,optionalSpecs:new Set([...optionalDependencyNames(I?[I]:[]),...t[`save-optional`]?(t.packages??[]).map(t=>parseSpec$2(t).name):[]]),linkedNames:N?.names});if(reportRewiredDevLinks(N),t.packages&&t.packages.length>0&&I){let n=depKindFromArgs(t);for(let S of t.packages){let{name:t,range:C}=parseSpec$2(S),N=H.installed.find(n=>n.name===t);addDependencyEntry(I,t,C??(N?defaultRangeFromVersion(N.version):`latest`),n)}writePackageJson(C,I),t.immutable||syncLockfileRequested(S,projectSpecsFromPackageJson(I))}}finally{q.release()}}function syncLockfileRequested(t,n){let S=xn(t,`gjsify-lock.json`);if(existsSync(S))try{let t=JSON.parse(readFileSync(S,`utf-8`)),C=[...n].sort(),N=[...t.requested??[]].sort();if(C.length===N.length&&C.every((t,n)=>t===N[n]))return;t.requested=n,atomicWriteStrict(S,JSON.stringify(t,null,2)+`
|
package/lib/commands/ship.js
CHANGED
|
@@ -332,6 +332,7 @@ async function assemble(args) {
|
|
|
332
332
|
ship,
|
|
333
333
|
flatpakIcon: flatpak.icon,
|
|
334
334
|
declaredBundle: resolvedBundle.declared,
|
|
335
|
+
layoutOs: layout.os,
|
|
335
336
|
foreignBundles: resolvedBundle.foreign,
|
|
336
337
|
});
|
|
337
338
|
const { settings, metadata, warnings } = resolveShipSettings({
|
|
@@ -564,8 +564,13 @@ export interface ConfigDataShip extends AppMetadata {
|
|
|
564
564
|
* The namespaces this covers are read back off the STAGED FILES, not from a separate list:
|
|
565
565
|
* a declaration that a namespace is bundled, without the file being there, is exactly the lie
|
|
566
566
|
* the dependency check exists to prevent.
|
|
567
|
+
*
|
|
568
|
+
* A flat list is staged for EVERY target. A TABLE names one list per OS, keyed like
|
|
569
|
+
* {@link ShipBundleOptions} and resolved the same way — by the LAYOUT being assembled. It exists
|
|
570
|
+
* because a prebuild is per-OS: a linux-x64 bridge `.so` staged into a `.app` is an ELF the
|
|
571
|
+
* bundle seal and `dlopen` both refuse. A target with no key stages nothing.
|
|
567
572
|
*/
|
|
568
|
-
bundledTypelibs?: string[];
|
|
573
|
+
bundledTypelibs?: string[] | ShipBundledTypelibsOptions;
|
|
569
574
|
/**
|
|
570
575
|
* Directory holding COMPILED gettext catalogues in the layout `bindtextdomain` reads —
|
|
571
576
|
* `<lang>/LC_MESSAGES/<domain>.mo` — e.g. `"dist/locale"`, which is what
|
|
@@ -668,6 +673,18 @@ export interface ShipBundleOptions {
|
|
|
668
673
|
/** The entry the Windows program directory carries. */
|
|
669
674
|
win32?: string;
|
|
670
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* `gjsify.ship.bundledTypelibs` as a table — the directories per OS, the twin of
|
|
678
|
+
* {@link ShipBundleOptions}.
|
|
679
|
+
*/
|
|
680
|
+
export interface ShipBundledTypelibsOptions {
|
|
681
|
+
/** Directories staged into `lib/<name>/gi` of a `.deb`/`.rpm`/Flatpak. */
|
|
682
|
+
linux?: string[];
|
|
683
|
+
/** Directories staged into `<App>.app` by `gjsify ship darwin`. */
|
|
684
|
+
darwin?: string[];
|
|
685
|
+
/** Directories staged into the Windows program directory. */
|
|
686
|
+
win32?: string[];
|
|
687
|
+
}
|
|
671
688
|
/**
|
|
672
689
|
* `gjsify.ship.sign` — an IDENTITY per OS, and never a certificate.
|
|
673
690
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ConfigDataShip } from '../../types/config-data.js';
|
|
1
|
+
import type { ConfigDataShip, ShipBundledTypelibsOptions } from '../../types/config-data.js';
|
|
2
2
|
import { type DiscoveredPayload, type ShipPackageManifest } from './settings.js';
|
|
3
|
+
import type { HostOs } from './types.js';
|
|
3
4
|
export interface DiscoverInput {
|
|
4
5
|
projectDir: string;
|
|
5
6
|
pkg: ShipPackageManifest;
|
|
@@ -8,6 +9,11 @@ export interface DiscoverInput {
|
|
|
8
9
|
flatpakIcon?: string;
|
|
9
10
|
/** The bundle path the project declares FOR THIS TARGET. */
|
|
10
11
|
declaredBundle?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The OS whose layout is being assembled. Only a `bundledTypelibs` TABLE needs it; a flat
|
|
14
|
+
* list is the same for every target.
|
|
15
|
+
*/
|
|
16
|
+
layoutOs?: HostOs;
|
|
11
17
|
/**
|
|
12
18
|
* The entries other targets declare, which this one must not carry.
|
|
13
19
|
*
|
|
@@ -19,6 +25,14 @@ export interface DiscoverInput {
|
|
|
19
25
|
foreignBundles?: readonly string[];
|
|
20
26
|
}
|
|
21
27
|
export declare function discoverPayload(input: DiscoverInput): DiscoveredPayload;
|
|
28
|
+
/**
|
|
29
|
+
* The directories `gjsify.ship.bundledTypelibs` names for ONE layout.
|
|
30
|
+
*
|
|
31
|
+
* Resolved by the layout, never by the host assembling it — the same rule `resolveShipBundle`
|
|
32
|
+
* follows. A table key nothing reads is refused rather than ignored: a prebuild declared under
|
|
33
|
+
* `windows` would otherwise leave that target without its typelib and print nothing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveBundledTypelibs(declared: string[] | ShipBundledTypelibsOptions | undefined, layoutOs: HostOs | undefined): string[];
|
|
22
36
|
/**
|
|
23
37
|
* Every regular file under `dir`, as POSIX-separated relative paths.
|
|
24
38
|
*
|
|
@@ -51,13 +51,36 @@ export function discoverPayload(input) {
|
|
|
51
51
|
bundleFiles: withoutForeignEntries(withoutLocaleTree(listFilesRecursive(bundleDir), bundleDir, projectDir, ship.localeDir), bundleDir, projectDir, input.foreignBundles ?? [], bundlePath),
|
|
52
52
|
iconFiles: discoverIcons(projectDir, ship.icon ?? input.flatpakIcon),
|
|
53
53
|
schemaFiles: discoverSchemas(projectDir, ship.schemas),
|
|
54
|
-
typelibFiles: discoverTypelibs(projectDir, ship.bundledTypelibs),
|
|
54
|
+
typelibFiles: discoverTypelibs(projectDir, resolveBundledTypelibs(ship.bundledTypelibs, input.layoutOs)),
|
|
55
55
|
localeFiles,
|
|
56
56
|
fontFiles: discoverFonts(projectDir, ship.fonts),
|
|
57
57
|
licenseFile: discoverLicense(projectDir, ship.licenseFile),
|
|
58
58
|
changelogFile: discoverChangelog(projectDir, ship.changelogFile),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The directories `gjsify.ship.bundledTypelibs` names for ONE layout.
|
|
63
|
+
*
|
|
64
|
+
* Resolved by the layout, never by the host assembling it — the same rule `resolveShipBundle`
|
|
65
|
+
* follows. A table key nothing reads is refused rather than ignored: a prebuild declared under
|
|
66
|
+
* `windows` would otherwise leave that target without its typelib and print nothing.
|
|
67
|
+
*/
|
|
68
|
+
export function resolveBundledTypelibs(declared, layoutOs) {
|
|
69
|
+
if (declared === undefined || Array.isArray(declared))
|
|
70
|
+
return declared ?? [];
|
|
71
|
+
const known = ['linux', 'darwin', 'win32'];
|
|
72
|
+
for (const os of Object.keys(declared)) {
|
|
73
|
+
if (known.includes(os))
|
|
74
|
+
continue;
|
|
75
|
+
throw new Error(`gjsify ship: \`gjsify.ship.bundledTypelibs.${os}\` is not an OS this command assembles for. ` +
|
|
76
|
+
`Known: ${known.join(', ')} — the \`process.platform\` spelling, not the ` +
|
|
77
|
+
"`gjsify ship <os>` positional's.");
|
|
78
|
+
}
|
|
79
|
+
if (layoutOs === undefined) {
|
|
80
|
+
throw new Error('gjsify ship: `gjsify.ship.bundledTypelibs` is a per-OS table but no layout OS was given.');
|
|
81
|
+
}
|
|
82
|
+
return declared[layoutOs] ?? [];
|
|
83
|
+
}
|
|
61
84
|
/**
|
|
62
85
|
* Typelibs (and their shared libraries) the PROJECT ships itself.
|
|
63
86
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.1-next.240",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,22 +142,22 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/blueprint": "
|
|
146
|
-
"@gjsify/buffer": "
|
|
147
|
-
"@gjsify/create-app": "
|
|
148
|
-
"@gjsify/node-globals": "
|
|
149
|
-
"@gjsify/node-polyfills": "
|
|
150
|
-
"@gjsify/npm-registry": "
|
|
151
|
-
"@gjsify/resolve-npm": "
|
|
152
|
-
"@gjsify/rolldown-plugin-gjsify": "
|
|
153
|
-
"@gjsify/vite-plugin-blueprint": "
|
|
154
|
-
"@gjsify/rolldown-plugin-pnp": "
|
|
155
|
-
"@gjsify/semver": "
|
|
156
|
-
"@gjsify/tar": "
|
|
157
|
-
"@gjsify/tsc": "
|
|
158
|
-
"@gjsify/utils": "
|
|
159
|
-
"@gjsify/web-polyfills": "
|
|
160
|
-
"@gjsify/workspace": "
|
|
145
|
+
"@gjsify/blueprint": "0.64.1-next.240",
|
|
146
|
+
"@gjsify/buffer": "0.64.1-next.240",
|
|
147
|
+
"@gjsify/create-app": "0.64.1-next.240",
|
|
148
|
+
"@gjsify/node-globals": "0.64.1-next.240",
|
|
149
|
+
"@gjsify/node-polyfills": "0.64.1-next.240",
|
|
150
|
+
"@gjsify/npm-registry": "0.64.1-next.240",
|
|
151
|
+
"@gjsify/resolve-npm": "0.64.1-next.240",
|
|
152
|
+
"@gjsify/rolldown-plugin-gjsify": "0.64.1-next.240",
|
|
153
|
+
"@gjsify/vite-plugin-blueprint": "0.64.1-next.240",
|
|
154
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.1-next.240",
|
|
155
|
+
"@gjsify/semver": "0.64.1-next.240",
|
|
156
|
+
"@gjsify/tar": "0.64.1-next.240",
|
|
157
|
+
"@gjsify/tsc": "0.64.1-next.240",
|
|
158
|
+
"@gjsify/utils": "0.64.1-next.240",
|
|
159
|
+
"@gjsify/web-polyfills": "0.64.1-next.240",
|
|
160
|
+
"@gjsify/workspace": "0.64.1-next.240",
|
|
161
161
|
"acorn": "^8.17.0",
|
|
162
162
|
"cosmiconfig": "^9.0.2",
|
|
163
163
|
"get-tsconfig": "^4.14.0",
|
|
@@ -166,13 +166,13 @@
|
|
|
166
166
|
"yargs": "^18.0.0"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@gjsify/unit": "
|
|
169
|
+
"@gjsify/unit": "0.64.1-next.240",
|
|
170
170
|
"@types/yargs": "^17.0.35",
|
|
171
171
|
"typescript": "^6.0.3"
|
|
172
172
|
},
|
|
173
173
|
"peerDependencies": {
|
|
174
|
-
"@gjsify/oxfmt-native": "
|
|
175
|
-
"@gjsify/rolldown-native": "
|
|
174
|
+
"@gjsify/oxfmt-native": "0.64.1-next.240",
|
|
175
|
+
"@gjsify/rolldown-native": "0.64.1-next.240"
|
|
176
176
|
},
|
|
177
177
|
"peerDependenciesMeta": {
|
|
178
178
|
"@gjsify/oxfmt-native": {
|
|
@@ -191,5 +191,6 @@
|
|
|
191
191
|
"bugs": {
|
|
192
192
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
193
193
|
},
|
|
194
|
-
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/cli#readme"
|
|
194
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/cli#readme",
|
|
195
|
+
"gitHead": "9cc65385593e615e921d7c3b2ceb31fd03e98e4b"
|
|
195
196
|
}
|