peachsim 0.1.2605 → 0.1.2606
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-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +711 -264
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-UNOYFUKI.mjs → acorn-UL7Z3WUQ.mjs} +3 -3
- package/dist-lib/esm-chunks/chunk-25LYRBSX.mjs +326 -0
- package/dist-lib/esm-chunks/{chunk-3XUIDCBF.mjs → chunk-34CIYRB7.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-RJCM34J7.mjs → chunk-5ANQR24T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GT54N3GG.mjs → chunk-5JMW5G3U.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YO756PYQ.mjs → chunk-66ESCMV3.mjs} +14 -16
- package/dist-lib/esm-chunks/{chunk-O55DZ2EL.mjs → chunk-B7AXR7WA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-M4G5YUO7.mjs → chunk-CPMK3DA6.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-AYHTHFG4.mjs → chunk-E2TASYAA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WSRPZF7M.mjs → chunk-EXB4QSQI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WB2EBX5Q.mjs → chunk-KWLQDES2.mjs} +1 -1
- package/dist-lib/esm-chunks/chunk-L7FPUZZO.mjs +32 -0
- package/dist-lib/esm-chunks/{chunk-FXONOT2L.mjs → chunk-MBCSJQRY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LFN7VAPB.mjs → chunk-O6NRI4T2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HHS4A7GI.mjs → chunk-O6ZNRBLB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B54SPDLA.mjs → chunk-OB5XSLW6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UPUOCALX.mjs → chunk-PLOV7VQQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-M3V4F5OV.mjs → chunk-QFASF6EH.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-7K33ENH6.mjs → chunk-RTPUFY2K.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-VRQPEROV.mjs → chunk-TVICD24H.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AST6VA7D.mjs → chunk-VTZJPPTE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LG76KUUO.mjs → chunk-WJKACRMG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6TE7WLSF.mjs → chunk-XUWYWP35.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-YRBZCLVD.mjs → metro-layout-parser-OMUFYOJI.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-S7KR6TKE.mjs → swift-package-prebuilt-X7EZCX34.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-3JNA7PCB.mjs → swift-sdk-app-module-E3IF2XPD.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-3P4IUP2A.mjs → swift-sdk-image-57YYLNU6.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-EA2RYBM4.mjs → swift-sdk-image-producer-DZOZTTDZ.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +710 -263
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +724 -277
- package/dist-lib/host/fetch-proxy-handler.cjs +43 -37
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +537 -246
- package/dist-lib/native-app-identity-project.mjs +218 -1828
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +327 -15
- package/dist-lib/plist.mjs +13 -5
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +82 -129
- package/dist-lib/public-origins-lib.json +69 -140
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +211 -3
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +740 -293
- package/dist-lib/swift-compile.cjs +3 -5
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/package.json +1 -6
- package/src/bazel-project.ts +1 -1
- package/src/expo-native-prebuilt.ts +1 -1
- package/src/expo-workspace-exclusion.ts +1 -1
- package/src/gitignore.ts +175 -0
- package/src/intent-definition/plist-reader.ts +22 -168
- package/src/plist-bytes.ts +144 -2
- package/src/plist.ts +359 -2
- package/src/swift-compile.ts +4 -6
- package/src/xcode-project.ts +1 -1
- package/dist-lib/esm-chunks/chunk-OW4VRQKO.mjs +0 -10993
- package/dist-lib/esm-chunks/chunk-ZSHGFGW7.mjs +0 -65
- package/dist-lib/vendor/@xmldom/xmldom.cjs +0 -6481
- package/dist-lib/vendor/bplist-parser.cjs +0 -1589
- package/dist-lib/vendor/ignore.cjs +0 -455
- package/dist-lib/vendor/plist.cjs +0 -10978
package/src/plist.ts
CHANGED
|
@@ -1,5 +1,362 @@
|
|
|
1
|
-
|
|
1
|
+
export type PlistValue =
|
|
2
|
+
| string
|
|
3
|
+
| number
|
|
4
|
+
| boolean
|
|
5
|
+
| Date
|
|
6
|
+
| Buffer
|
|
7
|
+
| PlistObject
|
|
8
|
+
| PlistArray
|
|
9
|
+
|
|
10
|
+
export type PlistObject = { [key: string]: PlistValue }
|
|
11
|
+
export type PlistArray = PlistValue[]
|
|
12
|
+
|
|
13
|
+
export interface ParseXmlPlistOptions {
|
|
14
|
+
strict?: boolean
|
|
15
|
+
onInteger?: (raw: string) => unknown
|
|
16
|
+
onReal?: (raw: string) => unknown
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const NAMED_ENTITIES: Record<string, string> = {
|
|
20
|
+
amp: '&',
|
|
21
|
+
lt: '<',
|
|
22
|
+
gt: '>',
|
|
23
|
+
quot: '"',
|
|
24
|
+
apos: "'",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function decodeXmlEntities(text: string): string {
|
|
28
|
+
if (!text.includes('&')) return text
|
|
29
|
+
return text.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (full, entity: string) => {
|
|
30
|
+
if (entity.startsWith('#x') || entity.startsWith('#X')) {
|
|
31
|
+
const code = Number.parseInt(entity.slice(2), 16)
|
|
32
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : full
|
|
33
|
+
}
|
|
34
|
+
if (entity.startsWith('#')) {
|
|
35
|
+
const code = Number.parseInt(entity.slice(1), 10)
|
|
36
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : full
|
|
37
|
+
}
|
|
38
|
+
return NAMED_ENTITIES[entity] ?? full
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function escapeXmlText(text: string): string {
|
|
43
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface XmlElementNode {
|
|
47
|
+
tag: string
|
|
48
|
+
children: XmlElementNode[]
|
|
49
|
+
text: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function parseXmlDocument(input: string): XmlElementNode {
|
|
53
|
+
const source = input.startsWith('\uFEFF') ? input.slice(1) : input
|
|
54
|
+
const len = source.length
|
|
55
|
+
let pos = 0
|
|
56
|
+
|
|
57
|
+
const skipIgnorable = () => {
|
|
58
|
+
while (pos < len) {
|
|
59
|
+
while (pos < len && /\s/.test(source[pos]!)) pos++
|
|
60
|
+
if (source.startsWith('<!--', pos)) {
|
|
61
|
+
const end = source.indexOf('-->', pos + 4)
|
|
62
|
+
if (end === -1) throw new Error('unterminated XML comment')
|
|
63
|
+
pos = end + 3
|
|
64
|
+
continue
|
|
65
|
+
}
|
|
66
|
+
if (source.startsWith('<?', pos)) {
|
|
67
|
+
const end = source.indexOf('?>', pos + 2)
|
|
68
|
+
if (end === -1) throw new Error('unterminated XML processing instruction')
|
|
69
|
+
pos = end + 2
|
|
70
|
+
continue
|
|
71
|
+
}
|
|
72
|
+
if (source.startsWith('<!DOCTYPE', pos)) {
|
|
73
|
+
pos += 9
|
|
74
|
+
let depth = 0
|
|
75
|
+
let quote = ''
|
|
76
|
+
while (pos < len) {
|
|
77
|
+
const ch = source[pos]!
|
|
78
|
+
pos++
|
|
79
|
+
if (quote) {
|
|
80
|
+
if (ch === quote) quote = ''
|
|
81
|
+
} else if (ch === '"' || ch === "'") {
|
|
82
|
+
quote = ch
|
|
83
|
+
} else if (ch === '[') {
|
|
84
|
+
depth++
|
|
85
|
+
} else if (ch === ']') {
|
|
86
|
+
depth = Math.max(0, depth - 1)
|
|
87
|
+
} else if (ch === '>' && depth === 0) {
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
continue
|
|
92
|
+
}
|
|
93
|
+
break
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const readElement = (): XmlElementNode => {
|
|
98
|
+
if (source[pos] !== '<') {
|
|
99
|
+
throw new Error(`expected XML tag at offset ${pos}`)
|
|
100
|
+
}
|
|
101
|
+
pos++
|
|
102
|
+
const nameStart = pos
|
|
103
|
+
while (pos < len && /[^\s/>]/.test(source[pos]!)) pos++
|
|
104
|
+
const tag = source.slice(nameStart, pos)
|
|
105
|
+
if (!tag) throw new Error(`empty XML tag name at offset ${nameStart}`)
|
|
106
|
+
|
|
107
|
+
// skip attributes until > or />
|
|
108
|
+
let quote = ''
|
|
109
|
+
let selfClosing = false
|
|
110
|
+
while (pos < len) {
|
|
111
|
+
const ch = source[pos]!
|
|
112
|
+
if (quote) {
|
|
113
|
+
pos++
|
|
114
|
+
if (ch === quote) quote = ''
|
|
115
|
+
continue
|
|
116
|
+
}
|
|
117
|
+
if (ch === '"' || ch === "'") {
|
|
118
|
+
quote = ch
|
|
119
|
+
pos++
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
if (ch === '/' && source[pos + 1] === '>') {
|
|
123
|
+
selfClosing = true
|
|
124
|
+
pos += 2
|
|
125
|
+
break
|
|
126
|
+
}
|
|
127
|
+
if (ch === '>') {
|
|
128
|
+
pos++
|
|
129
|
+
break
|
|
130
|
+
}
|
|
131
|
+
pos++
|
|
132
|
+
}
|
|
133
|
+
if (selfClosing) {
|
|
134
|
+
return { tag, children: [], text: '' }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const children: XmlElementNode[] = []
|
|
138
|
+
let text = ''
|
|
139
|
+
while (pos < len) {
|
|
140
|
+
if (source.startsWith('<!--', pos)) {
|
|
141
|
+
const end = source.indexOf('-->', pos + 4)
|
|
142
|
+
if (end === -1) throw new Error('unterminated XML comment')
|
|
143
|
+
pos = end + 3
|
|
144
|
+
continue
|
|
145
|
+
}
|
|
146
|
+
if (source.startsWith('<![CDATA[', pos)) {
|
|
147
|
+
const end = source.indexOf(']]>', pos + 9)
|
|
148
|
+
if (end === -1) throw new Error('unterminated CDATA section')
|
|
149
|
+
text += source.slice(pos + 9, end)
|
|
150
|
+
pos = end + 3
|
|
151
|
+
continue
|
|
152
|
+
}
|
|
153
|
+
if (source.startsWith('</', pos)) {
|
|
154
|
+
pos += 2
|
|
155
|
+
const closeStart = pos
|
|
156
|
+
while (pos < len && /[^\s>]/.test(source[pos]!)) pos++
|
|
157
|
+
const closeTag = source.slice(closeStart, pos)
|
|
158
|
+
while (pos < len && /\s/.test(source[pos]!)) pos++
|
|
159
|
+
if (source[pos] !== '>') throw new Error(`malformed closing tag </${closeTag}>`)
|
|
160
|
+
pos++
|
|
161
|
+
if (closeTag !== tag) {
|
|
162
|
+
throw new Error(`mismatched XML closing tag </${closeTag}> for <${tag}>`)
|
|
163
|
+
}
|
|
164
|
+
return { tag, children, text }
|
|
165
|
+
}
|
|
166
|
+
if (source[pos] === '<') {
|
|
167
|
+
children.push(readElement())
|
|
168
|
+
continue
|
|
169
|
+
}
|
|
170
|
+
const nextTag = source.indexOf('<', pos)
|
|
171
|
+
const end = nextTag === -1 ? len : nextTag
|
|
172
|
+
text += decodeXmlEntities(source.slice(pos, end))
|
|
173
|
+
pos = end
|
|
174
|
+
}
|
|
175
|
+
throw new Error(`unclosed XML tag <${tag}>`)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
skipIgnorable()
|
|
179
|
+
if (pos >= len) throw new Error('empty XML plist document')
|
|
180
|
+
return readElement()
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function parseXmlPlist(
|
|
184
|
+
source: string,
|
|
185
|
+
options: ParseXmlPlistOptions = {},
|
|
186
|
+
): unknown {
|
|
187
|
+
const root = parseXmlDocument(source)
|
|
188
|
+
if (root.tag !== 'plist') {
|
|
189
|
+
throw new Error(`expected <plist> root element, got <${root.tag}>`)
|
|
190
|
+
}
|
|
191
|
+
if (root.children.length === 0) {
|
|
192
|
+
if (options.strict) throw new Error('<plist> element has no root value')
|
|
193
|
+
return undefined
|
|
194
|
+
}
|
|
195
|
+
if (options.strict && root.children.length !== 1) {
|
|
196
|
+
throw new Error('<plist> element must contain exactly one root value')
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const leafText = (node: XmlElementNode): string => {
|
|
200
|
+
if (options.strict && node.children.length > 0) {
|
|
201
|
+
throw new Error(`<${node.tag}> must not contain child elements`)
|
|
202
|
+
}
|
|
203
|
+
return node.text
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const visit = (node: XmlElementNode): unknown => {
|
|
207
|
+
switch (node.tag) {
|
|
208
|
+
case 'dict': {
|
|
209
|
+
const result: Record<string, unknown> = {}
|
|
210
|
+
if (options.strict && node.children.length % 2 !== 0) {
|
|
211
|
+
throw new Error('<dict> must contain key/value pairs')
|
|
212
|
+
}
|
|
213
|
+
for (let i = 0; i + 1 < node.children.length; i += 2) {
|
|
214
|
+
const keyNode = node.children[i]!
|
|
215
|
+
if (keyNode.tag !== 'key') {
|
|
216
|
+
throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`)
|
|
217
|
+
}
|
|
218
|
+
result[leafText(keyNode)] = visit(node.children[i + 1]!)
|
|
219
|
+
}
|
|
220
|
+
return result
|
|
221
|
+
}
|
|
222
|
+
case 'array':
|
|
223
|
+
return node.children.map(visit)
|
|
224
|
+
case 'string':
|
|
225
|
+
return leafText(node)
|
|
226
|
+
case 'integer': {
|
|
227
|
+
const raw = leafText(node).trim()
|
|
228
|
+
if (options.onInteger) return options.onInteger(raw)
|
|
229
|
+
if (!raw) throw new Error('empty <integer> element')
|
|
230
|
+
return Number.parseInt(raw, 10)
|
|
231
|
+
}
|
|
232
|
+
case 'real': {
|
|
233
|
+
const raw = leafText(node).trim()
|
|
234
|
+
if (options.onReal) return options.onReal(raw)
|
|
235
|
+
if (!raw) throw new Error('empty <real> element')
|
|
236
|
+
return Number.parseFloat(raw)
|
|
237
|
+
}
|
|
238
|
+
case 'true':
|
|
239
|
+
return true
|
|
240
|
+
case 'false':
|
|
241
|
+
return false
|
|
242
|
+
case 'data':
|
|
243
|
+
return Buffer.from(leafText(node).replace(/\s+/g, ''), 'base64')
|
|
244
|
+
case 'date':
|
|
245
|
+
return new Date(leafText(node).trim())
|
|
246
|
+
default:
|
|
247
|
+
throw new Error(`unsupported plist element ${node.tag}`)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return visit(root.children[0]!)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function parsePlist(source: string): PlistValue {
|
|
255
|
+
const root = parseXmlDocument(source)
|
|
256
|
+
if (root.tag !== 'plist') {
|
|
257
|
+
throw new Error(`expected <plist> root element, got <${root.tag}>`)
|
|
258
|
+
}
|
|
259
|
+
if (root.children.length === 0) return {}
|
|
260
|
+
|
|
261
|
+
const visit = (node: XmlElementNode): PlistValue => {
|
|
262
|
+
switch (node.tag) {
|
|
263
|
+
case 'dict': {
|
|
264
|
+
const result: PlistObject = {}
|
|
265
|
+
for (let i = 0; i + 1 < node.children.length; i += 2) {
|
|
266
|
+
const keyNode = node.children[i]!
|
|
267
|
+
if (keyNode.tag !== 'key') {
|
|
268
|
+
throw new Error(`expected <key> in <dict>, got <${keyNode.tag}>`)
|
|
269
|
+
}
|
|
270
|
+
result[keyNode.text] = visit(node.children[i + 1]!)
|
|
271
|
+
}
|
|
272
|
+
return result
|
|
273
|
+
}
|
|
274
|
+
case 'array':
|
|
275
|
+
return node.children.map(visit)
|
|
276
|
+
case 'string':
|
|
277
|
+
return node.text
|
|
278
|
+
case 'integer': {
|
|
279
|
+
const raw = node.text.trim()
|
|
280
|
+
if (!raw) throw new Error('empty <integer> element')
|
|
281
|
+
return Number.parseInt(raw, 10)
|
|
282
|
+
}
|
|
283
|
+
case 'real': {
|
|
284
|
+
const raw = node.text.trim()
|
|
285
|
+
if (!raw) throw new Error('empty <real> element')
|
|
286
|
+
return Number.parseFloat(raw)
|
|
287
|
+
}
|
|
288
|
+
case 'true':
|
|
289
|
+
return true
|
|
290
|
+
case 'false':
|
|
291
|
+
return false
|
|
292
|
+
case 'data':
|
|
293
|
+
return Buffer.from(node.text.replace(/\s+/g, ''), 'base64')
|
|
294
|
+
case 'date':
|
|
295
|
+
return new Date(node.text.trim())
|
|
296
|
+
default:
|
|
297
|
+
throw new Error(`unsupported plist element ${node.tag}`)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return visit(root.children[0]!)
|
|
302
|
+
}
|
|
2
303
|
|
|
3
304
|
export function parsePlistSource(source: string): unknown {
|
|
4
|
-
return
|
|
305
|
+
return parseXmlPlist(source)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function renderValue(value: unknown, indent: string): string | null {
|
|
309
|
+
if (value === undefined || value === null) return null
|
|
310
|
+
if (typeof value === 'string') {
|
|
311
|
+
return `${indent}<string>${escapeXmlText(value)}</string>`
|
|
312
|
+
}
|
|
313
|
+
if (typeof value === 'boolean') {
|
|
314
|
+
return `${indent}${value ? '<true/>' : '<false/>'}`
|
|
315
|
+
}
|
|
316
|
+
if (typeof value === 'number') {
|
|
317
|
+
if (Number.isInteger(value) && !Object.is(value, -0)) {
|
|
318
|
+
return `${indent}<integer>${value}</integer>`
|
|
319
|
+
}
|
|
320
|
+
return `${indent}<real>${value}</real>`
|
|
321
|
+
}
|
|
322
|
+
if (value instanceof Date) {
|
|
323
|
+
return `${indent}<date>${value.toISOString().replace(/\.\d{3}Z$/, 'Z')}</date>`
|
|
324
|
+
}
|
|
325
|
+
if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
|
|
326
|
+
const encoded = Buffer.from(value).toString('base64')
|
|
327
|
+
return encoded ? `${indent}<data>${encoded}</data>` : `${indent}<data/>`
|
|
328
|
+
}
|
|
329
|
+
if (Array.isArray(value)) {
|
|
330
|
+
const items = value
|
|
331
|
+
.map((entry) => renderValue(entry, `${indent} `))
|
|
332
|
+
.filter((entry): entry is string => entry !== null)
|
|
333
|
+
if (items.length === 0) return `${indent}<array/>`
|
|
334
|
+
return `${indent}<array>\n${items.join('\n')}\n${indent}</array>`
|
|
335
|
+
}
|
|
336
|
+
if (typeof value === 'object') {
|
|
337
|
+
const lines: string[] = []
|
|
338
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
339
|
+
const rendered = renderValue(entry, `${indent} `)
|
|
340
|
+
if (rendered === null) continue
|
|
341
|
+
lines.push(`${indent} <key>${escapeXmlText(key)}</key>`)
|
|
342
|
+
lines.push(rendered)
|
|
343
|
+
}
|
|
344
|
+
if (lines.length === 0) return `${indent}<dict/>`
|
|
345
|
+
return `${indent}<dict>\n${lines.join('\n')}\n${indent}</dict>`
|
|
346
|
+
}
|
|
347
|
+
throw new Error(`unsupported plist value type: ${typeof value}`)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function buildPlist(value: PlistValue): string {
|
|
351
|
+
const body = renderValue(value, ' ')
|
|
352
|
+
return [
|
|
353
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
354
|
+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
355
|
+
'<plist version="1.0">',
|
|
356
|
+
...(body ? [body] : []),
|
|
357
|
+
'</plist>',
|
|
358
|
+
'',
|
|
359
|
+
].join('\n')
|
|
5
360
|
}
|
|
361
|
+
|
|
362
|
+
export { parsePlist as parse, buildPlist as build }
|
package/src/swift-compile.ts
CHANGED
|
@@ -5015,7 +5015,6 @@ export function writeSwiftProject(
|
|
|
5015
5015
|
(left, right) => right.path.length - left.path.length,
|
|
5016
5016
|
)
|
|
5017
5017
|
const targetsByDir = indexTargetsByDirectory(bySourcePath)
|
|
5018
|
-
const targetByName = new Map(targets.map((target) => [target.name, target]))
|
|
5019
5018
|
const nativeTargets = input.nativeTargets ?? []
|
|
5020
5019
|
const nativeTargetByName = new Map(nativeTargets.map((target) => [target.name, target]))
|
|
5021
5020
|
const nativeTargetIndex = new Map(
|
|
@@ -5099,10 +5098,6 @@ export function writeSwiftProject(
|
|
|
5099
5098
|
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot))
|
|
5100
5099
|
return checkedToolchain
|
|
5101
5100
|
}
|
|
5102
|
-
const deploymentTarget = (name: string) =>
|
|
5103
|
-
nativeTargetByName.get(name)?.deploymentTarget ??
|
|
5104
|
-
targetByName.get(name)?.iosDeploymentTarget ??
|
|
5105
|
-
null
|
|
5106
5101
|
const targetStagedFiles = new Map<string, Map<string, string | Buffer | undefined>>()
|
|
5107
5102
|
const stageTargetFile = (
|
|
5108
5103
|
target: string,
|
|
@@ -6476,7 +6471,10 @@ export function writeSwiftProject(
|
|
|
6476
6471
|
}
|
|
6477
6472
|
for (const target of targets) {
|
|
6478
6473
|
if (!target.executable && !reachesNative(target.name)) continue
|
|
6479
|
-
const version =
|
|
6474
|
+
const version =
|
|
6475
|
+
nativeTargetByName.get(target.name)?.deploymentTarget ??
|
|
6476
|
+
target.iosDeploymentTarget ??
|
|
6477
|
+
null
|
|
6480
6478
|
const minimum = iosDeploymentMinimum(version)
|
|
6481
6479
|
if (minimum === undefined)
|
|
6482
6480
|
throw new Error(
|
package/src/xcode-project.ts
CHANGED
|
@@ -12,11 +12,11 @@ import { createHash } from 'node:crypto'
|
|
|
12
12
|
import fs from 'node:fs'
|
|
13
13
|
import { createRequire } from 'node:module'
|
|
14
14
|
import path from 'node:path'
|
|
15
|
-
import plist from 'plist'
|
|
16
15
|
import { isBazelPackage, readBazelAppTarget } from './bazel-project'
|
|
17
16
|
import iosSdk from './ios-sdk-frameworks.json' with { type: 'json' }
|
|
18
17
|
import { isRecord } from './is-record'
|
|
19
18
|
import { readKeychainAccessGroups, readSiriEntitlement } from './native-app-identity'
|
|
19
|
+
import * as plist from './plist'
|
|
20
20
|
import {
|
|
21
21
|
POD_GRAPH_SPECIFICATIONS,
|
|
22
22
|
readPodGraphSpecifications,
|