peachsim 0.1.1673 → 0.1.1674

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 (111) hide show
  1. package/cli/commands/inspect/settling.ts +37 -4
  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 +32 -9
  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 +39 -6
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/expo-swift-bundle.cjs +29 -6
  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 +34 -8
  32. package/dist-lib/host/fetch-proxy-handler.cjs +6 -3
  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 +43 -7
  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 +1 -1
  48. package/dist-lib/native-app-identity-project.cjs +1 -1
  49. package/dist-lib/native-app-identity-project.mjs +1 -1
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/plist.cjs +1 -1
  55. package/dist-lib/plist.mjs +1 -1
  56. package/dist-lib/profiles.cjs +1 -1
  57. package/dist-lib/public-brand.cjs +1 -1
  58. package/dist-lib/public-origins-lib-esm.json +23 -23
  59. package/dist-lib/public-origins-lib.json +52 -52
  60. package/dist-lib/react-native-host-modules.cjs +1 -1
  61. package/dist-lib/react-native-host-modules.mjs +1 -1
  62. package/dist-lib/reap-browser.cjs +1 -1
  63. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  64. package/dist-lib/sdk.cjs +38 -5
  65. package/dist-lib/sdk.mjs +38 -5
  66. package/dist-lib/skills.cjs +74 -15
  67. package/dist-lib/swift-compile.cjs +27 -5
  68. package/dist-lib/swift-compile.mjs +27 -5
  69. package/dist-lib/swift-package.cjs +23 -4
  70. package/dist-lib/swift-package.mjs +23 -4
  71. package/dist-lib/swift-submit.cjs +1 -1
  72. package/dist-lib/swift-submit.mjs +1 -1
  73. package/dist-lib/swift-toolchain.cjs +1 -1
  74. package/dist-lib/swift.cjs +1 -1
  75. package/dist-lib/vite-swift.cjs +29 -6
  76. package/dist-lib/vite.cjs +6 -3
  77. package/dist-lib/worklet-executable.cjs +1 -1
  78. package/dist-lib/worklet-executable.mjs +1 -1
  79. package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
  80. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -1
  81. package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +10 -1
  82. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  83. package/package.json +1 -1
  84. package/runtime-companion.json +1 -1
  85. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +18 -0
  86. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +23 -4
  87. package/sdk/ios/usr/include/_ctype.h +388 -0
  88. package/sdk/ios/usr/include/_inttypes.h +296 -0
  89. package/sdk/ios/usr/include/_locale.h +83 -0
  90. package/sdk/ios/usr/include/_locale_posix2008.h +65 -0
  91. package/sdk/ios/usr/include/_time.h +207 -0
  92. package/sdk/ios/usr/include/ctype.h +70 -0
  93. package/sdk/ios/usr/include/dispatch/dispatch.h +69 -6
  94. package/sdk/ios/usr/include/inttypes.h +35 -0
  95. package/sdk/ios/usr/include/locale.h +59 -0
  96. package/sdk/ios/usr/include/runetype.h +118 -0
  97. package/sdk/ios/usr/include/setjmp.h +99 -0
  98. package/sdk/ios/usr/include/sys/_types/_clock_t.h +32 -0
  99. package/sdk/ios/usr/include/sys/_types/_ct_rune_t.h +33 -0
  100. package/sdk/ios/usr/include/sys/_types/_rune_t.h +32 -0
  101. package/sdk/ios/usr/include/sys/_types/_time_t.h +32 -0
  102. package/sdk/ios/usr/include/sys/_types/_wint_t.h +33 -0
  103. package/sdk/ios/usr/include/sys/cdefs.h +2 -0
  104. package/sdk/ios/usr/include/time.h +67 -2
  105. package/src/host/rolldown-bundle-forward.ts +4 -1
  106. package/src/swift-compile.ts +2 -1
  107. package/src/swift-objc-compile.ts +7 -3
  108. package/src/swift-objc-metadata.ts +2 -2
  109. package/src/swift-objc-standin.ts +5 -0
  110. package/src/swift-package.ts +26 -3
  111. package/src/swift-standins.ts +4 -1
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2012 Apple Inc. All rights reserved.
3
+ *
4
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. The rights granted to you under the License
10
+ * may not be used to create, or enable the creation or redistribution of,
11
+ * unlawful or unlicensed copies of an Apple operating system, or to
12
+ * circumvent, violate, or enable the circumvention or violation of, any
13
+ * terms of an Apple operating system software license agreement.
14
+ *
15
+ * Please obtain a copy of the License at
16
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
17
+ *
18
+ * The Original Code and all software distributed under the License are
19
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23
+ * Please see the License for the specific language governing rights and
24
+ * limitations under the License.
25
+ *
26
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27
+ */
28
+
29
+ #ifndef _WINT_T
30
+ #define _WINT_T
31
+ #include <machine/_types.h> /* __darwin_wint_t */
32
+ typedef __darwin_wint_t wint_t;
33
+ #endif /* _WINT_T */
@@ -46,6 +46,8 @@
46
46
  #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
