desktop-product-identity.d.mts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * 手写声明的原因:`desktop-product-identity.mjs` 是构建脚本与 main 进程共用的 ESM 模块,
  3. * 仓库未开启 allowJs,缺少本文件时 TS 会把它整体当成隐式 any,main 侧调用点就失去类型校验。
  4. * 合并冲突原因:本文件曾停留在旧接口(identity 上带 artifactSuffix、只有单轴的
  5. * resolveWindowsAppUserModelId),而实现已把「产品身份 flavor」和「后端环境 artifactSuffix」拆成两轴,
  6. * 导致 main/index.ts 导入 resolveWindowsAppUserModelIdForFlavor 时报 TS2724。
  7. * 改 .mjs 导出时必须同步本文件。
  8. */
  9. export type DesktopProductFlavor = "production" | "preview";
  10. export interface DesktopProductIdentity {
  11. readonly flavor: DesktopProductFlavor;
  12. readonly appId: string;
  13. readonly productName: string;
  14. readonly linuxExecutableName: string;
  15. readonly linuxPackageName: string;
  16. readonly cuaHelperInstallVariant: "preview" | null;
  17. }
  18. export const ZCODE_PREVIEW_IDENTITY_ENV: "ZCODE_PREVIEW_IDENTITY";
  19. export function isPreviewIdentityRequested(env?: Record<string, string | undefined>): boolean;
  20. export function resolveDesktopProductFlavor(
  21. env?: Record<string, string | undefined>,
  22. ): DesktopProductFlavor;
  23. export function resolveDesktopProductIdentity(
  24. env?: Record<string, string | undefined>,
  25. ): DesktopProductIdentity;
  26. export function resolveDesktopArtifactSuffix(env?: Record<string, string | undefined>): string;
  27. export function resolveWindowsAppUserModelIdForFlavor(
  28. flavor: DesktopProductFlavor,
  29. runtime?: { isPackaged: boolean },
  30. ): string;
  31. export function resolveWindowsAppUserModelId(
  32. env?: Record<string, string | undefined>,
  33. runtime?: { isPackaged: boolean },
  34. ): string;
  35. export const desktopProductIdentities: Readonly<{
  36. production: DesktopProductIdentity;
  37. preview: DesktopProductIdentity;
  38. }>;