@stacksjs/desktop-build 0.75.685 → 0.75.687

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.
@@ -1,6 +1,7 @@
1
1
  import { desktopAppPaths } from './webview-agent';
2
2
  import type { AgentBundleFiles, StacksAgentHandlerOptions } from './agent-launcher';
3
3
  import type { BeforeDesktopUpdate, DesktopUpdater } from './update-install';
4
+ import type { BundledConfig } from '@stacksjs/config/sources';
4
5
  import type { SecondInstanceLaunch, WebviewAgent, WebviewAgentContext, WebviewHandler, WebviewViews } from './webview-agent';
5
6
  /** A module's default export, as a `WebviewAgentModule`: a bare function is its `fetch`. */
6
7
  export declare function agentModuleOf(loaded: unknown): WebviewAgentModule;
@@ -42,6 +43,30 @@ export declare function resolveWebviewRuntime(manifest: Pick<WebviewAppManifest,
42
43
  * resolves 0 without booting anything.
43
44
  */
44
45
  export declare function runWebviewApp(options: RunWebviewAppOptions): Promise<number>;
46
+ /**
47
+ * The page a failed start shows: the app's name, the reason, and where the
48
+ * log is. Static, with no script, and every value escaped.
49
+ */
50
+ export declare function renderFailurePage(options: { appName: string, reason: string, logFile?: string }): string;
51
+ /**
52
+ * Show why the app could not start, in a small window of its own, and resolve
53
+ * once it is closed. The page is served from loopback for as long as the
54
+ * window is open. The window keeps its titlebar whatever the app's own
55
+ * window does, so it can always be moved and closed.
56
+ */
57
+ export declare function showFailureWindow(options: {
58
+ manifest: Pick<WebviewAppManifest, 'appName' | 'appId' | 'window' | 'runtimeFlags'>
59
+ runtime: string
60
+ reason: string
61
+ logFile?: string
62
+ spawn: (command: string[], env: Record<string, string>) => SpawnedWindow
63
+ launch?: { args?: string[], url?: string }
64
+ }): Promise<void>;
65
+ /**
66
+ * Register the compiled-in config and load it. Throws when a file threw, so
67
+ * the app does not start on the framework defaults for that section.
68
+ */
69
+ export declare function loadBundledConfig(config: BundledConfig): Promise<void>;
45
70
  /**
46
71
  * The app's routes as a webview handler: their answer, or nothing when no
47
72
  * route matches, so the views answer the window's pages. A route's own 404
@@ -67,6 +92,8 @@ export declare function renderWebviewEntry(options: {
67
92
  migrations?: Record<string, string>
68
93
 
69
94
  migrationRunner?: string
95
+
96
+ configFiles?: Record<string, string>
70
97
  } & AgentBundleFiles): string;
71
98
  /** The agent module a project uses: `agent.entry`, else `app/Desktop/Agent.ts` when it exists. */
72
99
  export declare function webviewAgentEntry(root: string, entry?: string): string | undefined;
@@ -145,6 +172,7 @@ export declare interface RunWebviewAppOptions {
145
172
  onAgent?: (agent: WebviewAgent) => void
146
173
  app?: Pick<StacksAgentHandlerOptions, 'routes' | 'actions' | 'middleware'>
147
174
  database?: WebviewDatabase
175
+ config?: BundledConfig
148
176
  }
149
177
  /** What `runWebviewApp` needs to bring the app's database up to date. */
150
178
  export declare interface WebviewDatabase {
@@ -1,12 +1,37 @@
1
1
  import{createHash}from"node:crypto";import{chmodSync,copyFileSync,existsSync,mkdirSync,readFileSync,renameSync,rmSync,writeFileSync}from"node:fs";import{dirname,isAbsolute,join,resolve}from"node:path";import process from"node:process";import{fileURLToPath}from"node:url";import{newAgentToken}from"./agent";import{agentBundleSource,logToFileWhenDetached,stacksAgentHandler}from"./agent-launcher";import{createDesktopUpdater,updateRequestHandler}from"./update-install";import{applyWidenedPath,desktopAppPaths,INSTANCE_HEADER,INSTANCE_PATH,startWebviewAgent}from"./webview-agent";export const OPTIONAL_CRAFT_FLAGS=["--single-instance","--deep-link","--app-name"];export const WEBVIEW_RUNTIME_NAME="craft-runtime";export const WAIT_PID_FLAG="--wait-pid=";export function agentModuleOf(loaded){const value=loaded&&typeof loaded==="object"&&"default"in loaded?loaded.default:loaded;if(typeof value==="function")return{fetch:value};return value&&typeof value==="object"?value:{}}function readInstance(lockFile){try{const record=JSON.parse(readFileSync(lockFile,"utf8"));return Number.isInteger(record.pid)&&typeof record.secret==="string"?{pid:record.pid,port:Number(record.port)||0,secret:record.secret}:null}catch{return null}}function isAlive(pid){try{process.kill(pid,0);return true}catch(error){return error.code==="EPERM"}}function writeInstance(lockFile,record){mkdirSync(dirname(lockFile),{recursive:true});const temporary=`${lockFile}.${record.pid}`;writeFileSync(temporary,JSON.stringify(record),{mode:384});renameSync(temporary,lockFile)}export function acquireWebviewInstance(lockFile,pid=process.pid){const holder=readInstance(lockFile);if(holder&&holder.pid!==pid&&isAlive(holder.pid))return{acquired:false,holder};const record={pid,port:0,secret:newAgentToken()};writeInstance(lockFile,record);return{acquired:true,record}}export function publishInstancePort(lockFile,record,port){record.port=port;writeInstance(lockFile,record)}export function releaseWebviewInstance(lockFile,pid=process.pid){if(readInstance(lockFile)?.pid===pid)rmSync(lockFile,{force:true})}export function parseLaunchArguments(argv,urlSchemes=[]){const args=[];let url;let waitPid;for(const arg of argv){if(arg.startsWith(WAIT_PID_FLAG)){const pid=Number(arg.slice(WAIT_PID_FLAG.length));if(Number.isInteger(pid)&&pid>0)waitPid=pid;continue}if(arg.startsWith("-psn_"))continue;if(!url&&urlSchemes.some((scheme)=>arg.toLowerCase().startsWith(`${scheme.toLowerCase()}:`))){url=arg;continue}args.push(arg)}return{args,...url?{url}:{},...waitPid?{waitPid}:{}}}export async function forwardToInstance(lockFile,launch,options={}){const fetcher=options.fetcher??fetch;for(let attempt=0;attempt<(options.attempts??40);attempt++){const holder=readInstance(lockFile);if(!holder||!isAlive(holder.pid))return false;if(holder.port){try{const response=await fetcher(`http://127.0.0.1:${holder.port}${INSTANCE_PATH}`,{method:"POST",headers:{"content-type":"application/json",[INSTANCE_HEADER]:holder.secret},body:JSON.stringify(launch)});if(response.status===204)return true}catch{}}await Bun.sleep(options.delayMs??125)}return false}export function craftWindowCommand(manifest,runtime,url,launch={}){const{window}=manifest;const has=(flag)=>manifest.runtimeFlags?.includes(flag)===true;return[runtime,"--url",url,"--title",window.title,"--width",String(window.width),"--height",String(window.height),...has("--app-name")?["--app-name",manifest.appName]:[],...has("--single-instance")?["--single-instance",manifest.appId,...(launch.args??[]).flatMap((arg)=>["--instance-arg",arg])]:[],...launch.url&&has("--deep-link")?["--deep-link",launch.url]:[],...window.devtools?[]:["--no-devtools"],...window.darkMode===true?["--dark"]:window.darkMode===false?["--light"]:[],...window.titlebarHidden?["--titlebar-hidden"]:[],...window.arguments??[]]}export function resolveWebviewRuntime(manifest,options){const platform=options.platform??process.platform;const name=platform==="win32"?`${WEBVIEW_RUNTIME_NAME}.exe`:WEBVIEW_RUNTIME_NAME;if(manifest.runtime==="beside")return join(dirname(options.execPath??process.execPath),name);if(manifest.runtime!=="embedded")return manifest.runtime;if(!options.embedded)throw new Error("This app was built with an embedded Craft runtime, but none was compiled in.");const bytes=readFileSync(options.embedded);const digest=createHash("sha256").update(bytes).digest("hex");const target=join(options.dataDir,"runtime",digest.slice(0,16),name);const current=existsSync(target)?createHash("sha256").update(readFileSync(target)).digest("hex"):"";if(current!==digest){mkdirSync(dirname(target),{recursive:true});const temporary=`${target}.${process.pid}`;writeFileSync(temporary,bytes,{mode:493});renameSync(temporary,target)}if(platform!=="win32")chmodSync(target,493);return target}async function waitForExit(pid,timeoutMs=15000){const until=Date.now()+timeoutMs;while(isAlive(pid)&&Date.now()<until)await Bun.sleep(100)}function defaultArgv(){return process.argv.slice(2)}function spawnCraft(command,env){const child=Bun.spawn(command,{env:{...process.env,...env},stdio:["ignore","inherit","pipe"]});new Response(child.stderr).text().then((stderr)=>{const lines=stderr.split(`
2
2
  `).filter((line)=>line.trim());if(lines.length)console.error(`[craft] ${lines.join(`
3
- `)}`)});return{exited:child.exited,kill:()=>child.kill()}}export async function runWebviewApp(options){const{manifest}=options;const paths=options.paths??desktopAppPaths(manifest.appName);const tag=`[${manifest.appName}]`;if(options.logWhenDetached!==false)logToFileWhenDetached(paths.logFile);const launch=parseLaunchArguments(options.argv??defaultArgv(),manifest.urlSchemes);const incoming={args:launch.args,cwd:process.cwd(),...launch.url?{url:launch.url}:{}};const spawn=options.spawn??spawnCraft;if(launch.waitPid)await waitForExit(launch.waitPid);let runtime;try{runtime=resolveWebviewRuntime(manifest,{embedded:options.embeddedRuntime,dataDir:paths.dataDir});if(!existsSync(runtime))throw new Error(`the Craft runtime is missing: ${runtime}`)}catch(error){console.error(`${tag} could not start: ${error instanceof Error?error.message:String(error)}`);return 1}const lock=acquireWebviewInstance(paths.lockFile);if(!lock.acquired){const reached=await forwardToInstance(paths.lockFile,incoming);if((options.platform??process.platform)!=="darwin"&&manifest.runtimeFlags?.includes("--single-instance"))await spawn(craftWindowCommand(manifest,runtime,"about:blank",incoming),{}).exited.catch(()=>0);console.log(reached?`${tag} already running; handed over`:`${tag} already running`);return 0}applyWidenedPath();let module={};let agent;let updater;try{if(options.database){const databasePath=join(paths.dataDir,"database.sqlite");const{applied}=options.database.migrate({databasePath,migrations:options.database.migrations});if(applied.length)console.log(`${tag} applied ${applied.length} migration(s) to ${databasePath}`);process.env.DB_CONNECTION="sqlite";process.env.DB_DATABASE_PATH=databasePath}module=options.module?agentModuleOf(await options.module()):{};if(manifest.updates){updater=createDesktopUpdater({appName:manifest.appName,currentVersion:manifest.version,feedUrl:manifest.updates.feedUrl,trustedKeys:manifest.updates.publicKeys,channel:manifest.updates.channel,updatesDir:paths.updatesDir,beforeUpdate:module.beforeUpdate})}const answerUpdate=updater?updateRequestHandler(updater):undefined;const answerApp=options.app?appRouteHandler(await stacksAgentHandler({appRoutes:false,...options.app}),(await import("@stacksjs/router")).isUnmatchedRouteResponse):undefined;agent=await startWebviewAgent({appName:manifest.appName,version:manifest.version,views:options.views,port:manifest.port,portFile:paths.portFile,dataDir:paths.dataDir,publicPaths:manifest.publicPaths,instanceSecret:lock.record.secret,handler:async(request,context)=>await answerUpdate?.(request)??await module.fetch?.(request,context)??answerApp?.(request),onSecondInstance:(next)=>module.secondInstance?.(next)});publishInstancePort(paths.lockFile,lock.record,agent.port);await module.start?.({appName:manifest.appName,version:manifest.version,origin:agent.origin,port:agent.port,dataDir:paths.dataDir,launch:incoming,...updater?{updater}:{}})}catch(error){console.error(`${tag} could not start: ${error instanceof Error?error.stack??error.message:String(error)}`);releaseWebviewInstance(paths.lockFile);return 1}options.onAgent?.(agent);console.log(`${tag} ${manifest.version} serving on ${agent.origin}`);const window=spawn(craftWindowCommand(manifest,runtime,agent.launchUrl(manifest.startPath),incoming),{CRAFT_RELAUNCH_EXECUTABLE:process.execPath,CRAFT_RELAUNCH_ARGS:JSON.stringify([...process.execPath.endsWith("bun")||process.execPath.endsWith("bun.exe")?[process.argv[1]??""]:[],`${WAIT_PID_FLAG}${process.pid}`])});const hours=manifest.updates?.checkEveryHours??24;let timer;if(updater&&hours>0){const check=()=>{updater.check().catch(()=>{})};agent.windowReady.then(check);timer=setInterval(check,hours*3600000);timer.unref?.()}let stopped=false;const stop=async()=>{if(stopped)return;stopped=true;if(timer)clearInterval(timer);window.kill();try{await module.stop?.()}catch(error){console.error(`${tag} stop: ${error instanceof Error?error.message:String(error)}`)}agent.stop();releaseWebviewInstance(paths.lockFile)};const signals=process.platform==="win32"?["SIGINT","SIGTERM"]:["SIGTERM","SIGINT","SIGHUP"];const onSignal=()=>{stop().then(()=>process.exit(0))};for(const signal of signals)process.on(signal,onSignal);const code=await window.exited;console.log(`${tag} window closed (${code})`);for(const signal of signals)process.off(signal,onSignal);await stop();await updater?.relaunchIfInstalled();return 0}export function appRouteHandler(handler,unmatched){return async(request)=>{const response=await handler(request);return await unmatched(response,request)?undefined:response}}export function renderWebviewEntry(options){const launcher=options.launcherModule??fileURLToPath(import.meta.url);const bundled=options.routes?.length?agentBundleSource(options):undefined;const files=Object.entries(options.viewFiles??{});const imports=files.map(([,file],index)=>`import view${index} from ${JSON.stringify(file)} with { type: 'file' }`);const migrations=options.migrations?Object.entries(options.migrations):undefined;if(migrations){imports.push(`import { migrateCompiledDatabase } from ${JSON.stringify(options.migrationRunner??"@stacksjs/database/compiled-migrations")}`);migrations.forEach(([,file],index)=>imports.push(`import migration${index} from ${JSON.stringify(file)} with { type: 'text' }`))}const database=migrations?`
3
+ `)}`)});return{exited:child.exited,kill:()=>child.kill()}}export async function runWebviewApp(options){const{manifest}=options;const paths=options.paths??desktopAppPaths(manifest.appName);const tag=`[${manifest.appName}]`;const loggingToFile=options.logWhenDetached!==false&&logToFileWhenDetached(paths.logFile);const launch=parseLaunchArguments(options.argv??defaultArgv(),manifest.urlSchemes);const incoming={args:launch.args,cwd:process.cwd(),...launch.url?{url:launch.url}:{}};const spawn=options.spawn??spawnCraft;if(launch.waitPid)await waitForExit(launch.waitPid);let runtime;try{runtime=resolveWebviewRuntime(manifest,{embedded:options.embeddedRuntime,dataDir:paths.dataDir});if(!existsSync(runtime))throw new Error(`the Craft runtime is missing: ${runtime}`)}catch(error){console.error(`${tag} could not start: ${error instanceof Error?error.message:String(error)}`);return 1}const lock=acquireWebviewInstance(paths.lockFile);if(!lock.acquired){const reached=await forwardToInstance(paths.lockFile,incoming);if((options.platform??process.platform)!=="darwin"&&manifest.runtimeFlags?.includes("--single-instance"))await spawn(craftWindowCommand(manifest,runtime,"about:blank",incoming),{}).exited.catch(()=>0);console.log(reached?`${tag} already running; handed over`:`${tag} already running`);return 0}applyWidenedPath();let module={};let agent;let serving;let updater;try{if(options.database){const databasePath=join(paths.dataDir,"database.sqlite");const{applied}=options.database.migrate({databasePath,migrations:options.database.migrations});if(applied.length)console.log(`${tag} applied ${applied.length} migration(s) to ${databasePath}`);process.env.DB_CONNECTION="sqlite";process.env.DB_DATABASE_PATH=databasePath}if(options.config)await loadBundledConfig(options.config);module=options.module?agentModuleOf(await options.module()):{};if(manifest.updates){updater=createDesktopUpdater({appName:manifest.appName,currentVersion:manifest.version,feedUrl:manifest.updates.feedUrl,trustedKeys:manifest.updates.publicKeys,channel:manifest.updates.channel,updatesDir:paths.updatesDir,beforeUpdate:module.beforeUpdate})}const answerUpdate=updater?updateRequestHandler(updater):undefined;const answerApp=options.app?appRouteHandler(await stacksAgentHandler({appRoutes:false,...options.app}),(await import("@stacksjs/router")).isUnmatchedRouteResponse):undefined;const{describeConfigSource,settledConfigSource}=await import("@stacksjs/config/sources");const source=await settledConfigSource();if(source)console.log(`${tag} ${describeConfigSource(source)}`);agent=await startWebviewAgent({appName:manifest.appName,version:manifest.version,views:options.views,port:manifest.port,portFile:paths.portFile,dataDir:paths.dataDir,publicPaths:manifest.publicPaths,instanceSecret:lock.record.secret,handler:async(request,context)=>await answerUpdate?.(request)??await module.fetch?.(request,context)??answerApp?.(request),onSecondInstance:(next)=>module.secondInstance?.(next)});serving=agent;publishInstancePort(paths.lockFile,lock.record,agent.port);await module.start?.({appName:manifest.appName,version:manifest.version,origin:agent.origin,port:agent.port,dataDir:paths.dataDir,launch:incoming,...updater?{updater}:{}})}catch(error){console.error(`${tag} could not start: ${error instanceof Error?error.stack??error.message:String(error)}`);serving?.stop();await showFailureWindow({manifest,runtime,reason:error instanceof Error?error.message:String(error),...loggingToFile?{logFile:paths.logFile}:{},spawn,launch:incoming}).catch((shown)=>console.error(`${tag} could not show why: ${shown instanceof Error?shown.message:String(shown)}`));releaseWebviewInstance(paths.lockFile);return 1}options.onAgent?.(agent);console.log(`${tag} ${manifest.version} serving on ${agent.origin}`);const window=spawn(craftWindowCommand(manifest,runtime,agent.launchUrl(manifest.startPath),incoming),{CRAFT_RELAUNCH_EXECUTABLE:process.execPath,CRAFT_RELAUNCH_ARGS:JSON.stringify([...process.execPath.endsWith("bun")||process.execPath.endsWith("bun.exe")?[process.argv[1]??""]:[],`${WAIT_PID_FLAG}${process.pid}`])});const hours=manifest.updates?.checkEveryHours??24;let timer;if(updater&&hours>0){const check=()=>{updater.check().catch(()=>{})};agent.windowReady.then(check);timer=setInterval(check,hours*3600000);timer.unref?.()}let stopped=false;const stop=async()=>{if(stopped)return;stopped=true;if(timer)clearInterval(timer);window.kill();try{await module.stop?.()}catch(error){console.error(`${tag} stop: ${error instanceof Error?error.message:String(error)}`)}agent.stop();releaseWebviewInstance(paths.lockFile)};const signals=process.platform==="win32"?["SIGINT","SIGTERM"]:["SIGTERM","SIGINT","SIGHUP"];const onSignal=()=>{stop().then(()=>process.exit(0))};for(const signal of signals)process.on(signal,onSignal);const code=await window.exited;console.log(`${tag} window closed (${code})`);for(const signal of signals)process.off(signal,onSignal);await stop();await updater?.relaunchIfInstalled();return 0}export function renderFailurePage(options){const escape=(text)=>text.replace(/[&<>"']/g,(char)=>`&#${char.charCodeAt(0)};`);const name=escape(options.appName);return`<!doctype html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <title>${name} could not start</title>
8
+ <style>
9
+ :root { color-scheme: light dark; --fg: #1d1d1f; --muted: #6e6e73; --bg: #ffffff; --panel: #f5f5f7; }
10
+ @media (prefers-color-scheme: dark) { :root { --fg: #f5f5f7; --muted: #a1a1a6; --bg: #1d1d1f; --panel: #2c2c2e; } }
11
+ body { margin: 0; padding: 28px 32px; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; color: var(--fg); background: var(--bg); }
12
+ h1 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
13
+ pre { margin: 0 0 16px; padding: 12px 14px; border-radius: 8px; background: var(--panel); white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
14
+ p { margin: 0; color: var(--muted); }
15
+ code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <h1>${name} could not start</h1>
20
+ <pre>${escape(options.reason)}</pre>
21
+ <p>${options.logFile?`Closing this window quits the app. The details are also in <code>${escape(options.logFile)}</code>.`:"Closing this window quits the app."}</p>
22
+ </body>
23
+ </html>
24
+ `}export async function showFailureWindow(options){const page=renderFailurePage({appName:options.manifest.appName,reason:options.reason,...options.logFile?{logFile:options.logFile}:{}});const server=Bun.serve({hostname:"127.0.0.1",port:0,fetch:()=>new Response(page,{headers:{"content-type":"text/html; charset=utf-8","content-security-policy":"default-src 'none'; style-src 'unsafe-inline'","cache-control":"no-store"}})});try{const{window}=options.manifest;const manifest={...options.manifest,window:{title:`${options.manifest.appName} could not start`,width:560,height:340,...window.darkMode!==undefined?{darkMode:window.darkMode}:{}}};await options.spawn(craftWindowCommand(manifest,options.runtime,`http://127.0.0.1:${server.port}/`,{args:options.launch?.args??[]}),{}).exited}finally{server.stop(true)}}export async function loadBundledConfig(config){const{configSource,registerBundledConfig}=await import("@stacksjs/config/sources");registerBundledConfig(config);await(await import("@stacksjs/config")).overridesReady;const failed=configSource()?.failed??[];if(failed.length)throw new Error(`config failed to load: ${failed.map((file)=>`config/${file.name}.ts: ${file.error}`).join("; ")}`)}export function appRouteHandler(handler,unmatched){return async(request)=>{const response=await handler(request);return await unmatched(response,request)?undefined:response}}export function renderWebviewEntry(options){const launcher=options.launcherModule??fileURLToPath(import.meta.url);const bundled=options.routes?.length?agentBundleSource(options):undefined;const files=Object.entries(options.viewFiles??{});const imports=files.map(([,file],index)=>`import view${index} from ${JSON.stringify(file)} with { type: 'file' }`);const migrations=options.migrations?Object.entries(options.migrations):undefined;if(migrations){imports.push(`import { migrateCompiledDatabase } from ${JSON.stringify(options.migrationRunner??"@stacksjs/database/compiled-migrations")}`);migrations.forEach(([,file],index)=>imports.push(`import migration${index} from ${JSON.stringify(file)} with { type: 'text' }`))}const database=migrations?`
4
25
  database: {
5
26
  migrations: {
6
27
  ${migrations.map(([name],index)=>` ${JSON.stringify(name)}: migration${index},`).join(`
7
28
  `)}
8
29
  },
9
30
  migrate: migrateCompiledDatabase,
31
+ },`:"";const configFiles=Object.entries(options.configFiles??{});const config=configFiles.length?`
32
+ config: {
33
+ ${configFiles.map(([name,file])=>` ${JSON.stringify(name)}: () => import(${JSON.stringify(file)}),`).join(`
34
+ `)}
10
35
  },`:"";if(options.embeddedRuntime)imports.push(`import embeddedRuntime from ${JSON.stringify(options.embeddedRuntime)} with { type: 'file' }`);const views=options.stxViews?`{ kind: 'stx', ...${JSON.stringify(options.stxViews)} }`:files.length?`{ kind: 'embedded', files: {
11
36
  ${files.map(([path],index)=>` ${JSON.stringify(path)}: view${index},`).join(`
12
37
  `)}
@@ -29,6 +54,6 @@ process.exit(await runWebviewApp({
29
54
  `)},
30
55
  middleware: ${bundled.middleware.replace(/\n/g,`
31
56
  `)},
32
- },`:""}${database}
57
+ },`:""}${database}${config}
33
58
  }))
34
59
  `}export function webviewAgentEntry(root,entry){if(entry){const file=isAbsolute(entry)?entry:resolve(root,entry);if(!existsSync(file))throw new Error(`desktop.webview.agent.entry does not exist: ${file}`);return file}const conventional=join(root,"app/Desktop/Agent.ts");return existsSync(conventional)?conventional:undefined}export function copyExecutable(from,to){mkdirSync(dirname(to),{recursive:true});copyFileSync(from,to);if(process.platform!=="win32")chmodSync(to,493)}
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.75.685",
5
+ "version": "0.75.687",
6
6
  "description": "Build and launch Craft desktop applications for Stacks",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -73,17 +73,17 @@
73
73
  "prepublishOnly": "bun run build"
74
74
  },
75
75
  "dependencies": {
76
- "@stacksjs/config": "0.75.685",
77
- "@stacksjs/router": "0.75.685",
78
- "@stacksjs/server": "0.75.685",
79
- "@stacksjs/storage": "0.75.685",
76
+ "@stacksjs/config": "0.75.687",
77
+ "@stacksjs/router": "0.75.687",
78
+ "@stacksjs/server": "0.75.687",
79
+ "@stacksjs/storage": "0.75.687",
80
80
  "craft-native": ">=0.0.505"
81
81
  },
82
82
  "peerDependencies": {
83
- "@stacksjs/config": "0.75.685",
84
- "@stacksjs/router": "0.75.685",
85
- "@stacksjs/server": "0.75.685",
86
- "@stacksjs/storage": "0.75.685"
83
+ "@stacksjs/config": "0.75.687",
84
+ "@stacksjs/router": "0.75.687",
85
+ "@stacksjs/server": "0.75.687",
86
+ "@stacksjs/storage": "0.75.687"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@stacksjs/config": {
@@ -100,7 +100,7 @@
100
100
  }
101
101
  },
102
102
  "devDependencies": {
103
- "@stacksjs/build": "0.75.685",
103
+ "@stacksjs/build": "0.75.687",
104
104
  "better-dx": "^0.2.39"
105
105
  }
106
106
  }