@stacksjs/desktop-build 0.70.261 → 0.70.262

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.
@@ -0,0 +1,69 @@
1
+ export declare function resolveCraftBinary(explicit?: string | undefined): string;
2
+ /**
3
+ * The launcher entrypoint `buddy build:desktop` compiles into the native
4
+ * bundle.
5
+ *
6
+ * Inside this monorepo the TypeScript source is right there. A consumer app
7
+ * only has the published package, which ships `dist/launcher.js` — so resolve
8
+ * whichever exists rather than assuming the monorepo layout, which is what
9
+ * previously made desktop builds impossible outside this repo.
10
+ */
11
+ export declare function resolveDesktopLauncher(): string;
12
+ export declare function resolveDevWindowUrl(port: number, options?: OpenDevWindowOptions): string;
13
+ export declare function craftDevCommand(port: number, options?: OpenDevWindowOptions): string[];
14
+ export declare function createUpdateManifestUrl(baseUrl: string, channel?: string): string;
15
+ export declare function openDevWindow(port: number, options?: OpenDevWindowOptions, launcher?: CraftLauncher): Promise<boolean>;
16
+ export declare interface Desktop {
17
+ app: unknown
18
+ core: unknown
19
+ dpi: unknown
20
+ event: unknown
21
+ image: unknown
22
+ menu: unknown
23
+ mocks: unknown
24
+ path: unknown
25
+ tray: unknown
26
+ webview: unknown
27
+ webviewWindow: unknown
28
+ window: unknown
29
+ }
30
+ // let _desktop: Desktop | undefined
31
+ // export async function getDesktop(): Promise<Desktop> {
32
+ // if (_desktop) return _desktop
33
+ // const tauri = await import('@tauri-apps/api')
34
+ // _desktop = {
35
+ // app: tauri.app,
36
+ // core: tauri.core,
37
+ // dpi: tauri.dpi,
38
+ // event: tauri.event,
39
+ // image: tauri.image,
40
+ // menu: tauri.menu,
41
+ // mocks: tauri.mocks,
42
+ // path: tauri.path,
43
+ // tray: tauri.tray,
44
+ // webview: tauri.webview,
45
+ // webviewWindow: tauri.webviewWindow,
46
+ // window: tauri.window,
47
+ // }
48
+ // return _desktop
49
+ // }
50
+ export declare interface OpenDevWindowOptions {
51
+ url?: string
52
+ title?: string
53
+ width?: number
54
+ height?: number
55
+ darkMode?: boolean
56
+ hotReload?: boolean
57
+ nativeSidebar?: boolean
58
+ sidebarWidth?: number
59
+ sidebarConfig?: unknown
60
+ devTools?: boolean
61
+ craftBin?: string
62
+ systemTray?: boolean
63
+ hideDockIcon?: boolean
64
+ menubarOnly?: boolean
65
+ }
66
+ export type CraftLauncher = (command: string[]) => void | Promise<void>;
67
+ export * from './invites';
68
+ export * from './updater';
69
+ export * from './support';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{existsSync as c}from"fs";import{homedir as R}from"os";import{dirname as S,join as a}from"path";import{fileURLToPath as A}from"url";function d(t,e,s={}){if(!e.trim())throw Error("Invite token is required");let r=new URL("/invite",/^https?:\/\//.test(t)?t:`https://${t}`);if(r.searchParams.set("token",e),s.email)r.searchParams.set("email",s.email);if(s.team)r.searchParams.set("team",s.team);if(s.role)r.searchParams.set("role",s.role);if(s.expiresAt){let i=s.expiresAt instanceof Date?s.expiresAt:new Date(s.expiresAt);if(Number.isNaN(i.valueOf()))throw Error("Invite expiration must be a valid date");r.searchParams.set("expires",i.toISOString())}return r.toString()}async function j(t,e){return Promise.all(t.map(async(s)=>{let r=typeof s==="string"?{email:s}:s;try{k(r.email);let i=await e.createToken(r),n=d(e.baseUrl,i,{email:r.email,team:r.team,role:r.role,expiresAt:e.expiresAt});return await e.send({recipient:r,url:n}),{recipient:r,url:n,delivered:!0}}catch(i){return{recipient:r,url:"",delivered:!1,error:i instanceof Error?i.message:String(i)}}}))}function k(t){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))throw Error(`Invalid invite email: ${t}`)}import{createHash as f,createPublicKey as h,verify as m}from"crypto";import{mkdir as w,rename as b,writeFile as v}from"fs/promises";import{dirname as y}from"path";async function F(t){l(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 s=p(await e.json());return g(s,t.trustedKeys),D(s.version,t.currentVersion)>0?s:null}async function T(t,e,s=fetch,r){if(p(t),!r)throw Error("Desktop update staging requires trusted signing keys");g(t,r),l(t.url);let i=await s(t.url);if(!i.ok)throw Error(`Desktop update download failed with HTTP ${i.status}`);let n=new Uint8Array(await i.arrayBuffer());if(n.byteLength!==t.size)throw Error(`Desktop update size mismatch: expected ${t.size}, received ${n.byteLength}`);if(f("sha256").update(n).digest("hex")!==t.sha256.toLowerCase())throw Error("Desktop update checksum mismatch");await w(y(e),{recursive:!0});let u=`${e}.download-${crypto.randomUUID()}`;return await v(u,n,{mode:448}),await b(u,e),{manifest:t,path:e,bytes:n.byteLength}}function D(t,e){let s=o(t),r=o(e);for(let i=0;i<3;i++){let n=s[i]-r[i];if(n!==0)return Math.sign(n)}return 0}function p(t){if(!t||typeof t!=="object")throw Error("Desktop update manifest must be an object");let e=t;if(o(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 E(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 g(t,e){let s=e[t.signingKeyId];if(!s)throw Error(`Desktop update signing key is not trusted: ${t.signingKeyId}`);let r="ed25519-public:";if(!s.startsWith(r))throw Error("Desktop update signing key has an invalid encoding");try{let i=h({key:Buffer.from(s.slice(r.length),"base64url"),format:"der",type:"spki"}),n=Buffer.from(t.signature,"base64url");if(i.asymmetricKeyType!=="ed25519"||n.length!==64||!m(null,E(t),i,n))throw Error("invalid")}catch{throw Error("Desktop update manifest signature verification failed")}}function o(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 l(t){let e=new URL(t),s=["localhost","127.0.0.1","::1"].includes(e.hostname);if(e.protocol!=="https:"&&!(e.protocol==="http:"&&s))throw Error("Desktop updates require HTTPS outside loopback development")}var x=[{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/stacks/blob/main/.github/protocol/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/stacks/blob/main/.github/protocol/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/stacks/blob/main/.github/protocol/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/stacks/blob/main/.github/protocol/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 I(t=process.platform,e=process.arch){return x.find((s)=>s.platform===t&&s.architecture===e)}function N(t,e=process.platform,s=process.arch){let r=I(e,s);if(!r)throw Error(`Desktop target ${e}/${s} is unsupported`);if(t==="stable"&&(r.status!=="stable"||r.signing!=="enforced"||r.platform==="darwin"&&r.notarization!=="enforced"||!r.installLaunchEvidence||!r.updateRollbackEvidence))throw Error(`Desktop target ${e}/${s} cannot be released as stable; complete stacksjs/stacks#2059, #2062, and #2063 first`);return r}function P(t=process.env.CRAFT_BIN){if(t){if(!c(t))throw Error(`Craft binary not found: ${t}`);return t}let e=a(R(),"Code/Tools/craft");return[a(e,"packages/zig/zig-out/bin/craft"),a(e,"craft"),a(e,"bin/craft")].find((r)=>c(r))||"craft"}function _(){let t=S(A(import.meta.url)),s=[a(t,"launcher.ts"),a(t,"launcher.js")].find((r)=>c(r));if(!s)throw Error("Desktop launcher entrypoint not found. Reinstall @stacksjs/desktop \u2014 the package must ship dist/launcher.js.");return s}function U(t,e={}){if(!Number.isInteger(t)||t<1||t>65535)throw RangeError(`Invalid desktop development port: ${t}`);let s=e.url||process.env.APP_URL;if(!s)return"https://stacks.test";let r=/^https?:\/\//.test(s)?s:`https://${s}`;return new URL(r).toString().replace(/\/$/,"")}function $(t,e={}){let s=[P(e.craftBin),U(t,e),"--title",e.title||"Stacks","--width",String(e.width||1400),"--height",String(e.height||900)];if(e.hotReload!==!1)s.push("--hot-reload");if(e.devTools===!1)s.push("--no-devtools");if(e.darkMode)s.push("--dark");if(e.systemTray)s.push("--system-tray");if(e.hideDockIcon)s.push("--hide-dock-icon");if(e.menubarOnly)s.push("--menubar-only");return s}function J(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 L(t){Bun.spawn(t,{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).unref()}async function W(t,e={},s=L){return await s($(t,e)),!0}export{g as verifyUpdateManifestSignature,p as validateUpdateManifest,E as updateManifestPayload,T as stageDesktopUpdate,j as sendDesktopInvites,U as resolveDevWindowUrl,_ as resolveDesktopLauncher,P as resolveCraftBinary,W as openDevWindow,x as desktopSupportMatrix,I as desktopSupport,J as createUpdateManifestUrl,d as createInviteLink,$ as craftDevCommand,D as compareVersions,F as checkForDesktopUpdate,N as assertDesktopReleaseChannel};
2
+ import{existsSync as c}from"fs";import{homedir as R}from"os";import{dirname as S,join as a}from"path";import{fileURLToPath as A}from"url";function d(t,e,s={}){if(!e.trim())throw Error("Invite token is required");let r=new URL("/invite",/^https?:\/\//.test(t)?t:`https://${t}`);if(r.searchParams.set("token",e),s.email)r.searchParams.set("email",s.email);if(s.team)r.searchParams.set("team",s.team);if(s.role)r.searchParams.set("role",s.role);if(s.expiresAt){let i=s.expiresAt instanceof Date?s.expiresAt:new Date(s.expiresAt);if(Number.isNaN(i.valueOf()))throw Error("Invite expiration must be a valid date");r.searchParams.set("expires",i.toISOString())}return r.toString()}async function j(t,e){return Promise.all(t.map(async(s)=>{let r=typeof s==="string"?{email:s}:s;try{f(r.email);let i=await e.createToken(r),n=d(e.baseUrl,i,{email:r.email,team:r.team,role:r.role,expiresAt:e.expiresAt});return await e.send({recipient:r,url:n}),{recipient:r,url:n,delivered:!0}}catch(i){return{recipient:r,url:"",delivered:!1,error:i instanceof Error?i.message:String(i)}}}))}function f(t){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))throw Error(`Invalid invite email: ${t}`)}import{createHash as k,createPublicKey as h,verify as m}from"crypto";import{mkdir as w,rename as b,writeFile as v}from"fs/promises";import{dirname as y}from"path";async function F(t){l(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 s=p(await e.json());return g(s,t.trustedKeys),D(s.version,t.currentVersion)>0?s:null}async function T(t,e,s=fetch,r){if(p(t),!r)throw Error("Desktop update staging requires trusted signing keys");g(t,r),l(t.url);let i=await s(t.url);if(!i.ok)throw Error(`Desktop update download failed with HTTP ${i.status}`);let n=new Uint8Array(await i.arrayBuffer());if(n.byteLength!==t.size)throw Error(`Desktop update size mismatch: expected ${t.size}, received ${n.byteLength}`);if(k("sha256").update(n).digest("hex")!==t.sha256.toLowerCase())throw Error("Desktop update checksum mismatch");await w(y(e),{recursive:!0});let u=`${e}.download-${crypto.randomUUID()}`;return await v(u,n,{mode:448}),await b(u,e),{manifest:t,path:e,bytes:n.byteLength}}function D(t,e){let s=o(t),r=o(e);for(let i=0;i<3;i++){let n=s[i]-r[i];if(n!==0)return Math.sign(n)}return 0}function p(t){if(!t||typeof t!=="object")throw Error("Desktop update manifest must be an object");let e=t;if(o(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 E(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 g(t,e){let s=e[t.signingKeyId];if(!s)throw Error(`Desktop update signing key is not trusted: ${t.signingKeyId}`);let r="ed25519-public:";if(!s.startsWith(r))throw Error("Desktop update signing key has an invalid encoding");try{let i=h({key:Buffer.from(s.slice(r.length),"base64url"),format:"der",type:"spki"}),n=Buffer.from(t.signature,"base64url");if(i.asymmetricKeyType!=="ed25519"||n.length!==64||!m(null,E(t),i,n))throw Error("invalid")}catch{throw Error("Desktop update manifest signature verification failed")}}function o(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 l(t){let e=new URL(t),s=["localhost","127.0.0.1","::1"].includes(e.hostname);if(e.protocol!=="https:"&&!(e.protocol==="http:"&&s))throw Error("Desktop updates require HTTPS outside loopback development")}var x=[{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 I(t=process.platform,e=process.arch){return x.find((s)=>s.platform===t&&s.architecture===e)}function N(t,e=process.platform,s=process.arch){let r=I(e,s);if(!r)throw Error(`Desktop target ${e}/${s} is unsupported`);if(t==="stable"&&(r.status!=="stable"||r.signing!=="enforced"||r.platform==="darwin"&&r.notarization!=="enforced"||!r.installLaunchEvidence||!r.updateRollbackEvidence))throw Error(`Desktop target ${e}/${s} cannot be released as stable; complete stacksjs/stacks#2059, #2062, and #2063 first`);return r}function P(t=process.env.CRAFT_BIN){if(t){if(!c(t))throw Error(`Craft binary not found: ${t}`);return t}let e=a(R(),"Code/Tools/craft");return[a(e,"packages/zig/zig-out/bin/craft"),a(e,"craft"),a(e,"bin/craft")].find((r)=>c(r))||"craft"}function _(){let t=S(A(import.meta.url)),s=[a(t,"launcher.ts"),a(t,"launcher.js")].find((r)=>c(r));if(!s)throw Error("Desktop launcher entrypoint not found. Reinstall @stacksjs/desktop \u2014 the package must ship dist/launcher.js.");return s}function U(t,e={}){if(!Number.isInteger(t)||t<1||t>65535)throw RangeError(`Invalid desktop development port: ${t}`);let s=e.url||process.env.APP_URL;if(!s)return"https://stacks.test";let r=/^https?:\/\//.test(s)?s:`https://${s}`;return new URL(r).toString().replace(/\/$/,"")}function $(t,e={}){let s=[P(e.craftBin),U(t,e),"--title",e.title||"Stacks","--width",String(e.width||1400),"--height",String(e.height||900)];if(e.hotReload!==!1)s.push("--hot-reload");if(e.devTools===!1)s.push("--no-devtools");if(e.darkMode)s.push("--dark");if(e.systemTray)s.push("--system-tray");if(e.hideDockIcon)s.push("--hide-dock-icon");if(e.menubarOnly)s.push("--menubar-only");return s}function J(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 L(t){Bun.spawn(t,{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).unref()}async function W(t,e={},s=L){return await s($(t,e)),!0}export{g as verifyUpdateManifestSignature,p as validateUpdateManifest,E as updateManifestPayload,T as stageDesktopUpdate,j as sendDesktopInvites,U as resolveDevWindowUrl,_ as resolveDesktopLauncher,P as resolveCraftBinary,W as openDevWindow,x as desktopSupportMatrix,I as desktopSupport,J as createUpdateManifestUrl,d as createInviteLink,$ as craftDevCommand,D as compareVersions,F as checkForDesktopUpdate,N as assertDesktopReleaseChannel};
@@ -0,0 +1,26 @@
1
+ export declare function createInviteLink(baseUrl: string, token: string, options?: InviteLinkOptions): string;
2
+ export declare function sendDesktopInvites(recipients: Array<string | DesktopInviteRecipient>, options: SendDesktopInvitesOptions): Promise<DesktopInviteDelivery[]>;
3
+ export declare interface InviteLinkOptions {
4
+ email?: string
5
+ team?: string
6
+ role?: string
7
+ expiresAt?: Date | string
8
+ }
9
+ export declare interface DesktopInviteRecipient {
10
+ email: string
11
+ name?: string
12
+ team?: string
13
+ role?: string
14
+ }
15
+ export declare interface DesktopInviteDelivery {
16
+ recipient: DesktopInviteRecipient
17
+ url: string
18
+ delivered: boolean
19
+ error?: string
20
+ }
21
+ export declare interface SendDesktopInvitesOptions {
22
+ baseUrl: string
23
+ expiresAt?: Date | string
24
+ createToken: (recipient: DesktopInviteRecipient) => string | Promise<string>
25
+ send: (invite: { recipient: DesktopInviteRecipient, url: string }) => void | Promise<void>
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ export declare function desktopSupport(platform?: string, architecture?: string): DesktopSupportRow | undefined;
2
+ export declare function assertDesktopReleaseChannel(channel: 'experimental' | 'stable', platform?: string, architecture?: string): DesktopSupportRow;
3
+ export declare const desktopSupportMatrix: readonly DesktopSupportRow[];
4
+ export declare interface DesktopSupportRow {
5
+ platform: 'darwin' | 'linux' | 'win32'
6
+ architecture: 'arm64' | 'x64'
7
+ status: DesktopSupportStatus
8
+ osVersions: string[]
9
+ packageFormat: string
10
+ signing: 'enforced' | 'pending'
11
+ notarization: 'enforced' | 'pending' | 'not-applicable'
12
+ installLaunchEvidence: string | null
13
+ updateRollbackEvidence: string | null
14
+ packagingEvidence: string
15
+ blockingIssues: string[]
16
+ limitations: string[]
17
+ }
18
+ export type DesktopSupportStatus = 'stable' | 'experimental' | 'unsupported';
@@ -0,0 +1,31 @@
1
+ export declare function checkForDesktopUpdate(options: CheckDesktopUpdateOptions): Promise<DesktopUpdateManifest | null>;
2
+ export declare function stageDesktopUpdate(manifest: DesktopUpdateManifest, destination: string, fetcher?: DesktopFetcher, trustedKeys?: Record<string, string>): Promise<StagedDesktopUpdate>;
3
+ export declare function compareVersions(left: string, right: string): number;
4
+ export declare function validateUpdateManifest(input: unknown): DesktopUpdateManifest;
5
+ export declare function updateManifestPayload(manifest: DesktopUpdateManifest): Buffer;
6
+ export declare function verifyUpdateManifestSignature(manifest: DesktopUpdateManifest, trustedKeys: Record<string, string>): void;
7
+ export declare interface DesktopUpdateManifest {
8
+ version: string
9
+ url: string
10
+ sha256: string
11
+ size: number
12
+ sourceRevision: string
13
+ platform: string
14
+ architecture: string
15
+ signingKeyId: string
16
+ signature: string
17
+ publishedAt?: string
18
+ notes?: string
19
+ }
20
+ export declare interface CheckDesktopUpdateOptions {
21
+ currentVersion: string
22
+ manifestUrl: string
23
+ trustedKeys: Record<string, string>
24
+ fetcher?: DesktopFetcher
25
+ }
26
+ export declare interface StagedDesktopUpdate {
27
+ manifest: DesktopUpdateManifest
28
+ path: string
29
+ bytes: number
30
+ }
31
+ export type DesktopFetcher = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
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.70.261",
5
+ "version": "0.70.262",
6
6
  "description": "Build and launch Craft desktop applications for Stacks",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -67,8 +67,8 @@
67
67
  "prepublishOnly": "bun run build"
68
68
  },
69
69
  "devDependencies": {
70
- "@stacksjs/build": "0.70.261",
70
+ "@stacksjs/build": "0.70.262",
71
71
  "better-dx": "^0.2.17",
72
- "@stacksjs/server": "0.70.261"
72
+ "@stacksjs/server": "0.70.262"
73
73
  }
74
74
  }