peachsim 0.1.2017 → 0.1.2019

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 (130) hide show
  1. package/cli/telemetry.ts +19 -0
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/attached-projects.cjs +1 -1
  5. package/dist-lib/auth/shared-session.cjs +1 -1
  6. package/dist-lib/backend-origin.cjs +1 -1
  7. package/dist-lib/beta.cjs +1 -1
  8. package/dist-lib/beta.mjs +1 -1
  9. package/dist-lib/bridge-constants.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.mjs +1 -1
  12. package/dist-lib/bridge-contract.cjs +1 -1
  13. package/dist-lib/bridge-contract.mjs +1 -1
  14. package/dist-lib/bundle-channel.cjs +379 -102
  15. package/dist-lib/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cloud-contract.cjs +1 -1
  18. package/dist-lib/cloud-contract.mjs +1 -1
  19. package/dist-lib/cloud-test-args.cjs +1 -1
  20. package/dist-lib/cloud-test-args.mjs +1 -1
  21. package/dist-lib/cloud.cjs +1 -1
  22. package/dist-lib/cloud.mjs +1 -1
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/config.mjs +1 -1
  25. package/dist-lib/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/expo-swift-bundle.cjs +373 -96
  28. package/dist-lib/expo-swift-metadata.cjs +1 -1
  29. package/dist-lib/expo-swift-metadata.mjs +1 -1
  30. package/dist-lib/home-paths.cjs +1 -1
  31. package/dist-lib/host/bridge-host.cjs +378 -101
  32. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  35. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  36. package/dist-lib/host/websocket-proxy.cjs +1 -1
  37. package/dist-lib/index.cjs +74 -15
  38. package/dist-lib/jump-to-source-babel.cjs +1 -1
  39. package/dist-lib/jump-to-source-native.cjs +1 -1
  40. package/dist-lib/kotlin-host.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +74 -15
  48. package/dist-lib/native-app-identity-project.cjs +72 -13
  49. package/dist-lib/native-app-identity-project.mjs +72 -12
  50. package/dist-lib/native-app-identity.cjs +5 -2
  51. package/dist-lib/native-app-identity.mjs +5 -2
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/pdfium-raster.cjs +1 -1
  55. package/dist-lib/pdfium-raster.mjs +1 -1
  56. package/dist-lib/plist.cjs +1 -1
  57. package/dist-lib/plist.mjs +1 -1
  58. package/dist-lib/profiles.cjs +1 -1
  59. package/dist-lib/public-brand.cjs +1 -1
  60. package/dist-lib/public-origins-lib-esm.json +24 -24
  61. package/dist-lib/public-origins-lib.json +53 -53
  62. package/dist-lib/react-native-host-modules.cjs +1 -1
  63. package/dist-lib/react-native-host-modules.mjs +1 -1
  64. package/dist-lib/reap-browser.cjs +1 -1
  65. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  66. package/dist-lib/sdk.cjs +1 -1
  67. package/dist-lib/sdk.mjs +1 -1
  68. package/dist-lib/skills.cjs +380 -103
  69. package/dist-lib/swift-compile.cjs +101 -66
  70. package/dist-lib/swift-compile.mjs +100 -65
  71. package/dist-lib/swift-package.cjs +1 -1
  72. package/dist-lib/swift-package.mjs +1 -1
  73. package/dist-lib/swift-submit.cjs +1 -1
  74. package/dist-lib/swift-submit.mjs +1 -1
  75. package/dist-lib/swift-toolchain.cjs +26 -1
  76. package/dist-lib/swift.cjs +1 -1
  77. package/dist-lib/vite-swift.cjs +372 -95
  78. package/dist-lib/vite.cjs +1 -1
  79. package/dist-lib/worklet-executable.cjs +1 -1
  80. package/dist-lib/worklet-executable.mjs +1 -1
  81. package/dist-types/packages/peach-engine/src/components/native-ui/context-menu-types.d.ts +84 -0
  82. package/dist-types/packages/peach-engine/src/engine/animated.d.ts +1 -1
  83. package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +4 -0
  84. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
  85. package/dist-types/packages/peach-engine/src/engine/rn-spring.d.ts +2 -2
  86. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
  87. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  88. package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +4 -1
  89. package/dist-types/packages/peach-engine/src/render-worker/native-menu-gesture.d.ts +6 -0
  90. package/package.json +1 -1
  91. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +1 -1
  92. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +2 -0
  93. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +10 -0
  94. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +28 -0
  95. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +1 -1
  96. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +16 -1
  97. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
  98. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +7 -0
  99. package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +3 -0
  100. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSPredicate.h +1 -1
  101. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSSortDescriptor.h +1 -1
  102. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSURLConnection.h +1 -1
  103. package/sdk/ios/System/Library/Frameworks/LocalAuthentication.framework/Headers/LAContext.h +1 -1
  104. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFAuthenticationSession.h +17 -0
  105. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SafariServices.h +1 -0
  106. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInputViewController.h +1 -1
  107. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPageViewController.h +1 -1
  108. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +1 -6
  109. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +1 -0
  110. package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +6 -0
  111. package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSession.h +1 -1
  112. package/sdk/ios/usr/include/objc/NSObject.h +1 -1
  113. package/sdk/ios/wasm/include/stdlib.h +1 -0
  114. package/src/nitro-adapter.lock.json +274 -274
  115. package/src/nitro-superset.lock.json +4 -4
  116. package/src/swift-compile.ts +70 -81
  117. package/src/swift-distribution.lock.json +14 -12
  118. package/src/swift-guest-image-ledger.ts +15 -10
  119. package/src/swift-guest-source-inputs.ts +6 -3
  120. package/src/swift-guest-source-plan.ts +5 -1
  121. package/src/swift-objc-compile.ts +2 -2
  122. package/src/swift-objc-standin.ts +197 -5
  123. package/src/swift-packages.ts +13 -12
  124. package/src/swift-shared-sdk.ts +2 -1
  125. package/src/swift-standin-emit.ts +43 -5
  126. package/src/swift-standins.ts +41 -2
  127. package/src/swift-toolchain.ts +24 -0
  128. package/src/turbo-runtime.lock.json +23 -23
  129. package/src/xcode-project.ts +55 -1
  130. package/src/xcode-target-members.ts +4 -0
