@sentry/wizard 6.11.0 → 6.13.0
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.
- package/CHANGELOG.md +64 -0
- package/dist/bin.js +16 -1
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/angular-17.test.js +3 -4
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +3 -4
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/cloudflare-worker.test.js +5 -0
- package/dist/e2e-tests/tests/cloudflare-worker.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +60 -0
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +8 -3
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +8 -4
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +96 -0
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -0
- package/dist/e2e-tests/tests/react-router.test.js +6 -7
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +8 -4
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -2
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/android/android-wizard.js +3 -0
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +1 -1
- package/dist/src/angular/codemods/main.js +0 -1
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -3
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -1
- package/dist/src/apple/check-installed-cli.js +13 -7
- package/dist/src/apple/check-installed-cli.js.map +1 -1
- package/dist/src/apple/code-tools.js +17 -3
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/configure-package-manager.js +18 -5
- package/dist/src/apple/configure-package-manager.js.map +1 -1
- package/dist/src/apple/configure-xcode-project.js +8 -1
- package/dist/src/apple/configure-xcode-project.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
- package/dist/src/apple/lookup-xcode-project.js +22 -17
- package/dist/src/apple/lookup-xcode-project.js.map +1 -1
- package/dist/src/apple/options.d.ts +5 -0
- package/dist/src/apple/options.js.map +1 -1
- package/dist/src/apple/sentry-swift-package.d.ts +4 -0
- package/dist/src/apple/sentry-swift-package.js +17 -0
- package/dist/src/apple/sentry-swift-package.js.map +1 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +59 -1
- package/dist/src/apple/xcode-manager.js +507 -106
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/cloudflare/cloudflare-wizard.js +5 -0
- package/dist/src/cloudflare/cloudflare-wizard.js.map +1 -1
- package/dist/src/cloudflare/sdk-setup.d.ts +1 -0
- package/dist/src/cloudflare/sdk-setup.js.map +1 -1
- package/dist/src/cloudflare/templates.d.ts +1 -0
- package/dist/src/cloudflare/templates.js +7 -1
- package/dist/src/cloudflare/templates.js.map +1 -1
- package/dist/src/cloudflare/wrap-worker.d.ts +1 -0
- package/dist/src/cloudflare/wrap-worker.js +7 -0
- package/dist/src/cloudflare/wrap-worker.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -0
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +12 -6
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +12 -6
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-native/expo.d.ts +6 -0
- package/dist/src/react-native/expo.js +27 -1
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/git.d.ts +5 -0
- package/dist/src/react-native/git.js +32 -1
- package/dist/src/react-native/git.js.map +1 -1
- package/dist/src/react-native/javascript.js +3 -1
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +12 -6
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +124 -26
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/react-router-config.js +1 -1
- package/dist/src/react-router/codemods/react-router-config.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.d.ts +1 -1
- package/dist/src/react-router/codemods/server-entry.js +40 -4
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/codemods/vite.js +46 -1
- package/dist/src/react-router/codemods/vite.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +62 -21
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +5 -3
- package/dist/src/react-router/sdk-setup.js +44 -16
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +2 -4
- package/dist/src/react-router/templates.js +89 -87
- package/dist/src/react-router/templates.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -2
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +4 -1
- package/dist/src/run.js +13 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +1 -1
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/vite.js +1 -1
- package/dist/src/sveltekit/sdk-setup/vite.js.map +1 -1
- package/dist/src/sveltekit/templates.js +12 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/ast-utils.d.ts +10 -0
- package/dist/src/utils/ast-utils.js +19 -1
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -1
- package/dist/src/utils/clack/index.js +17 -6
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/files.d.ts +2 -0
- package/dist/src/utils/files.js +58 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/git.d.ts +3 -1
- package/dist/src/utils/git.js +2 -1
- package/dist/src/utils/git.js.map +1 -1
- package/dist/src/utils/line-endings.d.ts +1 -0
- package/dist/src/utils/line-endings.js +76 -0
- package/dist/src/utils/line-endings.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +0 -5
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +78 -0
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/configure-package-manager.test.d.ts +1 -0
- package/dist/test/apple/configure-package-manager.test.js +161 -0
- package/dist/test/apple/configure-package-manager.test.js.map +1 -0
- package/dist/test/apple/lookup-xcode-project.test.d.ts +1 -0
- package/dist/test/apple/lookup-xcode-project.test.js +167 -0
- package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
- package/dist/test/apple/xcode-manager.test.js +452 -43
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/cloudflare/sdk-setup.test.js +20 -2
- package/dist/test/cloudflare/sdk-setup.test.js.map +1 -1
- package/dist/test/cloudflare/templates.test.js +54 -0
- package/dist/test/cloudflare/templates.test.js.map +1 -1
- package/dist/test/cloudflare/wrap-worker.test.js +74 -11
- package/dist/test/cloudflare/wrap-worker.test.js.map +1 -1
- package/dist/test/constants.test.d.ts +1 -0
- package/dist/test/constants.test.js +12 -0
- package/dist/test/constants.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +66 -33
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +66 -36
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/expo.test.js +140 -0
- package/dist/test/react-native/expo.test.js.map +1 -1
- package/dist/test/react-native/git.test.d.ts +1 -0
- package/dist/test/react-native/git.test.js +160 -0
- package/dist/test/react-native/git.test.js.map +1 -0
- package/dist/test/react-router/codemods/client-entry.test.js +38 -5
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +83 -0
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/vite.test.js +89 -0
- package/dist/test/react-router/codemods/vite.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +98 -6
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +50 -38
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/remix/build-script.test.d.ts +1 -0
- package/dist/test/remix/build-script.test.js +124 -0
- package/dist/test/remix/build-script.test.js.map +1 -0
- package/dist/test/remix/client-entry.test.js +4 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/run.test.d.ts +1 -0
- package/dist/test/run.test.js +137 -0
- package/dist/test/run.test.js.map +1 -0
- package/dist/test/sourcemaps/tools/vite.test.js +12 -8
- package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +78 -27
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/ast-utils.test.js +22 -0
- package/dist/test/utils/ast-utils.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +101 -0
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/git.test.js +10 -0
- package/dist/test/utils/git.test.js.map +1 -1
- package/dist/test/utils/line-endings.test.d.ts +1 -0
- package/dist/test/utils/line-endings.test.js +103 -0
- package/dist/test/utils/line-endings.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/react-router/codemods/root.d.ts +0 -1
- package/dist/src/react-router/codemods/root.js +0 -171
- package/dist/src/react-router/codemods/root.js.map +0 -1
- package/dist/test/react-router/codemods/root.test.js +0 -178
- package/dist/test/react-router/codemods/root.test.js.map +0 -1
- /package/dist/{test/react-router/codemods/root.test.d.ts → e2e-tests/tests/react-router-instrumentation-api.test.d.ts} +0 -0
|
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AE,CAAC;QACL,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,MAAM,YAAY,GAChB,IAAI,CAAC,OAAO,CAAC,8CAA8C,EAAE,CAC3D,SAAS,CAAC,KAAK,CAChB,CAAC;YACJ,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;gBACpC,SAAS;aACV;YACD,aAAa,CAAC,IAAI,CAAC;gBACjB,EAAE,EAAE,SAAS,CAAC,KAAK;gBACnB,GAAG,EAAE,YAAY;gBACjB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;SACJ;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAqB;IAE7C;;;;OAIG;IACK,6BAA6B;QACnC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,MAAM,aAAa,GAAG,wCAAkB,CAAC,sBAAsB,CAC7D,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,IAAI,CAAC,aAAa,EAAE;YAClB,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,gBAAgB;YACnB,aAAa,CAAC,kBAAkB,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AA/rCD,oCA+rCC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { debug } from '../utils/debug';\nimport type { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\n\nimport {\n project as createXcodeProject,\n PBXFileReference,\n PBXFileSystemSynchronizedBuildFileExceptionSet,\n PBXSourcesBuildPhase,\n type PBXBuildFile,\n type PBXFileSystemSynchronizedRootGroup,\n type PBXGroup,\n type PBXNativeTarget,\n type PBXObjects,\n type PBXShellScriptBuildPhase,\n type Project,\n type XCConfigurationList,\n} from 'xcode';\nimport { MacOSSystemHelpers } from './macos-system-helper';\nimport { XcodeProjectObjectWithId } from './xcode-project-object-with-id';\n\ninterface ProjectFile {\n key?: string;\n name: string;\n path: string;\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: Project,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as\n | PBXNativeTarget\n | undefined;\n\n if (!xcObjects.XCBuildConfiguration) {\n xcObjects.XCBuildConfiguration = {};\n }\n if (!xcObjects.XCConfigurationList) {\n xcObjects.XCConfigurationList = {};\n }\n const buildConfigurationListId = target?.buildConfigurationList ?? '';\n const configurationList = xcObjects.XCConfigurationList?.[\n buildConfigurationListId\n ] as XCConfigurationList | undefined;\n const buildListConfigurationIds =\n configurationList?.buildConfigurations ?? [];\n for (const buildListConfigId of buildListConfigurationIds) {\n const config =\n xcObjects.XCBuildConfiguration[buildListConfigId.value] ?? {};\n if (typeof config === 'string') {\n // Ignore comments\n continue;\n }\n\n const buildSettings = config.buildSettings ?? {};\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n\n config.buildSettings = buildSettings;\n xcObjects.XCBuildConfiguration[buildListConfigId.value] = config;\n }\n}\n\nfunction addSentrySPM(proj: Project, targetName: string): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid();\n const sentrySPMUUID = proj.generateUuid();\n\n // Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n const frameworkBuildPhase = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof frameworkBuildPhase === 'string') {\n // Ignore comments\n continue;\n }\n for (const framework of frameworkBuildPhase.files ?? []) {\n // We identify the Sentry framework by the comment \"Sentry in Frameworks\",\n // which is set by this manager in previous runs.\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n\n if (!xcObjects.PBXBuildFile) {\n xcObjects.PBXBuildFile = {};\n }\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[`${sentryFrameworkUUID}_comment`] =\n 'Sentry in Frameworks';\n\n if (!xcObjects.PBXFrameworksBuildPhase) {\n xcObjects.PBXFrameworksBuildPhase = {};\n }\n for (const key in xcObjects.PBXFrameworksBuildPhase) {\n const value = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof value === 'string') {\n // Ignore comments\n continue;\n }\n\n const frameworks = value.files ?? [];\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n value.files = frameworks;\n\n xcObjects.PBXFrameworksBuildPhase[key] = value;\n }\n\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid();\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n if (!xcObjects.XCRemoteSwiftPackageReference) {\n xcObjects.XCRemoteSwiftPackageReference = {};\n }\n\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[`${sentrySwiftPackageUUID}_comment`] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n if (!xcObjects.XCSwiftPackageProductDependency) {\n xcObjects.XCSwiftPackageProductDependency = {};\n }\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[`${sentrySPMUUID}_comment`] =\n 'Sentry';\n\n clack.log.step('Added Sentry SPM dependency to your project');\n}\n\nexport class XcodeProject {\n /**\n * The directory where the Xcode project is located.\n */\n baseDir: string;\n\n /**\n * The path to the `<PROJECT>.xcodeproj` directory.\n */\n xcodeprojPath: string;\n\n /**\n * The path to the `project.pbxproj` file.\n */\n pbxprojPath: string;\n\n /**\n * The Xcode project object.\n */\n project: Project;\n\n objects: PBXObjects;\n\n /**\n * Creates a new XcodeProject instance, a wrapper around the Xcode project file `<PROJECT>.xcodeproj/project.pbxproj`.\n *\n * @param projectPath - The path to the Xcode project file\n */\n public constructor(projectPath: string) {\n this.pbxprojPath = projectPath;\n this.xcodeprojPath = path.dirname(projectPath);\n this.baseDir = path.dirname(this.xcodeprojPath);\n\n this.project = createXcodeProject(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value.productType.startsWith('\"com.apple.product-type.application')\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n addSPMReference: boolean,\n uploadSource = true,\n ): void {\n this.addUploadSymbolsScript({\n sentryProject,\n targetName: target,\n uploadSource,\n });\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (addSPMReference) {\n addSentrySPM(this.project, target);\n }\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.pbxprojPath, newContent);\n }\n\n addUploadSymbolsScript({\n sentryProject,\n targetName,\n uploadSource,\n }: {\n sentryProject: SentryProjectData;\n targetName: string;\n uploadSource: boolean;\n }): void {\n const xcObjects = this.project.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n })[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n if (!target) {\n debug(`Target not found: ${targetName}`);\n return;\n }\n\n // Generate the new script content\n const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');\n const shellScript = templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n isHomebrewInstalled,\n );\n\n if (!xcObjects.PBXShellScriptBuildPhase) {\n xcObjects.PBXShellScriptBuildPhase = {};\n }\n\n // Look for existing Sentry build phase in the current target\n let existingSentryBuildPhaseId: string | undefined;\n let existingSentryBuildPhase: PBXShellScriptBuildPhase | undefined;\n\n // Check target's build phases for existing Sentry script by searching for a build phase that contains \"sentry-cli\" in the shell script\n if (target.buildPhases) {\n for (const phase of target.buildPhases) {\n const buildPhase = xcObjects.PBXShellScriptBuildPhase[phase.value];\n if (\n typeof buildPhase === 'object' &&\n buildPhase.shellScript?.includes('sentry-cli')\n ) {\n existingSentryBuildPhaseId = phase.value;\n existingSentryBuildPhase = buildPhase;\n break;\n }\n }\n }\n\n // Clean up orphaned build phase references that may exist from previous runs\n // Find all build phase IDs that are referenced in targets but don't exist in PBXShellScriptBuildPhase\n const orphanedBuildPhaseIds: string[] = [];\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n for (const phase of targetValue.buildPhases) {\n // Check if this is a shell script build phase that doesn't exist\n if (\n !xcObjects.PBXShellScriptBuildPhase?.[phase.value] &&\n phase.comment?.includes('Upload Debug Symbols to Sentry')\n ) {\n orphanedBuildPhaseIds.push(phase.value);\n }\n }\n }\n }\n\n // Remove orphaned build phase references from all targets\n if (orphanedBuildPhaseIds.length > 0) {\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n targetValue.buildPhases = targetValue.buildPhases.filter((phase) => {\n return !orphanedBuildPhaseIds.includes(phase.value);\n });\n }\n }\n }\n\n if (existingSentryBuildPhaseId && existingSentryBuildPhase) {\n // Update existing build phase instead of adding a new one\n // This call is idempotent, so it will not add a new build phase if it already exists\n this.updateScriptBuildPhase(existingSentryBuildPhaseId, shellScript, [\n templates.scriptInputPath,\n ]);\n clack.log.step(\n `Updated existing Sentry upload script for \"${targetName}\" build phase`,\n );\n } else {\n // Add new build phase to the target\n this.addScriptBuildPhase(\n targetKey,\n 'Upload Debug Symbols to Sentry',\n shellScript,\n [templates.scriptInputPath],\n );\n clack.log.step(\n `Added Sentry upload script to \"${targetName}\" build phase`,\n );\n }\n }\n\n /**\n * Retrieves all source files associated with a specific target in the Xcode project.\n * This is used to find files where we can inject Sentry initialization code.\n *\n * @param targetName - The name of the target to get files for\n * @returns An array of absolute file paths for the target's source files, or undefined if target not found\n */\n public getSourceFilesForTarget(targetName: string): string[] | undefined {\n // ## Summary how Xcode Projects are structured:\n // - Every Xcode Project has exactly one main group of type `PBXGroup`\n // - The main group contains a list of children identifiers\n // - Each child can be a `PBXGroup`, a `PBXFileReference` or a `PBXFileSystemSynchronizedRootGroup`\n // - Each `PBXGroup` has a list of children identifiers which again can be `PBXGroup`, `PBXFileReference` or `PBXFileSystemSynchronizedRootGroup`\n // - The target defines the list of `fileSystemSynchronizedGroups` which are `PBXFileSystemSynchronizedRootGroup` to be included in the build phase\n // - The `PBXFileSystemSynchronizedRootGroup` has a list of `exceptions` which are `PBXFileSystemSynchronizedBuildFileExceptionSet`\n // - Each `PBXFileSystemSynchronizedBuildFileExceptionSet` represents a folder to be excluded from the build.\n // - The `PBXFileSystemSynchronizedBuildFileExceptionSet` has a list of `membershipExceptions` which are files to be excluded from being excluded, therefore included in the build.\n // - The Xcode project has a build phase `PBXSourcesBuildPhase` which has a list of `files` which are `PBXBuildFile`\n // - A file which is not part of a `PBXFileSystemSynchronizedRootGroup` must be added to the `files` list of the `PBXSourcesBuildPhase` build phase\n // - Nested subfolders in `fileSystemSynchronizedGroups` are not declared but recursively included\n //\n // Based on the findings above the files included in the build phase are:\n // - All files in the `files` of the `PBXSourcesBuildPhase` build phase `Sources` of the target\n // - All files in directories of the `fileSystemSynchronizedGroups` of the target\n // - Excluding all files in the `exceptions` of the `PBXFileSystemSynchronizedRootGroup` of the target\n // - Including all files in the `membershipExceptions` of the `PBXFileSystemSynchronizedBuildFileExceptionSet` of the target\n const nativeTarget = this.findNativeTargetByName(targetName);\n if (!nativeTarget) {\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n const filesInBuildPhase = this.findFilesInSourceBuildPhase(nativeTarget);\n debug(\n `Found ${filesInBuildPhase.length} files in build phase for target: ${targetName}`,\n );\n\n const filesInSynchronizedRootGroups =\n this.findFilesInSynchronizedRootGroups(nativeTarget);\n debug(\n `Found ${filesInSynchronizedRootGroups.length} files in synchronized root groups for target: ${targetName}`,\n );\n return [...filesInBuildPhase, ...filesInSynchronizedRootGroups];\n }\n\n // ================================ TARGET HELPERS ================================\n\n /**\n * Finds a native target by name.\n *\n * @param targetName - The name of the target to find\n * @returns The native target, or undefined if the target is not found\n */\n private findNativeTargetByName(\n targetName: string,\n ): XcodeProjectObjectWithId<PBXNativeTarget> | undefined {\n debug('Finding native target by name: ' + targetName);\n\n if (!this.objects.PBXNativeTarget) {\n debug('No native targets found');\n return undefined;\n }\n\n const nativeTargets = Object.entries(this.objects.PBXNativeTarget);\n for (const [key, target] of nativeTargets) {\n // Ignore comments\n if (key.endsWith('_comment') || typeof target === 'string') {\n continue;\n }\n\n // Ignore targets that are not the target we are looking for\n if (target.name !== targetName) {\n continue;\n }\n debug('Found native target: ' + targetName);\n return {\n id: key,\n obj: target,\n };\n }\n\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n // ================================ BUILD PHASE HELPERS ================================\n\n /**\n * Finds the source build phase in a target.\n *\n * @param target - The target to find the source build phase in\n * @returns The source build phase, or undefined if the target is not found or has no source build phase\n */\n findSourceBuildPhaseInTarget(\n target: PBXNativeTarget,\n ): XcodeProjectObjectWithId<PBXSourcesBuildPhase> | undefined {\n debug(`Finding source build phase in target: ${target.name}`);\n if (!target.buildPhases) {\n debug('No build phases found for target: ' + target.name);\n return undefined;\n }\n for (const phase of target.buildPhases) {\n const buildPhaseId = phase.value;\n const buildPhase = this.objects.PBXSourcesBuildPhase?.[buildPhaseId];\n if (typeof buildPhase !== 'object') {\n // Ignore comments\n continue;\n }\n debug(\n `Found source build phase: ${buildPhaseId} for target: ${target.name}`,\n );\n return {\n id: buildPhaseId,\n obj: buildPhase,\n };\n }\n\n debug(`No source build phase found for target: ${target.name}`);\n return undefined;\n }\n\n /**\n * Adds a new script build phase to the specified target.\n *\n * @param targetKey - The key of the target to add the build phase to\n * @param name - The name of the build phase\n * @param script - The shell script content\n * @param inputPaths - Array of input paths for the script\n * @returns The UUID of the created build phase\n */\n addScriptBuildPhase(\n targetKey: string,\n name: string,\n script: string,\n inputPaths: string[] = [],\n ): string {\n const buildPhaseUuid = this.project.generateUuid();\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n\n // Create the shell script build phase object\n const buildPhase = {\n isa: 'PBXShellScriptBuildPhase' as const,\n buildActionMask: 2147483647,\n files: [],\n inputPaths,\n outputPaths: [],\n runOnlyForDeploymentPostprocessing: 0,\n shellPath: '/bin/sh',\n shellScript: `\"${escapedScript}\"`,\n name: `\"${name}\"`,\n };\n\n // Add to PBXShellScriptBuildPhase section\n if (!this.objects.PBXShellScriptBuildPhase) {\n this.objects.PBXShellScriptBuildPhase = {};\n }\n this.objects.PBXShellScriptBuildPhase[buildPhaseUuid] = buildPhase;\n this.objects.PBXShellScriptBuildPhase[`${buildPhaseUuid}_comment`] = name;\n\n // Add to target's build phases\n const target = this.objects.PBXNativeTarget?.[targetKey] as PBXNativeTarget;\n if (target?.buildPhases) {\n target.buildPhases.push({\n value: buildPhaseUuid,\n comment: name,\n });\n }\n\n return buildPhaseUuid;\n }\n\n /**\n * Updates an existing script build phase.\n *\n * @param buildPhaseId - The UUID of the build phase to update\n * @param script - The new shell script content\n * @param inputPaths - Array of input paths for the script\n */\n updateScriptBuildPhase(\n buildPhaseId: string,\n script: string,\n inputPaths: string[] = [],\n ): void {\n const buildPhase = this.objects.PBXShellScriptBuildPhase?.[buildPhaseId];\n if (!buildPhase || typeof buildPhase === 'string') {\n debug(`Build phase not found: ${buildPhaseId}`);\n return;\n }\n\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n buildPhase.shellScript = `\"${escapedScript}\"`;\n buildPhase.inputPaths = inputPaths;\n buildPhase.shellPath = '/bin/sh';\n }\n\n // ================================ FILE HELPERS ================================\n\n /**\n * Finds all files in the source build phase of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the source build phase of the target, or an empty array if the target is not found or has no source build phase\n */\n findFilesInSourceBuildPhase(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n 'Finding files in source build phase for target: ' +\n nativeTarget.obj.name,\n );\n const buildPhase = this.findSourceBuildPhaseInTarget(nativeTarget.obj);\n if (!buildPhase) {\n debug(\n `Sources build phase not found for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n const buildPhaseFiles = buildPhase.obj.files;\n if (!buildPhaseFiles) {\n debug(\n `No files found in sources build phase for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n if (!this.objects.PBXBuildFile) {\n debug('PBXBuildFile is undefined');\n return [];\n }\n if (!this.objects.PBXFileReference) {\n debug('PBXFileReference is undefined');\n return [];\n }\n\n const result: string[] = [];\n for (const file of buildPhaseFiles) {\n debug(`Resolving build phase file: ${file.value}`);\n // Find the related build file object\n const buildFileObj = this.objects.PBXBuildFile[\n file.value\n ] as PBXBuildFile;\n if (!buildFileObj || typeof buildFileObj !== 'object') {\n debug(`Build file object not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file object found for file: ${file.value}`);\n\n const buildFileRefId = buildFileObj.fileRef;\n if (!buildFileRefId) {\n debug(`File reference not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file reference found for file: ${file.value}`);\n\n // Find the related file reference object\n const buildFile = this.objects.PBXFileReference[buildFileRefId];\n if (!buildFile || typeof buildFile !== 'object') {\n debug(`File not found in file dictionary for file: ${file.value}`);\n continue;\n }\n debug(`Build file found in file dictionary for file: ${file.value}`);\n\n // Resolve the path of the file based on the `sourceTree` property\n const resolvedFilePath = this.resolveAbsolutePathOfFileReference({\n id: buildFileRefId,\n obj: buildFile,\n });\n if (!resolvedFilePath) {\n debug(`Failed to resolve file path for file: ${file.value}`);\n continue;\n }\n debug(`Resolved file ${file.value} to path: ${resolvedFilePath}`);\n\n result.push(resolvedFilePath);\n }\n\n debug(\n `Resolved ${result.length} files for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n /**\n * Resolves the absolute path of a file reference.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsolutePathOfFileReference(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving path of file reference: ${fileRef.id} with path: ${fileRef.obj.path}`,\n );\n // File path is expected to be set, therefore typing is non-nullable.\n // As the file is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!fileRef.obj.path) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // File references are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<absolute>': The file path is absolute\n // - '<group>': The file path is relative to the parent group of the file reference\n // - 'BUILT_PRODUCTS_DIR': The file path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SOURCE_ROOT': The file path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'SDKROOT': The file path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The file path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const fileRefSourceTree = fileRef.obj.sourceTree?.replace(/\"/g, '') ?? '';\n switch (fileRefSourceTree) {\n case '<absolute>':\n return fileRef.obj.path.replace(/\"/g, '');\n case '<group>':\n return this.resolveAbsoluteFilePathRelativeToGroup(fileRef);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolveAbsoluteFilePathRelativeToBuiltProductsDir(fileRef);\n case 'SOURCE_ROOT':\n return this.resolveAbsoluteFilePathRelativeToSourceRoot(fileRef);\n case 'SDKROOT':\n return this.resolveAbsoluteFilePathRelativeToSdkRoot(fileRef);\n case 'DEVELOPER_DIR':\n return this.resolveAbsoluteFilePathRelativeToDeveloperDir(fileRef);\n default:\n debug(\n `Unknown source tree '${fileRef.obj.sourceTree}' for build file: ${fileRef.obj.path}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the parent group.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToGroup(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to group for file reference: ${\n fileRef.id\n } with path: ${fileRef.obj.path ?? ''}`,\n );\n const fileRefPath = fileRef.obj.path?.replace(/\"/g, '');\n if (!fileRefPath) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // Find the parent group of the file reference by searching for the reverse relationship\n const parentGroup = this.findParentGroupByChildId(fileRef.id);\n if (!parentGroup) {\n debug(\n `Parent group not found for file reference: ${fileRef.id} at path: ${fileRefPath}`,\n );\n return undefined;\n }\n\n // Resolve the path of the parent group\n const absoluteGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of group: ${parentGroup.id}`);\n return undefined;\n }\n\n return path.join(absoluteGroupPath, fileRefPath);\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the built products directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToBuiltProductsDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to built products directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSourceRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n return path.join(this.baseDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the SDK root.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSdkRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to SDK root for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the developer directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToDeveloperDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to developer directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} with path: ${group.obj.path ?? ''}`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfGroupRelativeToSourceRoot(group);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfGroupRelativeToBuiltProductsDir(group);\n case 'SDKROOT':\n return this.resolvePathOfGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfGroupRelativeToDeveloperDir(group);\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} with path: ${\n group.obj.path ?? ''\n }`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfSynchronizedRootGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group,\n );\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group,\n );\n case 'SDKROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group,\n );\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Finds all files in the synchronized root groups of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the synchronized root groups of the target, or an empty array if the target is not found or has no synchronized root groups\n */\n findFilesInSynchronizedRootGroups(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n `Finding files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n const synchronizedRootGroups =\n nativeTarget.obj.fileSystemSynchronizedGroups ?? [];\n\n const result: string[] = [];\n for (const group of synchronizedRootGroups) {\n const groupObj =\n this.objects.PBXFileSystemSynchronizedRootGroup?.[group.value];\n if (!groupObj || typeof groupObj !== 'object') {\n debug(`Synchronized root group not found: ${group.value}`);\n continue;\n }\n debug(`Found synchronized root group: ${group.value}`);\n\n const files = this.getFilesInSynchronizedRootGroup({\n id: group.value,\n obj: groupObj,\n });\n debug(\n `Found ${files.length} files in synchronized root group: ${group.value}`,\n );\n result.push(...files.map((file) => file.path));\n }\n debug(\n `Found ${result.length} files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n private getFilesInSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): ProjectFile[] {\n // Group path is expected to be set, therefore typing is non-nullable.\n // As the group is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!group.obj.path) {\n debug(`Group path not found for group: ${group.id}`);\n return [];\n }\n\n // Resolve the path of the synchronized root group\n const absoluteGroupPath =\n this.resolveAbsolutePathOfSynchronizedRootGroup(group);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of synchronized root group: ${group.id}`);\n return [];\n }\n\n // Build a list of all exception paths for the group\n const exceptionSets = this.getExceptionSetsForGroup(group);\n\n // Resolve a list of all files in the group\n const files = this.getAbsoluteFilePathsInDirectoryTree(absoluteGroupPath);\n\n // Filter out files that are excluded by the exception sets\n const filteredFiles = this.filterFilesByExceptionSets(files, exceptionSets);\n\n return filteredFiles;\n }\n\n /**\n * Returns all files in a directory tree.\n *\n * @param dirPath - The path of the directory to get the files in\n * @returns All files in the directory tree, or an empty array if the directory does not exist\n */\n private getAbsoluteFilePathsInDirectoryTree(dirPath: string): ProjectFile[] {\n // If the directory does not exist, return an empty array\n // This can happen if the group is not found in the project\n if (!fs.existsSync(dirPath)) {\n return [];\n }\n const result: ProjectFile[] = [];\n const files = fs.readdirSync(dirPath);\n for (const file of files) {\n // Ignore hidden files and directories\n if (file.startsWith('.')) {\n continue;\n }\n\n const filePath = path.join(dirPath, file);\n // If the file is a directory, recursively get the files in the directory\n if (fs.statSync(filePath).isDirectory()) {\n result.push(...this.getAbsoluteFilePathsInDirectoryTree(filePath));\n continue;\n }\n // If the file is a file, add it to the result\n if (fs.statSync(filePath).isFile()) {\n result.push({\n name: file,\n path: filePath,\n });\n continue;\n }\n }\n\n return result;\n }\n\n private filterFilesByExceptionSets(\n files: ProjectFile[],\n exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[],\n ): ProjectFile[] {\n // Iterate over all files and filter out files that are excluded by any exception sets\n return files.filter((file) => {\n return !exceptionSets.some((exceptionSet) => {\n const membershipExceptions =\n exceptionSet.obj.membershipExceptions ?? [];\n return membershipExceptions.some((path) => {\n const unescapedPath = path.replace(/\"/g, '');\n return file.path.includes(unescapedPath);\n });\n });\n });\n }\n\n // ================================ GROUP HELPERS ================================\n\n /**\n * Returns all groups that are PBXGroup.\n *\n * This is a helper method to avoid having to map and filter the groups manually.\n *\n * @returns All groups that are PBXGroup, excluding comments and non-object values.\n */\n private get groups(): XcodeProjectObjectWithId<PBXGroup>[] {\n // Map and filter the groups to only include the groups that are PBXGroup\n return Object.entries(this.objects.PBXGroup ?? {}).reduce(\n (acc, [key, group]) => {\n if (typeof group !== 'object') {\n return acc;\n }\n return acc.concat([\n {\n id: key,\n obj: group,\n },\n ]);\n },\n new Array<XcodeProjectObjectWithId<PBXGroup>>(),\n );\n }\n\n /**\n * Finds the parent group of a child group or file reference.\n *\n * @param childId - The ID of the child group or file reference\n * @returns The parent group of the child group or file reference, or undefined if the child group or file reference is not found or has no parent group\n */\n private findParentGroupByChildId(\n childId: string,\n ): XcodeProjectObjectWithId<PBXGroup> | undefined {\n return this.groups.find((group) => {\n return (group.obj.children ?? []).some((child) => {\n return child.value === childId;\n });\n });\n }\n\n /**\n * Checks if a group is the main group of any project.\n *\n * @param groupId - The ID of the group to check\n * @returns True if the group is the main group, false otherwise\n */\n private isMainGroup(groupId: string): boolean {\n return Object.values(this.objects.PBXProject ?? {}).some((project) => {\n if (typeof project !== 'object') {\n return false;\n }\n return project.mainGroup === groupId;\n });\n }\n\n private getExceptionSetsForGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] {\n const exceptions = group.obj.exceptions ?? [];\n const exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] =\n [];\n for (const exception of exceptions) {\n const exceptionSet =\n this.objects.PBXFileSystemSynchronizedBuildFileExceptionSet?.[\n exception.value\n ];\n if (typeof exceptionSet !== 'object') {\n continue;\n }\n exceptionSets.push({\n id: exception.value,\n obj: exceptionSet,\n comment: exception.comment,\n });\n }\n return exceptionSets;\n }\n\n /**\n * The path to the build products directory for the project.\n *\n * This is cached to avoid having to read the build settings from Xcode for each call to `getBuildProductsDirectoryPath`.\n */\n private buildProductsDir: string | undefined;\n\n /**\n * Returns the path to the build products directory for the project.\n *\n * @returns The path to the build products directory for the project, or undefined if the path is not found\n */\n private getBuildProductsDirectoryPath(): string | undefined {\n if (this.buildProductsDir) {\n return this.buildProductsDir;\n }\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n this.xcodeprojPath,\n );\n if (!buildSettings) {\n debug(`Failed to read Xcode build settings`);\n return undefined;\n }\n this.buildProductsDir =\n buildSettings['TARGET_BUILD_DIR'] ?? buildSettings['BUILD_DIR'];\n\n return this.buildProductsDir;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],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CAAC,SAAS,KAAK,OAAO,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,wBAAwB,CAC9B,KAAmE;QAEnE,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC;QAC9C,MAAM,aAAa,GACjB,EAAE,CAAC;QACL,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,MAAM,YAAY,GAChB,IAAI,CAAC,OAAO,CAAC,8CAA8C,EAAE,CAC3D,SAAS,CAAC,KAAK,CAChB,CAAC;YACJ,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;gBACpC,SAAS;aACV;YACD,aAAa,CAAC,IAAI,CAAC;gBACjB,EAAE,EAAE,SAAS,CAAC,KAAK;gBACnB,GAAG,EAAE,YAAY;gBACjB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;SACJ;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAqB;IAE7C;;;;OAIG;IACK,6BAA6B;QACnC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,MAAM,aAAa,GAAG,wCAAkB,CAAC,sBAAsB,CAC7D,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,IAAI,CAAC,aAAa,EAAE;YAClB,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,gBAAgB;YACnB,aAAa,CAAC,kBAAkB,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAz2DD,oCAy2DC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { lt, valid } from 'semver';\nimport { debug } from '../utils/debug';\nimport type { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\n\nimport {\n project as createXcodeProject,\n PBXFileReference,\n PBXFileSystemSynchronizedBuildFileExceptionSet,\n PBXSourcesBuildPhase,\n type PBXBuildFile,\n type PBXFileSystemSynchronizedRootGroup,\n type PBXGroup,\n type PBXNativeTarget,\n type PBXObjects,\n type PBXShellScriptBuildPhase,\n type Project,\n type XCConfigurationList,\n} from 'xcode';\nimport { MacOSSystemHelpers } from './macos-system-helper';\nimport { XcodeProjectObjectWithId } from './xcode-project-object-with-id';\n\ninterface ProjectFile {\n key?: string;\n name: string;\n path: string;\n}\n\nexport type SwiftPackageSpec = {\n repositoryURL: string;\n requirement: {\n kind: 'upToNextMajorVersion';\n minimumVersion: string;\n };\n commentName: string;\n};\n\nexport type SwiftPackageProductSpec = {\n package: SwiftPackageSpec;\n productName: string;\n};\n\nconst XCODE_APPLICATION_PRODUCT_TYPE = 'com.apple.product-type.application';\nconst XCODE_UNIT_TEST_PRODUCT_TYPE = 'com.apple.product-type.bundle.unit-test';\n\nfunction unquote(value: unknown): string {\n return typeof value === 'string' ? value.replace(/\"/g, '') : '';\n}\n\nfunction stripAppExtension(value: string | undefined): string | undefined {\n return value?.endsWith('.app') ? value.slice(0, -'.app'.length) : value;\n}\n\nfunction resolveBuildSettingValue(\n value: unknown,\n targetName: string,\n): string | undefined {\n const resolvedValue = unquote(value)\n .replace(/\\$\\(TARGET_NAME\\)/g, targetName)\n .replace(/\\$\\{TARGET_NAME\\}/g, targetName)\n .trim();\n\n return resolvedValue && !resolvedValue.includes('$')\n ? resolvedValue\n : undefined;\n}\n\nfunction uniqueStrings(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter(Boolean))] as string[];\n}\n\nfunction testHostReferencesApplication(\n testHost: unknown,\n appHostCandidates: ApplicationHostCandidates,\n): boolean {\n const resolvedTestHost = unquote(testHost);\n if (!resolvedTestHost) {\n return false;\n }\n\n const referencesAppBundle = appHostCandidates.bundleNames.some((bundleName) =>\n containsPathSegment(resolvedTestHost, `${bundleName}.app`),\n );\n if (!referencesAppBundle) {\n return false;\n }\n\n return appHostCandidates.executableNames.some((executableName) =>\n containsPathSegment(resolvedTestHost, executableName),\n );\n}\n\nfunction containsPathSegment(value: string, segment: string): boolean {\n return new RegExp(`(^|/)${escapeRegExp(segment)}(/|$)`).test(value);\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nfunction normalizeSwiftPackageRepositoryURL(value: unknown): string {\n return unquote(value).replace(/\\/+$/, '');\n}\n\nfunction shouldUpdatePackageRequirement(\n existingRequirement: unknown,\n requestedRequirement: SwiftPackageSpec['requirement'],\n): boolean {\n if (!existingRequirement || typeof existingRequirement !== 'object') {\n return true;\n }\n\n const requirement = existingRequirement as Record<string, unknown>;\n if (requirement.kind !== requestedRequirement.kind) {\n return true;\n }\n\n const existingMinimumVersion = requirement.minimumVersion;\n if (typeof existingMinimumVersion !== 'string') {\n return true;\n }\n\n const existingVersion = valid(existingMinimumVersion);\n const requestedVersion = valid(requestedRequirement.minimumVersion);\n if (!existingVersion || !requestedVersion) {\n return existingMinimumVersion !== requestedRequirement.minimumVersion;\n }\n\n return lt(existingVersion, requestedVersion);\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: Project,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as\n | PBXNativeTarget\n | undefined;\n\n if (!xcObjects.XCBuildConfiguration) {\n xcObjects.XCBuildConfiguration = {};\n }\n if (!xcObjects.XCConfigurationList) {\n xcObjects.XCConfigurationList = {};\n }\n const buildConfigurationListId = target?.buildConfigurationList ?? '';\n const configurationList = xcObjects.XCConfigurationList?.[\n buildConfigurationListId\n ] as XCConfigurationList | undefined;\n const buildListConfigurationIds =\n configurationList?.buildConfigurations ?? [];\n for (const buildListConfigId of buildListConfigurationIds) {\n const config =\n xcObjects.XCBuildConfiguration[buildListConfigId.value] ?? {};\n if (typeof config === 'string') {\n // Ignore comments\n continue;\n }\n\n const buildSettings = config.buildSettings ?? {};\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n\n config.buildSettings = buildSettings;\n xcObjects.XCBuildConfiguration[buildListConfigId.value] = config;\n }\n}\n\nexport type SwiftPackageProductLinkOptions = {\n product: SwiftPackageProductSpec;\n existingFrameworkComment?: string;\n successMessage?: string;\n};\n\ntype ApplicationHostCandidates = {\n bundleNames: string[];\n executableNames: string[];\n};\n\nexport class XcodeProject {\n /**\n * The directory where the Xcode project is located.\n */\n baseDir: string;\n\n /**\n * The path to the `<PROJECT>.xcodeproj` directory.\n */\n xcodeprojPath: string;\n\n /**\n * The path to the `project.pbxproj` file.\n */\n pbxprojPath: string;\n\n /**\n * The Xcode project object.\n */\n project: Project;\n\n objects: PBXObjects;\n\n /**\n * Creates a new XcodeProject instance, a wrapper around the Xcode project file `<PROJECT>.xcodeproj/project.pbxproj`.\n *\n * @param projectPath - The path to the Xcode project file\n */\n public constructor(projectPath: string) {\n this.pbxprojPath = projectPath;\n this.xcodeprojPath = path.dirname(projectPath);\n this.baseDir = path.dirname(this.xcodeprojPath);\n\n this.project = createXcodeProject(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n unquote(value.productType).startsWith(XCODE_APPLICATION_PRODUCT_TYPE)\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public getUnitTestTargetNames(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return this.isUnitTestTargetEntry(key, value);\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public getHostedUnitTestTargetNames(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n this.isUnitTestTargetEntry(key, value) &&\n this.getTargetBuildSettings(value).some((buildSettings) =>\n Boolean(unquote(buildSettings.TEST_HOST).trim()),\n )\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public getHostedUnitTestTargetNamesForApplicationTarget(\n appTargetName: string,\n ): string[] {\n const appTarget = this.findNativeTargetByName(appTargetName);\n if (!appTarget) {\n return [];\n }\n\n const appHostCandidates = this.getApplicationHostCandidates(appTarget);\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n unquote(value.productType) === XCODE_UNIT_TEST_PRODUCT_TYPE &&\n this.getTargetBuildSettings(value).some((buildSettings) =>\n testHostReferencesApplication(\n buildSettings.TEST_HOST,\n appHostCandidates,\n ),\n )\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public getBundleIdentifierForTarget(targetName: string): string | undefined {\n const target = this.findNativeTargetByName(targetName);\n if (!target) {\n return undefined;\n }\n\n return this.getTargetBuildSettings(target.obj)\n .map((buildSettings) => {\n return unquote(buildSettings.PRODUCT_BUNDLE_IDENTIFIER);\n })\n .find(Boolean);\n }\n\n /**\n * Idempotently links a Swift package product to one target dependency list\n * and Frameworks build phase. Returns whether the pbxproj graph changed and\n * whether the product is linked after the operation.\n */\n public ensureSwiftPackageProductLinked(\n targetName: string,\n product: SwiftPackageProductSpec,\n ): { changed: boolean; linked: boolean } {\n const target = this.findNativeTargetByName(targetName);\n if (!target) {\n debug(`Target not found: ${targetName}`);\n return { changed: false, linked: false };\n }\n\n const frameworksBuildPhase = this.findFrameworksBuildPhaseInTarget(\n target.obj,\n );\n if (!frameworksBuildPhase) {\n debug(`Frameworks build phase not found for target: ${targetName}`);\n return { changed: false, linked: false };\n }\n\n let changed = false;\n\n // Ensure the remote Swift package object exists.\n const packageReference = this.ensureSwiftPackageReference(product.package);\n changed = packageReference.changed || changed;\n\n // Attach the Swift package object to the root Xcode project.\n changed =\n this.ensureProjectSwiftPackageReference(\n packageReference.packageRefId,\n product.package.commentName,\n ) || changed;\n\n // Ensure the package product dependency object exists.\n const productDependency = this.ensureSwiftPackageProductDependency(\n packageReference.packageRefId,\n product,\n );\n changed = productDependency.changed || changed;\n\n if (!target.obj.packageProductDependencies) {\n target.obj.packageProductDependencies = [];\n }\n\n // Attach the package product dependency to the selected target.\n if (\n !target.obj.packageProductDependencies.some((dependency) => {\n return dependency.value === productDependency.productDependencyId;\n })\n ) {\n target.obj.packageProductDependencies.push({\n value: productDependency.productDependencyId,\n comment: product.productName,\n });\n changed = true;\n }\n\n // Link the package product in the target Frameworks build phase.\n changed =\n this.ensureFrameworksBuildFile(\n frameworksBuildPhase,\n productDependency.productDependencyId,\n product,\n ) || changed;\n\n return { changed, linked: true };\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n swiftPackageProduct?: SwiftPackageProductLinkOptions,\n uploadSource = true,\n ): void {\n this.addUploadSymbolsScript({\n sentryProject,\n targetName: target,\n uploadSource,\n });\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (\n swiftPackageProduct &&\n !(\n swiftPackageProduct.existingFrameworkComment &&\n this.hasFrameworkBuildFileCommentInTarget(\n target,\n swiftPackageProduct.existingFrameworkComment,\n )\n )\n ) {\n const result = this.ensureSwiftPackageProductLinked(\n target,\n swiftPackageProduct.product,\n );\n if (result.changed && swiftPackageProduct.successMessage) {\n clack.log.step(swiftPackageProduct.successMessage);\n }\n }\n this.write();\n }\n\n addUploadSymbolsScript({\n sentryProject,\n targetName,\n uploadSource,\n }: {\n sentryProject: SentryProjectData;\n targetName: string;\n uploadSource: boolean;\n }): void {\n const xcObjects = this.project.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n })[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n if (!target) {\n debug(`Target not found: ${targetName}`);\n return;\n }\n\n // Generate the new script content\n const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');\n const shellScript = templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n isHomebrewInstalled,\n );\n\n if (!xcObjects.PBXShellScriptBuildPhase) {\n xcObjects.PBXShellScriptBuildPhase = {};\n }\n\n // Look for existing Sentry build phase in the current target\n let existingSentryBuildPhaseId: string | undefined;\n let existingSentryBuildPhase: PBXShellScriptBuildPhase | undefined;\n\n // Check target's build phases for existing Sentry script by searching for a build phase that contains \"sentry-cli\" in the shell script\n if (target.buildPhases) {\n for (const phase of target.buildPhases) {\n const buildPhase = xcObjects.PBXShellScriptBuildPhase[phase.value];\n if (\n typeof buildPhase === 'object' &&\n buildPhase.shellScript?.includes('sentry-cli')\n ) {\n existingSentryBuildPhaseId = phase.value;\n existingSentryBuildPhase = buildPhase;\n break;\n }\n }\n }\n\n // Clean up orphaned build phase references that may exist from previous runs\n // Find all build phase IDs that are referenced in targets but don't exist in PBXShellScriptBuildPhase\n const orphanedBuildPhaseIds: string[] = [];\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n for (const phase of targetValue.buildPhases) {\n // Check if this is a shell script build phase that doesn't exist\n if (\n !xcObjects.PBXShellScriptBuildPhase?.[phase.value] &&\n phase.comment?.includes('Upload Debug Symbols to Sentry')\n ) {\n orphanedBuildPhaseIds.push(phase.value);\n }\n }\n }\n }\n\n // Remove orphaned build phase references from all targets\n if (orphanedBuildPhaseIds.length > 0) {\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n targetValue.buildPhases = targetValue.buildPhases.filter((phase) => {\n return !orphanedBuildPhaseIds.includes(phase.value);\n });\n }\n }\n }\n\n if (existingSentryBuildPhaseId && existingSentryBuildPhase) {\n // Update existing build phase instead of adding a new one\n // This call is idempotent, so it will not add a new build phase if it already exists\n this.updateScriptBuildPhase(existingSentryBuildPhaseId, shellScript, [\n templates.scriptInputPath,\n ]);\n clack.log.step(\n `Updated existing Sentry upload script for \"${targetName}\" build phase`,\n );\n } else {\n // Add new build phase to the target\n this.addScriptBuildPhase(\n targetKey,\n 'Upload Debug Symbols to Sentry',\n shellScript,\n [templates.scriptInputPath],\n );\n clack.log.step(\n `Added Sentry upload script to \"${targetName}\" build phase`,\n );\n }\n }\n\n public write(): void {\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.pbxprojPath, newContent);\n }\n\n public getSynchronizedRootGroupPathsForTarget(targetName: string): string[] {\n const nativeTarget = this.findNativeTargetByName(targetName);\n if (!nativeTarget) {\n return [];\n }\n\n return (nativeTarget.obj.fileSystemSynchronizedGroups ?? []).reduce(\n (groupPaths, group) => {\n const groupObj =\n this.objects.PBXFileSystemSynchronizedRootGroup?.[group.value];\n if (!groupObj || typeof groupObj !== 'object') {\n return groupPaths;\n }\n\n const groupPath = this.resolveAbsolutePathOfSynchronizedRootGroup({\n id: group.value,\n obj: groupObj,\n });\n if (!groupPath) {\n return groupPaths;\n }\n\n return groupPaths.concat(groupPath);\n },\n new Array<string>(),\n );\n }\n\n /**\n * Ensures a Swift file is compiled by a target, either through an Xcode\n * synchronized root group or an explicit Sources build phase entry.\n */\n public addSwiftSourceFileToTarget(args: {\n targetName: string;\n filePath: string;\n }): { changed: boolean; included: boolean } {\n const nativeTarget = this.findNativeTargetByName(args.targetName);\n const defaultResult = { changed: false, included: false };\n if (!nativeTarget) {\n debug(`Target not found: ${args.targetName}`);\n return defaultResult;\n }\n\n const absoluteFilePath = args.filePath;\n if (\n this.isFileIncludedBySynchronizedRootGroup(nativeTarget, absoluteFilePath)\n ) {\n return {\n changed: false,\n included: true,\n };\n }\n\n const sourceBuildPhase = this.findSourceBuildPhaseInTarget(\n nativeTarget.obj,\n );\n if (!sourceBuildPhase) {\n debug(`Sources build phase not found for target: ${args.targetName}`);\n return defaultResult;\n }\n\n const fileReference = this.ensureSwiftFileReference(absoluteFilePath);\n const sourceBuildPhaseFiles = sourceBuildPhase.obj.files ?? [];\n const existingBuildFileReference = sourceBuildPhaseFiles.find((file) => {\n const buildFile = this.objects.PBXBuildFile?.[file.value];\n return (\n buildFile &&\n typeof buildFile !== 'string' &&\n buildFile.fileRef === fileReference.fileReferenceId\n );\n });\n\n if (existingBuildFileReference) {\n return {\n changed: fileReference.changed,\n included: true,\n };\n }\n\n if (!this.objects.PBXBuildFile) {\n this.objects.PBXBuildFile = {};\n }\n\n const buildFileId = this.project.generateUuid();\n const fileName = path.basename(absoluteFilePath);\n this.objects.PBXBuildFile[buildFileId] = {\n isa: 'PBXBuildFile',\n fileRef: fileReference.fileReferenceId,\n fileRef_comment: fileName,\n };\n this.objects.PBXBuildFile[\n `${buildFileId}_comment`\n ] = `${fileName} in Sources`;\n\n sourceBuildPhase.obj.files = [\n ...sourceBuildPhaseFiles,\n {\n value: buildFileId,\n comment: `${fileName} in Sources`,\n },\n ];\n\n return { changed: true, included: true };\n }\n\n /**\n * Retrieves all source files associated with a specific target in the Xcode project.\n * This is used to find files where we can inject Sentry initialization code.\n *\n * @param targetName - The name of the target to get files for\n * @returns An array of absolute file paths for the target's source files, or undefined if target not found\n */\n public getSourceFilesForTarget(targetName: string): string[] | undefined {\n // ## Summary how Xcode Projects are structured:\n // - Every Xcode Project has exactly one main group of type `PBXGroup`\n // - The main group contains a list of children identifiers\n // - Each child can be a `PBXGroup`, a `PBXFileReference` or a `PBXFileSystemSynchronizedRootGroup`\n // - Each `PBXGroup` has a list of children identifiers which again can be `PBXGroup`, `PBXFileReference` or `PBXFileSystemSynchronizedRootGroup`\n // - The target defines the list of `fileSystemSynchronizedGroups` which are `PBXFileSystemSynchronizedRootGroup` to be included in the build phase\n // - The `PBXFileSystemSynchronizedRootGroup` has a list of `exceptions` which are `PBXFileSystemSynchronizedBuildFileExceptionSet`\n // - Each `PBXFileSystemSynchronizedBuildFileExceptionSet` represents a folder to be excluded from the build.\n // - The `PBXFileSystemSynchronizedBuildFileExceptionSet` has a list of `membershipExceptions` which are files to be excluded from being excluded, therefore included in the build.\n // - The Xcode project has a build phase `PBXSourcesBuildPhase` which has a list of `files` which are `PBXBuildFile`\n // - A file which is not part of a `PBXFileSystemSynchronizedRootGroup` must be added to the `files` list of the `PBXSourcesBuildPhase` build phase\n // - Nested subfolders in `fileSystemSynchronizedGroups` are not declared but recursively included\n //\n // Based on the findings above the files included in the build phase are:\n // - All files in the `files` of the `PBXSourcesBuildPhase` build phase `Sources` of the target\n // - All files in directories of the `fileSystemSynchronizedGroups` of the target\n // - Excluding all files in the `exceptions` of the `PBXFileSystemSynchronizedRootGroup` of the target\n // - Including all files in the `membershipExceptions` of the `PBXFileSystemSynchronizedBuildFileExceptionSet` of the target\n const nativeTarget = this.findNativeTargetByName(targetName);\n if (!nativeTarget) {\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n const filesInBuildPhase = this.findFilesInSourceBuildPhase(nativeTarget);\n debug(\n `Found ${filesInBuildPhase.length} files in build phase for target: ${targetName}`,\n );\n\n const filesInSynchronizedRootGroups =\n this.findFilesInSynchronizedRootGroups(nativeTarget);\n debug(\n `Found ${filesInSynchronizedRootGroups.length} files in synchronized root groups for target: ${targetName}`,\n );\n return [...filesInBuildPhase, ...filesInSynchronizedRootGroups];\n }\n\n private isUnitTestTargetEntry(\n key: string,\n value: PBXNativeTarget | string | undefined,\n ): value is PBXNativeTarget {\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value !== undefined &&\n unquote(value.productType) === XCODE_UNIT_TEST_PRODUCT_TYPE\n );\n }\n\n private getTargetBuildSettings(\n target: PBXNativeTarget,\n ): Record<string, unknown>[] {\n const buildConfigurationListId = target.buildConfigurationList;\n if (!buildConfigurationListId) {\n return [];\n }\n\n const configurationList = this.objects.XCConfigurationList?.[\n buildConfigurationListId\n ] as XCConfigurationList | undefined;\n if (!configurationList || typeof configurationList === 'string') {\n return [];\n }\n\n return (configurationList.buildConfigurations ?? []).reduce(\n (buildSettings, buildConfiguration) => {\n const configuration =\n this.objects.XCBuildConfiguration?.[buildConfiguration.value];\n if (!configuration || typeof configuration === 'string') {\n return buildSettings;\n }\n\n return buildSettings.concat(configuration.buildSettings ?? {});\n },\n new Array<Record<string, unknown>>(),\n );\n }\n\n private getApplicationHostCandidates(\n target: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): ApplicationHostCandidates {\n const buildSettings = this.getTargetBuildSettings(target.obj);\n const productReferencePath = this.getProductReferencePath(target.obj);\n const productReferenceName = stripAppExtension(productReferencePath);\n const targetProductName = resolveBuildSettingValue(\n target.obj.productName,\n target.obj.name,\n );\n const buildSettingProductNames = buildSettings.flatMap((settings) => [\n resolveBuildSettingValue(settings.PRODUCT_NAME, target.obj.name),\n stripAppExtension(\n resolveBuildSettingValue(settings.FULL_PRODUCT_NAME, target.obj.name),\n ),\n stripAppExtension(\n resolveBuildSettingValue(settings.WRAPPER_NAME, target.obj.name),\n ),\n ]);\n const buildSettingExecutableNames = buildSettings.map((settings) =>\n resolveBuildSettingValue(settings.EXECUTABLE_NAME, target.obj.name),\n );\n\n return {\n bundleNames: uniqueStrings([\n target.obj.name,\n targetProductName,\n productReferenceName,\n ...buildSettingProductNames,\n ]),\n executableNames: uniqueStrings([\n target.obj.name,\n targetProductName,\n productReferenceName,\n ...buildSettingExecutableNames,\n ]),\n };\n }\n\n private getProductReferencePath(target: PBXNativeTarget): string | undefined {\n if (!target.productReference) {\n return undefined;\n }\n\n const productReference =\n this.objects.PBXFileReference?.[target.productReference];\n if (!productReference || typeof productReference === 'string') {\n return undefined;\n }\n\n return unquote(productReference.path);\n }\n\n private hasFrameworkBuildFileCommentInTarget(\n targetName: string,\n comment: string,\n ): boolean {\n const target = this.findNativeTargetByName(targetName);\n if (!target) {\n return false;\n }\n\n const frameworksBuildPhase = this.findFrameworksBuildPhaseInTarget(\n target.obj,\n );\n return (frameworksBuildPhase?.files ?? []).some((framework) => {\n return framework.comment === comment;\n });\n }\n\n private ensureSwiftPackageReference(packageSpec: SwiftPackageSpec): {\n packageRefId: string;\n changed: boolean;\n } {\n if (!this.objects.XCRemoteSwiftPackageReference) {\n this.objects.XCRemoteSwiftPackageReference = {};\n }\n\n const packageReferences = this.objects\n .XCRemoteSwiftPackageReference as Record<string, unknown>;\n const requestedRepositoryURL = normalizeSwiftPackageRepositoryURL(\n packageSpec.repositoryURL,\n );\n const existingPackageReference = Object.entries(packageReferences).find(\n ([id, value]) => {\n if (id.endsWith('_comment') || typeof value !== 'object') {\n return false;\n }\n\n const packageReference = value as Record<string, unknown>;\n return (\n normalizeSwiftPackageRepositoryURL(packageReference.repositoryURL) ===\n requestedRepositoryURL\n );\n },\n );\n\n if (existingPackageReference) {\n const packageReference = existingPackageReference[1] as Record<\n string,\n unknown\n >;\n if (\n shouldUpdatePackageRequirement(\n packageReference.requirement,\n packageSpec.requirement,\n )\n ) {\n packageReference.requirement = packageSpec.requirement;\n return { packageRefId: existingPackageReference[0], changed: true };\n }\n\n return { packageRefId: existingPackageReference[0], changed: false };\n }\n\n const packageRefId = this.project.generateUuid();\n packageReferences[packageRefId] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: `\"${packageSpec.repositoryURL}\"`,\n requirement: packageSpec.requirement,\n };\n packageReferences[`${packageRefId}_comment`] =\n this.swiftPackageReferenceComment(packageSpec.commentName);\n\n return { packageRefId, changed: true };\n }\n\n private ensureProjectSwiftPackageReference(\n packageRefId: string,\n commentName: string,\n ): boolean {\n const xcodeProject = this.project.getFirstProject().firstProject as {\n packageReferences?: { value: string; comment?: string }[];\n };\n if (!xcodeProject.packageReferences) {\n xcodeProject.packageReferences = [];\n }\n\n if (\n xcodeProject.packageReferences.some((packageReference) => {\n return packageReference.value === packageRefId;\n })\n ) {\n return false;\n }\n\n xcodeProject.packageReferences.push({\n value: packageRefId,\n comment: this.swiftPackageReferenceComment(commentName),\n });\n return true;\n }\n\n private ensureSwiftPackageProductDependency(\n packageRefId: string,\n product: SwiftPackageProductSpec,\n ): { productDependencyId: string; changed: boolean } {\n if (!this.objects.XCSwiftPackageProductDependency) {\n this.objects.XCSwiftPackageProductDependency = {};\n }\n\n const productDependencies = this.objects\n .XCSwiftPackageProductDependency as Record<string, unknown>;\n const existingProductDependency = Object.entries(productDependencies).find(\n ([id, value]) => {\n if (id.endsWith('_comment') || typeof value !== 'object') {\n return false;\n }\n\n const productDependency = value as Record<string, unknown>;\n return (\n productDependency.package === packageRefId &&\n unquote(productDependency.productName) === product.productName\n );\n },\n );\n\n if (existingProductDependency) {\n return {\n productDependencyId: existingProductDependency[0],\n changed: false,\n };\n }\n\n const productDependencyId = this.project.generateUuid();\n productDependencies[productDependencyId] = {\n isa: 'XCSwiftPackageProductDependency',\n package: packageRefId,\n package_comment: this.swiftPackageReferenceComment(\n product.package.commentName,\n ),\n productName: product.productName,\n };\n productDependencies[`${productDependencyId}_comment`] = product.productName;\n\n return { productDependencyId, changed: true };\n }\n\n private ensureFrameworksBuildFile(\n frameworksBuildPhase: {\n files?: { value: string; comment?: string }[];\n },\n productDependencyId: string,\n product: SwiftPackageProductSpec,\n ): boolean {\n if (!this.objects.PBXBuildFile) {\n this.objects.PBXBuildFile = {};\n }\n\n const existingFrameworkEntry = (frameworksBuildPhase.files ?? []).find(\n (framework) => {\n const buildFile = this.objects.PBXBuildFile?.[framework.value];\n return (\n buildFile &&\n typeof buildFile !== 'string' &&\n buildFile.productRef === productDependencyId\n );\n },\n );\n if (existingFrameworkEntry) {\n return false;\n }\n\n const buildFileId = this.project.generateUuid();\n this.objects.PBXBuildFile[buildFileId] = {\n isa: 'PBXBuildFile',\n productRef: productDependencyId,\n productRef_comment: product.productName,\n };\n this.objects.PBXBuildFile[\n `${buildFileId}_comment`\n ] = `${product.productName} in Frameworks`;\n\n if (!frameworksBuildPhase.files) {\n frameworksBuildPhase.files = [];\n }\n frameworksBuildPhase.files.push({\n value: buildFileId,\n comment: `${product.productName} in Frameworks`,\n });\n\n return true;\n }\n\n private findFrameworksBuildPhaseInTarget(target: PBXNativeTarget):\n | {\n files?: { value: string; comment?: string }[];\n }\n | undefined {\n for (const buildPhaseReference of target.buildPhases ?? []) {\n const buildPhase =\n this.objects.PBXFrameworksBuildPhase?.[buildPhaseReference.value];\n if (buildPhase && typeof buildPhase !== 'string') {\n return buildPhase as { files?: { value: string; comment?: string }[] };\n }\n }\n\n return undefined;\n }\n\n private swiftPackageReferenceComment(commentName: string): string {\n return `XCRemoteSwiftPackageReference \"${commentName}\"`;\n }\n\n private isFileIncludedBySynchronizedRootGroup(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n absoluteFilePath: string,\n ): boolean {\n return this.findFilesInSynchronizedRootGroups(nativeTarget).some(\n (filePath) => filePath === absoluteFilePath,\n );\n }\n\n private ensureSwiftFileReference(absoluteFilePath: string): {\n fileReferenceId: string;\n changed: boolean;\n } {\n if (!this.objects.PBXFileReference) {\n this.objects.PBXFileReference = {};\n }\n\n const existingFileReference = Object.entries(\n this.objects.PBXFileReference,\n ).find(([id, fileReference]) => {\n if (id.endsWith('_comment') || typeof fileReference !== 'object') {\n return false;\n }\n\n const resolvedFilePath = this.resolveAbsolutePathOfFileReference({\n id,\n obj: fileReference,\n });\n return resolvedFilePath === absoluteFilePath;\n });\n\n if (existingFileReference) {\n return { fileReferenceId: existingFileReference[0], changed: false };\n }\n\n const fileReferenceId = this.project.generateUuid();\n const fileName = path.basename(absoluteFilePath);\n const relativePath = path.relative(this.baseDir, absoluteFilePath);\n this.objects.PBXFileReference[fileReferenceId] = {\n isa: 'PBXFileReference',\n lastKnownFileType: 'sourcecode.swift',\n path: relativePath,\n sourceTree: 'SOURCE_ROOT',\n };\n this.objects.PBXFileReference[`${fileReferenceId}_comment`] = fileName;\n\n this.addFileReferenceToBestGroup(\n fileReferenceId,\n fileName,\n absoluteFilePath,\n );\n\n return { fileReferenceId, changed: true };\n }\n\n private addFileReferenceToBestGroup(\n fileReferenceId: string,\n fileName: string,\n absoluteFilePath: string,\n ): void {\n const parentDirectory = path.dirname(absoluteFilePath);\n const parentGroup =\n this.groups.find((group) => {\n const groupPath = this.resolveAbsolutePathOfGroup(group);\n return groupPath === parentDirectory;\n }) ?? this.mainGroup;\n\n if (!parentGroup) {\n return;\n }\n\n if (!parentGroup.obj.children) {\n parentGroup.obj.children = [];\n }\n\n if (\n parentGroup.obj.children.some((child) => child.value === fileReferenceId)\n ) {\n return;\n }\n\n parentGroup.obj.children.push({\n value: fileReferenceId,\n comment: fileName,\n });\n }\n\n private get mainGroup(): XcodeProjectObjectWithId<PBXGroup> | undefined {\n const project = Object.entries(this.objects.PBXProject ?? {}).find(\n ([id, candidate]) => {\n return !id.endsWith('_comment') && typeof candidate === 'object';\n },\n )?.[1];\n if (!project || typeof project !== 'object') {\n return undefined;\n }\n\n const mainGroupId = (project as { mainGroup?: string }).mainGroup;\n if (!mainGroupId) {\n return undefined;\n }\n\n const mainGroup = this.objects.PBXGroup?.[mainGroupId];\n if (!mainGroup || typeof mainGroup !== 'object') {\n return undefined;\n }\n\n return { id: mainGroupId, obj: mainGroup };\n }\n\n // ================================ TARGET HELPERS ================================\n\n /**\n * Finds a native target by name.\n *\n * @param targetName - The name of the target to find\n * @returns The native target, or undefined if the target is not found\n */\n private findNativeTargetByName(\n targetName: string,\n ): XcodeProjectObjectWithId<PBXNativeTarget> | undefined {\n debug('Finding native target by name: ' + targetName);\n\n if (!this.objects.PBXNativeTarget) {\n debug('No native targets found');\n return undefined;\n }\n\n const nativeTargets = Object.entries(this.objects.PBXNativeTarget);\n for (const [key, target] of nativeTargets) {\n // Ignore comments\n if (key.endsWith('_comment') || typeof target === 'string') {\n continue;\n }\n\n // Ignore targets that are not the target we are looking for\n if (target.name !== targetName) {\n continue;\n }\n debug('Found native target: ' + targetName);\n return {\n id: key,\n obj: target,\n };\n }\n\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n // ================================ BUILD PHASE HELPERS ================================\n\n /**\n * Finds the source build phase in a target.\n *\n * @param target - The target to find the source build phase in\n * @returns The source build phase, or undefined if the target is not found or has no source build phase\n */\n findSourceBuildPhaseInTarget(\n target: PBXNativeTarget,\n ): XcodeProjectObjectWithId<PBXSourcesBuildPhase> | undefined {\n debug(`Finding source build phase in target: ${target.name}`);\n if (!target.buildPhases) {\n debug('No build phases found for target: ' + target.name);\n return undefined;\n }\n for (const phase of target.buildPhases) {\n const buildPhaseId = phase.value;\n const buildPhase = this.objects.PBXSourcesBuildPhase?.[buildPhaseId];\n if (typeof buildPhase !== 'object') {\n // Ignore comments\n continue;\n }\n debug(\n `Found source build phase: ${buildPhaseId} for target: ${target.name}`,\n );\n return {\n id: buildPhaseId,\n obj: buildPhase,\n };\n }\n\n debug(`No source build phase found for target: ${target.name}`);\n return undefined;\n }\n\n /**\n * Adds a new script build phase to the specified target.\n *\n * @param targetKey - The key of the target to add the build phase to\n * @param name - The name of the build phase\n * @param script - The shell script content\n * @param inputPaths - Array of input paths for the script\n * @returns The UUID of the created build phase\n */\n addScriptBuildPhase(\n targetKey: string,\n name: string,\n script: string,\n inputPaths: string[] = [],\n ): string {\n const buildPhaseUuid = this.project.generateUuid();\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n\n // Create the shell script build phase object\n const buildPhase = {\n isa: 'PBXShellScriptBuildPhase' as const,\n buildActionMask: 2147483647,\n files: [],\n inputPaths,\n outputPaths: [],\n runOnlyForDeploymentPostprocessing: 0,\n shellPath: '/bin/sh',\n shellScript: `\"${escapedScript}\"`,\n name: `\"${name}\"`,\n };\n\n // Add to PBXShellScriptBuildPhase section\n if (!this.objects.PBXShellScriptBuildPhase) {\n this.objects.PBXShellScriptBuildPhase = {};\n }\n this.objects.PBXShellScriptBuildPhase[buildPhaseUuid] = buildPhase;\n this.objects.PBXShellScriptBuildPhase[`${buildPhaseUuid}_comment`] = name;\n\n // Add to target's build phases\n const target = this.objects.PBXNativeTarget?.[targetKey] as PBXNativeTarget;\n if (target?.buildPhases) {\n target.buildPhases.push({\n value: buildPhaseUuid,\n comment: name,\n });\n }\n\n return buildPhaseUuid;\n }\n\n /**\n * Updates an existing script build phase.\n *\n * @param buildPhaseId - The UUID of the build phase to update\n * @param script - The new shell script content\n * @param inputPaths - Array of input paths for the script\n */\n updateScriptBuildPhase(\n buildPhaseId: string,\n script: string,\n inputPaths: string[] = [],\n ): void {\n const buildPhase = this.objects.PBXShellScriptBuildPhase?.[buildPhaseId];\n if (!buildPhase || typeof buildPhase === 'string') {\n debug(`Build phase not found: ${buildPhaseId}`);\n return;\n }\n\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n buildPhase.shellScript = `\"${escapedScript}\"`;\n buildPhase.inputPaths = inputPaths;\n buildPhase.shellPath = '/bin/sh';\n }\n\n // ================================ FILE HELPERS ================================\n\n /**\n * Finds all files in the source build phase of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the source build phase of the target, or an empty array if the target is not found or has no source build phase\n */\n findFilesInSourceBuildPhase(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n 'Finding files in source build phase for target: ' +\n nativeTarget.obj.name,\n );\n const buildPhase = this.findSourceBuildPhaseInTarget(nativeTarget.obj);\n if (!buildPhase) {\n debug(\n `Sources build phase not found for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n const buildPhaseFiles = buildPhase.obj.files;\n if (!buildPhaseFiles) {\n debug(\n `No files found in sources build phase for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n if (!this.objects.PBXBuildFile) {\n debug('PBXBuildFile is undefined');\n return [];\n }\n if (!this.objects.PBXFileReference) {\n debug('PBXFileReference is undefined');\n return [];\n }\n\n const result: string[] = [];\n for (const file of buildPhaseFiles) {\n debug(`Resolving build phase file: ${file.value}`);\n // Find the related build file object\n const buildFileObj = this.objects.PBXBuildFile[\n file.value\n ] as PBXBuildFile;\n if (!buildFileObj || typeof buildFileObj !== 'object') {\n debug(`Build file object not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file object found for file: ${file.value}`);\n\n const buildFileRefId = buildFileObj.fileRef;\n if (!buildFileRefId) {\n debug(`File reference not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file reference found for file: ${file.value}`);\n\n // Find the related file reference object\n const buildFile = this.objects.PBXFileReference[buildFileRefId];\n if (!buildFile || typeof buildFile !== 'object') {\n debug(`File not found in file dictionary for file: ${file.value}`);\n continue;\n }\n debug(`Build file found in file dictionary for file: ${file.value}`);\n\n // Resolve the path of the file based on the `sourceTree` property\n const resolvedFilePath = this.resolveAbsolutePathOfFileReference({\n id: buildFileRefId,\n obj: buildFile,\n });\n if (!resolvedFilePath) {\n debug(`Failed to resolve file path for file: ${file.value}`);\n continue;\n }\n debug(`Resolved file ${file.value} to path: ${resolvedFilePath}`);\n\n result.push(resolvedFilePath);\n }\n\n debug(\n `Resolved ${result.length} files for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n /**\n * Resolves the absolute path of a file reference.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsolutePathOfFileReference(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving path of file reference: ${fileRef.id} with path: ${fileRef.obj.path}`,\n );\n // File path is expected to be set, therefore typing is non-nullable.\n // As the file is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!fileRef.obj.path) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // File references are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<absolute>': The file path is absolute\n // - '<group>': The file path is relative to the parent group of the file reference\n // - 'BUILT_PRODUCTS_DIR': The file path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SOURCE_ROOT': The file path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'SDKROOT': The file path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The file path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const fileRefSourceTree = fileRef.obj.sourceTree?.replace(/\"/g, '') ?? '';\n switch (fileRefSourceTree) {\n case '<absolute>':\n return fileRef.obj.path.replace(/\"/g, '');\n case '<group>':\n return this.resolveAbsoluteFilePathRelativeToGroup(fileRef);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolveAbsoluteFilePathRelativeToBuiltProductsDir(fileRef);\n case 'SOURCE_ROOT':\n return this.resolveAbsoluteFilePathRelativeToSourceRoot(fileRef);\n case 'SDKROOT':\n return this.resolveAbsoluteFilePathRelativeToSdkRoot(fileRef);\n case 'DEVELOPER_DIR':\n return this.resolveAbsoluteFilePathRelativeToDeveloperDir(fileRef);\n default:\n debug(\n `Unknown source tree '${fileRef.obj.sourceTree}' for build file: ${fileRef.obj.path}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the parent group.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToGroup(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to group for file reference: ${\n fileRef.id\n } with path: ${fileRef.obj.path ?? ''}`,\n );\n const fileRefPath = fileRef.obj.path?.replace(/\"/g, '');\n if (!fileRefPath) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // Find the parent group of the file reference by searching for the reverse relationship\n const parentGroup = this.findParentGroupByChildId(fileRef.id);\n if (!parentGroup) {\n debug(\n `Parent group not found for file reference: ${fileRef.id} at path: ${fileRefPath}`,\n );\n return undefined;\n }\n\n // Resolve the path of the parent group\n const absoluteGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of group: ${parentGroup.id}`);\n return undefined;\n }\n\n return path.join(absoluteGroupPath, fileRefPath);\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the built products directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToBuiltProductsDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to built products directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSourceRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n return path.join(this.baseDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the SDK root.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSdkRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to SDK root for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the developer directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToDeveloperDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to developer directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} with path: ${group.obj.path ?? ''}`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfGroupRelativeToSourceRoot(group);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfGroupRelativeToBuiltProductsDir(group);\n case 'SDKROOT':\n return this.resolvePathOfGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfGroupRelativeToDeveloperDir(group);\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} with path: ${\n group.obj.path ?? ''\n }`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfSynchronizedRootGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group,\n );\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group,\n );\n case 'SDKROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group,\n );\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Finds all files in the synchronized root groups of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the synchronized root groups of the target, or an empty array if the target is not found or has no synchronized root groups\n */\n findFilesInSynchronizedRootGroups(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n `Finding files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n const synchronizedRootGroups =\n nativeTarget.obj.fileSystemSynchronizedGroups ?? [];\n\n const result: string[] = [];\n for (const group of synchronizedRootGroups) {\n const groupObj =\n this.objects.PBXFileSystemSynchronizedRootGroup?.[group.value];\n if (!groupObj || typeof groupObj !== 'object') {\n debug(`Synchronized root group not found: ${group.value}`);\n continue;\n }\n debug(`Found synchronized root group: ${group.value}`);\n\n const files = this.getFilesInSynchronizedRootGroup({\n id: group.value,\n obj: groupObj,\n });\n debug(\n `Found ${files.length} files in synchronized root group: ${group.value}`,\n );\n result.push(...files.map((file) => file.path));\n }\n debug(\n `Found ${result.length} files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n private getFilesInSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): ProjectFile[] {\n // Group path is expected to be set, therefore typing is non-nullable.\n // As the group is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!group.obj.path) {\n debug(`Group path not found for group: ${group.id}`);\n return [];\n }\n\n // Resolve the path of the synchronized root group\n const absoluteGroupPath =\n this.resolveAbsolutePathOfSynchronizedRootGroup(group);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of synchronized root group: ${group.id}`);\n return [];\n }\n\n // Build a list of all exception paths for the group\n const exceptionSets = this.getExceptionSetsForGroup(group);\n\n // Resolve a list of all files in the group\n const files = this.getAbsoluteFilePathsInDirectoryTree(absoluteGroupPath);\n\n // Filter out files that are excluded by the exception sets\n const filteredFiles = this.filterFilesByExceptionSets(files, exceptionSets);\n\n return filteredFiles;\n }\n\n /**\n * Returns all files in a directory tree.\n *\n * @param dirPath - The path of the directory to get the files in\n * @returns All files in the directory tree, or an empty array if the directory does not exist\n */\n private getAbsoluteFilePathsInDirectoryTree(dirPath: string): ProjectFile[] {\n // If the directory does not exist, return an empty array\n // This can happen if the group is not found in the project\n if (!fs.existsSync(dirPath)) {\n return [];\n }\n const result: ProjectFile[] = [];\n const files = fs.readdirSync(dirPath);\n for (const file of files) {\n // Ignore hidden files and directories\n if (file.startsWith('.')) {\n continue;\n }\n\n const filePath = path.join(dirPath, file);\n // If the file is a directory, recursively get the files in the directory\n if (fs.statSync(filePath).isDirectory()) {\n result.push(...this.getAbsoluteFilePathsInDirectoryTree(filePath));\n continue;\n }\n // If the file is a file, add it to the result\n if (fs.statSync(filePath).isFile()) {\n result.push({\n name: file,\n path: filePath,\n });\n continue;\n }\n }\n\n return result;\n }\n\n private filterFilesByExceptionSets(\n files: ProjectFile[],\n exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[],\n ): ProjectFile[] {\n // Iterate over all files and filter out files that are excluded by any exception sets\n return files.filter((file) => {\n return !exceptionSets.some((exceptionSet) => {\n const membershipExceptions =\n exceptionSet.obj.membershipExceptions ?? [];\n return membershipExceptions.some((path) => {\n const unescapedPath = path.replace(/\"/g, '');\n return file.path.includes(unescapedPath);\n });\n });\n });\n }\n\n // ================================ GROUP HELPERS ================================\n\n /**\n * Returns all groups that are PBXGroup.\n *\n * This is a helper method to avoid having to map and filter the groups manually.\n *\n * @returns All groups that are PBXGroup, excluding comments and non-object values.\n */\n private get groups(): XcodeProjectObjectWithId<PBXGroup>[] {\n // Map and filter the groups to only include the groups that are PBXGroup\n return Object.entries(this.objects.PBXGroup ?? {}).reduce(\n (acc, [key, group]) => {\n if (typeof group !== 'object') {\n return acc;\n }\n return acc.concat([\n {\n id: key,\n obj: group,\n },\n ]);\n },\n new Array<XcodeProjectObjectWithId<PBXGroup>>(),\n );\n }\n\n /**\n * Finds the parent group of a child group or file reference.\n *\n * @param childId - The ID of the child group or file reference\n * @returns The parent group of the child group or file reference, or undefined if the child group or file reference is not found or has no parent group\n */\n private findParentGroupByChildId(\n childId: string,\n ): XcodeProjectObjectWithId<PBXGroup> | undefined {\n return this.groups.find((group) => {\n return (group.obj.children ?? []).some((child) => {\n return child.value === childId;\n });\n });\n }\n\n /**\n * Checks if a group is the main group of any project.\n *\n * @param groupId - The ID of the group to check\n * @returns True if the group is the main group, false otherwise\n */\n private isMainGroup(groupId: string): boolean {\n return Object.values(this.objects.PBXProject ?? {}).some((project) => {\n if (typeof project !== 'object') {\n return false;\n }\n return project.mainGroup === groupId;\n });\n }\n\n private getExceptionSetsForGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] {\n const exceptions = group.obj.exceptions ?? [];\n const exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] =\n [];\n for (const exception of exceptions) {\n const exceptionSet =\n this.objects.PBXFileSystemSynchronizedBuildFileExceptionSet?.[\n exception.value\n ];\n if (typeof exceptionSet !== 'object') {\n continue;\n }\n exceptionSets.push({\n id: exception.value,\n obj: exceptionSet,\n comment: exception.comment,\n });\n }\n return exceptionSets;\n }\n\n /**\n * The path to the build products directory for the project.\n *\n * This is cached to avoid having to read the build settings from Xcode for each call to `getBuildProductsDirectoryPath`.\n */\n private buildProductsDir: string | undefined;\n\n /**\n * Returns the path to the build products directory for the project.\n *\n * @returns The path to the build products directory for the project, or undefined if the path is not found\n */\n private getBuildProductsDirectoryPath(): string | undefined {\n if (this.buildProductsDir) {\n return this.buildProductsDir;\n }\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n this.xcodeprojPath,\n );\n if (!buildSettings) {\n debug(`Failed to read Xcode build settings`);\n return undefined;\n }\n this.buildProductsDir =\n buildSettings['TARGET_BUILD_DIR'] ?? buildSettings['BUILD_DIR'];\n\n return this.buildProductsDir;\n }\n}\n"]}
|
|
@@ -58,6 +58,11 @@ async function runCloudflareWizardWithTelemetry(options) {
|
|
|
58
58
|
prompt: `Do you want to enable ${chalk_1.default.bold('Tracing')} to track the performance of your application?`,
|
|
59
59
|
enabledHint: 'recommended',
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
id: 'logs',
|
|
63
|
+
prompt: `Do you want to enable ${chalk_1.default.bold('Logs')} to send your application logs to Sentry?`,
|
|
64
|
+
enabledHint: 'recommended',
|
|
65
|
+
},
|
|
61
66
|
]);
|
|
62
67
|
await (0, telemetry_1.traceStep)('Create Sentry initialization', async () => {
|
|
63
68
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare-wizard.js","sourceRoot":"","sources":["../../../src/cloudflare/cloudflare-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CASwB;AACxB,0DAAwE;AACxE,wDAA4D;AAE5D,2CAAmD;AACnD,kGAA0F;AAC1F,8EAAyE;AACzE,8EAAyE;AACzE,0CAAuC;AACvC,0GAGyD;AAElD,KAAK,UAAU,mBAAmB,CACvC,OAAsB;IAEtB,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,YAAY;QACzB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAChD,CAAC;AACJ,CAAC;AAXD,kDAWC;AAED,KAAK,UAAU,gCAAgC,CAC7C,OAAsB;IAEtB,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAE9D,IAAA,oBAAY,EAAC;QACX,UAAU,EAAE,0BAA0B;QACtC,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,IAAA,yCAAiC,EAAC;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,IAAA,yBAAiB,GAAE,CAAC;IAE9C,MAAM,IAAA,gCAAwB,EAAC,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEtE,IAAA,qBAAS,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACvC,IAAA,6CAAoB,GAAE,CAAC;IACzB,CAAC,CAAC,CAAC;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YAAY,CAAC;QACnC,kBAAkB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QACzD,gBAAgB,EAAE;YAChB,OAAO,EAAE,qBAAqB;SAC/B;KACF,CAAC,CACH,CAAC;IAEF,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjD,iFAAiF;IACjF,MAAM,IAAA,wCAA2B,EAC/B,eAAe,CAAC,YAAY,CAAC,IAAI,EACjC,eAAe,CAAC,IAAI,CACrB,CAAC;IAEF,iBAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO;IACL,eAAK,CAAC,KAAK,CACX,sEAAsE,CACvE;;IAEC,eAAK,CAAC,GAAG,CAAC,aAAa,CAAC;IACxB,eAAK,CAAC,GAAG,CAAC,qDAAqD,CAAC;IAChE,eAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC,IAAI,eAAK,CAAC,IAAI,CAC3D,iBAAiB,CAClB;IACC,eAAK,CAAC,GAAG,CAAC,gDAAgD,CAAC;;IAE3D,eAAK,CAAC,IAAI,CACV;iEAC6D,CAC9D;GACA,CAAC;AACJ,CAAC;AAlBD,8CAkBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { createSentryInitFile } from './sdk-setup';\nimport { abortIfSpotlightNotSupported } from '../utils/abort-if-sportlight-not-supported';\nimport { ensureWranglerConfig } from './wrangler/ensure-wrangler-config';\nimport { updateWranglerConfig } from './wrangler/update-wrangler-config';\nimport { debug } from '../utils/debug';\nimport {\n defaultEntryPoint,\n getEntryPointFromWranglerConfig,\n} from './wrangler/get-entry-point-from-wrangler-config';\n\nexport async function runCloudflareWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'cloudflare',\n wizardOptions: options,\n },\n () => runCloudflareWizardWithTelemetry(options),\n );\n}\n\nasync function runCloudflareWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Cloudflare Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'wrangler', 'Cloudflare');\n\n traceStep('Ensure Wrangler config', () => {\n ensureWranglerConfig();\n });\n\n const projectData = await getOrAskForProjectData(\n options,\n 'node-cloudflare-workers',\n );\n\n if (projectData.spotlight) {\n return abortIfSpotlightNotSupported('Cloudflare');\n }\n\n const { selectedProject } = projectData;\n\n await installPackage({\n packageName: '@sentry/cloudflare@^10',\n packageNameDisplayLabel: '@sentry/cloudflare',\n alreadyInstalled: hasPackageInstalled('@sentry/cloudflare', packageJson),\n forceInstall,\n });\n\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n await traceStep('Create Sentry initialization', async () => {\n try {\n await createSentryInitFile(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not automatically set up Sentry initialization. Please set it up manually using instructions from https://docs.sentry.io/platforms/javascript/guides/cloudflare/',\n );\n debug(e);\n }\n });\n\n const mainFile = getEntryPointFromWranglerConfig();\n\n await traceStep('Update Wrangler config with Sentry requirements', () =>\n updateWranglerConfig({\n ...(mainFile ? {} : { main: defaultEntryPoint }),\n compatibility_flags: ['nodejs_als'],\n compatibility_date: new Date().toISOString().slice(0, 10),\n version_metadata: {\n binding: 'CF_VERSION_METADATA',\n },\n }),\n );\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(buildOutroMessage());\n}\n\nexport function buildOutroMessage(): string {\n return `\n ${chalk.green(\n 'Sentry has been successfully configured for your Cloudflare project.',\n )}\n\n ${chalk.dim('Next steps:')}\n ${chalk.dim('1. Wrap your worker with Sentry as instructed above')}\n ${chalk.dim('2. Deploy your application with:')} ${chalk.cyan(\n 'wrangler deploy',\n )}\n ${chalk.dim('3. Trigger an error to test Sentry integration')}\n\n ${chalk.cyan(\n `To learn more about using Sentry with Cloudflare, visit:\n https://docs.sentry.io/platforms/javascript/guides/cloudflare/`,\n )}\n `;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cloudflare-wizard.js","sourceRoot":"","sources":["../../../src/cloudflare/cloudflare-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CASwB;AACxB,0DAAwE;AACxE,wDAA4D;AAE5D,2CAAmD;AACnD,kGAA0F;AAC1F,8EAAyE;AACzE,8EAAyE;AACzE,0CAAuC;AACvC,0GAGyD;AAElD,KAAK,UAAU,mBAAmB,CACvC,OAAsB;IAEtB,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,YAAY;QACzB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CA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AC/B,OAAO;IACL,eAAK,CAAC,KAAK,CACX,sEAAsE,CACvE;;IAEC,eAAK,CAAC,GAAG,CAAC,aAAa,CAAC;IACxB,eAAK,CAAC,GAAG,CAAC,qDAAqD,CAAC;IAChE,eAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC,IAAI,eAAK,CAAC,IAAI,CAC3D,iBAAiB,CAClB;IACC,eAAK,CAAC,GAAG,CAAC,gDAAgD,CAAC;;IAE3D,eAAK,CAAC,IAAI,CACV;iEAC6D,CAC9D;GACA,CAAC;AACJ,CAAC;AAlBD,8CAkBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { createSentryInitFile } from './sdk-setup';\nimport { abortIfSpotlightNotSupported } from '../utils/abort-if-sportlight-not-supported';\nimport { ensureWranglerConfig } from './wrangler/ensure-wrangler-config';\nimport { updateWranglerConfig } from './wrangler/update-wrangler-config';\nimport { debug } from '../utils/debug';\nimport {\n defaultEntryPoint,\n getEntryPointFromWranglerConfig,\n} from './wrangler/get-entry-point-from-wrangler-config';\n\nexport async function runCloudflareWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'cloudflare',\n wizardOptions: options,\n },\n () => runCloudflareWizardWithTelemetry(options),\n );\n}\n\nasync function runCloudflareWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Cloudflare Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'wrangler', 'Cloudflare');\n\n traceStep('Ensure Wrangler config', () => {\n ensureWranglerConfig();\n });\n\n const projectData = await getOrAskForProjectData(\n options,\n 'node-cloudflare-workers',\n );\n\n if (projectData.spotlight) {\n return abortIfSpotlightNotSupported('Cloudflare');\n }\n\n const { selectedProject } = projectData;\n\n await installPackage({\n packageName: '@sentry/cloudflare@^10',\n packageNameDisplayLabel: '@sentry/cloudflare',\n alreadyInstalled: hasPackageInstalled('@sentry/cloudflare', packageJson),\n forceInstall,\n });\n\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n await traceStep('Create Sentry initialization', async () => {\n try {\n await createSentryInitFile(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not automatically set up Sentry initialization. Please set it up manually using instructions from https://docs.sentry.io/platforms/javascript/guides/cloudflare/',\n );\n debug(e);\n }\n });\n\n const mainFile = getEntryPointFromWranglerConfig();\n\n await traceStep('Update Wrangler config with Sentry requirements', () =>\n updateWranglerConfig({\n ...(mainFile ? {} : { main: defaultEntryPoint }),\n compatibility_flags: ['nodejs_als'],\n compatibility_date: new Date().toISOString().slice(0, 10),\n version_metadata: {\n binding: 'CF_VERSION_METADATA',\n },\n }),\n );\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(buildOutroMessage());\n}\n\nexport function buildOutroMessage(): string {\n return `\n ${chalk.green(\n 'Sentry has been successfully configured for your Cloudflare project.',\n )}\n\n ${chalk.dim('Next steps:')}\n ${chalk.dim('1. Wrap your worker with Sentry as instructed above')}\n ${chalk.dim('2. Deploy your application with:')} ${chalk.cyan(\n 'wrangler deploy',\n )}\n ${chalk.dim('3. Trigger an error to test Sentry integration')}\n\n ${chalk.cyan(\n `To learn more about using Sentry with Cloudflare, visit:\n https://docs.sentry.io/platforms/javascript/guides/cloudflare/`,\n )}\n `;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/cloudflare/sdk-setup.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,sDAAyB;AACzB,0DAA6B;AAC7B,2CAGqB;AACrB,0GAGyD;AACzD,+CAAqD;AAErD;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CACxC,GAAW,EACX,
|
|
1
|
+
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/cloudflare/sdk-setup.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,sDAAyB;AACzB,0DAA6B;AAC7B,2CAGqB;AACrB,0GAGyD;AACzD,+CAAqD;AAErD;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CACxC,GAAW,EACX,gBAGC;IAED,MAAM,oBAAoB,GAAG,IAAA,sEAA+B,GAAE,CAAC;IAE/D,IAAI,CAAC,oBAAoB,EAAE;QACzB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,8DAA8D,CAC/D,CAAC;QAEF,MAAM,wBAAwB,GAAG,IAAA,kDAAsC,GAAE,CAAC;QAE1E,MAAM,iBAAE,CAAC,QAAQ,CAAC,KAAK,CACrB,mBAAI,CAAC,IAAI,CAA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AyDC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport {\n getCloudflareWorkerTemplate,\n getCloudflareWorkerTemplateWithHandler,\n} from './templates';\nimport {\n defaultEntryPoint,\n getEntryPointFromWranglerConfig,\n} from './wrangler/get-entry-point-from-wrangler-config';\nimport { wrapWorkerWithSentry } from './wrap-worker';\n\n/**\n * Creates or updates the main worker file with Sentry initialization.\n * Currently focused on Cloudflare Workers\n */\nexport async function createSentryInitFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const entryPointFromConfig = getEntryPointFromWranglerConfig();\n\n if (!entryPointFromConfig) {\n clack.log.info(\n 'No entry point found in wrangler config, creating a new one.',\n );\n\n const cloudflareWorkerTemplate = getCloudflareWorkerTemplateWithHandler();\n\n await fs.promises.mkdir(\n path.join(process.cwd(), path.dirname(defaultEntryPoint)),\n {\n recursive: true,\n },\n );\n await fs.promises.writeFile(\n path.join(process.cwd(), defaultEntryPoint),\n cloudflareWorkerTemplate,\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan(defaultEntryPoint)}.`);\n\n return;\n }\n\n const entryPointPath = path.join(process.cwd(), entryPointFromConfig);\n\n if (fs.existsSync(entryPointPath)) {\n clack.log.info(\n `Found existing entry point: ${chalk.cyan(entryPointFromConfig)}`,\n );\n\n try {\n await wrapWorkerWithSentry(entryPointPath, dsn, selectedFeatures);\n clack.log.success(\n `Wrapped ${chalk.cyan(\n entryPointFromConfig,\n )} with Sentry initialization.`,\n );\n } catch (error) {\n clack.log.warn('Failed to wrap worker automatically.');\n clack.log.step('Please wrap your handler with Sentry initialization:');\n\n clack.note(\n chalk.cyan(getCloudflareWorkerTemplate(dsn, selectedFeatures)),\n );\n }\n return;\n }\n}\n"]}
|
|
@@ -8,11 +8,17 @@ function getCloudflareWorkerTemplate(dsn, selectedFeatures) {
|
|
|
8
8
|
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
9
9
|
tracesSampleRate: 1,`;
|
|
10
10
|
}
|
|
11
|
+
let logsOptions = '';
|
|
12
|
+
if (selectedFeatures.logs) {
|
|
13
|
+
logsOptions = `
|
|
14
|
+
// Enable logs to be sent to Sentry
|
|
15
|
+
enableLogs: true,`;
|
|
16
|
+
}
|
|
11
17
|
return `import * as Sentry from '@sentry/cloudflare';
|
|
12
18
|
|
|
13
19
|
export default Sentry.withSentry(
|
|
14
20
|
(env) => ({
|
|
15
|
-
dsn: '${dsn}',${performanceOptions}
|
|
21
|
+
dsn: '${dsn}',${performanceOptions}${logsOptions}
|
|
16
22
|
}),
|
|
17
23
|
{
|
|
18
24
|
async fetch(request, env, ctx): Promise<Response> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cloudflare/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,2BAA2B,CACzC,GAAW,EACX,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cloudflare/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,2BAA2B,CACzC,GAAW,EACX,gBAGC;IAED,IAAI,kBAAkB,GAAG,EAAE,CAAC;IAC5B,IAAI,gBAAgB,CAAC,WAAW,EAAE;QAChC,kBAAkB,GAAG;;uBAEF,CAAC;KACrB;IAED,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,gBAAgB,CAAC,IAAI,EAAE;QACzB,WAAW,GAAG;;oBAEE,CAAC;KAClB;IAED,OAAO;;;;UAIC,GAAG,KAAK,kBAAkB,GAAG,WAAW;;;;;;;;;CASjD,CAAC;AACF,CAAC;AAnCD,kEAmCC;AAED,SAAgB,sCAAsC;IACpD,OAAO;;;;;;;;;;;;;CAaR,CAAC;AACF,CAAC;AAfD,wFAeC","sourcesContent":["export function getCloudflareWorkerTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): string {\n let performanceOptions = '';\n if (selectedFeatures.performance) {\n performanceOptions = `\n\t\t// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n\t\ttracesSampleRate: 1,`;\n }\n\n let logsOptions = '';\n if (selectedFeatures.logs) {\n logsOptions = `\n\t\t// Enable logs to be sent to Sentry\n\t\tenableLogs: true,`;\n }\n\n return `import * as Sentry from '@sentry/cloudflare';\n\nexport default Sentry.withSentry(\n\t(env) => ({\n\t\tdsn: '${dsn}',${performanceOptions}${logsOptions}\n\t}),\n\t{\n\t\tasync fetch(request, env, ctx): Promise<Response> {\n\t\t\t// Your worker logic here\n\t\t\treturn new Response('Hello World!');\n\t\t},\n\t} satisfies ExportedHandler<Env>,\n);\n`;\n}\n\nexport function getCloudflareWorkerTemplateWithHandler(): string {\n return `export default {\n\tasync fetch(request, env, ctx): Promise<Response> {\n\t\tconst url = new URL(request.url);\n\t\tswitch (url.pathname) {\n\t\t\tcase '/message':\n\t\t\t\treturn new Response('Hello, World!');\n\t\t\tcase '/random':\n\t\t\t\treturn new Response(crypto.randomUUID());\n\t\t\tdefault:\n\t\t\t\treturn new Response('Not Found', { status: 404 });\n\t\t}\n\t},\n} satisfies ExportedHandler<Env>;\n`;\n}\n"]}
|