/** What an app's package.json asks for under `bundle.app`. */ export interface AppDeclaration { title: string; description?: string | undefined; args: string[]; categories: string[]; icons: Partial>; } export type IconFormat = 'svg' | 'png' | 'icns' | 'ico'; /** The largest icon file read out of an archive. */ export declare const MAX_ICON: number; /** * The entry an archive asks for: its declaration, or why it is not one, or * neither when it asks for none. Reading it runs nothing. */ export declare function readDeclaration(bytes: Buffer): { app?: AppDeclaration | undefined; problem?: string | undefined; }; /** What is wrong with a `bundle.app` declaration, or undefined when nothing is. */ export declare function declarationProblem(app: unknown): string | undefined; /** * The declared icons, read out of the archive: each a file of at most * `MAX_ICON` bytes that starts the way its format does. One that is missing * or is not what it says is left out, with a note saying so. */ export declare function readIcons(bytes: Buffer, app: AppDeclaration): { icons: Partial>; notes: string[]; }; /** * What `bundle create` says about an app's declaration, from the files it is * about to pack: the declaration, which icon formats it will have, and * everything that will keep an install from making the entry it asks for. */ export declare function checkSource(base: string, files: readonly string[]): { app?: AppDeclaration | undefined; formats: IconFormat[]; problems: string[]; }; /** Where an entry goes: the platform and its user's directories. Injected by tests. */ export interface Places { platform: NodeJS.Platform; home: string; /** `$XDG_DATA_HOME`, or `~/.local/share`. */ dataHome: string; /** `%APPDATA%` and `%LOCALAPPDATA%`, on Windows. */ appData: string; localAppData: string; } export declare function currentPlaces(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): Places; /** What making an entry writes and runs, and what taking it away removes. */ export interface Plan { kind: string; /** Where a person finds it: the entry itself. */ entry: string; files: { path: string; content: Buffer; mode?: number | undefined; }[]; /** Run in order once the files are written; a failure is a note, not a failed install. */ commands: string[][]; /** Removed, in order, when it is taken away — files and the directories that hold only them. */ remove: string[]; } export interface PlanInput { /** The name it is installed as: what identifies it. */ name: string; app: AppDeclaration; icons: Partial>; /** The installed archive, which the entry runs. */ archive: string; /** On Windows, the node that runs it — what the .nzip association names. */ node?: string | undefined; places: Places; } /** The plan for this platform, or undefined on one that has no menu bundle knows how to add to. */ export declare function planFor(input: PlanInput): Plan | undefined; /** The name, as it is safe in a file name on every system: what an entry's files are called after. */ export declare function idOf(name: string): string; /** * The title, as a file name a person sees — the `.app` in Applications, the * shortcut in Start: no separators or characters Windows refuses, no leading * or trailing dots or spaces, and none of the names Windows reserves. */ export declare function fileTitle(title: string): string; /** A value of the desktop entry spec's `string` type: one line, with its backslashes escaped. */ export declare function desktopString(value: string): string; /** * One argument of an `Exec=` line: always in double quotes, with `"`, `` ` ``, * `$` and `\` escaped inside them as the spec says — and then, because the * line is itself a `string` value, every backslash escaped again — and `%` * doubled, so no field code is read into it. */ export declare function execArg(arg: string): string; /** The bundle identifier prefix of the apps bundle writes, by which it knows its own. */ export declare const MAC_ID_PREFIX = "com.pipobscure.bundle.app."; /** A word for `/bin/sh`: in single quotes, each `'` closed, escaped and reopened. */ export declare function shQuote(word: string): string; /** PowerShell's single-quoted string: nothing inside is interpreted, and ' doubles. */ export declare function psQuote(text: string): string; /** How a plan's commands run — injected by tests, which have none of them. */ export type Runner = (command: string, args: string[]) => { status: number | null; error?: Error | undefined; stderr?: string | undefined; }; export interface Made { /** What was made, to remember with the install — and remove with it. */ paths: string[]; /** Where a person finds it, when there is one. */ entry?: string | undefined; notes: string[]; } /** * Carry `plan` out: unless something not bundle's is where its entry goes, * write its files and run its commands. `ours` is what this install made * before, which it may replace; anything of that the new plan does not make * — a renamed title's old entry — is taken away. */ export declare function make(plan: Plan, { ours, name, runner, places }: { ours?: readonly string[] | undefined; name: string; runner: Runner; places?: Places | undefined; }): Made; /** * Remove what an entry made. Only ever paths inside the directories entries * are made in — whatever a record says — so a record edited by hand cannot * make this delete anything else. */ export declare function takeAway(paths: readonly string[], places?: Places): string[]; //# sourceMappingURL=app-entry.d.ts.map