47
47
  #define __deprecated_enum_msg(_msg) __deprecated_msg(_msg)
48
48
  #define __unavailable __attribute__((__unavailable__))
49
+ #define __dead2 __attribute__((__noreturn__))
50
+ #define __pure2 __attribute__((__const__))
49
51
  #if __STDC_VERSION__ < 199901
50
52
  #define __restrict
51
53
  #else
@@ -1,2 +1,67 @@
1
- #pragma once
2
- typedef long time_t;
1
+ /*
2
+ * Copyright (c) 2000, 2023 Apple Computer, Inc. All rights reserved.
3
+ *
4
+ * @APPLE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://www.opensource.apple.com/apsl/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ *
21
+ * @APPLE_LICENSE_HEADER_END@
22
+ */
23
+ /*
24
+ * Copyright (c) 1989, 1993
25
+ * The Regents of the University of California. All rights reserved.
26
+ * (c) UNIX System Laboratories, Inc.
27
+ * All or some portions of this file are derived from material licensed
28
+ * to the University of California by American Telephone and Telegraph
29
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
30
+ * the permission of UNIX System Laboratories, Inc.
31
+ *
32
+ * Redistribution and use in source and binary forms, with or without
33
+ * modification, are permitted provided that the following conditions
34
+ * are met:
35
+ * 1. Redistributions of source code must retain the above copyright
36
+ * notice, this list of conditions and the following disclaimer.
37
+ * 2. Redistributions in binary form must reproduce the above copyright
38
+ * notice, this list of conditions and the following disclaimer in the
39
+ * documentation and/or other materials provided with the distribution.
40
+ * 3. All advertising materials mentioning features or use of this software
41
+ * must display the following acknowledgement:
42
+ * This product includes software developed by the University of
43
+ * California, Berkeley and its contributors.
44
+ * 4. Neither the name of the University nor the names of its contributors
45
+ * may be used to endorse or promote products derived from this software
46
+ * without specific prior written permission.
47
+ *
48
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58
+ * SUCH DAMAGE.
59
+ *
60
+ * @(#)time.h 8.3 (Berkeley) 1/21/94
61
+ */
62
+
63
+ #include <_time.h>
64
+
65
+ #ifdef _USE_EXTENDED_LOCALES_
66
+ #include <xlocale/_time.h>
67
+ #endif /* _USE_EXTENDED_LOCALES_ */
@@ -57,7 +57,10 @@ export async function forwardRolldownBundleResponse(
57
57
  }`
58
58
  console.error(`[peach] ${message}`)
59
59
  if (contentType.toLowerCase().includes('multipart/mixed')) {
60
- yield Buffer.from(inventory.multipartFailurePart(contentType, message), 'utf8')
60
+ yield Buffer.from(
61
+ inventory.multipartFailurePart(contentType, message, payload.slice(0, sent)),
62
+ 'utf8',
63
+ )
61
64
  return
62
65
  }
63
66
  res.statusCode = 500
@@ -41,7 +41,7 @@ import {
41
41
  swiftObjCPrivateImports,
42
42
  } from './swift-objc-import'
43
43
  import { validateObjcPeerStartupLibraries } from './swift-objc-metadata'
44
- import { materializeObjcSdk, objcView } from './swift-objc-standin'
44
+ import { materializeObjcSdk, objcView, WASI_EMULATION_FLAGS } from './swift-objc-standin'
45
45
  import {
46
46
  OBJC_RESOURCE_ACCESSOR_BODY,
47
47
  OBJC_RESOURCE_ACCESSOR_HEADER,
@@ -6879,6 +6879,7 @@ export function writeSwiftProject(
6879
6879
  '-fobjc-exceptions',
6880
6880
  '-fexceptions',
6881
6881
  '-fwasm-exceptions',
6882
+ ...WASI_EMULATION_FLAGS,
6882
6883
  '-fobjc-arc',
6883
6884
  '-fblocks',
6884
6885
  '-F',
@@ -11,7 +11,12 @@ import {
11
11
  ObjcPeerMetadataError,
12
12
  validateObjcPeerClasses,
13
13
  } from './swift-objc-metadata'
14
- import { IOS_SDK_ID, materializeObjcSdk, OBJC_IMPORT_VERSION } from './swift-objc-standin'
14
+ import {
15
+ IOS_SDK_ID,
16
+ materializeObjcSdk,
17
+ OBJC_IMPORT_VERSION,
18
+ WASI_EMULATION_FLAGS,
19
+ } from './swift-objc-standin'
15
20
  import { SWIFT_NATIVE_SOURCE_EXTENSIONS, swiftTargetModuleName } from './swift-package'
16
21
  import { swiftPackageManifest, swiftTargetFiles } from './swift-package-manifest'
17
22
  import { remoteSwiftCheckouts, type SwiftPackageBinary } from './swift-packages'
@@ -554,8 +559,7 @@ export function prepareXcodeObjCImplementations(
554
559
  `--sysroot=${sdk.sysroot}`,
555
560
  '-fwasm-exceptions',
556
561
  '-fexceptions',
557
- '-D_WASI_EMULATED_SIGNAL',
558
- '-D_WASI_EMULATED_MMAN',
562
+ ...WASI_EMULATION_FLAGS,
559
563
  `-D__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__=${minimum}`,
560
564
  `-D__IPHONE_OS_VERSION_MIN_REQUIRED=${minimum}`,
561
565
  ...(objc
@@ -8,6 +8,7 @@ import {
8
8
  IOS_SDK_ID,
9
9
  materializeObjcSdk,
10
10
  OBJC_IMPORT_VERSION,
11
+ WASI_EMULATION_FLAGS,
11
12
  objcView,
12
13
  type ObjcView,
13
14
  } from './swift-objc-standin'
@@ -433,8 +434,7 @@ export function compileObjcPeerMetadata(args: {
433
434
  `--sysroot=${args.sysroot}`,
434
435
  '-fwasm-exceptions',
435
436
  '-fexceptions',
436
- '-D_WASI_EMULATED_SIGNAL',
437
- '-D_WASI_EMULATED_MMAN',
437
+ ...WASI_EMULATION_FLAGS,
438
438
  `-D__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__=${args.minimum}`,
439
439
  `-D__IPHONE_OS_VERSION_MIN_REQUIRED=${args.minimum}`,
440
440
  '-fobjc-runtime=gnustep-2.2',
@@ -45,6 +45,11 @@ export const OBJC_IMPORT_VERSION = '4'
45
45
 
46
46
  export const NATIVE_GRAPH_SDK_VERSION = '27.1'
47
47
 
48
+ /** the installed libc's emulated surfaces: its signal.h is an #error without them,
49
+ * so every clang that builds original c or objective-c for wasm passes them. */
50
+ export const WASI_EMULATION = ['_WASI_EMULATED_SIGNAL', '_WASI_EMULATED_MMAN']
51
+ export const WASI_EMULATION_FLAGS = WASI_EMULATION.map((name) => `-D${name}`)
52
+
48
53
  const NATIVE_GRAPH_INPUTS = {
49
54
  sdk: NATIVE_GRAPH_SDK_VERSION,
50
55
  settings: 'e68503e5e534e9194af5efe8c636ca8b824e2d8237c5f38ec84aa4d155bc8418',
@@ -204,6 +204,15 @@ export function clangMacroSetting(macro: string): string {
204
204
  : `.define(${JSON.stringify(name)}, to: ${JSON.stringify(value.join('='))})`
205
205
  }
206
206
 
207
+ const swiftEscapes: Record<string, string> = {
208
+ '\\': '\\',
209
+ '"': '"',
210
+ "'": "'",
211
+ n: '\n',
212
+ r: '\r',
213
+ t: '\t',
214
+ }
215
+
207
216
  /**
208
217
  * the macros a target declares unconditionally in one tool's settings array,
209
218
  * as `NAME` or `NAME=value`. swiftSettings conditions never reach clang, and
@@ -225,9 +234,23 @@ function settingDefines(call: string, tool: 'swift' | 'c' | 'cxx'): string[] {
225
234
  }
226
235
  const body = call.slice(start, index - 1)
227
236
  for (const match of body.matchAll(
228
- /\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"([^"]*)"\s*)?\)/g,
229
- ))
230
- defines.push(match[2] === undefined ? match[1]! : `${match[1]}=${match[2]}`)
237
+ /\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"((?:[^"\\]|\\.)*)"\s*)?\)/g,
238
+ )) {
239
+ const name = match[1]!
240
+ // the value of a single-line swift string literal; interpolation, unicode and NUL escapes are refused, never dropped
241
+ defines.push(
242
+ match[2] === undefined
243
+ ? name
244
+ : `${name}=${match[2].replace(/\\(.)/g, (_, escape: string) => {
245
+ const value = swiftEscapes[escape]
246
+ if (value === undefined)
247
+ throw new Error(
248
+ `Unsupported escape \\${escape} in the value of macro ${name}`,
249
+ )
250
+ return value
251
+ })}`,
252
+ )
253
+ }
231
254
  }
232
255
  return defines
233
256
  }
@@ -31,6 +31,8 @@ import {
31
31
  IOS_SDK_ID,
32
32
  NATIVE_GRAPH_ID,
33
33
  OBJC_IMPORT_VERSION,
34
+ WASI_EMULATION,
35
+ WASI_EMULATION_FLAGS,
34
36
  nativeInterfaceView,
35
37
  objcView,
36
38
  type ObjcSurface,
@@ -48,7 +50,6 @@ import { sourceSwiftCheckout, swiftEnvironment, swiftSdkOptions } from './swift-
48
50
  import type { SwiftPackageBinary } from './swift-packages'
49
51
 
50
52
  const TRIPLE = 'wasm32-unknown-wasip1'
51
- const WASI_EMULATION = ['_WASI_EMULATED_SIGNAL', '_WASI_EMULATED_MMAN']
52
53
  // every stand-in artifact and temporary workspace belongs to peach.
53
54
  const cacheDir = path.join(peachCacheDir(), 'swift-standins')
54
55
  // each binary stand-in is a target under its module's directory here.
@@ -822,6 +823,7 @@ function cStandin(
822
823
  TRIPLE,
823
824
  '--sysroot',
824
825
  sysroot,
826
+ ...WASI_EMULATION_FLAGS,
825
827
  '-fsyntax-only',
826
828
  '-I',
827
829
  include,
@@ -897,6 +899,7 @@ function cStandin(
897
899
  TRIPLE,
898
900
  '--sysroot',
899
901
  sysroot,
902
+ ...WASI_EMULATION_FLAGS,
900
903
  '-fsyntax-only',
901
904
  '-I',
902
905
  include,