@@ -273,14 +273,15 @@ const SWIFTPM_NOISE =
273
273
  /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/
274
274
 
275
275
  // compiler jobs match the fixture builder's cap to fit a 16GiB Linux slot, and
276
- // never exceed the cores an admitted build scope granted (TM_EXEC_CPU_CORES).
277
- const admittedCores = Number(process.env.TM_EXEC_CPU_CORES)
278
- export const SWIFT_BUILD_JOBS = Math.min(
279
- 4,
280
- Math.max(1, Math.floor(os.availableParallelism() / 2)),
281
- Number.isInteger(admittedCores) && admittedCores > 0 ? admittedCores : 4,
282
- )
283
- const BUILD_JOBS = String(SWIFT_BUILD_JOBS)
276
+ // never exceed the cores an admitted build scope granted.
277
+ export function swiftBuildJobs(): number {
278
+ const admittedCores = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES)
279
+ return Math.min(
280
+ 4,
281
+ Math.max(1, Math.floor(os.availableParallelism() / 2)),
282
+ Number.isInteger(admittedCores) && admittedCores > 0 ? admittedCores : 4,
283
+ )
284
+ }
284
285
 
285
286
  export interface SwiftCompileInput {
286
287
  files: Record<string, string>
@@ -1543,7 +1544,7 @@ const darwinRecordsRegion = (quoted: readonly string[]): string[] =>
1543
1544
  const REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n'
1544
1545
 
1545
1546
  /** bump with any change to the emitted multi-target manifest text. */
1546
- export const MULTI_MANIFEST_VERSION = 66
1547
+ export const MULTI_MANIFEST_VERSION = 68
1547
1548
  const SWIFT_HEADER_PRODUCTS_TARGET = 'PeachHeaderProducts'
1548
1549
 
1549
1550
  // build-cli replaces this in every bundle; source runs read the files directly.
@@ -1735,6 +1736,7 @@ export function emitSwiftPackageManifest(args: {
1735
1736
  packages?: ReadonlyMap<string, string>
1736
1737
  cxxLanguageStandard?: string
1737
1738
  native?: Map<string, SwiftNativeTargetPlan>
1739
+ sourceSwiftTargets?: ReadonlySet<string>
1738
1740
  headerDirectory?: string
1739
1741
  /** the objective-c runtime and sdk flags every original native unit compiles with. */
1740
1742
  nativeFlags?: Map<string, string[]>
@@ -1802,7 +1804,29 @@ export function emitSwiftPackageManifest(args: {
1802
1804
  if (distribution && distributionLink) {
1803
1805
  const isProvider = (object: string) =>
1804
1806
  object.startsWith(`lib/${DARWIN_RECORDS_PREFIX}`)
1805
- const available = distribution.objects.filter((object) => !isProvider(object))
1807
+ const sourceModules = new Set(
1808
+ targets
1809
+ .filter(
1810
+ (target) =>
1811
+ args.sourceSwiftTargets?.has(target.name) &&
1812
+ !args.native?.get(target.name)?.clang,
1813
+ )
1814
+ .map((target) => swiftTargetModuleName(target.name)),
1815
+ )
1816
+ const product = v.parse(
1817
+ swiftFrameworkProductSchema,
1818
+ JSON.parse(
1819
+ readFileSync(path.join(moduleRoot, SWIFT_FRAMEWORK_PRODUCT_FILE), 'utf8'),
1820
+ ),
1821
+ )
1822
+ const replacedObjects = new Set(
1823
+ product.objects
1824
+ .filter((object) => sourceModules.has(swiftTargetModuleName(object.target)))
1825
+ .map((object) => object.path),
1826
+ )
1827
+ const available = distribution.objects.filter(
1828
+ (object) => !isProvider(object) && !replacedObjects.has(object),
1829
+ )
1806
1830
  const objects = available.filter(
1807
1831
  (object) =>
1808
1832
  !targets.some((target) => object.startsWith(`lib/${target.name}-`)) &&
@@ -2304,26 +2328,6 @@ const OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g
2304
2328
  // compile naming itself.
2305
2329
  const DELEGATE_CLASS =
2306
2330
  /^class\s+[A-Za-z_]\w*\s*(?:<[^>{]*>)?\s*:[^{]*\b(?:UIApplicationDelegate|UISceneDelegate|UIWindowSceneDelegate)\b[^{]*\{/
2307
- // a table makes its cells and header footer views from their class, which
2308
- // here needs the initializer it calls to be required. a subclass's override
2309
- // of it says `required`, the same width: the cell's
2310
- // init(style:reuseIdentifier:) and the header footer view's
2311
- // init(reuseIdentifier:).
2312
- const REUSABLE_INIT =
2313
- /^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/
2314
- // a collection view makes its cells and supplementary views with
2315
- // init(frame:), so inside a class that inherits from one, directly or
2316
- // through a class declared earlier in the file, an override of it says
2317
- // `required` too. a class whose base is declared in another file is not
2318
- // seen and fails to compile.
2319
- const REUSABLE_VIEW_BASES = [
2320
- 'UICollectionReusableView',
2321
- 'UICollectionViewCell',
2322
- 'UICollectionViewListCell',
2323
- ]
2324
- const CLASS_BASE =
2325
- /^class\s+([A-Za-z_]\w*)\s*(?:<[^>{]*>)?\s*:\s*([A-Za-z_][\w.]*)[^{]*\{/
2326
- const FRAME_INIT = /^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*frame\s*:)/
2327
2331
  function compiledSwiftSources(
2328
2332
  files: Record<string, string>,
2329
2333
  targets: SwiftPackageTarget[],
@@ -3165,11 +3169,7 @@ const CORE_FOUNDATION_HANDLE_IMPORTS = [
3165
3169
 
3166
3170
  // the guest module that owns a name darwin's Foundation declares
3167
3171
  export function foundationOwnerOf(name: string): string | undefined {
3168
- if (
3169
- name === 'NSClassFromString' ||
3170
- name === 'NSKeyValueObservedChange' ||
3171
- name === 'NSKeyValueObservation'
3172
- )
3172
+ if (name === 'NSKeyValueObservedChange' || name === 'NSKeyValueObservation')
3173
3173
  return 'PeachObjC'
3174
3174
  if (name === 'DispatchData') return 'Dispatch'
3175
3175
  if (FOUNDATION_NETWORKING_TYPES.has(name)) return 'FoundationNetworking'
@@ -3206,11 +3206,6 @@ export function swiftSourceAsIOS(
3206
3206
  .join('\n')
3207
3207
  let out = ''
3208
3208
  let copied = 0
3209
- const reusableViews = new Set(REUSABLE_VIEW_BASES)
3210
- // the brace depth of each open reusable view class's body
3211
- const reusableBodies: number[] = []
3212
- let depth = 0
3213
- let opensReusableBody = false
3214
3209
  const sceneLifecycleBodies = new Set<number>()
3215
3210
  for (const at of tokens) {
3216
3211
  const rest = conditioned.slice(at, at + 400)
@@ -3221,24 +3216,6 @@ export function swiftSourceAsIOS(
3221
3216
  ' public var _peachUsesSceneLifecycle: Bool { true };'
3222
3217
  copied = at + 1
3223
3218
  }
3224
- depth++
3225
- if (opensReusableBody) reusableBodies.push(depth)
3226
- opensReusableBody = false
3227
- continue
3228
- }
3229
- if (rest.startsWith('}')) {
3230
- if (reusableBodies.at(-1) === depth) reusableBodies.pop()
3231
- depth--
3232
- continue
3233
- }
3234
- if (rest.startsWith('override')) {
3235
- if (
3236
- REUSABLE_INIT.test(rest) ||
3237
- (reusableBodies.at(-1) === depth && FRAME_INIT.test(rest))
3238
- ) {
3239
- out += `${conditioned.slice(copied, at)}required`
3240
- copied = at + 'override'.length
3241
- }
3242
3219
  continue
3243
3220
  }
3244
3221
  // keep Clang submodules the selected SDK actually owns. a framework
@@ -3316,11 +3293,6 @@ export function swiftSourceAsIOS(
3316
3293
  continue
3317
3294
  }
3318
3295
  if (rest.startsWith('class')) {
3319
- const declared = CLASS_BASE.exec(rest)
3320
- if (declared && reusableViews.has(declared[2]!.split('.').pop()!)) {
3321
- reusableViews.add(declared[1]!)
3322
- opensReusableBody = true
3323
- }
3324
3296
  const modifiers = conditioned.slice(conditioned.lastIndexOf('\n', at - 1) + 1, at)
3325
3297
  const delegateClass = DELEGATE_CLASS.exec(rest)
3326
3298
  if (delegateClass && /\bUIApplicationDelegate\b/.test(delegateClass[0])) {
@@ -4022,17 +3994,15 @@ function swiftCodeScan(source: string): {
4022
3994
  ? 'func'
4023
3995
  : source.startsWith('UIApplicationMain', i)
4024
3996
  ? 'UIApplicationMain'
4025
- : source.startsWith('NSClassFromString', i)
4026
- ? 'NSClassFromString'
4027
- : source.startsWith('Foundation', i)
4028
- ? 'Foundation'
4029
- : source.startsWith('CoreFoundation', i)
4030
- ? 'CoreFoundation'
4031
- : source.startsWith('ObjectiveC', i)
4032
- ? 'ObjectiveC'
4033
- : source.startsWith('_LocationEssentials', i)
4034
- ? '_LocationEssentials'
4035
- : null
3997
+ : source.startsWith('Foundation', i)
3998
+ ? 'Foundation'
3999
+ : source.startsWith('CoreFoundation', i)
4000
+ ? 'CoreFoundation'
4001
+ : source.startsWith('ObjectiveC', i)
4002
+ ? 'ObjectiveC'
4003
+ : source.startsWith('_LocationEssentials', i)
4004
+ ? '_LocationEssentials'
4005
+ : null
4036
4006
  if (
4037
4007
  keyword &&
4038
4008
  !/[\w$]/.test(source[i - 1] ?? '') &&
@@ -5320,6 +5290,7 @@ export function writeSwiftProject(
5320
5290
  )
5321
5291
  // an application's swift module must precede its native implementations.
5322
5292
  // the tiny executable calls the original typed entry after both are linked.
5293
+ const libraryEntryFiles = new Map<string, string>()
5323
5294
  for (const target of [...targets]) {
5324
5295
  if (
5325
5296
  !target.executable ||
@@ -5399,7 +5370,18 @@ export function writeSwiftProject(
5399
5370
  `mixed executable ${target.name} requires one typed Swift application entry`,
5400
5371
  )
5401
5372
  }
5402
- if (!nativeEntry) compiled.set(entryFile, entrySource)
5373
+ if (!nativeEntry) {
5374
+ compiled.set(entryFile, entrySource)
5375
+ if (path.basename(entryFile) === 'main.swift') {
5376
+ const libraryEntry = path.posix.join(
5377
+ path.posix.dirname(entryFile),
5378
+ 'PeachApplicationEntry.generated.swift',
5379
+ )
5380
+ if (Object.hasOwn(input.files, libraryEntry))
5381
+ throw new Error(`mixed application entry conflicts with ${libraryEntry}`)
5382
+ libraryEntryFiles.set(entryFile, libraryEntry)
5383
+ }
5384
+ }
5403
5385
  const name = `${target.name}Executable`
5404
5386
  if (targets.some((candidate) => candidate.name === name))
5405
5387
  throw new Error(`mixed application executable target conflicts with ${name}`)
@@ -5552,7 +5534,7 @@ export function writeSwiftProject(
5552
5534
  }
5553
5535
  for (const [file, contents] of Object.entries(input.files)) {
5554
5536
  if (file === 'Package.swift') continue
5555
- const destination = path.join(base, file)
5537
+ const destination = path.join(base, libraryEntryFiles.get(file) ?? file)
5556
5538
  const interfaceModule = /(?:^|\/)(\w+)-Swift\.h$/.exec(file)?.[1]
5557
5539
  // an installed binary's iOS header cannot describe the local Wasm
5558
5540
  // producer. its consumers use that producer's emitted compatibility
@@ -5662,9 +5644,16 @@ export function writeSwiftProject(
5662
5644
  emitSwiftPackageManifest({
5663
5645
  root: layout.root,
5664
5646
  files,
5665
- targets: manifestTargets,
5647
+ targets: manifestTargets.map((target) => ({
5648
+ ...target,
5649
+ sources: target.sources?.map((source) => {
5650
+ const entry = libraryEntryFiles.get(path.posix.join(target.path, source))
5651
+ return entry ? path.posix.relative(target.path, entry) : source
5652
+ }),
5653
+ })),
5666
5654
  packages,
5667
5655
  native,
5656
+ sourceSwiftTargets: swiftTargets,
5668
5657
  nativeFlags,
5669
5658
  nativeImportFlags,
5670
5659
  nativeHeaderFlags,
@@ -6428,7 +6417,7 @@ async function buildFrameworkProducts(
6428
6417
  '--build-system',
6429
6418
  'native',
6430
6419
  '-j',
6431
- BUILD_JOBS,
6420
+ String(swiftBuildJobs()),
6432
6421
  '--package-path',
6433
6422
  linkRoot,
6434
6423
  '--scratch-path',
@@ -6446,7 +6435,7 @@ async function buildFrameworkProducts(
6446
6435
  '-Xswiftc',
6447
6436
  '-num-threads',
6448
6437
  '-Xswiftc',
6449
- BUILD_JOBS,
6438
+ String(swiftBuildJobs()),
6450
6439
  ...swiftReproducibleBuildFlags([
6451
6440
  [path.dirname(args.toolchainBin), 'toolchain'],
6452
6441
  [args.moduleRoot, 'framework'],
@@ -7056,7 +7045,7 @@ function compileSwiftProjectOnce(
7056
7045
  '--build-system',
7057
7046
  'native',
7058
7047
  '-j',
7059
- BUILD_JOBS,
7048
+ String(swiftBuildJobs()),
7060
7049
  '--package-path',
7061
7050
  root,
7062
7051
  ...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
@@ -7071,7 +7060,7 @@ function compileSwiftProjectOnce(
7071
7060
  '-Xswiftc',
7072
7061
  '-num-threads',
7073
7062
  '-Xswiftc',
7074
- BUILD_JOBS,
7063
+ String(swiftBuildJobs()),
7075
7064
  ...swiftReproducibleBuildFlags([
7076
7065
  [path.dirname(options.toolchainBin), 'toolchain'],
7077
7066
  [frameworkRoot, 'framework'],
@@ -1,10 +1,10 @@
1
1
  {
2
- "id": "947d6fdb1f5cd39a",
3
- "release": "swift-6.4.0-RELEASE-custom-a560ff35bf882b5c",
4
- "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-a69fef5a",
5
- "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-a69fef5a.artifactbundle.tar.gz",
6
- "wasmSdkChecksum": "c345ff1a647e806d2ba554f927f8894572d3fb323f919c49a02d04b431bd8b48",
7
- "source": "81cb569bea1cff8c706e18e678834077bb70db5c",
2
+ "id": "e9ff5f11f9bc07c8",
3
+ "release": "swift-6.4.0-RELEASE-custom-11345d60dca47496",
4
+ "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-5e5960c3",
5
+ "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-5e5960c3.artifactbundle.tar.gz",
6
+ "wasmSdkChecksum": "be0b68da6af43e575e9f9daaae6239c92794159a85b910d7b4530e13117be579",
7
+ "source": "1be98e64083c03e076385a40ddfe6d111750a3cd",
8
8
  "targets": [
9
9
  "ImagePlayground",
10
10
  "QuickLookThumbnailing",
@@ -133,6 +133,7 @@
133
133
  "TOCropViewController",
134
134
  "RiveRuntime",
135
135
  "AVRouting",
136
+ "CoreDataConstants",
136
137
  "CoreData",
137
138
  "PDFKit",
138
139
  "ModelIOEnums",
@@ -187,6 +188,7 @@
187
188
  "ReplayKit",
188
189
  "CoreServices",
189
190
  "MobileCoreServices",
191
+ "CoreTelephonyConstants",
190
192
  "CoreTelephony",
191
193
  "SystemConfiguration",
192
194
  "ImageIO",
@@ -233,16 +235,16 @@
233
235
  },
234
236
  "hosts": {
235
237
  "darwin-arm64": {
236
- "sha256": "5f37d30f083bb872ed441a0558405feb00565bc5d433ded44c259f825880f0fe",
237
- "size": 99983632
238
+ "sha256": "3d6b7c9c47ee0e1e13c3e79bb6f92a9ee68862a27fc777f2e481c2beb7782ab9",
239
+ "size": 100088476
238
240
  },
239
241
  "linux-x64": {
240
- "sha256": "71cad8448706b2ffbb4634888038fefee94be0b6ceff93d3193e97d85acacfef",
241
- "size": 102700977
242
+ "sha256": "a9e4d05046d4105c3654808728396602eddb3012a2a1c174043dc2dc66781162",
243
+ "size": 102806849
242
244
  },
243
245
  "linux-arm64": {
244
- "sha256": "4949f854341ff2b625ae33d7a6d51e8f7fa38e0ba86c544d6005eb1d962f2a6d",
245
- "size": 102194427
246
+ "sha256": "ccc8ecbd37dd2aacf83efd1bcfeb6b2a0ff0ba3c50768217bdb6907618d1dca3",
247
+ "size": 102300527
246
248
  }
247
249
  }
248
250
  }
@@ -587,15 +587,20 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
587
587
  exported.set(definition.alias, definition)
588
588
  }
589
589
  const names = [...new Set([...exported.values()].map((definition) => definition.name))]
590
- const nameIndex = new Map(names.map((name, index) => [name, index]))
591
- const ir = ['target triple = "wasm32-unknown-wasip1"']
592
- names.forEach((name, index) => {
593
- const bytes = Buffer.concat([Buffer.from(name), Buffer.from([0])])
594
- const contents = [...bytes]
595
- .map((byte) => `\\${byte.toString(16).padStart(2, '0')}`)
596
- .join('')
597
- ir.push(`@.name${index} = private constant [${bytes.length} x i8] c"${contents}"`)
598
- })
590
+ const nameOffsets = new Map<string, number>()
591
+ let nameSize = 0
592
+ const nameContents = names
593
+ .map((name) => {
594
+ const bytes = Buffer.concat([Buffer.from(name), Buffer.from([0])])
595
+ nameOffsets.set(name, nameSize)
596
+ nameSize += bytes.length
597
+ return [...bytes].map((byte) => `\\${byte.toString(16).padStart(2, '0')}`).join('')
598
+ })
599
+ .join('')
600
+ const ir = [
601
+ 'target triple = "wasm32-unknown-wasip1"',
602
+ `@.names = private constant [${nameSize} x i8] c"${nameContents}"`,
603
+ ]
599
604
  for (const definition of exported.values()) {
600
605
  if (definition.kind === 'function')
601
606
  ir.push(
@@ -608,7 +613,7 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
608
613
  [...exported.values()]
609
614
  .map(
610
615
  (definition) =>
611
- ` { ptr, i32, ptr } { ptr @.name${nameIndex.get(definition.name)}, i32 ${definition.image}, ptr @${definition.alias} }`,
616
+ ` { ptr, i32, ptr } { ptr getelementptr (i8, ptr @.names, i32 ${nameOffsets.get(definition.name)}), i32 ${definition.image}, ptr @${definition.alias} }`,
612
617
  )
613
618
  .join(',\n'),
614
619
  )
@@ -319,10 +319,11 @@ export function sourceGuestRuntimeLinks(options: {
319
319
  const links: string[] = []
320
320
  const requests: GuestFrameworkRequest[] = []
321
321
  const optionGroups = [
322
- { object: null, flags: [...image.linkerFlags, ...autolink] },
323
- ...image.clangLinkOptions,
322
+ { object: null, flags: image.linkerFlags, autoLinked: false },
323
+ { object: null, flags: autolink, autoLinked: true },
324
+ ...image.clangLinkOptions.map((options) => ({ ...options, autoLinked: true })),
324
325
  ]
325
- for (const { object, flags } of optionGroups) {
326
+ for (const { object, flags, autoLinked } of optionGroups) {
326
327
  for (let index = 0; index < flags.length; index++) {
327
328
  const flag = flags[index]!
328
329
  const artifact = artifacts.get(flag)
@@ -339,6 +340,8 @@ export function sourceGuestRuntimeLinks(options: {
339
340
  if (flag === '-framework') {
340
341
  const name = flags[++index]
341
342
  const provider = name && frameworkAliases.get(name)
343
+ // autolinks are hints; wasm-ld already rejects any missing required symbol.
344
+ if (!provider && name && autoLinked) continue
342
345
  if (!provider)
343
346
  throw new Error(
344
347
  `source image ${image.id} has unresolved framework linkage ${name}`,
@@ -66,7 +66,11 @@ export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage
66
66
  const type = dependency.productType
67
67
  let dynamic: boolean
68
68
  if (type.startsWith('swiftpm.target.')) {
69
- if (type !== 'swiftpm.target.regular' && type !== 'swiftpm.target.binary')
69
+ if (
70
+ type !== 'swiftpm.target.regular' &&
71
+ type !== 'swiftpm.target.binary' &&
72
+ type !== 'swiftpm.target.system'
73
+ )
70
74
  throw new Error(`unsupported SwiftPM target ${edge.target}`)
71
75
  dynamic = false
72
76
  } else if (type.startsWith('swiftpm.library.')) {
@@ -7,7 +7,7 @@ import { cacheDir } from './home-paths'
7
7
  import { isRecord } from './is-record'
8
8
  import { DOUBLE_CONVERSION_WASM32_BACKPORT } from './nitro-dependencies'
9
9
  import {
10
- SWIFT_BUILD_JOBS,
10
+ swiftBuildJobs,
11
11
  swiftSdkPaths,
12
12
  swiftModuleSdk,
13
13
  swiftModuleDigest,
@@ -1502,7 +1502,7 @@ export async function prepareXcodeObjCImplementations(
1502
1502
  let interrupted = false
1503
1503
  await mapLimit(
1504
1504
  units,
1505
- SWIFT_BUILD_JOBS,
1505
+ swiftBuildJobs(),
1506
1506
  async ({ target, index, unit, file }, position) => {
1507
1507
  if (interrupted) return
1508
1508
  const minimum = minimums[index]!