peachsim 0.1.2439 → 0.1.2441

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.
Files changed (143) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +8180 -8397
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-FGE4PYDJ.mjs → acorn-FRQNHKFC.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-HIDNO3RP.mjs → chunk-4BZ3Z3IQ.mjs} +18 -18
  28. package/dist-lib/esm-chunks/{chunk-5T4XBUJP.mjs → chunk-4HEUXQGM.mjs} +4 -4
  29. package/dist-lib/esm-chunks/{chunk-7HANEMO4.mjs → chunk-4ZRMJ5YO.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-4ZFNH7TU.mjs → chunk-6A6JEVIF.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-KVTIDLBK.mjs → chunk-ABMB3G7I.mjs} +3 -3
  32. package/dist-lib/esm-chunks/{chunk-C3WBGYP6.mjs → chunk-BAYRN7ZL.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-KSQ5KM5Y.mjs → chunk-DJMWTW2B.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-DADGQELM.mjs → chunk-IRMC5BCX.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-YB27R6JG.mjs → chunk-NPLEBOWJ.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-HSADZOVN.mjs → chunk-O4EOBXAP.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-JCKI3VZ6.mjs → chunk-ORYS5CC4.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-2NPABFPN.mjs → chunk-PMGJ7FLI.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-6VY6HTJC.mjs → chunk-QUBR7LHU.mjs} +2036 -1918
  40. package/dist-lib/esm-chunks/{chunk-IWJUYJQO.mjs → chunk-QYYJESMK.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-CVGDRROP.mjs → chunk-VAQJQDWI.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-DEGYKHN7.mjs → chunk-VCAJFWZD.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-2EUHEBIJ.mjs → chunk-XO5GX4PI.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-MIQSRBVU.mjs → chunk-ZCMAKWHN.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{metro-layout-parser-MVUAXRUJ.mjs → metro-layout-parser-AUAVE5VL.mjs} +3 -3
  46. package/dist-lib/expo-swift-bundle.cjs +5580 -5768
  47. package/dist-lib/expo-swift-metadata.cjs +1 -1
  48. package/dist-lib/expo-swift-metadata.mjs +7 -7
  49. package/dist-lib/home-paths.cjs +1 -1
  50. package/dist-lib/host/bridge-host.cjs +6332 -6500
  51. package/dist-lib/host/fetch-proxy-handler.cjs +13891 -13919
  52. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  53. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  54. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  55. package/dist-lib/host/websocket-proxy.cjs +1 -1
  56. package/dist-lib/index.cjs +1 -1
  57. package/dist-lib/jump-to-source-babel.cjs +1 -1
  58. package/dist-lib/jump-to-source-native.cjs +1 -1
  59. package/dist-lib/kotlin-host.cjs +1 -1
  60. package/dist-lib/menu.cjs +1 -1
  61. package/dist-lib/menu.mjs +3 -3
  62. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  63. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  64. package/dist-lib/metro-production-bundle.cjs +1 -1
  65. package/dist-lib/metro-production-bundle.mjs +4 -4
  66. package/dist-lib/native-app-identity-project.cjs +784 -536
  67. package/dist-lib/native-app-identity-project.mjs +543 -408
  68. package/dist-lib/native-app-identity.cjs +1 -1
  69. package/dist-lib/native-app-identity.mjs +6 -6
  70. package/dist-lib/native-firebase-metadata.cjs +1 -1
  71. package/dist-lib/native-firebase-metadata.mjs +3 -3
  72. package/dist-lib/pdfium-raster.cjs +1 -1
  73. package/dist-lib/pdfium-raster.mjs +2 -2
  74. package/dist-lib/plist.cjs +1 -1
  75. package/dist-lib/plist.mjs +3 -3
  76. package/dist-lib/profiles.cjs +1 -1
  77. package/dist-lib/public-brand.cjs +1 -1
  78. package/dist-lib/public-origins-lib-esm.json +81 -79
  79. package/dist-lib/public-origins-lib.json +185 -195
  80. package/dist-lib/react-native-host-modules.cjs +1 -1
  81. package/dist-lib/react-native-host-modules.mjs +2 -2
  82. package/dist-lib/reap-browser.cjs +1 -1
  83. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  84. package/dist-lib/sdk.cjs +1 -1
  85. package/dist-lib/sdk.mjs +7 -7
  86. package/dist-lib/skills.cjs +7579 -7758
  87. package/dist-lib/swift-compile.cjs +1978 -1922
  88. package/dist-lib/swift-compile.mjs +8 -8
  89. package/dist-lib/swift-package.cjs +1 -1
  90. package/dist-lib/swift-package.mjs +3 -3
  91. package/dist-lib/swift-submit.cjs +1 -1
  92. package/dist-lib/swift-submit.mjs +5 -5
  93. package/dist-lib/swift-toolchain.cjs +3 -1
  94. package/dist-lib/swift.cjs +1 -1
  95. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  96. package/dist-lib/vendor/acorn.cjs +1 -1
  97. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  98. package/dist-lib/vendor/ignore.cjs +1 -1
  99. package/dist-lib/vendor/magic-string.cjs +1 -1
  100. package/dist-lib/vendor/plist.cjs +17 -17
  101. package/dist-lib/vendor/smol-toml.cjs +1 -1
  102. package/dist-lib/vendor/stream-json.cjs +1 -1
  103. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  104. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  105. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  106. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  107. package/dist-lib/vendor/sucrase.cjs +1 -1
  108. package/dist-lib/vendor/terser.cjs +1 -1
  109. package/dist-lib/vendor/valibot.cjs +1 -1
  110. package/dist-lib/vendor/zod.cjs +1 -1
  111. package/dist-lib/worklet-executable.cjs +1 -1
  112. package/dist-lib/worklet-executable.mjs +3 -3
  113. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +4 -0
  114. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  115. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
  116. package/package.json +1 -1
  117. package/runtime-companion.json +1 -1
  118. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDateComponentsFormatter.h +1 -1
  119. package/src/expo-discovery-cache.ts +9 -45
  120. package/src/expo-native-compiler-digest.ts +8 -0
  121. package/src/expo-native-prebuilt.ts +1 -10
  122. package/src/expo-native-workspace.ts +5 -120
  123. package/src/expo-pod-prebuilt.ts +1 -1
  124. package/src/expo-swift-host.ts +48 -35
  125. package/src/host/bridge-host.ts +2 -0
  126. package/src/installed-native-libraries.ts +10 -20
  127. package/src/native-slices.ts +1 -1
  128. package/src/pod-graph-specifications.ts +11 -0
  129. package/src/pods-install.ts +10 -7
  130. package/src/podspec-cocoapods.ts +8 -3
  131. package/src/podspec-sources.ts +19 -15
  132. package/src/swift-clang-type-ownership.ts +118 -0
  133. package/src/swift-compile.ts +20 -12
  134. package/src/swift-guest-image-ledger.ts +48 -0
  135. package/src/swift-guest-link.ts +11 -1
  136. package/src/swift-host.ts +7 -8
  137. package/src/swift-package-manifest.ts +13 -8
  138. package/src/swift-packages.ts +0 -5
  139. package/src/swift-toolchain.ts +1 -1
  140. package/src/xcode-project.ts +64 -46
  141. package/src/portable-expo-contract.ts +0 -108
  142. package/src/portable-expo-workspace.ts +0 -100
  143. package/src/prepared-xcode-phases.ts +0 -194
@@ -1,108 +0,0 @@
1
- import { createHash } from 'node:crypto'
2
- import fs from 'node:fs'
3
- import path from 'node:path'
4
- import { z } from 'zod'
5
- import { isRecord } from './is-record'
6
- import { podspecReceiptSchema, type PodspecReceipt } from './podspec-sources'
7
- import type { PreparedSwiftPin, PreparedXcodePhase } from './prepared-xcode-phases'
8
-
9
- export interface PortableExpoWorkspaceManifest {
10
- format: 'peach-expo-workspace-v1'
11
- sourceHash: string
12
- configHash: string
13
- archiveHash: string
14
- checkoutsArchiveHash: string
15
- interfacesArchiveHash: string
16
- interfacesHash: string
17
- producerRoot: string
18
- swiftDistribution: string
19
- selected: string[]
20
- inventory: { name: string; sha256: string }[]
21
- app: string
22
- workspace: string
23
- interfaces: string
24
- checkouts: string
25
- pins: PreparedSwiftPin[]
26
- phases: PreparedXcodePhase[]
27
- podspecs: PodspecReceipt[]
28
- }
29
-
30
- const digest = (value: unknown): value is string =>
31
- typeof value === 'string' && /^[a-f0-9]{64}$/.test(value)
32
-
33
- function isManifest(
34
- value: unknown,
35
- ): value is Omit<PortableExpoWorkspaceManifest, 'podspecs'> & { podspecs: unknown } {
36
- return (
37
- isRecord(value) &&
38
- value.format === 'peach-expo-workspace-v1' &&
39
- digest(value.sourceHash) &&
40
- digest(value.configHash) &&
41
- digest(value.archiveHash) &&
42
- digest(value.checkoutsArchiveHash) &&
43
- digest(value.interfacesArchiveHash) &&
44
- digest(value.interfacesHash) &&
45
- typeof value.producerRoot === 'string' &&
46
- path.isAbsolute(value.producerRoot) &&
47
- typeof value.swiftDistribution === 'string' &&
48
- typeof value.app === 'string' &&
49
- typeof value.workspace === 'string' &&
50
- typeof value.interfaces === 'string' &&
51
- typeof value.checkouts === 'string' &&
52
- Array.isArray(value.pins) &&
53
- value.pins.every(
54
- (pin) =>
55
- isRecord(pin) &&
56
- typeof pin.identity === 'string' &&
57
- /^[a-z0-9][a-z0-9._-]*$/.test(pin.identity) &&
58
- !pin.identity.includes('..') &&
59
- typeof pin.location === 'string' &&
60
- typeof pin.revision === 'string' &&
61
- /^[a-f0-9]{40,64}$/.test(pin.revision),
62
- ) &&
63
- Array.isArray(value.selected) &&
64
- value.selected.every((item) => typeof item === 'string') &&
65
- Array.isArray(value.inventory) &&
66
- value.inventory.every(
67
- (item) => isRecord(item) && typeof item.name === 'string' && digest(item.sha256),
68
- ) &&
69
- Array.isArray(value.phases) &&
70
- value.phases.every(
71
- (phase) =>
72
- isRecord(phase) &&
73
- typeof phase.project === 'string' &&
74
- typeof phase.target === 'string' &&
75
- typeof phase.phase === 'string' &&
76
- typeof phase.configuration === 'string' &&
77
- Array.isArray(phase.outputs) &&
78
- phase.outputs.every(
79
- (item) =>
80
- isRecord(item) &&
81
- typeof item.path === 'string' &&
82
- (item.sha256 === null || digest(item.sha256)),
83
- ),
84
- )
85
- )
86
- }
87
-
88
- export function readPortableExpoManifest(file: string): PortableExpoWorkspaceManifest {
89
- const value: unknown = JSON.parse(fs.readFileSync(file, 'utf8'))
90
- if (!isManifest(value))
91
- throw new Error(`invalid prepared Expo workspace manifest: ${file}`)
92
- return { ...value, podspecs: z.array(podspecReceiptSchema).parse(value.podspecs) }
93
- }
94
-
95
- export function portableInterfaceHash(directory: string): string {
96
- const hash = createHash('sha256')
97
- for (const entry of fs
98
- .readdirSync(directory, { withFileTypes: true })
99
- .sort((a, b) => a.name.localeCompare(b.name))) {
100
- if (!entry.isFile())
101
- throw new Error(`invalid prepared Swift interface: ${entry.name}`)
102
- const bytes = fs.readFileSync(path.join(directory, entry.name))
103
- hash
104
- .update(`${Buffer.byteLength(entry.name)}:${entry.name}:${bytes.length}:`)
105
- .update(bytes)
106
- }
107
- return hash.digest('hex')
108
- }
@@ -1,100 +0,0 @@
1
- import { createHash } from 'node:crypto'
2
- import fs from 'node:fs'
3
- import path from 'node:path'
4
- import { isRecord } from './is-record'
5
- import { readExpoConfigAsync } from './native-firebase-config'
6
- import { restoreEvaluatedPodspecs } from './podspec-sources'
7
- import { portableInterfaceHash, readPortableExpoManifest } from './portable-expo-contract'
8
- import { preparedNativeInventory } from './prepared-native-inventory'
9
- import { registerPreparedXcodePhases } from './prepared-xcode-phases'
10
- import { swiftDistributionAt } from './swift-compile'
11
- import { swiftDistributionRoot } from './swift-distribution'
12
-
13
- function stable(value: unknown, app: string): string {
14
- if (typeof value === 'string') return JSON.stringify(value.split(app).join('$APP'))
15
- if (Array.isArray(value)) return `[${value.map((item) => stable(item, app)).join(',')}]`
16
- if (isRecord(value))
17
- return `{${Object.keys(value)
18
- .sort()
19
- .map((key) => `${JSON.stringify(key)}:${stable(value[key], app)}`)
20
- .join(',')}}`
21
- return JSON.stringify(value) ?? 'null'
22
- }
23
-
24
- export async function portableExpoConfigHash(app: string): Promise<string> {
25
- const config = await readExpoConfigAsync(app)
26
- return createHash('sha256')
27
- .update(stable(config, fs.realpathSync(app)))
28
- .digest('hex')
29
- }
30
-
31
- function contained(root: string, relative: string): string {
32
- if (path.isAbsolute(relative))
33
- throw new Error(`absolute prepared workspace path: ${relative}`)
34
- const file = fs.realpathSync(path.resolve(root, relative))
35
- const within = path.relative(root, file)
36
- if (within === '..' || within.startsWith(`..${path.sep}`) || path.isAbsolute(within))
37
- throw new Error(`prepared workspace path escapes its archive: ${relative}`)
38
- return file
39
- }
40
-
41
- // the directory is supplied by the private producer's verified archive handoff.
42
- // a miss is an error: using a different app or silently preparing locally
43
- // would change the selected source graph.
44
- export async function portableExpoWorkspace(
45
- app: string,
46
- sourceHash: string,
47
- signal?: AbortSignal,
48
- ): Promise<{ app: string; workspace: string; work: string; identity: string }> {
49
- const directory = process.env.PEACH_PREPARED_NATIVE_WORKSPACES
50
- if (!directory) throw new Error(`missing prepared Expo workspace for ${sourceHash}`)
51
- const configHash = await portableExpoConfigHash(app)
52
- const mismatches: string[] = []
53
- for (const name of fs.readdirSync(directory).sort()) {
54
- signal?.throwIfAborted()
55
- const root = fs.realpathSync(path.join(directory, name))
56
- const file = path.join(root, 'manifest.json')
57
- if (!fs.existsSync(file)) continue
58
- const value = readPortableExpoManifest(file)
59
- if (value.sourceHash !== sourceHash) continue
60
- if (value.configHash !== configHash) {
61
- mismatches.push(
62
- `${name}: Expo config ${configHash} differs from ${value.configHash}`,
63
- )
64
- continue
65
- }
66
- const distribution = swiftDistributionAt(await swiftDistributionRoot(signal))
67
- if (!distribution) throw new Error('missing prepared Swift distribution')
68
- const { id } = distribution
69
- if (value.swiftDistribution !== id) {
70
- mismatches.push(
71
- `${name}: Swift distribution ${id} differs from ${value.swiftDistribution}`,
72
- )
73
- continue
74
- }
75
- const actual = await preparedNativeInventory(app, value.selected, signal)
76
- if (JSON.stringify(actual) !== JSON.stringify(value.inventory)) {
77
- const expected = new Map(value.inventory.map(({ name, sha256 }) => [name, sha256]))
78
- const found = new Map(actual.map(({ name, sha256 }) => [name, sha256]))
79
- const changed = [...new Set([...expected.keys(), ...found.keys()])].filter(
80
- (packageName) => expected.get(packageName) !== found.get(packageName),
81
- )
82
- mismatches.push(`${name}: native packages differ: ${changed.join(', ')}`)
83
- continue
84
- }
85
- const work = contained(root, 'work')
86
- const preparedApp = contained(work, value.app)
87
- const workspace = contained(work, value.workspace)
88
- const interfaces = contained(root, value.interfaces)
89
- const checkouts = contained(root, value.checkouts)
90
- if (portableInterfaceHash(interfaces) !== value.interfacesHash)
91
- throw new Error(`prepared Swift interface digest mismatch: ${interfaces}`)
92
- registerPreparedXcodePhases(work, value.phases, interfaces, checkouts, value.pins)
93
- for (const root of [app, preparedApp]) restoreEvaluatedPodspecs(root, value.podspecs)
94
- const identity = createHash('sha256').update(JSON.stringify(value)).digest('hex')
95
- return { app: preparedApp, workspace, work, identity }
96
- }
97
- throw new Error(
98
- `missing matching prepared Expo workspace for ${sourceHash}${mismatches.length ? ` (${mismatches.join('; ')})` : ''}`,
99
- )
100
- }
@@ -1,194 +0,0 @@
1
- import { createHash } from 'node:crypto'
2
- import fs from 'node:fs'
3
- import path from 'node:path'
4
-
5
- export interface PreparedXcodePhase {
6
- project: string
7
- target: string
8
- phase: string
9
- configuration: string
10
- outputs: { path: string; sha256: string | null }[]
11
- }
12
-
13
- export interface PreparedSwiftPin {
14
- identity: string
15
- location: string
16
- revision: string
17
- }
18
-
19
- const workspaces = new Map<
20
- string,
21
- {
22
- phases: PreparedXcodePhase[]
23
- interfaces: string
24
- checkouts: string
25
- pins: PreparedSwiftPin[]
26
- }
27
- >()
28
- let recording: { root: string; phases: PreparedXcodePhase[] } | undefined
29
-
30
- function relativeFile(root: string, file: string): string {
31
- const relative = path.relative(root, file)
32
- if (
33
- !relative ||
34
- relative === '..' ||
35
- relative.startsWith(`..${path.sep}`) ||
36
- path.isAbsolute(relative)
37
- )
38
- throw new Error(`prepared Xcode output is outside its workspace: ${file}`)
39
- return relative.split(path.sep).join('/')
40
- }
41
-
42
- function output(root: string, file: string) {
43
- const relative = relativeFile(root, file)
44
- const stat = fs.statSync(file, { throwIfNoEntry: false })
45
- if (!stat) return { path: relative, sha256: null }
46
- if (!stat.isFile()) throw new Error(`prepared Xcode output is not a file: ${file}`)
47
- relativeFile(root, fs.realpathSync(file))
48
- const bytes = fs.readFileSync(file)
49
- const prefix = Buffer.from(root)
50
- const hash = createHash('sha256')
51
- let offset = 0
52
- for (
53
- let index = bytes.indexOf(prefix);
54
- index !== -1;
55
- index = bytes.indexOf(prefix, offset)
56
- ) {
57
- hash.update(bytes.subarray(offset, index)).update('\0workspace\0')
58
- offset = index + prefix.length
59
- }
60
- hash.update(bytes.subarray(offset))
61
- return {
62
- path: relative,
63
- sha256: hash.digest('hex'),
64
- }
65
- }
66
-
67
- export async function recordPreparedXcodePhases<T>(root: string, run: () => T) {
68
- if (recording) throw new Error('already recording prepared Xcode phases')
69
- const current: { root: string; phases: PreparedXcodePhase[] } = {
70
- root: fs.realpathSync(root),
71
- phases: [],
72
- }
73
- recording = current
74
- try {
75
- const result = await run()
76
- return { result, phases: current.phases }
77
- } finally {
78
- recording = undefined
79
- }
80
- }
81
-
82
- export function registerPreparedXcodePhases(
83
- root: string,
84
- phases: PreparedXcodePhase[],
85
- interfaces: string,
86
- checkouts: string,
87
- pins: PreparedSwiftPin[],
88
- ) {
89
- workspaces.set(fs.realpathSync(root), { phases, interfaces, checkouts, pins })
90
- }
91
-
92
- export function preparedXcodeInterfaces(project: string): string | undefined {
93
- for (const [root, workspace] of workspaces) {
94
- const relative = path.relative(root, project)
95
- if (
96
- relative !== '..' &&
97
- !relative.startsWith(`..${path.sep}`) &&
98
- !path.isAbsolute(relative)
99
- )
100
- return workspace.interfaces
101
- }
102
- return undefined
103
- }
104
-
105
- export function preparedSwiftCheckouts(project: string): string | undefined {
106
- for (const [root, workspace] of workspaces) {
107
- const relative = path.relative(root, project)
108
- if (
109
- relative !== '..' &&
110
- !relative.startsWith(`..${path.sep}`) &&
111
- !path.isAbsolute(relative)
112
- )
113
- return workspace.checkouts
114
- }
115
- return undefined
116
- }
117
-
118
- export function preparedSwiftPin(
119
- checkouts: string,
120
- identity: string,
121
- location: string,
122
- revision: string,
123
- ): boolean {
124
- for (const workspace of workspaces.values()) {
125
- if (workspace.checkouts !== checkouts) continue
126
- const pin = workspace.pins.find((item) => item.identity === identity)
127
- if (!pin || pin.location !== location || pin.revision !== revision)
128
- throw new Error(`prepared Swift package pin mismatch: ${identity}`)
129
- if (!fs.existsSync(path.join(checkouts, identity, 'Package.swift')))
130
- throw new Error(`prepared Swift package is missing: ${identity}`)
131
- return true
132
- }
133
- return false
134
- }
135
-
136
- export function preparedXcodePhase(
137
- project: string,
138
- target: string,
139
- phase: string,
140
- configuration: string,
141
- outputs: string[],
142
- recorded: boolean,
143
- ): boolean {
144
- const root =
145
- recording?.root ??
146
- [...workspaces.keys()].find((root) => {
147
- const relative = path.relative(root, project)
148
- return (
149
- relative !== '..' &&
150
- !relative.startsWith(`..${path.sep}`) &&
151
- !path.isAbsolute(relative)
152
- )
153
- })
154
- if (!root) return false
155
- const entry = {
156
- project: relativeFile(root, project),
157
- target,
158
- phase,
159
- configuration,
160
- outputs: outputs.map((file) => output(root, file)),
161
- }
162
- if (recorded) {
163
- if (recording) {
164
- const previous = recording.phases.find(
165
- (item) =>
166
- item.project === entry.project &&
167
- item.target === target &&
168
- item.phase === phase &&
169
- item.configuration === configuration,
170
- )
171
- if (previous && JSON.stringify(previous.outputs) !== JSON.stringify(entry.outputs))
172
- throw new Error(
173
- `Xcode phase produced inconsistent outputs: ${project} ${target} ${phase}`,
174
- )
175
- if (!previous) recording.phases.push(entry)
176
- }
177
- return false
178
- }
179
- if (recording) return false
180
- const expected = workspaces
181
- .get(root)
182
- ?.phases.find(
183
- (item) =>
184
- item.project === entry.project &&
185
- item.target === target &&
186
- item.phase === phase &&
187
- item.configuration === configuration,
188
- )
189
- if (!expected || JSON.stringify(expected.outputs) !== JSON.stringify(entry.outputs))
190
- throw new Error(
191
- `prepared Xcode phase does not match its attested outputs: ${project} ${target} ${phase}`,
192
- )
193
- return true
194
- }