@stacksjs/desktop-build 0.72.99 → 0.72.100

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/index.d.ts CHANGED
@@ -30,12 +30,36 @@ export declare function hasUserlandDesktopLauncher(projectRoot?: string): boolea
30
30
  * made desktop builds impossible outside this repo.
31
31
  */
32
32
  export declare function resolveDesktopLauncher(projectRoot?: string): string;
33
+ export declare function xmlEscape(value: string): string;
34
+ /**
35
+ * Serialise a JSON value as a plist fragment.
36
+ *
37
+ * Applications declare extra `Info.plist` entries as JSON rather than XML so a
38
+ * typo cannot produce a bundle macOS silently refuses to launch. The keys that
39
+ * matter most are the `NS*UsageDescription` strings: they are the sentences a
40
+ * person reads in a permission prompt, and without them macOS shows a generic
41
+ * prompt or refuses the request outright.
42
+ */
43
+ export declare function plistValue(value: unknown, indent?: string): string;
44
+ /**
45
+ * Render an application's declared `Info.plist` entries, dropping any key the
46
+ * bundle must own. Returns the ignored keys so the caller can say so.
47
+ */
48
+ export declare function renderUserlandPlistEntries(declared: Record<string, unknown>): { xml: string, ignored: string[] };
33
49
  export declare function resolveDevWindowUrl(port: number, options?: OpenDevWindowOptions): string;
34
50
  export declare function craftDevCommand(port: number, options?: OpenDevWindowOptions): string[];
35
51
  export declare function createUpdateManifestUrl(baseUrl: string, channel?: string): string;
36
52
  export declare function openDevWindow(port: number, options?: OpenDevWindowOptions, launcher?: CraftLauncher): Promise<boolean>;
37
53
  /** Where an application puts a launcher of its own. */
38
54
  export declare const USERLAND_LAUNCHER: 'app/Desktop/launcher.ts';
