app-builder-lib 24.0.0-alpha.7 → 24.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  import { TargetSpecificOptions } from "../core";
2
2
  import { CommonLinuxOptions } from "./linuxOptions";
3
3
  export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {
4
+ /**
5
+ * A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`. Defaults to `core18`
6
+ */
7
+ readonly base?: string | null;
4
8
  /**
5
9
  * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.
6
10
  * @default strict
@@ -1 +1 @@
1
- {"version":3,"file":"SnapOptions.js","sourceRoot":"","sources":["../../src/options/SnapOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { CommonLinuxOptions } from \"./linuxOptions\"\n\nexport interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName).\n */\n readonly summary?: string | null\n\n /**\n * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * The list of features that must be supported by the core in order for this snap to install.\n */\n readonly assumes?: Array<string> | string | null\n\n /**\n * The list of debian packages needs to be installed for building this snap.\n */\n readonly buildPackages?: Array<string> | null\n\n /**\n * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom package `foo` in addition to defaults.\n */\n readonly stagePackages?: Array<string> | null\n\n /**\n * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n\n /**\n * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).\n * Defaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom plug `foo` in addition to defaults.\n *\n * Additional attributes can be specified using object instead of just name of plug:\n * ```\n *[\n * {\n * \"browser-sandbox\": {\n * \"interface\": \"browser-support\",\n * \"allow-sandbox\": true\n * },\n * },\n * \"another-simple-plug-name\"\n *]\n * ```\n */\n readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null\n\n /**\n * The list of [slots](https://snapcraft.io/docs/reference/interfaces).\n *\n * Additional attributes can be specified using object instead of just name of slot:\n * ```\n *[\n * {\n * \"mpris\": {\n * \"name\": \"chromium\"\n * },\n * }\n *]\n *\n * In case you want your application to be a compliant MPris player, you will need to definie\n * The mpris slot with \"chromium\" name.\n * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),\n * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.\n *\n */\n readonly slots?: Array<string | SlotDescriptor> | PlugDescriptor | null\n\n /**\n * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.\n * Defaults to `[\"desktop-gtk2\"\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom parts `foo` in addition to defaults.\n */\n readonly after?: Array<string> | null\n\n /**\n * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.\n */\n readonly useTemplateApp?: boolean\n\n /**\n * Whether or not the snap should automatically start on login.\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n /**\n * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.\n *\n * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).\n */\n readonly appPartStage?: Array<string> | null\n\n /**\n * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Sets the compression type for the snap. Can be xz, lzo, or null.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Allow running the program with native wayland support with --ozone-platform=wayland.\n * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007\n */\n readonly allowNativeWayland?: boolean | null\n}\n\nexport interface PlugDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n\nexport interface SlotDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n"]}
1
+ {"version":3,"file":"SnapOptions.js","sourceRoot":"","sources":["../../src/options/SnapOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { CommonLinuxOptions } from \"./linuxOptions\"\n\nexport interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`. Defaults to `core18`\n */\n readonly base?: string | null\n\n /**\n * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName).\n */\n readonly summary?: string | null\n\n /**\n * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * The list of features that must be supported by the core in order for this snap to install.\n */\n readonly assumes?: Array<string> | string | null\n\n /**\n * The list of debian packages needs to be installed for building this snap.\n */\n readonly buildPackages?: Array<string> | null\n\n /**\n * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom package `foo` in addition to defaults.\n */\n readonly stagePackages?: Array<string> | null\n\n /**\n * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n\n /**\n * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).\n * Defaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom plug `foo` in addition to defaults.\n *\n * Additional attributes can be specified using object instead of just name of plug:\n * ```\n *[\n * {\n * \"browser-sandbox\": {\n * \"interface\": \"browser-support\",\n * \"allow-sandbox\": true\n * },\n * },\n * \"another-simple-plug-name\"\n *]\n * ```\n */\n readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null\n\n /**\n * The list of [slots](https://snapcraft.io/docs/reference/interfaces).\n *\n * Additional attributes can be specified using object instead of just name of slot:\n * ```\n *[\n * {\n * \"mpris\": {\n * \"name\": \"chromium\"\n * },\n * }\n *]\n *\n * In case you want your application to be a compliant MPris player, you will need to definie\n * The mpris slot with \"chromium\" name.\n * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),\n * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.\n *\n */\n readonly slots?: Array<string | SlotDescriptor> | PlugDescriptor | null\n\n /**\n * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.\n * Defaults to `[\"desktop-gtk2\"\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom parts `foo` in addition to defaults.\n */\n readonly after?: Array<string> | null\n\n /**\n * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.\n */\n readonly useTemplateApp?: boolean\n\n /**\n * Whether or not the snap should automatically start on login.\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n /**\n * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.\n *\n * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).\n */\n readonly appPartStage?: Array<string> | null\n\n /**\n * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Sets the compression type for the snap. Can be xz, lzo, or null.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Allow running the program with native wayland support with --ozone-platform=wayland.\n * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007\n */\n readonly allowNativeWayland?: boolean | null\n}\n\nexport interface PlugDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n\nexport interface SlotDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n"]}
@@ -56,6 +56,9 @@ class SnapTarget extends core_1.Target {
56
56
  if (this.isUseTemplateApp) {
57
57
  delete appDescriptor.adapter;
58
58
  }
59
+ if (options.base != null) {
60
+ snap.base = options.base;
61
+ }
59
62
  if (options.grade != null) {
60
63
  snap.grade = options.grade;
61
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"snap.js","sourceRoot":"","sources":["../../src/targets/snap.ts"],"names":[],"mappings":";;AAAA,+CAAyK;AACzK,+DAA8C;AAC9C,uCAA+C;AAC/C,qCAA8B;AAC9B,6BAA4B;AAC5B,iCAAgC;AAChC,kCAAgC;AAGhC,qDAAqD;AAErD,6CAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;AAE3K,MAAqB,UAAW,SAAQ,aAAM;IAK5C,YAAY,IAAY,EAAmB,QAAuB,EAAmB,MAAyB,EAAW,MAAc;QACrI,KAAK,CAAC,IAAI,CAAC,CAAA;QAD8B,aAAQ,GAAR,QAAQ,CAAe;QAAmB,WAAM,GAAN,MAAM,CAAmB;QAAW,WAAM,GAAN,MAAM,CAAQ;QAJ9H,YAAO,GAAgB,EAAE,GAAG,IAAI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KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;QACnD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;SACpB;aAAM;YACL,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;SAC5B;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAS;IACxC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;QACtB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACjC,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE;gBAC1E,OAAO,IAAI,CAAA;aACZ;SACF;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,uBAAuB;IAC9B,qFAAqF;IACrF,uCAAuC;IACvC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAA;AAClF,CAAC","sourcesContent":["import { Arch, deepAssign, executeAppBuilder, InvalidConfigurationError, log, replaceDefault as _replaceDefault, serializeToYaml, toLinuxArchString } from \"builder-util\"\nimport { asArray } from \"builder-util-runtime\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { PlugDescriptor, SnapOptions } from \"../options/SnapOptions\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDirPath } from \"./targetUtil\"\n\nconst defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\nexport default class SnapTarget extends Target {\n readonly options: SnapOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n public isUseTemplateApp = false\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name)\n }\n\n private replaceDefault(inList: Array<string> | null | undefined, defaultList: Array<string>) {\n const result = _replaceDefault(inList, defaultList)\n if (result !== defaultList) {\n this.isUseTemplateApp = false\n }\n return result\n }\n\n private async createDescriptor(arch: Arch): Promise<any> {\n if (!this.isElectronVersionGreaterOrEqualThan(\"4.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"2.0.0-beta.1\")) {\n throw new InvalidConfigurationError(\"Electron 2 and higher is required to build Snap\")\n }\n\n log.warn(\"Electron 4 and higher is highly recommended for Snap\")\n }\n\n const appInfo = this.packager.appInfo\n const snapName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n const plugs = normalizePlugConfiguration(this.options.plugs)\n\n const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs)\n\n const slots = normalizePlugConfiguration(this.options.slots)\n\n const buildPackages = asArray(options.buildPackages)\n const defaultStagePackages = getDefaultStagePackages()\n const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages)\n\n this.isUseTemplateApp =\n this.options.useTemplateApp !== false &&\n (arch === Arch.x64 || arch === Arch.armv7l) &&\n buildPackages.length === 0 &&\n isArrayEqualRegardlessOfSort(stagePackages, defaultStagePackages)\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.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 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 = `${snap.name}.desktop`\n }\n\n if (options.confinement === \"classic\") {\n delete appDescriptor.plugs\n delete snap.plugs\n } else {\n const archTriplet = archNameToTriplet(arch)\n appDescriptor.environment = {\n DISABLE_WAYLAND: options.allowNativeWayland ? \"\" : \"1\",\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\n if (plugs != null) {\n for (const plugName of plugNames) {\n const plugOptions = plugs[plugName]\n if (plugOptions == null) {\n continue\n }\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 build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n // tslint:disable-next-line:no-invalid-template-strings\n const artifactName = packager.expandArtifactNamePattern(this.options, \"snap\", arch, \"${name}_${version}_${arch}.${ext}\", false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"snap\",\n file: artifactPath,\n arch,\n })\n\n const snap = await this.createDescriptor(arch)\n\n const stageDir = await createStageDirPath(this, packager, arch)\n const snapArch = toLinuxArchString(arch, \"snap\")\n const args = [\"snap\", \"--app\", appOutDir, \"--stage\", stageDir, \"--arch\", snapArch, \"--output\", artifactPath, \"--executable\", this.packager.executableName]\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 // snapcraft.yaml inside a snap directory\n const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? \"meta\" : \"snap\")\n const desktopFile = path.join(snapMetaDir, \"gui\", `${snap.name}.desktop`)\n await this.helper.writeDesktopEntry(this.options, packager.executableName + \" %U\", desktopFile, {\n // tslint:disable:no-invalid-template-strings\n Icon: \"${SNAP}/meta/gui/icon.png\",\n })\n\n const extraAppArgs: Array<string> = options.executableArgs ?? []\n if (this.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !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 if (snap.compression != null) {\n args.push(\"--compression\", snap.compression)\n }\n\n if (this.isUseTemplateApp) {\n // remove fields that are valid in snapcraft.yaml, but not snap.yaml\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 (packager.packagerOptions.effectiveOptionComputed != null && (await 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 packager.getResource(options.hooks, \"snap-hooks\")\n if (hooksDir != null) {\n args.push(\"--hooks\", hooksDir)\n }\n\n if (this.isUseTemplateApp) {\n args.push(\"--template-url\", `electron4:${snapArch}`)\n }\n\n await executeAppBuilder(args)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"snap\", arch, false),\n target: this,\n arch,\n packager,\n publishConfig: options.publish == null ? { provider: \"snapStore\" } : null,\n })\n }\n\n private isElectronVersionGreaterOrEqualThan(version: string) {\n return semver.gte(this.packager.config.electronVersion || \"7.0.0\", version)\n }\n}\n\nfunction 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 // noinspection SpellCheckingInspection\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\nfunction isArrayEqualRegardlessOfSort(a: Array<string>, b: Array<string>) {\n a = a.slice()\n b = b.slice()\n a.sort()\n b.sort()\n return a.length === b.length && a.every((value, index) => value === b[index])\n}\n\nfunction normalizePlugConfiguration(raw: Array<string | PlugDescriptor> | PlugDescriptor | null | undefined): { [key: string]: { [name: 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 result[item] = null\n } else {\n Object.assign(result, item)\n }\n }\n return result\n}\n\nfunction 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\nfunction getDefaultStagePackages() {\n // libxss1 - was \"error while loading shared libraries: libXss.so.1\" on Xubuntu 16.04\n // noinspection SpellCheckingInspection\n return [\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]\n}\n"]}
1
+ {"version":3,"file":"snap.js","sourceRoot":"","sources":["../../src/targets/snap.ts"],"names":[],"mappings":";;AAAA,+CAAyK;AACzK,+DAA8C;AAC9C,uCAA+C;AAC/C,qCAA8B;AAC9B,6BAA4B;AAC5B,iCAAgC;AAChC,kCAAgC;AAGhC,qDAAqD;AAErD,6CAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;AAE3K,MAAqB,UAAW,SAAQ,aAAM;IAK5C,YAAY,IAAY,EAAmB,QAAuB,EAAmB,MAAyB,EAAW,MAAc;QACrI,KAAK,CAAC,IAAI,CAAC,CAAA;QAD8B,aAAQ,GAAR,QAAQ,CAAe;QAAmB,WAAM,GAAN,MAAM,CAAmB;QAAW,WAAM,GAAN,MAAM,CAAQ;QAJ9H,YAAO,GAAgB,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAI,IAAI,CAA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,MAAM,GAAQ,EAAE,CAAA;IACtB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;QACnD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;SACpB;aAAM;YACL,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;SAC5B;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAS;IACxC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;QACtB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACjC,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE;gBAC1E,OAAO,IAAI,CAAA;aACZ;SACF;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,uBAAuB;IAC9B,qFAAqF;IACrF,uCAAuC;IACvC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAA;AAClF,CAAC","sourcesContent":["import { Arch, deepAssign, executeAppBuilder, InvalidConfigurationError, log, replaceDefault as _replaceDefault, serializeToYaml, toLinuxArchString } from \"builder-util\"\nimport { asArray } from \"builder-util-runtime\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { PlugDescriptor, SnapOptions } from \"../options/SnapOptions\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDirPath } from \"./targetUtil\"\n\nconst defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\nexport default class SnapTarget extends Target {\n readonly options: SnapOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n public isUseTemplateApp = false\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name)\n }\n\n private replaceDefault(inList: Array<string> | null | undefined, defaultList: Array<string>) {\n const result = _replaceDefault(inList, defaultList)\n if (result !== defaultList) {\n this.isUseTemplateApp = false\n }\n return result\n }\n\n private async createDescriptor(arch: Arch): Promise<any> {\n if (!this.isElectronVersionGreaterOrEqualThan(\"4.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"2.0.0-beta.1\")) {\n throw new InvalidConfigurationError(\"Electron 2 and higher is required to build Snap\")\n }\n\n log.warn(\"Electron 4 and higher is highly recommended for Snap\")\n }\n\n const appInfo = this.packager.appInfo\n const snapName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n const plugs = normalizePlugConfiguration(this.options.plugs)\n\n const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs)\n\n const slots = normalizePlugConfiguration(this.options.slots)\n\n const buildPackages = asArray(options.buildPackages)\n const defaultStagePackages = getDefaultStagePackages()\n const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages)\n\n this.isUseTemplateApp =\n this.options.useTemplateApp !== false &&\n (arch === Arch.x64 || arch === Arch.armv7l) &&\n buildPackages.length === 0 &&\n isArrayEqualRegardlessOfSort(stagePackages, defaultStagePackages)\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 }\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 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 = `${snap.name}.desktop`\n }\n\n if (options.confinement === \"classic\") {\n delete appDescriptor.plugs\n delete snap.plugs\n } else {\n const archTriplet = archNameToTriplet(arch)\n appDescriptor.environment = {\n DISABLE_WAYLAND: options.allowNativeWayland ? \"\" : \"1\",\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\n if (plugs != null) {\n for (const plugName of plugNames) {\n const plugOptions = plugs[plugName]\n if (plugOptions == null) {\n continue\n }\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 build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n // tslint:disable-next-line:no-invalid-template-strings\n const artifactName = packager.expandArtifactNamePattern(this.options, \"snap\", arch, \"${name}_${version}_${arch}.${ext}\", false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"snap\",\n file: artifactPath,\n arch,\n })\n\n const snap = await this.createDescriptor(arch)\n\n const stageDir = await createStageDirPath(this, packager, arch)\n const snapArch = toLinuxArchString(arch, \"snap\")\n const args = [\"snap\", \"--app\", appOutDir, \"--stage\", stageDir, \"--arch\", snapArch, \"--output\", artifactPath, \"--executable\", this.packager.executableName]\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 // snapcraft.yaml inside a snap directory\n const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? \"meta\" : \"snap\")\n const desktopFile = path.join(snapMetaDir, \"gui\", `${snap.name}.desktop`)\n await this.helper.writeDesktopEntry(this.options, packager.executableName + \" %U\", desktopFile, {\n // tslint:disable:no-invalid-template-strings\n Icon: \"${SNAP}/meta/gui/icon.png\",\n })\n\n const extraAppArgs: Array<string> = options.executableArgs ?? []\n if (this.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !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 if (snap.compression != null) {\n args.push(\"--compression\", snap.compression)\n }\n\n if (this.isUseTemplateApp) {\n // remove fields that are valid in snapcraft.yaml, but not snap.yaml\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 (packager.packagerOptions.effectiveOptionComputed != null && (await 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 packager.getResource(options.hooks, \"snap-hooks\")\n if (hooksDir != null) {\n args.push(\"--hooks\", hooksDir)\n }\n\n if (this.isUseTemplateApp) {\n args.push(\"--template-url\", `electron4:${snapArch}`)\n }\n\n await executeAppBuilder(args)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"snap\", arch, false),\n target: this,\n arch,\n packager,\n publishConfig: options.publish == null ? { provider: \"snapStore\" } : null,\n })\n }\n\n private isElectronVersionGreaterOrEqualThan(version: string) {\n return semver.gte(this.packager.config.electronVersion || \"7.0.0\", version)\n }\n}\n\nfunction 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 // noinspection SpellCheckingInspection\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\nfunction isArrayEqualRegardlessOfSort(a: Array<string>, b: Array<string>) {\n a = a.slice()\n b = b.slice()\n a.sort()\n b.sort()\n return a.length === b.length && a.every((value, index) => value === b[index])\n}\n\nfunction normalizePlugConfiguration(raw: Array<string | PlugDescriptor> | PlugDescriptor | null | undefined): { [key: string]: { [name: 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 result[item] = null\n } else {\n Object.assign(result, item)\n }\n }\n return result\n}\n\nfunction 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\nfunction getDefaultStagePackages() {\n // libxss1 - was \"error while loading shared libraries: libXss.so.1\" on Xubuntu 16.04\n // noinspection SpellCheckingInspection\n return [\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]\n}\n"]}
package/out/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "24.0.0-alpha.7";
1
+ export declare const PACKAGE_VERSION = "24.0.0-alpha.8";
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 = "24.0.0-alpha.7";
4
+ exports.PACKAGE_VERSION = "24.0.0-alpha.8";
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,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"24.0.0-alpha.7\"\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"24.0.0-alpha.8\"\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": "24.0.0-alpha.7",
4
+ "version": "24.0.0-alpha.8",
5
5
  "main": "out/index.js",
6
6
  "files": [
7
7
  "out",
@@ -56,12 +56,12 @@
56
56
  "@malept/flatpak-bundler": "^0.4.0",
57
57
  "async-exit-hook": "^2.0.1",
58
58
  "bluebird-lst": "^1.0.9",
59
- "builder-util": "24.0.0-alpha.6",
60
- "builder-util-runtime": "9.1.2-alpha.1",
59
+ "builder-util": "24.0.0-alpha.8",
60
+ "builder-util-runtime": "9.2.0-alpha.2",
61
61
  "chromium-pickle-js": "^0.2.0",
62
62
  "debug": "^4.3.4",
63
63
  "ejs": "^3.1.8",
64
- "electron-publish": "24.0.0-alpha.6",
64
+ "electron-publish": "24.0.0-alpha.8",
65
65
  "form-data": "^4.0.0",
66
66
  "fs-extra": "^10.1.0",
67
67
  "hosted-git-info": "^4.1.0",
@@ -105,8 +105,8 @@
105
105
  "@types/js-yaml": "4.0.3",
106
106
  "@types/semver": "7.3.8",
107
107
  "@types/tar": "^6.1.3",
108
- "dmg-builder": "24.0.0-alpha.7",
109
- "electron-builder-squirrel-windows": "24.0.0-alpha.7"
108
+ "dmg-builder": "24.0.0-alpha.8",
109
+ "electron-builder-squirrel-windows": "24.0.0-alpha.8"
110
110
  },
111
111
  "//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
112
112
  "typings": "./out/index.d.ts"
package/scheme.json CHANGED
@@ -4882,6 +4882,10 @@
4882
4882
  "additionalProperties": false,
4883
4883
  "description": "[Amazon S3](https://aws.amazon.com/s3/) options.\nAWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).\nDefine `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).\nOr in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).\n\nExample configuration:\n\n```json\n{\n\"build\":\n \"publish\": {\n \"provider\": \"s3\",\n \"bucket\": \"bucket-name\"\n }\n}\n}\n```",
4884
4884
  "properties": {
4885
+ "accelerate": {
4886
+ "description": "If set to true, this will enable the s3 accelerated endpoint\nThese endpoints have a particular format of:\n ${bucketname}.s3-accelerate.amazonaws.com",
4887
+ "type": "boolean"
4888
+ },
4885
4889
  "acl": {
4886
4890
  "anyOf": [
4887
4891
  {
@@ -5094,6 +5098,13 @@
5094
5098
  "description": "Whether or not the snap should automatically start on login.",
5095
5099
  "type": "boolean"
5096
5100
  },
5101
+ "base": {
5102
+ "description": "A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`. Defaults to `core18`",
5103
+ "type": [
5104
+ "null",
5105
+ "string"
5106
+ ]
5107
+ },
5097
5108
  "buildPackages": {
5098
5109
  "anyOf": [
5099
5110
  {