app-builder-lib 26.15.4 → 26.15.5

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,13 +1,15 @@
1
1
  import { Arch } from "builder-util";
2
+ import { Nullish } from "builder-util-runtime";
2
3
  import { PlugDescriptor, SlotDescriptor, SnapOptions24 } from "../../options/SnapOptions";
3
4
  import { SnapCore } from "./SnapTarget";
4
5
  import { SnapcraftYAML } from "./snapcraft";
5
- import { Nullish } from "builder-util-runtime";
6
6
  /** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */
7
7
  export declare class SnapCore24 extends SnapCore<SnapOptions24> {
8
8
  defaultPlugs: string[];
9
9
  readonly configRelativePath = "snap";
10
10
  readonly guiRelativePath: string;
11
+ private removeChromeSandbox;
12
+ private commandArgs;
11
13
  createDescriptor(arch: Arch): Promise<SnapcraftYAML>;
12
14
  private isHostMode;
13
15
  /** Writes the snapcraft.yaml, stages app files, then invokes `buildSnap()` to run the actual snapcraft build. */
@@ -2,12 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SnapCore24 = void 0;
4
4
  const builder_util_1 = require("builder-util");
5
+ const builder_util_runtime_1 = require("builder-util-runtime");
5
6
  const fs_extra_1 = require("fs-extra");
7
+ const yaml = require("js-yaml");
6
8
  const path = require("path");
7
9
  const SnapTarget_1 = require("./SnapTarget");
10
+ const snapCommand_js_1 = require("./snapCommand.js");
8
11
  const snapcraftBuilder_1 = require("./snapcraftBuilder");
9
- const yaml = require("js-yaml");
10
- const builder_util_runtime_1 = require("builder-util-runtime");
12
+ // Electron's setuid sandbox helper. Removed from the staged app when the snap runs with
13
+ // `--no-sandbox` (snap confinement supplies its own sandbox via the browser-support interface).
14
+ const CHROME_SANDBOX = "chrome-sandbox";
15
+ // Launcher script name used when the app command cannot be expressed inline (see resolveSnapCommand).
16
+ const SNAP_COMMAND_LAUNCHER = "command.sh";
11
17
  /** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */
12
18
  class SnapCore24 extends SnapTarget_1.SnapCore {
13
19
  constructor() {
@@ -20,6 +26,12 @@ class SnapCore24 extends SnapTarget_1.SnapCore {
20
26
  // - Desktop files in meta/gui/ are used for menu integration
21
27
  this.configRelativePath = "snap";
22
28
  this.guiRelativePath = path.join(this.configRelativePath, "gui");
29
+ // Computed in createDescriptor (mapSnapOptionsToSnapcraftYAML) and consumed in buildSnap.
30
+ // getSnapCore() returns a fresh SnapCore24 per arch build, so this per-instance state is
31
+ // never shared across builds.
32
+ this.removeChromeSandbox = false;
33
+ // Args embedded into the generated launcher script (executableArgs + forceX11/no-sandbox flags).
34
+ this.commandArgs = [];
23
35
  }
24
36
  async createDescriptor(arch) {
25
37
  return await this.mapSnapOptionsToSnapcraftYAML(arch);
@@ -61,6 +73,16 @@ class SnapCore24 extends SnapTarget_1.SnapCore {
61
73
  builder_util_1.log.debug({ to: builder_util_1.log.filePath(appDir), from: builder_util_1.log.filePath(appOutDir) }, "copying app files to project root app directory");
62
74
  await (0, builder_util_1.copyDir)(appOutDir, appDir);
63
75
  }
76
+ // Drop the setuid chrome-sandbox helper before snapcraft stages the app — it is unusable under
77
+ // strict confinement when launching with --no-sandbox (mirrors SnapCoreLegacy).
78
+ if (this.removeChromeSandbox) {
79
+ await (0, fs_extra_1.remove)(path.join(appDir, CHROME_SANDBOX));
80
+ }
81
+ // Write the launcher script the command always points at (see SNAP_COMMAND_LAUNCHER).
82
+ // It lands at the snap root ($SNAP/command.sh) — it is intentionally not added to `organize`.
83
+ const launcherPath = path.join(appDir, SNAP_COMMAND_LAUNCHER);
84
+ await (0, fs_extra_1.writeFile)(launcherPath, (0, snapCommand_js_1.buildSnapCommandLauncherScript)({ execName: this.packager.executableName, args: this.commandArgs }), { mode: 0o755 });
85
+ await (0, fs_extra_1.chmod)(launcherPath, 0o755);
64
86
  // Auto-generate `organize` mapping for the app part so top-level helper
65
87
  // binaries and resources are placed under `app/` inside the snap. Update
66
88
  // the already-written `snapcraft.yaml` so the build sees the mapping.
@@ -68,11 +90,25 @@ class SnapCore24 extends SnapTarget_1.SnapCore {
68
90
  const appPart = snap.parts[snap.name];
69
91
  if (appPart) {
70
92
  const entries = (await (0, fs_extra_1.readdir)(appOutDir)).sort();
71
- const organize = appPart.organize || {};
93
+ // Null-prototype map: entry names come from the filesystem, so a top-level file named
94
+ // "__proto__" / "constructor" / "toString" must not read inherited keys (which would make
95
+ // the membership check below skip it) or interact with Object.prototype on assignment.
96
+ const organize = Object.assign(Object.create(null), appPart.organize);
72
97
  for (const entry of entries) {
73
98
  if (!entry) {
74
99
  continue;
75
100
  }
101
+ // Skip files no longer present in the staged app dir (e.g. removed chrome-sandbox) so
102
+ // snapcraft doesn't fail trying to organize a missing source.
103
+ if (this.removeChromeSandbox && entry === CHROME_SANDBOX) {
104
+ continue;
105
+ }
106
+ // Never organize the launcher under app/. It must stay at the snap root ($SNAP/command.sh)
107
+ // to match apps.<name>.command. This matters when appOutDir === appDir, where readdir
108
+ // would otherwise pick up the launcher we just wrote.
109
+ if (entry === SNAP_COMMAND_LAUNCHER) {
110
+ continue;
111
+ }
76
112
  if (organize[entry]) {
77
113
  continue;
78
114
  }
@@ -215,16 +251,20 @@ class SnapCore24 extends SnapTarget_1.SnapCore {
215
251
  extraArgs.push("--ozone-platform=x11");
216
252
  }
217
253
  }
218
- if (this.helper.isElectronVersionGreaterOrEqualThan("5.0.0") && !this.isBrowserSandboxAllowed(rootPlugs)) {
219
- if (!extraArgs.includes("--no-sandbox")) {
220
- extraArgs.push("--no-sandbox");
221
- }
254
+ const noSandbox = this.helper.isElectronVersionGreaterOrEqualThan("5.0.0") && !this.isBrowserSandboxAllowed(rootPlugs);
255
+ if (noSandbox && !extraArgs.includes("--no-sandbox")) {
256
+ extraArgs.push("--no-sandbox");
222
257
  }
223
- const commandSuffix = extraArgs.length > 0 ? ` ${extraArgs.join(" ")}` : "";
258
+ // With --no-sandbox the setuid chrome-sandbox helper is unused; strip it from the snap.
259
+ this.removeChromeSandbox = noSandbox;
260
+ // The command always points at a generated launcher script (written in buildSnap). This keeps a
261
+ // single uniform command path and sidesteps snapd's character/word-splitting rules for the
262
+ // command field (e.g. --ozone-platform=x11, --js-flags="...").
263
+ this.commandArgs = extraArgs;
224
264
  // Create the app configuration
225
265
  const desktopBaseName = this.helper.getDesktopFileName(appName);
226
266
  const app = {
227
- command: `app/${this.packager.executableName}${commandSuffix}`,
267
+ command: SNAP_COMMAND_LAUNCHER,
228
268
  "command-chain": undefined, // explicitly undefined so removeNullish strips it; extensions supply their own command-chain
229
269
  plugs: appPlugs,
230
270
  slots: appSlots,
@@ -1 +1 @@
1
- {"version":3,"file":"core24.js","sourceRoot":"","sources":["../../../src/targets/snap/core24.ts"],"names":[],"mappings":";;;AAAA,+CAA8H;AAC9H,uCAA0D;AAC1D,6BAA4B;AAE5B,6CAAuC;AAEvC,yDAA8F;AAC9F,gCAA+B;AAC/B,+DAAsE;AAEtE,wGAAwG;AACxG,MAAa,UAAW,SAAQ,qBAAuB;IAAvD;;QACE,qGAAqG;QACrG,oGAAoG;QACpG,iBAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;QAElJ,uBAAuB;QACvB,uEAAuE;QACvE,6DAA6D;QACpD,uBAAkB,GAAG,MAAM,CAAA;QAC3B,oBAAe,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;IA+dtE,CAAC;IA7dC,KAAK,CAAC,gBAAgB,CAAC,IAAU;QAC/B,OAAO,MAAM,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAA;IACvD,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,KAAK,IAAI,C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BAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/C,CAAC;CACF;AAxeD,gCAweC","sourcesContent":["import { Arch, archFromString, copyDir, InvalidConfigurationError, log, removeNullish, toLinuxArchString } from \"builder-util\"\nimport { copy, mkdir, readdir, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { PlugDescriptor, SlotDescriptor, SnapOptions24 } from \"../../options/SnapOptions\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { App, Part, SnapcraftYAML } from \"./snapcraft\"\nimport { buildSnap, DEFAULT_STAGE_PACKAGES, SNAPCRAFT_YAML_OPTIONS } from \"./snapcraftBuilder\"\nimport * as yaml from \"js-yaml\"\nimport { deepAssign, isValidKey, Nullish } from \"builder-util-runtime\"\n\n/** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */\nexport class SnapCore24 extends SnapCore<SnapOptions24> {\n // browser-support is intentionally absent here; it is auto-injected in mapSnapOptionsToSnapcraftYAML\n // when the user has not provided custom plugs, so it always lands in both root plugs and app plugs.\n defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\n // Snap file hierarchy:\n // - snap/gui/ gets automatically copied to meta/gui/ in the final snap\n // - Desktop files in meta/gui/ are used for menu integration\n readonly configRelativePath = \"snap\"\n readonly guiRelativePath = path.join(this.configRelativePath, \"gui\")\n\n async createDescriptor(arch: Arch): Promise<SnapcraftYAML> {\n return await this.mapSnapOptionsToSnapcraftYAML(arch)\n }\n\n private isHostMode(): boolean {\n return this.options.useDestructiveMode === true\n }\n\n /** Writes the snapcraft.yaml, stages app files, then invokes `buildSnap()` to run the actual snapcraft build. */\n async buildSnap(params: { snap: SnapcraftYAML; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, appOutDir, stageDir, artifactPath } = params\n\n const snapDirResolved = path.resolve(stageDir, this.configRelativePath)\n const snapcraftYamlPath = path.join(snapDirResolved, \"snapcraft.yaml\")\n\n // Create snap/gui directory for desktop files and icons\n // Snapcraft will automatically copy snap/gui/ contents to meta/gui/ in the final snap\n const guiOutput = path.resolve(stageDir, this.guiRelativePath)\n await mkdir(guiOutput, { recursive: true })\n\n const yamlContent = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, yamlContent, \"utf8\")\n log.debug(snap, \"generated snapcraft.yaml\")\n\n // Copy icon to snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopExtraProps: Record<string, string> = {}\n const icon = this.helper.maxIconPath\n if (icon) {\n const iconFileName = `${snap.name}${path.extname(icon)}`\n await copy(icon, path.join(guiOutput, iconFileName))\n // Icon path will be available at ${SNAP}/meta/gui/<icon-file> after installation\n desktopExtraProps.Icon = `\\${SNAP}/meta/gui/${iconFileName}`\n }\n\n // Create desktop file in snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopFilePath = path.join(guiOutput, `${this.helper.getDesktopFileName(snap.name)}.desktop`)\n await this.helper.writeDesktopEntry(this.options, this.packager.executableName + \" %U\", desktopFilePath, desktopExtraProps)\n\n // Copy app files to the project root `app` directory so `source: app`\n // in the generated `snapcraft.yaml` (which is under `snap/`) can be\n // resolved by snapcraft running in the build environment.\n const appDir = path.resolve(stageDir, \"app\")\n if (path.resolve(appDir) !== path.resolve(appOutDir)) {\n log.debug({ to: log.filePath(appDir), from: log.filePath(appOutDir) }, \"copying app files to project root app directory\")\n await copyDir(appOutDir, appDir)\n }\n\n // Auto-generate `organize` mapping for the app part so top-level helper\n // binaries and resources are placed under `app/` inside the snap. Update\n // the already-written `snapcraft.yaml` so the build sees the mapping.\n try {\n const appPart = snap.parts[snap.name]\n if (appPart) {\n const entries = (await readdir(appOutDir)).sort()\n const organize: Record<string, string> = (appPart.organize as Record<string, string>) || {}\n for (const entry of entries) {\n if (!entry) {\n continue\n }\n if (organize[entry]) {\n continue\n }\n organize[entry] = `app/${entry}`\n }\n appPart.organize = organize\n\n const updatedYaml = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, updatedYaml, \"utf8\")\n log.debug({ organize }, \"updated snapcraft.yaml with organize mapping\")\n }\n } catch (e: any) {\n log.warn({ error: e.message }, \"failed to generate and update organize mapping\")\n }\n\n const buildMode = {\n useLXD: this.options.useLXD === true,\n useMultipass: this.options.useMultipass === true,\n useDestructiveMode: this.options.useDestructiveMode === true,\n remoteBuild: this.options.remoteBuild || undefined,\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null) {\n const shouldSkip = await this.packager.packagerOptions.effectiveOptionComputed({ snap, ...buildMode })\n if (shouldSkip) {\n return\n }\n }\n\n const rootOptions = this.packager.config.snapcraft\n await buildSnap({\n snapcraftConfig: snap,\n artifactPath,\n stageDir,\n packager: this.packager,\n cscLink: rootOptions?.cscLink,\n ...buildMode,\n })\n }\n\n /** Converts `SnapOptions24` into a fully resolved `SnapcraftYAML` descriptor for the given architecture. */\n async mapSnapOptionsToSnapcraftYAML(arch: Arch): Promise<SnapcraftYAML> {\n const appInfo = this.packager.appInfo\n const appName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n // Default to [\"gnome\"] in normal builds; no extensions in host/destructive-mode (where the\n // gnome extension is incompatible). Throw if the user explicitly includes \"gnome\" in host mode.\n const hostMode = this.isHostMode()\n const extensionsList: string[] = options.extensions != null ? [...options.extensions] : hostMode ? [] : [\"gnome\"]\n if (hostMode && extensionsList.includes(\"gnome\")) {\n throw new InvalidConfigurationError(\n `The \"gnome\" snapcraft extension is incompatible with host/destructive-mode builds.\\n` +\n `In this mode snapcraft cannot resolve the extension's command-chain source ` +\n `(/usr/share/snapcraft/extensions/desktop/command-chain) and will fail.\\n\\n` +\n `To resolve this, choose one of:\\n` +\n ` 1. Remove \"gnome\" from snapcraft.core24.extensions (or set it to []) and add any\\n` +\n ` required stage-packages manually.\\n` +\n ` 2. Switch to an isolated build environment by setting snapcraft.core24.useLXD: true\\n` +\n ` or snapcraft.core24.useMultipass: true instead of useDestructiveMode.\\n\\n` +\n `See: https://snapcraft.io/docs/gnome-extension`\n )\n }\n const resolvedExtensions = extensionsList.length > 0 ? extensionsList : undefined\n const useGnomeExtension = extensionsList.includes(\"gnome\")\n\n // Create the app part\n const appPart: Part = {\n plugin: \"dump\",\n source: \"app\",\n \"build-packages\": options.buildPackages?.length ? options.buildPackages : undefined,\n \"stage-packages\": this.expandDefaultsInArray(options.stagePackages, DEFAULT_STAGE_PACKAGES),\n after: this.expandDefaultsInArray(options.after, []),\n stage: options.appPartStage?.length ? options.appPartStage : undefined,\n }\n\n // Process plugs and slots\n // When using GNOME extension, we don't need to manually configure content snaps\n // The extension will handle: gnome-46-2404, gtk-3-themes, icon-themes, sound-themes\n let rootPlugs: Record<string, any> | undefined\n let appPlugs: string[] | undefined\n\n if (useGnomeExtension) {\n // With GNOME extension, only process user-provided custom plugs\n const result = options.plugs ? this.processPlugOrSlots(options.plugs) : { root: undefined, app: undefined }\n rootPlugs = result.root\n // Extension automatically adds common plugs, so we only add custom ones\n appPlugs = result.app\n } else {\n // Without GNOME extension, we need manual content snaps\n const defaultRootPlugs: Record<string, any> = {\n \"gtk-3-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/themes\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"icon-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/icons\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"sound-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/sounds\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"gnome-46-2404\": {\n interface: \"content\",\n target: \"$SNAP/gnome-platform\",\n \"default-provider\": \"gnome-46-2404\",\n },\n \"gpu-2404\": {\n interface: \"content\",\n target: \"$SNAP/gpu-2404\",\n \"default-provider\": \"mesa-2404\",\n },\n }\n\n const result = options.plugs\n ? this.processPlugOrSlots(options.plugs)\n : hostMode\n ? { root: undefined, app: this.defaultPlugs }\n : {\n root: defaultRootPlugs,\n app: this.defaultPlugs,\n }\n rootPlugs = result.root\n appPlugs = result.app\n }\n\n // Always add browser-support with allow-sandbox so Chromium's internal sandbox\n // can create user namespaces under strict confinement. Without allow-sandbox: true\n // the app crashes immediately with \"FATAL: Permission denied (13)\" in credentials.cc.\n // Skip the injection only when the user has explicitly provided their own plugs\n // (they are responsible for including browser-support in that case).\n if (!options.plugs) {\n rootPlugs = { ...rootPlugs, \"browser-support\": { interface: \"browser-support\", \"allow-sandbox\": true } }\n if (!appPlugs?.includes(\"browser-support\")) {\n appPlugs = [...(appPlugs ?? []), \"browser-support\"]\n }\n }\n\n const { root: rootSlots, app: appSlots } = options.slots ? this.processPlugOrSlots(options.slots) : { root: undefined, app: undefined }\n\n // Build the effective arg list for the snap command.\n // Start with any user-supplied executableArgs, then conditionally add --no-sandbox\n // if browser-support with allow-sandbox:true is not present in the resolved plugs\n // (mirrors the same logic in SnapCoreLegacy.buildSnap).\n const extraArgs: string[] = [...(this.options.executableArgs ?? [])]\n if (this.options.forceX11 === true) {\n if (!extraArgs.includes(\"--ozone-platform=x11\")) {\n extraArgs.push(\"--ozone-platform=x11\")\n }\n }\n if (this.helper.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !this.isBrowserSandboxAllowed(rootPlugs)) {\n if (!extraArgs.includes(\"--no-sandbox\")) {\n extraArgs.push(\"--no-sandbox\")\n }\n }\n const commandSuffix = extraArgs.length > 0 ? ` ${extraArgs.join(\" \")}` : \"\"\n\n // Create the app configuration\n const desktopBaseName = this.helper.getDesktopFileName(appName)\n const app: App = {\n command: `app/${this.packager.executableName}${commandSuffix}`,\n \"command-chain\": undefined, // explicitly undefined so removeNullish strips it; extensions supply their own command-chain\n plugs: appPlugs,\n slots: appSlots,\n autostart: options.autoStart ? `${desktopBaseName}.desktop` : undefined,\n desktop: `meta/gui/${desktopBaseName}.desktop`,\n extensions: resolvedExtensions,\n }\n\n // Icon path — build-time relative path so snapcraft can find the file in snap/gui/\n await this.helper.icons\n const iconPath = this.helper.maxIconPath != null ? `snap/gui/${appName}${path.extname(this.helper.maxIconPath)}` : undefined\n\n // Process hooks if configured\n const hooksConfig = options.hooks\n const hooks = hooksConfig ? await this.processHooks(hooksConfig) : undefined\n\n // Parts configuration - the extension automatically adds a gnome/sdk part\n // Don't manually add desktop-launch when using the extension\n const parts: Record<string, Part> = {\n [appName]: appPart,\n }\n\n // Note: `organize` will be generated later in `buildSnap` based on the\n // actual contents of the built app directory so helper binaries and\n // resources are automatically moved under `app/` in the snap.\n\n // Build the snapcraft configuration\n const snapcraft: SnapcraftYAML = {\n // Required fields\n name: appName,\n base: \"core24\",\n confinement: options.confinement || \"strict\",\n parts: parts,\n\n // Architecture/Platform — only needed for cross-compilation; snapcraft 8\n // defaults to host arch and snapcraft 7 rejects this field entirely.\n ...(arch !== archFromString(process.arch)\n ? {\n platforms: {\n [toLinuxArchString(arch, \"snap\")]: {\n \"build-for\": toLinuxArchString(arch, \"snap\"),\n \"build-on\": toLinuxArchString(archFromString(process.arch), \"snap\"),\n },\n },\n }\n : {}),\n\n // Metadata - with fallbacks from appInfo\n version: appInfo.version,\n summary: options.summary || appInfo.productName,\n description: this.helper.getDescription(options),\n grade: options.grade || \"stable\",\n title: options.title || appInfo.productName,\n icon: iconPath,\n\n // Build configuration\n compression: options.compression || undefined,\n assumes: this.normalizeAssumesList(options.assumes),\n\n // Environment\n environment: this.buildEnvironment(options),\n\n // User-supplied layout always wins. Without gnome extension and not in host mode, fall back to content-snap defaults.\n layout: options.layout ?? (useGnomeExtension || hostMode ? undefined : this.buildDefaultLayout(options)),\n\n // Interfaces\n plugs: rootPlugs,\n slots: rootSlots,\n\n // Hooks\n hooks: hooks,\n\n // Apps\n apps: {\n [appName]: app,\n },\n }\n\n return removeNullish(snapcraft)\n }\n\n /**\n * Build environment variables with proper defaults\n */\n private buildEnvironment(options: SnapOptions24): Record<string, string | null> | undefined {\n const env: Record<string, string | null> = {}\n\n // Add default TMPDIR for Electron/Chromium apps\n if (!options.environment?.TMPDIR) {\n env.TMPDIR = \"$XDG_RUNTIME_DIR\"\n }\n\n if (options.environment) {\n deepAssign(env, options.environment)\n }\n\n return Object.keys(env).length > 0 ? env : undefined\n }\n\n /**\n * Build default layout for core24 with GNOME platform content snaps (non-extension mode)\n * This allows the app to access libraries from the gnome-46-2404 and mesa-2404 content snaps\n */\n private buildDefaultLayout(options: SnapOptions24): Record<string, any> | undefined {\n // If user provides custom layout, use that instead\n if (options.layout) {\n return options.layout\n }\n\n // Default layout for core24 Electron apps using GNOME content snaps WITHOUT extension\n return {\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\",\n },\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\",\n },\n \"/usr/share/xml/iso-codes\": {\n bind: \"$SNAP/gnome-platform/usr/share/xml/iso-codes\",\n },\n \"/usr/share/libdrm\": {\n bind: \"$SNAP/gpu-2404/libdrm\",\n },\n \"/usr/share/drirc.d\": {\n symlink: \"$SNAP/gpu-2404/drirc.d\",\n },\n }\n }\n\n /**\n * Process hooks directory into hook definitions\n */\n private async processHooks(hooksPath: string): Promise<Record<string, any> | undefined> {\n try {\n const buildResourcesDir = this.packager.buildResourcesDir\n const hooksDir = path.resolve(buildResourcesDir, hooksPath)\n if (!hooksDir.startsWith(buildResourcesDir + path.sep) && hooksDir !== buildResourcesDir) {\n throw new InvalidConfigurationError(`snapcraft.core24.hooks must resolve within the build resources directory (got \"${hooksDir}\")`)\n }\n const hookFiles = await readdir(hooksDir)\n\n if (hookFiles.length === 0) {\n return undefined\n }\n\n const hooks: Record<string, any> = {}\n for (const hookFile of hookFiles) {\n const hookName = path.basename(hookFile, path.extname(hookFile))\n if (!isValidKey(hookName)) {\n throw new InvalidConfigurationError(`Invalid hook name: ${hookName}`)\n }\n hooks[hookName] = {\n // Hook definitions will be populated by snapcraft from the files\n // Just register that these hooks exist\n }\n }\n\n return hooks\n } catch (e: any) {\n log.error({ message: e.message }, \"error processing Snap hooks directory\")\n throw e\n }\n }\n\n /**\n * Normalize assumes list (can be string or array)\n */\n normalizeAssumesList(assumes: Array<string> | string | Nullish): string[] | undefined {\n if (!assumes) {\n return undefined\n }\n if (typeof assumes === \"string\") {\n return [assumes]\n }\n return assumes.length > 0 ? assumes : undefined\n }\n\n /**\n * Process plugs or slots into root-level definitions and app-level references\n */\n processPlugOrSlots<T extends Array<string | SlotDescriptor | PlugDescriptor> | SlotDescriptor | PlugDescriptor | null>(\n items: T\n ): {\n root: Record<string, unknown> | undefined\n app: string[] | undefined\n } {\n if (!items || (Array.isArray(items) && items.length === 0)) {\n return { root: undefined, app: undefined }\n }\n const root: Record<string, unknown> = {}\n const app: string[] = []\n\n // Handle single descriptor object\n if (!Array.isArray(items)) {\n Object.entries(items).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n return { root, app }\n }\n\n // Handle array - support \"default\" keyword\n const processedItems = this.expandDefaultsInArray(items, this.defaultPlugs)\n for (const item of processedItems ?? []) {\n if (typeof item === \"string\") {\n // Simple string reference\n app.push(item)\n } else {\n // Descriptor object with configuration\n Object.entries(item).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n }\n }\n\n return { root: Object.keys(root).length > 0 ? root : undefined, app: app.length > 0 ? app : undefined }\n }\n\n private isBrowserSandboxAllowed(plugs: Record<string, any> | undefined): boolean {\n if (!plugs) {\n return false\n }\n for (const plug of Object.values(plugs)) {\n if (plug?.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n return false\n }\n\n /**\n * Expand \"default\" keyword in arrays of anything\n */\n private expandDefaultsInArray<T>(items: T[] | Nullish, defaults: T[]): T[] | undefined {\n const result: Array<T> = []\n for (const item of items ?? []) {\n if (typeof item === \"string\" && item === \"default\") {\n result.push(...defaults)\n } else {\n result.push(item)\n }\n }\n return result.length > 0 ? result : undefined\n }\n}\n"]}
1
+ {"version":3,"file":"core24.js","sourceRoot":"","sources":["../../../src/targets/snap/core24.ts"],"names":[],"mappings":";;;AAAA,+CAA8H;AAC9H,+DAAsE;AACtE,uCAAyE;AACzE,gCAA+B;AAC/B,6BAA4B;AAE5B,6CAAuC;AACvC,qDAAiE;AAEjE,yDAA8F;AAE9F,wFAAwF;AACxF,gGAAgG;AAChG,MAAM,cAAc,GAAG,gBAAgB,CAAA;AACvC,sGAAsG;AACtG,MAAM,qBAAqB,GAAG,YAAY,CAAA;AAE1C,wGAAwG;AACxG,MAAa,UAAW,SAAQ,qBAAuB;IAAvD;;QACE,qGAAqG;QACrG,oGAAoG;QACpG,iBAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;QAElJ,uBAAuB;QACvB,uEAAuE;QACvE,6DAA6D;QACpD,uBAAkB,GAAG,MAAM,CAAA;QAC3B,oBAAe,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;QAEpE,0FAA0F;QAC1F,yFAAyF;QACzF,8BAA8B;QACtB,wBAAmB,GAAG,KAAK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C,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/C,CAAC;CACF;AA9gBD,gCA8gBC","sourcesContent":["import { Arch, archFromString, copyDir, InvalidConfigurationError, log, removeNullish, toLinuxArchString } from \"builder-util\"\nimport { deepAssign, isValidKey, Nullish } from \"builder-util-runtime\"\nimport { chmod, copy, mkdir, readdir, remove, writeFile } from \"fs-extra\"\nimport * as yaml from \"js-yaml\"\nimport * as path from \"path\"\nimport { PlugDescriptor, SlotDescriptor, SnapOptions24 } from \"../../options/SnapOptions\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { buildSnapCommandLauncherScript } from \"./snapCommand.js\"\nimport { App, Part, SnapcraftYAML } from \"./snapcraft\"\nimport { buildSnap, DEFAULT_STAGE_PACKAGES, SNAPCRAFT_YAML_OPTIONS } from \"./snapcraftBuilder\"\n\n// Electron's setuid sandbox helper. Removed from the staged app when the snap runs with\n// `--no-sandbox` (snap confinement supplies its own sandbox via the browser-support interface).\nconst CHROME_SANDBOX = \"chrome-sandbox\"\n// Launcher script name used when the app command cannot be expressed inline (see resolveSnapCommand).\nconst SNAP_COMMAND_LAUNCHER = \"command.sh\"\n\n/** Snap build strategy for core24 — generates a native snapcraft.yaml and invokes the snapcraft CLI. */\nexport class SnapCore24 extends SnapCore<SnapOptions24> {\n // browser-support is intentionally absent here; it is auto-injected in mapSnapOptionsToSnapcraftYAML\n // when the user has not provided custom plugs, so it always lands in both root plugs and app plugs.\n defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\n // Snap file hierarchy:\n // - snap/gui/ gets automatically copied to meta/gui/ in the final snap\n // - Desktop files in meta/gui/ are used for menu integration\n readonly configRelativePath = \"snap\"\n readonly guiRelativePath = path.join(this.configRelativePath, \"gui\")\n\n // Computed in createDescriptor (mapSnapOptionsToSnapcraftYAML) and consumed in buildSnap.\n // getSnapCore() returns a fresh SnapCore24 per arch build, so this per-instance state is\n // never shared across builds.\n private removeChromeSandbox = false\n // Args embedded into the generated launcher script (executableArgs + forceX11/no-sandbox flags).\n private commandArgs: string[] = []\n\n async createDescriptor(arch: Arch): Promise<SnapcraftYAML> {\n return await this.mapSnapOptionsToSnapcraftYAML(arch)\n }\n\n private isHostMode(): boolean {\n return this.options.useDestructiveMode === true\n }\n\n /** Writes the snapcraft.yaml, stages app files, then invokes `buildSnap()` to run the actual snapcraft build. */\n async buildSnap(params: { snap: SnapcraftYAML; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, appOutDir, stageDir, artifactPath } = params\n\n const snapDirResolved = path.resolve(stageDir, this.configRelativePath)\n const snapcraftYamlPath = path.join(snapDirResolved, \"snapcraft.yaml\")\n\n // Create snap/gui directory for desktop files and icons\n // Snapcraft will automatically copy snap/gui/ contents to meta/gui/ in the final snap\n const guiOutput = path.resolve(stageDir, this.guiRelativePath)\n await mkdir(guiOutput, { recursive: true })\n\n const yamlContent = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, yamlContent, \"utf8\")\n log.debug(snap, \"generated snapcraft.yaml\")\n\n // Copy icon to snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopExtraProps: Record<string, string> = {}\n const icon = this.helper.maxIconPath\n if (icon) {\n const iconFileName = `${snap.name}${path.extname(icon)}`\n await copy(icon, path.join(guiOutput, iconFileName))\n // Icon path will be available at ${SNAP}/meta/gui/<icon-file> after installation\n desktopExtraProps.Icon = `\\${SNAP}/meta/gui/${iconFileName}`\n }\n\n // Create desktop file in snap/gui/ directory\n // Snapcraft will automatically copy this to meta/gui/ in the final snap\n const desktopFilePath = path.join(guiOutput, `${this.helper.getDesktopFileName(snap.name)}.desktop`)\n await this.helper.writeDesktopEntry(this.options, this.packager.executableName + \" %U\", desktopFilePath, desktopExtraProps)\n\n // Copy app files to the project root `app` directory so `source: app`\n // in the generated `snapcraft.yaml` (which is under `snap/`) can be\n // resolved by snapcraft running in the build environment.\n const appDir = path.resolve(stageDir, \"app\")\n if (path.resolve(appDir) !== path.resolve(appOutDir)) {\n log.debug({ to: log.filePath(appDir), from: log.filePath(appOutDir) }, \"copying app files to project root app directory\")\n await copyDir(appOutDir, appDir)\n }\n\n // Drop the setuid chrome-sandbox helper before snapcraft stages the app — it is unusable under\n // strict confinement when launching with --no-sandbox (mirrors SnapCoreLegacy).\n if (this.removeChromeSandbox) {\n await remove(path.join(appDir, CHROME_SANDBOX))\n }\n\n // Write the launcher script the command always points at (see SNAP_COMMAND_LAUNCHER).\n // It lands at the snap root ($SNAP/command.sh) — it is intentionally not added to `organize`.\n const launcherPath = path.join(appDir, SNAP_COMMAND_LAUNCHER)\n await writeFile(launcherPath, buildSnapCommandLauncherScript({ execName: this.packager.executableName, args: this.commandArgs }), { mode: 0o755 })\n await chmod(launcherPath, 0o755)\n\n // Auto-generate `organize` mapping for the app part so top-level helper\n // binaries and resources are placed under `app/` inside the snap. Update\n // the already-written `snapcraft.yaml` so the build sees the mapping.\n try {\n const appPart = snap.parts[snap.name]\n if (appPart) {\n const entries = (await readdir(appOutDir)).sort()\n // Null-prototype map: entry names come from the filesystem, so a top-level file named\n // \"__proto__\" / \"constructor\" / \"toString\" must not read inherited keys (which would make\n // the membership check below skip it) or interact with Object.prototype on assignment.\n const organize: Record<string, string> = Object.assign(Object.create(null), appPart.organize)\n for (const entry of entries) {\n if (!entry) {\n continue\n }\n // Skip files no longer present in the staged app dir (e.g. removed chrome-sandbox) so\n // snapcraft doesn't fail trying to organize a missing source.\n if (this.removeChromeSandbox && entry === CHROME_SANDBOX) {\n continue\n }\n // Never organize the launcher under app/. It must stay at the snap root ($SNAP/command.sh)\n // to match apps.<name>.command. This matters when appOutDir === appDir, where readdir\n // would otherwise pick up the launcher we just wrote.\n if (entry === SNAP_COMMAND_LAUNCHER) {\n continue\n }\n if (organize[entry]) {\n continue\n }\n organize[entry] = `app/${entry}`\n }\n appPart.organize = organize\n\n const updatedYaml = yaml.dump(snap, SNAPCRAFT_YAML_OPTIONS)\n await writeFile(snapcraftYamlPath, updatedYaml, \"utf8\")\n log.debug({ organize }, \"updated snapcraft.yaml with organize mapping\")\n }\n } catch (e: any) {\n log.warn({ error: e.message }, \"failed to generate and update organize mapping\")\n }\n\n const buildMode = {\n useLXD: this.options.useLXD === true,\n useMultipass: this.options.useMultipass === true,\n useDestructiveMode: this.options.useDestructiveMode === true,\n remoteBuild: this.options.remoteBuild || undefined,\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null) {\n const shouldSkip = await this.packager.packagerOptions.effectiveOptionComputed({ snap, ...buildMode })\n if (shouldSkip) {\n return\n }\n }\n\n const rootOptions = this.packager.config.snapcraft\n await buildSnap({\n snapcraftConfig: snap,\n artifactPath,\n stageDir,\n packager: this.packager,\n cscLink: rootOptions?.cscLink,\n ...buildMode,\n })\n }\n\n /** Converts `SnapOptions24` into a fully resolved `SnapcraftYAML` descriptor for the given architecture. */\n async mapSnapOptionsToSnapcraftYAML(arch: Arch): Promise<SnapcraftYAML> {\n const appInfo = this.packager.appInfo\n const appName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n // Default to [\"gnome\"] in normal builds; no extensions in host/destructive-mode (where the\n // gnome extension is incompatible). Throw if the user explicitly includes \"gnome\" in host mode.\n const hostMode = this.isHostMode()\n const extensionsList: string[] = options.extensions != null ? [...options.extensions] : hostMode ? [] : [\"gnome\"]\n if (hostMode && extensionsList.includes(\"gnome\")) {\n throw new InvalidConfigurationError(\n `The \"gnome\" snapcraft extension is incompatible with host/destructive-mode builds.\\n` +\n `In this mode snapcraft cannot resolve the extension's command-chain source ` +\n `(/usr/share/snapcraft/extensions/desktop/command-chain) and will fail.\\n\\n` +\n `To resolve this, choose one of:\\n` +\n ` 1. Remove \"gnome\" from snapcraft.core24.extensions (or set it to []) and add any\\n` +\n ` required stage-packages manually.\\n` +\n ` 2. Switch to an isolated build environment by setting snapcraft.core24.useLXD: true\\n` +\n ` or snapcraft.core24.useMultipass: true instead of useDestructiveMode.\\n\\n` +\n `See: https://snapcraft.io/docs/gnome-extension`\n )\n }\n const resolvedExtensions = extensionsList.length > 0 ? extensionsList : undefined\n const useGnomeExtension = extensionsList.includes(\"gnome\")\n\n // Create the app part\n const appPart: Part = {\n plugin: \"dump\",\n source: \"app\",\n \"build-packages\": options.buildPackages?.length ? options.buildPackages : undefined,\n \"stage-packages\": this.expandDefaultsInArray(options.stagePackages, DEFAULT_STAGE_PACKAGES),\n after: this.expandDefaultsInArray(options.after, []),\n stage: options.appPartStage?.length ? options.appPartStage : undefined,\n }\n\n // Process plugs and slots\n // When using GNOME extension, we don't need to manually configure content snaps\n // The extension will handle: gnome-46-2404, gtk-3-themes, icon-themes, sound-themes\n let rootPlugs: Record<string, any> | undefined\n let appPlugs: string[] | undefined\n\n if (useGnomeExtension) {\n // With GNOME extension, only process user-provided custom plugs\n const result = options.plugs ? this.processPlugOrSlots(options.plugs) : { root: undefined, app: undefined }\n rootPlugs = result.root\n // Extension automatically adds common plugs, so we only add custom ones\n appPlugs = result.app\n } else {\n // Without GNOME extension, we need manual content snaps\n const defaultRootPlugs: Record<string, any> = {\n \"gtk-3-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/themes\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"icon-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/icons\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"sound-themes\": {\n interface: \"content\",\n target: \"$SNAP/data-dir/sounds\",\n \"default-provider\": \"gtk-common-themes\",\n },\n \"gnome-46-2404\": {\n interface: \"content\",\n target: \"$SNAP/gnome-platform\",\n \"default-provider\": \"gnome-46-2404\",\n },\n \"gpu-2404\": {\n interface: \"content\",\n target: \"$SNAP/gpu-2404\",\n \"default-provider\": \"mesa-2404\",\n },\n }\n\n const result = options.plugs\n ? this.processPlugOrSlots(options.plugs)\n : hostMode\n ? { root: undefined, app: this.defaultPlugs }\n : {\n root: defaultRootPlugs,\n app: this.defaultPlugs,\n }\n rootPlugs = result.root\n appPlugs = result.app\n }\n\n // Always add browser-support with allow-sandbox so Chromium's internal sandbox\n // can create user namespaces under strict confinement. Without allow-sandbox: true\n // the app crashes immediately with \"FATAL: Permission denied (13)\" in credentials.cc.\n // Skip the injection only when the user has explicitly provided their own plugs\n // (they are responsible for including browser-support in that case).\n if (!options.plugs) {\n rootPlugs = { ...rootPlugs, \"browser-support\": { interface: \"browser-support\", \"allow-sandbox\": true } }\n if (!appPlugs?.includes(\"browser-support\")) {\n appPlugs = [...(appPlugs ?? []), \"browser-support\"]\n }\n }\n\n const { root: rootSlots, app: appSlots } = options.slots ? this.processPlugOrSlots(options.slots) : { root: undefined, app: undefined }\n\n // Build the effective arg list for the snap command.\n // Start with any user-supplied executableArgs, then conditionally add --no-sandbox\n // if browser-support with allow-sandbox:true is not present in the resolved plugs\n // (mirrors the same logic in SnapCoreLegacy.buildSnap).\n const extraArgs: string[] = [...(this.options.executableArgs ?? [])]\n if (this.options.forceX11 === true) {\n if (!extraArgs.includes(\"--ozone-platform=x11\")) {\n extraArgs.push(\"--ozone-platform=x11\")\n }\n }\n const noSandbox = this.helper.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !this.isBrowserSandboxAllowed(rootPlugs)\n if (noSandbox && !extraArgs.includes(\"--no-sandbox\")) {\n extraArgs.push(\"--no-sandbox\")\n }\n // With --no-sandbox the setuid chrome-sandbox helper is unused; strip it from the snap.\n this.removeChromeSandbox = noSandbox\n\n // The command always points at a generated launcher script (written in buildSnap). This keeps a\n // single uniform command path and sidesteps snapd's character/word-splitting rules for the\n // command field (e.g. --ozone-platform=x11, --js-flags=\"...\").\n this.commandArgs = extraArgs\n\n // Create the app configuration\n const desktopBaseName = this.helper.getDesktopFileName(appName)\n const app: App = {\n command: SNAP_COMMAND_LAUNCHER,\n \"command-chain\": undefined, // explicitly undefined so removeNullish strips it; extensions supply their own command-chain\n plugs: appPlugs,\n slots: appSlots,\n autostart: options.autoStart ? `${desktopBaseName}.desktop` : undefined,\n desktop: `meta/gui/${desktopBaseName}.desktop`,\n extensions: resolvedExtensions,\n }\n\n // Icon path — build-time relative path so snapcraft can find the file in snap/gui/\n await this.helper.icons\n const iconPath = this.helper.maxIconPath != null ? `snap/gui/${appName}${path.extname(this.helper.maxIconPath)}` : undefined\n\n // Process hooks if configured\n const hooksConfig = options.hooks\n const hooks = hooksConfig ? await this.processHooks(hooksConfig) : undefined\n\n // Parts configuration - the extension automatically adds a gnome/sdk part\n // Don't manually add desktop-launch when using the extension\n const parts: Record<string, Part> = {\n [appName]: appPart,\n }\n\n // Note: `organize` will be generated later in `buildSnap` based on the\n // actual contents of the built app directory so helper binaries and\n // resources are automatically moved under `app/` in the snap.\n\n // Build the snapcraft configuration\n const snapcraft: SnapcraftYAML = {\n // Required fields\n name: appName,\n base: \"core24\",\n confinement: options.confinement || \"strict\",\n parts: parts,\n\n // Architecture/Platform — only needed for cross-compilation; snapcraft 8\n // defaults to host arch and snapcraft 7 rejects this field entirely.\n ...(arch !== archFromString(process.arch)\n ? {\n platforms: {\n [toLinuxArchString(arch, \"snap\")]: {\n \"build-for\": toLinuxArchString(arch, \"snap\"),\n \"build-on\": toLinuxArchString(archFromString(process.arch), \"snap\"),\n },\n },\n }\n : {}),\n\n // Metadata - with fallbacks from appInfo\n version: appInfo.version,\n summary: options.summary || appInfo.productName,\n description: this.helper.getDescription(options),\n grade: options.grade || \"stable\",\n title: options.title || appInfo.productName,\n icon: iconPath,\n\n // Build configuration\n compression: options.compression || undefined,\n assumes: this.normalizeAssumesList(options.assumes),\n\n // Environment\n environment: this.buildEnvironment(options),\n\n // User-supplied layout always wins. Without gnome extension and not in host mode, fall back to content-snap defaults.\n layout: options.layout ?? (useGnomeExtension || hostMode ? undefined : this.buildDefaultLayout(options)),\n\n // Interfaces\n plugs: rootPlugs,\n slots: rootSlots,\n\n // Hooks\n hooks: hooks,\n\n // Apps\n apps: {\n [appName]: app,\n },\n }\n\n return removeNullish(snapcraft)\n }\n\n /**\n * Build environment variables with proper defaults\n */\n private buildEnvironment(options: SnapOptions24): Record<string, string | null> | undefined {\n const env: Record<string, string | null> = {}\n\n // Add default TMPDIR for Electron/Chromium apps\n if (!options.environment?.TMPDIR) {\n env.TMPDIR = \"$XDG_RUNTIME_DIR\"\n }\n\n if (options.environment) {\n deepAssign(env, options.environment)\n }\n\n return Object.keys(env).length > 0 ? env : undefined\n }\n\n /**\n * Build default layout for core24 with GNOME platform content snaps (non-extension mode)\n * This allows the app to access libraries from the gnome-46-2404 and mesa-2404 content snaps\n */\n private buildDefaultLayout(options: SnapOptions24): Record<string, any> | undefined {\n // If user provides custom layout, use that instead\n if (options.layout) {\n return options.layout\n }\n\n // Default layout for core24 Electron apps using GNOME content snaps WITHOUT extension\n return {\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.0\",\n },\n \"/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\": {\n bind: \"$SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1\",\n },\n \"/usr/share/xml/iso-codes\": {\n bind: \"$SNAP/gnome-platform/usr/share/xml/iso-codes\",\n },\n \"/usr/share/libdrm\": {\n bind: \"$SNAP/gpu-2404/libdrm\",\n },\n \"/usr/share/drirc.d\": {\n symlink: \"$SNAP/gpu-2404/drirc.d\",\n },\n }\n }\n\n /**\n * Process hooks directory into hook definitions\n */\n private async processHooks(hooksPath: string): Promise<Record<string, any> | undefined> {\n try {\n const buildResourcesDir = this.packager.buildResourcesDir\n const hooksDir = path.resolve(buildResourcesDir, hooksPath)\n if (!hooksDir.startsWith(buildResourcesDir + path.sep) && hooksDir !== buildResourcesDir) {\n throw new InvalidConfigurationError(`snapcraft.core24.hooks must resolve within the build resources directory (got \"${hooksDir}\")`)\n }\n const hookFiles = await readdir(hooksDir)\n\n if (hookFiles.length === 0) {\n return undefined\n }\n\n const hooks: Record<string, any> = {}\n for (const hookFile of hookFiles) {\n const hookName = path.basename(hookFile, path.extname(hookFile))\n if (!isValidKey(hookName)) {\n throw new InvalidConfigurationError(`Invalid hook name: ${hookName}`)\n }\n hooks[hookName] = {\n // Hook definitions will be populated by snapcraft from the files\n // Just register that these hooks exist\n }\n }\n\n return hooks\n } catch (e: any) {\n log.error({ message: e.message }, \"error processing Snap hooks directory\")\n throw e\n }\n }\n\n /**\n * Normalize assumes list (can be string or array)\n */\n normalizeAssumesList(assumes: Array<string> | string | Nullish): string[] | undefined {\n if (!assumes) {\n return undefined\n }\n if (typeof assumes === \"string\") {\n return [assumes]\n }\n return assumes.length > 0 ? assumes : undefined\n }\n\n /**\n * Process plugs or slots into root-level definitions and app-level references\n */\n processPlugOrSlots<T extends Array<string | SlotDescriptor | PlugDescriptor> | SlotDescriptor | PlugDescriptor | null>(\n items: T\n ): {\n root: Record<string, unknown> | undefined\n app: string[] | undefined\n } {\n if (!items || (Array.isArray(items) && items.length === 0)) {\n return { root: undefined, app: undefined }\n }\n const root: Record<string, unknown> = {}\n const app: string[] = []\n\n // Handle single descriptor object\n if (!Array.isArray(items)) {\n Object.entries(items).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n return { root, app }\n }\n\n // Handle array - support \"default\" keyword\n const processedItems = this.expandDefaultsInArray(items, this.defaultPlugs)\n for (const item of processedItems ?? []) {\n if (typeof item === \"string\") {\n // Simple string reference\n app.push(item)\n } else {\n // Descriptor object with configuration\n Object.entries(item).forEach(([name, config]) => {\n if (!isValidKey(name)) {\n throw new Error(`Invalid plug/slot name: ${name}`)\n }\n root[name] = config\n app.push(name)\n })\n }\n }\n\n return { root: Object.keys(root).length > 0 ? root : undefined, app: app.length > 0 ? app : undefined }\n }\n\n private isBrowserSandboxAllowed(plugs: Record<string, any> | undefined): boolean {\n if (!plugs) {\n return false\n }\n for (const plug of Object.values(plugs)) {\n if (plug?.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n return false\n }\n\n /**\n * Expand \"default\" keyword in arrays of anything\n */\n private expandDefaultsInArray<T>(items: T[] | Nullish, defaults: T[]): T[] | undefined {\n const result: Array<T> = []\n for (const item of items ?? []) {\n if (typeof item === \"string\" && item === \"default\") {\n result.push(...defaults)\n } else {\n result.push(item)\n }\n }\n return result.length > 0 ? result : undefined\n }\n}\n"]}
@@ -1,7 +1,9 @@
1
1
  import { Arch } from "builder-util";
2
2
  import { SnapOptions } from "../../options/SnapOptions";
3
3
  import { SnapCore } from "./SnapTarget";
4
+ import { shellQuote } from "./snapCommand.js";
4
5
  import { SnapcraftYAML } from "./snapcraft";
6
+ export { shellQuote };
5
7
  export declare class SnapCoreLegacy extends SnapCore<SnapOptions> {
6
8
  private isUseTemplateApp;
7
9
  defaultPlugs: string[];
@@ -21,8 +23,6 @@ export declare class SnapCoreLegacy extends SnapCore<SnapOptions> {
21
23
  private isBrowserSandboxAllowed;
22
24
  private archNameToTriplet;
23
25
  }
24
- /** Single-quote a shell argument, escaping any embedded single quotes. */
25
- export declare function shellQuote(arg: string): string;
26
26
  /**
27
27
  * Builds the content of command.sh for a snap package.
28
28
  *
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnapCoreLegacy = void 0;
4
- exports.shellQuote = shellQuote;
3
+ exports.SnapCoreLegacy = exports.shellQuote = void 0;
5
4
  exports.buildCommandShContent = buildCommandShContent;
6
5
  const builder_util_1 = require("builder-util");
7
6
  const builder_util_runtime_1 = require("builder-util-runtime");
8
- const promises_1 = require("fs/promises");
9
7
  const fs_extra_1 = require("fs-extra");
8
+ const promises_1 = require("fs/promises");
9
+ const js_yaml_1 = require("js-yaml");
10
10
  const path = require("path");
11
+ const LibUiFramework_1 = require("../../frameworks/LibUiFramework");
11
12
  const linux_1 = require("../../toolsets/linux");
12
13
  const electronGet_1 = require("../../util/electronGet");
13
14
  const pathManager_1 = require("../../util/pathManager");
14
- const LibUiFramework_1 = require("../../frameworks/LibUiFramework");
15
15
  const SnapTarget_1 = require("./SnapTarget");
16
+ const snapCommand_js_1 = require("./snapCommand.js");
17
+ Object.defineProperty(exports, "shellQuote", { enumerable: true, get: function () { return snapCommand_js_1.shellQuote; } });
16
18
  const snapcraftBuilder_1 = require("./snapcraftBuilder");
17
- const js_yaml_1 = require("js-yaml");
18
19
  // Snap template release info from electron-userland/electron-builder-binaries
19
20
  const SNAP_TEMPLATES = {
20
21
  amd64: {
@@ -385,10 +386,6 @@ async function readDirPaths(dir, filter) {
385
386
  }
386
387
  return result;
387
388
  }
388
- /** Single-quote a shell argument, escaping any embedded single quotes. */
389
- function shellQuote(arg) {
390
- return "'" + arg.replace(/'/g, "'\\''") + "'";
391
- }
392
389
  /**
393
390
  * Builds the content of command.sh for a snap package.
394
391
  *
@@ -408,7 +405,7 @@ function buildCommandShContent(opts) {
408
405
  const appPrefix = isTemplate ? "" : "app/";
409
406
  let content = `#!/bin/bash -e\nexec "$SNAP/desktop-init.sh" "$SNAP/desktop-common.sh" "$SNAP/desktop-gnome-specific.sh" "$SNAP/${appPrefix}${executableName}"`;
410
407
  if (extraAppArgs.length > 0) {
411
- content += " " + extraAppArgs.map(shellQuote).join(" ");
408
+ content += " " + extraAppArgs.map(snapCommand_js_1.shellQuote).join(" ");
412
409
  }
413
410
  content += ' "$@"';
414
411
  return content;
@@ -1 +1 @@
1
- {"version":3,"file":"coreLegacy.js","sourceRoot":"","sources":["../../../src/targets/snap/coreLegacy.ts"],"names":[],"mappings":";;;AA6bA,gCAEC;AAeD,sDAUC;AAxdD,+CAA8H;AAC9H,+DAA+E;AAC/E,0CAAoF;AACpF,uCAA+C;AAC/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AAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,0EAA0E;AAC1E,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,GAAG,CAAA;AAC/C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,qBAAqB,CAAC,IAA6E;IACjH,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IACzD,IAAA,wCAAuB,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;IACzD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;IAC1C,IAAI,OAAO,GAAG,mHAAmH,SAAS,GAAG,cAAc,GAAG,CAAA;IAC9J,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,OAAO,CAAA;IAClB,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { replaceDefault as _replaceDefault, Arch, copyDir, exec, log, serializeToYaml, toLinuxArchString } from \"builder-util\"\nimport { asArray, deepAssign, isValidKey, Nullish } from \"builder-util-runtime\"\nimport { chmod, copyFile, mkdir, readdir, rename, rm, writeFile } from \"fs/promises\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { PlugDescriptor, SnapOptions } from \"../../options/SnapOptions\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { downloadBuilderToolset } from \"../../util/electronGet\"\nimport { getTemplatePath } from \"../../util/pathManager\"\nimport { validateShellEmbeddable } from \"../../frameworks/LibUiFramework\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { SnapcraftYAML } from \"./snapcraft\"\nimport { DEFAULT_STAGE_PACKAGES } from \"./snapcraftBuilder\"\nimport { load } from \"js-yaml\"\n\n// Snap template release info from electron-userland/electron-builder-binaries\nconst SNAP_TEMPLATES = {\n amd64: {\n releaseName: \"snap-template-4.0-2\",\n filenameWithExt: \"snap-template-electron-4.0-2-amd64.tar.7z\",\n checksums: { \"snap-template-electron-4.0-2-amd64.tar.7z\": \"5e3ab4e09364ac06f0072b1c2dab9138318c933f6b2c7374f893b5ec44d19e6f\" },\n },\n armhf: {\n releaseName: \"snap-template-4.0-1\",\n filenameWithExt: \"snap-template-electron-4.0-1-armhf.tar.7z\",\n checksums: { \"snap-template-electron-4.0-1-armhf.tar.7z\": \"6f7553e904f4e043bc3019f0899d05e01a283b00b61fec22e932296490e3be6b\" },\n },\n} as const\n\n// Handles core18/core20/core22 snaps via mksquashfs (template) or snapcraft CLI (no-template).\n// See: https://github.com/develar/app-builder/blob/master/pkg/package-format/snap\nexport class SnapCoreLegacy extends SnapCore<SnapOptions> {\n private isUseTemplateApp = false\n\n defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\n private replaceDefault(inList: Array<string> | Nullish, defaultList: Array<string>) {\n const result = _replaceDefault(inList, defaultList)\n if (result !== defaultList) {\n this.isUseTemplateApp = false\n }\n return result\n }\n\n async createDescriptor(arch: Arch): Promise<SnapcraftYAML> {\n const appInfo = this.packager.appInfo\n const snapName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n const plugs = this.normalizePlugConfiguration(this.options.plugs)\n\n const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), this.defaultPlugs)\n\n const slots = this.normalizePlugConfiguration(this.options.slots)\n\n const buildPackages = asArray(options.buildPackages)\n const stagePackages = this.replaceDefault(options.stagePackages, DEFAULT_STAGE_PACKAGES)\n\n const stageSet = new Set(stagePackages)\n const stageMatchesDefaults = stagePackages.length === DEFAULT_STAGE_PACKAGES.length && DEFAULT_STAGE_PACKAGES.every((p: string) => stageSet.has(p))\n\n // Template app is only available for x64/armv7l, and only when no packages are customised.\n this.isUseTemplateApp = this.options.useTemplateApp !== false && (arch === Arch.x64 || arch === Arch.armv7l) && buildPackages.length === 0 && stageMatchesDefaults\n\n const appDescriptor: any = {\n command: \"command.sh\",\n plugs: plugNames,\n adapter: \"none\",\n }\n\n const snap: any = load(await readFile(path.join(getTemplatePath(\"snap\"), \"snapcraft.yaml\"), \"utf-8\"))\n if (this.isUseTemplateApp) {\n delete appDescriptor.adapter\n }\n if (options.base != null) {\n snap.base = options.base\n if (Number(snap.base.split(\"core\")[1]) >= 22) {\n delete appDescriptor.adapter\n }\n }\n if (options.grade != null) {\n snap.grade = options.grade\n }\n if (options.confinement != null) {\n snap.confinement = options.confinement\n }\n if (options.appPartStage != null) {\n snap.parts.app.stage = options.appPartStage\n }\n if (options.layout != null) {\n snap.layout = options.layout\n }\n if (slots != null) {\n appDescriptor.slots = Object.getOwnPropertyNames(slots)\n for (const slotName of appDescriptor.slots) {\n if (!isValidKey(slotName)) {\n throw new Error(`Invalid plug/slot name: ${slotName}`)\n }\n const slotOptions = slots[slotName]\n if (slotOptions == null) {\n continue\n }\n if (!snap.slots) {\n snap.slots = {}\n }\n snap.slots[slotName] = slotOptions\n }\n }\n\n deepAssign(snap, {\n name: snapName,\n version: appInfo.version,\n title: options.title || appInfo.productName,\n summary: options.summary || appInfo.productName,\n compression: options.compression,\n description: this.helper.getDescription(options),\n architectures: [toLinuxArchString(arch, \"snap\")],\n apps: {\n [snapName]: appDescriptor,\n },\n parts: {\n app: {\n \"stage-packages\": stagePackages,\n },\n },\n })\n\n if (options.autoStart) {\n appDescriptor.autostart = `${this.helper.getDesktopFileName(snap.name)}.desktop`\n }\n\n if (options.confinement === \"classic\") {\n delete appDescriptor.plugs\n delete snap.plugs\n } else {\n const archTriplet = this.archNameToTriplet(arch)\n const environment: Record<string, string> = {\n PATH: \"$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH\",\n SNAP_DESKTOP_RUNTIME: \"$SNAP/gnome-platform\",\n LD_LIBRARY_PATH: [\n \"$SNAP_LIBRARY_PATH\",\n \"$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n \"$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib\",\n \"$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n ].join(\":\"),\n ...options.environment,\n }\n const allow = options.allowNativeWayland\n const isOldElectron = !this.helper.isElectronVersionGreaterOrEqualThan(\"38.0.0\", \"7.0.0\")\n if ((allow == null && isOldElectron) || allow === false) {\n environment.DISABLE_WAYLAND = \"1\"\n }\n\n appDescriptor.environment = environment\n\n if (plugs != null) {\n for (const plugName of plugNames) {\n if (!isValidKey(plugName)) {\n throw new Error(`Invalid plug/slot name: ${plugName}`)\n }\n const plugOptions = plugs[plugName]\n if (plugOptions == null) {\n continue\n }\n if (!snap.plugs) {\n snap.plugs = {}\n }\n snap.plugs[plugName] = plugOptions\n }\n }\n }\n\n if (buildPackages.length > 0) {\n snap.parts.app[\"build-packages\"] = buildPackages\n }\n if (options.after != null) {\n snap.parts.app.after = options.after\n }\n\n if (options.assumes != null) {\n snap.assumes = asArray(options.assumes)\n }\n\n return snap\n }\n\n async buildSnap(props: { snap: any; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, appOutDir, stageDir, snapArch, artifactPath } = props\n\n // Build the args array for effectiveOptionComputed compatibility — tests inspect this.\n const args = [\n \"snap\",\n \"--app\",\n appOutDir,\n \"--stage\",\n stageDir,\n \"--arch\",\n toLinuxArchString(snapArch, \"snap\"),\n \"--output\",\n artifactPath,\n \"--executable\",\n this.packager.executableName,\n ]\n\n await this.helper.icons\n if (this.helper.maxIconPath != null) {\n if (!this.isUseTemplateApp) {\n snap.icon = \"snap/gui/icon.png\"\n }\n args.push(\"--icon\", this.helper.maxIconPath)\n }\n\n const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? \"meta\" : \"snap\")\n const desktopFile = path.join(snapMetaDir, \"gui\", `${this.helper.getDesktopFileName(snap.name)}.desktop`)\n await this.helper.writeDesktopEntry(this.options, this.packager.executableName + \" %U\", desktopFile, {\n Icon: \"${SNAP}/meta/gui/icon.png\",\n })\n\n const extraAppArgs: Array<string> = this.options.executableArgs ?? []\n if (this.helper.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !this.isBrowserSandboxAllowed(snap)) {\n const noSandboxArg = \"--no-sandbox\"\n if (!extraAppArgs.includes(noSandboxArg)) {\n extraAppArgs.push(noSandboxArg)\n }\n if (this.isUseTemplateApp) {\n args.push(\"--exclude\", \"chrome-sandbox\")\n }\n }\n if (extraAppArgs.length > 0) {\n args.push(\"--extraAppArgs=\" + extraAppArgs.join(\" \"))\n }\n\n // Capture compression BEFORE it gets stripped from snap for template builds.\n const compression = this.options.compression ?? \"xz\"\n if (snap.compression != null) {\n args.push(\"--compression\", snap.compression)\n }\n\n if (this.isUseTemplateApp) {\n const fieldsToStrip = [\"compression\", \"contact\", \"donation\", \"issues\", \"parts\", \"source-code\", \"website\"]\n for (const field of fieldsToStrip) {\n delete snap[field]\n }\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ snap, desktopFile, args }))) {\n return\n }\n\n await outputFile(path.join(snapMetaDir, this.isUseTemplateApp ? \"snap.yaml\" : \"snapcraft.yaml\"), serializeToYaml(snap))\n\n const hooksDir = await this.packager.getResource(this.options.hooks, \"snap-hooks\")\n if (hooksDir != null) {\n args.push(\"--hooks\", hooksDir)\n }\n\n if (this.isUseTemplateApp) {\n const templateArch = snapArch === Arch.x64 ? \"amd64\" : \"armhf\"\n args.push(\"--template-url\", `electron4:${templateArch}`)\n await this.buildWithTemplate({ appOutDir, stageDir, snapArch, artifactPath, compression, hooksDir, extraAppArgs })\n } else {\n await this.buildWithoutTemplate({ appOutDir, stageDir, artifactPath, hooksDir, extraAppArgs })\n }\n }\n\n private async buildWithTemplate(opts: {\n appOutDir: string\n stageDir: string\n snapArch: Arch\n artifactPath: string\n compression: string\n hooksDir: string | null\n extraAppArgs: string[]\n }): Promise<void> {\n const { appOutDir, stageDir, snapArch, artifactPath, compression, hooksDir, extraAppArgs } = opts\n const templateArch = snapArch === Arch.x64 ? \"amd64\" : \"armhf\"\n const { releaseName, filenameWithExt, checksums } = SNAP_TEMPLATES[templateArch]\n\n log.info({ releaseName }, \"downloading snap template\")\n const templateDir = await downloadBuilderToolset({ releaseName, filenameWithExt, checksums, githubOrgRepo: \"electron-userland/electron-builder-binaries\" })\n\n await this.stageSnapFiles({ stageDir, appOutDir, hooksDir, extraAppArgs, isTemplate: true })\n\n // Best-effort: remove chrome-sandbox from app dir before mksquashfs scans it.\n await rm(path.join(appOutDir, \"chrome-sandbox\"), { force: true })\n\n // chmod -R g-s to avoid setgid bits in final image\n for (const dir of [stageDir, appOutDir, templateDir]) {\n await exec(\"chmod\", [\"-R\", \"g-s\", dir]).catch(err => log.warn({ error: err.message }, \"chmod g-s failed\"))\n }\n\n const mksquashfsPath = await getMksquashfsPath(snapArch)\n\n // Collect top-level entries from each dir as individual path args (mirrors Go ReadDirContentTo)\n const mksquashfsArgs: string[] = [\n ...(await readDirPaths(templateDir)),\n ...(await readDirPaths(stageDir)),\n ...(await readDirPaths(appOutDir, name => name !== \"LICENSES.chromium.html\" && name !== \"LICENSE.electron.txt\" && name !== \"chrome-sandbox\")),\n artifactPath,\n \"-no-progress\",\n \"-quiet\",\n \"-noappend\",\n \"-comp\",\n compression,\n \"-no-xattrs\",\n \"-no-fragments\",\n \"-all-root\",\n ]\n\n await exec(mksquashfsPath, mksquashfsArgs, { cwd: stageDir })\n }\n\n private async buildWithoutTemplate(opts: { appOutDir: string; stageDir: string; artifactPath: string; hooksDir: string | null; extraAppArgs: string[] }): Promise<void> {\n const { appOutDir, stageDir, artifactPath, hooksDir, extraAppArgs } = opts\n\n await this.stageSnapFiles({ stageDir, appOutDir, hooksDir, extraAppArgs, isTemplate: false })\n\n // Write desktop integration scripts (embedded in the Go binary, now in our templates)\n const snapTemplateDir = getTemplatePath(\"snap\")\n for (const script of [\"desktop-init.sh\", \"desktop-common.sh\", \"desktop-gnome-specific.sh\"]) {\n const src = path.join(snapTemplateDir, script)\n const dest = path.join(stageDir, \"scripts\", script)\n await copyFile(src, dest)\n // copyFile doesn't preserve mode; chmod 755 explicitly\n await chmod(dest, 0o755)\n }\n\n // Copy app dir into stage/app/ so snapcraft can pick it up\n await copyDir(appOutDir, path.join(stageDir, \"app\"))\n\n // Run snapcraft (legacy `snap` subcommand)\n const isDestructiveMode = process.env.SNAP_DESTRUCTIVE_MODE === \"true\"\n const snapOutputName = \"out.snap\"\n const snapArgs = [\"snap\", \"--output\", isDestructiveMode ? artifactPath : snapOutputName]\n if (isDestructiveMode) {\n snapArgs.push(\"--destructive-mode\")\n }\n\n await exec(\"snapcraft\", snapArgs, {\n cwd: stageDir,\n env: { ...process.env, SNAPCRAFT_HAS_TTY: \"false\" },\n })\n\n if (!isDestructiveMode) {\n await rename(path.join(stageDir, snapOutputName), artifactPath)\n }\n }\n\n private async stageSnapFiles(opts: { stageDir: string; appOutDir: string; hooksDir: string | null; extraAppArgs: string[]; isTemplate: boolean }): Promise<void> {\n const { stageDir, hooksDir, extraAppArgs, isTemplate } = opts\n\n const snapMetaDir = path.join(stageDir, isTemplate ? \"meta\" : \"snap\")\n // No-template builds place command.sh + desktop scripts in scripts/ which snapcraft stages to snap root.\n // Template builds write command.sh to the stage root directly; no scripts/ dir is needed.\n const scriptDir = path.join(stageDir, \"scripts\")\n if (!isTemplate) {\n await mkdir(scriptDir, { recursive: true })\n }\n\n if (this.helper.maxIconPath != null) {\n const iconDest = path.join(snapMetaDir, \"gui\", `icon${path.extname(this.helper.maxIconPath)}`)\n await mkdir(path.dirname(iconDest), { recursive: true })\n await copyFile(this.helper.maxIconPath, iconDest)\n }\n\n if (hooksDir != null) {\n await copyDir(hooksDir, path.join(snapMetaDir, \"hooks\"))\n }\n\n // command.sh — template builds write to stage root; no-template writes to scripts/\n const commandWrapperPath = isTemplate ? path.join(stageDir, \"command.sh\") : path.join(scriptDir, \"command.sh\")\n const commandContent = buildCommandShContent({ isTemplate, executableName: this.packager.executableName, extraAppArgs })\n await writeFile(commandWrapperPath, commandContent, { mode: 0o755 })\n await chmod(commandWrapperPath, 0o755)\n }\n\n private normalizePlugConfiguration(raw: Array<string | PlugDescriptor> | PlugDescriptor | Nullish): Record<string, Record<string, any> | null> | null {\n if (raw == null) {\n return null\n }\n\n const result: any = {}\n for (const item of Array.isArray(raw) ? raw : [raw]) {\n if (typeof item === \"string\") {\n if (!isValidKey(item)) {\n throw new Error(`Invalid plug/slot name: ${item}`)\n }\n result[item] = null\n } else {\n deepAssign(result, item)\n }\n }\n return result\n }\n\n private isBrowserSandboxAllowed(snap: any): boolean {\n if (snap.plugs != null) {\n for (const plugName of Object.keys(snap.plugs)) {\n const plug = snap.plugs[plugName]\n if (plug.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n }\n return false\n }\n\n private archNameToTriplet(arch: Arch): string {\n switch (arch) {\n case Arch.x64:\n return \"x86_64-linux-gnu\"\n case Arch.ia32:\n return \"i386-linux-gnu\"\n case Arch.armv7l:\n return \"arm-linux-gnueabihf\"\n case Arch.arm64:\n return \"aarch64-linux-gnu\"\n\n default:\n throw new Error(`Unsupported arch ${arch}`)\n }\n }\n}\n\nasync function getMksquashfsPath(arch: Arch): Promise<string> {\n const envPath = process.env.MKSQUASHFS_PATH\n if (envPath) {\n return envPath\n }\n const { mksquashfs } = await getAppImageTools(\"0.0.0\", arch)\n return mksquashfs\n}\n\nasync function readDirPaths(dir: string, filter?: (name: string) => boolean): Promise<string[]> {\n const entries = await readdir(dir)\n const result: string[] = []\n for (const name of entries) {\n if (!filter || filter(name)) {\n result.push(path.join(dir, name))\n }\n }\n return result\n}\n\n/** Single-quote a shell argument, escaping any embedded single quotes. */\nexport function shellQuote(arg: string): string {\n return \"'\" + arg.replace(/'/g, \"'\\\\''\") + \"'\"\n}\n\n/**\n * Builds the content of command.sh for a snap package.\n *\n * For both template and no-template builds, the desktop-integration scripts are\n * sourced from the snap root ($SNAP):\n * - Template: scripts are embedded in the template tarball at the snap root.\n * - No-template: the snapcraft.yaml `launch-scripts` part uses `plugin: dump,\n * source: scripts`, which stages stageDir/scripts/ contents directly into the\n * snap root — so $SNAP/desktop-init.sh is correct in both cases.\n *\n * The only difference between template and no-template is the app executable prefix:\n * template apps are at $SNAP/<name>; no-template apps are at $SNAP/app/<name>.\n */\nexport function buildCommandShContent(opts: { isTemplate: boolean; executableName: string; extraAppArgs: string[] }): string {\n const { isTemplate, executableName, extraAppArgs } = opts\n validateShellEmbeddable(executableName, \"executableName\")\n const appPrefix = isTemplate ? \"\" : \"app/\"\n let content = `#!/bin/bash -e\\nexec \"$SNAP/desktop-init.sh\" \"$SNAP/desktop-common.sh\" \"$SNAP/desktop-gnome-specific.sh\" \"$SNAP/${appPrefix}${executableName}\"`\n if (extraAppArgs.length > 0) {\n content += \" \" + extraAppArgs.map(shellQuote).join(\" \")\n }\n content += ' \"$@\"'\n return content\n}\n"]}
1
+ {"version":3,"file":"coreLegacy.js","sourceRoot":"","sources":["../../../src/targets/snap/coreLegacy.ts"],"names":[],"mappings":";;;AA6cA,sDAUC;AAvdD,+CAA8H;AAC9H,+DAA+E;AAC/E,uCAA+C;AAC/C,0CAAoF;AACpF,qCAA8B;AAC9B,6BAA4B;AAC5B,oEAAyE;AAEzE,gDAAuD;AACvD,wDAA+D;AAC/D,wDAAwD;AACxD,6CAAuC;AACvC,qDAA6C;AAKpC,2FALA,2BAAU,OAKA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IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,qBAAqB,CAAC,IAA6E;IACjH,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IACzD,IAAA,wCAAuB,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;IACzD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;IAC1C,IAAI,OAAO,GAAG,mHAAmH,SAAS,GAAG,cAAc,GAAG,CAAA;IAC9J,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,2BAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,OAAO,CAAA;IAClB,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { replaceDefault as _replaceDefault, Arch, copyDir, exec, log, serializeToYaml, toLinuxArchString } from \"builder-util\"\nimport { asArray, deepAssign, isValidKey, Nullish } from \"builder-util-runtime\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { chmod, copyFile, mkdir, readdir, rename, rm, writeFile } from \"fs/promises\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport { validateShellEmbeddable } from \"../../frameworks/LibUiFramework\"\nimport { PlugDescriptor, SnapOptions } from \"../../options/SnapOptions\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { downloadBuilderToolset } from \"../../util/electronGet\"\nimport { getTemplatePath } from \"../../util/pathManager\"\nimport { SnapCore } from \"./SnapTarget\"\nimport { shellQuote } from \"./snapCommand.js\"\nimport { SnapcraftYAML } from \"./snapcraft\"\nimport { DEFAULT_STAGE_PACKAGES } from \"./snapcraftBuilder\"\n\n// Re-exported for backwards compatibility with existing imports/tests.\nexport { shellQuote }\n\n// Snap template release info from electron-userland/electron-builder-binaries\nconst SNAP_TEMPLATES = {\n amd64: {\n releaseName: \"snap-template-4.0-2\",\n filenameWithExt: \"snap-template-electron-4.0-2-amd64.tar.7z\",\n checksums: { \"snap-template-electron-4.0-2-amd64.tar.7z\": \"5e3ab4e09364ac06f0072b1c2dab9138318c933f6b2c7374f893b5ec44d19e6f\" },\n },\n armhf: {\n releaseName: \"snap-template-4.0-1\",\n filenameWithExt: \"snap-template-electron-4.0-1-armhf.tar.7z\",\n checksums: { \"snap-template-electron-4.0-1-armhf.tar.7z\": \"6f7553e904f4e043bc3019f0899d05e01a283b00b61fec22e932296490e3be6b\" },\n },\n} as const\n\n// Handles core18/core20/core22 snaps via mksquashfs (template) or snapcraft CLI (no-template).\n// See: https://github.com/develar/app-builder/blob/master/pkg/package-format/snap\nexport class SnapCoreLegacy extends SnapCore<SnapOptions> {\n private isUseTemplateApp = false\n\n defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\n private replaceDefault(inList: Array<string> | Nullish, defaultList: Array<string>) {\n const result = _replaceDefault(inList, defaultList)\n if (result !== defaultList) {\n this.isUseTemplateApp = false\n }\n return result\n }\n\n async createDescriptor(arch: Arch): Promise<SnapcraftYAML> {\n const appInfo = this.packager.appInfo\n const snapName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n const plugs = this.normalizePlugConfiguration(this.options.plugs)\n\n const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), this.defaultPlugs)\n\n const slots = this.normalizePlugConfiguration(this.options.slots)\n\n const buildPackages = asArray(options.buildPackages)\n const stagePackages = this.replaceDefault(options.stagePackages, DEFAULT_STAGE_PACKAGES)\n\n const stageSet = new Set(stagePackages)\n const stageMatchesDefaults = stagePackages.length === DEFAULT_STAGE_PACKAGES.length && DEFAULT_STAGE_PACKAGES.every((p: string) => stageSet.has(p))\n\n // Template app is only available for x64/armv7l, and only when no packages are customised.\n this.isUseTemplateApp = this.options.useTemplateApp !== false && (arch === Arch.x64 || arch === Arch.armv7l) && buildPackages.length === 0 && stageMatchesDefaults\n\n const appDescriptor: any = {\n command: \"command.sh\",\n plugs: plugNames,\n adapter: \"none\",\n }\n\n const snap: any = load(await readFile(path.join(getTemplatePath(\"snap\"), \"snapcraft.yaml\"), \"utf-8\"))\n if (this.isUseTemplateApp) {\n delete appDescriptor.adapter\n }\n if (options.base != null) {\n snap.base = options.base\n if (Number(snap.base.split(\"core\")[1]) >= 22) {\n delete appDescriptor.adapter\n }\n }\n if (options.grade != null) {\n snap.grade = options.grade\n }\n if (options.confinement != null) {\n snap.confinement = options.confinement\n }\n if (options.appPartStage != null) {\n snap.parts.app.stage = options.appPartStage\n }\n if (options.layout != null) {\n snap.layout = options.layout\n }\n if (slots != null) {\n appDescriptor.slots = Object.getOwnPropertyNames(slots)\n for (const slotName of appDescriptor.slots) {\n if (!isValidKey(slotName)) {\n throw new Error(`Invalid plug/slot name: ${slotName}`)\n }\n const slotOptions = slots[slotName]\n if (slotOptions == null) {\n continue\n }\n if (!snap.slots) {\n snap.slots = {}\n }\n snap.slots[slotName] = slotOptions\n }\n }\n\n deepAssign(snap, {\n name: snapName,\n version: appInfo.version,\n title: options.title || appInfo.productName,\n summary: options.summary || appInfo.productName,\n compression: options.compression,\n description: this.helper.getDescription(options),\n architectures: [toLinuxArchString(arch, \"snap\")],\n apps: {\n [snapName]: appDescriptor,\n },\n parts: {\n app: {\n \"stage-packages\": stagePackages,\n },\n },\n })\n\n if (options.autoStart) {\n appDescriptor.autostart = `${this.helper.getDesktopFileName(snap.name)}.desktop`\n }\n\n if (options.confinement === \"classic\") {\n delete appDescriptor.plugs\n delete snap.plugs\n } else {\n const archTriplet = this.archNameToTriplet(arch)\n const environment: Record<string, string> = {\n PATH: \"$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH\",\n SNAP_DESKTOP_RUNTIME: \"$SNAP/gnome-platform\",\n LD_LIBRARY_PATH: [\n \"$SNAP_LIBRARY_PATH\",\n \"$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n \"$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib\",\n \"$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n ].join(\":\"),\n ...options.environment,\n }\n const allow = options.allowNativeWayland\n const isOldElectron = !this.helper.isElectronVersionGreaterOrEqualThan(\"38.0.0\", \"7.0.0\")\n if ((allow == null && isOldElectron) || allow === false) {\n environment.DISABLE_WAYLAND = \"1\"\n }\n\n appDescriptor.environment = environment\n\n if (plugs != null) {\n for (const plugName of plugNames) {\n if (!isValidKey(plugName)) {\n throw new Error(`Invalid plug/slot name: ${plugName}`)\n }\n const plugOptions = plugs[plugName]\n if (plugOptions == null) {\n continue\n }\n if (!snap.plugs) {\n snap.plugs = {}\n }\n snap.plugs[plugName] = plugOptions\n }\n }\n }\n\n if (buildPackages.length > 0) {\n snap.parts.app[\"build-packages\"] = buildPackages\n }\n if (options.after != null) {\n snap.parts.app.after = options.after\n }\n\n if (options.assumes != null) {\n snap.assumes = asArray(options.assumes)\n }\n\n return snap\n }\n\n async buildSnap(props: { snap: any; appOutDir: string; stageDir: string; snapArch: Arch; artifactPath: string }): Promise<void> {\n const { snap, appOutDir, stageDir, snapArch, artifactPath } = props\n\n // Build the args array for effectiveOptionComputed compatibility — tests inspect this.\n const args = [\n \"snap\",\n \"--app\",\n appOutDir,\n \"--stage\",\n stageDir,\n \"--arch\",\n toLinuxArchString(snapArch, \"snap\"),\n \"--output\",\n artifactPath,\n \"--executable\",\n this.packager.executableName,\n ]\n\n await this.helper.icons\n if (this.helper.maxIconPath != null) {\n if (!this.isUseTemplateApp) {\n snap.icon = \"snap/gui/icon.png\"\n }\n args.push(\"--icon\", this.helper.maxIconPath)\n }\n\n const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? \"meta\" : \"snap\")\n const desktopFile = path.join(snapMetaDir, \"gui\", `${this.helper.getDesktopFileName(snap.name)}.desktop`)\n await this.helper.writeDesktopEntry(this.options, this.packager.executableName + \" %U\", desktopFile, {\n Icon: \"${SNAP}/meta/gui/icon.png\",\n })\n\n const extraAppArgs: Array<string> = this.options.executableArgs ?? []\n if (this.helper.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !this.isBrowserSandboxAllowed(snap)) {\n const noSandboxArg = \"--no-sandbox\"\n if (!extraAppArgs.includes(noSandboxArg)) {\n extraAppArgs.push(noSandboxArg)\n }\n if (this.isUseTemplateApp) {\n args.push(\"--exclude\", \"chrome-sandbox\")\n }\n }\n if (extraAppArgs.length > 0) {\n args.push(\"--extraAppArgs=\" + extraAppArgs.join(\" \"))\n }\n\n // Capture compression BEFORE it gets stripped from snap for template builds.\n const compression = this.options.compression ?? \"xz\"\n if (snap.compression != null) {\n args.push(\"--compression\", snap.compression)\n }\n\n if (this.isUseTemplateApp) {\n const fieldsToStrip = [\"compression\", \"contact\", \"donation\", \"issues\", \"parts\", \"source-code\", \"website\"]\n for (const field of fieldsToStrip) {\n delete snap[field]\n }\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ snap, desktopFile, args }))) {\n return\n }\n\n await outputFile(path.join(snapMetaDir, this.isUseTemplateApp ? \"snap.yaml\" : \"snapcraft.yaml\"), serializeToYaml(snap))\n\n const hooksDir = await this.packager.getResource(this.options.hooks, \"snap-hooks\")\n if (hooksDir != null) {\n args.push(\"--hooks\", hooksDir)\n }\n\n if (this.isUseTemplateApp) {\n const templateArch = snapArch === Arch.x64 ? \"amd64\" : \"armhf\"\n args.push(\"--template-url\", `electron4:${templateArch}`)\n await this.buildWithTemplate({ appOutDir, stageDir, snapArch, artifactPath, compression, hooksDir, extraAppArgs })\n } else {\n await this.buildWithoutTemplate({ appOutDir, stageDir, artifactPath, hooksDir, extraAppArgs })\n }\n }\n\n private async buildWithTemplate(opts: {\n appOutDir: string\n stageDir: string\n snapArch: Arch\n artifactPath: string\n compression: string\n hooksDir: string | null\n extraAppArgs: string[]\n }): Promise<void> {\n const { appOutDir, stageDir, snapArch, artifactPath, compression, hooksDir, extraAppArgs } = opts\n const templateArch = snapArch === Arch.x64 ? \"amd64\" : \"armhf\"\n const { releaseName, filenameWithExt, checksums } = SNAP_TEMPLATES[templateArch]\n\n log.info({ releaseName }, \"downloading snap template\")\n const templateDir = await downloadBuilderToolset({ releaseName, filenameWithExt, checksums, githubOrgRepo: \"electron-userland/electron-builder-binaries\" })\n\n await this.stageSnapFiles({ stageDir, appOutDir, hooksDir, extraAppArgs, isTemplate: true })\n\n // Best-effort: remove chrome-sandbox from app dir before mksquashfs scans it.\n await rm(path.join(appOutDir, \"chrome-sandbox\"), { force: true })\n\n // chmod -R g-s to avoid setgid bits in final image\n for (const dir of [stageDir, appOutDir, templateDir]) {\n await exec(\"chmod\", [\"-R\", \"g-s\", dir]).catch(err => log.warn({ error: err.message }, \"chmod g-s failed\"))\n }\n\n const mksquashfsPath = await getMksquashfsPath(snapArch)\n\n // Collect top-level entries from each dir as individual path args (mirrors Go ReadDirContentTo)\n const mksquashfsArgs: string[] = [\n ...(await readDirPaths(templateDir)),\n ...(await readDirPaths(stageDir)),\n ...(await readDirPaths(appOutDir, name => name !== \"LICENSES.chromium.html\" && name !== \"LICENSE.electron.txt\" && name !== \"chrome-sandbox\")),\n artifactPath,\n \"-no-progress\",\n \"-quiet\",\n \"-noappend\",\n \"-comp\",\n compression,\n \"-no-xattrs\",\n \"-no-fragments\",\n \"-all-root\",\n ]\n\n await exec(mksquashfsPath, mksquashfsArgs, { cwd: stageDir })\n }\n\n private async buildWithoutTemplate(opts: { appOutDir: string; stageDir: string; artifactPath: string; hooksDir: string | null; extraAppArgs: string[] }): Promise<void> {\n const { appOutDir, stageDir, artifactPath, hooksDir, extraAppArgs } = opts\n\n await this.stageSnapFiles({ stageDir, appOutDir, hooksDir, extraAppArgs, isTemplate: false })\n\n // Write desktop integration scripts (embedded in the Go binary, now in our templates)\n const snapTemplateDir = getTemplatePath(\"snap\")\n for (const script of [\"desktop-init.sh\", \"desktop-common.sh\", \"desktop-gnome-specific.sh\"]) {\n const src = path.join(snapTemplateDir, script)\n const dest = path.join(stageDir, \"scripts\", script)\n await copyFile(src, dest)\n // copyFile doesn't preserve mode; chmod 755 explicitly\n await chmod(dest, 0o755)\n }\n\n // Copy app dir into stage/app/ so snapcraft can pick it up\n await copyDir(appOutDir, path.join(stageDir, \"app\"))\n\n // Run snapcraft (legacy `snap` subcommand)\n const isDestructiveMode = process.env.SNAP_DESTRUCTIVE_MODE === \"true\"\n const snapOutputName = \"out.snap\"\n const snapArgs = [\"snap\", \"--output\", isDestructiveMode ? artifactPath : snapOutputName]\n if (isDestructiveMode) {\n snapArgs.push(\"--destructive-mode\")\n }\n\n await exec(\"snapcraft\", snapArgs, {\n cwd: stageDir,\n env: { ...process.env, SNAPCRAFT_HAS_TTY: \"false\" },\n })\n\n if (!isDestructiveMode) {\n await rename(path.join(stageDir, snapOutputName), artifactPath)\n }\n }\n\n private async stageSnapFiles(opts: { stageDir: string; appOutDir: string; hooksDir: string | null; extraAppArgs: string[]; isTemplate: boolean }): Promise<void> {\n const { stageDir, hooksDir, extraAppArgs, isTemplate } = opts\n\n const snapMetaDir = path.join(stageDir, isTemplate ? \"meta\" : \"snap\")\n // No-template builds place command.sh + desktop scripts in scripts/ which snapcraft stages to snap root.\n // Template builds write command.sh to the stage root directly; no scripts/ dir is needed.\n const scriptDir = path.join(stageDir, \"scripts\")\n if (!isTemplate) {\n await mkdir(scriptDir, { recursive: true })\n }\n\n if (this.helper.maxIconPath != null) {\n const iconDest = path.join(snapMetaDir, \"gui\", `icon${path.extname(this.helper.maxIconPath)}`)\n await mkdir(path.dirname(iconDest), { recursive: true })\n await copyFile(this.helper.maxIconPath, iconDest)\n }\n\n if (hooksDir != null) {\n await copyDir(hooksDir, path.join(snapMetaDir, \"hooks\"))\n }\n\n // command.sh — template builds write to stage root; no-template writes to scripts/\n const commandWrapperPath = isTemplate ? path.join(stageDir, \"command.sh\") : path.join(scriptDir, \"command.sh\")\n const commandContent = buildCommandShContent({ isTemplate, executableName: this.packager.executableName, extraAppArgs })\n await writeFile(commandWrapperPath, commandContent, { mode: 0o755 })\n await chmod(commandWrapperPath, 0o755)\n }\n\n private normalizePlugConfiguration(raw: Array<string | PlugDescriptor> | PlugDescriptor | Nullish): Record<string, Record<string, any> | null> | null {\n if (raw == null) {\n return null\n }\n\n const result: any = {}\n for (const item of Array.isArray(raw) ? raw : [raw]) {\n if (typeof item === \"string\") {\n if (!isValidKey(item)) {\n throw new Error(`Invalid plug/slot name: ${item}`)\n }\n result[item] = null\n } else {\n deepAssign(result, item)\n }\n }\n return result\n }\n\n private isBrowserSandboxAllowed(snap: any): boolean {\n if (snap.plugs != null) {\n for (const plugName of Object.keys(snap.plugs)) {\n const plug = snap.plugs[plugName]\n if (plug.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n }\n return false\n }\n\n private archNameToTriplet(arch: Arch): string {\n switch (arch) {\n case Arch.x64:\n return \"x86_64-linux-gnu\"\n case Arch.ia32:\n return \"i386-linux-gnu\"\n case Arch.armv7l:\n return \"arm-linux-gnueabihf\"\n case Arch.arm64:\n return \"aarch64-linux-gnu\"\n\n default:\n throw new Error(`Unsupported arch ${arch}`)\n }\n }\n}\n\nasync function getMksquashfsPath(arch: Arch): Promise<string> {\n const envPath = process.env.MKSQUASHFS_PATH\n if (envPath) {\n return envPath\n }\n const { mksquashfs } = await getAppImageTools(\"0.0.0\", arch)\n return mksquashfs\n}\n\nasync function readDirPaths(dir: string, filter?: (name: string) => boolean): Promise<string[]> {\n const entries = await readdir(dir)\n const result: string[] = []\n for (const name of entries) {\n if (!filter || filter(name)) {\n result.push(path.join(dir, name))\n }\n }\n return result\n}\n\n/**\n * Builds the content of command.sh for a snap package.\n *\n * For both template and no-template builds, the desktop-integration scripts are\n * sourced from the snap root ($SNAP):\n * - Template: scripts are embedded in the template tarball at the snap root.\n * - No-template: the snapcraft.yaml `launch-scripts` part uses `plugin: dump,\n * source: scripts`, which stages stageDir/scripts/ contents directly into the\n * snap root — so $SNAP/desktop-init.sh is correct in both cases.\n *\n * The only difference between template and no-template is the app executable prefix:\n * template apps are at $SNAP/<name>; no-template apps are at $SNAP/app/<name>.\n */\nexport function buildCommandShContent(opts: { isTemplate: boolean; executableName: string; extraAppArgs: string[] }): string {\n const { isTemplate, executableName, extraAppArgs } = opts\n validateShellEmbeddable(executableName, \"executableName\")\n const appPrefix = isTemplate ? \"\" : \"app/\"\n let content = `#!/bin/bash -e\\nexec \"$SNAP/desktop-init.sh\" \"$SNAP/desktop-common.sh\" \"$SNAP/desktop-gnome-specific.sh\" \"$SNAP/${appPrefix}${executableName}\"`\n if (extraAppArgs.length > 0) {\n content += \" \" + extraAppArgs.map(shellQuote).join(\" \")\n }\n content += ' \"$@\"'\n return content\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Validates that a value is safe to embed in a double-quoted shell string.
3
+ * Rejects characters that would be interpreted as shell metacharacters inside `"..."`:
4
+ * `$`, backtick, `"`, `\`, and newlines.
5
+ */
6
+ export declare function validateShellEmbeddable(value: string, fieldName: string): void;
7
+ /** Single-quote a shell argument, escaping any embedded single quotes. */
8
+ export declare function shellQuote(arg: string): string;
9
+ /**
10
+ * Builds the contents of the launcher script that execs `$SNAP/app/<execName>` with the given args.
11
+ * `$@` is forwarded so launch-time arguments still reach the app. The executable name is validated
12
+ * against shell metacharacters and each arg is single-quoted, so embedded characters (e.g. `=`, quotes)
13
+ * are passed literally.
14
+ */
15
+ export declare function buildSnapCommandLauncherScript(opts: {
16
+ execName: string;
17
+ args: string[];
18
+ }): string;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateShellEmbeddable = validateShellEmbeddable;
4
+ exports.shellQuote = shellQuote;
5
+ exports.buildSnapCommandLauncherScript = buildSnapCommandLauncherScript;
6
+ const builder_util_1 = require("builder-util");
7
+ /**
8
+ * Validates that a value is safe to embed in a double-quoted shell string.
9
+ * Rejects characters that would be interpreted as shell metacharacters inside `"..."`:
10
+ * `$`, backtick, `"`, `\`, and newlines.
11
+ */
12
+ function validateShellEmbeddable(value, fieldName) {
13
+ if (/[$`"\\\r\n]/.test(value)) {
14
+ throw new builder_util_1.InvalidConfigurationError(`${fieldName} contains characters that are not safe in shell scripts: ${JSON.stringify(value)}. ` + `Avoid $, backtick, double-quote, backslash, and newline characters.`);
15
+ }
16
+ }
17
+ // snapd restricts the value of `apps.<app-name>.command` to alphanumeric characters, spaces, and
18
+ // `/ . _ # : $ -`, and splits it on whitespace. Rather than encode those rules per-arg, core24
19
+ // always routes the command through a launcher script (see buildSnapCommandLauncherScript), which
20
+ // sidesteps the character restrictions entirely and keeps a single, uniform command path.
21
+ // See: https://documentation.ubuntu.com/snapcraft/stable/reference/snapcraft-yaml/#apps.%3Capp-name%3E.command
22
+ /** Single-quote a shell argument, escaping any embedded single quotes. */
23
+ function shellQuote(arg) {
24
+ return "'" + arg.replace(/'/g, "'\\''") + "'";
25
+ }
26
+ /**
27
+ * Builds the contents of the launcher script that execs `$SNAP/app/<execName>` with the given args.
28
+ * `$@` is forwarded so launch-time arguments still reach the app. The executable name is validated
29
+ * against shell metacharacters and each arg is single-quoted, so embedded characters (e.g. `=`, quotes)
30
+ * are passed literally.
31
+ */
32
+ function buildSnapCommandLauncherScript(opts) {
33
+ const { execName, args } = opts;
34
+ validateShellEmbeddable(execName, "executableName");
35
+ let content = `#!/bin/sh\nexec "$SNAP/app/${execName}"`;
36
+ if (args.length > 0) {
37
+ content += " " + args.map(shellQuote).join(" ");
38
+ }
39
+ content += ' "$@"\n';
40
+ return content;
41
+ }
42
+ //# sourceMappingURL=snapCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapCommand.js","sourceRoot":"","sources":["../../../src/targets/snap/snapCommand.ts"],"names":[],"mappings":";;AAOA,0DAMC;AASD,gCAEC;AAQD,wEASC;AAzCD,+CAAwD;AAExD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,KAAa,EAAE,SAAiB;IACtE,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,wCAAyB,CACjC,GAAG,SAAS,4DAA4D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,qEAAqE,CAC1K,CAAA;IACH,CAAC;AACH,CAAC;AAED,iGAAiG;AACjG,+FAA+F;AAC/F,kGAAkG;AAClG,0FAA0F;AAC1F,+GAA+G;AAE/G,0EAA0E;AAC1E,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,GAAG,CAAA;AAC/C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,8BAA8B,CAAC,IAA0C;IACvF,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAC/B,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IACnD,IAAI,OAAO,GAAG,8BAA8B,QAAQ,GAAG,CAAA;IACvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,IAAI,SAAS,CAAA;IACpB,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { InvalidConfigurationError } from \"builder-util\"\n\n/**\n * Validates that a value is safe to embed in a double-quoted shell string.\n * Rejects characters that would be interpreted as shell metacharacters inside `\"...\"`:\n * `$`, backtick, `\"`, `\\`, and newlines.\n */\nexport function validateShellEmbeddable(value: string, fieldName: string): void {\n if (/[$`\"\\\\\\r\\n]/.test(value)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that are not safe in shell scripts: ${JSON.stringify(value)}. ` + `Avoid $, backtick, double-quote, backslash, and newline characters.`\n )\n }\n}\n\n// snapd restricts the value of `apps.<app-name>.command` to alphanumeric characters, spaces, and\n// `/ . _ # : $ -`, and splits it on whitespace. Rather than encode those rules per-arg, core24\n// always routes the command through a launcher script (see buildSnapCommandLauncherScript), which\n// sidesteps the character restrictions entirely and keeps a single, uniform command path.\n// See: https://documentation.ubuntu.com/snapcraft/stable/reference/snapcraft-yaml/#apps.%3Capp-name%3E.command\n\n/** Single-quote a shell argument, escaping any embedded single quotes. */\nexport function shellQuote(arg: string): string {\n return \"'\" + arg.replace(/'/g, \"'\\\\''\") + \"'\"\n}\n\n/**\n * Builds the contents of the launcher script that execs `$SNAP/app/<execName>` with the given args.\n * `$@` is forwarded so launch-time arguments still reach the app. The executable name is validated\n * against shell metacharacters and each arg is single-quoted, so embedded characters (e.g. `=`, quotes)\n * are passed literally.\n */\nexport function buildSnapCommandLauncherScript(opts: { execName: string; args: string[] }): string {\n const { execName, args } = opts\n validateShellEmbeddable(execName, \"executableName\")\n let content = `#!/bin/sh\\nexec \"$SNAP/app/${execName}\"`\n if (args.length > 0) {\n content += \" \" + args.map(shellQuote).join(\" \")\n }\n content += ' \"$@\"\\n'\n return content\n}\n"]}
@@ -6,7 +6,7 @@ const builder_util_1 = require("builder-util");
6
6
  const path = require("path");
7
7
  const electronGet_1 = require("../util/electronGet");
8
8
  const iconsToolsChecksums = {
9
- "icons-bundle.tar.gz": "2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec",
9
+ "icons-bundle.tar.gz": "193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a",
10
10
  };
11
11
  async function getIconsToolsetPath() {
12
12
  const envPath = await (0, builder_util_1.resolveEnvToolsetPath)("ELECTRON_BUILDER_ICONS_TOOLSET_DIR", "directory");
@@ -14,7 +14,7 @@ async function getIconsToolsetPath() {
14
14
  return envPath;
15
15
  }
16
16
  return (0, electronGet_1.downloadBuilderToolset)({
17
- releaseName: "icons@1.1.0",
17
+ releaseName: "icons@1.2.1",
18
18
  filenameWithExt: "icons-bundle.tar.gz",
19
19
  checksums: iconsToolsChecksums,
20
20
  githubOrgRepo: "electron-userland/electron-builder-binaries",
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":";;AAQA,kDAWC;AAUD,oCAaC;AA1CD,+CAA8G;AAC9G,6BAA4B;AAC5B,qDAA4D;AAE5D,MAAM,mBAAmB,GAAG;IAC1B,qBAAqB,EAAE,kEAAkE;CACjF,CAAA;AAEH,KAAK,UAAU,mBAAmB;IACvC,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAqB,EAAC,oCAAoC,EAAE,WAAW,CAAC,CAAA;IAC9F,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,IAAA,oCAAsB,EAAC;QAC5B,WAAW,EAAE,aAAa;QAC1B,eAAe,EAAE,qBAAqB;QACtC,SAAS,EAAE,mBAAmB;QAC9B,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;AACJ,CAAC;AAQD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAErD,KAAK,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAyB;IAC3F,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,wCAAyB,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,IAAA,8BAAe,EAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,IAAA,8BAAe,EAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,EAAE,CAAA;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC5D,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAM,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,wCAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,SAAS,EAAE,EAAE,YAAY,YAAY,EAAE,EAAE,SAAS,UAAU,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AACzI,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, resolveEnvToolsetPath, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst iconsToolsChecksums = {\n \"icons-bundle.tar.gz\": \"2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec\",\n} as const\n\nexport async function getIconsToolsetPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n return downloadBuilderToolset({\n releaseName: \"icons@1.1.0\",\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir }: IconConversionOptions): Promise<void> {\n if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n }\n const safeInput = sanitizeDirPath(inputFile)\n const safeOutDir = sanitizeDirPath(outDir)\n\n const toolsetPath = await getIconsToolsetPath()\n const scriptPath = path.resolve(toolsetPath, \"icon-tool.js\")\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n await exec(process.execPath, [scriptPath, `--input=${safeInput}`, `--format=${outputFormat}`, `--out=${safeOutDir}`], { shell: false })\n}\n"]}
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":";;AAQA,kDAWC;AAUD,oCAaC;AA1CD,+CAA8G;AAC9G,6BAA4B;AAC5B,qDAA4D;AAE5D,MAAM,mBAAmB,GAAG;IAC1B,qBAAqB,EAAE,kEAAkE;CACjF,CAAA;AAEH,KAAK,UAAU,mBAAmB;IACvC,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAqB,EAAC,oCAAoC,EAAE,WAAW,CAAC,CAAA;IAC9F,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,IAAA,oCAAsB,EAAC;QAC5B,WAAW,EAAE,aAAa;QAC1B,eAAe,EAAE,qBAAqB;QACtC,SAAS,EAAE,mBAAmB;QAC9B,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;AACJ,CAAC;AAQD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAErD,KAAK,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAyB;IAC3F,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,wCAAyB,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,IAAA,8BAAe,EAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,IAAA,8BAAe,EAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,EAAE,CAAA;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC5D,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAM,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,wCAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,SAAS,EAAE,EAAE,YAAY,YAAY,EAAE,EAAE,SAAS,UAAU,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AACzI,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, resolveEnvToolsetPath, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst iconsToolsChecksums = {\n \"icons-bundle.tar.gz\": \"193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a\",\n} as const\n\nexport async function getIconsToolsetPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n return downloadBuilderToolset({\n releaseName: \"icons@1.2.1\",\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir }: IconConversionOptions): Promise<void> {\n if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n }\n const safeInput = sanitizeDirPath(inputFile)\n const safeOutDir = sanitizeDirPath(outDir)\n\n const toolsetPath = await getIconsToolsetPath()\n const scriptPath = path.resolve(toolsetPath, \"icon-tool.js\")\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n await exec(process.execPath, [scriptPath, `--input=${safeInput}`, `--format=${outputFormat}`, `--out=${safeOutDir}`], { shell: false })\n}\n"]}
package/out/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "26.15.4";
1
+ export declare const PACKAGE_VERSION = "26.15.5";
package/out/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
- exports.PACKAGE_VERSION = "26.15.4";
4
+ exports.PACKAGE_VERSION = "26.15.5";
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.15.4\"\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.15.5\"\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "app-builder-lib",
3
3
  "description": "electron-builder lib",
4
- "version": "26.15.4",
4
+ "version": "26.15.5",
5
5
  "main": "out/index.js",
6
6
  "files": [
7
7
  "out",
@@ -121,12 +121,12 @@
121
121
  "@types/unzipper": "^0.10.11",
122
122
  "@types/which": "^3.0.4",
123
123
  "toml": "^3.0.0",
124
- "dmg-builder": "26.15.4",
125
- "electron-builder-squirrel-windows": "26.15.4"
124
+ "electron-builder-squirrel-windows": "26.15.5",
125
+ "dmg-builder": "26.15.5"
126
126
  },
127
127
  "peerDependencies": {
128
- "dmg-builder": "26.15.4",
129
- "electron-builder-squirrel-windows": "26.15.4"
128
+ "dmg-builder": "26.15.5",
129
+ "electron-builder-squirrel-windows": "26.15.5"
130
130
  },
131
131
  "//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
132
132
  "typings": "./out/index.d.ts"