rork-xcode 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Rork, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # rork-xcode
2
+
3
+ [![CI](https://github.com/rorkai/rork-xcode/actions/workflows/ci.yml/badge.svg)](https://github.com/rorkai/rork-xcode/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/rork-xcode)](https://www.npmjs.com/package/rork-xcode)
5
+
6
+ The [fastest](#performance) zero-dependency Xcode project (`project.pbxproj`) parser and builder for any JavaScript runtime: browsers, Node.js, Bun, Electron, Cloudflare Workers, and React Native.
7
+
8
+ ```ts
9
+ import { parsePbxproj, buildPbxproj } from "rork-xcode";
10
+
11
+ const project = parsePbxproj(pbxprojText);
12
+
13
+ for (const [uuid, object] of Object.entries(project.objects)) {
14
+ if (object.isa === "PBXNativeTarget") {
15
+ console.log(uuid, object.name, object.productType);
16
+ }
17
+ }
18
+
19
+ const text = buildPbxproj(project); // byte-stable, Xcode-canonical layout
20
+ ```
21
+
22
+ ## Why
23
+
24
+ `project.pbxproj` is the heart of every Xcode project: targets, build phases, build settings, file references. Programs that create or repair Xcode projects increasingly run everywhere at once: an API on an edge runtime, a desktop app's Node process, a CLI inside a build sandbox.
25
+
26
+ `rork-xcode` is designed for exactly that situation:
27
+
28
+ - **Zero dependencies.** The pbxproj grammar is a small OpenStep-style property list dialect: dictionaries, arrays, strings, and hex data runs. A dedicated scanner covers it completely, with no general-purpose parser stack, no native addon, and no WASM blob.
29
+ - **One artifact, one code path.** A single ESM file with named exports. No environment-conditional entry points, no reliance on ambient globals like `Buffer`. What you test locally is what runs in production, whatever the bundler.
30
+ - **Xcode-canonical output.** The serializer reproduces the layout Xcode itself writes (tab indentation, per-isa object sections in sorted order, single-line build-file entries, and derived reference comments like `13B07F86… /* AppDelegate.swift in Sources */`), so diffs against Xcode-saved projects stay minimal and Xcode does not rewrite the file on next save.
31
+ - **Round-trip faithful.** Parse → build is byte-identical for Xcode-canonical documents and a fixed point for everything else. Lexical subtleties that plain number conversion would destroy (leading-zero values like `0755`, trailing-zero versions like `5.0`, digit runs longer than the double-precision safe range) are preserved as strings by design.
32
+ - **Loud failure modes.** Malformed documents fail with a typed error carrying line and column; unrepresentable values (`null`, booleans, non-finite numbers) fail with the exact path of the offending value. Nothing is silently dropped.
33
+
34
+ ## Install
35
+
36
+ ```sh
37
+ pnpm add rork-xcode
38
+ ```
39
+
40
+ ## API
41
+
42
+ ### `parsePbxproj(text)`
43
+
44
+ Parses a `project.pbxproj` document into plain JavaScript values. The leading `// !$*UTF8*$!` marker and all comments are treated as trivia.
45
+
46
+ | Source shape | JavaScript value |
47
+ | ------------------------------------------------------ | ---------------- |
48
+ | `{ key = value; ... }` | plain object |
49
+ | `( item, item, ... )` | array |
50
+ | unquoted number that prints back (`46`, `3.14`, `-12`) | `number` |
51
+ | `<48656c6c6f>` | `Uint8Array` |
52
+ | everything else | `string` |
53
+
54
+ An unquoted literal becomes a number exactly when the number formats back to the identical text, so serializing can never change a scalar's bytes: leading-zero values (`0755`), trailing-zero versions (`5.0`), bare-dot decimals (`.5`), and digit runs beyond double precision all stay strings. Dictionary keys keep document order. Quoted values are always strings, so `"46"` and `46` remain distinguishable.
55
+
56
+ ```ts
57
+ import { parsePbxproj, PbxprojParseError } from "rork-xcode";
58
+
59
+ try {
60
+ const project = parsePbxproj(text);
61
+ } catch (error) {
62
+ if (error instanceof PbxprojParseError) {
63
+ console.error(error.message); // "Expected ';' but found '}' (line 41, column 3)"
64
+ console.error(error.position); // { offset, line, column }
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### `buildPbxproj(root)`
70
+
71
+ Serializes a document back to pbxproj text. The input is the same shape `parsePbxproj` produces; any dictionary works, and documents carrying a root-level `objects` dictionary get the full Xcode layout treatment: sections grouped by `isa` and sorted, entries sorted by identifier, and reference comments derived from the object graph. Version-like build settings (`SWIFT_VERSION = 5.0`) arrive from the parser as strings and round-trip verbatim.
72
+
73
+ ```ts
74
+ import { buildPbxproj, PbxprojBuildError } from "rork-xcode";
75
+
76
+ try {
77
+ const text = buildPbxproj(project);
78
+ } catch (error) {
79
+ if (error instanceof PbxprojBuildError) {
80
+ console.error(error.message); // "Cannot serialize a null value… (at $.objects.AA10….name)"
81
+ console.error(error.path); // "$.objects.AA10….name"
82
+ }
83
+ }
84
+ ```
85
+
86
+ Booleans are rejected on purpose. The format has no boolean notation (Xcode models flags as the strings `"YES"` and `"NO"`), so writing one would produce a value Xcode misreads.
87
+
88
+ ## Performance
89
+
90
+ `rork-xcode` is measured against the pbxproj parsers on npm, [`@bacons/xcode`](https://www.npmjs.com/package/@bacons/xcode) (its `/json` parse/build entry point) and [`xcode`](https://www.npmjs.com/package/xcode) (the long-standing package used by native build tooling), on three documents: two real Xcode-written projects from the test suite and a deterministically generated five-target app with 800 source files. It is the fastest at both operations on every document, with zero dependencies.
91
+
92
+ <p align="center">
93
+ <img src="assets/performance.svg" alt="Benchmark chart comparing rork-xcode with the @bacons/xcode and xcode packages. Bars show time relative to rork-xcode as the geometric mean over three project documents. Parsing, @bacons/xcode takes 1.3 times as long and xcode 21 times. Building, xcode takes 1.6 times as long and @bacons/xcode 9 times." width="880" />
94
+ </p>
95
+
96
+ | Operation | Document | `rork-xcode` | `@bacons/xcode` | `xcode` |
97
+ | --------- | ----------------------- | ------------ | ---------------- | ---------------- |
98
+ | parse | legacy app (7 KiB) | **13.9 µs** | 17.8 µs (1.3×) | 297.7 µs (21.4×) |
99
+ | parse | app, Xcode 16 (20 KiB) | **43.7 µs** | 54.4 µs (1.2×) | 795.0 µs (18.2×) |
100
+ | parse | generated app (471 KiB) | **0.84 ms** | 1.20 ms (1.4×) | 19.74 ms (23.6×) |
101
+ | build | legacy app | **15.9 µs** | 43.1 µs (2.7×) | 29.6 µs (1.9×) |
102
+ | build | app, Xcode 16 | **37.5 µs** | 113.6 µs (3.0×) | 71.3 µs (1.9×) |
103
+ | build | generated app | **0.98 ms** | 85.98 ms (87.7×) | 1.20 ms (1.2×) |
104
+
105
+ Measured on an Apple M5 Max, Node.js 24, single thread, with `@bacons/xcode` 1.0.0-alpha.33 and `xcode` 3.0.1. Multipliers are relative to `rork-xcode` on the same row; the ordering also holds on Bun. Reproduce with `pnpm bench:compare`, which interleaves the libraries in round-robin batches and reports the median, after verifying that every library round-trips every fixture.
106
+
107
+ ### Key performance features
108
+
109
+ - **Single-pass scanner.** One cursor over the input string with table-driven character classification; no tokenizer stage, no intermediate token objects.
110
+ - **Comments skip in bulk.** Reference comments are a sizable share of a canonical document's bytes; comment bodies are jumped with `indexOf` instead of being scanned per character.
111
+ - **Linear comment derivation.** Building the `/* … */` annotations uses reverse indexes over the object graph (build file → phase, configuration list → owner), so serialization stays linear on projects with thousands of objects.
112
+ - **Memoized rendering.** Quoting decisions for the repeated key vocabulary and rendered uuid references are cached per document, halving the quote scans on reference-heavy sections.
113
+
114
+ ## Verification
115
+
116
+ - The committed fixture corpus spans project generations from Xcode 3 to Xcode 16, captured from real projects with identifiers neutralized: synchronized folders with both exception-set kinds, classic groups, variant groups, aggregate and legacy targets, reference proxies, build rules, Swift packages, and a ~100 KiB multiplatform framework project.
117
+ - Documents already in current Xcode's layout must round-trip byte for byte; documents from other tool generations must normalize to a byte-stable fixed point with unchanged values.
118
+ - On macOS, the suite cross-validates every fixture and its rebuilt form with `plutil`, Apple's own property list parser and the empirical ground truth for what Apple tooling accepts.
119
+ - A corpus sweep (`pnpm corpus`) walks every Xcode project on the machine, verifies each one parses and reaches a byte-stable fixed point, and cross-validates a sample of parsed values against plutil's own reading.
120
+ - CI runs the full gate on Linux and macOS, and executes the built artifact on the oldest supported Node to enforce the `engines` floor.
121
+
122
+ ## License
123
+
124
+ Apache-2.0
@@ -0,0 +1,155 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * The value model shared by {@link parsePbxproj} and {@link buildPbxproj}.
4
+ *
5
+ * `project.pbxproj` files are OpenStep-style property lists: dictionaries,
6
+ * arrays, strings, and hexadecimal data runs. The format carries no type
7
+ * markers beyond quoting, so the mapping is driven by lexical shape:
8
+ *
9
+ * - `{ key = value; ... }` parses to a {@link PbxprojObject}.
10
+ * - `( item, item, ... )` parses to a {@link PbxprojArray}.
11
+ * - `<48656c6c6f>` data runs parse to `Uint8Array`.
12
+ * - Unquoted integers and decimals (`46`, `3.14`, `-12`) parse to `number`
13
+ * under one print-back rule: the literal converts exactly when the number
14
+ * formats back to the identical text.
15
+ * - Everything else (quoted text, identifiers, uuids, paths) parses to
16
+ * `string`.
17
+ *
18
+ * The print-back rule is what keeps round-trips faithful: any literal the
19
+ * conversion would reshape stays a string, so serializing never changes a
20
+ * scalar's bytes. Leading-zero runs like `0755` would corrupt file modes,
21
+ * trailing-zero decimals like `5.0` would drop the zero build settings are
22
+ * written with, bare-dot decimals like `.5` would grow a leading zero, and
23
+ * digit runs beyond `Number.MAX_SAFE_INTEGER` would lose precision (a
24
+ * 24-character identifier can be all digits); all of these therefore parse
25
+ * as strings.
26
+ *
27
+ * @module
28
+ */
29
+ /**
30
+ * A value representable in a `project.pbxproj` document.
31
+ *
32
+ * Notably absent are booleans and null: the format has no notation for
33
+ * either, and Xcode models flags as the strings `"YES"` and `"NO"`.
34
+ */
35
+ type PbxprojValue = string | number | Uint8Array | PbxprojArray | PbxprojObject;
36
+ /**
37
+ * A `( ... )` list: an ordered array of values.
38
+ *
39
+ * This is a plain JavaScript array; the interface exists only to give the
40
+ * recursive {@link PbxprojValue} type a name.
41
+ */
42
+ interface PbxprojArray extends Array<PbxprojValue> {}
43
+ /**
44
+ * A `{ ... }` dictionary: a plain object whose keys appear in document order.
45
+ *
46
+ * Duplicate keys in a parsed document resolve to the last occurrence. A
47
+ * literal `__proto__` key is always stored as an own property, so parsing
48
+ * untrusted documents cannot pollute prototypes.
49
+ */
50
+ interface PbxprojObject {
51
+ [key: string]: PbxprojValue;
52
+ }
53
+ //#endregion
54
+ //#region src/build.d.ts
55
+ /**
56
+ * Serializes a project document to `project.pbxproj` text.
57
+ *
58
+ * The input is the same shape {@link parsePbxproj} produces; see the module
59
+ * documentation of `types.ts` for the value model. Output is stable: two
60
+ * calls with semantically equal documents produce identical text, and the
61
+ * layout matches what Xcode itself writes so diffs stay minimal.
62
+ *
63
+ * @param root The document root. Real project documents carry `objects`,
64
+ * `rootObject`, and the version fields, but any dictionary serializes.
65
+ * @returns The document text, terminated by a newline.
66
+ * @throws PbxprojBuildError when a value has no pbxproj representation:
67
+ * `null`, `undefined`, booleans, bigints, functions, symbols, class
68
+ * instances, or non-finite numbers. The error names the path of the
69
+ * offending value.
70
+ */
71
+ declare function buildPbxproj(root: PbxprojObject): string;
72
+ //#endregion
73
+ //#region src/errors.d.ts
74
+ /**
75
+ * Error types raised by this library.
76
+ *
77
+ * Both error classes are exported so callers can distinguish "the document is
78
+ * malformed" ({@link PbxprojParseError}) from "this value cannot be written"
79
+ * ({@link PbxprojBuildError}) and report precise context for each.
80
+ *
81
+ * @module
82
+ */
83
+ /**
84
+ * Location of a parse failure inside the source text.
85
+ *
86
+ * Offsets count UTF-16 code units from the start of the string (the same
87
+ * units `String.prototype.slice` uses), so editors and log tooling can jump
88
+ * straight to the failure.
89
+ */
90
+ interface PbxprojErrorPosition {
91
+ /** Zero-based character offset into the source string. */
92
+ offset: number;
93
+ /** One-based line number. */
94
+ line: number;
95
+ /** One-based column number, in characters from the start of the line. */
96
+ column: number;
97
+ }
98
+ /**
99
+ * Thrown when the source text is not a well-formed OpenStep-style property
100
+ * list (the format of `project.pbxproj` files).
101
+ *
102
+ * The message always embeds the line and column of the failure, and the same
103
+ * information is available in structured form on {@link position} for
104
+ * programmatic use.
105
+ */
106
+ declare class PbxprojParseError extends Error {
107
+ /** Where in the source text parsing failed. */
108
+ readonly position: PbxprojErrorPosition;
109
+ /**
110
+ * @param message Failure description without location; the location is
111
+ * appended automatically.
112
+ * @param source Full source text, used to compute the position.
113
+ * @param offset Character offset of the failure inside `source`.
114
+ */
115
+ constructor(message: string, source: string, offset: number);
116
+ }
117
+ /**
118
+ * Thrown when a value cannot be represented in a `project.pbxproj` document.
119
+ *
120
+ * Raised for `null`, `undefined`, booleans, bigints, functions, symbols,
121
+ * class instances, and non-finite numbers. The format itself has no boolean
122
+ * or null notation (Xcode models booleans as the strings `YES`/`NO`), so
123
+ * rejecting them loudly beats writing a value Xcode would misread. The
124
+ * {@link path} pinpoints the offending value inside the input, which matters
125
+ * when serializing a project with thousands of objects.
126
+ */
127
+ declare class PbxprojBuildError extends Error {
128
+ /** Path to the offending value from the root, e.g. `$.objects.13B07F86.name`. */
129
+ readonly path: string;
130
+ /**
131
+ * @param message Failure description without location; the value path is
132
+ * appended automatically.
133
+ * @param path Path to the offending value from the root, `$`.
134
+ */
135
+ constructor(message: string, path: string);
136
+ }
137
+ //#endregion
138
+ //#region src/parse.d.ts
139
+ /**
140
+ * Parses a `project.pbxproj` document into JavaScript values.
141
+ *
142
+ * Accepts the leading `// !$*UTF8*$!` marker and any other comments as
143
+ * trivia. Content after the root value is ignored. See the module
144
+ * documentation of `types.ts` for how source shapes map to JavaScript
145
+ * values.
146
+ *
147
+ * @param text Source text of the document.
148
+ * @returns The document's root value. For real project files this is the
149
+ * root dictionary with `objects`, `rootObject`, and version fields.
150
+ * @throws PbxprojParseError when the document is malformed; the error
151
+ * carries the line and column of the failure.
152
+ */
153
+ declare function parsePbxproj(text: string): PbxprojValue;
154
+ //#endregion
155
+ export { type PbxprojArray, PbxprojBuildError, type PbxprojErrorPosition, type PbxprojObject, PbxprojParseError, type PbxprojValue, buildPbxproj, parsePbxproj };