rork-xcode 0.4.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -204,20 +204,26 @@ declare class PbxprojBuildError extends Error {
204
204
  */
205
205
  declare const Isa: {
206
206
  readonly aggregateTarget: "PBXAggregateTarget";
207
+ readonly appleScriptBuildPhase: "PBXAppleScriptBuildPhase";
207
208
  readonly buildFile: "PBXBuildFile";
208
209
  readonly buildRule: "PBXBuildRule";
210
+ readonly buildStyle: "PBXBuildStyle";
209
211
  readonly containerItemProxy: "PBXContainerItemProxy";
210
212
  readonly copyFilesBuildPhase: "PBXCopyFilesBuildPhase";
211
213
  readonly fileReference: "PBXFileReference";
212
214
  readonly fileSystemSynchronizedBuildFileExceptionSet: "PBXFileSystemSynchronizedBuildFileExceptionSet";
215
+ readonly fileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet: "PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet";
213
216
  readonly fileSystemSynchronizedRootGroup: "PBXFileSystemSynchronizedRootGroup";
214
217
  readonly frameworksBuildPhase: "PBXFrameworksBuildPhase";
215
218
  readonly group: "PBXGroup";
219
+ readonly headersBuildPhase: "PBXHeadersBuildPhase";
216
220
  readonly legacyTarget: "PBXLegacyTarget";
217
221
  readonly nativeTarget: "PBXNativeTarget";
218
222
  readonly project: "PBXProject";
219
223
  readonly referenceProxy: "PBXReferenceProxy";
220
224
  readonly resourcesBuildPhase: "PBXResourcesBuildPhase";
225
+ readonly rezBuildPhase: "PBXRezBuildPhase";
226
+ readonly shellScriptBuildPhase: "PBXShellScriptBuildPhase";
221
227
  readonly sourcesBuildPhase: "PBXSourcesBuildPhase";
222
228
  readonly targetDependency: "PBXTargetDependency";
223
229
  readonly variantGroup: "PBXVariantGroup";
@@ -228,6 +234,16 @@ declare const Isa: {
228
234
  readonly swiftPackageProductDependency: "XCSwiftPackageProductDependency";
229
235
  readonly versionGroup: "XCVersionGroup";
230
236
  };
237
+ /**
238
+ * One of the `isa` names of the vocabulary, the union of the values of
239
+ * {@link Isa}.
240
+ */
241
+ type IsaValue = (typeof Isa)[keyof typeof Isa];
242
+ /**
243
+ * The `isa` names of the build phase kinds. The phase helpers on targets
244
+ * accept these, and the literal passed picks the phase class they return.
245
+ */
246
+ type BuildPhaseIsa = typeof Isa.appleScriptBuildPhase | typeof Isa.copyFilesBuildPhase | typeof Isa.frameworksBuildPhase | typeof Isa.headersBuildPhase | typeof Isa.resourcesBuildPhase | typeof Isa.rezBuildPhase | typeof Isa.shellScriptBuildPhase | typeof Isa.sourcesBuildPhase;
231
247
  /**
232
248
  * Product type identifiers of the targets the model creates or reasons
233
249
  * about. Other product types pass through untouched.
@@ -405,21 +421,31 @@ interface ReferenceProxyProperties extends PbxprojObject {
405
421
  sourceTree?: string;
406
422
  }
407
423
  /**
408
- * Properties shared by the `PBX*BuildPhase` kinds. Copy-files and
409
- * shell-script phases carry the destination and script keys. The standard
410
- * phases leave them absent.
424
+ * Properties shared by every `PBX*BuildPhase` kind.
411
425
  */
412
426
  interface BuildPhaseProperties extends PbxprojObject {
413
427
  buildActionMask?: number;
428
+ files?: string[];
429
+ name?: string;
430
+ runOnlyForDeploymentPostprocessing?: number;
431
+ }
432
+ /**
433
+ * Properties of a `PBXCopyFilesBuildPhase`, which adds the destination
434
+ * the files are copied to.
435
+ */
436
+ interface CopyFilesBuildPhaseProperties extends BuildPhaseProperties {
414
437
  dstPath?: string;
415
438
  dstSubfolderSpec?: number;
416
- files?: string[];
439
+ }
440
+ /**
441
+ * Properties of a `PBXShellScriptBuildPhase`, which adds the script, its
442
+ * interpreter, and the declared inputs and outputs.
443
+ */
444
+ interface ShellScriptBuildPhaseProperties extends BuildPhaseProperties {
417
445
  inputFileListPaths?: string[];
418
446
  inputPaths?: string[];
419
- name?: string;
420
447
  outputFileListPaths?: string[];
421
448
  outputPaths?: string[];
422
- runOnlyForDeploymentPostprocessing?: number;
423
449
  shellPath?: string;
424
450
  shellScript?: string;
425
451
  }
@@ -487,15 +513,25 @@ interface ContainerItemProxyProperties extends PbxprojObject {
487
513
  remoteInfo?: string;
488
514
  }
489
515
  /**
490
- * Properties of an `XCRemoteSwiftPackageReference` or
491
- * `XCLocalSwiftPackageReference`. Remote references carry the repository
492
- * and requirement. Local ones carry the relative path.
516
+ * Properties shared by the Swift package reference kinds. The remote and
517
+ * local interfaces below add their own keys.
493
518
  */
494
- interface SwiftPackageReferenceProperties extends PbxprojObject {
495
- relativePath?: string;
519
+ interface SwiftPackageReferenceProperties extends PbxprojObject {}
520
+ /**
521
+ * Properties of an `XCRemoteSwiftPackageReference`, which names a
522
+ * repository and a version requirement.
523
+ */
524
+ interface RemoteSwiftPackageReferenceProperties extends SwiftPackageReferenceProperties {
496
525
  repositoryURL?: string;
497
526
  requirement?: PbxprojObject;
498
527
  }
528
+ /**
529
+ * Properties of an `XCLocalSwiftPackageReference`, which names a package
530
+ * directory relative to the project.
531
+ */
532
+ interface LocalSwiftPackageReferenceProperties extends SwiftPackageReferenceProperties {
533
+ relativePath?: string;
534
+ }
499
535
  /**
500
536
  * Properties of an `XCSwiftPackageProductDependency`.
501
537
  */
@@ -504,14 +540,28 @@ interface SwiftPackageProductDependencyProperties extends PbxprojObject {
504
540
  productName?: string;
505
541
  }
506
542
  /**
507
- * Properties of a `PBXFileSystemSynchronizedBuildFileExceptionSet` or its
508
- * build-phase-membership variant.
543
+ * Properties shared by the synchronized-folder exception set kinds.
509
544
  */
510
545
  interface ExceptionSetProperties extends PbxprojObject {
511
- buildPhase?: string;
512
546
  membershipExceptions?: string[];
513
547
  target?: string;
514
548
  }
549
+ /**
550
+ * Properties of a
551
+ * `PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet`, which
552
+ * adds the build phase the listed files belong to.
553
+ */
554
+ interface BuildPhaseMembershipExceptionSetProperties extends ExceptionSetProperties {
555
+ buildPhase?: string;
556
+ }
557
+ /**
558
+ * Properties of a `PBXBuildStyle`, the pre-Xcode-2 predecessor of
559
+ * `XCBuildConfiguration` still found in old documents.
560
+ */
561
+ interface BuildStyleProperties extends PbxprojObject {
562
+ buildSettings?: BuildSettings;
563
+ name?: string;
564
+ }
515
565
  //#endregion
516
566
  //#region src/model/target.d.ts
517
567
  /**
@@ -526,15 +576,20 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
526
576
  * The target's name, when present.
527
577
  */
528
578
  get name(): string | undefined;
579
+ /**
580
+ * The view of the target's configuration list, when the reference
581
+ * resolves.
582
+ */
583
+ configurationList(): ConfigurationList | undefined;
529
584
  /**
530
585
  * The views of the target's build configurations, in list order.
531
586
  */
532
- buildConfigurations(): XcodeObject[];
587
+ buildConfigurations(): BuildConfiguration[];
533
588
  /**
534
- * The settings dictionary of the target's default configuration: the one
535
- * named by the list's `defaultConfigurationName`, falling back to the
536
- * first configuration. Returns `undefined` when the target has no
537
- * configurations or the default carries no settings dictionary.
589
+ * The settings dictionary of the target's default configuration, which
590
+ * is the one named by the list's `defaultConfigurationName`, falling
591
+ * back to the first configuration. Returns `undefined` when the target
592
+ * has no configurations or the default carries no settings dictionary.
538
593
  */
539
594
  defaultConfigurationSettings(): PbxprojObject | undefined;
540
595
  /**
@@ -558,29 +613,31 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
558
613
  */
559
614
  removeBuildSetting(key: string): void;
560
615
  /**
561
- * The views of the target's dependency objects
562
- * (`PBXTargetDependency`), in declaration order. Resolve a dependency's
563
- * target through its `target` property.
616
+ * The views of the target's dependencies, in declaration order. Resolve
617
+ * a dependency's target through {@link TargetDependency.target}.
564
618
  */
565
- dependencies(): XcodeObject[];
619
+ dependencies(): TargetDependency[];
566
620
  /**
567
621
  * The views of the target's build phases, in build order.
568
622
  */
569
623
  buildPhases(): BuildPhase[];
570
624
  /**
571
625
  * Finds the target's first build phase with the given isa, and, when
572
- * `name` is provided, the given display name.
626
+ * `name` is provided, the given display name. An isa literal of the
627
+ * vocabulary types the result, so `findBuildPhase(Isa.copyFilesBuildPhase)`
628
+ * gives a `CopyFilesBuildPhase | undefined`.
573
629
  */
574
- findBuildPhase(isa: string, name?: string): BuildPhase | undefined;
630
+ findBuildPhase<I extends string>(isa: I, name?: string): BuildPhaseOf<I> | undefined;
575
631
  /**
576
632
  * Returns the target's build phase with the given isa and properties,
577
633
  * creating and appending it when missing. The properties apply only on
578
- * creation; an existing phase is returned as is.
634
+ * creation. An existing phase is returned as is, already typed as the
635
+ * phase class the isa names.
579
636
  *
580
637
  * The match key is the isa plus the `name` property when one is given,
581
638
  * so differently named copy-files phases coexist.
582
639
  */
583
- ensureBuildPhase(isa: string, properties?: PbxprojObject): BuildPhase;
640
+ ensureBuildPhase<I extends BuildPhaseIsa>(isa: I, properties?: PbxprojObject): BuildPhaseOf<I>;
584
641
  /**
585
642
  * The target's shell-script phase with the given name, created with the
586
643
  * usual defaults (`/bin/sh`, empty input and output lists) when missing.
@@ -589,7 +646,7 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
589
646
  * @param name Display name of the phase, which is also its match key.
590
647
  * @param properties Phase properties, most usefully `shellScript`.
591
648
  */
592
- ensureShellScriptPhase(name: string, properties?: PbxprojObject): BuildPhase;
649
+ ensureShellScriptPhase(name: string, properties?: PbxprojObject): ShellScriptBuildPhase;
593
650
  /**
594
651
  * Adds a dependency on another target of the same project, wiring the
595
652
  * `PBXContainerItemProxy` and `PBXTargetDependency` pair Xcode uses to
@@ -597,13 +654,14 @@ declare class Target<Properties extends TargetProperties = TargetProperties> ext
597
654
  *
598
655
  * @returns The view of the target dependency object.
599
656
  */
600
- addDependency(dependency: Target): XcodeObject;
657
+ addDependency(dependency: Target): TargetDependency;
601
658
  }
602
659
  /**
603
660
  * A `PBXNativeTarget` is a product the project compiles and packages
604
661
  * itself, such as an application or an app extension.
605
662
  */
606
663
  declare class NativeTarget extends Target<NativeTargetProperties> {
664
+ static readonly isa: string | null;
607
665
  /**
608
666
  * The target's product type identifier, for example
609
667
  * `com.apple.product-type.application`.
@@ -618,7 +676,7 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
618
676
  * The view of the target's product file reference, when the target has
619
677
  * one.
620
678
  */
621
- get productReference(): XcodeObject | undefined;
679
+ get productReference(): FileReference | undefined;
622
680
  /**
623
681
  * Whether the target builds for watchOS, decided by its product type or
624
682
  * its watchOS deployment-target setting.
@@ -628,7 +686,7 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
628
686
  * The views of the target's Swift package product dependencies, in
629
687
  * declaration order.
630
688
  */
631
- packageProductDependencies(): XcodeObject[];
689
+ packageProductDependencies(): SwiftPackageProductDependency[];
632
690
  /**
633
691
  * The views of the target's file-system-synchronized folders, in
634
692
  * declaration order.
@@ -642,15 +700,15 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
642
700
  /**
643
701
  * The target's sources phase, created when missing.
644
702
  */
645
- ensureSourcesPhase(): BuildPhase;
703
+ ensureSourcesPhase(): SourcesBuildPhase;
646
704
  /**
647
705
  * The target's frameworks phase, created when missing.
648
706
  */
649
- ensureFrameworksPhase(): BuildPhase;
707
+ ensureFrameworksPhase(): FrameworksBuildPhase;
650
708
  /**
651
709
  * The target's resources phase, created when missing.
652
710
  */
653
- ensureResourcesPhase(): BuildPhase;
711
+ ensureResourcesPhase(): ResourcesBuildPhase;
654
712
  /**
655
713
  * Embeds another target's product into this target through the
656
714
  * copy-files phase its product type calls for ("Embed Foundation
@@ -664,7 +722,7 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
664
722
  * @returns The view of the embed phase, or `undefined` when the embedded
665
723
  * target has no product reference to embed.
666
724
  */
667
- embed(extension: NativeTarget): BuildPhase | undefined;
725
+ embed(extension: NativeTarget): CopyFilesBuildPhase | undefined;
668
726
  /**
669
727
  * The on-disk folder paths of the file-system-synchronized groups linked
670
728
  * to this target. Empty for targets without synchronized folders
@@ -699,7 +757,7 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
699
757
  addSwiftPackageProduct(options: {
700
758
  productName: string;
701
759
  packageReference: XcodeObject;
702
- }): XcodeObject;
760
+ }): SwiftPackageProductDependency;
703
761
  /**
704
762
  * Links a system framework (for example `Messages`) to this target. It
705
763
  * reuses or creates the file reference under the SDK's frameworks
@@ -709,19 +767,22 @@ declare class NativeTarget extends Target<NativeTargetProperties> {
709
767
  * @param name Framework name without the `.framework` suffix.
710
768
  * @returns The view of the framework's file reference.
711
769
  */
712
- addSystemFramework(name: string): XcodeObject;
770
+ addSystemFramework(name: string): FileReference;
713
771
  }
714
772
  /**
715
773
  * An aggregate target produces nothing itself. It exists to group other
716
774
  * targets through its dependencies and to run script or copy-files
717
775
  * phases, and the shared target surface covers everything it carries.
718
776
  */
719
- declare class AggregateTarget extends Target {}
777
+ declare class AggregateTarget extends Target {
778
+ static readonly isa: string | null;
779
+ }
720
780
  /**
721
781
  * A legacy target shells out to an external build tool such as make
722
782
  * instead of using Xcode's build system.
723
783
  */
724
784
  declare class LegacyTarget extends Target<LegacyTargetProperties> {
785
+ static readonly isa: string | null;
725
786
  /**
726
787
  * The build tool the target invokes, as an absolute path.
727
788
  */
@@ -740,11 +801,11 @@ declare class LegacyTarget extends Target<LegacyTargetProperties> {
740
801
  //#region src/model/objects.d.ts
741
802
  /**
742
803
  * A `PBXGroup` is a folder in Xcode's navigator, holding references to
743
- * files and other groups. Variant groups (`PBXVariantGroup`) share this
744
- * view. The type parameter lets subclasses carry a more specific property
745
- * shape.
804
+ * files and other groups. The type parameter lets subclasses carry a more
805
+ * specific property shape.
746
806
  */
747
807
  declare class Group<Properties extends GroupProperties = GroupProperties> extends XcodeObject<Properties> {
808
+ static readonly isa: string | null;
748
809
  /**
749
810
  * Ids of the group's children, in navigator order. Non-string entries of
750
811
  * a malformed document are skipped.
@@ -786,11 +847,21 @@ declare class Group<Properties extends GroupProperties = GroupProperties> extend
786
847
  */
787
848
  createFile(path: string): XcodeObject;
788
849
  }
850
+ /**
851
+ * A `PBXVariantGroup` holds the localized variants of one file, one child
852
+ * per language. Everything else behaves like a plain group.
853
+ */
854
+ declare class VariantGroup extends Group {
855
+ static readonly isa: string | null;
856
+ }
789
857
  /**
790
858
  * A build phase is an ordered list of build files processed by one step
791
- * of a target's build. Every `PBX*BuildPhase` kind shares this view.
859
+ * of a target's build. Every `PBX*BuildPhase` kind extends this view, and
860
+ * kinds without a class of their own still map here through the factory's
861
+ * suffix fallback. The type parameter lets subclasses carry a more
862
+ * specific property shape.
792
863
  */
793
- declare class BuildPhase extends XcodeObject<BuildPhaseProperties> {
864
+ declare class BuildPhase<Properties extends BuildPhaseProperties = BuildPhaseProperties> extends XcodeObject<Properties> {
794
865
  /**
795
866
  * The phase's display name, when it carries an explicit one. Xcode names
796
867
  * copy-files and shell-script phases; the standard phases derive their
@@ -831,13 +902,102 @@ declare class BuildPhase extends XcodeObject<BuildPhaseProperties> {
831
902
  ensureBuildFile(reference: XcodeObject, options?: {
832
903
  referenceKey?: "fileRef" | "productRef";
833
904
  settings?: Record<string, string[] | string>;
834
- }): XcodeObject;
905
+ }): BuildFile;
906
+ }
907
+ /**
908
+ * A `PBXSourcesBuildPhase` compiles the target's source files.
909
+ */
910
+ declare class SourcesBuildPhase extends BuildPhase {
911
+ static readonly isa: string | null;
912
+ }
913
+ /**
914
+ * A `PBXFrameworksBuildPhase` links the target against frameworks,
915
+ * libraries, and Swift package products.
916
+ */
917
+ declare class FrameworksBuildPhase extends BuildPhase {
918
+ static readonly isa: string | null;
919
+ }
920
+ /**
921
+ * A `PBXResourcesBuildPhase` copies the target's resources into the
922
+ * built product.
923
+ */
924
+ declare class ResourcesBuildPhase extends BuildPhase {
925
+ static readonly isa: string | null;
926
+ }
927
+ /**
928
+ * A `PBXHeadersBuildPhase` installs a framework target's headers with
929
+ * their public, private, or project visibility.
930
+ */
931
+ declare class HeadersBuildPhase extends BuildPhase {
932
+ static readonly isa: string | null;
933
+ }
934
+ /**
935
+ * A `PBXCopyFilesBuildPhase` copies its build files to a destination
936
+ * inside the built product, which is how extensions and watch apps embed.
937
+ */
938
+ declare class CopyFilesBuildPhase extends BuildPhase<CopyFilesBuildPhaseProperties> {
939
+ static readonly isa: string | null;
940
+ /**
941
+ * The destination path inside the folder `dstSubfolderSpec` selects,
942
+ * when present.
943
+ */
944
+ get dstPath(): string | undefined;
945
+ }
946
+ /**
947
+ * A `PBXShellScriptBuildPhase` runs a script during the build.
948
+ */
949
+ declare class ShellScriptBuildPhase extends BuildPhase<ShellScriptBuildPhaseProperties> {
950
+ static readonly isa: string | null;
951
+ /**
952
+ * The script's source text, when present.
953
+ */
954
+ get shellScript(): string | undefined;
955
+ /**
956
+ * The interpreter the script runs under, when present. Xcode's default
957
+ * is `/bin/sh`.
958
+ */
959
+ get shellPath(): string | undefined;
960
+ }
961
+ /**
962
+ * A `PBXRezBuildPhase` runs Rez, the classic Mac OS resource compiler,
963
+ * over `.r` files. Xcode's UI called it "Build Carbon Resources".
964
+ * Current Xcode no longer creates these phases, but old documents still
965
+ * carry them.
966
+ */
967
+ declare class RezBuildPhase extends BuildPhase {
968
+ static readonly isa: string | null;
969
+ }
970
+ /**
971
+ * A `PBXAppleScriptBuildPhase` compiles AppleScript sources. Current
972
+ * Xcode no longer creates these, but old documents still carry them.
973
+ */
974
+ declare class AppleScriptBuildPhase extends BuildPhase {
975
+ static readonly isa: string | null;
976
+ }
977
+ /**
978
+ * A `PBXBuildFile` places one file reference or package product inside
979
+ * one build phase, optionally with per-file settings.
980
+ */
981
+ declare class BuildFile extends XcodeObject<BuildFileProperties> {
982
+ static readonly isa: string | null;
983
+ /**
984
+ * The view of the file reference the build file points at, when it
985
+ * points at one. Build files for Swift package products carry a
986
+ * `productRef` instead; see {@link productDependency}.
987
+ */
988
+ fileReference(): XcodeObject | undefined;
989
+ /**
990
+ * The view of the Swift package product dependency the build file
991
+ * points at, when it points at one.
992
+ */
993
+ productDependency(): SwiftPackageProductDependency | undefined;
835
994
  }
836
995
  /**
837
996
  * A `PBXFileSystemSynchronizedRootGroup` is an Xcode 16 folder whose
838
997
  * members are synchronized from disk instead of listed individually.
839
998
  */
840
999
  declare class SyncRootGroup extends XcodeObject<SyncRootGroupProperties> {
1000
+ static readonly isa: string | null;
841
1001
  /**
842
1002
  * The group's on-disk folder path, when present.
843
1003
  */
@@ -860,13 +1020,51 @@ declare class SyncRootGroup extends XcodeObject<SyncRootGroupProperties> {
860
1020
  * @param membershipExceptions File names inside the folder to exclude.
861
1021
  * @returns The view of the target's exception set for this folder.
862
1022
  */
863
- addMembershipExceptions(target: NativeTarget, membershipExceptions: string[]): XcodeObject;
1023
+ addMembershipExceptions(target: NativeTarget, membershipExceptions: string[]): BuildFileExceptionSet;
1024
+ }
1025
+ /**
1026
+ * Behavior shared by the synchronized-folder exception set kinds, which
1027
+ * carve files out of a folder's automatic membership for one target. The
1028
+ * type parameter lets subclasses carry a more specific property shape.
1029
+ */
1030
+ declare class ExceptionSet<Properties extends ExceptionSetProperties = ExceptionSetProperties> extends XcodeObject<Properties> {
1031
+ /**
1032
+ * The file names the set excludes, in declaration order. Non-string
1033
+ * entries of a malformed document are skipped.
1034
+ */
1035
+ get membershipExceptions(): string[];
1036
+ /**
1037
+ * The view of the target whose membership the set restricts, when the
1038
+ * reference resolves.
1039
+ */
1040
+ target(): XcodeObject | undefined;
1041
+ }
1042
+ /**
1043
+ * A `PBXFileSystemSynchronizedBuildFileExceptionSet` excludes files from
1044
+ * a synchronized folder's automatic target membership.
1045
+ */
1046
+ declare class BuildFileExceptionSet extends ExceptionSet {
1047
+ static readonly isa: string | null;
1048
+ }
1049
+ /**
1050
+ * A `PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet`
1051
+ * assigns some of a synchronized folder's files to a different build
1052
+ * phase than the automatic one.
1053
+ */
1054
+ declare class BuildPhaseMembershipExceptionSet extends ExceptionSet<BuildPhaseMembershipExceptionSetProperties> {
1055
+ static readonly isa: string | null;
1056
+ /**
1057
+ * The view of the build phase the listed files belong to, when the
1058
+ * reference resolves.
1059
+ */
1060
+ buildPhase(): BuildPhase | undefined;
864
1061
  }
865
1062
  /**
866
1063
  * A `PBXBuildRule` tells a target which compiler or script processes a
867
1064
  * kind of file.
868
1065
  */
869
1066
  declare class BuildRule extends XcodeObject<BuildRuleProperties> {
1067
+ static readonly isa: string | null;
870
1068
  /**
871
1069
  * The rule's script, when it is a script rule rather than a reference
872
1070
  * to a compiler specification.
@@ -879,6 +1077,7 @@ declare class BuildRule extends XcodeObject<BuildRuleProperties> {
879
1077
  * `currentVersion` names the active one.
880
1078
  */
881
1079
  declare class VersionGroup extends Group<VersionGroupProperties> {
1080
+ static readonly isa: string | null;
882
1081
  /**
883
1082
  * The view of the active model version's file reference, when the group
884
1083
  * names one.
@@ -895,6 +1094,7 @@ declare class VersionGroup extends Group<VersionGroupProperties> {
895
1094
  * target or of the project, for example Debug or Release.
896
1095
  */
897
1096
  declare class BuildConfiguration extends XcodeObject<BuildConfigurationProperties> {
1097
+ static readonly isa: string | null;
898
1098
  /**
899
1099
  * The configuration's name, when present.
900
1100
  */
@@ -907,11 +1107,30 @@ declare class BuildConfiguration extends XcodeObject<BuildConfigurationPropertie
907
1107
  */
908
1108
  get buildSettings(): BuildSettings | undefined;
909
1109
  }
1110
+ /**
1111
+ * A `PBXBuildStyle` is the pre-Xcode-2 predecessor of
1112
+ * `XCBuildConfiguration`. Current Xcode neither creates nor reads them,
1113
+ * but old documents still carry them.
1114
+ */
1115
+ declare class BuildStyle extends XcodeObject<BuildStyleProperties> {
1116
+ static readonly isa: string | null;
1117
+ /**
1118
+ * The style's name, when present.
1119
+ */
1120
+ get name(): string | undefined;
1121
+ /**
1122
+ * The style's settings dictionary, or `undefined` when the style
1123
+ * carries none. The dictionary is live. Writes through it land in the
1124
+ * document.
1125
+ */
1126
+ get buildSettings(): BuildSettings | undefined;
1127
+ }
910
1128
  /**
911
1129
  * A `PBXFileReference` names one file on disk, from source files to the
912
1130
  * built products themselves.
913
1131
  */
914
1132
  declare class FileReference extends XcodeObject<FileReferenceProperties> {
1133
+ static readonly isa: string | null;
915
1134
  /**
916
1135
  * The reference's path, relative to its `sourceTree`, when present.
917
1136
  */
@@ -927,17 +1146,96 @@ declare class FileReference extends XcodeObject<FileReferenceProperties> {
927
1146
  * target dependency and the target it points at.
928
1147
  */
929
1148
  declare class ContainerItemProxy extends XcodeObject<ContainerItemProxyProperties> {
1149
+ static readonly isa: string | null;
930
1150
  /**
931
1151
  * The display name of the object the proxy points at, when present.
932
1152
  * For target dependencies this is the target's name.
933
1153
  */
934
1154
  get remoteInfo(): string | undefined;
935
1155
  }
1156
+ /**
1157
+ * A `PBXTargetDependency` records that one target must build before
1158
+ * another, through a container item proxy naming the prerequisite.
1159
+ */
1160
+ declare class TargetDependency extends XcodeObject<TargetDependencyProperties> {
1161
+ static readonly isa: string | null;
1162
+ /**
1163
+ * The view of the target this dependency points at, when the reference
1164
+ * resolves to one inside this document.
1165
+ */
1166
+ target(): XcodeObject | undefined;
1167
+ /**
1168
+ * The view of the dependency's container item proxy, when the reference
1169
+ * resolves.
1170
+ */
1171
+ targetProxy(): ContainerItemProxy | undefined;
1172
+ }
1173
+ /**
1174
+ * An `XCConfigurationList` owns the named build configurations of one
1175
+ * target or of the project, plus the default configuration choice.
1176
+ */
1177
+ declare class ConfigurationList extends XcodeObject<ConfigurationListProperties> {
1178
+ static readonly isa: string | null;
1179
+ /**
1180
+ * The name of the configuration builds use when none is specified, when
1181
+ * present.
1182
+ */
1183
+ get defaultConfigurationName(): string | undefined;
1184
+ /**
1185
+ * The views of the list's build configurations, in list order. Dangling
1186
+ * ids and objects of other kinds are skipped.
1187
+ */
1188
+ configurations(): BuildConfiguration[];
1189
+ }
1190
+ /**
1191
+ * Behavior shared by the Swift package reference kinds. The type
1192
+ * parameter lets subclasses carry a more specific property shape.
1193
+ */
1194
+ declare class SwiftPackageReference<Properties extends SwiftPackageReferenceProperties = SwiftPackageReferenceProperties> extends XcodeObject<Properties> {}
1195
+ /**
1196
+ * An `XCRemoteSwiftPackageReference` names a package repository and a
1197
+ * version requirement.
1198
+ */
1199
+ declare class RemoteSwiftPackageReference extends SwiftPackageReference<RemoteSwiftPackageReferenceProperties> {
1200
+ static readonly isa: string | null;
1201
+ /**
1202
+ * The package's repository URL, when present.
1203
+ */
1204
+ get repositoryURL(): string | undefined;
1205
+ }
1206
+ /**
1207
+ * An `XCLocalSwiftPackageReference` names a package directory relative
1208
+ * to the project.
1209
+ */
1210
+ declare class LocalSwiftPackageReference extends SwiftPackageReference<LocalSwiftPackageReferenceProperties> {
1211
+ static readonly isa: string | null;
1212
+ /**
1213
+ * The package's path relative to the project, when present.
1214
+ */
1215
+ get relativePath(): string | undefined;
1216
+ }
1217
+ /**
1218
+ * An `XCSwiftPackageProductDependency` links one product of a Swift
1219
+ * package to the target that consumes it.
1220
+ */
1221
+ declare class SwiftPackageProductDependency extends XcodeObject<SwiftPackageProductDependencyProperties> {
1222
+ static readonly isa: string | null;
1223
+ /**
1224
+ * The product's name as the package manifest declares it, when present.
1225
+ */
1226
+ get productName(): string | undefined;
1227
+ /**
1228
+ * The view of the package reference the product comes from, when the
1229
+ * reference resolves. Products of local packages can omit it.
1230
+ */
1231
+ packageReference(): SwiftPackageReference | undefined;
1232
+ }
936
1233
  /**
937
1234
  * A `PBXReferenceProxy` stands in for a product built by a target of
938
1235
  * another project referenced from this one.
939
1236
  */
940
1237
  declare class ReferenceProxy extends XcodeObject<ReferenceProxyProperties> {
1238
+ static readonly isa: string | null;
941
1239
  /**
942
1240
  * The proxy's product path inside the other project's build directory,
943
1241
  * when present.
@@ -947,7 +1245,7 @@ declare class ReferenceProxy extends XcodeObject<ReferenceProxyProperties> {
947
1245
  * The view of the container item proxy that names the remote target,
948
1246
  * when the reference resolves.
949
1247
  */
950
- remoteReference(): XcodeObject | undefined;
1248
+ remoteReference(): ContainerItemProxy | undefined;
951
1249
  }
952
1250
  //#endregion
953
1251
  //#region src/model/project.d.ts
@@ -956,6 +1254,7 @@ declare class ReferenceProxy extends XcodeObject<ReferenceProxyProperties> {
956
1254
  * the main group, and the project-level configurations.
957
1255
  */
958
1256
  declare class RootProject extends XcodeObject<RootProjectProperties> {
1257
+ static readonly isa: string | null;
959
1258
  /**
960
1259
  * Ids of the project's targets, in project order.
961
1260
  */
@@ -975,7 +1274,7 @@ declare class RootProject extends XcodeObject<RootProjectProperties> {
975
1274
  * The views of the project's Swift package references, remote and local,
976
1275
  * in declaration order.
977
1276
  */
978
- packageReferences(): XcodeObject[];
1277
+ packageReferences(): SwiftPackageReference[];
979
1278
  /**
980
1279
  * The group product references live in, creating it (and registering it
981
1280
  * as the project's `productRefGroup`) when missing.
@@ -1079,17 +1378,20 @@ declare class XcodeProject {
1079
1378
  */
1080
1379
  generateId(seed: string): string;
1081
1380
  /**
1082
- * Adds an object to the document and returns its view.
1381
+ * Adds an object to the document and returns its view. When the isa is
1382
+ * a literal of the vocabulary, the returned view is already the exact
1383
+ * class for it, so `add(Isa.fileReference, ...)` gives a `FileReference`
1384
+ * with no cast at the call site.
1083
1385
  *
1084
- * @param isa The object's kind; written as the `isa` property.
1386
+ * @param isa The object's kind, written as the `isa` property.
1085
1387
  * @param properties The object's remaining properties. The dictionary is
1086
1388
  * stored as passed (not copied), with `isa` written first so the
1087
1389
  * serialized entry leads with it.
1088
- * @param seed Seed for the deterministic id; defaults to the isa, which
1390
+ * @param seed Seed for the deterministic id. Defaults to the isa, which
1089
1391
  * is only sensible for singleton objects.
1090
1392
  * @returns The view of the created object.
1091
1393
  */
1092
- add(isa: string, properties: PbxprojObject, seed?: string): XcodeObject;
1394
+ add<I extends string>(isa: I, properties: PbxprojObject, seed?: string): ViewOf<I>;
1093
1395
  /**
1094
1396
  * The view of the document's root `PBXProject` object.
1095
1397
  *
@@ -1131,7 +1433,7 @@ declare class XcodeProject {
1131
1433
  /**
1132
1434
  * Finds the remote Swift package reference for a repository URL.
1133
1435
  */
1134
- findSwiftPackage(repositoryUrl: string): XcodeObject | undefined;
1436
+ findSwiftPackage(repositoryUrl: string): RemoteSwiftPackageReference | undefined;
1135
1437
  /**
1136
1438
  * Adds a remote Swift package reference and registers it on the project.
1137
1439
  * When the project already references the repository, the existing
@@ -1148,11 +1450,11 @@ declare class XcodeProject {
1148
1450
  addSwiftPackage(options: {
1149
1451
  repositoryURL: string;
1150
1452
  requirement: Record<string, string>;
1151
- }): XcodeObject;
1453
+ }): RemoteSwiftPackageReference;
1152
1454
  /**
1153
1455
  * Finds the local Swift package reference for a directory path.
1154
1456
  */
1155
- findLocalSwiftPackage(relativePath: string): XcodeObject | undefined;
1457
+ findLocalSwiftPackage(relativePath: string): LocalSwiftPackageReference | undefined;
1156
1458
  /**
1157
1459
  * Adds a local (path-based) Swift package reference and registers it on
1158
1460
  * the project, returning the existing reference when the path is already
@@ -1162,13 +1464,13 @@ declare class XcodeProject {
1162
1464
  * @param relativePath The package directory, relative to the project.
1163
1465
  * @returns The view of the package reference for the path.
1164
1466
  */
1165
- addLocalSwiftPackage(relativePath: string): XcodeObject;
1467
+ addLocalSwiftPackage(relativePath: string): LocalSwiftPackageReference;
1166
1468
  /**
1167
1469
  * The views of every `PBXBuildFile` that points at the referenced object
1168
1470
  * through `fileRef` or `productRef`. Useful for relocating a product
1169
1471
  * between copy phases.
1170
1472
  */
1171
- buildFilesReferencing(reference: XcodeObject): XcodeObject[];
1473
+ buildFilesReferencing(reference: XcodeObject): BuildFile[];
1172
1474
  /**
1173
1475
  * Validates the document's object graph and returns every problem
1174
1476
  * found. An empty array means the graph is structurally sound. The
@@ -1233,11 +1535,72 @@ declare class XcodeProject {
1233
1535
  */
1234
1536
  findFileReference(projectRelativePath: string): XcodeObject | undefined;
1235
1537
  /**
1236
- * Creates the typed view for an object, dispatching on its isa. Objects
1237
- * outside the typed vocabulary get the generic base view.
1538
+ * Creates the typed view for an object, dispatching on the isa each
1539
+ * view class declares. Unknown `PBX*BuildPhase` kinds still map to
1540
+ * {@link BuildPhase}, and everything else outside the vocabulary gets
1541
+ * the generic base view.
1238
1542
  */
1239
1543
  private createView;
1240
1544
  }
1545
+ /**
1546
+ * The view class for every isa of the vocabulary. The runtime registry
1547
+ * and the {@link ViewByIsa} type are both derived from this one object,
1548
+ * so the class an object routes to and the class its isa literal promises
1549
+ * are always the same. The `satisfies` clause keeps the object covering
1550
+ * the whole vocabulary, and the model tests check that every entry agrees
1551
+ * with its class's own `isa` declaration.
1552
+ */
1553
+ declare const VIEWS: {
1554
+ readonly PBXAggregateTarget: typeof AggregateTarget;
1555
+ readonly PBXAppleScriptBuildPhase: typeof AppleScriptBuildPhase;
1556
+ readonly XCBuildConfiguration: typeof BuildConfiguration;
1557
+ readonly PBXBuildFile: typeof BuildFile;
1558
+ readonly PBXBuildRule: typeof BuildRule;
1559
+ readonly PBXBuildStyle: typeof BuildStyle;
1560
+ readonly XCConfigurationList: typeof ConfigurationList;
1561
+ readonly PBXContainerItemProxy: typeof ContainerItemProxy;
1562
+ readonly PBXCopyFilesBuildPhase: typeof CopyFilesBuildPhase;
1563
+ readonly PBXFileReference: typeof FileReference;
1564
+ readonly PBXFileSystemSynchronizedBuildFileExceptionSet: typeof BuildFileExceptionSet;
1565
+ readonly PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet: typeof BuildPhaseMembershipExceptionSet;
1566
+ readonly PBXFileSystemSynchronizedRootGroup: typeof SyncRootGroup;
1567
+ readonly PBXFrameworksBuildPhase: typeof FrameworksBuildPhase;
1568
+ readonly PBXGroup: typeof Group;
1569
+ readonly PBXHeadersBuildPhase: typeof HeadersBuildPhase;
1570
+ readonly PBXLegacyTarget: typeof LegacyTarget;
1571
+ readonly XCLocalSwiftPackageReference: typeof LocalSwiftPackageReference;
1572
+ readonly PBXNativeTarget: typeof NativeTarget;
1573
+ readonly PBXProject: typeof RootProject;
1574
+ readonly PBXReferenceProxy: typeof ReferenceProxy;
1575
+ readonly XCRemoteSwiftPackageReference: typeof RemoteSwiftPackageReference;
1576
+ readonly PBXResourcesBuildPhase: typeof ResourcesBuildPhase;
1577
+ readonly PBXRezBuildPhase: typeof RezBuildPhase;
1578
+ readonly PBXShellScriptBuildPhase: typeof ShellScriptBuildPhase;
1579
+ readonly PBXSourcesBuildPhase: typeof SourcesBuildPhase;
1580
+ readonly XCSwiftPackageProductDependency: typeof SwiftPackageProductDependency;
1581
+ readonly PBXTargetDependency: typeof TargetDependency;
1582
+ readonly PBXVariantGroup: typeof VariantGroup;
1583
+ readonly XCVersionGroup: typeof VersionGroup;
1584
+ };
1585
+ /**
1586
+ * The view class each isa of the vocabulary maps to, as a type. Derived
1587
+ * from the same {@link VIEWS} object the runtime registry is built from,
1588
+ * which is what lets creation and lookup helpers return the exact class
1589
+ * for an isa literal instead of a base class the caller has to cast.
1590
+ */
1591
+ type ViewByIsa = { [I in keyof typeof VIEWS]: InstanceType<(typeof VIEWS)[I]> };
1592
+ /**
1593
+ * The view type an isa literal resolves to. Literals of the vocabulary
1594
+ * give the dedicated class, and anything else gives the generic
1595
+ * `XcodeObject`.
1596
+ */
1597
+ type ViewOf<I extends string> = I extends keyof ViewByIsa ? ViewByIsa[I] : XcodeObject;
1598
+ /**
1599
+ * The build phase view an isa literal resolves to. Isas outside the
1600
+ * vocabulary give the generic `BuildPhase`, matching the view factory's
1601
+ * suffix fallback.
1602
+ */
1603
+ type BuildPhaseOf<I extends string> = I extends keyof ViewByIsa ? Extract<ViewByIsa[I], BuildPhase> : BuildPhase;
1241
1604
  //#endregion
1242
1605
  //#region src/model/object.d.ts
1243
1606
  /**
@@ -1253,6 +1616,15 @@ declare class XcodeProject {
1253
1616
  * itself always reads through the narrowing accessors.
1254
1617
  */
1255
1618
  declare class XcodeObject<Properties extends PbxprojObject = PbxprojObject> {
1619
+ /**
1620
+ * The `isa` name this view class models. Each concrete view declares
1621
+ * its own, the factory registry routes objects of that isa to the
1622
+ * class, and the model tests keep the registry and these declarations
1623
+ * in agreement. Classes that only share behavior, like this base class
1624
+ * and the abstract target and phase bases, declare `null` and never
1625
+ * route.
1626
+ */
1627
+ static readonly isa: string | null;
1256
1628
  /** The project this object belongs to. */
1257
1629
  readonly project: XcodeProject;
1258
1630
  /** The object's 24-character identifier (its key in `objects`). */
@@ -1574,4 +1946,4 @@ declare function parseXcscheme(text: string): XcschemeDocument;
1574
1946
  */
1575
1947
  declare function generateObjectId(seed: string, existing: ReadonlySet<string>): string;
1576
1948
  //#endregion
1577
- export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, BuildConfiguration, type BuildConfigurationProperties, type BuildFileProperties, BuildPhase, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettings, BuildableReference, type ConfigurationListProperties, ContainerItemProxy, type ContainerItemProxyProperties, CopyFilesDestination, type CreateXcschemeOptions, type ExceptionSetProperties, FileReference, type FileReferenceProperties, Group, type GroupProperties, Isa, LegacyTarget, type LegacyTargetProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RootProject, type RootProjectProperties, type SwiftPackageProductDependencyProperties, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, type TargetDependencyProperties, type TargetProperties, VersionGroup, type VersionGroupProperties, XcodeModelError, XcodeObject, XcodeProject, Xcscheme, XcschemeBuildError, type XcschemeComment, type XcschemeDocument, type XcschemeElement, type XcschemeNode, XcschemeParseError, buildPbxproj, buildXcscheme, createXcscheme, generateObjectId, isXcschemeElement, parsePbxproj, parseXcscheme, xcschemeElements };
1949
+ export { type AddNativeTargetOptions, AggregateTarget, type ApplePlatform, AppleScriptBuildPhase, BuildConfiguration, type BuildConfigurationProperties, BuildFile, BuildFileExceptionSet, type BuildFileProperties, BuildPhase, type BuildPhaseIsa, BuildPhaseMembershipExceptionSet, type BuildPhaseMembershipExceptionSetProperties, type BuildPhaseOf, type BuildPhaseProperties, BuildRule, type BuildRuleProperties, type BuildSettings, BuildStyle, type BuildStyleProperties, BuildableReference, ConfigurationList, type ConfigurationListProperties, ContainerItemProxy, type ContainerItemProxyProperties, CopyFilesBuildPhase, type CopyFilesBuildPhaseProperties, CopyFilesDestination, type CreateXcschemeOptions, ExceptionSet, type ExceptionSetProperties, FileReference, type FileReferenceProperties, FrameworksBuildPhase, Group, type GroupProperties, HeadersBuildPhase, Isa, type IsaValue, LegacyTarget, type LegacyTargetProperties, LocalSwiftPackageReference, type LocalSwiftPackageReferenceProperties, NativeTarget, type NativeTargetProperties, type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, ProductType, type ProjectIssue, type ProjectIssueKind, ReferenceProxy, type ReferenceProxyProperties, RemoteSwiftPackageReference, type RemoteSwiftPackageReferenceProperties, ResourcesBuildPhase, RezBuildPhase, RootProject, type RootProjectProperties, ShellScriptBuildPhase, type ShellScriptBuildPhaseProperties, SourcesBuildPhase, SwiftPackageProductDependency, type SwiftPackageProductDependencyProperties, SwiftPackageReference, type SwiftPackageReferenceProperties, SyncRootGroup, type SyncRootGroupProperties, Target, TargetDependency, type TargetDependencyProperties, type TargetProperties, VariantGroup, VersionGroup, type VersionGroupProperties, type ViewByIsa, type ViewOf, XcodeModelError, XcodeObject, XcodeProject, Xcscheme, XcschemeBuildError, type XcschemeComment, type XcschemeDocument, type XcschemeElement, type XcschemeNode, XcschemeParseError, buildPbxproj, buildXcscheme, createXcscheme, generateObjectId, isXcschemeElement, parsePbxproj, parseXcscheme, xcschemeElements };