55
+ /**
56
+ * Keys the bundle itself must control.
57
+ *
58
+ * Letting an app rewrite its own identifier or executable from `Info.plist.json`
59
+ * produces a bundle that does not match what was signed — which fails at
60
+ * launch, long after the build said it succeeded.
61
+ */
62
+ export declare const RESERVED_PLIST_KEYS: ReadonlySet<string>;
39
63
  export declare interface Desktop {
40
64
  app: unknown
41
65
  core: unknown
package/dist/index.js CHANGED
@@ -1,2 +1,10 @@
1
1
  // @bun
2
- import{existsSync as p}from"fs";import{dirname as L,join as a}from"path";import o from"process";import{fileURLToPath as P}from"url";import{craftBinaryNotFoundMessage as j,resolveCraftBinary as A}from"craft-native";function m(t,e,r={}){if(!e.trim())throw Error("Invite token is required");let s=new URL("/invite",/^https?:\/\//.test(t)?t:`https://${t}`);if(s.searchParams.set("token",e),r.email)s.searchParams.set("email",r.email);if(r.team)s.searchParams.set("team",r.team);if(r.role)s.searchParams.set("role",r.role);if(r.expiresAt){let n=r.expiresAt instanceof Date?r.expiresAt:new Date(r.expiresAt);if(Number.isNaN(n.valueOf()))throw Error("Invite expiration must be a valid date");s.searchParams.set("expires",n.toISOString())}return s.toString()}async function B(t,e){return Promise.all(t.map(async(r)=>{let s=typeof r==="string"?{email:r}:r;try{k(s.email);let n=await e.createToken(s),i=m(e.baseUrl,n,{email:s.email,team:s.team,role:s.role,expiresAt:e.expiresAt});return await e.send({recipient:s,url:i}),{recipient:s,url:i,delivered:!0}}catch(n){return{recipient:s,url:"",delivered:!1,error:n instanceof Error?n.message:String(n)}}}))}function k(t){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))throw Error(`Invalid invite email: ${t}`)}import{createHash as w,createPublicKey as b,verify as v}from"crypto";import{mkdir as y,rename as D,writeFile as x}from"fs/promises";import{dirname as E}from"path";async function F(t){g(t.manifestUrl);let e=await(t.fetcher||fetch)(t.manifestUrl,{headers:{Accept:"application/json"}});if(!e.ok)throw Error(`Desktop update check failed with HTTP ${e.status}`);let r=l(await e.json());return d(r,t.trustedKeys),I(r.version,t.currentVersion)>0?r:null}async function W(t,e,r=fetch,s){if(l(t),!s)throw Error("Desktop update staging requires trusted signing keys");d(t,s),g(t.url);let n=await r(t.url);if(!n.ok)throw Error(`Desktop update download failed with HTTP ${n.status}`);let i=new Uint8Array(await n.arrayBuffer());if(i.byteLength!==t.size)throw Error(`Desktop update size mismatch: expected ${t.size}, received ${i.byteLength}`);if(w("sha256").update(i).digest("hex")!==t.sha256.toLowerCase())throw Error("Desktop update checksum mismatch");await y(E(e),{recursive:!0});let u=`${e}.download-${crypto.randomUUID()}`;return await x(u,i,{mode:448}),await D(u,e),{manifest:t,path:e,bytes:i.byteLength}}function I(t,e){let r=c(t),s=c(e);for(let n=0;n<3;n++){let i=r[n]-s[n];if(i!==0)return Math.sign(i)}return 0}function l(t){if(!t||typeof t!=="object")throw Error("Desktop update manifest must be an object");let e=t;if(c(e.version||""),typeof e.url!=="string")throw Error("Desktop update manifest requires a URL");if(typeof e.sha256!=="string"||!/^[a-f0-9]{64}$/i.test(e.sha256))throw Error("Desktop update manifest requires a SHA-256 checksum");if(!Number.isInteger(e.size)||e.size<0)throw Error("Desktop update manifest requires a non-negative integer size");if(typeof e.sourceRevision!=="string"||!/^[0-9a-f]{40}$/.test(e.sourceRevision))throw Error("Desktop update manifest requires a full source revision");if(typeof e.platform!=="string"||!["darwin","linux","win32"].includes(e.platform))throw Error("Desktop update manifest requires a supported platform identifier");if(typeof e.architecture!=="string"||!/^[a-z0-9_-]+$/.test(e.architecture))throw Error("Desktop update manifest requires an architecture");if(typeof e.signingKeyId!=="string"||!/^[a-zA-Z0-9._-]+$/.test(e.signingKeyId))throw Error("Desktop update manifest requires a signing key ID");if(typeof e.signature!=="string"||!/^[A-Za-z0-9_-]+$/.test(e.signature))throw Error("Desktop update manifest requires an Ed25519 signature");return e}function R(t){return Buffer.from(JSON.stringify({version:t.version,url:t.url,sha256:t.sha256.toLowerCase(),size:t.size,sourceRevision:t.sourceRevision,platform:t.platform,architecture:t.architecture,signingKeyId:t.signingKeyId,publishedAt:t.publishedAt||null,notes:t.notes||null}),"utf8")}function d(t,e){let r=e[t.signingKeyId];if(!r)throw Error(`Desktop update signing key is not trusted: ${t.signingKeyId}`);let s="ed25519-public:";if(!r.startsWith(s))throw Error("Desktop update signing key has an invalid encoding");try{let n=b({key:Buffer.from(r.slice(s.length),"base64url"),format:"der",type:"spki"}),i=Buffer.from(t.signature,"base64url");if(n.asymmetricKeyType!=="ed25519"||i.length!==64||!v(null,R(t),n,i))throw Error("invalid")}catch{throw Error("Desktop update manifest signature verification failed")}}function c(t){let e=t.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$/);if(!e)throw Error(`Invalid semantic version: ${t}`);return[Number(e[1]),Number(e[2]),Number(e[3])]}function g(t){let e=new URL(t),r=["localhost","127.0.0.1","::1"].includes(e.hostname);if(e.protocol!=="https:"&&!(e.protocol==="http:"&&r))throw Error("Desktop updates require HTTPS outside loopback development")}var U=[{platform:"darwin",architecture:"arm64",status:"experimental",osVersions:["macOS 15 runner"],packageFormat:"DMG + PKG",signing:"pending",notarization:"pending",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["Lifecycle fixtures are unsigned while platform identities remain unprovisioned.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"darwin",architecture:"x64",status:"experimental",osVersions:["macOS 15 Intel runner"],packageFormat:"DMG + PKG",signing:"pending",notarization:"pending",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["Lifecycle fixtures are unsigned while platform identities remain unprovisioned.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"linux",architecture:"x64",status:"experimental",osVersions:["Ubuntu 24.04 runner"],packageFormat:"DEB",signing:"pending",notarization:"not-applicable",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["The lifecycle fixture is unsigned and no package repository support policy is published.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"win32",architecture:"x64",status:"experimental",osVersions:["Windows Server 2025 runner"],packageFormat:"MSI + ZIP",signing:"pending",notarization:"not-applicable",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["The lifecycle fixture is not Authenticode-signed.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]}];function S(t=process.platform,e=process.arch){return U.find((r)=>r.platform===t&&r.architecture===e)}function _(t,e=process.platform,r=process.arch){let s=S(e,r);if(!s)throw Error(`Desktop target ${e}/${r} is unsupported`);if(t==="stable"&&(s.status!=="stable"||s.signing!=="enforced"||s.platform==="darwin"&&s.notarization!=="enforced"||!s.installLaunchEvidence||!s.updateRollbackEvidence))throw Error(`Desktop target ${e}/${r} cannot be released as stable; complete stacksjs/stacks#2059, #2062, and #2063 first`);return s}function f(t=o.env.CRAFT_BIN){return A(t)}function Y(t=o.env.CRAFT_BIN,e=(r)=>Bun.which(r)){let r=f(t);if(r!=="craft")return r;let s=e(r);if(!s)throw Error(j(r));return s}var h="app/Desktop/launcher.ts";function ee(t=o.cwd()){return p(a(t,h))}function te(t=o.cwd()){let e=a(t,h);if(p(e))return e;let r=L(P(import.meta.url)),n=[a(r,"launcher.ts"),a(r,"launcher.js")].find((i)=>p(i));if(!n)throw Error("Desktop launcher entrypoint not found. Reinstall @stacksjs/desktop - the package must ship dist/launcher.js.");return n}function C(t,e={}){if(!Number.isInteger(t)||t<1||t>65535)throw RangeError(`Invalid desktop development port: ${t}`);let r=e.url||o.env.APP_URL;if(!r)return"https://stacks.test";let s=/^https?:\/\//.test(r)?r:`https://${r}`;return new URL(s).toString().replace(/\/$/,"")}function M(t,e={}){let r=[f(e.craftBin),C(t,e),"--title",e.title||"Stacks","--width",String(e.width||1400),"--height",String(e.height||900)];if(e.hotReload!==!1)r.push("--hot-reload");if(e.devTools===!1)r.push("--no-devtools");if(e.darkMode)r.push("--dark");if(e.systemTray)r.push("--system-tray");if(e.hideDockIcon)r.push("--hide-dock-icon");if(e.menubarOnly)r.push("--menubar-only");return r}function re(t,e="stable"){if(!/^[a-z0-9-]+$/i.test(e))throw Error("Update channel may only contain letters, numbers, and hyphens");return new URL(`/desktop/updates/${e}.json`,/^https?:\/\//.test(t)?t:`https://${t}`).toString()}async function O(t){Bun.spawn(t,{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).unref()}async function se(t,e={},r=O){return await r(M(t,e)),!0}export{h as USERLAND_LAUNCHER,_ as assertDesktopReleaseChannel,F as checkForDesktopUpdate,I as compareVersions,M as craftDevCommand,m as createInviteLink,re as createUpdateManifestUrl,S as desktopSupport,U as desktopSupportMatrix,ee as hasUserlandDesktopLauncher,se as openDevWindow,f as resolveCraftBinary,Y as resolveCraftExecutable,te as resolveDesktopLauncher,C as resolveDevWindowUrl,B as sendDesktopInvites,W as stageDesktopUpdate,R as updateManifestPayload,l as validateUpdateManifest,d as verifyUpdateManifestSignature};
2
+ import{existsSync as p}from"fs";import{dirname as P,join as a}from"path";import o from"process";import{fileURLToPath as C}from"url";import{craftBinaryNotFoundMessage as B,resolveCraftBinary as O}from"craft-native";function b(e,t,r={}){if(!t.trim())throw Error("Invite token is required");let n=new URL("/invite",/^https?:\/\//.test(e)?e:`https://${e}`);if(n.searchParams.set("token",t),r.email)n.searchParams.set("email",r.email);if(r.team)n.searchParams.set("team",r.team);if(r.role)n.searchParams.set("role",r.role);if(r.expiresAt){let s=r.expiresAt instanceof Date?r.expiresAt:new Date(r.expiresAt);if(Number.isNaN(s.valueOf()))throw Error("Invite expiration must be a valid date");n.searchParams.set("expires",s.toISOString())}return n.toString()}async function T(e,t){return Promise.all(e.map(async(r)=>{let n=typeof r==="string"?{email:r}:r;try{y(n.email);let s=await t.createToken(n),i=b(t.baseUrl,s,{email:n.email,team:n.team,role:n.role,expiresAt:t.expiresAt});return await t.send({recipient:n,url:i}),{recipient:n,url:i,delivered:!0}}catch(s){return{recipient:n,url:"",delivered:!1,error:s instanceof Error?s.message:String(s)}}}))}function y(e){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))throw Error(`Invalid invite email: ${e}`)}import{createHash as v,createPublicKey as D,verify as x}from"crypto";import{mkdir as E,rename as I,writeFile as R}from"fs/promises";import{dirname as S}from"path";async function _(e){h(e.manifestUrl);let t=await(e.fetcher||fetch)(e.manifestUrl,{headers:{Accept:"application/json"}});if(!t.ok)throw Error(`Desktop update check failed with HTTP ${t.status}`);let r=g(await t.json());return f(r,e.trustedKeys),U(r.version,e.currentVersion)>0?r:null}async function H(e,t,r=fetch,n){if(g(e),!n)throw Error("Desktop update staging requires trusted signing keys");f(e,n),h(e.url);let s=await r(e.url);if(!s.ok)throw Error(`Desktop update download failed with HTTP ${s.status}`);let i=new Uint8Array(await s.arrayBuffer());if(i.byteLength!==e.size)throw Error(`Desktop update size mismatch: expected ${e.size}, received ${i.byteLength}`);if(v("sha256").update(i).digest("hex")!==e.sha256.toLowerCase())throw Error("Desktop update checksum mismatch");await E(S(t),{recursive:!0});let d=`${t}.download-${crypto.randomUUID()}`;return await R(d,i,{mode:448}),await I(d,t),{manifest:e,path:t,bytes:i.byteLength}}function U(e,t){let r=c(e),n=c(t);for(let s=0;s<3;s++){let i=r[s]-n[s];if(i!==0)return Math.sign(i)}return 0}function g(e){if(!e||typeof e!=="object")throw Error("Desktop update manifest must be an object");let t=e;if(c(t.version||""),typeof t.url!=="string")throw Error("Desktop update manifest requires a URL");if(typeof t.sha256!=="string"||!/^[a-f0-9]{64}$/i.test(t.sha256))throw Error("Desktop update manifest requires a SHA-256 checksum");if(!Number.isInteger(t.size)||t.size<0)throw Error("Desktop update manifest requires a non-negative integer size");if(typeof t.sourceRevision!=="string"||!/^[0-9a-f]{40}$/.test(t.sourceRevision))throw Error("Desktop update manifest requires a full source revision");if(typeof t.platform!=="string"||!["darwin","linux","win32"].includes(t.platform))throw Error("Desktop update manifest requires a supported platform identifier");if(typeof t.architecture!=="string"||!/^[a-z0-9_-]+$/.test(t.architecture))throw Error("Desktop update manifest requires an architecture");if(typeof t.signingKeyId!=="string"||!/^[a-zA-Z0-9._-]+$/.test(t.signingKeyId))throw Error("Desktop update manifest requires a signing key ID");if(typeof t.signature!=="string"||!/^[A-Za-z0-9_-]+$/.test(t.signature))throw Error("Desktop update manifest requires an Ed25519 signature");return t}function j(e){return Buffer.from(JSON.stringify({version:e.version,url:e.url,sha256:e.sha256.toLowerCase(),size:e.size,sourceRevision:e.sourceRevision,platform:e.platform,architecture:e.architecture,signingKeyId:e.signingKeyId,publishedAt:e.publishedAt||null,notes:e.notes||null}),"utf8")}function f(e,t){let r=t[e.signingKeyId];if(!r)throw Error(`Desktop update signing key is not trusted: ${e.signingKeyId}`);let n="ed25519-public:";if(!r.startsWith(n))throw Error("Desktop update signing key has an invalid encoding");try{let s=D({key:Buffer.from(r.slice(n.length),"base64url"),format:"der",type:"spki"}),i=Buffer.from(e.signature,"base64url");if(s.asymmetricKeyType!=="ed25519"||i.length!==64||!x(null,j(e),s,i))throw Error("invalid")}catch{throw Error("Desktop update manifest signature verification failed")}}function c(e){let t=e.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$/);if(!t)throw Error(`Invalid semantic version: ${e}`);return[Number(t[1]),Number(t[2]),Number(t[3])]}function h(e){let t=new URL(e),r=["localhost","127.0.0.1","::1"].includes(t.hostname);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&r))throw Error("Desktop updates require HTTPS outside loopback development")}var A=[{platform:"darwin",architecture:"arm64",status:"experimental",osVersions:["macOS 15 runner"],packageFormat:"DMG + PKG",signing:"pending",notarization:"pending",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["Lifecycle fixtures are unsigned while platform identities remain unprovisioned.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"darwin",architecture:"x64",status:"experimental",osVersions:["macOS 15 Intel runner"],packageFormat:"DMG + PKG",signing:"pending",notarization:"pending",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["Lifecycle fixtures are unsigned while platform identities remain unprovisioned.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"linux",architecture:"x64",status:"experimental",osVersions:["Ubuntu 24.04 runner"],packageFormat:"DEB",signing:"pending",notarization:"not-applicable",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["The lifecycle fixture is unsigned and no package repository support policy is published.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]},{platform:"win32",architecture:"x64",status:"experimental",osVersions:["Windows Server 2025 runner"],packageFormat:"MSI + ZIP",signing:"pending",notarization:"not-applicable",installLaunchEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",updateRollbackEvidence:"https://github.com/stacksjs/stacks/actions/runs/29890804159",packagingEvidence:"https://github.com/stacksjs/protocol/blob/main/evidence/craft.json",blockingIssues:["https://github.com/stacksjs/stacks/issues/2062","https://github.com/home-lang/craft/issues/11"],limitations:["The lifecycle fixture is not Authenticode-signed.","Craft v0.0.48 is source-tagged, but its upstream release workflow is blocked by repository Actions policy."]}];function L(e=process.platform,t=process.arch){return A.find((r)=>r.platform===e&&r.architecture===t)}function Z(e,t=process.platform,r=process.arch){let n=L(t,r);if(!n)throw Error(`Desktop target ${t}/${r} is unsupported`);if(e==="stable"&&(n.status!=="stable"||n.signing!=="enforced"||n.platform==="darwin"&&n.notarization!=="enforced"||!n.installLaunchEvidence||!n.updateRollbackEvidence))throw Error(`Desktop target ${t}/${r} cannot be released as stable; complete stacksjs/stacks#2059, #2062, and #2063 first`);return n}function k(e=o.env.CRAFT_BIN){return O(e)}function re(e=o.env.CRAFT_BIN,t=(r)=>Bun.which(r)){let r=k(e);if(r!=="craft")return r;let n=t(r);if(!n)throw Error(B(r));return n}var w="app/Desktop/launcher.ts";function ne(e=o.cwd()){return p(a(e,w))}function se(e=o.cwd()){let t=a(e,w);if(p(t))return t;let r=P(C(import.meta.url)),s=[a(r,"launcher.ts"),a(r,"launcher.js")].find((i)=>p(i));if(!s)throw Error("Desktop launcher entrypoint not found. Reinstall @stacksjs/desktop - the package must ship dist/launcher.js.");return s}var m=new Set(["CFBundleName","CFBundleDisplayName","CFBundleIdentifier","CFBundleVersion","CFBundleShortVersionString","CFBundleExecutable","CFBundlePackageType","CFBundleInfoDictionaryVersion","CFBundleIconFile"]);function u(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function l(e,t=""){if(typeof e==="string")return`<string>${u(e)}</string>`;if(typeof e==="boolean")return e?"<true/>":"<false/>";if(typeof e==="number"){if(!Number.isFinite(e))throw Error(`Unsupported Info.plist number: ${e}`);return Number.isInteger(e)?`<integer>${e}</integer>`:`<real>${e}</real>`}if(Array.isArray(e)){if(e.length===0)return"<array/>";return`<array>
3
+ ${e.map((n)=>`${t} ${l(n,`${t} `)}`).join(`
4
+ `)}
5
+ ${t}</array>`}if(e&&typeof e==="object"){let r=Object.entries(e);if(r.length===0)return"<dict/>";return`<dict>
6
+ ${r.map(([s,i])=>`${t} <key>${u(s)}</key>${l(i,`${t} `)}`).join(`
7
+ `)}
8
+ ${t}</dict>`}throw Error(`Unsupported Info.plist value: ${JSON.stringify(e)??String(e)}`)}function ie(e){let t=Object.keys(e).filter((s)=>m.has(s)),r=Object.entries(e).filter(([s])=>!m.has(s));if(r.length===0)return{xml:"",ignored:t};return{xml:`
9
+ ${r.map(([s,i])=>` <key>${u(s)}</key>${l(i," ")}`).join(`
10
+ `)}`,ignored:t}}function F(e,t={}){if(!Number.isInteger(e)||e<1||e>65535)throw RangeError(`Invalid desktop development port: ${e}`);let r=t.url||o.env.APP_URL;if(!r)return"https://stacks.test";let n=/^https?:\/\//.test(r)?r:`https://${r}`;return new URL(n).toString().replace(/\/$/,"")}function M(e,t={}){let r=[k(t.craftBin),F(e,t),"--title",t.title||"Stacks","--width",String(t.width||1400),"--height",String(t.height||900)];if(t.hotReload!==!1)r.push("--hot-reload");if(t.devTools===!1)r.push("--no-devtools");if(t.darkMode)r.push("--dark");if(t.systemTray)r.push("--system-tray");if(t.hideDockIcon)r.push("--hide-dock-icon");if(t.menubarOnly)r.push("--menubar-only");return r}function oe(e,t="stable"){if(!/^[a-z0-9-]+$/i.test(t))throw Error("Update channel may only contain letters, numbers, and hyphens");return new URL(`/desktop/updates/${t}.json`,/^https?:\/\//.test(e)?e:`https://${e}`).toString()}async function z(e){Bun.spawn(e,{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).unref()}async function ae(e,t={},r=z){return await r(M(e,t)),!0}export{m as RESERVED_PLIST_KEYS,w as USERLAND_LAUNCHER,Z as assertDesktopReleaseChannel,_ as checkForDesktopUpdate,U as compareVersions,M as craftDevCommand,b as createInviteLink,oe as createUpdateManifestUrl,L as desktopSupport,A as desktopSupportMatrix,ne as hasUserlandDesktopLauncher,ae as openDevWindow,l as plistValue,ie as renderUserlandPlistEntries,k as resolveCraftBinary,re as resolveCraftExecutable,se as resolveDesktopLauncher,F as resolveDevWindowUrl,T as sendDesktopInvites,H as stageDesktopUpdate,j as updateManifestPayload,g as validateUpdateManifest,f as verifyUpdateManifestSignature,u as xmlEscape};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/desktop-build",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.72.99",
5
+ "version": "0.72.100",
6
6
  "description": "Build and launch Craft desktop applications for Stacks",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -67,9 +67,9 @@
67
67
  "prepublishOnly": "bun run build"
68
68
  },
69
69
  "devDependencies": {
70
- "@stacksjs/build": "0.72.99",
70
+ "@stacksjs/build": "0.72.100",
71
71
  "better-dx": "^0.2.24",
72
- "@stacksjs/server": "0.72.99"
72
+ "@stacksjs/server": "0.72.100"
73
73
  },
74
74
  "dependencies": {
75
75
  "craft-native": "^0.0.55"