peachsim 0.1.2301 → 0.1.2303
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/cli/commands/inspect.ts +2 -1
- 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 +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +496 -312
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +447 -263
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +493 -309
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +4 -4
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +546 -362
- package/dist-lib/swift-compile.cjs +3 -17
- package/dist-lib/swift-compile.mjs +3 -16
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +75 -18
- package/dist-lib/vite.cjs +4 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +5 -20
- package/dist-types/packages/peach-engine/src/components/native-ui/webview-frame-bridge.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-arbitration-native.d.ts +15 -2
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +4 -0
- package/java-platform/licenses/fdlibm.txt +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Modules/module.modulemap +52 -0
- package/sdk/ios/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h +1 -1
- package/src/core-data-model.ts +92 -3
- package/src/expo-native-workspace.ts +111 -39
- package/src/one-sdk-preparation.ts +61 -5
- package/src/swift-compile.ts +1 -25
- package/src/swift-packages.ts +22 -1
package/src/core-data-model.ts
CHANGED
|
@@ -24,12 +24,27 @@ type Common = {
|
|
|
24
24
|
renaming: string
|
|
25
25
|
userInfo: UserInfo
|
|
26
26
|
}
|
|
27
|
+
// an NSDecimal: up to eight little-endian 16-bit mantissa words, length of them used
|
|
28
|
+
type Decimal = {
|
|
29
|
+
kind: 'decimal'
|
|
30
|
+
exponent: number
|
|
31
|
+
length: number
|
|
32
|
+
negative: boolean
|
|
33
|
+
compact: boolean
|
|
34
|
+
mantissa: Buffer
|
|
35
|
+
}
|
|
27
36
|
type Attribute = Common & {
|
|
28
37
|
kind: 'attribute'
|
|
29
38
|
transient: boolean
|
|
30
39
|
type: number
|
|
31
40
|
className: string | null
|
|
32
|
-
defaultValue:
|
|
41
|
+
defaultValue:
|
|
42
|
+
| string
|
|
43
|
+
| number
|
|
44
|
+
| boolean
|
|
45
|
+
| Decimal
|
|
46
|
+
| { kind: 'date'; time: number }
|
|
47
|
+
| null
|
|
33
48
|
transformer: string | null
|
|
34
49
|
flags: number
|
|
35
50
|
cloudEncryption: boolean
|
|
@@ -124,7 +139,56 @@ function userInfo(source: Source, owner: Tag): UserInfo {
|
|
|
124
139
|
: entries
|
|
125
140
|
}
|
|
126
141
|
|
|
142
|
+
// momc archives a decimal default as the NSDecimal its string scans to: a
|
|
143
|
+
// nonzero value compacts (1.50 is 15e-1, 100 is 1e2), a zero keeps its fraction
|
|
144
|
+
// digits uncompacted (0.00 is 0e-2) and a negative zero is plain zero.
|
|
145
|
+
function decimal(text: string): Decimal | null {
|
|
146
|
+
const match = /^([+-]?)(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(text)
|
|
147
|
+
if (!match) return null
|
|
148
|
+
const [, sign, whole = '', fraction = '', power] = match
|
|
149
|
+
if (whole + fraction === '') return null
|
|
150
|
+
let mantissa = BigInt(whole + fraction)
|
|
151
|
+
let exponent = Number(power ?? 0) - fraction.length
|
|
152
|
+
if (mantissa === 0n) {
|
|
153
|
+
if (power !== undefined) return null
|
|
154
|
+
const zero = {
|
|
155
|
+
kind: 'decimal' as const,
|
|
156
|
+
length: 0,
|
|
157
|
+
negative: false,
|
|
158
|
+
compact: false,
|
|
159
|
+
mantissa: Buffer.alloc(16),
|
|
160
|
+
}
|
|
161
|
+
return { ...zero, exponent: sign === '-' ? 0 : exponent }
|
|
162
|
+
}
|
|
163
|
+
while (mantissa % 10n === 0n) {
|
|
164
|
+
mantissa /= 10n
|
|
165
|
+
exponent++
|
|
166
|
+
}
|
|
167
|
+
if (mantissa >> 128n !== 0n || exponent < -128 || exponent > 127) return null
|
|
168
|
+
const words = Buffer.alloc(16)
|
|
169
|
+
let length = 0
|
|
170
|
+
for (let word = 0; word < 8; word++) {
|
|
171
|
+
const value = Number((mantissa >> BigInt(16 * word)) & 0xffffn)
|
|
172
|
+
words.writeUInt16LE(value, 2 * word)
|
|
173
|
+
if (value !== 0) length = word + 1
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
kind: 'decimal',
|
|
177
|
+
exponent,
|
|
178
|
+
length,
|
|
179
|
+
negative: sign === '-',
|
|
180
|
+
compact: true,
|
|
181
|
+
mantissa: words,
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
127
185
|
function defaultValue(model: string, member: Tag, type: string) {
|
|
186
|
+
const interval = member.attrs.defaultDateTimeInterval
|
|
187
|
+
// momc keeps a date default to the whole minute at or before it
|
|
188
|
+
if (type === 'Date' && interval !== undefined && Number.isFinite(Number(interval)))
|
|
189
|
+
return { kind: 'date' as const, time: Math.floor(Number(interval) / 60) * 60 }
|
|
190
|
+
if (interval !== undefined)
|
|
191
|
+
refuse(model, `${member.attrs.name} has the ${type} date interval ${interval}`)
|
|
128
192
|
const text = member.attrs.defaultValueString
|
|
129
193
|
if (text === undefined) return null
|
|
130
194
|
if (type.startsWith('Integer ') && /^-?\d+$/.test(text)) return Number(text)
|
|
@@ -132,6 +196,8 @@ function defaultValue(model: string, member: Tag, type: string) {
|
|
|
132
196
|
return Number(text)
|
|
133
197
|
if (type === 'Boolean' && (text === 'YES' || text === 'NO')) return text === 'YES'
|
|
134
198
|
if (type === 'String') return text
|
|
199
|
+
const scanned = type === 'Decimal' ? decimal(text) : null
|
|
200
|
+
if (scanned) return scanned
|
|
135
201
|
refuse(model, `${member.attrs.name} has the ${type} default ${JSON.stringify(text)}`)
|
|
136
202
|
}
|
|
137
203
|
|
|
@@ -150,6 +216,7 @@ function attribute(source: Source, member: Tag): Attribute {
|
|
|
150
216
|
'transient',
|
|
151
217
|
'attributeType',
|
|
152
218
|
'defaultValueString',
|
|
219
|
+
'defaultDateTimeInterval',
|
|
153
220
|
'usesScalarValueType',
|
|
154
221
|
'customClassName',
|
|
155
222
|
'valueTransformerName',
|
|
@@ -357,6 +424,14 @@ const classChains: Record<string, string[]> = {
|
|
|
357
424
|
NSArray: ['NSArray', 'NSObject'],
|
|
358
425
|
NSMutableArray: ['NSMutableArray', 'NSArray', 'NSObject'],
|
|
359
426
|
NSSet: ['NSSet', 'NSObject'],
|
|
427
|
+
NSDate: ['NSDate', 'NSObject'],
|
|
428
|
+
NSDecimalNumberPlaceholder: [
|
|
429
|
+
'NSDecimalNumberPlaceholder',
|
|
430
|
+
'NSDecimalNumber',
|
|
431
|
+
'NSNumber',
|
|
432
|
+
'NSValue',
|
|
433
|
+
'NSObject',
|
|
434
|
+
],
|
|
360
435
|
}
|
|
361
436
|
|
|
362
437
|
// the NSKeyedArchiver object table: objects reserve their slot first so the
|
|
@@ -409,6 +484,21 @@ class KeyedArchive {
|
|
|
409
484
|
}
|
|
410
485
|
}
|
|
411
486
|
|
|
487
|
+
function archiveDefault(archive: KeyedArchive, value: Attribute['defaultValue']) {
|
|
488
|
+
if (value === null) return NULL
|
|
489
|
+
if (typeof value !== 'object') return archive.add(value)
|
|
490
|
+
if (value.kind === 'date')
|
|
491
|
+
return archive.fill(archive.reserve(), 'NSDate', { 'NS.time': value.time })
|
|
492
|
+
return archive.fill(archive.reserve(), 'NSDecimalNumberPlaceholder', {
|
|
493
|
+
'NS.compact': value.compact,
|
|
494
|
+
'NS.exponent': value.exponent,
|
|
495
|
+
'NS.length': value.length,
|
|
496
|
+
'NS.mantissa': value.mantissa,
|
|
497
|
+
'NS.mantissa.bo': 1,
|
|
498
|
+
'NS.negative': value.negative,
|
|
499
|
+
})
|
|
500
|
+
}
|
|
501
|
+
|
|
412
502
|
function archiveModel(model: Model) {
|
|
413
503
|
const archive = new KeyedArchive()
|
|
414
504
|
const modelIndex = archive.reserve()
|
|
@@ -443,8 +533,7 @@ function archiveModel(model: Model) {
|
|
|
443
533
|
...shared,
|
|
444
534
|
NSAttributeType: property.type,
|
|
445
535
|
NSAttributeValueClassName: archive.string(property.className),
|
|
446
|
-
NSDefaultValue:
|
|
447
|
-
property.defaultValue === null ? NULL : archive.add(property.defaultValue),
|
|
536
|
+
NSDefaultValue: archiveDefault(archive, property.defaultValue),
|
|
448
537
|
NSFlagsKey: property.flags,
|
|
449
538
|
NSValueTransformerName: archive.string(property.transformer),
|
|
450
539
|
...(property.transient ? { NSIsTransient: true } : {}),
|
|
@@ -33,6 +33,30 @@ const isolatedGitEnv = {
|
|
|
33
33
|
GIT_CONFIG_SYSTEM: '/dev/null',
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
function cleanWorkspaceGitEnv(): NodeJS.ProcessEnv {
|
|
37
|
+
const env: NodeJS.ProcessEnv = { ...process.env }
|
|
38
|
+
for (const key of [
|
|
39
|
+
'GIT_DIR',
|
|
40
|
+
'GIT_COMMON_DIR',
|
|
41
|
+
'GIT_WORK_TREE',
|
|
42
|
+
'GIT_INDEX_FILE',
|
|
43
|
+
'GIT_OBJECT_DIRECTORY',
|
|
44
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
|
|
45
|
+
'GIT_PREFIX',
|
|
46
|
+
'GIT_SHALLOW_FILE',
|
|
47
|
+
'GIT_GRAFT_FILE',
|
|
48
|
+
'GIT_NAMESPACE',
|
|
49
|
+
'GIT_IMPLICIT_WORK_TREE',
|
|
50
|
+
'GIT_CONFIG',
|
|
51
|
+
'GIT_CEILING_DIRECTORIES',
|
|
52
|
+
'GIT_DISCOVERY_ACROSS_FILESYSTEM',
|
|
53
|
+
'GIT_SUPER_PREFIX',
|
|
54
|
+
]) {
|
|
55
|
+
delete env[key]
|
|
56
|
+
}
|
|
57
|
+
return { ...env, ...isolatedGitEnv }
|
|
58
|
+
}
|
|
59
|
+
|
|
36
60
|
// CocoaPods refuses a non UTF-8 locale, so even its version probe names one.
|
|
37
61
|
const utf8Env = { ...process.env, LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' }
|
|
38
62
|
|
|
@@ -75,13 +99,23 @@ const NATIVE_CONFIG_FILE =
|
|
|
75
99
|
// native sources steer pod install by existing, not by content: an edit to one
|
|
76
100
|
// is copied into the prepared workspace, an added or removed one rebuilds it.
|
|
77
101
|
const NATIVE_SOURCE_FILE = /\.(swift|mm?|hpp?|c|cc|cpp|kt|java)$/
|
|
102
|
+
|
|
103
|
+
// every load hashes each workspace byte; a file whose inode, size and both
|
|
104
|
+
// timestamps are unchanged keeps the digest of its last read.
|
|
105
|
+
type FileDigest = {
|
|
106
|
+
ino: number
|
|
107
|
+
size: number
|
|
108
|
+
mtimeMs: number
|
|
109
|
+
ctimeMs: number
|
|
110
|
+
digest: string
|
|
111
|
+
}
|
|
112
|
+
const fileDigests = new Map<string, FileDigest>()
|
|
78
113
|
const NATIVE_PACKAGE_ENTRY =
|
|
79
114
|
/^(ios|android|.*\.podspec|expo-module\.config\.json|react-native\.config\.[cm]?[jt]s|app\.plugin\.[cm]?js)$/
|
|
80
115
|
|
|
81
116
|
// every file the native prepare can read, plus the toolchain that reads it.
|
|
82
117
|
// node_modules stays out: the js install reconciles it with the hashed
|
|
83
118
|
// lockfiles, and the discovery cache keys the live native inventory separately.
|
|
84
|
-
// the walk yields so the bridge that runs it keeps answering its other requests.
|
|
85
119
|
export async function hashExpoWorkspace(app: string, signal?: AbortSignal) {
|
|
86
120
|
if (process.platform !== 'darwin') {
|
|
87
121
|
const source = await hashExpoSourceWorkspace(app, signal)
|
|
@@ -281,40 +315,78 @@ async function hashWorkspaceInputs(
|
|
|
281
315
|
relative === directory ||
|
|
282
316
|
relative.startsWith(directory + path.sep),
|
|
283
317
|
)
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
318
|
+
// the walk lists and stats synchronously: each await of an async walk queues
|
|
319
|
+
// behind the bridge's other native preparation, across tens of thousands of
|
|
320
|
+
// files. only content changed since its last read is read, overlapping.
|
|
321
|
+
const steps: (() => void)[] = []
|
|
322
|
+
const unread: { file: string; content: FileDigest }[] = []
|
|
323
|
+
const walk = (directory: string) => {
|
|
324
|
+
const entries = fs
|
|
325
|
+
.readdirSync(directory, { withFileTypes: true })
|
|
326
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
327
|
+
for (const entry of entries) {
|
|
287
328
|
signal?.throwIfAborted()
|
|
288
329
|
const file = path.join(directory, entry.name)
|
|
289
330
|
const relative = path.relative(root, file)
|
|
290
331
|
if (excluded(relative, entry.isDirectory())) continue
|
|
291
|
-
hash.update(`${relative}\0`)
|
|
332
|
+
steps.push(() => hash.update(`${relative}\0`))
|
|
292
333
|
if (entry.isSymbolicLink()) {
|
|
293
|
-
const link = `link\0${
|
|
294
|
-
|
|
295
|
-
|
|
334
|
+
const link = `link\0${fs.readlinkSync(file)}\0`
|
|
335
|
+
steps.push(() => {
|
|
336
|
+
hash.update(link)
|
|
337
|
+
if (steersNative(relative)) native.update(`${relative}\0${link}`)
|
|
338
|
+
})
|
|
296
339
|
} else if (entry.isDirectory()) {
|
|
297
|
-
hash.update('directory\0')
|
|
298
|
-
|
|
340
|
+
steps.push(() => hash.update('directory\0'))
|
|
341
|
+
walk(file)
|
|
299
342
|
} else if (entry.isFile()) {
|
|
300
343
|
const posix = relative.split(path.sep).join('/')
|
|
301
344
|
if (NATIVE_CONFIG_FILE.test(posix)) {
|
|
302
|
-
const bytes =
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
hash.update(`file\0${bytes.length}\0`).update(bytes)
|
|
310
|
-
}
|
|
311
|
-
if (NATIVE_SOURCE_FILE.test(posix) && steersNative(relative))
|
|
312
|
-
native.update(`${posix}\0`)
|
|
345
|
+
const bytes = fs.readFileSync(file)
|
|
346
|
+
steps.push(() => {
|
|
347
|
+
if (everyByte) hash.update(`file\0${bytes.length}\0`).update(bytes)
|
|
348
|
+
if (steersNative(relative))
|
|
349
|
+
native.update(`${posix}\0`).update(nativeConfigBytes(posix, bytes))
|
|
350
|
+
})
|
|
351
|
+
continue
|
|
313
352
|
}
|
|
353
|
+
if (everyByte) {
|
|
354
|
+
const stat = fs.statSync(file)
|
|
355
|
+
const known = fileDigests.get(file)
|
|
356
|
+
const content =
|
|
357
|
+
known?.ino === stat.ino &&
|
|
358
|
+
known.size === stat.size &&
|
|
359
|
+
known.mtimeMs === stat.mtimeMs &&
|
|
360
|
+
known.ctimeMs === stat.ctimeMs
|
|
361
|
+
? known
|
|
362
|
+
: {
|
|
363
|
+
ino: stat.ino,
|
|
364
|
+
size: stat.size,
|
|
365
|
+
mtimeMs: stat.mtimeMs,
|
|
366
|
+
ctimeMs: stat.ctimeMs,
|
|
367
|
+
digest: '',
|
|
368
|
+
}
|
|
369
|
+
if (content !== known) unread.push({ file, content })
|
|
370
|
+
steps.push(() => hash.update(`file\0${content.size}\0${content.digest}`))
|
|
371
|
+
}
|
|
372
|
+
if (NATIVE_SOURCE_FILE.test(posix) && steersNative(relative))
|
|
373
|
+
steps.push(() => native.update(`${posix}\0`))
|
|
314
374
|
}
|
|
315
375
|
}
|
|
316
376
|
}
|
|
317
|
-
|
|
377
|
+
walk(root)
|
|
378
|
+
for (let start = 0; start < unread.length; start += 32) {
|
|
379
|
+
signal?.throwIfAborted()
|
|
380
|
+
await Promise.all(
|
|
381
|
+
unread.slice(start, start + 32).map(async ({ file, content }) => {
|
|
382
|
+
const bytes = await fs.promises.readFile(file)
|
|
383
|
+
content.size = bytes.length
|
|
384
|
+
content.digest = createHash('sha256').update(bytes).digest('hex')
|
|
385
|
+
fileDigests.set(file, content)
|
|
386
|
+
}),
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
for (const step of steps) step()
|
|
318
390
|
if (sourceOnly) {
|
|
319
391
|
hash.update(`\0${appRelative}\0`)
|
|
320
392
|
return {
|
|
@@ -327,9 +399,14 @@ async function hashWorkspaceInputs(
|
|
|
327
399
|
}
|
|
328
400
|
// cocoapods and xcode exist only on a Mac; elsewhere only the prebuild stage runs
|
|
329
401
|
const execFileAsync = promisify(execFile)
|
|
330
|
-
const
|
|
402
|
+
const pinnedNode =
|
|
403
|
+
typeof manifest.engines?.node === 'string' &&
|
|
404
|
+
/^\d+(\.\d+){0,2}$/.test(manifest.engines.node)
|
|
405
|
+
? `node@${manifest.engines.node}`
|
|
406
|
+
: null
|
|
407
|
+
const [mac, node] = await Promise.all([
|
|
331
408
|
process.platform === 'darwin'
|
|
332
|
-
?
|
|
409
|
+
? Promise.all([
|
|
333
410
|
// runner-toolchain-platform: darwin
|
|
334
411
|
execFileAsync('pod', ['--version'], { env: utf8Env, signal }).catch(
|
|
335
412
|
(cause: unknown) => {
|
|
@@ -341,23 +418,18 @@ async function hashWorkspaceInputs(
|
|
|
341
418
|
// runner-toolchain-platform: darwin
|
|
342
419
|
execFileAsync('xcodebuild', ['-version'], { env: utf8Env, signal }),
|
|
343
420
|
]).then(([pod, xcode]) => ({ podVersion: pod.stdout, xcode: xcode.stdout }))
|
|
344
|
-
: {}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
421
|
+
: {},
|
|
422
|
+
execFileAsync(
|
|
423
|
+
pinnedNode ? 'mise' : 'node',
|
|
424
|
+
pinnedNode ? ['exec', pinnedNode, '--', 'node', '--version'] : ['--version'],
|
|
425
|
+
{ cwd: root, signal },
|
|
426
|
+
),
|
|
427
|
+
])
|
|
350
428
|
const toolchain = JSON.stringify({
|
|
351
429
|
preparation: 7,
|
|
352
430
|
appRelative,
|
|
353
431
|
...mac,
|
|
354
|
-
node: (
|
|
355
|
-
await execFileAsync(
|
|
356
|
-
pinnedNode ? 'mise' : 'node',
|
|
357
|
-
pinnedNode ? ['exec', pinnedNode, '--', 'node', '--version'] : ['--version'],
|
|
358
|
-
{ cwd: root, signal },
|
|
359
|
-
)
|
|
360
|
-
).stdout.trim(),
|
|
432
|
+
node: node.stdout.trim(),
|
|
361
433
|
packageManager: workspacePackageManager(root, manifest.packageManager, excluded),
|
|
362
434
|
podsEnvironment,
|
|
363
435
|
})
|
|
@@ -776,7 +848,7 @@ export async function prepareInstalledExpoWorkspace(app: string, work: string) {
|
|
|
776
848
|
function trackedSourceEntries(root: string, work: string): string[] {
|
|
777
849
|
const listed = spawnSync('git', ['ls-files', '--stage', '-z'], {
|
|
778
850
|
cwd: root,
|
|
779
|
-
env:
|
|
851
|
+
env: cleanWorkspaceGitEnv(),
|
|
780
852
|
maxBuffer: 256 * 1024 * 1024,
|
|
781
853
|
})
|
|
782
854
|
if (listed.status !== 0) return []
|
|
@@ -791,7 +863,7 @@ function trackedSourceEntries(root: string, work: string): string[] {
|
|
|
791
863
|
|
|
792
864
|
function initializeWorkspaceGit(root: string, work: string) {
|
|
793
865
|
requireNativeGit()
|
|
794
|
-
const env =
|
|
866
|
+
const env = cleanWorkspaceGitEnv()
|
|
795
867
|
execFileSync('git', ['init', '--quiet'], { cwd: work, env })
|
|
796
868
|
execFileSync(
|
|
797
869
|
'git',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
1
2
|
import { createHash } from 'node:crypto'
|
|
2
3
|
import fs from 'node:fs'
|
|
3
4
|
import { createRequire } from 'node:module'
|
|
5
|
+
import os from 'node:os'
|
|
4
6
|
import path from 'node:path'
|
|
5
7
|
import { pathToFileURL } from 'node:url'
|
|
6
8
|
import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
|
|
@@ -12,10 +14,61 @@ import {
|
|
|
12
14
|
|
|
13
15
|
interface SDKGenerator {
|
|
14
16
|
importedFrameworks(root: string): string[]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// the generator reads symbol graphs and runs compiler passes in this thread for
|
|
20
|
+
// minutes on a cold cache, and the dev bridge that serves every peach command
|
|
21
|
+
// calls it, so it runs in its own process.
|
|
22
|
+
const GENERATE_SCRIPT = `
|
|
23
|
+
import { writeFileSync } from 'node:fs'
|
|
24
|
+
import { pathToFileURL } from 'node:url'
|
|
25
|
+
const [generatorFile, resultFile, frameworks] = process.argv.slice(1)
|
|
26
|
+
const generator = await import(pathToFileURL(generatorFile).href)
|
|
27
|
+
const { files, generation } = await generator.generateAppSdk(JSON.parse(frameworks))
|
|
28
|
+
writeFileSync(resultFile, JSON.stringify({ generation, files: [...files] }))
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
async function generateAppSdkInChild(
|
|
32
|
+
generatorFile: string,
|
|
33
|
+
frameworks: string[],
|
|
34
|
+
): Promise<{ generation: string; files: Map<string, string> }> {
|
|
35
|
+
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'peach-one-sdk-'))
|
|
36
|
+
const resultFile = path.join(directory, 'result.json')
|
|
37
|
+
try {
|
|
38
|
+
const child = spawn(
|
|
39
|
+
'node',
|
|
40
|
+
[
|
|
41
|
+
'--input-type=module',
|
|
42
|
+
'-e',
|
|
43
|
+
GENERATE_SCRIPT,
|
|
44
|
+
generatorFile,
|
|
45
|
+
resultFile,
|
|
46
|
+
JSON.stringify(frameworks),
|
|
47
|
+
],
|
|
48
|
+
{ stdio: ['ignore', 'ignore', 'pipe'] },
|
|
49
|
+
)
|
|
50
|
+
let stderr = ''
|
|
51
|
+
child.stderr.setEncoding('utf8')
|
|
52
|
+
child.stderr.on('data', (chunk: string) => {
|
|
53
|
+
stderr += chunk
|
|
54
|
+
})
|
|
55
|
+
const [status, signal] = await new Promise<[number | null, NodeJS.Signals | null]>(
|
|
56
|
+
(resolve, reject) => {
|
|
57
|
+
child.once('error', reject)
|
|
58
|
+
child.once('close', (code, closeSignal) => resolve([code, closeSignal]))
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
if (status !== 0)
|
|
62
|
+
throw new Error(
|
|
63
|
+
`One SDK source generation failed (${signal ?? `exit ${status}`})${stderr ? `: ${stderr.trim().slice(-2000)}` : ''}`,
|
|
64
|
+
)
|
|
65
|
+
const result: { generation: string; files: [string, string][] } = JSON.parse(
|
|
66
|
+
fs.readFileSync(resultFile, 'utf8'),
|
|
67
|
+
)
|
|
68
|
+
return { generation: result.generation, files: new Map(result.files) }
|
|
69
|
+
} finally {
|
|
70
|
+
fs.rmSync(directory, { recursive: true, force: true })
|
|
71
|
+
}
|
|
19
72
|
}
|
|
20
73
|
|
|
21
74
|
export async function selectOneSDK(appRoot: string) {
|
|
@@ -88,7 +141,10 @@ export async function prepareOneSDKSources(appRoot: string, output?: string) {
|
|
|
88
141
|
fs.copyFileSync(path.join(published, name), path.join(directory, name))
|
|
89
142
|
return
|
|
90
143
|
}
|
|
91
|
-
const generated = await
|
|
144
|
+
const generated = await generateAppSdkInChild(
|
|
145
|
+
path.join(selected.one, 'dist/sdk/app.mjs'),
|
|
146
|
+
selected.frameworks,
|
|
147
|
+
)
|
|
92
148
|
if (generated.generation !== generation)
|
|
93
149
|
throw new Error('One SDK source generation differs from the installed facades')
|
|
94
150
|
fs.rmSync(directory, { recursive: true, force: true })
|
package/src/swift-compile.ts
CHANGED
|
@@ -2685,30 +2685,6 @@ export function lowerAVAssetURLCluster(source: string): string {
|
|
|
2685
2685
|
return out
|
|
2686
2686
|
}
|
|
2687
2687
|
|
|
2688
|
-
// NSValue(time:) boxes a CMTime struct, which the sdk's NSValue cluster
|
|
2689
|
-
// cannot encode (its concrete value traps on struct objCType strings), and
|
|
2690
|
-
// a convenience initializer cannot substitute the box subclass, so compiled
|
|
2691
|
-
// sources construct the landed NSStructBox through NSValue.boxedTime
|
|
2692
|
-
// instead; only the token changes, spacing and the argument list stay as
|
|
2693
|
-
// written. NSValue.boxedTime keeps the time: label for exactly this reason.
|
|
2694
|
-
// every other NSValue construction keeps its spelling: timeRange:,
|
|
2695
|
-
// timeMapping: and the struct-taking siblings stay on their trapping stubs,
|
|
2696
|
-
// the explicit .init(time:) spelling stays on the shim, and the sdk's own
|
|
2697
|
-
// NSValue(bytes:objCType:) still traps on struct encodings (the probe's
|
|
2698
|
-
// sdk-trap negative pins that wall as the one the box avoids).
|
|
2699
|
-
export function lowerNSValueTimeBox(source: string): string {
|
|
2700
|
-
const masked = swiftCodeMask(source)
|
|
2701
|
-
const pattern = /\bNSValue\s*\(\s*time\s*:/g
|
|
2702
|
-
const edits: [number, number, string][] = []
|
|
2703
|
-
let hit: RegExpExecArray | null
|
|
2704
|
-
while ((hit = pattern.exec(masked)) !== null)
|
|
2705
|
-
edits.push([hit.index, 'NSValue'.length, 'NSValue.boxedTime'])
|
|
2706
|
-
let out = source
|
|
2707
|
-
for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
|
|
2708
|
-
out = out.slice(0, at) + insert + out.slice(at + remove)
|
|
2709
|
-
return out
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
2688
|
export function swiftCodeMask(source: string): string {
|
|
2713
2689
|
const chars = source.split('')
|
|
2714
2690
|
const blank = (from: number, to: number): void => {
|
|
@@ -3525,7 +3501,7 @@ export function swiftSourceAsIOS(
|
|
|
3525
3501
|
continue
|
|
3526
3502
|
}
|
|
3527
3503
|
}
|
|
3528
|
-
return
|
|
3504
|
+
return lowerAVAssetURLCluster(out + conditioned.slice(copied))
|
|
3529
3505
|
}
|
|
3530
3506
|
|
|
3531
3507
|
// a native module's file closure includes referenced top-level declarations
|
package/src/swift-packages.ts
CHANGED
|
@@ -343,11 +343,32 @@ async function fetchCheckout(
|
|
|
343
343
|
if (preparedSwiftPin(checkouts, identity, pin.location, pin.revision)) return
|
|
344
344
|
requireNativeGit()
|
|
345
345
|
const key = checkoutKey(dir, pin)
|
|
346
|
+
const gitEnv: NodeJS.ProcessEnv = { ...process.env }
|
|
347
|
+
for (const name of [
|
|
348
|
+
'GIT_DIR',
|
|
349
|
+
'GIT_COMMON_DIR',
|
|
350
|
+
'GIT_WORK_TREE',
|
|
351
|
+
'GIT_INDEX_FILE',
|
|
352
|
+
'GIT_OBJECT_DIRECTORY',
|
|
353
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
|
|
354
|
+
'GIT_PREFIX',
|
|
355
|
+
'GIT_SHALLOW_FILE',
|
|
356
|
+
'GIT_GRAFT_FILE',
|
|
357
|
+
'GIT_NAMESPACE',
|
|
358
|
+
'GIT_IMPLICIT_WORK_TREE',
|
|
359
|
+
'GIT_CONFIG',
|
|
360
|
+
'GIT_CEILING_DIRECTORIES',
|
|
361
|
+
'GIT_DISCOVERY_ACROSS_FILESYSTEM',
|
|
362
|
+
'GIT_SUPER_PREFIX',
|
|
363
|
+
]) {
|
|
364
|
+
delete gitEnv[name]
|
|
365
|
+
}
|
|
366
|
+
gitEnv.GIT_TERMINAL_PROMPT = '0'
|
|
346
367
|
const git: Git = async (cwd, ...args) =>
|
|
347
368
|
(
|
|
348
369
|
await execFileAsync('git', ['-C', cwd, ...args], {
|
|
349
370
|
encoding: 'utf8',
|
|
350
|
-
env:
|
|
371
|
+
env: gitEnv,
|
|
351
372
|
signal,
|
|
352
373
|
})
|
|
353
374
|
).stdout.trim()
|