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CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAA;IAC3C,CAAC;CACF;AArBD,wBAqBC;AAWY,QAAA,cAAc,GAAG,SAAS,CAAA;AAC1B,QAAA,UAAU,GAAG,KAAK,CAAA","sourcesContent":["import { Arch, archFromString, ArchType, AsyncTaskManager } from \"builder-util\"\nimport { AllPublishOptions, CancellationToken, Nullish } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n  /**\n   * The target name. e.g. `snap`.\n   */\n  readonly target: string\n\n  /**\n   * The arch or list of archs.\n   */\n  readonly arch?: Array<ArchType> | ArchType\n}\n\nexport class Platform {\n  static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n  static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n  static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n  constructor(\n    public name: string,\n    public buildConfigurationKey: string,\n    public nodeName: NodeJS.Platform\n  ) {}\n\n  toString() {\n    return this.name\n  }\n\n  createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> {\n    if (type == null && (archs == null || archs.length === 0)) {\n      return new Map([[this, new Map()]])\n    }\n\n    const archToType = new Map()\n\n    for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n      archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n    }\n    return new Map([[this, archToType]])\n  }\n\n  static current(): Platform {\n    return Platform.fromString(process.platform)\n  }\n\n  static fromString(name: string): Platform {\n    name = name.toLowerCase()\n    switch (name) {\n      case Platform.MAC.nodeName:\n      case Platform.MAC.name:\n        return Platform.MAC\n\n      case Platform.WINDOWS.nodeName:\n      case Platform.WINDOWS.name:\n      case Platform.WINDOWS.buildConfigurationKey:\n        return Platform.WINDOWS\n\n      case Platform.LINUX.nodeName:\n        return Platform.LINUX\n\n      default:\n        throw new Error(`Unknown platform: ${name}`)\n    }\n  }\n}\n\nexport abstract class Target {\n  abstract readonly outDir: string\n  abstract readonly options: TargetSpecificOptions | Nullish\n\n  // use only for tasks that cannot be executed in parallel (such as signing on windows and hdiutil on macOS due to file locking)\n  readonly buildQueueManager = new AsyncTaskManager(new CancellationToken())\n\n  protected constructor(\n    readonly name: string,\n    readonly isAsyncSupported: boolean = true\n  ) {}\n\n  async checkOptions(): Promise<any> {\n    // ignore\n  }\n\n  abstract build(appOutDir: string, arch: Arch): Promise<any>\n\n  async finishBuild(): Promise<any> {\n    await this.buildQueueManager.awaitTasks()\n  }\n}\n\nexport interface TargetSpecificOptions {\n  /**\n   The [artifact file name template](./configuration.md#artifact-file-name-template).\n   */\n  readonly artifactName?: string | null\n\n  publish?: Publish\n}\n\nexport const DEFAULT_TARGET = \"default\"\nexport const DIR_TARGET = \"dir\"\n\nexport type CompressionLevel = \"store\" | \"normal\" | \"maximum\"\n\nexport interface BeforeBuildContext {\n  readonly appDir: string\n  readonly electronVersion: string\n  readonly platform: Platform\n  readonly arch: string\n}\n\nexport interface SourceRepositoryInfo {\n  type?: string\n  domain?: string\n  user: string\n  project: string\n}\n"]}