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,QAAD,EAAmB;AACjD,WAAO,QAAQ,KAAK,iBAAS,OAAtB,IAAkC,KAAK,aAAL,IAAsB,QAAQ,KAAK,iBAAS,KAArF;AACD;;AAED,EAAA,uBAAuB,CAAC,QAAD,EAAmB;AACxC;AACA,WAAO,KAAK,wBAAL,CAA8B,QAA9B,IAA0C,CAAC,YAAD,CAA1C,GAA2D,IAAlE;AACD;;AAnGwB;;;;AAsG3B,eAAe,mBAAf,CAAmC,IAAnC,EAAiD,OAAjD,EAAgE;AAC9D,QAAM,0BAAU,IAAV,EAAgB,OAAhB,EAAyB;AAAC,IAAA,IAAI,EAAE;AAAP,GAAzB,CAAN;AACA,QAAM,sBAAM,IAAN,EAAY,KAAZ,CAAN;AACD,C","sourcesContent":["import { chmod, emptyDir, ensureDir, rename, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { executeAppBuilder } from \"builder-util\"\nimport { AfterPackContext } from \"../configuration\"\nimport { Platform } from \"../core\"\nimport { Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport MacPackager from \"../macPackager\"\nimport { executeAppBuilderAndWriteJson } from \"../util/appBuilder\"\n\nexport class LibUiFramework implements Framework {\n readonly name: string = \"libui\"\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"dmg\"]\n\n readonly defaultAppIdPrefix: string = \"com.libui.\"\n\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = false\n\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = false\n\n constructor(readonly version: string, readonly distMacOsAppName: string, protected readonly isUseLaunchUi: boolean) {\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await emptyDir(options.appOutDir)\n\n const packager = options.packager\n const platform = packager.platform\n\n if (this.isUseLaunchUiForPlatform(platform)) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\"proton-native\",\n \"--node-version\", this.version,\n \"--use-launch-ui\",\n \"--platform\", platform.nodeName,\n \"--arch\", options.arch,\n \"--stage\", appOutDir,\n \"--executable\", `${packager.appInfo.productFilename}${platform === Platform.WINDOWS ? \".exe\" : \"\"}`,\n ])\n return\n }\n\n if (platform === Platform.MAC) {\n await this.prepareMacosApplicationStageDirectory(packager as MacPackager, options)\n }\n else if (platform === Platform.LINUX) {\n await this.prepareLinuxApplicationStageDirectory(options)\n }\n }\n\n private async prepareMacosApplicationStageDirectory(packager: MacPackager, options: PrepareApplicationStageDirectoryOptions) {\n const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, \"Contents\")\n await ensureDir(path.join(appContentsDir, \"Resources\"))\n await ensureDir(path.join(appContentsDir, \"MacOS\"))\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"darwin\", \"--stage\", path.join(appContentsDir, \"MacOS\")])\n\n const appPlist: any = {\n // https://github.com/albe-rosado/create-proton-app/issues/13\n NSHighResolutionCapable: true,\n }\n await packager.applyCommonInfo(appPlist, appContentsDir)\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], {[path.join(appContentsDir, \"Info.plist\")]: appPlist}),\n writeExecutableMain(path.join(appContentsDir, \"MacOS\", appPlist.CFBundleExecutable), `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/../Resources/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `),\n ])\n }\n\n private async prepareLinuxApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"linux\", \"--arch\", options.arch, \"--stage\", appOutDir])\n const mainPath = path.join(appOutDir, (options.packager as LinuxPackager).executableName)\n await writeExecutableMain(mainPath, `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `)\n }\n\n async afterPack(context: AfterPackContext) {\n const packager = context.packager\n if (!this.isUseLaunchUiForPlatform(packager.platform)) {\n return\n }\n\n // LaunchUI requires main.js, rename if need\n const userMain = packager.info.metadata.main || \"index.js\"\n if (userMain === \"main.js\") {\n return\n }\n\n await rename(path.join(context.appOutDir, \"app\", userMain), path.join(context.appOutDir, \"app\", \"main.js\"))\n }\n\n getMainFile(platform: Platform): string | null {\n return this.isUseLaunchUiForPlatform(platform) ? \"main.js\" : null\n }\n\n private isUseLaunchUiForPlatform(platform: Platform) {\n return platform === Platform.WINDOWS || (this.isUseLaunchUi && platform === Platform.LINUX)\n }\n\n getExcludedDependencies(platform: Platform): Array<string> | null {\n // part of launchui\n return this.isUseLaunchUiForPlatform(platform) ? [\"libui-node\"] : null\n }\n}\n\nasync function writeExecutableMain(file: string, content: string) {\n await writeFile(file, content, {mode: 0o755})\n await chmod(file, 0o755)\n}"],"sourceRoot":""}