peachsim 0.1.2429 → 0.1.2432
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/preview.ts +2 -1
- package/cli/outbound-endpoints.ts +10 -2
- 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 +15792 -5999
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +14638 -4887
- 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 +15465 -5754
- package/dist-lib/host/fetch-proxy-handler.cjs +3205 -54
- 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 +3542 -391
- 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 +3438 -287
- 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 +174 -81
- 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 +16787 -6994
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +95 -27
- package/dist-lib/vite.cjs +3331 -180
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/expo-native-workspace.ts +23 -63
- package/src/pbx-table.ts +200 -0
- package/src/pod-sources.ts +628 -0
- package/src/podfile-cocoapods.ts +40 -3
- package/src/pods-analysis.ts +488 -0
- package/src/pods-build-settings.ts +1015 -0
- package/src/pods-files.ts +478 -0
- package/src/pods-install.ts +475 -0
- package/src/pods-integration.ts +778 -0
- package/src/pods-post-install.ts +1811 -0
- package/src/pods-project.ts +2416 -0
- package/src/pods-scripts.ts +409 -0
- package/src/pods-targets.ts +757 -0
- package/src/pods-xcconfig.ts +198 -0
- package/src/podspec-cocoapods.ts +29 -3
- package/src/podspec-ruby-stdlib.ts +111 -10
- package/src/podspec-ruby.ts +52 -8
- package/src/swift-catalog-png.ts +75 -0
- package/src/swift-host.ts +4 -3
- package/src/swift-root-lock.ts +0 -10
- package/src/swift-source-pods.ts +29 -73
- package/src/turbo-source.ts +16 -37
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
// the files of a pod as CocoaPods 1.17 finds them: Sandbox::PathList's glob
|
|
2
|
+
// over the pod directory, Sandbox::FileAccessor's per-attribute patterns, and
|
|
3
|
+
// the linkage of vendored binaries and XCFrameworks it inspects.
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import { isRecord } from './is-record'
|
|
7
|
+
import { parsePlistBytes } from './plist-bytes'
|
|
8
|
+
import { type PodConsumer } from './pods-analysis'
|
|
9
|
+
|
|
10
|
+
// Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
|
|
11
|
+
export const HEADER_EXTENSIONS = [
|
|
12
|
+
'.h',
|
|
13
|
+
'.hh',
|
|
14
|
+
'.hpp',
|
|
15
|
+
'.ipp',
|
|
16
|
+
'.tpp',
|
|
17
|
+
'.hxx',
|
|
18
|
+
'.def',
|
|
19
|
+
'.inl',
|
|
20
|
+
'.inc',
|
|
21
|
+
]
|
|
22
|
+
export const SOURCE_FILE_EXTENSIONS = [
|
|
23
|
+
...new Set([
|
|
24
|
+
'.m',
|
|
25
|
+
'.mm',
|
|
26
|
+
'.i',
|
|
27
|
+
'.c',
|
|
28
|
+
'.cc',
|
|
29
|
+
'.cxx',
|
|
30
|
+
'.cpp',
|
|
31
|
+
'.c++',
|
|
32
|
+
'.swift',
|
|
33
|
+
...HEADER_EXTENSIONS,
|
|
34
|
+
]),
|
|
35
|
+
]
|
|
36
|
+
const GLOB_PATTERNS: Record<string, string> = {
|
|
37
|
+
source_files: `*{${SOURCE_FILE_EXTENSIONS.join(',')}}`,
|
|
38
|
+
public_header_files: `*{${HEADER_EXTENSIONS.join(',')}}`,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ruby orders strings by their bytes
|
|
42
|
+
const byBytes = (a: string, b: string) => Buffer.compare(Buffer.from(a), Buffer.from(b))
|
|
43
|
+
const upcaseOrder = (a: string, b: string) => byBytes(a.toUpperCase(), b.toUpperCase())
|
|
44
|
+
|
|
45
|
+
// File.fnmatch(pattern, path, FNM_CASEFOLD | FNM_PATHNAME): a wildcard never
|
|
46
|
+
// crosses a slash or matches a component's leading dot, and `**/` at the
|
|
47
|
+
// start of a component matches any run of visible directories.
|
|
48
|
+
function fnmatchRegExp(pattern: string): RegExp {
|
|
49
|
+
let source = ''
|
|
50
|
+
let start = true
|
|
51
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
52
|
+
const c = pattern[i]!
|
|
53
|
+
const hidden = start ? '(?!\\.)' : ''
|
|
54
|
+
if (c === '*' && pattern[i + 1] === '*' && pattern[i + 2] === '/' && start) {
|
|
55
|
+
source += '(?:(?!\\.)[^/]*/)*'
|
|
56
|
+
i += 2
|
|
57
|
+
start = true
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
if (c === '*') {
|
|
61
|
+
while (pattern[i + 1] === '*') i++
|
|
62
|
+
source += `${hidden}[^/]*`
|
|
63
|
+
} else if (c === '?') source += `${hidden}[^/]`
|
|
64
|
+
else if (c === '[') {
|
|
65
|
+
const end = pattern.indexOf(']', i + 2)
|
|
66
|
+
if (end === -1) source += '\\['
|
|
67
|
+
else {
|
|
68
|
+
let body = pattern.slice(i + 1, end)
|
|
69
|
+
const negated = body[0] === '!' || body[0] === '^'
|
|
70
|
+
if (negated) body = body.slice(1)
|
|
71
|
+
const escaped = body.replace(/\\(.)/g, '$1').replace(/[\\\]^]/g, '\\$&')
|
|
72
|
+
source += `${hidden}${negated ? `(?!/)[^${escaped}]` : `[${escaped}]`}`
|
|
73
|
+
i = end
|
|
74
|
+
}
|
|
75
|
+
} else if (c === '\\' && i + 1 < pattern.length)
|
|
76
|
+
source += pattern[++i]!.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')
|
|
77
|
+
else source += c.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')
|
|
78
|
+
start = c === '/'
|
|
79
|
+
}
|
|
80
|
+
return new RegExp(`^${source}$`, 'i')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// PathList#dir_glob_equivalent_patterns: `/**/` also matches one slash, and
|
|
84
|
+
// each brace set expands, since fnmatch alone expands neither
|
|
85
|
+
function equivalentPatterns(pattern: string): string[] {
|
|
86
|
+
const rewritten = pattern.replaceAll('/**/', '{/**/,/}')
|
|
87
|
+
const sets = new Map<string, string[]>()
|
|
88
|
+
for (const [set] of rewritten.matchAll(/\{[^}]*\}/g)) {
|
|
89
|
+
const values = set.replace(/[{}]/g, '').split(',')
|
|
90
|
+
while (values.length > 0 && values.at(-1) === '') values.pop()
|
|
91
|
+
sets.set(set, values)
|
|
92
|
+
}
|
|
93
|
+
let patterns = [rewritten]
|
|
94
|
+
for (const [set, values] of sets)
|
|
95
|
+
patterns = patterns.flatMap((old) =>
|
|
96
|
+
values.map((value) => old.replaceAll(set, value)),
|
|
97
|
+
)
|
|
98
|
+
return patterns
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface GlobOptions {
|
|
102
|
+
dirPattern?: string
|
|
103
|
+
excludePatterns?: string[]
|
|
104
|
+
includeDirs?: boolean
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Sandbox::PathList: every file and directory below a pod's root, as `Dir.glob('**\/*', File::FNM_DOTMATCH)` lists them. */
|
|
108
|
+
export class PathList {
|
|
109
|
+
#files: string[] | undefined
|
|
110
|
+
#dirs: string[] | undefined
|
|
111
|
+
#cache = new Map<string, string[]>()
|
|
112
|
+
|
|
113
|
+
constructor(readonly root: string) {}
|
|
114
|
+
|
|
115
|
+
#read() {
|
|
116
|
+
if (!fs.existsSync(this.root))
|
|
117
|
+
throw new Error(`Attempt to read non existent folder \`${this.root}\`.`)
|
|
118
|
+
const files: string[] = []
|
|
119
|
+
const dirs: string[] = []
|
|
120
|
+
// ruby's `**/` lists a symlinked directory but does not descend into it
|
|
121
|
+
const walk = (dir: string, prefix: string) => {
|
|
122
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
123
|
+
const rel = prefix + entry.name
|
|
124
|
+
const full = path.join(dir, entry.name)
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
dirs.push(rel)
|
|
127
|
+
walk(full, `${rel}/`)
|
|
128
|
+
} else if (
|
|
129
|
+
entry.isSymbolicLink() &&
|
|
130
|
+
fs.existsSync(full) &&
|
|
131
|
+
fs.statSync(full).isDirectory()
|
|
132
|
+
)
|
|
133
|
+
dirs.push(rel)
|
|
134
|
+
else files.push(rel)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
walk(this.root, '')
|
|
138
|
+
this.#files = files.sort(upcaseOrder)
|
|
139
|
+
this.#dirs = dirs.sort(upcaseOrder)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
get files(): string[] {
|
|
143
|
+
if (!this.#files) this.#read()
|
|
144
|
+
return this.#files!
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
get dirs(): string[] {
|
|
148
|
+
if (!this.#dirs) this.#read()
|
|
149
|
+
return this.#dirs!
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** absolute paths of the files, and with `includeDirs` directories, the patterns match. */
|
|
153
|
+
glob(patterns: string[], options: GlobOptions = {}): string[] {
|
|
154
|
+
const key = JSON.stringify([patterns, options])
|
|
155
|
+
let found = this.#cache.get(key)
|
|
156
|
+
if (!found) {
|
|
157
|
+
found = this.relativeGlob(patterns, options).map((rel) => path.join(this.root, rel))
|
|
158
|
+
this.#cache.set(key, found)
|
|
159
|
+
}
|
|
160
|
+
return found
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
relativeGlob(patterns: string[], options: GlobOptions = {}): string[] {
|
|
164
|
+
if (patterns.length === 0) return []
|
|
165
|
+
const all = options.includeDirs ? [...this.files, ...this.dirs] : this.files
|
|
166
|
+
const exact = new Set(all.filter((entry) => patterns.includes(entry)))
|
|
167
|
+
let list = patterns.flatMap((pattern) => {
|
|
168
|
+
if (exact.has(pattern)) return [pattern]
|
|
169
|
+
let expanded = pattern
|
|
170
|
+
if (options.dirPattern && this.#isDirectory(pattern)) {
|
|
171
|
+
if (!expanded.endsWith('/')) expanded += '/'
|
|
172
|
+
expanded += options.dirPattern
|
|
173
|
+
}
|
|
174
|
+
const matchers = equivalentPatterns(expanded).map(fnmatchRegExp)
|
|
175
|
+
return all.filter((entry) => matchers.some((matcher) => matcher.test(entry)))
|
|
176
|
+
})
|
|
177
|
+
if (options.excludePatterns) {
|
|
178
|
+
const excluded = new Set(
|
|
179
|
+
this.relativeGlob(options.excludePatterns, {
|
|
180
|
+
dirPattern: '**/*',
|
|
181
|
+
includeDirs: options.includeDirs,
|
|
182
|
+
}),
|
|
183
|
+
)
|
|
184
|
+
list = list.filter((entry) => !excluded.has(entry))
|
|
185
|
+
}
|
|
186
|
+
return list
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
#isDirectory(sub: string): boolean {
|
|
190
|
+
const wanted = sub.toLowerCase().replace(/\/$/, '')
|
|
191
|
+
return this.dirs.some((dir) => dir.toLowerCase() === wanted)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const unique = <T>(values: T[]) => [...new Set(values)]
|
|
196
|
+
|
|
197
|
+
/** Xcode::LinkageAnalyzer.dynamic_binary?: a Mach-O (or a fat file's first slice) of type MH_DYLIB. */
|
|
198
|
+
export function dynamicBinary(file: string): boolean {
|
|
199
|
+
if (!fs.existsSync(file) || !fs.statSync(file).isFile()) return false
|
|
200
|
+
const bytes = fs.readFileSync(file)
|
|
201
|
+
if (bytes.length < 4) return false
|
|
202
|
+
let offset = 0
|
|
203
|
+
const fat = bytes.readUInt32BE(0)
|
|
204
|
+
if (fat === 0xcafebabe || fat === 0xcafebabf) {
|
|
205
|
+
if (bytes.readUInt32BE(4) === 0) return false
|
|
206
|
+
offset =
|
|
207
|
+
fat === 0xcafebabe
|
|
208
|
+
? bytes.readUInt32BE(8 + 8)
|
|
209
|
+
: Number(bytes.readBigUInt64BE(8 + 8))
|
|
210
|
+
}
|
|
211
|
+
if (bytes.length < offset + 16) return false
|
|
212
|
+
const magic = bytes.readUInt32BE(offset)
|
|
213
|
+
const little = magic === 0xcefaedfe || magic === 0xcffaedfe
|
|
214
|
+
const big = magic === 0xfeedface || magic === 0xfeedfacf
|
|
215
|
+
if (!little && !big) return false
|
|
216
|
+
const filetype = little
|
|
217
|
+
? bytes.readUInt32LE(offset + 12)
|
|
218
|
+
: bytes.readUInt32BE(offset + 12)
|
|
219
|
+
return filetype === 6
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface XCFrameworkSlice {
|
|
223
|
+
path: string
|
|
224
|
+
identifier: string
|
|
225
|
+
platform: string
|
|
226
|
+
platformVariant: string | null
|
|
227
|
+
supportedArchs: string[]
|
|
228
|
+
headers: string
|
|
229
|
+
packaging: 'framework' | 'library'
|
|
230
|
+
dynamic: boolean
|
|
231
|
+
binaryPath: string
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Xcode::XCFramework: its slices sorted by identifier, typed by the first. */
|
|
235
|
+
export class XCFramework {
|
|
236
|
+
readonly slices: XCFrameworkSlice[]
|
|
237
|
+
constructor(
|
|
238
|
+
readonly targetName: string,
|
|
239
|
+
readonly path: string,
|
|
240
|
+
) {
|
|
241
|
+
const plist = parsePlistBytes(fs.readFileSync(`${path}/Info.plist`))
|
|
242
|
+
if (!isRecord(plist) || !Array.isArray(plist.AvailableLibraries))
|
|
243
|
+
throw new Error(`${path}/Info.plist declares no AvailableLibraries`)
|
|
244
|
+
this.slices = plist.AvailableLibraries.map((library: unknown): XCFrameworkSlice => {
|
|
245
|
+
if (
|
|
246
|
+
!isRecord(library) ||
|
|
247
|
+
typeof library.LibraryIdentifier !== 'string' ||
|
|
248
|
+
typeof library.LibraryPath !== 'string' ||
|
|
249
|
+
typeof library.SupportedPlatform !== 'string'
|
|
250
|
+
)
|
|
251
|
+
throw new Error(`${path}/Info.plist has an invalid library entry`)
|
|
252
|
+
const root = `${path}/${library.LibraryIdentifier}`
|
|
253
|
+
const slicePath = `${root}/${library.LibraryPath}`
|
|
254
|
+
const extension = slicePath.slice(slicePath.lastIndexOf('.'))
|
|
255
|
+
const packaging =
|
|
256
|
+
extension === '.framework'
|
|
257
|
+
? 'framework'
|
|
258
|
+
: extension === '.a' || extension === '.dylib'
|
|
259
|
+
? 'library'
|
|
260
|
+
: null
|
|
261
|
+
if (!packaging) throw new Error(`Invalid XCFramework slice type \`${extension}\``)
|
|
262
|
+
const binaryPath =
|
|
263
|
+
packaging === 'framework'
|
|
264
|
+
? `${slicePath}/${slicePath.slice(slicePath.lastIndexOf('/') + 1, -'.framework'.length)}`
|
|
265
|
+
: slicePath
|
|
266
|
+
return {
|
|
267
|
+
path: slicePath,
|
|
268
|
+
identifier: library.LibraryIdentifier,
|
|
269
|
+
platform: library.SupportedPlatform,
|
|
270
|
+
platformVariant:
|
|
271
|
+
typeof library.SupportedPlatformVariant === 'string'
|
|
272
|
+
? library.SupportedPlatformVariant
|
|
273
|
+
: null,
|
|
274
|
+
supportedArchs: Array.isArray(library.SupportedArchitectures)
|
|
275
|
+
? library.SupportedArchitectures.filter(
|
|
276
|
+
(arch: unknown): arch is string => typeof arch === 'string',
|
|
277
|
+
)
|
|
278
|
+
: [],
|
|
279
|
+
headers:
|
|
280
|
+
typeof library.HeadersPath === 'string'
|
|
281
|
+
? `${root}/${library.HeadersPath}`
|
|
282
|
+
: `${slicePath}/Headers`,
|
|
283
|
+
packaging,
|
|
284
|
+
dynamic: dynamicBinary(binaryPath),
|
|
285
|
+
binaryPath,
|
|
286
|
+
}
|
|
287
|
+
}).sort((a, b) => byBytes(a.identifier, b.identifier))
|
|
288
|
+
if (this.slices.length === 0)
|
|
289
|
+
throw new Error(
|
|
290
|
+
`XCFramework at ${path} does not contain any frameworks or libraries.`,
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
get name(): string {
|
|
295
|
+
return this.path.slice(this.path.lastIndexOf('/') + 1).replace(/\.xcframework$/, '')
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
get dynamic(): boolean {
|
|
299
|
+
return this.slices[0]!.dynamic
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
get packaging(): 'framework' | 'library' {
|
|
303
|
+
return this.slices[0]!.packaging
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Sandbox::FileAccessor for one spec on the pod's platform. */
|
|
308
|
+
export class FileAccessor {
|
|
309
|
+
constructor(
|
|
310
|
+
readonly pathList: PathList,
|
|
311
|
+
readonly specName: string,
|
|
312
|
+
readonly consumer: PodConsumer,
|
|
313
|
+
) {}
|
|
314
|
+
|
|
315
|
+
get root(): string {
|
|
316
|
+
return this.pathList.root
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
#paths(patterns: string[], options: GlobOptions): string[] {
|
|
320
|
+
if (patterns.length === 0) return []
|
|
321
|
+
return unique(this.pathList.glob(patterns, options))
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
#forAttribute(patterns: string[], dirPattern: string | undefined, includeDirs = false) {
|
|
325
|
+
return this.#paths(patterns, {
|
|
326
|
+
excludePatterns: this.consumer.exclude_files,
|
|
327
|
+
dirPattern,
|
|
328
|
+
includeDirs,
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
get sourceFiles(): string[] {
|
|
333
|
+
return this.#forAttribute(this.consumer.source_files, GLOB_PATTERNS.source_files)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
get arcSourceFiles(): string[] {
|
|
337
|
+
const arc = this.consumer.requires_arc
|
|
338
|
+
if (arc === true) return this.sourceFiles
|
|
339
|
+
if (arc === false) return []
|
|
340
|
+
const matched = new Set(
|
|
341
|
+
this.#forAttribute(typeof arc === 'string' ? [arc] : arc, undefined),
|
|
342
|
+
)
|
|
343
|
+
return this.sourceFiles.filter((file) => matched.has(file))
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
get nonArcSourceFiles(): string[] {
|
|
347
|
+
const arc = new Set(this.arcSourceFiles)
|
|
348
|
+
return this.sourceFiles.filter((file) => !arc.has(file))
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
get headers(): string[] {
|
|
352
|
+
return this.sourceFiles.filter((file) =>
|
|
353
|
+
HEADER_EXTENSIONS.includes(path.extname(file)),
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
get publicHeaderFiles(): string[] {
|
|
358
|
+
return this.#forAttribute(
|
|
359
|
+
this.consumer.public_header_files,
|
|
360
|
+
GLOB_PATTERNS.public_header_files,
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
get projectHeaders(): string[] {
|
|
365
|
+
return this.#forAttribute(this.consumer.project_header_files, undefined)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
get privateHeaders(): string[] {
|
|
369
|
+
return this.#forAttribute(this.consumer.private_header_files, undefined)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
publicHeaders(includeFrameworks = false): string[] {
|
|
373
|
+
const declared = this.publicHeaderFiles
|
|
374
|
+
let files = declared.length === 0 ? this.headers : declared
|
|
375
|
+
if (includeFrameworks) files = [...files, ...this.vendoredFrameworksHeaders]
|
|
376
|
+
const hidden = new Set([...this.projectHeaders, ...this.privateHeaders])
|
|
377
|
+
return files.filter((file) => !hidden.has(file))
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
get resources(): string[] {
|
|
381
|
+
return this.#forAttribute(this.consumer.resources, undefined, true)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
get preservePaths(): string[] {
|
|
385
|
+
return this.#forAttribute(this.consumer.preserve_paths, undefined, true)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
get vendoredFrameworks(): string[] {
|
|
389
|
+
return this.#forAttribute(this.consumer.vendored_frameworks, undefined, true)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
get vendoredXCFrameworks(): string[] {
|
|
393
|
+
return this.vendoredFrameworks.filter(
|
|
394
|
+
(framework) => path.extname(framework) === '.xcframework',
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
get vendoredDynamicFrameworks(): string[] {
|
|
399
|
+
const xcframeworks = new Set(this.vendoredXCFrameworks)
|
|
400
|
+
return this.vendoredFrameworks.filter(
|
|
401
|
+
(framework) =>
|
|
402
|
+
!xcframeworks.has(framework) &&
|
|
403
|
+
dynamicBinary(
|
|
404
|
+
path.join(framework, path.basename(framework, path.extname(framework))),
|
|
405
|
+
),
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
get vendoredStaticFrameworks(): string[] {
|
|
410
|
+
const excluded = new Set([
|
|
411
|
+
...this.vendoredDynamicFrameworks,
|
|
412
|
+
...this.vendoredXCFrameworks,
|
|
413
|
+
])
|
|
414
|
+
return this.vendoredFrameworks.filter((framework) => !excluded.has(framework))
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
get vendoredFrameworksHeaders(): string[] {
|
|
418
|
+
const headersIn = (framework: string) => {
|
|
419
|
+
const dir = path.join(framework, 'Headers')
|
|
420
|
+
const root =
|
|
421
|
+
fs.existsSync(dir) && fs.statSync(dir).isDirectory() ? fs.realpathSync(dir) : dir
|
|
422
|
+
return fs.existsSync(root)
|
|
423
|
+
? new PathList(root).glob([`**/${GLOB_PATTERNS.public_header_files}`])
|
|
424
|
+
: []
|
|
425
|
+
}
|
|
426
|
+
const xcframeworks = new Set(this.vendoredXCFrameworks)
|
|
427
|
+
const paths = unique(
|
|
428
|
+
this.vendoredFrameworks.filter((f) => !xcframeworks.has(f)).flatMap(headersIn),
|
|
429
|
+
)
|
|
430
|
+
return [
|
|
431
|
+
...paths,
|
|
432
|
+
...this.vendoredXCFrameworks.flatMap((framework) =>
|
|
433
|
+
new XCFramework(this.specName, framework).slices.flatMap((slice) =>
|
|
434
|
+
headersIn(slice.path),
|
|
435
|
+
),
|
|
436
|
+
),
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
get vendoredLibraries(): string[] {
|
|
441
|
+
return this.#forAttribute(this.consumer.vendored_libraries, undefined)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
get vendoredDynamicLibraries(): string[] {
|
|
445
|
+
return this.vendoredLibraries.filter(dynamicBinary)
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
get vendoredStaticLibraries(): string[] {
|
|
449
|
+
const dynamic = new Set(this.vendoredDynamicLibraries)
|
|
450
|
+
return this.vendoredLibraries.filter((library) => !dynamic.has(library))
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
get vendoredDynamicArtifacts(): string[] {
|
|
454
|
+
return [...this.vendoredDynamicLibraries, ...this.vendoredDynamicFrameworks]
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
get resourceBundles(): Record<string, string[]> {
|
|
458
|
+
return Object.fromEntries(
|
|
459
|
+
Object.entries(this.consumer.resource_bundles).map(([name, patterns]) => [
|
|
460
|
+
name,
|
|
461
|
+
this.#paths(typeof patterns === 'string' ? [patterns] : patterns, {
|
|
462
|
+
excludePatterns: this.consumer.exclude_files,
|
|
463
|
+
includeDirs: true,
|
|
464
|
+
}),
|
|
465
|
+
]),
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
get prefixHeader(): string | null {
|
|
470
|
+
const file = this.consumer.prefix_header_file
|
|
471
|
+
return typeof file === 'string' ? path.join(this.root, file) : null
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
get moduleMap(): string | null {
|
|
475
|
+
const file = this.consumer.module_map
|
|
476
|
+
return typeof file === 'string' ? path.join(this.root, file) : null
|
|
477
|
+
}
|
|
478
|
+
}
|